:root {
  color-scheme: dark;
  --bg-0: #050514;
  --bg-1: #0a0c20;
  --bg-2: #131634;
  --line-soft: rgba(120, 150, 220, 0.10);
  --line: rgba(120, 150, 220, 0.18);
  --line-strong: rgba(120, 150, 220, 0.32);
  --text: #f4f7ff;
  --muted: #8d96b8;
  --muted-soft: #6f779a;
  --accent: #6e8cff;
  --accent-strong: #4060ff;
  --accent-soft: rgba(110, 140, 255, 0.14);
  --healthy: #5af2c2;
  --healthy-soft: rgba(90, 242, 194, 0.18);
  --warn: #ffc36e;
  --warn-soft: rgba(255, 195, 110, 0.18);
  --danger: #ff6c7a;
  --danger-soft: rgba(255, 108, 122, 0.18);
  --purple: #c382ff;
  --pink: #ff7fb5;
  --shadow-lg: 0 32px 80px -20px rgba(0, 0, 0, 0.7);
  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --font-sans: "Inter", "Segoe UI", system-ui, sans-serif;
  --font-display: "Space Grotesk", "Inter", sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--bg-0);
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  background:
    radial-gradient(60vmax 50vmax at 12% -8%, rgba(110, 140, 255, 0.18), transparent 55%),
    radial-gradient(45vmax 50vmax at 110% 0%, rgba(195, 130, 255, 0.14), transparent 55%),
    radial-gradient(55vmax 60vmax at 0% 110%, rgba(90, 242, 194, 0.10), transparent 55%),
    var(--bg-0);
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    linear-gradient(rgba(110,140,255,0.020) 1px, transparent 1px),
    linear-gradient(90deg, rgba(110,140,255,0.020) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(circle at center, black 10%, transparent 80%);
}

a { color: inherit; text-decoration: none; }

h1, h2, h3, p { margin: 0; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}

.muted { color: var(--muted); }
.mono { font-family: var(--font-mono); }

/* Login --------------------------------------------------- */
.login-shell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  z-index: 1;
}

.login-card {
  width: 100%;
  max-width: 440px;
  padding: 32px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(20, 22, 56, 0.85), rgba(8, 10, 28, 0.85));
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  box-shadow: var(--shadow-lg);
}

.login-card h1 {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 12px;
}

.login-card .lead {
  color: var(--muted);
  margin: 8px 0 24px;
}

.login-form {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 6px;
}

.field span {
  font-size: 0.74rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  font-family: var(--font-display);
}

.field input,
.search-input input {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(6, 8, 24, 0.7);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.field input:focus,
.search-input input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: rgba(8, 12, 32, 0.85);
}

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  padding: 11px 18px;
  font-family: var(--font-display);
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.06s ease, filter 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
  color: #fff;
  box-shadow: 0 8px 24px -10px var(--accent);
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn-ghost {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border-color: var(--line);
}
.btn-ghost:hover:not(:disabled) { background: rgba(255, 255, 255, 0.08); }
.btn-danger {
  background: linear-gradient(180deg, var(--danger), #c43c4a);
  color: #fff;
}

.flash {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  margin-bottom: 14px;
}
.flash-error {
  background: var(--danger-soft);
  border: 1px solid rgba(255, 108, 122, 0.4);
  color: #ffd4d8;
}
.flash-ok {
  background: rgba(125, 211, 252, 0.1);
  border: 1px solid rgba(125, 211, 252, 0.4);
  color: #cbeafe;
}

/* Dashboard layout --------------------------------------- */
.app-shell {
  position: relative;
  display: grid;
  grid-template-columns: 268px 1fr;
  min-height: 100vh;
  z-index: 1;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(10, 12, 32, 0.95), rgba(6, 8, 22, 0.95));
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  gap: 16px;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(140deg, var(--accent), var(--purple));
  display: grid;
  place-items: center;
  color: #0a0c20;
  font-weight: 800;
  font-family: var(--font-display);
  box-shadow: 0 12px 26px -10px var(--accent);
}

.brand-info { display: grid; gap: 2px; }
.brand-name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
}
.brand-domain {
  font-size: 0.75rem;
  color: var(--muted);
  font-family: var(--font-mono);
}

.live-card {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--line);
}

.live-card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
}

