/* Lebe Ops — design system.
   Identity is taken from the marks: Lebe's three overlapping lenses (forest
   green → vivid green → lime) and Lemo's gold coin. Forest green carries
   structure, vivid green means "good", lime is the single high-energy
   highlight used at most once per screen, and gold means money.
   Chart hues are the validated categorical set — light and dark are stepped
   separately, never inverted. */

:root {
  /* brand */
  --forest: #05613E;
  --green: #12B76A;
  --lime: #B9D42B;
  --gold: #E9A020;

  /* surfaces & ink (light) — neutral, faint green bias, no colour in the chrome */
  --bg: #FBFBFA;
  --surface: #FFFFFF;
  --surface-2: #FAFAF9;
  --surface-3: #F2F3F1;
  --border: #E7E8E5;
  --border-strong: #D8DAD6;
  --ink: #161A18;
  --ink-2: #5B615D;
  --ink-3: #8A918C;
  --accent: #0E7C5A;
  --accent-ink: #FFFFFF;
  --accent-soft: #EEF2F0;
  --accent-line: #DDE0DC;

  /* semantic */
  --good: #0E7C5A;   --good-bg: #E4F2EB;
  --warn: #9A6B0A;   --warn-bg: #FAF0DA;
  --crit: #A33636;   --crit-bg: #FAE7E7;
  --info: #3C5CC4;   --info-bg: #E7EBFA;

  /* charts (validated light set) */
  --c1: #0E7C5A; --c2: #E9A020; --c3: #4A6FE3; --c4: #B3452C; --c5: #7A4FD1;
  --grid: #EBEEE8;
  --bar-mute: #DDE5DC;

  --shadow-sm: none;
  --shadow: 0 1px 2px rgba(9, 30, 22, .04);
  --shadow-lg: 0 24px 60px -24px rgba(9, 30, 22, .28);

  --r-sm: 8px; --r: 12px; --r-lg: 16px; --r-pill: 999px;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Display",
          "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

:root[data-theme="dark"] {
  --bg: #0D0F0E;
  --surface: #141614;
  --surface-2: #171A18;
  --surface-3: #1E2220;
  --border: #232724;
  --border-strong: #2E332F;
  --ink: #ECEEEC;
  --ink-2: #A0A6A2;
  --ink-3: #71776F;
  --accent: #3DCB93;
  --accent-ink: #06231A;
  --accent-soft: #1B211E;
  --accent-line: #2A302C;

  --good: #3DCB93;  --good-bg: #14291F;
  --warn: #D9A341;  --warn-bg: #2B2413;
  --crit: #E08585;  --crit-bg: #2E1B1B;
  --info: #7F9BF0;  --info-bg: #1A2138;

  --c1: #22A473; --c2: #C08A0E; --c3: #6488E8; --c4: #D9705A; --c5: #8F72D9;
  --grid: #222C26;
  --bar-mute: #2C3A32;

  --shadow-sm: none;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-lg: 0 24px 60px -24px rgba(0, 0, 0, .8);
}

* { box-sizing: border-box; }
/* dvh tracks the VISIBLE viewport on iOS (excluding the URL bar); vh is fixed
   at the fully-expanded height, which pushes content below the fold. */
html, body { height: 100%; height: 100dvh; }
/* The grey iOS tap flash fights our own :active feedback — kill it and let
   the scale press be the only response. */
html { -webkit-tap-highlight-color: transparent; }
button, a, [role="button"], input, select {
  -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none;
}
.btn:active, .iconbtn:active, nav button:active, .segment button:active,
.installbar:active { transform: scale(.97); }
/* Scroll chaining out of a panel into the page reads as a broken app. */
.drawer, .drawer-body, .tablewrap, .content {
  overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
}
body {
  /* Nothing may scroll the page sideways: a single overflowing child used to
     widen the document and clip every card's right edge. */
  overflow-x: hidden;
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--sans); font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
::selection { background: var(--accent-soft); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ── brand mark ─────────────────────────────────────────────── */
/* Two files, identical in design; the dark one only lifts the near-black
   wordmark so it stays legible. No plate, no filter, no redraw. */
.logo { display: block; width: 100%; height: auto; }
.logo-dark { display: none; }
:root[data-theme="dark"] .logo-light { display: none; }
:root[data-theme="dark"] .logo-dark { display: block; }
.brandplate { display: block; line-height: 0; }
aside .brandplate { width: 104px; }
.login-card .brandplate { width: 150px; margin: 0 0 18px -3px; }
.wordmark { display: flex; align-items: center; gap: 9px; }

/* ── login ──────────────────────────────────────────────────── */
#login {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(60rem 40rem at 15% -10%, var(--accent-soft), transparent 60%),
    radial-gradient(48rem 32rem at 105% 110%, var(--surface-3), transparent 65%),
    var(--bg);
}
.login-card {
  width: min(376px, 100%); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 32px; box-shadow: var(--shadow);
}
.login-card h1 { font-size: 19px; font-weight: 640; letter-spacing: -.02em; margin: 22px 0 4px; }
.login-card .muted { color: var(--ink-3); font-size: 13px; margin: 0 0 22px; }
label {
  display: block; font-size: 11px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--ink-3); margin: 14px 0 6px;
}
input[type=text], input[type=email], input[type=password], input[type=search],
textarea, select {
  width: 100%; padding: 10px 12px; background: var(--surface-2);
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  font-size: 14px; transition: border-color .15s, background .15s;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--accent); background: var(--surface);
}
textarea { resize: vertical; min-height: 88px; line-height: 1.55; }
#tp { letter-spacing: .35em; font-family: var(--mono); text-align: center; font-size: 17px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px; border-radius: var(--r-sm); border: 1px solid transparent;
  font-size: 13.5px; font-weight: 560; transition: filter .15s, background .15s;
}
.btn:hover { filter: brightness(1.05); }
.btn-primary { background: var(--accent); color: var(--accent-ink); width: 100%; padding: 11px; }
.btn-ghost { background: var(--surface); border-color: var(--border-strong); color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--ink); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn-danger { background: var(--crit-bg); color: var(--crit); border-color: transparent; }
.err { color: var(--crit); font-size: 13px; margin-top: 14px; min-height: 19px; }

