/* ==========================================================================
   Rummaan admin console
   One stylesheet, no framework. Tokens first; light is the default and dark is
   declared twice on purpose (system dark unless the viewer chose light, and the
   manual data-theme="dark" override). KEEP BOTH DARK BLOCKS IDENTICAL.
   Data colours follow the dataviz palette: three fixed property hues (blue,
   orange, aqua) validated for colour-blind separation in both themes.
   ========================================================================== */

:root {
  color-scheme: light;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --bg: #F4F6FA;
  --surface: #FFFFFF;
  --surface-2: #F1F5F9;
  --surface-3: #E8EDF4;
  --border: #E2E8F0;
  --border-strong: #CBD5E1;
  --text: #0F172A;
  --text-2: #334155;
  --muted: #475569;
  --accent: #C41E3A;
  --accent-btn: #C41E3A;   /* filled buttons: white text is 5.9:1 on this */
  --accent-text: #9B1B30;
  --accent-soft: rgba(196, 30, 58, 0.08);
  --on-accent: #FFFFFF;
  --focus: #2A78D6;

  --s1: #2A78D6;   /* Rummaan */
  --s2: #EB6834;   /* MShop */
  --s3: #1BAF7A;   /* PacketPulse */
  --grid: #E6EAF0;
  --axis: #94A3B8;

  --good: #0B7A0B;
  --warn: #8A5A00;
  --crit: #B42318;
  --good-bg: rgba(12, 163, 12, 0.1);
  --warn-bg: rgba(250, 178, 25, 0.18);
  --crit-bg: rgba(208, 59, 59, 0.1);

  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 16px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 24px 64px rgba(15, 23, 42, 0.22);
  --topbar-bg: rgba(244, 246, 250, 0.86);
  --radius: 14px;
  --radius-sm: 9px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0B1120;
    --surface: #161F33;
    --surface-2: #1B2438;
    --surface-3: #232E47;
    --border: #263049;
    --border-strong: #35425F;
    --text: #F1F5F9;
    --text-2: #CBD5E1;
    --muted: #94A3B8;
    --accent: #E8384F;
    --accent-text: #FF8A98;
    --accent-soft: rgba(255, 107, 122, 0.12);
    --focus: #6DA7EC;
    --s1: #3987E5;
    --s2: #D95926;
    --s3: #199E70;
    --grid: #263049;
    --axis: #64748B;
    --good: #4ADE80;
    --warn: #FBBF24;
    --crit: #FF8A80;
    --good-bg: rgba(74, 222, 128, 0.12);
    --warn-bg: rgba(251, 191, 36, 0.14);
    --crit-bg: rgba(255, 138, 128, 0.14);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.6);
    --topbar-bg: rgba(11, 17, 32, 0.86);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0B1120;
  --surface: #161F33;
  --surface-2: #1B2438;
  --surface-3: #232E47;
  --border: #263049;
  --border-strong: #35425F;
  --text: #F1F5F9;
  --text-2: #CBD5E1;
  --muted: #94A3B8;
  --accent: #E8384F;
  --accent-text: #FF8A98;
  --accent-soft: rgba(255, 107, 122, 0.12);
  --focus: #6DA7EC;
  --s1: #3987E5;
  --s2: #D95926;
  --s3: #199E70;
  --grid: #263049;
  --axis: #64748B;
  --good: #4ADE80;
  --warn: #FBBF24;
  --crit: #FF8A80;
  --good-bg: rgba(74, 222, 128, 0.12);
  --warn-bg: rgba(251, 191, 36, 0.14);
  --crit-bg: rgba(255, 138, 128, 0.14);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.6);
  --topbar-bg: rgba(11, 17, 32, 0.86);
}

