/* Rojicc Account — design tokens, base, layout.
   Dark ("observatory") is the default; light is selected per viewer.
   Chart series use the validated categorical palette (dataviz skill),
   in fixed member order — colour follows the member, never the rank. */

@font-face { font-family: "Geist"; src: url("/assets/geist-var.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "DM Mono"; src: url("/assets/dm-mono-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "DM Mono"; src: url("/assets/dm-mono-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }

:root {
  color-scheme: dark;
  --bg: #0a0912;
  --bg-glow-1: rgba(139, 92, 246, .10);
  --bg-glow-2: rgba(224, 173, 68, .07);
  --surface-1: #13111d;
  --surface-2: #191626;
  --surface-3: #221e33;
  --surface-in: #0f0d18;
  --line: #262138;
  --line-2: #342e4c;
  --grid: #231f34;
  --text-1: #f2eff8;
  --text-2: #bdb7d0;
  --text-3: #8a849f;
  --text-4: #6b6582;
  --accent: #e3b04b;
  --accent-strong: #f0c35e;
  --accent-ink: #1b1405;
  --accent-soft: rgba(227, 176, 75, .14);
  --arcane: #9b6ae0;
  --arcane-soft: rgba(155, 106, 224, .16);
  --pos: #4cc38a;
  --neg: #f07272;
  --good: #0ca30c; --warning: #fab219; --serious: #ec835a; --critical: #d03b3b;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
  --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
  --c-in: #3987e5; --c-out: #d95926;
  --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 8px 28px rgba(0,0,0,.35);
  --shadow-pop: 0 18px 50px rgba(0,0,0,.55), 0 0 0 1px var(--line-2);
  --radius: 12px;
  --radius-s: 8px;
  --gap: 16px;
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "DM Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f3fa;
  --bg-glow-1: rgba(139, 92, 246, .07);
  --bg-glow-2: rgba(224, 173, 68, .08);
  --surface-1: #ffffff;
  --surface-2: #faf9fd;
  --surface-3: #f0edf7;
  --surface-in: #f7f5fb;
  --line: #e7e3f0;
  --line-2: #d9d3e6;
  --grid: #ece8f3;
  --text-1: #16121f;
  --text-2: #4c465c;
  --text-3: #767089;
  --text-4: #9a94ab;
  --accent: #a8740f;
  --accent-strong: #8f6209;
  --accent-ink: #ffffff;
  --accent-soft: rgba(168, 116, 15, .10);
  --arcane: #6d43c7;
  --arcane-soft: rgba(109, 67, 199, .10);
  --pos: #11804f;
  --neg: #c62f2f;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --s8: #e34948;
  --c-in: #2a78d6; --c-out: #eb6834;
  --shadow: 0 1px 2px rgba(30,20,60,.05), 0 6px 20px rgba(30,20,60,.06);
  --shadow-pop: 0 18px 50px rgba(30,20,60,.18), 0 0 0 1px var(--line-2);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]):not([data-theme="light"]) { /* first paint before JS picks */
    color-scheme: light;
    --bg: #f5f3fa; --surface-1: #ffffff; --surface-2: #faf9fd; --surface-3: #f0edf7; --surface-in: #f7f5fb;
    --line: #e7e3f0; --line-2: #d9d3e6; --grid: #ece8f3;
    --text-1: #16121f; --text-2: #4c465c; --text-3: #767089; --text-4: #9a94ab;
    --accent: #a8740f; --accent-ink: #ffffff;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh;
  font: 14px/1.5 var(--font); color: var(--text-1); background: var(--bg);
  background-image:
    radial-gradient(1100px 520px at 12% -8%, var(--bg-glow-1), transparent 60%),
    radial-gradient(900px 480px at 92% -10%, var(--bg-glow-2), transparent 60%);
  background-attachment: fixed;
  font-feature-settings: "ss01", "cv11";
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--arcane-soft); }
[hidden] { display: none !important; }
.num, .tnum { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: .92em; letter-spacing: -.01em; }
.muted { color: var(--text-3); }
.dim { color: var(--text-4); }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- shell ---------------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 18px;
  height: 60px; padding: 0 22px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; flex: none; }