/* ── shell ──────────────────────────────────────────────────── */
#shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
aside {
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 18px 12px;
  position: sticky; top: 0; height: 100vh;
}
aside .wordmark { padding: 4px 10px 20px; }
nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-label {
  font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-3); padding: 16px 10px 6px;
}
nav button {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 9px 10px; border: 0; border-radius: var(--r-sm); background: none;
  color: var(--ink-2); font-size: 13.5px; font-weight: 500; position: relative;
  transition: background .14s, color .14s;
}
nav button:hover { background: var(--surface-3); color: var(--ink); }
nav button.on { background: var(--surface-3); color: var(--ink); font-weight: 560; }
nav button svg { width: 17px; height: 17px; flex: none; opacity: .9; }
nav .count {
  margin-left: auto; font-size: 11px; font-weight: 650; font-family: var(--mono);
  background: var(--crit-bg); color: var(--crit); padding: 1px 7px; border-radius: var(--r-pill);
}
.side-foot { border-top: 1px solid var(--border); padding-top: 12px; }
.userbox { display: flex; align-items: center; gap: 10px; padding: 6px 10px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: none; display: grid;
  place-items: center; background: var(--accent); color: var(--accent-ink);
  font-size: 12px; font-weight: 650;
}
.userbox .nm { font-size: 12.5px; font-weight: 600; line-height: 1.25; }
.userbox .rl { font-size: 11px; color: var(--ink-3); text-transform: capitalize; }

main { min-width: 0; max-width: 100%; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 14px; padding: 14px 26px;
  border-bottom: 1px solid var(--border); background: var(--surface);
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 17px; font-weight: 640; letter-spacing: -.02em; margin: 0; }
.topbar .sub { font-size: 12.5px; color: var(--ink-3); margin: 1px 0 0; }
.spacer { flex: 1; }
.iconbtn {
  width: 34px; height: 34px; display: grid; place-items: center; border-radius: var(--r-sm);
  background: var(--surface); border: 1px solid var(--border-strong); color: var(--ink-2);
}
.iconbtn:hover { background: var(--surface-3); color: var(--ink); }
/* Inset ring: the control's outer geometry never changes on hover, so a row
   of them cannot shift by a pixel. */