/* ---------------------------------------------------------------- base --- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
code { font-family: var(--mono); font-size: 0.9em; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
svg { display: block; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }

.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 100;
  background: var(--accent-btn); color: var(--on-accent); padding: 8px 14px; border-radius: 8px; text-decoration: none;
}
.skip-link:focus { top: 12px; }
.noscript { padding: 24px; text-align: center; }

/* --------------------------------------------------------------- login --- */
.login {
  min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background:
    radial-gradient(ellipse 60% 50% at 50% 0%, var(--accent-soft), transparent 70%),
    var(--bg);
}
.login-card {
  width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; padding: 32px 28px 24px; box-shadow: var(--shadow);
}
.login-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; font-size: 18px; margin-bottom: 20px; }
.login-card h1 { font-size: 24px; letter-spacing: -0.02em; }
.login-lede { color: var(--muted); margin: 6px 0 22px; }
.field-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.password-row { display: flex; gap: 8px; }
.password-row input {
  flex: 1; min-width: 0; height: 46px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); font-size: 16px; letter-spacing: 0.04em;
}
.password-row input:focus { outline: 2px solid var(--focus); outline-offset: 1px; }
.login-message { min-height: 22px; margin: 10px 0 6px; font-size: 14px; color: var(--crit); }
.login-message.info { color: var(--muted); }
.login-back { display: block; text-align: center; margin-top: 18px; color: var(--muted); font-size: 14px; text-decoration: none; }
.login-back:hover { color: var(--accent-text); }

/* ------------------------------------------------------------- buttons --- */
.primary-btn, .ghost-btn, .icon-btn {
  border-radius: var(--radius-sm); border: 1px solid transparent; transition: background .15s, border-color .15s, transform .05s;
}
.primary-btn {
  width: 100%; height: 46px; background: var(--accent-btn); color: var(--on-accent); font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
}
.primary-btn:hover:not(:disabled) { filter: brightness(1.07); }
.primary-btn:active:not(:disabled) { transform: translateY(1px); }
.primary-btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-spinner { display: none; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
.primary-btn.loading .btn-spinner { display: inline-block; }
.ghost-btn { height: 40px; padding: 0 14px; background: transparent; border-color: var(--border-strong); color: var(--text-2); font-weight: 500; white-space: nowrap; }
.ghost-btn:hover { background: var(--surface-2); color: var(--text); }
.ghost-btn.small { height: 34px; padding: 0 12px; font-size: 13px; }
.ghost-btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
.icon-btn { width: 40px; height: 40px; display: inline-grid; place-items: center; background: transparent; border-color: var(--border-strong); color: var(--text-2); flex: none; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn.spinning svg { animation: spin .8s linear infinite; }
#theme .icon-sun { display: none; }
:root[data-theme="dark"] #theme .icon-sun { display: block; }
:root[data-theme="dark"] #theme .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) #theme .icon-sun { display: block; }
  :root:not([data-theme="light"]) #theme .icon-moon { display: none; }
}

.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; color: var(--text-2); user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { width: 38px; height: 22px; background: var(--surface-3); border: 1px solid var(--border-strong); border-radius: 99px; position: relative; transition: background .15s; }
.switch-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .15s; }
.switch input:checked + .switch-track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--focus); outline-offset: 2px; }

