/* ===========================================================================
   UB Satish — Business OS
   Property of Zera Technologies (https://zeratech.io/)
   =========================================================================== */

:root {
  color-scheme: dark;

  /* surfaces */
  --plane:        #070b12;
  --surface-1:    #111826;
  --surface-2:    #161f30;
  --surface-3:    #1d2839;
  --surface-hover:#1a2434;

  /* ink */
  --ink:          #f2f5fa;
  --ink-2:        #9dabc2;
  --ink-3:        #6a7893;
  --ink-4:        #4a566d;

  /* lines */
  --line:         rgba(255,255,255,0.075);
  --line-strong:  rgba(255,255,255,0.14);
  --grid:         rgba(255,255,255,0.055);

  /* brand + data */
  --gold:         #c9a227;
  --gold-soft:    rgba(201,162,39,0.13);
  --series-1:     #3987e5;
  --series-2:     #d95926;
  --series-3:     #199e70;

  /* status */
  --good:         #0ca30c;
  --warning:      #fab219;
  --critical:     #d03b3b;
  --good-bg:      rgba(12,163,12,0.13);
  --warning-bg:   rgba(250,178,25,0.13);
  --critical-bg:  rgba(208,59,59,0.14);
  --info-bg:      rgba(57,135,229,0.13);

  --radius:       14px;
  --radius-sm:    10px;
  --shadow:       0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.28);
  --shadow-lg:    0 24px 64px rgba(0,0,0,.55);

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --sidebar: 244px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--plane);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.5;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--series-1); text-decoration: none; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }

/* ── scrollbars ───────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 8px; border: 2px solid var(--plane); }
::-webkit-scrollbar-thumb:hover { background: #2a3548; }

/* ═══════════════════════════════════════════════════════════════════════
   LOGIN
   ═══════════════════════════════════════════════════════════════════════ */
#login {
  position: fixed; inset: 0; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(900px 520px at 50% -8%, rgba(57,135,229,.16), transparent 62%),
    radial-gradient(700px 460px at 88% 108%, rgba(201,162,39,.10), transparent 60%),
    var(--plane);
  z-index: 200;
}
.login-card {
  width: 100%; max-width: 400px; background: var(--surface-1);
  border: 1px solid var(--line); border-radius: 20px; padding: 40px 32px 28px;
  box-shadow: var(--shadow-lg); text-align: center;
}
.brand-mark {
  width: 60px; height: 60px; margin: 0 auto 22px; border-radius: 17px;
  display: grid; place-items: center;
  background: linear-gradient(150deg, #1c2740, #0e1524);
  border: 1px solid var(--line-strong);
  font-size: 21px; font-weight: 700; letter-spacing: .5px; color: var(--gold);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.07);
}
.login-card h1 { margin: 0 0 6px; font-size: 21px; font-weight: 650; letter-spacing: -.2px; }
.login-card .sub { margin: 0 0 30px; color: var(--ink-3); font-size: 13px; }
.gsi-slot { display: grid; place-items: center; min-height: 44px; }
.login-note {
  margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line);
  font-size: 11.5px; color: var(--ink-4); line-height: 1.65;
}
.login-err {
  margin-top: 18px; padding: 11px 13px; border-radius: var(--radius-sm);
  background: var(--critical-bg); border: 1px solid rgba(208,59,59,.32);
  color: #f0a5a5; font-size: 12.5px; text-align: left;
}

/* ═══════════════════════════════════════════════════════════════════════
   SHELL
   ═══════════════════════════════════════════════════════════════════════ */
