/* ============================================================
   MizanNetOps AI — Enterprise UI System
   Dual theme (dark default / light glassmorphism) via :root[data-theme]
   ============================================================ */

:root {
  /* surfaces */
  --bg: #060c16;
  --bg-2: #0a1424;
  --panel: #0e1c30;
  --panel-2: #12253f;
  --panel-3: #0b1828;
  --line: rgba(148, 163, 184, 0.16);
  --line-strong: rgba(148, 163, 184, 0.30);
  --grid-line: rgba(148, 163, 184, 0.12);

  /* text */
  --text: #f1f6fd;
  --muted: #9db0c9;
  --muted-2: #6f829c;

  /* brand */
  --brand: #22d3ee;
  --brand-2: #38bdf8;
  --accent: #6366f1;
  --accent-2: #818cf8;

  /* status / severity */
  --ok: #22c55e;
  --warn: #f59e0b;
  --bad: #ef4444;
  --crit: #f43f5e;
  --major: #fb923c;
  --minor: #eab308;
  --info: #38bdf8;

  /* glass / shadow */
  --card-bg: rgba(14, 28, 48, 0.62);
  --card-blur: blur(14px) saturate(140%);
  --glass-border: rgba(148, 163, 184, 0.18);
  --shadow: 0 20px 60px rgba(2, 8, 20, 0.55);
  --glow: 0 0 0 1px rgba(34, 211, 238, 0.18), 0 18px 48px rgba(8, 145, 178, 0.18);

  --radius: 12px;
  --radius-sm: 8px;
  --mono: "Roboto Mono", ui-monospace, SFMono-Regular, Consolas, monospace;

  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="light"] {
  --bg: #eef2f8;
  --bg-2: #e4ebf5;
  --panel: #ffffff;
  --panel-2: #f3f7fc;
  --panel-3: #ffffff;
  --line: rgba(15, 23, 42, 0.10);
  --line-strong: rgba(15, 23, 42, 0.18);
  --grid-line: rgba(15, 23, 42, 0.08);

  --text: #0f1c2e;
  --muted: #47566b;
  --muted-2: #6b7a90;

  --brand: #0891b2;
  --brand-2: #2563eb;
  --accent: #4f46e5;
  --accent-2: #6366f1;

  --ok: #16a34a;
  --warn: #d97706;
  --bad: #dc2626;
  --crit: #e11d48;
  --major: #ea580c;
  --minor: #ca8a04;
  --info: #2563eb;

  --card-bg: rgba(255, 255, 255, 0.70);
  --card-blur: blur(18px) saturate(165%);
  --glass-border: rgba(255, 255, 255, 0.65);
  --shadow: 0 18px 50px rgba(30, 58, 95, 0.14);
  --glow: 0 0 0 1px rgba(37, 99, 235, 0.14), 0 16px 40px rgba(37, 99, 235, 0.12);

  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.65;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv11", "ss01";
  transition: background 0.4s ease, color 0.3s ease;
}
p { text-wrap: pretty; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
::selection { background: rgba(34, 211, 238, 0.28); }

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 999px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--muted-2); background-clip: padding-box; }

.site-shell {
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% -4%, rgba(34, 211, 238, 0.16), transparent 34rem),
    radial-gradient(circle at 84% 12%, rgba(99, 102, 241, 0.16), transparent 30rem),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 46%, var(--bg) 100%);
  transition: background 0.4s ease;
}
:root[data-theme="light"] .site-shell {
  background:
    radial-gradient(circle at 16% -6%, rgba(37, 99, 235, 0.12), transparent 32rem),
    radial-gradient(circle at 86% 8%, rgba(8, 145, 178, 0.12), transparent 30rem),
    linear-gradient(180deg, #f7faff 0%, var(--bg) 50%, #eaf0f9 100%);
}

.container { width: min(1200px, calc(100% - 44px)); margin: 0 auto; }

/* ---------- Scroll reveal ---------- */
.reveal-on { opacity: 0; transform: translateY(22px); transition: opacity 0.7s cubic-bezier(0.2, 0.7, 0.2, 1), transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1); }
.reveal-on.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal-on { opacity: 1 !important; transform: none !important; }
  html { scroll-behavior: auto; }
}