.iconbtn:hover, .btn-ghost:hover { box-shadow: inset 0 0 0 1px var(--accent-line); }
@media (hover: none) {
  /* Touch has no hover state — anything revealed on hover must be permanent. */
  .row .val .btn, .q-actions { opacity: 1 !important; }
}
.iconbtn svg { width: 16px; height: 16px; }
.content { padding: 22px 26px 56px; max-width: 1500px; width: 100%; }

/* ── segmented period filter ────────────────────────────────── */
.segment {
  display: inline-flex; background: var(--surface-3); border-radius: var(--r-pill);
  padding: 3px; gap: 2px; border: 1px solid var(--border);
}
.segment button {
  border: 0; background: none; padding: 5px 13px; border-radius: var(--r-pill);
  font-size: 12.5px; font-weight: 540; color: var(--ink-2); transition: all .16s;
}
.segment button.on {
  background: var(--surface); color: var(--ink); font-weight: 620;
  box-shadow: var(--shadow-sm);
}

/* ── cards & grid ───────────────────────────────────────────── */
.grid { display: grid; gap: 16px; }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-1-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
@media (max-width: 1180px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3, .g-2-1, .g-1-2 { grid-template-columns: minmax(0, 1fr); }
}

/* ── phones & installed app ─────────────────────────────────────
   The sidebar becomes a bottom tab bar, because on a phone the thumb is at
   the bottom and a left rail is unreachable. Safe-area insets keep the bar
   clear of the iPhone home indicator when this runs as an installed app. */
@media (max-width: 860px) {
  #shell { grid-template-columns: 1fr; }

  aside {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 45;
    height: auto; flex-direction: row; padding: 6px 4px;
    padding-bottom: calc(6px + env(safe-area-inset-bottom));
    border-right: 0; border-top: 1px solid var(--border);
    box-shadow: 0 -6px 24px -18px rgba(0, 0, 0, .5);
  }
  aside .wordmark, .nav-label, .side-foot { display: none; }
  /* Six tabs must share the width without pushing the page wider than the
     screen — an overflowing tab bar was clipping every card on the right. */
  nav { flex-direction: row; gap: 0; width: 100%; }
  nav button {
    flex: 1 1 0; min-width: 0; flex-direction: column; gap: 3px;
    padding: 6px 2px; font-size: 10px; letter-spacing: -.01em;
    text-align: center; font-weight: 560; border-radius: 10px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  nav button svg { width: 20px; height: 20px; }
  nav button.on { background: none; }
  nav button.on::before {
    left: 50%; top: 0; transform: translateX(-50%);
    width: 20px; height: 3px; border-radius: 0 0 3px 3px;
  }

  .topbar {
    padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top));
    gap: 8px; flex-wrap: wrap;
  }
  .topbar h1 { font-size: 16px; }
  .topbar .sub { display: none; }
  .spacer { display: none; }
  /* The period filter gets its own scrollable row instead of squeezing the
     title — the two used to collide at this width. */
  .segment {
    order: 10; width: 100%; overflow-x: auto; justify-content: flex-start;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
  }
  .segment::-webkit-scrollbar { display: none; }
  .segment button { white-space: nowrap; }

  .content {
    padding: 14px 14px calc(84px + env(safe-area-inset-bottom));
  }
  /* Under 16px iOS zooms the page on focus and never zooms back out. */
  input, textarea, select { font-size: 16px !important; }
  /* iOS minimum comfortable target. */
  .iconbtn { width: 40px; height: 40px; }
  .btn { min-height: 40px; }
  .grid { gap: 12px; }
  .g4, .g2, .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card { padding: 14px; border-radius: 14px; }
  .stat .v { font-size: 25px; }
  .stat .foot { font-size: 11px; }
  .ratenum { font-size: 36px; }

  .drawer {
    top: auto; width: 100%; max-height: 92dvh; border-left: 0; border-top: 1px solid var(--border);
    border-radius: 18px 18px 0 0; transform: translateY(100%);
    box-shadow: 0 -10px 40px rgba(0, 0, 0, .28);
  }
  .drawer.on { transform: translateY(0); }
  .drawer-head { padding-top: 22px; position: relative; }
  /* Drag handle drawn on the header — no extra markup, stays pinned. */
  .drawer-head::before {
    content: ""; position: absolute; left: 50%; top: 8px; transform: translateX(-50%);
    width: 38px; height: 4px; border-radius: 999px; background: var(--border-strong);
  }
  .drawer-body { padding-bottom: calc(32px + env(safe-area-inset-bottom)); }
  .installbar { bottom: calc(78px + env(safe-area-inset-bottom)); right: 12px; left: 12px;
    justify-content: space-between; }
  /* Dense tables keep the identifying column pinned while the rest scrolls. */
  th:first-child, td:first-child {
    position: sticky; left: 0; background: var(--surface); z-index: 1;
  }
  .tablewrap { margin: 0 -14px -14px; }
  th, td { padding: 9px 12px; }
}

