:root {
  --bg: #0B0F14;
  --panel: #121821;
  --inset: #0F151C;
  --line: #1F2A37;
  --line-soft: #1A2430;
  --nav-active: #16202B;
  --text: #E6EDF3;
  --muted: #8B98A5;
  --accent: #2DD4BF;
  --accent-ink: #04211E;
  --accent-soft: #12302D;
  --ok: #5EEAD4;
  --warn: #FBBF24;
  --warn-strong: #F59E0B;
  --warn-bg: #3A2410;
  --bad: #FCA5A5;
  --bad-line: #F87171;
  --bad-bg: #3B1518;
  --alert-bg: #2A1A12;
  --alert-line: #4A2E14;
  --blue: #60A5FA;
  --radius: 14px;
  --font: Inter, system-ui, -apple-system, sans-serif;
  --display: 'Space Grotesk', Inter, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; }
a { color: var(--ok); } a:hover { color: #99F6E4; }
button, input, select { font-family: inherit; font-size: 14px; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; margin: 0; }
h1 { font-size: 24px; } h2 { font-size: 18px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.boot { padding: 48px; color: var(--muted); text-align: center; }

.wrap { max-width: 1320px; margin: 0 auto; padding: 32px 24px 64px; display: flex; flex-direction: column; gap: 24px; }
.row { display: flex; flex-wrap: wrap; gap: 16px; }
.grow { flex: 999 1 560px; min-width: 0; }
.side { flex: 1 1 320px; min-width: 0; }
.third { flex: 1 1 380px; min-width: 0; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 8px; }
.inset { background: var(--inset); border-radius: 10px; padding: 12px 14px; }

/* header */
.top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 14px; }
.logo { width: 40px; height: 40px; border-radius: 10px; background: var(--accent-soft); display: flex; align-items: center; justify-content: center; }
.subtitle { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.nav { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.nav a { padding: 10px 14px; border-radius: 8px; color: var(--muted); text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
.nav a[aria-current="page"] { background: var(--nav-active); color: var(--text); font-weight: 500; }

/* buttons & fields */
.btn { min-height: 44px; padding: 10px 16px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--text); cursor: pointer; }
.btn:hover { border-color: #2B3A4A; }
.btn.primary { border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border-style: dashed; border-color: #2B3A4A; }
.btn.icon { width: 44px; padding: 0; color: var(--muted); font-size: 18px; background: transparent; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.field { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 12px; }
.input, select.input { width: 100%; background: var(--inset); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; min-height: 44px; }
.input:focus, .btn:focus-visible, .nav a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.input.right { text-align: right; font-variant-numeric: tabular-nums; }

/* KPI */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 8px; }
.kpi .label, .eyebrow { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.kpi .value { font-family: var(--display); font-size: 30px; font-weight: 600; }
.kpi .sub { color: var(--muted); font-size: 13px; }

/* allocation bars */
.legend { display: flex; gap: 16px; color: var(--muted); font-size: 12px; }
.legend span { display: flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.alloc-row { display: grid; grid-template-columns: 170px minmax(0, 1fr) 150px; gap: 16px; align-items: center; }
.track { position: relative; height: 12px; background: var(--line-soft); border-radius: 6px; }
.fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 6px; }
.tick { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--text); }
.alloc-val { text-align: right; }
.flag { font-size: 12px; }

/* platform */
.stack { display: flex; height: 14px; border-radius: 7px; overflow: hidden; gap: 2px; }
.list-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line-soft); gap: 12px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 10px; }

/* pills */
.pill { padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill.ok { background: var(--accent-soft); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.t-ok { color: var(--ok); } .t-warn { color: var(--warn); } .t-bad { color: var(--bad); }

/* chart */
.chart svg { width: 100%; height: 200px; display: block; }
.stress { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.stress .big { font-size: 20px; font-weight: 600; margin-top: 4px; }
.stress .alert { background: var(--alert-bg); }

.macro-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { color: var(--muted); font-size: 12px; font-weight: 500; text-align: left; padding: 10px 8px; }
td { padding: 10px 8px; border-top: 1px solid var(--line-soft); vertical-align: middle; }
td.right, th.right { text-align: right; }
table.edit td { padding: 6px; }
table.edit { min-width: 980px; table-layout: fixed; }

.check { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; background: var(--inset); border-radius: 10px; min-height: 44px; cursor: pointer; }
.check input { margin-top: 2px; accent-color: var(--accent); width: 16px; height: 16px; }
.check.done span { color: var(--muted); text-decoration: line-through; }

.alert-box { background: var(--alert-bg); border: 1px solid var(--alert-line); border-radius: var(--radius); padding: 16px 20px; display: flex; gap: 12px; }
.alert-box strong { color: #FDBA74; }
.platform-card .fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }

.empty { text-align: center; padding: 48px 24px; display: flex; flex-direction: column; gap: 16px; align-items: center; }
.login { max-width: 420px; margin: 12vh auto; }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 18px; opacity: 0; pointer-events: none; transition: opacity .2s; }
#toast.show { opacity: 1; }
#toast.error { border-color: var(--bad-line); color: var(--bad); }

@media (max-width: 640px) {
  .alloc-row { grid-template-columns: 1fr; gap: 8px; }
  .alloc-val { text-align: left; }
  .wrap { padding: 20px 16px 48px; }
}