/* ---------- Nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(18px) saturate(140%);
}
.nav-inner { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: 0.01em; }
.brand-mark {
  width: 34px; height: 34px; display: grid; place-items: center;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  color: #04111f; font-weight: 900;
  box-shadow: 0 6px 18px rgba(34, 211, 238, 0.35);
}
.nav-links { display: flex; align-items: center; gap: 18px; color: var(--muted); font-size: 0.94rem; }
.nav-links a { position: relative; padding: 4px 2px; transition: color 0.2s ease; }
.nav-links a::after {
  content: ""; position: absolute; left: 0; right: 100%; bottom: -4px; height: 2px;
  background: linear-gradient(90deg, var(--brand), var(--accent)); border-radius: 2px;
  transition: right 0.25s ease;
}
.nav-links a:hover { color: var(--text); }
.nav-links a:hover::after { right: 0; }
.nav-links a.active { color: var(--text); font-weight: 600; }
.nav-links a.active::after { right: 0; }
.nav-cta { display: flex; align-items: center; gap: 10px; }

/* ---------- Mobile navigation ---------- */
.nav-burger {
  display: none; flex-direction: column; justify-content: center; gap: 5px;
  width: 42px; height: 42px; padding: 0 10px; flex: 0 0 auto;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; cursor: pointer;
}
.nav-burger span { display: block; height: 2px; border-radius: 2px; background: var(--text); transition: transform 0.22s ease, opacity 0.22s ease; }
.nav-burger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-burger.open span:nth-child(2) { opacity: 0; }
.nav-burger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.nav-mobile {
  display: none; padding: 8px 18px 18px; border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 94%, transparent);
}
.nav-mobile a { display: block; padding: 12px 10px; border-radius: 10px; color: var(--muted); font-size: 1rem; }
.nav-mobile a:hover, .nav-mobile a.active { color: var(--text); background: var(--panel-2); }
.nav-mobile a.active { font-weight: 600; box-shadow: inset 3px 0 0 var(--brand); }
.nav-mobile .nav-mobile-cta { margin-top: 6px; text-align: center; border: 1px solid var(--line-strong); color: var(--text); }
.nav-mobile .nav-mobile-cta.primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #04111f; font-weight: 700; border: 0; }