/* -------------------------------------------------------------- topbar --- */
.topbar {
  position: sticky; top: 0; z-index: 30; background: var(--topbar-bg);
  -webkit-backdrop-filter: saturate(160%) blur(14px); backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar-row { display: flex; align-items: center; gap: 10px; max-width: 1280px; margin: 0 auto; padding: 10px 20px; }
.topbar-row.filters-row { padding-top: 0; flex-wrap: wrap; gap: 10px 14px; }
.topbar-spacer { flex: 1; }
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--text); text-decoration: none; font-weight: 700; font-size: 17px; }
.brand-tag { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-text); background: var(--accent-soft); padding: 3px 8px; border-radius: 99px; }
.refresh-group { display: flex; align-items: center; gap: 10px; }
.updated { font-size: 13px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-3); border-radius: 11px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.segmented::-webkit-scrollbar { display: none; }
.segmented button {
  height: 34px; padding: 0 14px; border: 0; background: transparent; border-radius: 8px; color: var(--text-2);
  font-weight: 500; font-size: 14px; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
}
.segmented button:hover { color: var(--text); }
.segmented button[aria-checked="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(15,23,42,.18); font-weight: 600; }
.segmented.compact button { padding: 0 12px; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.dot.p-rummaan53 { background: var(--s1); }
.dot.p-mshop { background: var(--s2); }
.dot.p-packetpulse { background: var(--s3); }
.dot.p-all { background: conic-gradient(var(--s1) 0 33%, var(--s2) 0 66%, var(--s3) 0); }

.tabs-scroll { max-width: 1280px; margin: 0 auto; padding: 0 20px; overflow-x: auto; scrollbar-width: none; }
.tabs-scroll::-webkit-scrollbar { display: none; }
.tabs { display: flex; gap: 4px; min-width: max-content; }
.tabs button {
  height: 42px; padding: 0 14px; border: 0; background: transparent; color: var(--muted); font-weight: 500; position: relative; white-space: nowrap;
}
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] { color: var(--text); font-weight: 600; }
.tabs button[aria-selected="true"]::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 3px; background: var(--accent); border-radius: 3px 3px 0 0; }
.tabs .count { margin-left: 6px; font-size: 12px; background: var(--surface-3); color: var(--text-2); padding: 1px 7px; border-radius: 99px; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- main --- */
.main { max-width: 1280px; margin: 0 auto; padding: 20px 20px 8px; outline: none; }
.panel { display: flex; flex-direction: column; gap: 16px; }
.main.loading .panel { opacity: .55; transition: opacity .15s; pointer-events: none; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px 20px; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.card-title { font-size: 16px; font-weight: 650; letter-spacing: -0.01em; }
.card-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }

.notice { padding: 12px 16px; border-radius: var(--radius-sm); background: var(--warn-bg); color: var(--text); border: 1px solid var(--border-strong); margin-bottom: 14px; font-size: 14px; }
.notice.error { background: var(--crit-bg); }

/* -------------------------------------------------------- source strip --- */
.source-strip { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.source-chip { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; padding: 6px 12px; border-radius: 99px; background: var(--surface); border: 1px solid var(--border); color: var(--text-2); }
.source-chip .state { font-weight: 600; }
.source-chip.ok .state { color: var(--good); }
.source-chip.warn .state { color: var(--warn); }
.source-chip.bad .state { color: var(--crit); }
.source-chip svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

/* --------------------------------------------------- property cards ------- */
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.pcard {
  text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; min-width: 0; position: relative; overflow: hidden;
}
.pcard::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c, var(--s1)); }
.pcard.p-rummaan53 { --c: var(--s1); }
.pcard.p-mshop { --c: var(--s2); }
.pcard.p-packetpulse { --c: var(--s3); }
.pcard:hover { border-color: var(--border-strong); }
.pcard[aria-pressed="true"] { border-color: var(--c); box-shadow: 0 0 0 1px var(--c), var(--shadow); }
.pcard-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pcard-name { font-weight: 650; display: inline-flex; align-items: center; gap: 8px; }
.pcard-state { font-size: 12px; color: var(--muted); }
.pcard-nums { display: flex; gap: 22px; align-items: flex-end; }
.pcard-num { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.pcard-lab { font-size: 12px; color: var(--muted); }
.spark { width: 100%; height: 36px; }
.spark path.line { fill: none; stroke: var(--c); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.spark path.area { fill: var(--c); opacity: .1; stroke: none; }

/* ----------------------------------------------------------------- kpis --- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); min-width: 0; }
.kpi-lab { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.kpi-val { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi-hint { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.kpi button { all: unset; cursor: pointer; color: var(--accent-text); text-decoration: underline; text-underline-offset: 2px; }
.kpi button:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* --------------------------------------------------------------- charts --- */
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-bottom: 8px; font-size: 13px; color: var(--text-2); }
.legend-item { display: inline-flex; align-items: center; gap: 8px; }
.legend-key { width: 16px; height: 3px; border-radius: 2px; background: var(--c); }
.chart { position: relative; width: 100%; height: 280px; border-radius: 8px; }
.chart svg { width: 100%; height: 100%; overflow: visible; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .axis-text { fill: var(--muted); font-size: 11.5px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart .series-line { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chart .series-area { stroke: none; opacity: .1; }
.chart .endcap { stroke: var(--surface); stroke-width: 2; }
.chart .cross { stroke: var(--axis); stroke-width: 1; }
.chart .hover-dot { stroke: var(--surface); stroke-width: 2; }
.tip {
  position: absolute; z-index: 5; pointer-events: none; min-width: 150px; max-width: 260px; background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 9px 12px; font-size: 13px;
}
.tip-title { color: var(--muted); font-size: 12px; margin-bottom: 5px; }
.tip-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 3px; }
.tip-row .k { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); }
.tip-row .k i { width: 12px; height: 3px; border-radius: 2px; background: var(--c); display: inline-block; }
.tip-row b { font-variant-numeric: tabular-nums; font-weight: 650; }

.bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.bar-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "label val" "track track"; gap: 3px 12px; align-items: baseline; }
.bar-row.clickable { cursor: pointer; border-radius: 8px; }
.bar-row.clickable:hover .bar-label { color: var(--accent-text); }
.bar-label { grid-area: label; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.bar-label small { color: var(--muted); margin-left: 6px; font-size: 12.5px; }
.bar-val { grid-area: val; font-variant-numeric: tabular-nums; font-weight: 600; font-size: 14px; white-space: nowrap; }
.bar-val small { color: var(--muted); font-weight: 400; margin-left: 6px; }
.bar-track { grid-area: track; height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; background: var(--c, var(--s1)); min-width: 3px; }
.bar-fill.p-rummaan53 { --c: var(--s1); }
.bar-fill.p-mshop { --c: var(--s2); }
.bar-fill.p-packetpulse { --c: var(--s3); }

.segbar { display: flex; height: 12px; gap: 2px; border-radius: 6px; overflow: hidden; background: var(--surface-3); }
.segbar span { height: 100%; min-width: 2px; background: var(--c); }
.seg-legend { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 12px; font-size: 14px; }
.seg-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 8px; background: var(--c); }
.seg-legend b { font-variant-numeric: tabular-nums; margin-left: 6px; }

.heat { display: grid; grid-template-columns: 38px repeat(24, minmax(0, 1fr)); gap: 3px; align-items: center; }
.heat .hx, .heat .hy { font-size: 11.5px; color: var(--muted); text-align: center; }
.heat .hy { text-align: right; padding-right: 6px; }
.heat .cell { aspect-ratio: 1; border-radius: 4px; background: color-mix(in srgb, var(--s1) calc(var(--v, 0) * 100%), var(--surface-3)); min-height: 12px; }
.heat .cell:hover { outline: 2px solid var(--text); outline-offset: 1px; }
.heat-scale { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.heat-scale i { width: 120px; height: 8px; border-radius: 4px; background: linear-gradient(90deg, var(--surface-3), var(--s1)); }

/* --------------------------------------------------------------- tables --- */
.table-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: left; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 8px 12px; border-bottom: 1px solid var(--border-strong); white-space: nowrap; background: var(--surface); position: sticky; top: 0; }
table.data td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data tbody tr.clickable { cursor: pointer; }
table.data tbody tr.clickable:hover td { background: var(--surface-2); }
table.data tbody tr:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.cell-main { font-weight: 550; overflow-wrap: anywhere; }
.cell-sub { color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 99px; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.badge .dot { width: 8px; height: 8px; }
.badge.bot { background: var(--warn-bg); color: var(--warn); }
.badge.priv { background: var(--surface-3); }
.empty { padding: 36px 16px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }
.empty .hint { margin-top: 8px; font-size: 13px; }
.skeleton { background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; border-radius: 8px; }
.skel-row { height: 18px; margin: 12px 0; }

.log-filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.search { position: relative; flex: 1 1 280px; min-width: 200px; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.search input { width: 100%; height: 40px; padding: 0 12px 0 38px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); }
.log-filters select { height: 40px; padding: 0 30px 0 12px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); max-width: 100%; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip { display: inline-flex; align-items: center; gap: 8px; background: var(--accent-soft); color: var(--accent-text); border-radius: 99px; padding: 4px 6px 4px 12px; font-size: 13px; font-weight: 550; }
.chip button { border: 0; background: transparent; width: 22px; height: 22px; border-radius: 50%; color: inherit; display: grid; place-items: center; }
.chip button:hover { background: var(--accent-soft); }
.chip button svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 14px; font-size: 14px; color: var(--muted); }
.pager .btns { display: flex; gap: 8px; align-items: center; }
.pager select { height: 34px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); padding: 0 8px; }

