/*
 * MultiCmsManager dashboard.
 * Tokens follow the data-viz reference palette: calm neutral chrome, one blue accent,
 * four reserved status colors (always paired with an icon and a label).
 */
:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --surface-raised: #ffffff;
  --surface-sunken: #f3f2ee;
  --hover: #f0efea;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #6f6d68;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --border-strong: rgba(11, 11, 11, 0.18);

  --accent: #2a78d6;          /* marks: lines, active indicators */
  --accent-strong: #256abf;   /* filled buttons (white text 5.4:1) */
  --accent-ink: #1c5cab;      /* links and accent text (6.5:1) */
  --accent-wash: rgba(42, 120, 214, 0.10);

  --good: #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --good-wash: rgba(12, 163, 12, 0.10);
  --warning-wash: rgba(250, 178, 25, 0.16);
  --critical-wash: rgba(208, 59, 59, 0.10);
  --info-wash: rgba(42, 120, 214, 0.10);
  --neutral-wash: rgba(11, 11, 11, 0.06);

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.04);
  --shadow-pop: 0 8px 24px rgba(16, 24, 40, 0.12), 0 2px 6px rgba(16, 24, 40, 0.06);
  --sidebar: 232px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --surface-raised: #1f1f1e;
    --surface-sunken: #141413;
    --hover: #262625;
    --ink: #ffffff;
    --ink-2: #c3c2b7;
    --muted: #9a988f;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --border-strong: rgba(255, 255, 255, 0.18);
    --accent: #3987e5;
    --accent-strong: #256abf;
    --accent-ink: #86b6ef;
    --accent-wash: rgba(57, 135, 229, 0.16);
    --good-wash: rgba(12, 163, 12, 0.16);
    --warning-wash: rgba(250, 178, 25, 0.14);
    --critical-wash: rgba(208, 59, 59, 0.20);
    --info-wash: rgba(57, 135, 229, 0.16);
    --neutral-wash: rgba(255, 255, 255, 0.08);
    --shadow: none;
    --shadow-pop: 0 8px 24px rgba(0, 0, 0, 0.5);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface: #1a1a19;
  --surface-raised: #1f1f1e;
  --surface-sunken: #141413;
  --hover: #262625;
  --ink: #ffffff;
  --ink-2: #c3c2b7;
  --muted: #9a988f;
  --grid: #2c2c2a;
  --axis: #383835;
  --border: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.18);
  --accent: #3987e5;
  --accent-strong: #256abf;
  --accent-ink: #86b6ef;
  --accent-wash: rgba(57, 135, 229, 0.16);
  --good-wash: rgba(12, 163, 12, 0.16);
  --warning-wash: rgba(250, 178, 25, 0.14);
  --critical-wash: rgba(208, 59, 59, 0.20);
  --info-wash: rgba(57, 135, 229, 0.16);
  --neutral-wash: rgba(255, 255, 255, 0.08);
  --shadow: none;
  --shadow-pop: 0 8px 24px rgba(0, 0, 0, 0.5);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--page); color: var(--ink); font: 14px/1.5 var(--font); }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