/* ---------- Accessibility ---------- */
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 60;
  padding: 10px 18px; border-radius: 0 0 12px 0;
  background: var(--brand); color: #04111f; font-weight: 700;
}
.skip-link:focus { left: 0; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.theme-toggle {
  width: 42px; height: 42px; flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--card-bg);
  backdrop-filter: var(--card-blur);
  color: var(--text); cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.theme-toggle:hover { transform: translateY(-1px); border-color: var(--brand); }
.theme-toggle svg { width: 19px; height: 19px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 10px 16px;
  white-space: nowrap;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  font-weight: 700; color: var(--text);
  background: var(--card-bg);
  backdrop-filter: var(--card-blur);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.btn:hover { transform: translateY(-1px); border-color: var(--line-strong); box-shadow: var(--shadow); }
.btn.primary {
  color: #03111d; border-color: transparent;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
}
.btn.primary:hover { box-shadow: 0 12px 30px rgba(34, 211, 238, 0.4); }
.btn.tiny { min-height: 32px; padding: 5px 12px; font-size: 0.8rem; border-radius: 7px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Hero ---------- */
.hero { padding: clamp(60px, 8vw, 104px) 0 clamp(48px, 6vw, 72px); }
.hero-grid { display: grid; grid-template-columns: 1.05fr 0.95fr; gap: clamp(32px, 4vw, 52px); align-items: center; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  margin-bottom: 18px; padding: 7px 12px;
  border: 1px solid rgba(34, 211, 238, 0.30);
  border-radius: 999px; color: var(--brand);
  background: rgba(34, 211, 238, 0.08);
  font-size: 0.82rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
}
.eyebrow::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.18); }
h1, h2, h3 { margin: 0; line-height: 1.1; letter-spacing: -0.02em; text-wrap: balance; }
h1 { max-width: 18ch; font-size: clamp(2.45rem, 1.55rem + 3.4vw, 3.6rem); line-height: 1.06; letter-spacing: -0.032em; font-weight: 800; }
.lead { margin: 22px 0 0; max-width: 60ch; color: var(--muted); font-size: clamp(1.05rem, 0.98rem + 0.42vw, 1.18rem); line-height: 1.6; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.metric-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 36px; }
.metric {
  padding: 16px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--card-bg); backdrop-filter: var(--card-blur);
  transition: transform 0.25s ease, border-color 0.25s ease;
}
.metric:hover { transform: translateY(-3px); border-color: var(--line-strong); }
.metric strong { display: block; color: var(--brand); font-size: clamp(1.4rem, 1.2rem + 0.8vw, 1.7rem); line-height: 1; font-family: var(--mono); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.metric span { display: block; margin-top: 6px; color: var(--muted); font-size: 0.82rem; line-height: 1.4; }

/* ---------- Product frame / preview ---------- */
.product-frame {
  border: 1px solid var(--glass-border); border-radius: 14px; overflow: hidden;
  background: var(--card-bg); backdrop-filter: var(--card-blur);
  box-shadow: var(--shadow);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.product-frame:hover { transform: translateY(-4px); box-shadow: var(--glow), var(--shadow); }
.window-bar { display: flex; gap: 7px; padding: 12px 14px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--text) 5%, transparent); }
.dot { width: 11px; height: 11px; border-radius: 50%; background: var(--bad); }
.dot:nth-child(2) { background: var(--warn); }
.dot:nth-child(3) { background: var(--ok); }
.dashboard-preview { padding: 18px; display: grid; gap: 14px; }
.alarm-strip, .mini-grid { display: grid; gap: 10px; }
.alarm-strip { grid-template-columns: repeat(3, 1fr); }
.mini-grid { grid-template-columns: 1.2fr 0.8fr; }
.mini-card { padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: color-mix(in srgb, var(--text) 4%, transparent); }
.mini-card b { display: block; font-size: 1.45rem; font-family: var(--mono); }
.mini-card p { margin: 6px 0 0; color: var(--muted); font-size: 0.85rem; }
.rca-line { display: flex; justify-content: space-between; gap: 12px; margin-top: 10px; color: var(--muted); font-size: 0.88rem; }
.rca-line b { color: var(--ok); font-family: var(--mono); }

/* ---------- Sections / cards ---------- */
.section { padding: clamp(56px, 7vw, 88px) 0; }
.section-head { max-width: 760px; margin-bottom: clamp(26px, 3vw, 38px); }
.center { text-align: center; margin-left: auto; margin-right: auto; }
.section h2 { font-size: clamp(1.7rem, 1.2rem + 1.9vw, 2.5rem); letter-spacing: -0.026em; font-weight: 800; }
.section-head p { font-size: clamp(1rem, 0.96rem + 0.25vw, 1.12rem); line-height: 1.6; max-width: 62ch; }
.center.section-head p, .section-head.center p { margin-left: auto; margin-right: auto; }
.section p { color: var(--muted); }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(2, 1fr); }
.grid.three { grid-template-columns: repeat(3, 1fr); }
.grid.four { grid-template-columns: repeat(4, 1fr); }
.card {
  padding: 22px; border: 1px solid var(--glass-border); border-radius: var(--radius);
  background: var(--card-bg); backdrop-filter: var(--card-blur);
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}
.card:hover { transform: translateY(-4px); border-color: var(--line-strong); box-shadow: var(--shadow); }
.card h3 { font-size: 1.1rem; line-height: 1.25; margin-bottom: 9px; letter-spacing: -0.015em; }
.card p, .card li { color: var(--muted); font-size: 0.96rem; }
.icon {
  width: 40px; height: 40px; display: grid; place-items: center; margin-bottom: 14px;
  border-radius: 10px; background: rgba(34, 211, 238, 0.12); color: var(--brand);
  font-weight: 900; font-size: 0.85rem;
}
.tag-list { display: flex; flex-wrap: wrap; gap: 10px; padding: 0; margin: 18px 0 0; list-style: none; }
.tag-list li { padding: 8px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--text); background: color-mix(in srgb, var(--text) 5%, transparent); font-size: 0.88rem; }