.brand .logo { height: 34px; width: auto; display: block; }
.logo-glow { opacity: .0; transition: opacity .8s; }
.live .logo-glow { opacity: .55; animation: breathe 5s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { opacity: .35; } 50% { opacity: .7; } }
.brand .tag { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); border-left: 1px solid var(--line-2); padding-left: 10px; }

.nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  padding: 7px 11px; border-radius: 8px; color: var(--text-2); font-weight: 500; font-size: 13.5px;
  white-space: nowrap; position: relative; text-decoration: none;
}
.nav a:hover { color: var(--text-1); background: var(--surface-2); }
.nav a.on { color: var(--text-1); background: var(--surface-3); }
.nav a.on::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -11px; height: 2px; border-radius: 2px; background: linear-gradient(90deg, var(--accent), var(--arcane)); }
.nav .count { margin-left: 6px; font-size: 11px; padding: 0 6px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); }

.top-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.iconbtn {
  position: relative; display: inline-grid; place-items: center; width: 36px; height: 36px;
  border-radius: 10px; border: 1px solid transparent; background: transparent; cursor: pointer; color: var(--text-2);
}
.iconbtn:hover { background: var(--surface-2); color: var(--text-1); border-color: var(--line); }
.iconbtn svg { width: 18px; height: 18px; }
.kbd-btn { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-1); color: var(--text-3); cursor: pointer; font-size: 13px; }
.kbd-btn:hover { color: var(--text-1); border-color: var(--line-2); }
kbd { white-space: nowrap; font: 500 11px var(--mono); padding: 1px 6px; border-radius: 6px; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text-2); }
.badge-dot {
  position: absolute; top: 2px; right: 1px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--critical); color: #fff; font: 600 11px/18px var(--font);
  text-align: center; box-shadow: 0 0 0 2px var(--bg);
}
.bell.ring svg { animation: wiggle .9s ease-in-out; transform-origin: 50% 10%; }
@keyframes wiggle { 0%,100% { transform: rotate(0); } 15% { transform: rotate(14deg); } 30% { transform: rotate(-12deg); } 45% { transform: rotate(9deg); } 60% { transform: rotate(-6deg); } 75% { transform: rotate(3deg); } }
.userbtn { display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 20px; border: 1px solid var(--line); background: var(--surface-1); cursor: pointer; }
.avatar { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 12px; color: #fff; background: linear-gradient(135deg, var(--arcane), var(--accent)); }
.userbtn .role { font-size: 11px; color: var(--text-3); }

.statusbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; padding: 8px 22px;
  font-size: 12.5px; color: var(--text-3); border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--surface-1) 55%, transparent);
}
.statusbar b { color: var(--text-1); font-weight: 600; }
.pulse { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--text-4); margin-right: 6px; vertical-align: 1px; }
.pulse.on { background: var(--good); box-shadow: 0 0 0 0 rgba(12,163,12,.6); animation: ping 2.4s infinite; }
.pulse.warn { background: var(--warning); }
.pulse.off { background: var(--critical); }
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(12,163,12,.55); } 70% { box-shadow: 0 0 0 7px rgba(12,163,12,0); } 100% { box-shadow: 0 0 0 0 rgba(12,163,12,0); } }
.src { display: inline-flex; align-items: center; gap: 4px; }
.src i { width: 6px; height: 6px; border-radius: 50%; background: var(--good); display: inline-block; }
.src.stale i { background: var(--warning); }
.src.down i { background: var(--critical); }