code, pre, .mono { font-family: var(--mono); font-size: 12.5px; }
pre { background: var(--surface-sunken); border: 1px solid var(--border); padding: 10px 12px; border-radius: var(--radius-sm); overflow-x: auto; white-space: pre-wrap; word-break: break-word; margin: 8px 0 0; max-height: 320px; }
h1 { font-size: 22px; line-height: 1.25; margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h2 { font-size: 15px; margin: 0; font-weight: 600; }
h3 { font-size: 12px; margin: 20px 0 8px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); }
.ink-2 { color: var(--ink-2); }
.small { font-size: 13px; }
.xs { font-size: 12px; }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.icon { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.icon.sm { width: 14px; height: 14px; }
.icon.lg { width: 20px; height: 20px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- App shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; padding: 16px 12px; border-right: 1px solid var(--border); background: var(--surface); }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 18px; color: var(--ink); font-weight: 700; font-size: 15px; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--accent-strong); color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 700; letter-spacing: -0.02em; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--ink-2); font-weight: 500; }
.nav a:hover { background: var(--hover); color: var(--ink); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--accent-wash); color: var(--ink); }
.nav a[aria-current="page"] .icon { color: var(--accent); }
.nav .count { margin-left: auto; font-size: 12px; font-weight: 600; min-width: 20px; padding: 0 6px; border-radius: 999px; text-align: center; background: var(--neutral-wash); color: var(--ink-2); }
.nav .count.critical { background: var(--critical); color: #fff; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px solid var(--border); }
.user { display: flex; align-items: center; gap: 10px; padding: 4px 8px; min-width: 0; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--surface-sunken); border: 1px solid var(--border); display: grid; place-items: center; font-size: 12px; font-weight: 600; color: var(--ink-2); flex: none; }
.user .who { min-width: 0; }
.user .who div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.theme-switch { display: flex; gap: 2px; padding: 2px; border-radius: 8px; background: var(--surface-sunken); border: 1px solid var(--border); }
.theme-switch button { flex: 1; display: grid; place-items: center; padding: 5px 0; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; }
.theme-switch button[aria-pressed="true"] { background: var(--surface-raised); color: var(--ink); box-shadow: var(--shadow); }
.mobile-bar { display: none; }
.scrim { display: none; }
.main { min-width: 0; }
.container { max-width: 1240px; margin: 0 auto; padding: 28px 32px 72px; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 272px; z-index: 40; transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-pop); }
  .shell.nav-open .sidebar { transform: none; }
  .shell.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 30; }
  .mobile-bar { display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 20; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
  .container { padding: 20px 16px 64px; }
}

