:root {
  --bg: #0B1120; --surface: #111A2E; --surface-2: #172238; --line: #23304C; --line-soft: #1B2640;
  --text: #E9EDF5; --muted: #8C98B3; --faint: #5E6A86;
  --gold: #CBA869; --gold-soft: rgba(203,168,105,.14); --navy: #1F325B; --cream: #F5EFE3;
  --ok: #3FB68B; --ok-soft: rgba(63,182,139,.14); --warn: #E3A94F; --warn-soft: rgba(227,169,79,.14);
  --bad: #E2604F; --bad-soft: rgba(226,96,79,.14); --info: #6E9BE0; --info-soft: rgba(110,155,224,.14);
  --radius: 14px; --side: 252px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--surface); border-right: 1px solid var(--line-soft); padding: 20px 14px; display: flex; flex-direction: column; gap: 18px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 12px; border-bottom: 1px solid var(--line-soft); }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; background: var(--navy); display: grid; place-items: center; color: var(--gold); font-weight: 800; letter-spacing: .02em; border: 1px solid rgba(203,168,105,.45); }
.brand b { display: block; font-size: 14px; letter-spacing: .01em; }
.brand small { color: var(--muted); font-size: 12px; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-label { color: var(--faint); font-size: 11px; text-transform: uppercase; letter-spacing: .12em; padding: 8px 10px 4px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 10px; color: var(--muted); font-size: 14px; }
.nav a svg { width: 18px; height: 18px; flex: none; }
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--gold-soft); color: var(--gold); }
.nav a .soon { margin-left: auto; font-size: 10px; color: var(--faint); border: 1px solid var(--line); border-radius: 6px; padding: 0 5px; }
.nav a .count { margin-left: auto; background: var(--gold); color: #1a1406; font-size: 11px; font-weight: 700; border-radius: 9px; padding: 0 7px; }
.side-foot { margin-top: auto; border-top: 1px solid var(--line-soft); padding-top: 12px; font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; align-items: center; }
.link-btn { background: none; border: 0; color: var(--muted); padding: 4px 6px; border-radius: 6px; }
.link-btn:hover { color: var(--text); background: var(--surface-2); }

.main { min-width: 0; padding: 28px 32px 48px; }
.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.top h1 { margin: 0; font-size: 24px; letter-spacing: -.01em; }
.top p { margin: 4px 0 0; color: var(--muted); }

/* ---------- cards ---------- */
.grid { display: grid; gap: 16px; }
.kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.two { grid-template-columns: 1.4fr 1fr; }
.card { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 18px; min-width: 0; }
.card h2 { margin: 0 0 14px; font-size: 14px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; display: flex; justify-content: space-between; align-items: center; }
.kpi { display: flex; flex-direction: column; gap: 6px; }
.kpi .label { color: var(--muted); font-size: 13px; }
.kpi .value { font-size: 30px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi .hint { font-size: 12px; color: var(--faint); }
.kpi.accent .value { color: var(--gold); }
.kpi.alert .value { color: var(--bad); }

.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.list li { display: flex; gap: 12px; align-items: flex-start; padding: 11px 0; border-top: 1px solid var(--line-soft); }
.list li:first-child { border-top: 0; padding-top: 2px; }
.when { flex: none; width: 66px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.when b { display: block; color: var(--text); font-size: 13px; }
.grow { flex: 1; min-width: 0; }
.title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.sub { color: var(--muted); font-size: 12.5px; }
.empty { color: var(--muted); padding: 18px 0; text-align: center; }

.pill { display: inline-block; font-size: 11.5px; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.info { background: var(--info-soft); color: var(--info); }
.pill.gold { background: var(--gold-soft); color: var(--gold); }

/* ---------- approvals ---------- */
.appr { display: grid; gap: 14px; }
.appr-item { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 16px 18px; display: grid; gap: 12px; }
.appr-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.appr-head .title { font-size: 16px; font-weight: 600; white-space: normal; }
.appr-body { color: var(--muted); font-size: 13.5px; white-space: pre-line; }
.appr-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.appr-actions textarea { flex: 1 1 100%; min-height: 44px; resize: vertical; }
.btn { border: 1px solid var(--line); background: var(--surface-2); color: var(--text); padding: 9px 14px; border-radius: 10px; font-weight: 600; font-size: 14px; }
.btn:hover { border-color: var(--faint); }
.btn.primary { background: var(--gold); border-color: var(--gold); color: #1d1607; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--bad); }
.btn[disabled] { opacity: .5; cursor: wait; }

/* ---------- forms / auth ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line-soft); border-radius: 18px; padding: 28px; display: grid; gap: 16px; }
.auth-card h1 { margin: 0; font-size: 20px; }
.auth-card p { margin: 0; color: var(--muted); font-size: 14px; }
label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
input, textarea, select { width: 100%; background: var(--bg); border: 1px solid var(--line); color: var(--text); border-radius: 10px; padding: 11px 12px; font: inherit; }
input:focus, textarea:focus { border-color: var(--gold); outline: none; }
.error { color: var(--bad); font-size: 13px; min-height: 18px; }
.note { font-size: 12.5px; color: var(--faint); }

/* ---------- modules (coming next) ---------- */
.mods { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.mod { display: grid; gap: 6px; }
.mod b { font-size: 15px; }
.mod .sub { min-height: 38px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--surface-2); border: 1px solid var(--line); padding: 10px 16px; border-radius: 10px; z-index: 50; max-width: calc(100% - 32px); }
.skeleton { height: 14px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-2), var(--line-soft), var(--surface-2)); background-size: 200% 100%; animation: sh 1.2s infinite; }
@keyframes sh { to { background-position: -200% 0; } }

.bottom-nav { display: none; }

/* ---------- mobile ---------- */
@media (max-width: 900px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .main { padding: 18px 16px calc(84px + env(safe-area-inset-bottom)); }
  .top h1 { font-size: 21px; }
  .kpi .value { font-size: 26px; }
  .bottom-nav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; background: var(--surface); border-top: 1px solid var(--line-soft); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); z-index: 40; }
  .bottom-nav a { display: grid; justify-items: center; gap: 2px; color: var(--muted); font-size: 11px; padding: 4px 0; position: relative; }
  .bottom-nav a svg { width: 22px; height: 22px; }
  .bottom-nav a.active { color: var(--gold); text-decoration: none; }
  .bottom-nav .dot { position: absolute; top: 0; right: 26%; background: var(--gold); color: #1d1607; font-size: 10px; font-weight: 700; border-radius: 8px; padding: 0 5px; }
}