@media (max-width: 520px) {
  .g4, .g2, .g3 { grid-template-columns: minmax(0, 1fr); }
  .rankrow { grid-template-columns: minmax(64px, 38%) 1fr auto; gap: 8px; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dd { margin-bottom: 8px; }
}

/* An installed app has no browser chrome to lean on, so the shell paints the
   status-bar area itself. */
@media (display-mode: standalone) {
  .topbar { padding-top: calc(10px + env(safe-area-inset-top)); }
  #login { padding-top: calc(24px + env(safe-area-inset-top)); }
}
.card {
  min-width: 0; max-width: 100%;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 18px; box-shadow: var(--shadow-sm);
}
.card-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.card-head h3 { font-size: 14px; font-weight: 620; margin: 0; letter-spacing: -.01em; }
.card-head p { font-size: 12px; color: var(--ink-3); margin: 2px 0 0; }
.section-title {
  font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-3); margin: 26px 0 12px;
}
.section-title:first-child { margin-top: 0; }

/* ── stat tiles ─────────────────────────────────────────────── */
.statgrid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px; background: var(--border);
  border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden;
}
.statgrid .stat {
  background: var(--surface); border: 0; border-radius: 0; box-shadow: none;
  padding: 16px 18px 18px; position: relative; display: flex; flex-direction: column;
  min-height: 118px;
}
.stat .foot { margin-top: auto; }
@media (max-width: 1180px) { .statgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .statgrid { grid-template-columns: minmax(0, 1fr); } }
.stat .k {
  font-size: 12.5px; font-weight: 480; letter-spacing: 0; text-transform: none;
  color: var(--ink-3); display: flex; align-items: center; gap: 7px;
}
.stat .k svg { width: 14px; height: 14px; opacity: .75; }
.stat .v {
  font-size: 28px; font-weight: 560; letter-spacing: -.02em; margin: 8px 0 0;
  font-variant-numeric: tabular-nums; line-height: 1.1; color: var(--ink);
}
.stat .v .cur { font-size: 15px; font-weight: 480; color: var(--ink-3); margin-right: 4px; }
.stat .foot { display: flex; align-items: center; gap: 8px; margin-top: 9px; font-size: 12px; }
.delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 620; font-variant-numeric: tabular-nums; }
.delta.up { color: var(--good); } .delta.down { color: var(--crit); } .delta.flat { color: var(--ink-3); }
.delta svg { width: 12px; height: 12px; }
.stat .vs { color: var(--ink-3); }
:root[data-theme="dark"] 
.sparkrow { margin: 12px -18px -18px; height: 34px; overflow: hidden; }
.spark { display: block; width: 100%; height: 34px; }
.spark path.line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; }
.spark path.fill { fill: var(--accent-soft); }