main { max-width: 1480px; margin: 0 auto; padding: 22px 22px 80px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; margin: 4px 0 18px; }
.page-head h1 { margin: 0; font-size: 24px; letter-spacing: -.02em; font-weight: 650; }
.page-head .sub { color: var(--text-3); margin-top: 2px; font-size: 13px; }
.page-head .tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
h2 { font-size: 15px; font-weight: 600; margin: 0; letter-spacing: -.005em; }
h3 { font-size: 13px; font-weight: 600; margin: 0; color: var(--text-2); }
.section { margin-top: 22px; }
.row { display: flex; gap: var(--gap); flex-wrap: wrap; }
.grid { display: grid; gap: var(--gap); }
.g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.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)); }
.g21 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g12 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
@media (max-width: 1180px) { .g5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g21, .g12 { grid-template-columns: 1fr; } }
@media (max-width: 820px) {
  .g5, .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g2 { grid-template-columns: 1fr; }
  .topbar { padding: 0 14px; gap: 10px; } .brand .tag { display: none; } .brand .logo { height: 28px; }
  .kbd-btn span, .userbtn .meta { display: none; }
  main { padding: 16px 16px 80px; } .statusbar { padding: 8px 16px; }
}
@media (max-width: 560px) { .g5, .g4, .g3 { grid-template-columns: 1fr; } .page-head h1 { font-size: 20px; } }
@media (max-width: 980px) {
  /* backdrop-filter would make the top bar the containing block of the fixed nav */
  .topbar { backdrop-filter: none; background: var(--bg); }
  .nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; height: 58px; padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--surface-1) 92%, transparent); backdrop-filter: blur(14px); border-top: 1px solid var(--line); }
  .nav a { font-size: 12.5px; padding: 8px 10px; }
  .nav a.on::after { bottom: 2px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---- cards & tiles ---------------------------------------------------------- */
.card {
  background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px 18px; min-width: 0;
}
.card.flush { padding: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head .hint { font-size: 12px; color: var(--text-3); }
.card.flush .card-head { padding: 14px 18px 0; }

.tile { position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 4px; min-height: 128px; }
.tile::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 2px; background: linear-gradient(90deg, var(--accent), transparent 70%); opacity: .55; }
.tile.arcane::before { background: linear-gradient(90deg, var(--arcane), transparent 70%); }
.tile .label { font-size: 12px; color: var(--text-3); font-weight: 500; letter-spacing: .02em; display: flex; align-items: center; gap: 6px; }
.tile .value { font-size: 28px; font-weight: 650; letter-spacing: -.025em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.tile .value .unit { font-size: 14px; font-weight: 500; color: var(--text-3); margin-left: 4px; letter-spacing: 0; }
.tile .foot { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-3); margin-top: auto; flex-wrap: wrap; }
.tile .spark { position: absolute; right: 12px; bottom: 10px; width: 96px; height: 34px; opacity: .9; }
.hero .value { font-size: 34px; }

.delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; font-size: 12px; padding: 1px 7px; border-radius: 10px; }
.delta.up { color: var(--pos); background: color-mix(in srgb, var(--pos) 13%, transparent); }
.delta.down { color: var(--neg); background: color-mix(in srgb, var(--neg) 13%, transparent); }
.delta.flat { color: var(--text-3); background: var(--surface-3); }

.flash { animation: flash 1.1s ease-out; }
@keyframes flash { 0% { background: color-mix(in srgb, var(--accent) 30%, transparent); } 100% { background: transparent; } }
.flash-text { animation: flashText 1.1s ease-out; }
@keyframes flashText { 0% { color: var(--accent-strong); text-shadow: 0 0 14px color-mix(in srgb, var(--accent) 60%, transparent); } 100% { } }