#app { display: none; min-height: 100%; }
#app.ready { display: block; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar);
  background: var(--surface-1); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; z-index: 60;
}
.sb-head { padding: 20px 18px 16px; border-bottom: 1px solid var(--line); }
.sb-brand { display: flex; align-items: center; gap: 11px; }
.sb-logo {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(150deg, #1c2740, #0e1524); border: 1px solid var(--line-strong);
  color: var(--gold); font-weight: 700; font-size: 13px; flex: none;
}
.sb-name { font-size: 14px; font-weight: 620; letter-spacing: -.15px; }
.sb-sub { font-size: 10.5px; color: var(--ink-4); text-transform: uppercase; letter-spacing: .9px; margin-top: 1px; }

.sb-nav { flex: 1; overflow-y: auto; padding: 12px 10px; }
.sb-group { margin-bottom: 18px; }
.sb-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 1px;
  color: var(--ink-4); padding: 0 10px 7px; font-weight: 600;
}
.nav-item {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 9px 10px; border-radius: var(--radius-sm); border: 0; background: none;
  color: var(--ink-2); cursor: pointer; text-align: left; font-size: 13.5px;
  transition: background .13s, color .13s;
}
.nav-item:hover { background: var(--surface-hover); color: var(--ink); }
.nav-item.active { background: var(--surface-3); color: var(--ink); font-weight: 560; }
.nav-item svg { width: 17px; height: 17px; flex: none; opacity: .85; }
.nav-item.active svg { color: var(--gold); opacity: 1; }
.nav-count {
  margin-left: auto; font-size: 11px; padding: 1px 7px; border-radius: 20px;
  background: var(--surface-3); color: var(--ink-3); font-variant-numeric: tabular-nums;
}
.nav-item.active .nav-count { background: rgba(0,0,0,.32); }
.nav-count.alert { background: var(--critical-bg); color: #eb8f8f; }

.sb-foot { padding: 12px; border-top: 1px solid var(--line); }
.sb-user { display: flex; align-items: center; gap: 10px; padding: 8px 9px; border-radius: var(--radius-sm); }
.sb-avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: none; object-fit: cover;
  background: var(--surface-3); border: 1px solid var(--line);
}
.sb-user-name { font-size: 12.5px; font-weight: 560; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-user-role { font-size: 10.5px; color: var(--ink-4); text-transform: capitalize; }
.sb-credit { padding: 10px 9px 2px; font-size: 10.5px; color: var(--ink-4); line-height: 1.6; }
.sb-credit a { color: var(--ink-3); }
.sb-credit a:hover { color: var(--gold); }

.main { margin-left: var(--sidebar); min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 14px;
  padding: 13px 26px; background: rgba(7,11,18,.86);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.tb-title { font-size: 16px; font-weight: 620; letter-spacing: -.2px; }
.tb-sub { font-size: 11.5px; color: var(--ink-4); margin-top: 1px; }
.tb-spacer { flex: 1; }

.search-wrap { position: relative; flex: 1; max-width: 400px; }
.search-wrap svg {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; color: var(--ink-4); pointer-events: none;
}
.search {
  width: 100%; padding: 9px 12px 9px 34px; border-radius: 10px;
  background: var(--surface-1); border: 1px solid var(--line); color: var(--ink);
  font-size: 13px; outline: none; transition: border-color .13s, background .13s;
}
.search:focus { border-color: rgba(57,135,229,.5); background: var(--surface-2); }
.search::placeholder { color: var(--ink-4); }

.view { padding: 24px 26px 80px; flex: 1; max-width: 1400px; width: 100%; }

/* ═══════════════════════════════════════════════════════════════════════
   PRIMITIVES
   ═══════════════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 15px; border-radius: 10px; border: 1px solid var(--line-strong);
  background: var(--surface-2); color: var(--ink); font-size: 13px; font-weight: 550;
  cursor: pointer; transition: background .13s, border-color .13s, transform .08s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-3); border-color: rgba(255,255,255,.2); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 15px; height: 15px; }
.btn-primary {
  background: linear-gradient(180deg, #3d8ce8, #2a6fc4);
  border-color: rgba(57,135,229,.55); color: #fff;
  box-shadow: 0 1px 0 rgba(255,255,255,.14) inset, 0 4px 14px rgba(42,111,196,.28);
}
.btn-primary:hover { background: linear-gradient(180deg, #4b96ea, #2f78ce); border-color: rgba(57,135,229,.75); }
.btn-gold {
  background: linear-gradient(180deg, #d4ad2e, #b18b1c); border-color: rgba(201,162,39,.55);
  color: #14100a; font-weight: 620;
  box-shadow: 0 1px 0 rgba(255,255,255,.22) inset, 0 4px 14px rgba(177,139,28,.24);
}
.btn-gold:hover { background: linear-gradient(180deg, #e0b93a, #bd9520); }
.btn-danger { color: #ec8b8b; border-color: rgba(208,59,59,.34); background: var(--critical-bg); }
.btn-danger:hover { background: rgba(208,59,59,.22); border-color: rgba(208,59,59,.5); }
.btn-ghost { background: none; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-sm { padding: 6px 11px; font-size: 12px; border-radius: 8px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.card {
  background: var(--surface-1); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-head {
  display: flex; align-items: center; gap: 12px;
  padding: 15px 18px; border-bottom: 1px solid var(--line);
}
.card-title { font-size: 13.5px; font-weight: 600; letter-spacing: -.1px; }
.card-sub { font-size: 11.5px; color: var(--ink-4); margin-top: 1px; }
.card-body { padding: 18px; }
.card-body.flush { padding: 0; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2.5px 9px; border-radius: 20px; font-size: 11px; font-weight: 580;
  white-space: nowrap; border: 1px solid transparent;
}
.badge svg { width: 11px; height: 11px; }
.badge-good     { background: var(--good-bg);     color: #4dc94d; border-color: rgba(12,163,12,.28); }
.badge-warn     { background: var(--warning-bg);  color: #f0bb46; border-color: rgba(250,178,25,.28); }
.badge-critical { background: var(--critical-bg); color: #ea8484; border-color: rgba(208,59,59,.3); }
.badge-info     { background: var(--info-bg);     color: #6fa9ee; border-color: rgba(57,135,229,.28); }
.badge-muted    { background: var(--surface-3);   color: var(--ink-3); border-color: var(--line); }
.badge-gold     { background: var(--gold-soft);   color: #d9b64a; border-color: rgba(201,162,39,.3); }

.chip {
  padding: 6px 13px; border-radius: 20px; border: 1px solid var(--line);
  background: var(--surface-1); color: var(--ink-2); font-size: 12.5px;
  cursor: pointer; white-space: nowrap; transition: all .13s;
}
.chip:hover { background: var(--surface-2); color: var(--ink); }
.chip.on { background: var(--surface-3); border-color: var(--line-strong); color: var(--ink); font-weight: 560; }
.chip .n { font-variant-numeric: tabular-nums; opacity: .6; margin-left: 4px; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }

/* ── KPI tiles ────────────────────────────────────────────────────────── */
.kpi-grid {
  display: grid; gap: 12px; margin-bottom: 20px;
  grid-template-columns: repeat(auto-fit, minmax(232px, 1fr));
}
.kpi {
  background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 17px; position: relative; overflow: hidden;
}
.kpi::after {
  content: ''; position: absolute; inset: 0 0 auto 0; height: 2px;
  background: linear-gradient(90deg, var(--accent, transparent), transparent 72%);
  opacity: .8;
}
.kpi-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .9px;
  color: var(--ink-4); font-weight: 600; margin-bottom: 9px;
}
.kpi-value { font-size: 25px; font-weight: 640; letter-spacing: -.7px; line-height: 1.1; }
.kpi-value.sm { font-size: 21px; }
.kpi-meta { font-size: 11.5px; color: var(--ink-3); margin-top: 6px; display: flex; align-items: center; gap: 6px; }

/* ── tables ──────────────────────────────────────────────────────────── */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left; padding: 10px 14px; font-size: 10.5px; font-weight: 620;
  text-transform: uppercase; letter-spacing: .8px; color: var(--ink-4);
  border-bottom: 1px solid var(--line); white-space: nowrap;
  background: var(--surface-1); position: sticky; top: 0; z-index: 2;
}
.tbl th.r, .tbl td.r { text-align: right; }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--grid); vertical-align: middle; }
.tbl tbody tr { cursor: pointer; transition: background .1s; }
.tbl tbody tr:hover { background: var(--surface-hover); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .name { font-weight: 560; }
.tbl .dim { color: var(--ink-3); font-size: 12px; }
.tbl .mono { font-variant-numeric: tabular-nums; }
.tbl .pos { color: #4dc94d; }
.tbl .neg { color: #ea8484; }

.empty { padding: 44px 20px; text-align: center; color: var(--ink-4); }
.empty svg { width: 34px; height: 34px; margin-bottom: 12px; opacity: .4; }
.empty h4 { margin: 0 0 5px; font-size: 14px; color: var(--ink-2); font-weight: 560; }
.empty p { margin: 0; font-size: 12.5px; max-width: 340px; margin-inline: auto; line-height: 1.6; }

/* ── charts ──────────────────────────────────────────────────────────── */
.chart-grid { display: grid; gap: 12px; grid-template-columns: 1.55fr 1fr; margin-bottom: 20px; }
@media (max-width: 1080px) { .chart-grid { grid-template-columns: 1fr; } }
.chart { width: 100%; display: block; overflow: visible; }
.chart .grid-line { stroke: var(--grid); stroke-width: 1; }
.chart .axis-line { stroke: var(--line); stroke-width: 1; }
.chart text { font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart .tick { fill: var(--ink-4); font-size: 10.5px; }
.chart .val-label { fill: var(--ink-2); font-size: 11px; font-weight: 560; }
.chart .cat-label { fill: var(--ink-2); font-size: 11.5px; }
.chart .hit { fill: transparent; cursor: pointer; }
.chart .bar { transition: opacity .12s; }
.chart .hit:hover ~ .bar, .chart g:hover .bar { opacity: .82; }

.tip {
  position: fixed; z-index: 300; pointer-events: none; opacity: 0;
  background: var(--surface-3); border: 1px solid var(--line-strong);
  border-radius: 9px; padding: 9px 11px; font-size: 12px;
  box-shadow: var(--shadow-lg); transition: opacity .1s; max-width: 240px;
}
.tip.on { opacity: 1; }
.tip-t { font-weight: 600; margin-bottom: 4px; font-size: 11.5px; }
.tip-r { display: flex; align-items: center; gap: 7px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.tip-sw { width: 8px; height: 8px; border-radius: 2px; flex: none; }

.legend { display: flex; gap: 15px; flex-wrap: wrap; font-size: 11.5px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 9px; height: 9px; border-radius: 2px; display: block; }

/* ── detail sheet ────────────────────────────────────────────────────── */
.scrim {
  position: fixed; inset: 0; background: rgba(3,6,11,.7);
  backdrop-filter: blur(3px); z-index: 150; opacity: 0; transition: opacity .18s;
}
.scrim.on { opacity: 1; }
.sheet {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(620px, 100%);
  background: var(--plane); border-left: 1px solid var(--line);
  z-index: 160; display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .24s cubic-bezier(.32,.72,0,1);
  box-shadow: var(--shadow-lg);
}
.sheet.on { transform: none; }
.sheet-head {
  padding: 17px 20px; border-bottom: 1px solid var(--line);
  display: flex; align-items: flex-start; gap: 12px; background: var(--surface-1);
}
.sheet-title { font-size: 17px; font-weight: 640; letter-spacing: -.2px; }
.sheet-sub { font-size: 12px; color: var(--ink-3); margin-top: 3px; }
.sheet-body { flex: 1; overflow-y: auto; padding: 20px; }
.sheet-foot {
  padding: 13px 20px; border-top: 1px solid var(--line);
  display: flex; gap: 9px; background: var(--surface-1); flex-wrap: wrap;
}
.x-btn {
  width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--surface-2); display: grid; place-items: center; cursor: pointer;
  color: var(--ink-2); flex: none;
}
.x-btn:hover { background: var(--surface-3); color: var(--ink); }

.stat-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1px; background: var(--line); border: 1px solid var(--line);
  border-radius: var(--radius-sm); overflow: hidden; margin-bottom: 18px;
}
.stat { background: var(--surface-1); padding: 13px 14px; }
.stat-l { font-size: 10.5px; text-transform: uppercase; letter-spacing: .8px; color: var(--ink-4); font-weight: 600; }
.stat-v { font-size: 17px; font-weight: 620; margin-top: 5px; letter-spacing: -.3px; }
.stat-v.sm { font-size: 14px; }

.sec-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--ink-4);
  font-weight: 620; margin: 22px 0 10px; display: flex; align-items: center; gap: 9px;
}
.sec-title::after { content: ''; flex: 1; height: 1px; background: var(--line); }

.dl { display: grid; grid-template-columns: auto 1fr; gap: 9px 18px; font-size: 13px; }
.dl dt { color: var(--ink-3); }
.dl dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }

.tl { list-style: none; margin: 0; padding: 0; }
.tl li {
  display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--grid);
  font-size: 12.5px; align-items: flex-start;
}
.tl li:last-child { border-bottom: 0; }
.tl-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex: none; }
.tl-main { flex: 1; }
.tl-t { font-weight: 550; }
.tl-s { color: var(--ink-4); font-size: 11.5px; margin-top: 2px; }
.tl-v { font-variant-numeric: tabular-nums; font-weight: 560; white-space: nowrap; }

/* ── forms ───────────────────────────────────────────────────────────── */
.form-grid { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }
.field label {
  display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .7px;
  color: var(--ink-3); font-weight: 600; margin-bottom: 6px;
}
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px;
  background: var(--surface-1); border: 1px solid var(--line);
  color: var(--ink); font-size: 13.5px; outline: none; transition: border-color .13s;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: rgba(57,135,229,.55); }
.field textarea { resize: vertical; min-height: 72px; }
.field .hint { font-size: 11px; color: var(--ink-4); margin-top: 5px; line-height: 1.5; }
.field-check { display: flex; align-items: flex-start; gap: 10px; padding: 11px 12px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface-1); cursor: pointer; }
.field-check input { width: 16px; height: 16px; margin-top: 1px; accent-color: var(--series-1); flex: none; }
.field-check .t { font-size: 13px; font-weight: 550; }
.field-check .s { font-size: 11.5px; color: var(--ink-4); margin-top: 2px; line-height: 1.45; }