/* ---------- Page header ---------- */
.crumbs { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.crumbs a { color: var(--muted); }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head .title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-head .sub { color: var(--ink-2); margin-top: 4px; display: flex; gap: 6px 14px; flex-wrap: wrap; align-items: center; font-size: 13px; }
.page-head .sub > span { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; }
.page-head .sub > span > .icon { flex: none; }

/* ---------- Cards & layout ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
/* Vertical rhythm between stacked blocks; grid children are spaced by the grid gap instead. */
.container > .card + .card, .tab-panel > .card + .card, .tab-panel > .grid + .card, .tab-panel > .card + .grid, .tab-panel > .grid + .grid { margin-top: 16px; }
.grid > .card, .kpis > .card { margin-top: 0 !important; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-head .hint { color: var(--muted); font-size: 12px; }
.card-body { padding: 16px 18px; }
.card-foot { padding: 10px 18px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); }
@media (max-width: 1080px) { .grid-main { grid-template-columns: 1fr; } }
@media (max-width: 420px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------- Hero + KPI tiles ---------- */
.hero { display: flex; align-items: center; gap: 16px; padding: 18px 20px; }
.hero .hero-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.hero .hero-icon .icon { width: 24px; height: 24px; }
.hero.ok .hero-icon { background: var(--good-wash); color: var(--good); }
.hero.warning .hero-icon { background: var(--warning-wash); color: #b57a00; }
.hero.critical .hero-icon { background: var(--critical-wash); color: var(--critical); }
.hero .headline { font-size: 18px; font-weight: 650; }
.hero .detail { color: var(--ink-2); font-size: 13px; }
.kpis { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.tile { padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.tile .label { color: var(--ink-2); font-size: 13px; display: flex; align-items: center; gap: 6px; }
.tile .value { font-size: 28px; font-weight: 600; line-height: 1.15; letter-spacing: -0.01em; }
.tile .value .of { font-size: 16px; font-weight: 500; color: var(--muted); }
.tile .meta { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tile a.stretch { color: inherit; }
.tile a.stretch:hover { text-decoration: none; }
a.card.tile:hover { border-color: var(--border-strong); text-decoration: none; }
a.card.tile { color: inherit; }

/* ---------- Status & severity pills (icon + label, never color alone) ---------- */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px 2px 7px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 18px; white-space: nowrap; background: var(--neutral-wash); color: var(--ink); }
.pill .icon { width: 13px; height: 13px; stroke-width: 2.5; }
.pill.good { background: var(--good-wash); }
.pill.good .icon { color: var(--good); }
.pill.warning { background: var(--warning-wash); }
.pill.warning .icon { color: #c98500; }
.pill.critical { background: var(--critical-wash); }
.pill.critical .icon { color: var(--critical); }
.pill.info { background: var(--info-wash); }
.pill.info .icon { color: var(--accent); }
.pill.neutral .icon { color: var(--muted); }
.pill.plain { background: transparent; padding-left: 0; font-weight: 500; }
.count-pill { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-width: 22px; padding: 0 7px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 20px; background: var(--neutral-wash); color: var(--ink); }
.count-pill.critical { background: var(--critical); color: #fff; }
.count-pill.warning { background: var(--warning); color: #3d2a00; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; background: var(--axis); }
.dot.good { background: var(--good); } .dot.warning { background: var(--warning); } .dot.critical { background: var(--critical); } .dot.info { background: var(--accent); }
.cms { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.cms-mark { width: 20px; height: 20px; border-radius: 5px; display: grid; place-items: center; font-size: 11px; font-weight: 700; background: var(--surface-sunken); border: 1px solid var(--border); color: var(--ink-2); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px; border: 1px solid var(--border-strong); background: var(--surface-raised); color: var(--ink); border-radius: 8px; font: inherit; font-weight: 550; font-size: 13.5px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--hover); text-decoration: none; }
.btn.primary { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; }
.btn.primary:hover { background: #1c5cab; }
.btn.danger { color: var(--critical); }
.btn.danger-solid { background: var(--critical); border-color: var(--critical); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--hover); color: var(--ink); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn.icon-only { width: 34px; padding: 0; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
form.inline { display: inline-flex; margin: 0; }

/* Menu (details/summary dropdown) */
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-list { position: absolute; right: 0; top: calc(100% + 6px); z-index: 25; min-width: 240px; padding: 6px; background: var(--surface-raised); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-pop); }
.menu-list form { display: block; margin: 0; }
.menu-list button, .menu-list a { display: flex; width: 100%; align-items: flex-start; gap: 10px; padding: 8px 10px; border: 0; background: transparent; color: var(--ink); font: inherit; font-size: 13.5px; text-align: left; border-radius: 6px; cursor: pointer; }
.menu-list button:hover, .menu-list a:hover { background: var(--hover); text-decoration: none; }
.menu-list .desc { display: block; color: var(--muted); font-size: 12px; font-weight: 400; }
.menu-list hr { border: 0; border-top: 1px solid var(--border); margin: 6px 0; }
.menu-list .danger { color: var(--critical); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; background: var(--surface); }
thead th { position: sticky; top: 0; z-index: 1; }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-sites tbody tr { cursor: pointer; }
.table-sites tbody tr:hover td { background: var(--hover); }
.table-sites td:first-child, .table-sites th:first-child { padding-left: 18px; }
.table-sites td:last-child, .table-sites th:last-child { padding-right: 18px; }
.site-cell { display: flex; flex-direction: column; min-width: 180px; }
.site-cell a { color: var(--ink); font-weight: 600; }
.site-cell .host { color: var(--muted); font-size: 12px; }
.table-compact th, .table-compact td { padding: 7px 10px; font-size: 13px; }
.table-compact td:first-child, .table-compact th:first-child { padding-left: 18px; }
.table-compact td:last-child, .table-compact th:last-child { padding-right: 18px; }
tr.row-hidden { display: none; }

/* ---------- Filters ---------- */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.search { position: relative; flex: 1 1 200px; max-width: 300px; }
.search .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input[type=search] { padding-left: 32px; }
.segmented { display: inline-flex; padding: 2px; gap: 2px; border-radius: 8px; background: var(--surface-sunken); border: 1px solid var(--border); flex-wrap: wrap; }
.segmented button, .segmented a { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border: 0; border-radius: 6px; background: transparent; color: var(--ink-2); font: inherit; font-size: 13px; font-weight: 550; cursor: pointer; }
.segmented a:hover { text-decoration: none; color: var(--ink); }
.segmented [aria-pressed="true"], .segmented [aria-current="true"] { background: var(--surface-raised); color: var(--ink); box-shadow: var(--shadow); }
.segmented .n { font-size: 11.5px; color: var(--muted); font-weight: 600; }

/* ---------- Forms ---------- */
label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.field { margin-bottom: 16px; }
.field .help { color: var(--muted); font-size: 12.5px; margin-top: 5px; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=search], select, textarea {
  width: 100%; height: 36px; padding: 0 11px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface-raised); color: var(--ink); font: inherit; font-size: 14px;
}
textarea { height: auto; padding: 9px 11px; }
select { padding-right: 28px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
.checkbox { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.form-narrow { max-width: 560px; }
.form-grid { display: grid; gap: 0 16px; grid-template-columns: 1fr 1fr; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.error { color: var(--critical); font-size: 12.5px; margin-top: 5px; }
input.invalid, select.invalid { border-color: var(--critical); }

/* ---------- Flash / callouts ---------- */
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 11px 14px; border-radius: var(--radius); margin-bottom: 18px; border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow); }
.toast.good { border-left: 3px solid var(--good); }
.toast.good .icon { color: var(--good); }
.toast.critical { border-left: 3px solid var(--critical); }
.toast.critical .icon { color: var(--critical); }
.toast .close { margin-left: auto; }
.callout { display: flex; gap: 12px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-sunken); border: 1px solid var(--border); font-size: 13px; }
.callout.warning { background: var(--warning-wash); }
.callout.critical { background: var(--critical-wash); }
.callout.info { background: var(--info-wash); }
.callout .icon { margin-top: 1px; }
.code-box { display: flex; gap: 8px; align-items: stretch; }
.code-box code { flex: 1; min-width: 0; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-sunken); border: 1px dashed var(--border-strong); font-size: 12.5px; word-break: break-all; user-select: all; }
.steps { counter-reset: step; list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 10px; }
.steps li { display: flex; gap: 10px; font-size: 13px; }
.steps li::before { counter-increment: step; content: counter(step); flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--accent-wash); color: var(--accent-ink); font-weight: 700; font-size: 12px; display: grid; place-items: center; }

/* ---------- Lists (alerts, activity) ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.list > li:last-child { border-bottom: 0; }
.list .body { flex: 1; min-width: 0; }
.list .title { font-weight: 600; }
.list .meta { color: var(--muted); font-size: 12.5px; margin-top: 2px; display: flex; gap: 4px 12px; flex-wrap: wrap; }
.list .sev-icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: none; }
.sev-icon.critical { background: var(--critical-wash); color: var(--critical); }
.sev-icon.warning { background: var(--warning-wash); color: #c98500; }
.sev-icon.info { background: var(--info-wash); color: var(--accent); }
.sev-icon.good { background: var(--good-wash); color: var(--good); }
.list details { margin-top: 6px; }
.list summary, details.more > summary { cursor: pointer; color: var(--accent-ink); font-size: 12.5px; font-weight: 550; }
.kv { display: grid; grid-template-columns: minmax(110px, max-content) 1fr; gap: 7px 18px; margin: 0; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 28px 18px; color: var(--ink-2); }
.empty .icon { width: 28px; height: 28px; color: var(--muted); }
.empty.compact { flex-direction: row; justify-content: flex-start; text-align: left; padding: 14px 18px; gap: 10px; }
.empty.compact .icon { width: 18px; height: 18px; }
.empty.good .icon { color: var(--good); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 0 0 20px; overflow-x: auto; }
.tabs a { display: inline-flex; align-items: center; gap: 7px; padding: 10px 12px; color: var(--ink-2); font-weight: 550; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.js .tab-panel[hidden] { display: none; }

/* ---------- Charts ---------- */
.chart { position: relative; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--axis); stroke-width: 1; }
.chart .series-line { stroke: var(--accent); stroke-width: 2; fill: none; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.chart .series-area { fill: var(--accent); opacity: .10; }
.chart .fail-mark { fill: var(--critical); }
.chart .crosshair { stroke: var(--axis); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart-plot { position: relative; height: 180px; }
.chart-plot svg { position: absolute; inset: 0; height: 100%; }
.chart-y { position: absolute; left: 0; top: 0; bottom: 0; width: 48px; pointer-events: none; }
.chart-y span { position: absolute; right: 8px; transform: translateY(-50%); font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.chart-x { display: flex; justify-content: space-between; padding: 6px 0 0 48px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.chart-area { position: absolute; left: 48px; right: 0; top: 0; bottom: 0; }
.chart-cursor { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--axis); pointer-events: none; display: none; }
.chart-dot { position: absolute; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--surface); transform: translate(-50%, -50%); pointer-events: none; display: none; }
.tooltip { position: fixed; z-index: 60; pointer-events: none; padding: 8px 10px; border-radius: 8px; background: var(--surface-raised); border: 1px solid var(--border); box-shadow: var(--shadow-pop); font-size: 12px; color: var(--ink-2); min-width: 120px; display: none; }
.tooltip strong { display: block; color: var(--ink); font-size: 14px; font-weight: 650; }
.tooltip .key { display: inline-block; width: 12px; height: 2px; background: var(--accent); vertical-align: middle; margin-right: 6px; }

/* Uptime strip: one bar per time bucket, 2px surface gap between bars */
.strip { display: flex; gap: 2px; align-items: stretch; height: 30px; }
.strip span { flex: 1; min-width: 2px; border-radius: 2px; background: var(--grid); }
.strip span.up { background: var(--good); }
.strip span.down { background: var(--critical); }
.strip span.partial { background: var(--warning); }
.strip span:hover, .strip span:focus { opacity: .75; outline: none; }
.strip-legend { display: flex; justify-content: space-between; gap: 12px; margin-top: 8px; font-size: 11.5px; color: var(--muted); flex-wrap: wrap; }
.strip-legend .keys { display: flex; gap: 12px; }
.strip-legend .keys span { display: inline-flex; align-items: center; gap: 5px; }
.strip-legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

/* Sparkline in table rows */
.spark { display: block; width: 96px; height: 24px; overflow: visible; }
.spark polyline { fill: none; stroke: var(--axis); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.spark circle { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.spark circle.fail { fill: var(--critical); }

/* Meter (days left, uptime) */
.meter { height: 6px; border-radius: 3px; background: var(--grid); overflow: hidden; margin-top: 6px; }
.meter > i { display: block; height: 100%; border-radius: 3px; background: var(--good); }
.meter.warning > i { background: var(--warning); }
.meter.critical > i { background: var(--critical); }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 400px; padding: 28px; }
.auth-card .brand { padding: 0 0 18px; }
.auth-card h1 { margin-bottom: 4px; }
.auth-card .lead { color: var(--ink-2); margin-bottom: 20px; }
.btn.block { width: 100%; height: 38px; }

/* ---------- Misc ---------- */
.stack { display: flex; flex-direction: column; gap: 16px; }
.divider { height: 1px; background: var(--border); margin: 16px 0; border: 0; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 6px; font-size: 12px; background: var(--surface-sunken); border: 1px solid var(--border); color: var(--ink-2); white-space: nowrap; }
.link-plain { color: inherit; }
.link-plain:hover { color: var(--accent-ink); }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; }
.hide-sm { }
@media (max-width: 720px) { .hide-sm { display: none; } }
@media (max-width: 1100px) { .hide-md { display: none; } }

/* ---------- Core file list and diff ---------- */
.file-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 2px; max-height: 320px; overflow-y: auto; }
.file-list a { display: inline-flex; align-items: center; gap: 6px; padding: 2px 0; overflow-wrap: anywhere; }
.file-list .icon { flex: none; color: var(--muted); }
.kv dd .file-list { margin-top: 0; }
.diff-title { font-size: 18px; font-weight: 600; overflow-wrap: anywhere; }
.diff-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.diff-summary .small-value { font-size: 22px; }
.diff-stat .add { color: var(--good); }
.diff-stat .del { color: var(--critical); }
.diff-legend { display: inline-flex; gap: 14px; }
.diff-legend span { display: inline-flex; align-items: center; gap: 6px; }
.diff-legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.diff-legend i.add { background: var(--good); }
.diff-legend i.del { background: var(--critical); }
.diff-wrap { overflow-x: auto; border-top: 1px solid var(--border); }
.diff { width: 100%; border-collapse: collapse; table-layout: fixed; font-family: var(--mono); font-size: 12.5px; line-height: 1.55; }
.diff col.num { width: 52px; }
.diff col.sign { width: 22px; }
.diff td { padding: 0 8px; vertical-align: top; border: 0; }
.diff td.num { color: var(--muted); text-align: right; user-select: none; background: var(--surface-sunken); }
.diff td.sign { text-align: center; user-select: none; color: var(--muted); }
.diff td.code { white-space: pre-wrap; overflow-wrap: anywhere; }
.diff tr.add td.code, .diff tr.add td.sign { background: var(--good-wash); }
.diff tr.del td.code, .diff tr.del td.sign { background: var(--critical-wash); }
.diff tr.add td.sign { color: var(--good); font-weight: 700; }
.diff tr.del td.sign { color: var(--critical); font-weight: 700; }
.diff tr.flagged td.num { box-shadow: inset 3px 0 0 var(--critical); }
.diff .flag { display: inline-block; margin-left: 10px; padding: 0 6px; border-radius: 4px; font-family: var(--font); font-size: 11px; font-weight: 600; color: var(--critical); background: var(--critical-wash); white-space: nowrap; }
.diff tr.skip td { background: var(--surface-sunken); color: var(--muted); font-family: var(--font); font-size: 12px; padding: 4px 12px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }

/* ---------- Small screens ---------- */
@media (max-width: 640px) {
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tile { padding: 12px 14px; }
  .tile .value { font-size: 22px; }
  .hero { padding: 14px 16px; }
  .list > li { flex-wrap: wrap; padding: 12px 16px; }
  .list > li .body { flex-basis: calc(100% - 42px); }
  .list > li > .actions { width: 100%; padding-left: 42px; }
  .card-head { padding: 12px 16px; }
  .card-head .filters { width: 100%; }
  .search { max-width: none; }
  .page-head .actions { width: 100%; }
  /* Sites table becomes a list of rows: name + status, then the issue badges. */
  .table-sites thead { display: none; }
  .table-sites tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
  .table-sites tbody tr:hover td { background: transparent; }
  .table-sites td { display: block; padding: 0 !important; border: 0; }
  .table-sites td.hide-sm, .table-sites td.hide-md { display: none; }
  .table-sites td:nth-child(2) { justify-self: end; }
  .table-sites td.num { text-align: left; }
  .table-sites td.num .actions { justify-content: flex-start !important; }
  .site-cell { min-width: 0; }
  .tabs a { padding: 10px 8px; }
  .diff-summary { grid-template-columns: 1fr; }
  .diff col.num { width: 38px; }
  .diff td { padding: 0 5px; }
}