/* P&L ledger list */
.pl { display: grid; grid-template-columns: 1fr auto; row-gap: 7px; column-gap: 16px; font-size: 13.5px; }
.pl .k { color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.pl .v { text-align: right; font-variant-numeric: tabular-nums; }
.pl .sep { grid-column: 1 / -1; height: 1px; background: var(--line); margin: 2px 0; }
.pl .total .k, .pl .total.v, .pl .v.total { font-weight: 650; color: var(--text-1); }
.pl .big { font-size: 20px; font-weight: 650; letter-spacing: -.02em; }
.period-card .meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.period-card .meta .title { font-weight: 600; font-size: 14px; }
.countdown { font-size: 12px; color: var(--text-3); }

/* ---- buttons & inputs ---------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 34px; padding: 0 14px;
  border-radius: 9px; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text-1);
  font-weight: 550; font-size: 13.5px; cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: linear-gradient(180deg, var(--accent-strong), var(--accent)); color: var(--accent-ink); border-color: transparent; box-shadow: 0 4px 16px color-mix(in srgb, var(--accent) 28%, transparent); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.arcane { background: linear-gradient(180deg, #a77bea, var(--arcane)); color: #fff; border-color: transparent; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text-1); }
.btn.danger { color: var(--neg); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn.xs { height: 24px; padding: 0 8px; font-size: 12px; border-radius: 7px; }
.btn svg { width: 15px; height: 15px; }

.input, .select, textarea.input {
  height: 34px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--line-2);
  background: var(--surface-in); color: var(--text-1); min-width: 0; width: 100%;
}
textarea.input { height: auto; padding: 8px 10px; min-height: 80px; resize: vertical; font-family: var(--mono); font-size: 12.5px; }
.input:focus, .select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input.bad, .select.bad { border-color: var(--neg); box-shadow: 0 0 0 3px color-mix(in srgb, var(--neg) 18%, transparent); }
.input.num { text-align: right; font-variant-numeric: tabular-nums; }
.select { appearance: none; padding-right: 26px; background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%); background-position: calc(100% - 14px) 14px, calc(100% - 9px) 14px; background-size: 5px 5px; background-repeat: no-repeat; }
.tools .select, .table-tools .select, .tools .input, .table-tools .input { width: auto; min-width: 140px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: 12px; color: var(--text-3); font-weight: 500; }
.field .err { font-size: 12px; color: var(--neg); }
.form-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); align-items: end; }
.form-grid .wide { grid-column: span 2; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; color: var(--text-2); }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }

.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--surface-in); border: 1px solid var(--line); gap: 2px; }
.seg button { border: 0; background: transparent; padding: 5px 12px; border-radius: 7px; cursor: pointer; color: var(--text-3); font-weight: 550; font-size: 13px; }
.seg button.on { background: var(--surface-3); color: var(--text-1); box-shadow: 0 1px 2px rgba(0,0,0,.25); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 9px 12px; color: var(--text-3); font-weight: 550; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none; }
.tabs a.on { color: var(--text-1); border-bottom-color: var(--accent); }
.tabs a .count { margin-left: 6px; font-size: 11px; padding: 0 6px; border-radius: 10px; background: var(--surface-3); color: var(--text-2); }

/* chips, pills, dots */
.chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 12px; font-size: 12px; font-weight: 550; background: var(--surface-3); color: var(--text-2); border: 1px solid transparent; white-space: nowrap; }
.chip.click { cursor: pointer; border-color: var(--line-2); background: var(--surface-2); }
.chip.click:hover { border-color: var(--accent); color: var(--text-1); }
.chip.gold { background: var(--accent-soft); color: var(--accent); }
.chip.violet { background: var(--arcane-soft); color: var(--arcane); }
.chip.ok { background: color-mix(in srgb, var(--good) 15%, transparent); color: var(--pos); }
.chip.warn { background: color-mix(in srgb, var(--warning) 16%, transparent); color: var(--warning); }
.chip.bad { background: color-mix(in srgb, var(--critical) 16%, transparent); color: var(--neg); }
.chip .conf { font-size: 10.5px; opacity: .8; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.who { display: inline-flex; align-items: center; gap: 7px; font-weight: 550; white-space: nowrap; }
.status-ico { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; font-size: 10px; font-weight: 700; color: #fff; }
.status-ico.ok { background: var(--good); } .status-ico.warn { background: var(--warning); color: #241800; } .status-ico.bad { background: var(--critical); }
.lock { font-size: 12px; }

/* ---- tables --------------------------------------------------------------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
table.t th { position: sticky; top: 0; z-index: 1; background: var(--surface-1); text-align: left; font-weight: 550; font-size: 11.5px; letter-spacing: .03em; text-transform: uppercase; color: var(--text-3); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr:hover td { background: color-mix(in srgb, var(--surface-3) 55%, transparent); }
table.t tr.sel td { background: var(--accent-soft); }
table.t tr.focus td { animation: flash 2.2s ease-out; }
table.t tr.locked td { color: var(--text-2); }
table.t td.num, table.t th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.t tfoot td { font-weight: 650; border-top: 1px solid var(--line-2); border-bottom: 0; }
table.t td.cb, table.t th.cb { width: 34px; padding-right: 0; }
table.t .cell-edit { cursor: text; border-radius: 6px; padding: 2px 6px; margin: -2px -6px; display: inline-block; min-width: 30px; }
table.t .cell-edit:hover { background: var(--surface-3); box-shadow: 0 0 0 1px var(--line-2); }
table.t .cell-input { height: 28px; font-size: 13px; }
.table-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.table-tools .left, .table-tools .right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.empty { padding: 34px 18px; text-align: center; color: var(--text-3); }
.empty .big { font-size: 28px; margin-bottom: 6px; }

.bulkbar {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 50;
  display: flex; gap: 10px; align-items: center; padding: 10px 12px 10px 16px; border-radius: 14px;
  background: var(--surface-2); box-shadow: var(--shadow-pop); flex-wrap: wrap; max-width: calc(100vw - 24px);
}
.bulkbar .n { font-weight: 650; }

/* ---- overlays ------------------------------------------------------------------ */
.scrim { position: fixed; inset: 0; z-index: 60; background: rgba(5, 4, 10, .55); backdrop-filter: blur(3px); animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { position: fixed; z-index: 61; left: 50%; top: 12vh; transform: translateX(-50%); width: min(520px, calc(100vw - 24px)); max-height: 76vh; overflow: auto; background: var(--surface-1); border-radius: 16px; box-shadow: var(--shadow-pop); padding: 20px 22px; animation: pop .16s ease-out; }
.modal.wide { width: min(860px, calc(100vw - 24px)); }
@keyframes pop { from { opacity: 0; transform: translate(-50%, 8px) scale(.98); } }
.modal h2 { font-size: 17px; margin-bottom: 4px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.drawer { position: fixed; z-index: 61; top: 0; right: 0; bottom: 0; width: min(480px, 100vw); background: var(--surface-1); box-shadow: var(--shadow-pop); padding: 20px 22px; overflow: auto; animation: slide .18s ease-out; }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }
.drawer .close { position: absolute; top: 14px; right: 14px; }

.popover { position: fixed; z-index: 55; top: 62px; right: 16px; width: min(420px, calc(100vw - 24px)); max-height: min(560px, 80vh); display: flex; flex-direction: column; background: var(--surface-1); border-radius: 14px; box-shadow: var(--shadow-pop); animation: pop2 .14s ease-out; }
@keyframes pop2 { from { opacity: 0; transform: translateY(-6px); } }
.popover .ph { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px 8px; }
.popover .pt { display: flex; gap: 4px; padding: 0 12px 8px; border-bottom: 1px solid var(--line); }
.popover .pt button { border: 0; background: transparent; padding: 5px 9px; border-radius: 8px; color: var(--text-3); cursor: pointer; font-weight: 550; font-size: 12.5px; }
.popover .pt button.on { background: var(--surface-3); color: var(--text-1); }
.popover .list { overflow: auto; padding: 6px; }
.popover .pf { border-top: 1px solid var(--line); padding: 10px 16px; display: flex; justify-content: space-between; }
.notif { display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; padding: 10px; border-radius: 10px; cursor: pointer; color: var(--text-2); text-decoration: none; }
.notif:hover { background: var(--surface-2); text-decoration: none; }
.notif .ic { font-size: 15px; line-height: 20px; text-align: center; }
.notif .tt { color: var(--text-1); font-weight: 550; font-size: 13px; line-height: 1.35; }
.notif .bd { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.notif .tm { font-size: 11.5px; color: var(--text-4); white-space: nowrap; }
.notif.unread { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.notif.unread .tt::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-right: 6px; vertical-align: 2px; }
.notif.resolved .tt { text-decoration: line-through; color: var(--text-3); }

.menu { position: fixed; z-index: 55; min-width: 200px; background: var(--surface-1); border-radius: 12px; box-shadow: var(--shadow-pop); padding: 6px; animation: pop2 .12s; }
.menu button, .menu a { display: flex; width: 100%; align-items: center; gap: 10px; padding: 8px 10px; border: 0; background: transparent; color: var(--text-1); border-radius: 8px; cursor: pointer; text-align: left; font-size: 13px; text-decoration: none; }
.menu button:hover, .menu a:hover { background: var(--surface-3); text-decoration: none; }
.menu .sep { height: 1px; background: var(--line); margin: 5px 4px; }
.menu .meta { padding: 8px 10px; font-size: 12px; color: var(--text-3); }

.palette { position: fixed; z-index: 62; left: 50%; top: 14vh; transform: translateX(-50%); width: min(640px, calc(100vw - 24px)); background: var(--surface-1); border-radius: 16px; box-shadow: var(--shadow-pop); overflow: hidden; animation: pop .14s ease-out; }
.palette input { width: 100%; height: 54px; border: 0; border-bottom: 1px solid var(--line); background: transparent; padding: 0 18px; font-size: 16px; outline: none; }
.palette .items { max-height: 50vh; overflow: auto; padding: 6px; }
.palette .it { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; cursor: pointer; }
.palette .it .ic { width: 22px; text-align: center; color: var(--text-3); }
.palette .it .tx { flex: 1; min-width: 0; }
.palette .it .sub { font-size: 12px; color: var(--text-3); }
.palette .it.on { background: var(--surface-3); }
.palette .it .kb { font-size: 11px; color: var(--text-4); }
.palette .hint { padding: 9px 16px; font-size: 12px; color: var(--text-3); border-top: 1px solid var(--line); display: flex; gap: 14px; flex-wrap: wrap; }

.toasts { position: fixed; z-index: 70; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
@media (max-width: 980px) { .toasts { bottom: 76px; right: 12px; left: 12px; align-items: stretch; } }
.toast { display: flex; align-items: center; gap: 12px; min-width: 260px; max-width: 440px; padding: 11px 12px 11px 14px; border-radius: 12px; background: var(--surface-2); box-shadow: var(--shadow-pop); animation: pop2 .16s; font-size: 13px; }
.toast .ti { font-size: 16px; }
.toast .tx { flex: 1; }
.toast.err { border-left: 3px solid var(--critical); }
.toast.ok { border-left: 3px solid var(--good); }
.toast.live { border-left: 3px solid var(--accent); }

.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 8px; min-height: 14px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.callout { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface-2); font-size: 13px; }
.callout.warn { border-color: color-mix(in srgb, var(--warning) 45%, transparent); background: color-mix(in srgb, var(--warning) 8%, var(--surface-1)); }
.callout.bad { border-color: color-mix(in srgb, var(--critical) 50%, transparent); background: color-mix(in srgb, var(--critical) 9%, var(--surface-1)); }
.callout.ok { border-color: color-mix(in srgb, var(--good) 45%, transparent); background: color-mix(in srgb, var(--good) 7%, var(--surface-1)); }
.checks { display: flex; flex-direction: column; gap: 6px; }
.checks .c { display: flex; gap: 9px; align-items: flex-start; font-size: 13px; }

/* ---- charts ---------------------------------------------------------------------- */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis text { fill: var(--text-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .grid line { stroke: var(--grid); stroke-width: 1; }
.chart .base { stroke: var(--line-2); stroke-width: 1; }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart .xh { stroke: var(--text-4); stroke-width: 1; }
.chart .lbl { fill: var(--text-2); font-size: 11.5px; font-weight: 550; font-variant-numeric: tabular-nums; }
.chart .lbl.muted { fill: var(--text-3); font-weight: 450; }
.tip { position: absolute; z-index: 5; pointer-events: none; padding: 8px 10px; border-radius: 9px; background: var(--surface-3); box-shadow: var(--shadow-pop); font-size: 12px; white-space: nowrap; transform: translate(-50%, calc(-100% - 10px)); }
.tip .tr { display: flex; align-items: center; gap: 7px; justify-content: space-between; }
.tip .tr b { font-weight: 600; margin-left: 12px; font-variant-numeric: tabular-nums; }
.tip .th { color: var(--text-3); margin-bottom: 4px; font-size: 11.5px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--text-2); margin-top: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend i.line { height: 2px; border-radius: 1px; width: 14px; }
.chart-tabletoggle { font-size: 12px; }
.bar-row { display: grid; grid-template-columns: 120px 1fr 120px; gap: 12px; align-items: center; padding: 6px 0; }
.bar-row .track { height: 14px; border-radius: 4px; background: var(--surface-in); position: relative; overflow: hidden; }
.bar-row .fill { height: 100%; border-radius: 0 4px 4px 0; }
.share { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; min-width: 60px; }
.share > i { display: block; height: 100%; border-radius: 3px; }

/* pipeline */
.pipe { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; align-items: stretch; }
.pipe .st { position: relative; padding: 14px 18px; background: var(--surface-2); border: 1px solid var(--line); }
.pipe .st:first-child { border-radius: 12px 0 0 12px; }
.pipe .st:last-child { border-radius: 0 12px 12px 0; }
.pipe .st + .st { border-left: 0; }
.pipe .st:not(:last-child)::after { content: "›"; position: absolute; right: -10px; top: 50%; transform: translateY(-50%); z-index: 2; width: 20px; height: 20px; border-radius: 50%; background: var(--surface-1); border: 1px solid var(--line-2); display: grid; place-items: center; color: var(--accent); font-weight: 700; line-height: 18px; text-align: center; }
.pipe .k { font-size: 12px; color: var(--text-3); }
.pipe .v { font-size: 20px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.pipe .s { font-size: 12px; color: var(--text-3); margin-top: 2px; }
@media (max-width: 820px) { .pipe { grid-template-columns: 1fr 1fr; } .pipe .st { border-radius: 0 !important; border: 1px solid var(--line) !important; } .pipe .st::after { display: none; } }

/* member cards */
.mcard { display: flex; flex-direction: column; gap: 12px; cursor: pointer; transition: border-color .15s, transform .15s; text-decoration: none; color: inherit; }
.mcard:hover { border-color: var(--line-2); transform: translateY(-1px); text-decoration: none; }
.mcard .mh { display: flex; align-items: center; gap: 12px; }
.mcard .mav { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-weight: 700; color: #fff; font-size: 16px; }
.mcard .mn { font-weight: 650; font-size: 16px; }
.mcard .kv { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; font-size: 12.5px; }
.mcard .kv b { display: block; font-size: 15px; font-weight: 600; color: var(--text-1); font-variant-numeric: tabular-nums; }
.mcard .kv span { color: var(--text-3); }
.rank-badge { font: 700 12px var(--mono); width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); }
.rank-badge.r1 { background: linear-gradient(135deg, #f6dc8c, #c99a2e); color: #2a1d02; }
.rank-badge.r2 { background: linear-gradient(135deg, #e3e7ee, #a7afbd); color: #1f232b; }
.rank-badge.r3 { background: linear-gradient(135deg, #e8b48a, #a86a3d); color: #2b1608; }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; position: relative; overflow: hidden; }
.stars { position: fixed; inset: 0; pointer-events: none; opacity: .65; background-image:
  radial-gradient(1px 1px at 20% 30%, #fff8, transparent 60%), radial-gradient(1px 1px at 70% 20%, #fff6, transparent 60%),
  radial-gradient(1.5px 1.5px at 40% 70%, #f6dc8c88, transparent 60%), radial-gradient(1px 1px at 85% 60%, #fff5, transparent 60%),
  radial-gradient(1px 1px at 10% 85%, #c4b5fd77, transparent 60%), radial-gradient(1.5px 1.5px at 55% 45%, #fff4, transparent 60%),
  radial-gradient(1px 1px at 30% 12%, #fff6, transparent 60%), radial-gradient(1px 1px at 92% 88%, #f6dc8c66, transparent 60%); }
.login-card { position: relative; width: min(420px, 100%); background: color-mix(in srgb, var(--surface-1) 92%, transparent); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-pop); padding: 30px 30px 26px; }
.login-card .logo { width: 100%; max-width: 320px; height: auto; display: block; margin: 4px auto 6px; }
.login-card .logo-glow { opacity: .6; animation: breathe 5s ease-in-out infinite; }
.login-card .tagline { text-align: center; color: var(--text-3); font-size: 12.5px; letter-spacing: .18em; text-transform: uppercase; margin-bottom: 22px; }
.login-card form { display: flex; flex-direction: column; gap: 12px; }
.login-card .btn { height: 40px; }
.login-card .err { color: var(--neg); font-size: 13px; min-height: 18px; }
.qr { background: #fff; border-radius: 12px; padding: 8px; display: grid; place-items: center; width: 220px; margin: 8px auto; }
.qr svg { width: 200px; height: 200px; }
.secret { font: 500 13px var(--mono); text-align: center; padding: 8px; border-radius: 8px; background: var(--surface-in); user-select: all; word-break: break-all; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; font: 500 13px var(--mono); }
.codes span { padding: 6px 8px; border-radius: 6px; background: var(--surface-in); text-align: center; }
.otp { letter-spacing: .5em; text-align: center; font: 600 22px var(--mono); height: 50px !important; }