/* --------------------------------------------------------------- drawer --- */
.scrim { position: fixed; inset: 0; background: rgba(2, 6, 23, 0.5); z-index: 60; animation: fade .15s ease-out; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 61; width: min(520px, 100vw); background: var(--surface);
  border-left: 1px solid var(--border); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: slide .2s ease-out;
}
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 18px 20px 14px; border-bottom: 1px solid var(--border); }
.drawer-head h2 { font-size: 18px; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.drawer-kicker { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-text); margin-bottom: 2px; }
.drawer-body { overflow-y: auto; padding: 8px 20px 28px; flex: 1; }
.dgroup { margin-top: 18px; }
.dgroup h3 { font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.dl { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 7px 14px; font-size: 14px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; overflow-wrap: anywhere; }
.drawer-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--border-strong); display: flex; flex-direction: column; gap: 12px; }
.timeline li { position: relative; font-size: 14px; }
.timeline li::before { content: ""; position: absolute; left: -20px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--c, var(--s1)); }

/* ---------------------------------------------------------------- misc ---- */
.toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: calc(100% - 32px); }
.toast { background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); font-size: 14px; max-width: 520px; animation: slide-up .2s ease-out; pointer-events: auto; }
.toast.error { background: var(--crit); color: #fff; }
.foot { max-width: 1280px; margin: 0 auto; padding: 18px 20px 36px; display: flex; flex-wrap: wrap; gap: 6px 24px; color: var(--muted); font-size: 12.5px; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(24px); opacity: 0; } }
@keyframes slide-up { from { transform: translateY(8px); opacity: 0; } }

