:root {
  --bg: #0b0e14;
  --bg-elev: #121723;
  --bg-elev-2: #182032;
  --border: #232c40;
  --border-soft: #1c2435;
  --text: #e6e9ef;
  --text-dim: #97a1b6;
  --text-faint: #5e6982;
  --accent: #5b8cff;
  --accent-soft: rgba(91, 140, 255, 0.14);
  --good: #34d399;
  --good-soft: rgba(52, 211, 153, 0.14);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.13);
  --bad: #f87171;
  --bad-soft: rgba(248, 113, 113, 0.13);
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ── boot / loading ─────────────────────────────────────────── */
.app-loading { display: grid; place-items: center; height: 100vh; }
.boot-spin {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--accent);
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── layout ─────────────────────────────────────────────────── */
.layout { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--bg-elev); border-right: 1px solid var(--border-soft);
  padding: 22px 16px; display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 22px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), #8b5bff);
  display: grid; place-items: center; font-weight: 800; color: #fff; font-size: 15px;
}
.brand-name { font-weight: 700; letter-spacing: .2px; }
.brand-name small { display: block; font-weight: 500; color: var(--text-faint); font-size: 11px; letter-spacing: .4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px;
  border-radius: var(--radius-sm); color: var(--text-dim); font-weight: 500;
  border: 1px solid transparent;
}
.nav-item:hover { background: var(--bg-elev-2); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: #cdd9ff; border-color: rgba(91,140,255,.25); }
.nav-item .ico { width: 17px; height: 17px; opacity: .85; }
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--border-soft); padding-top: 14px; }
.who { font-size: 12.5px; color: var(--text-dim); padding: 0 8px 8px; word-break: break-all; }
.who b { color: var(--text); font-weight: 600; }
.who .role { display: inline-block; margin-top: 4px; }

.main { padding: 30px 38px 60px; max-width: 1180px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.page-head h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -.2px; }
.page-head p { margin: 0; color: var(--text-dim); }
.crumb { color: var(--text-faint); font-size: 13px; margin-bottom: 10px; }
.crumb a:hover { text-decoration: underline; }

/* ── pills / badges ─────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600;
  padding: 3px 9px; border-radius: 100px; letter-spacing: .2px;
}
.badge.good { background: var(--good-soft); color: var(--good); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.neutral { background: var(--bg-elev-2); color: var(--text-dim); }
.badge.info { background: var(--accent-soft); color: #cdd9ff; }
.badge.dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ── cards ───────────────────────────────────────────────────── */
.grid { display: grid; gap: 16px; }
.cards { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.card {
  background: var(--bg-elev); border: 1px solid var(--border-soft);
  border-radius: var(--radius); padding: 18px 18px 16px; box-shadow: var(--shadow);
}
.exp-card { cursor: pointer; transition: border-color .15s, transform .15s; }
.exp-card:hover { border-color: var(--border); transform: translateY(-2px); }
.exp-card .ec-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.exp-card .ec-key { font-weight: 700; font-size: 15px; letter-spacing: -.1px; word-break: break-word; }
.exp-card .ec-dates { color: var(--text-faint); font-size: 12px; margin-top: 2px; }

.arm-row { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center;
  padding: 9px 0; border-top: 1px solid var(--border-soft); }
.arm-row:first-of-type { border-top: none; }
.arm-name { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.arm-name .swatch { width: 9px; height: 9px; border-radius: 3px; }
.swatch.control { background: var(--text-faint); }
.swatch.variant { background: var(--accent); }
.arm-metric { text-align: right; }
.arm-metric .v { font-weight: 700; font-variant-numeric: tabular-nums; }
.arm-metric .l { color: var(--text-faint); font-size: 11px; }

.stat-line { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--border-soft); }

/* ── stat tiles ─────────────────────────────────────────────── */
.tiles { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 20px; }
.tile { background: var(--bg-elev); border: 1px solid var(--border-soft); border-radius: var(--radius-sm); padding: 14px 16px; }
.tile .tl { color: var(--text-faint); font-size: 12px; margin-bottom: 6px; }
.tile .tv { font-size: 24px; font-weight: 700; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.tile .ts { font-size: 12px; color: var(--text-dim); margin-top: 2px; }

/* ── tables ─────────────────────────────────────────────────── */
.panel { background: var(--bg-elev); border: 1px solid var(--border-soft); border-radius: var(--radius); overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 15px 18px; border-bottom: 1px solid var(--border-soft); }
.panel-head h3 { margin: 0; font-size: 14.5px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 18px; font-size: 13px; }
th { color: var(--text-faint); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px; }
tbody tr { border-top: 1px solid var(--border-soft); }
tbody tr:hover { background: var(--bg-elev-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.muted { color: var(--text-faint); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

.chart-wrap { padding: 14px 10px 6px; }
.chart-box { position: relative; height: 300px; }

/* ── buttons / forms ────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--border);
  background: var(--bg-elev-2); color: var(--text); padding: 9px 15px; border-radius: var(--radius-sm);
  font-weight: 600; font-size: 13px; transition: background .15s, border-color .15s;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #6f9bff; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 6px 11px; font-size: 12px; }
.btn.danger { color: var(--bad); border-color: transparent; background: var(--bad-soft); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
input, select {
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
  padding: 10px 12px; border-radius: var(--radius-sm); font-size: 14px; width: 100%;
}
input:focus, select:focus { outline: none; border-color: var(--accent); }
label.field { display: block; margin-bottom: 14px; }
label.field span { display: block; font-size: 12.5px; color: var(--text-dim); margin-bottom: 6px; }

/* ── login ──────────────────────────────────────────────────── */
.login-wrap { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.login-card { width: 100%; max-width: 380px; background: var(--bg-elev); border: 1px solid var(--border-soft);
  border-radius: 18px; padding: 32px 30px; box-shadow: var(--shadow); }
.login-card .brand { justify-content: center; padding: 0 0 8px; }
.login-card h2 { text-align: center; margin: 6px 0 4px; font-size: 19px; }
.login-card .sub { text-align: center; color: var(--text-dim); margin: 0 0 22px; font-size: 13.5px; }

/* ── toast / banner ─────────────────────────────────────────── */
.banner { padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 16px; }
.banner.ok { background: var(--good-soft); color: var(--good); }
.banner.err { background: var(--bad-soft); color: var(--bad); }
.banner.info { background: var(--accent-soft); color: #cdd9ff; }
.empty { text-align: center; color: var(--text-faint); padding: 50px 20px; }

.row-actions { display: flex; gap: 8px; justify-content: flex-end; }
.toolbar { display: flex; gap: 10px; align-items: flex-end; margin-bottom: 18px; flex-wrap: wrap; }
.toolbar .field, .toolbar label.field { margin-bottom: 0; }
.toolbar .grow { flex: 1; min-width: 220px; }

@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .sidebar-foot { margin: 0; border: none; padding: 0; }
  .who { display: none; }
  .main { padding: 22px 18px 50px; }
}