/* ---------- Architecture ---------- */
.architecture { padding: 22px; border: 1px solid var(--glass-border); border-radius: 14px; background: var(--card-bg); backdrop-filter: var(--card-blur); }
.arch-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 12px; }
.arch-box {
  min-height: 74px; display: grid; place-items: center; padding: 12px;
  border: 1px solid rgba(34, 211, 238, 0.24); border-radius: var(--radius-sm); text-align: center;
  background: rgba(34, 211, 238, 0.07); font-weight: 800; color: var(--text);
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}
.arch-box:hover { transform: translateY(-2px); background: rgba(34, 211, 238, 0.14); border-color: var(--brand); }
.arch-layers { display: grid; gap: 16px; }
.arch-layer-label { font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted-2); margin-bottom: 8px; font-family: var(--mono); }
.arch-box b { display: block; font-weight: 800; font-size: 0.92rem; }
.arch-box span { display: block; margin-top: 4px; font-size: 0.74rem; font-weight: 600; color: var(--muted); }

/* How the Platform Works — numbered flow */
.flow-steps { display: grid; gap: 14px; }
.flow-step {
  display: flex; gap: 16px; align-items: flex-start;
  padding: 18px 20px; border: 1px solid var(--glass-border); border-radius: var(--radius);
  background: var(--card-bg); backdrop-filter: var(--card-blur);
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.flow-step:hover { transform: translateX(3px); border-color: var(--line-strong); }
.flow-num {
  flex: 0 0 auto; width: 38px; height: 38px; display: grid; place-items: center;
  border-radius: 10px; font-family: var(--mono); font-weight: 800; color: #04111f;
  background: linear-gradient(135deg, var(--brand), var(--accent));
}
.flow-step h3 { font-size: 1.05rem; margin-bottom: 6px; }
.flow-step p { color: var(--muted); margin: 0; }
pre {
  white-space: pre-wrap; overflow: auto; padding: 18px;
  border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--text); background: var(--panel-3); font-family: var(--mono); font-size: 0.85rem;
}
code { font-family: var(--mono); }

/* ---------- Standard page hero ---------- */
.page-hero { padding: clamp(56px, 7vw, 82px) 0 36px; border-bottom: 1px solid var(--line); }
.page-hero h1 { max-width: 22ch; font-size: clamp(2.1rem, 1.5rem + 2.5vw, 3.05rem); letter-spacing: -0.03em; }

/* ---------- Rendered architecture flow diagram ---------- */
.mermaid-flow { margin: 18px 0 0; padding: clamp(14px, 2.5vw, 26px); background: var(--panel-3); border: 1px solid var(--line); border-radius: 14px; }
.mermaid-flow-canvas { overflow-x: auto; }
.mermaid-flow-canvas svg { display: block; min-width: 760px; width: 100%; height: auto; margin: 0 auto; }
.mermaid-flow figcaption { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted-2); font-size: 0.86rem; line-height: 1.5; }

/* ---------- Blog article ---------- */
.article-body { max-width: 70ch; }
.article-body h2 { margin: clamp(28px, 4vw, 40px) 0 12px; font-size: clamp(1.3rem, 1.15rem + 0.7vw, 1.6rem); letter-spacing: -0.02em; }
.article-body h2:first-child { margin-top: 0; }
.article-body p { margin: 0 0 16px; color: var(--muted); font-size: clamp(1rem, 0.97rem + 0.2vw, 1.1rem); line-height: 1.7; }
.article-footer { display: flex; flex-wrap: wrap; gap: 12px; margin-top: clamp(30px, 4vw, 44px); padding-top: 24px; border-top: 1px solid var(--line); }

/* ============================================================
   DASHBOARD
   ============================================================ */
.dashboard-layout { display: grid; grid-template-columns: 264px 1fr; min-height: calc(100vh - 72px); }
.sidebar {
  padding: 22px 18px; border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  backdrop-filter: blur(12px);
  display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 72px; align-self: start; height: calc(100vh - 72px);
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; font-weight: 800; }
.sidebar-label { font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted-2); margin: 14px 8px 6px; }
.sidebar a {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px;
  border-radius: var(--radius-sm); color: var(--muted); font-weight: 600; font-size: 0.92rem;
  border: 1px solid transparent; transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}