/* ── chips & pills ──────────────────────────────────────────── */
.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 2.5px 9px;
  border-radius: var(--r-pill); font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.chip.good { background: var(--good-bg); color: var(--good); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.crit { background: var(--crit-bg); color: var(--crit); }
.chip.info { background: var(--info-bg); color: var(--info); }
.chip.neutral { background: var(--surface-3); color: var(--ink-2); }

/* ── tables ─────────────────────────────────────────────────── */
.tablewrap { overflow-x: auto; margin: 0 -18px -18px; padding: 0 2px; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th {
  text-align: left; font-size: 10.5px; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: var(--ink-3); padding: 9px 16px;
  border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface);
}
td {
  padding: 11px 16px; border-bottom: 1px solid var(--border); vertical-align: middle;
  font-variant-numeric: tabular-nums;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr.clickable { cursor: pointer; transition: background .12s; }
tbody tr.clickable:hover td { background: var(--surface-2); }
td .strong { font-weight: 600; color: var(--ink); }
td .sub { font-size: 11.5px; color: var(--ink-3); }
.num { text-align: right; }
.ref { font-family: var(--mono); font-size: 11.5px; color: var(--ink-2); }

/* ── charts ─────────────────────────────────────────────────── */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: hidden; }
.axis text { font-size: 10.5px; fill: var(--ink-3); font-family: var(--sans); }
.gridline { stroke: var(--grid); stroke-width: 1; }
.bar { transition: opacity .15s; }
.bar.muted { fill: var(--surface-3); }
.bar:hover { opacity: .82; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); }
.legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.tip {
  position: absolute; pointer-events: none; background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  box-shadow: var(--shadow); padding: 9px 11px; font-size: 12px; min-width: 132px;
  transform: translate(-50%, -110%); opacity: 0; transition: opacity .1s; z-index: 30;
}
.tip.on { opacity: 1; }
.tip .t { font-weight: 650; margin-bottom: 5px; font-size: 11.5px; color: var(--ink); }
.tip .r { display: flex; justify-content: space-between; gap: 14px; color: var(--ink-2); }
.tip .r b { color: var(--ink); font-variant-numeric: tabular-nums; font-weight: 620; }

/* ── list rows (top users, features, health) ────────────────── */
.rows { display: flex; flex-direction: column; }
.row {
  display: flex; align-items: center; gap: 12px; padding: 11px 0;
  border-bottom: 1px solid var(--border);
}
.row:last-child { border-bottom: 0; padding-bottom: 0; }
.row:first-child { padding-top: 0; }
.rank {
  width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center;
  background: var(--surface-3); color: var(--ink-2); font-size: 11px; font-weight: 700; flex: none;
}
.row .nm { font-weight: 570; font-size: 13px; }
.row .sub { font-size: 11.5px; color: var(--ink-3); }
.row .val { margin-left: auto; text-align: right; font-variant-numeric: tabular-nums; }
.row .val .big { font-weight: 640; font-size: 13.5px; }
.meter { height: 5px; border-radius: 3px; background: var(--surface-3); overflow: hidden; margin-top: 5px; }
.meter i { display: block; height: 100%; border-radius: 3px; background: var(--accent); }

/* ── health ─────────────────────────────────────────────────── */
.health { display: flex; align-items: flex-start; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--border); }
.health:last-child { border-bottom: 0; }
.beacon { width: 9px; height: 9px; border-radius: 50%; margin-top: 5px; flex: none; }
.beacon.operational { background: var(--good); box-shadow: 0 0 0 3px var(--good-bg); }
.beacon.degraded { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-bg); }
.beacon.down { background: var(--crit); box-shadow: 0 0 0 3px var(--crit-bg); animation: pulse 2s infinite; }
.beacon.unknown { background: var(--ink-3); box-shadow: 0 0 0 3px var(--surface-3); }
@keyframes pulse { 0%, 100% { opacity: 1 } 50% { opacity: .45 } }
@media (prefers-reduced-motion: reduce) { .beacon.down { animation: none } }
.health .nm { font-weight: 600; font-size: 13px; }
.health .why { font-size: 12px; color: var(--ink-2); margin-top: 2px; }
.health .role { font-size: 11.5px; color: var(--ink-3); }