.live-clock {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--healthy);
  box-shadow: 0 0 0 0 var(--healthy);
  animation: pulse 1.8s infinite;
  display: inline-block;
}
.status-dot.is-warning { background: var(--warn); animation-name: pulse-warn; }
.status-dot.is-critical { background: var(--danger); animation-name: pulse-danger; }

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(90, 242, 194, 0.5); }
  70% { box-shadow: 0 0 0 8px rgba(90, 242, 194, 0); }
  100% { box-shadow: 0 0 0 0 rgba(90, 242, 194, 0); }
}
@keyframes pulse-warn {
  0% { box-shadow: 0 0 0 0 rgba(255, 195, 110, 0.5); }
  70% { box-shadow: 0 0 0 8px rgba(255, 195, 110, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 195, 110, 0); }
}
@keyframes pulse-danger {
  0% { box-shadow: 0 0 0 0 rgba(255, 108, 122, 0.5); }
  70% { box-shadow: 0 0 0 8px rgba(255, 108, 122, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 108, 122, 0); }
}

.sidebar-nav {
  display: grid;
  gap: 2px;
  margin-top: 4px;
}

.nav-group-label {
  font-family: var(--font-display);
  font-size: 0.66rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted-soft);
  margin: 8px 8px 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 130ms ease, background 130ms ease, transform 130ms ease;
  border: 1px solid transparent;
}

.nav-link:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  transform: translateX(2px);
}

.nav-link.is-active {
  color: var(--text);
  background: var(--accent-soft);
  border-color: rgba(110, 140, 255, 0.32);
}

.nav-icon {
  width: 18px;
  height: 18px;
  display: inline-block;
  flex-shrink: 0;
}

.sidebar-bottom {
  margin-top: auto;
  display: grid;
  gap: 8px;
}

.search-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 130ms ease;
}
.search-trigger:hover { background: rgba(255, 255, 255, 0.06); }

.kbd {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  color: var(--muted);
}

/* Main content -------------------------------------------- */
.main {
  padding: 28px 32px 60px;
  min-width: 0;
  position: relative;
  z-index: 1;
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}

.page-title {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.1;
}

.page-subtitle {
  color: var(--muted);
  margin-top: 6px;
  font-size: 0.95rem;
}

.last-updated {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}

/* Cards ---------------------------------------------------- */
.card {
  position: relative;
  padding: 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(20, 24, 60, 0.55), rgba(10, 12, 32, 0.55));
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  box-shadow: 0 12px 28px -10px rgba(0, 0, 0, 0.5);
}
.card-pad-sm { padding: 14px; }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.card-header-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.card-grid {
  display: grid;
  gap: 16px;
}
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.kpi {
  display: grid;
  gap: 8px;
}