/* ----------------------------------------------------------- responsive --- */
@media (max-width: 1000px) {
  .grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cards { grid-template-columns: 1fr; }
  .pcard { flex-direction: row; align-items: center; flex-wrap: wrap; }
  .pcard .spark { flex: 1 1 140px; max-width: 220px; }
}
@media (max-width: 720px) {
  .topbar-row { padding: 8px 14px; flex-wrap: wrap; gap: 8px; }
  .refresh-group { gap: 8px; }
  .switch-text { display: none; }
  #signout { padding: 0 12px; height: 40px; }
  .source-strip { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-left: -14px; margin-right: -14px; padding: 0 14px 2px; }
  .source-strip::-webkit-scrollbar { display: none; }
  .source-chip { flex: none; }
  .topbar-row.filters-row { padding-top: 0; }
  .tabs-scroll { padding: 0 8px; }
  .main { padding: 14px 14px 4px; }
  .grid.two, .grid.three { grid-template-columns: 1fr; }
  .brand-name { display: none; }
  .updated { display: none; }
  .card { padding: 14px 14px 16px; }
  .chart { height: 240px; }
  .heat { grid-template-columns: 30px repeat(24, minmax(0, 1fr)); gap: 2px; }
  .heat .hx { font-size: 10px; }
  .dl { grid-template-columns: 110px minmax(0, 1fr); }
  .drawer { width: 100vw; }
  .foot { padding: 14px 14px 30px; }

  /* Tables turn into stacked cards: every cell carries its own label. */
  table.data thead { position: absolute; left: -9999px; }
  table.data, table.data tbody, table.data tr, table.data td { display: block; width: 100%; }
  table.data tr { border: 1px solid var(--border); border-radius: 12px; padding: 8px 12px; margin-bottom: 10px; background: var(--surface); }
  table.data td { border: 0; padding: 5px 0; display: flex; gap: 12px; justify-content: space-between; text-align: right; }
  table.data td::before { content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; text-align: left; flex: none; padding-top: 2px; }
  table.data td.num { text-align: right; }
  table.data td > * { min-width: 0; }
  .table-wrap { overflow-x: visible; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

@media (forced-colors: active) {
  .bar-fill, .segbar span, .heat .cell { forced-color-adjust: none; }
  .tabs button[aria-selected="true"]::after { background: Highlight; }
}

@media print {
  .topbar, .drawer, .scrim, .toasts, .skip-link { display: none !important; }
  body { background: #fff; }
  .panel[hidden] { display: none !important; }
  .card { box-shadow: none; break-inside: avoid; }
}