/* ── drawer ─────────────────────────────────────────────────── */
.scrim {
  position: fixed; inset: 0; background: rgba(8, 20, 15, .42);
  backdrop-filter: blur(2px); z-index: 40; opacity: 0; transition: opacity .18s;
}
.scrim.on { opacity: 1; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%);
  background: var(--bg); border-left: 1px solid var(--border); z-index: 41;
  box-shadow: var(--shadow-lg); transform: translateX(100%); transition: transform .22s cubic-bezier(.32,.72,0,1);
  display: flex; flex-direction: column;
}
.drawer.on { transform: none; }
.drawer-head {
  padding: 18px 20px; border-bottom: 1px solid var(--border); background: var(--surface);
  display: flex; align-items: flex-start; gap: 12px;
}
.drawer-head h2 { font-size: 15.5px; font-weight: 640; margin: 3px 0 0; letter-spacing: -.01em; }
.drawer-body { padding: 18px 20px 40px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 16px; }
@media (prefers-reduced-motion: reduce) { .drawer { transition: none } }

.timeline { display: flex; flex-direction: column; gap: 0; }
.tl {
  display: grid; grid-template-columns: 14px 1fr; gap: 12px; padding-bottom: 16px; position: relative;
}
.tl::before { content: ""; position: absolute; left: 6px; top: 16px; bottom: 0; width: 1px; background: var(--border); }
.tl:last-child::before { display: none; }
.tl .pip { width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--surface); background: var(--accent); margin-top: 3px; z-index: 1; }
.tl .pip.note { background: var(--ink-3); } .tl .pip.status { background: var(--info); } .tl .pip.resolved { background: var(--good); }
.tl .who { font-size: 11.5px; color: var(--ink-3); }
.tl .what { font-size: 13px; margin-top: 2px; white-space: pre-wrap; }

.kv { display: grid; grid-template-columns: 130px 1fr; gap: 7px 14px; font-size: 13px; }
.kv dt { color: var(--ink-3); font-size: 12px; }
.kv dd { margin: 0; font-weight: 540; }

.empty { padding: 40px 20px; text-align: center; color: var(--ink-3); font-size: 13px; }
.empty svg { width: 34px; height: 34px; opacity: .35; margin-bottom: 10px; }
.skeleton { background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3));
  background-size: 200% 100%; animation: sh 1.3s infinite; border-radius: 6px; height: 13px; }
@keyframes sh { to { background-position: -200% 0 } }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.search { position: relative; flex: 1; min-width: 190px; max-width: 420px; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--ink-3); }
.search input { padding-left: 33px; border-radius: var(--r-pill); }
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(10px);
  background: var(--ink); color: var(--bg); padding: 11px 18px; border-radius: var(--r-pill);
  font-size: 13px; font-weight: 550; box-shadow: var(--shadow-lg); opacity: 0;
  transition: all .2s; z-index: 60; pointer-events: none;
}
.toast.on { opacity: 1; transform: translateX(-50%); }
.sla { font-family: var(--mono); font-size: 11.5px; font-weight: 600; }

/* The gauge is a single reading, not a hero graphic: cap its size so it can
   never grow into the rows beneath it on a wide card. */
#ch-gauge svg { max-width: 250px; margin: 4px auto 10px; display: block; }


/* ── bar-first chart language ───────────────────────────────── */
.bar { fill: var(--c1); transition: opacity .15s; }
.col { cursor: default; }
.col.dim .bar { opacity: .4; }
.col:hover .bar { opacity: 1; }
.spark rect { fill: var(--accent); opacity: .5; }