.kpi-label {
  font-family: var(--font-display);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.kpi-value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.kpi-value.sm { font-size: 1.4rem; }
.kpi-value.healthy { color: var(--healthy); }
.kpi-value.warn { color: var(--warn); }
.kpi-value.critical { color: var(--danger); }

.kpi-meta {
  font-size: 0.85rem;
  color: var(--muted);
  font-family: var(--font-mono);
}

/* Bar / progress ------------------------------------------ */
.bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
  position: relative;
}
.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #99b3ff);
  transition: width 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.bar-fill.warn { background: linear-gradient(90deg, var(--warn), #ffd998); }
.bar-fill.critical { background: linear-gradient(90deg, var(--danger), #ffabab); }
.bar-fill.healthy { background: linear-gradient(90deg, var(--healthy), #a7ffd9); }

/* Table --------------------------------------------------- */
.table {
  width: 100%;
  border-collapse: collapse;
}
.table th, .table td {
  padding: 11px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line-soft);
  font-size: 0.86rem;
  vertical-align: middle;
}
.table th {
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.table td {
  font-family: var(--font-mono);
  font-size: 0.83rem;
}
.table td.label, .table td.thin { font-family: var(--font-sans); font-size: 0.86rem; }
.table tr:last-child td { border-bottom: 0; }

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.012);
}

/* Badge --------------------------------------------------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
  font-family: var(--font-display);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
}
.chip.is-healthy { background: var(--healthy-soft); color: var(--healthy); border-color: rgba(90, 242, 194, 0.4); }
.chip.is-warn { background: var(--warn-soft); color: var(--warn); border-color: rgba(255, 195, 110, 0.4); }
.chip.is-critical { background: var(--danger-soft); color: var(--danger); border-color: rgba(255, 108, 122, 0.4); }
.chip.is-info { background: var(--accent-soft); color: var(--accent); border-color: rgba(110, 140, 255, 0.4); }
.chip.is-mute { color: var(--muted); }

/* Sparkline graph ----------------------------------------- */
.spark-wrap {
  position: relative;
  width: 100%;
  height: 48px;
}
.sparkline {
  width: 100%;
  height: 100%;
  display: block;
}
.sparkline path.fill { fill: var(--accent-soft); }
.sparkline path.line { fill: none; stroke: var(--accent); stroke-width: 1.5; }

.kpi-tile {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}

.kpi-tile-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}

/* Service / chip grid ------------------------------------- */
.svc-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.svc-tile {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
  display: grid;
  gap: 6px;
}
.svc-tile.is-healthy { border-color: rgba(90, 242, 194, 0.3); }
.svc-tile.is-warn { border-color: rgba(255, 195, 110, 0.32); }
.svc-tile.is-critical { border-color: rgba(255, 108, 122, 0.36); }

.svc-name {
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 600;
}

/* Search palette ------------------------------------------ */
.cmdk-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  z-index: 50;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 16px 16px;
}
.cmdk-overlay.is-open { display: flex; }

.cmdk-panel {
  width: 100%;
  max-width: 600px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line-strong);
  background: rgba(10, 12, 32, 0.95);
  backdrop-filter: blur(22px);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.cmdk-input {
  width: 100%;
  padding: 16px 20px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  outline: none;
}

.cmdk-list {
  max-height: 50vh;
  overflow-y: auto;
  padding: 6px;
}

.cmdk-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.92rem;
}
.cmdk-item:hover, .cmdk-item.is-focused {
  background: var(--accent-soft);
}

.cmdk-item-meta {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.78rem;
  font-family: var(--font-mono);
}

/* Mobile -------------------------------------------------- */
.menu-button {
  display: none;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  color: var(--text);
  cursor: pointer;
}

@media (max-width: 1080px) {
  .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 880px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    inset: 0 30% 0 0;
    z-index: 40;
    transform: translateX(-110%);
    transition: transform 220ms ease;
    border-right: 1px solid var(--line);
  }
  .sidebar.is-open { transform: translateX(0); }
  .main { padding: 20px 16px 40px; }
  .menu-button { display: inline-flex; }
  .cols-3, .cols-2 { grid-template-columns: 1fr; }
  .page-title { font-size: 1.6rem; }
}

/* Empty / loading ----------------------------------------- */
.empty {
  padding: 18px;
  border-radius: var(--radius-md);
  border: 1px dashed var(--line);
  color: var(--muted);
  font-size: 0.92rem;
  text-align: center;
}

.skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,0.04), rgba(255,255,255,0.08), rgba(255,255,255,0.04));
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
  border-radius: 6px;
  height: 14px;
}
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* Subtle fade in for content ------------------------------ */
.fade-in {
  animation: fadeIn 220ms ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}


/* ===== Demo banner ===== */
.demo-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 9px 16px;
  background: linear-gradient(90deg, rgba(94, 129, 255, 0.16), rgba(122, 92, 255, 0.16));
  border-bottom: 1px solid rgba(122, 132, 255, 0.35);
  backdrop-filter: blur(10px);
  font-size: 0.82rem;
  color: var(--text, #e8ecf4);
}
.demo-banner-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #7a8cff;
  box-shadow: 0 0 0 0 rgba(122, 140, 255, 0.6);
  animation: demoPulse 2s infinite;
  flex-shrink: 0;
}
@keyframes demoPulse {
  0% { box-shadow: 0 0 0 0 rgba(122, 140, 255, 0.55); }
  70% { box-shadow: 0 0 0 7px rgba(122, 140, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(122, 140, 255, 0); }
}
.demo-banner-cta {
  color: #aab8ff;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid rgba(122, 140, 255, 0.45);
  border-radius: 999px;
  padding: 3px 13px;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.demo-banner-cta:hover {
  background: rgba(122, 140, 255, 0.15);
  color: #fff;
}
.app-shell.has-demo-banner {
  padding-top: 40px;
}
.app-shell.has-demo-banner .sidebar {
  top: 40px;
  height: calc(100vh - 40px);
}
@media (max-width: 760px) {
  .demo-banner { font-size: 0.74rem; gap: 8px; }
  .app-shell.has-demo-banner { padding-top: 58px; }
  .app-shell.has-demo-banner .sidebar { top: 58px; height: calc(100vh - 58px); }
}