.sidebar a:hover { background: color-mix(in srgb, var(--text) 6%, transparent); color: var(--text); }
.sidebar a.active { background: rgba(34, 211, 238, 0.12); color: var(--brand); border-color: rgba(34, 211, 238, 0.28); }
.sidebar a .nav-ic { width: 18px; height: 18px; flex: 0 0 auto; opacity: 0.85; }
.sidebar-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line); font-size: 0.78rem; color: var(--muted-2); }

.dash-main { padding: 26px 28px 60px; min-width: 0; }
.dash-topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.live-pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 13px;
  border-radius: 999px; border: 1px solid rgba(34, 197, 94, 0.3);
  background: rgba(34, 197, 94, 0.12); color: var(--ok);
  font-size: 0.78rem; font-weight: 700; font-family: var(--mono);
}
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.55); } 70% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); } 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); } }
.dash-updated { color: var(--muted-2); font-size: 0.82rem; font-family: var(--mono); }
.dash-topbar h2 { font-size: clamp(1.45rem, 1.1rem + 1.1vw, 2rem); letter-spacing: -0.025em; font-weight: 800; }
.dash-topbar .section-head p { font-size: 0.96rem; margin-top: 8px; max-width: 64ch; }

/* KPI cards */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.kpi-card {
  padding: 16px 18px; border: 1px solid var(--glass-border); border-radius: var(--radius);
  background: var(--card-bg); backdrop-filter: var(--card-blur);
  display: flex; flex-direction: column; gap: 6px;
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.kpi-card:hover { transform: translateY(-3px); border-color: var(--line-strong); }
.kpi-card .k-label { font-size: 0.78rem; color: var(--muted); letter-spacing: 0.02em; text-transform: uppercase; }
.kpi-card .k-value { font-size: 2rem; font-weight: 800; font-family: var(--mono); letter-spacing: -0.03em; line-height: 1; }
.kpi-card .k-foot { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; color: var(--muted-2); }
.k-delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; font-family: var(--mono); }
.k-delta.up { color: var(--ok); }
.k-delta.down { color: var(--bad); }
.k-delta.flat { color: var(--muted); }
.k-accent-crit { color: var(--crit); }
.k-accent-warn { color: var(--warn); }
.k-accent-ok { color: var(--ok); }
.k-accent-brand { color: var(--brand); }

/* Charts */
.charts-grid { display: grid; gap: 16px; margin-bottom: 18px; }
.charts-grid.split { grid-template-columns: 1.55fr 1fr; }
.charts-grid.split-even { grid-template-columns: 1fr 1fr; }
.chart-card { padding: 18px; border: 1px solid var(--glass-border); border-radius: var(--radius); background: var(--card-bg); backdrop-filter: var(--card-blur); }
.chart-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.chart-head h3 { font-size: 1.02rem; }
.chart-head .chart-sub { font-size: 0.78rem; color: var(--muted-2); font-family: var(--mono); }
.chart-wrap { position: relative; width: 100%; }
.chart-wrap canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; }
.chart-loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted-2); font-family: var(--mono); font-size: 0.85rem; }

/* ---------- Data table (sortable) ---------- */
.panel-card { padding: 0; border: 1px solid var(--glass-border); border-radius: var(--radius); background: var(--card-bg); backdrop-filter: var(--card-blur); overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panel-head h3 { font-size: 1.05rem; }
.panel-head .sub { color: var(--muted-2); font-size: 0.82rem; }

.table-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.filter-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: transparent; color: var(--muted); font-size: 0.8rem; font-weight: 600; cursor: pointer;
  transition: all 0.18s ease; display: inline-flex; align-items: center; gap: 6px;
}
.chip:hover { color: var(--text); border-color: var(--line-strong); }
.chip.active { background: rgba(34, 211, 238, 0.14); border-color: rgba(34, 211, 238, 0.4); color: var(--brand); }
.chip .chip-count { font-family: var(--mono); opacity: 0.8; }
.search-input {
  min-width: 200px; padding: 8px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--panel-3); color: var(--text);
  font-size: 0.88rem; font-family: inherit;
}
.search-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.15); }