/* ranked horizontal bars */
.ranks { display: flex; flex-direction: column; gap: 11px; }
.rankrow {
  display: grid; grid-template-columns: minmax(72px, 30%) 1fr auto;
  align-items: center; gap: 12px;
}
.rankrow .rl { font-size: 12.5px; font-weight: 550; color: var(--ink-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rankrow .rt { background: var(--surface-3); border-radius: 5px; height: 22px; overflow: hidden; }
.rankrow .rt i { display: block; height: 100%; border-radius: 5px; transition: width .5s cubic-bezier(.32,.72,0,1); }
.rankrow .rv { font-size: 12.5px; font-weight: 650; font-variant-numeric: tabular-nums;
  min-width: 44px; text-align: right; }

/* one headline rate */
.ratehead { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.ratenum { font-size: 44px; font-weight: 680; letter-spacing: -.045em;
  font-variant-numeric: tabular-nums; line-height: 1; }
.ratecap { font-size: 12.5px; color: var(--ink-3); }
.ratetrack { height: 12px; border-radius: 6px; background: var(--surface-3);
  overflow: hidden; margin: 16px 0 12px; }
.ratetrack i { display: block; height: 100%; border-radius: 6px;
  transition: width .6s cubic-bezier(.32,.72,0,1); }
.ratelegend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); }
.ratelegend span { display: inline-flex; align-items: center; gap: 6px; }
.ratelegend i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.ratelegend b { color: var(--ink); font-variant-numeric: tabular-nums; }

/* Cards own their own height so a tall neighbour can never stretch a chart
   into dead space — the collision the first build had. */
.grid > .card { align-self: start; }

/* ── install prompt ─────────────────────────────────────────── */
.installbar {
  position: fixed; right: 18px; bottom: 18px; left: auto; transform: none;
  display: flex; align-items: center; gap: 14px; z-index: 55;
  background: var(--ink); color: var(--bg); border: 0;
  padding: 11px 12px 11px 18px; border-radius: var(--r-pill);
  font-size: 13px; font-weight: 550; box-shadow: var(--shadow-lg);
  max-width: calc(100vw - 32px);
}
.installbar .txt { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.installbar .go {
  background: var(--accent); color: var(--accent-ink); border: 0; flex: none;
  padding: 6px 14px; border-radius: var(--r-pill); font-weight: 640; font-size: 12.5px;
}
.installbar .dismiss {
  background: none; border: 0; color: inherit; opacity: .6; flex: none;
  display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
}
.installbar .dismiss:hover { opacity: 1; background: rgba(255, 255, 255, .12); }
.installbar .dismiss svg { width: 14px; height: 14px; }

/* feature rows: one component carrying name, value, volume bar and quality */
.featlist { display: flex; flex-direction: column; gap: 16px; }
.feat .fh { display: flex; align-items: baseline; gap: 12px; margin-bottom: 7px; }
.feat .fn { font-size: 13.5px; font-weight: 600; }
.feat .fv { margin-left: auto; font-size: 13.5px; font-weight: 650;
  font-variant-numeric: tabular-nums; }
.feat .rt { background: var(--surface-3); border-radius: 5px; height: 20px; overflow: hidden; }
.feat .rt i { display: block; height: 100%; border-radius: 5px;
  transition: width .5s cubic-bezier(.32,.72,0,1); }
.feat .fm { display: flex; justify-content: space-between; gap: 12px;
  margin-top: 6px; font-size: 11.5px; color: var(--ink-3); }
.feat .fm .ok { color: var(--good); font-weight: 600; }
.feat .fm .mid { color: var(--warn); font-weight: 600; }
.feat .fm .bad { color: var(--crit); font-weight: 600; }


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


/* sidebar brand block */
.brandbox { display: flex; align-items: center; gap: 7px; padding: 2px 8px 16px; }
.opslabel {
  font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-3); padding-bottom: 1px;
}

/* ── chart: one reference line, and a mark for days that were genuinely zero ── */
.refline { stroke: var(--accent); stroke-width: 1; stroke-dasharray: 4 4; opacity: .55; }
.reflabel { font-size: 11px; fill: var(--accent); font-family: var(--sans); font-weight: 560; }
.zero { fill: var(--border-strong); }        /* a day with no activity is data too */
.axis text { font-size: 11px; fill: var(--ink-3); font-family: var(--sans); }
