/* Demo Gate — matte dark, lilac/cream accents. No gradients, no glow. */
:root {
  --bg: #0b0b0d;
  --surface: #131316;
  --surface-2: #1a1a1f;
  --border: #232329;
  --text: #f2f2f4;
  --muted: #8e8e98;
  --lilac: #cdbcf2;      /* pale accent — UI chrome only */
  --cream: #efe7cf;      /* pale accent — UI chrome only */
  --s-label: #8f6ae8;    /* data series: label */
  --s-demo: #bd8b31;     /* data series: demo */
  --danger: #d96a6a;
  --r: 18px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  display: flex; flex-direction: column;
}
#shell { display: flex; flex-direction: column; min-height: 100vh; }

/* ---------- gate ---------- */
.gate {
  position: fixed; inset: 0; background: var(--bg); z-index: 50;
  display: flex; align-items: center; justify-content: center;
}
.gate-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  padding: 40px 44px; width: 360px; text-align: center;
}
.gate-card .wordmark { justify-content: center; margin-bottom: 10px; }
.gate-card form { display: flex; gap: 8px; margin-top: 18px; }
.gate-card input { flex: 1; }
.gate-error { color: var(--danger); font-size: 13px; margin-top: 12px; min-height: 16px; }

/* ---------- header ---------- */
header {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 30px;
}
.wordmark { font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", Helvetica, sans-serif; font-size: 19px; font-weight: 600; letter-spacing: -0.3px; display: flex; align-items: baseline; }
.wordmark .dot { color: var(--lilac); font-weight: 500; }
.module-label { color: var(--muted); font-size: 12px; font-weight: 500; text-transform: none; letter-spacing: 0; margin-left: 10px; align-self: baseline; }
.pills { display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 4px; }
.pill {
  border: none; background: none; color: var(--muted); font-size: 13.5px; font-weight: 500;
  padding: 8px 20px; border-radius: 999px; cursor: pointer; font-family: inherit;
}
.pill.active { background: #fff; color: #0b0b0d; }
.header-right { min-width: 110px; text-align: right; }
.status-chip {
  font-size: 12px; color: var(--muted); border: 1px solid var(--border);
  border-radius: 999px; padding: 5px 12px;
}
.status-chip.ok { color: var(--cream); }

/* ---------- layout ---------- */
main { flex: 1; width: 100%; max-width: 1140px; margin: 0 auto; padding: 10px 24px 48px; }
.view { display: none; }
.view.active { display: block; }
.cols { display: grid; grid-template-columns: 300px 1fr; gap: 16px; align-items: start; }
.cols.half { grid-template-columns: 1fr 1fr; }
.col-main { display: flex; flex-direction: column; gap: 16px; }
#label-body { display: flex; flex-direction: column; gap: 16px; }
@media (max-width: 900px) { .cols, .cols.half { grid-template-columns: 1fr; } }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  padding: 20px 22px;
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
h2 { font-size: 15.5px; font-weight: 600; letter-spacing: -0.2px; }
.small-cap { font-size: 12px; }
.muted { color: var(--muted); font-size: 13.5px; line-height: 1.55; }
.empty-card { padding: 34px; text-align: center; }

/* ---------- controls ---------- */
input[type=text], input[type=password] {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 10px; padding: 9px 12px; font-size: 14px; font-family: inherit; outline: none;
  width: 100%;
}
input:focus { border-color: #3a3a44; }
.btn {
  font-family: inherit; font-size: 13.5px; font-weight: 500; cursor: pointer;
  border-radius: 10px; padding: 9px 16px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text);
}
.btn.primary { background: #fff; color: #0b0b0d; border-color: #fff; }
.btn.ghost { background: none; color: var(--muted); }
.btn.ghost:hover { color: var(--danger); border-color: var(--danger); }
.btn.small { padding: 7px 13px; font-size: 12.5px; }
.inline-form { display: flex; gap: 8px; margin-bottom: 14px; }

/* ---------- label list ---------- */
.label-list { display: flex; flex-direction: column; gap: 4px; }
.label-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 12px; border-radius: 12px; cursor: pointer; border: 1px solid transparent;
}
.label-item:hover { background: var(--surface-2); }
.label-item.active { background: var(--surface-2); border-color: var(--border); }
.label-item .n { font-size: 14px; font-weight: 500; }
.label-item .c { font-size: 12px; color: var(--muted); }

/* ---------- tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 14px 0 4px; }
@media (max-width: 700px) { .tiles { grid-template-columns: repeat(2, 1fr); } }
.tile { background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; }
.tile-num { font-size: 26px; font-weight: 700; letter-spacing: -0.5px; }
.tile-cap { font-size: 11.5px; color: var(--muted); margin-top: 3px; text-transform: uppercase; letter-spacing: 0.6px; }

/* ---------- chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chip {
  background: var(--surface-2); border: 1px solid var(--border); color: #c6c6cf;
  font-size: 12px; padding: 4px 11px; border-radius: 999px; white-space: nowrap;
}

/* ---------- dropzone ---------- */
.dropzone {
  border: 1.5px dashed #33333c; border-radius: 14px; padding: 28px 18px; text-align: center;
  cursor: pointer; display: flex; flex-direction: column; gap: 5px;
}
.dropzone:hover, .dropzone.drag { border-color: var(--lilac); background: var(--surface-2); }
.dz-big { font-size: 15px; font-weight: 600; }
.dz-small { color: var(--muted); font-size: 12.5px; }
.progress { margin-top: 12px; color: var(--cream); font-size: 13.5px; }
.hidden { display: none !important; }

/* ---------- tracks ---------- */
.track-row { border-top: 1px solid var(--border); }
.track-row:first-child { border-top: none; }
.track-row summary {
  list-style: none; display: flex; align-items: center; gap: 12px; padding: 12px 4px; cursor: pointer;
}
.track-row summary::-webkit-details-marker { display: none; }
.track-row .caret { color: var(--muted); font-size: 10px; transition: transform .15s; width: 12px; }
.track-row[open] .caret { transform: rotate(90deg); }
.track-row .t-name { flex: 1; font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track-row .t-meta { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.track-body { padding: 2px 4px 16px 26px; }

/* ---------- test results ---------- */
#test-result { display: flex; flex-direction: column; gap: 16px; margin-top: 16px; }
.hero { display: flex; align-items: center; gap: 26px; }
.hero-num { font-size: 56px; font-weight: 800; letter-spacing: -2px; line-height: 1; }
.hero-num.good { color: var(--lilac); }
.hero-num.mid { color: var(--cream); }
.hero-num.bad { color: var(--muted); }
.hero-cap { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.6px; margin-top: 6px; }
.hero-text h2 { font-size: 18px; margin-bottom: 4px; }

.rank-row { border-top: 1px solid var(--border); }
.rank-row:first-child { border-top: none; }
.rank-row summary { list-style: none; display: flex; align-items: center; gap: 14px; padding: 13px 4px; cursor: pointer; }
.rank-row summary::-webkit-details-marker { display: none; }
.rank-row .r-pos { color: var(--muted); font-size: 12.5px; width: 18px; }
.rank-row .r-name { flex: 0 0 190px; font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-row .r-bar { flex: 1; background: var(--surface-2); border-radius: 999px; height: 8px; overflow: hidden; }
.rank-row .r-bar div { background: var(--s-label); height: 100%; border-radius: 999px; }
.rank-row .r-score { width: 34px; text-align: right; font-weight: 600; font-size: 14px; }
.rank-row .r-verdict { flex: 0 0 130px; text-align: right; font-size: 12px; color: var(--muted); }
.rank-body { padding: 6px 4px 18px 36px; }
.rank-body h3, .track-body h3 { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.7px; color: var(--muted); margin: 14px 0 8px; }

.sim-table { width: 100%; border-collapse: collapse; }
.sim-table td { padding: 5px 8px 5px 0; font-size: 13.5px; vertical-align: middle; }
.sim-table td:first-child { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sim-table .bar { background: var(--surface-2); border-radius: 999px; height: 6px; min-width: 90px; overflow: hidden; }
.sim-table .bar div { background: var(--s-label); height: 100%; border-radius: 999px; }
.sim-table .pct { color: var(--muted); width: 36px; text-align: right; font-size: 12.5px; }

/* ---------- charts ---------- */
.chart { width: 100%; }
.chart svg { display: block; width: 100%; height: auto; }
.chart text { font-family: inherit; }
.legend { display: flex; gap: 16px; margin-bottom: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.tooltip {
  position: fixed; z-index: 60; pointer-events: none;
  background: #202027; border: 1px solid #33333c; border-radius: 8px;
  padding: 6px 10px; font-size: 12.5px; color: var(--text);
}

footer { text-align: center; color: #55555e; font-size: 12px; padding: 16px; }