.calc-preview {
  margin-top: 16px; padding: 14px 15px; border-radius: var(--radius-sm);
  background: var(--info-bg); border: 1px solid rgba(57,135,229,.24); font-size: 12.5px;
}
.calc-preview .r { display: flex; justify-content: space-between; padding: 3px 0; color: var(--ink-2); }
.calc-preview .r b { color: var(--ink); font-variant-numeric: tabular-nums; }

/* ── toast ───────────────────────────────────────────────────────────── */
#toasts { position: fixed; bottom: 22px; right: 22px; z-index: 400; display: flex; flex-direction: column; gap: 9px; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 12px 15px;
  background: var(--surface-3); border: 1px solid var(--line-strong);
  border-radius: 11px; box-shadow: var(--shadow-lg); font-size: 13px;
  animation: slideIn .22s cubic-bezier(.32,.72,0,1); max-width: 340px;
}
.toast.err { border-color: rgba(208,59,59,.45); background: #2a1618; }
.toast.ok  { border-color: rgba(12,163,12,.4); }
.toast svg { width: 16px; height: 16px; flex: none; }
@keyframes slideIn { from { transform: translateX(24px); opacity: 0; } }

.spinner {
  width: 15px; height: 15px; border: 2px solid var(--line-strong);
  border-top-color: var(--series-1); border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#loading { position: fixed; inset: 0; display: grid; place-items: center; background: var(--plane); z-index: 180; gap: 14px; }
#loading .spinner { width: 26px; height: 26px; border-width: 3px; }

/* ── mobile ──────────────────────────────────────────────────────────── */
.mob-nav { display: none; }
.mob-only { display: none; }

@media (max-width: 900px) {
  .sidebar { display: none; }
  .main { margin-left: 0; padding-bottom: 68px; }
  .topbar { padding: 11px 15px; gap: 10px; }
  .tb-title { font-size: 15px; }
  .view { padding: 16px 15px 24px; }
  .desk-only { display: none !important; }
  .mob-only { display: block; }

  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .kpi { padding: 13px 14px; }
  .kpi-value { font-size: 20px; letter-spacing: -.5px; }
  .kpi-value.sm { font-size: 17px; }
  .kpi-label { font-size: 9.5px; margin-bottom: 7px; }

  .sheet { width: 100%; top: 6vh; border-radius: 20px 20px 0 0; border-left: 0; border-top: 1px solid var(--line-strong); }
  .sheet.on { transform: none; }
  .sheet { transform: translateY(100%); }

  .mob-nav {
    display: flex; position: fixed; inset: auto 0 0 0; z-index: 70;
    background: rgba(17,24,38,.94); backdrop-filter: blur(16px);
    border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .mob-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 7px 2px; border: 0; background: none; color: var(--ink-4);
    font-size: 10px; cursor: pointer; border-radius: 9px; position: relative;
  }
  .mob-item svg { width: 20px; height: 20px; }
  .mob-item.active { color: var(--gold); }
  .mob-dot {
    position: absolute; top: 4px; right: 50%; margin-right: -16px;
    min-width: 15px; height: 15px; padding: 0 4px; border-radius: 9px;
    background: var(--critical); color: #fff; font-size: 9.5px; font-weight: 700;
    display: grid; place-items: center; font-variant-numeric: tabular-nums;
  }

  .tbl th, .tbl td { padding: 9px 11px; }
  #toasts { left: 14px; right: 14px; bottom: 76px; }
  .toast { max-width: none; }
  .stat-row { grid-template-columns: 1fr 1fr; }
  .chart-grid { gap: 9px; }
}

/* mobile record cards replace tables on narrow screens */
.rec-list { display: none; }
@media (max-width: 700px) {
  .tbl-wrap.has-cards { display: none; }
  .rec-list { display: flex; flex-direction: column; }
  .rec {
    display: flex; align-items: center; gap: 12px; padding: 13px 15px;
    border-bottom: 1px solid var(--grid); cursor: pointer; text-align: left;
    background: none; border-left: 0; border-right: 0; border-top: 0; width: 100%; color: inherit;
  }
  .rec:last-child { border-bottom: 0; }
  .rec:active { background: var(--surface-hover); }
  .rec-av {
    width: 38px; height: 38px; border-radius: 11px; flex: none; display: grid; place-items: center;
    background: var(--surface-3); color: var(--ink-2); font-weight: 620; font-size: 13.5px;
  }
  .rec-main { flex: 1; min-width: 0; }
  .rec-t { font-size: 13.5px; font-weight: 570; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .rec-s { font-size: 11.5px; color: var(--ink-4); margin-top: 2px; display: flex; gap: 7px; align-items: center; flex-wrap: wrap; }
  .rec-r { text-align: right; flex: none; }
  .rec-v { font-size: 14px; font-weight: 620; font-variant-numeric: tabular-nums; letter-spacing: -.2px; }
  .rec-vs { font-size: 11px; color: var(--ink-4); margin-top: 2px; }
}

.foot-credit {
  margin-top: 34px; padding-top: 18px; border-top: 1px solid var(--line);
  font-size: 11.5px; color: var(--ink-4); text-align: center; line-height: 1.75;
}
.foot-credit a { color: var(--ink-3); }
.foot-credit a:hover { color: var(--gold); }

@media print {
  .sidebar, .topbar, .mob-nav, .sheet-foot, .filters { display: none !important; }
  body { background: #fff; color: #000; }
  .main { margin: 0; }
  .card, .kpi { border-color: #ddd; background: #fff; box-shadow: none; }
}