.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.data-table thead th {
  position: sticky; top: 0; z-index: 1;
  padding: 11px 16px; text-align: left; white-space: nowrap;
  color: var(--muted); font-size: 0.74rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border-bottom: 1px solid var(--line-strong);
  cursor: pointer; user-select: none;
}
.data-table thead th.no-sort { cursor: default; }
.data-table thead th .sort-ind { margin-left: 6px; opacity: 0.5; font-family: var(--mono); font-size: 0.7rem; }
.data-table thead th.sorted { color: var(--text); }
.data-table thead th.sorted .sort-ind { opacity: 1; color: var(--brand); }
.data-table tbody td { padding: 12px 16px; border-bottom: 1px solid var(--line); color: var(--text); vertical-align: middle; }
.data-table tbody td.muted { color: var(--muted); }
.data-table tbody td.mono { font-family: var(--mono); font-size: 0.82rem; color: var(--muted); }
.data-table tbody tr { transition: background 0.15s ease; }
.data-table tbody tr:hover { background: color-mix(in srgb, var(--text) 4%, transparent); }
.data-table tbody tr:nth-child(even) { background: color-mix(in srgb, var(--text) 2%, transparent); }
.data-table tbody tr:nth-child(even):hover { background: color-mix(in srgb, var(--text) 5%, transparent); }

.table-empty { padding: 48px 18px; text-align: center; color: var(--muted-2); }
.table-empty .big { font-size: 1.05rem; color: var(--text); margin-bottom: 6px; font-weight: 700; }

/* legacy table (kept for compatibility) */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px; border-bottom: 1px solid var(--line); text-align: left; }
.table th { color: var(--text); font-size: 0.82rem; }
.table td { color: var(--muted); }
.status { display: inline-flex; gap: 8px; align-items: center; padding: 5px 9px; border-radius: 999px; font-size: 0.78rem; font-weight: 800; }
.status.ok { background: rgba(34, 197, 94, 0.13); color: #86efac; }
.status.bad { background: rgba(239, 68, 68, 0.14); color: #fca5a5; }

/* ---------- Severity badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  font-family: var(--mono); border: 1px solid transparent; white-space: nowrap;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.critical { color: var(--crit); background: color-mix(in srgb, var(--crit) 16%, transparent); border-color: color-mix(in srgb, var(--crit) 35%, transparent); }
.badge.major { color: var(--major); background: color-mix(in srgb, var(--major) 16%, transparent); border-color: color-mix(in srgb, var(--major) 35%, transparent); }
.badge.minor { color: var(--minor); background: color-mix(in srgb, var(--minor) 16%, transparent); border-color: color-mix(in srgb, var(--minor) 35%, transparent); }
.badge.warning { color: var(--warn); background: color-mix(in srgb, var(--warn) 16%, transparent); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.badge.cleared, .badge.stable, .badge.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 16%, transparent); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.badge.info, .badge.at-risk { color: var(--info); background: color-mix(in srgb, var(--info) 16%, transparent); border-color: color-mix(in srgb, var(--info) 35%, transparent); }
.badge.impacted { color: var(--crit); background: color-mix(in srgb, var(--crit) 16%, transparent); border-color: color-mix(in srgb, var(--crit) 35%, transparent); }

/* ---------- Topology map (Service Impact) ---------- */
.topology-card { padding: 18px; border: 1px solid var(--glass-border); border-radius: var(--radius); background: var(--card-bg); backdrop-filter: var(--card-blur); }
.topology { width: 100%; height: auto; display: block; }
.topo-link { stroke-width: 3; fill: none; stroke-linecap: round; }
.topo-link.ok { stroke: var(--ok); opacity: 0.65; }
.topo-link.warn { stroke: var(--major); }
.topo-link.impacted { stroke: var(--crit); }
.topo-link.cut { stroke: var(--crit); stroke-dasharray: 9 7; animation: dash 1s linear infinite; }
@keyframes dash { to { stroke-dashoffset: -32; } }
.topo-node { fill: var(--panel-2); stroke: var(--line-strong); stroke-width: 1.5; }
.topo-node.ok { stroke: var(--ok); }
.topo-node.warn { stroke: var(--major); }
.topo-node.crit { stroke: var(--crit); }
.topo-node.crit.pulse { animation: nodepulse 1.6s ease-in-out infinite; }
@keyframes nodepulse { 0%, 100% { stroke-width: 1.5; } 50% { stroke-width: 3.5; } }
.topo-label { fill: var(--text); font-size: 12px; font-weight: 700; font-family: Inter, sans-serif; }
.topo-sub { fill: var(--muted); font-size: 10px; font-family: var(--mono); }
.topo-cut-badge { fill: var(--crit); font-size: 11px; font-weight: 800; font-family: var(--mono); }
.topo-legend { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 0.8rem; color: var(--muted); }
.topo-legend span { display: inline-flex; align-items: center; gap: 7px; }
.topo-legend i { width: 14px; height: 4px; border-radius: 2px; display: inline-block; }

/* ---------- Copilot chat ---------- */
.copilot { display: flex; flex-direction: column; height: min(620px, calc(100vh - 220px)); border: 1px solid var(--glass-border); border-radius: var(--radius); background: var(--card-bg); backdrop-filter: var(--card-blur); overflow: hidden; }
.copilot-head { display: flex; align-items: center; gap: 12px; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.copilot-avatar { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(135deg, var(--brand), var(--accent)); color: #04111f; font-weight: 900; }
.copilot-head h3 { font-size: 1rem; }
.copilot-head .sub { font-size: 0.76rem; color: var(--ok); display: flex; align-items: center; gap: 6px; }
.chat-log { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.msg { max-width: 80%; display: flex; flex-direction: column; gap: 5px; animation: rise 0.3s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.msg .who { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted-2); font-weight: 700; }
.msg .bubble-body { padding: 12px 15px; border-radius: 14px; font-size: 0.92rem; line-height: 1.55; }
.msg.user { align-self: flex-end; align-items: flex-end; }
.msg.user .bubble-body { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #04111f; border-bottom-right-radius: 4px; font-weight: 500; }
.msg.ai { align-self: flex-start; }
.msg.ai .bubble-body { background: color-mix(in srgb, var(--text) 6%, transparent); border: 1px solid var(--line); color: var(--text); border-bottom-left-radius: 4px; }
.msg.ai .bubble-body strong { color: var(--brand); }
.typing { display: inline-flex; gap: 5px; align-items: center; padding: 14px 16px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); display: inline-block; animation: blink 1.3s infinite both; }
.typing i:nth-child(2) { animation-delay: 0.18s; }
.typing i:nth-child(3) { animation-delay: 0.36s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.chat-suggestions { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 18px 12px; }
.chat-input-row { display: flex; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--line); }
.chat-input { flex: 1; padding: 11px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--panel-3); color: var(--text); font-size: 0.92rem; font-family: inherit; }
.chat-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.15); }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--line); padding: 46px 0; background: color-mix(in srgb, var(--bg) 60%, #000 8%); }
:root[data-theme="light"] .footer { background: color-mix(in srgb, var(--bg) 80%, #fff); }
.footer-grid { display: grid; grid-template-columns: 1.3fr repeat(3, 1fr); gap: 24px; }
.footer a, .footer p { color: var(--muted); }
.footer a { transition: color 0.18s ease; }
.footer a:hover { color: var(--brand); }
.footer h3 { font-size: 1rem; margin-bottom: 12px; }
.footer-links { display: grid; gap: 8px; }
.legal { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.9rem; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .charts-grid.split, .charts-grid.split-even { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 980px) {
  .nav-links { display: none; }
  .nav-burger { display: flex; }
  .nav-mobile { display: block; }
  .hero-grid, .grid.two, .grid.three, .grid.four, .footer-grid { grid-template-columns: 1fr; }
  .metric-row, .alarm-strip, .arch-row { grid-template-columns: repeat(2, 1fr); }
  .dashboard-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar-foot, .sidebar-label, .sidebar-brand { display: none; }
}
@media (max-width: 620px) {
  .container { width: min(100% - 28px, 1200px); }
  .nav-cta .btn:not(.primary):not(.theme-toggle) { display: none; }
  .nav-inner { gap: 12px; }
  .nav-cta { gap: 8px; }
  .nav-cta .btn.primary { padding: 8px 12px; font-size: 0.88rem; min-height: 38px; }
  .nav .brand span:not(.brand-mark) { display: none; }
  .metric-row, .alarm-strip, .mini-grid, .arch-row, .kpi-grid { grid-template-columns: 1fr; }
  .hero { padding-top: 56px; }
  .section { padding: 54px 0; }
  .dash-main { padding: 18px 16px 48px; }
  .msg { max-width: 92%; }
}
