:root {
  --navy: #071526;
  --navy-2: #0d2238;
  --panel: #102a44;
  --panel-2: #133451;
  --gold: #d8aa43;
  --gold-2: #f2d17a;
  --text: #f6f1e7;
  --muted: #a8b5c4;
  --line: rgba(216, 170, 67, 0.24);
  --danger: #ee6b5f;
  --ok: #6bd39a;
  --warn: #f2c15f;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(216,170,67,.18), transparent 34rem),
    linear-gradient(135deg, #04101f 0%, var(--navy) 44%, #081a2b 100%);
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; border: 0; border-radius: 999px; padding: .75rem 1rem; font-weight: 800; }
.gold { background: linear-gradient(135deg, var(--gold), var(--gold-2)); color: #111827; box-shadow: 0 14px 30px rgba(216,170,67,.18); }
.ghost { background: rgba(255,255,255,.06); color: var(--text); border: 1px solid var(--line); }
.danger { background: rgba(238,107,95,.12); color: #ffd7d3; border: 1px solid rgba(238,107,95,.38); }
.topbar { display: flex; justify-content: space-between; gap: 2rem; padding: 2rem clamp(1rem, 3vw, 3rem); border-bottom: 1px solid var(--line); }
h1 { margin: .15rem 0 .35rem; font-size: clamp(2.15rem, 5vw, 5rem); letter-spacing: -.07em; line-height: .9; }
h2, h3, p { margin-top: 0; }
.subhead { color: var(--muted); max-width: 760px; font-size: 1.05rem; line-height: 1.55; }
.eyebrow { color: var(--gold-2); text-transform: uppercase; letter-spacing: .14em; font-size: .75rem; font-weight: 900; }
.header-actions { display: flex; gap: .75rem; align-items: flex-start; flex-wrap: wrap; }
.layout { display: grid; grid-template-columns: minmax(290px, 360px) 1fr; gap: 1rem; padding: 1rem clamp(1rem, 3vw, 3rem) 3rem; }
.panel { background: linear-gradient(180deg, rgba(16,42,68,.95), rgba(9,28,48,.96)); border: 1px solid var(--line); border-radius: 24px; padding: 1.1rem; box-shadow: 0 24px 80px rgba(0,0,0,.24); }
.context-panel { position: sticky; top: 1rem; align-self: start; }
.main-stack { display: grid; gap: 1rem; }
.section-title { display: flex; align-items: center; gap: .75rem; margin-bottom: 1rem; }
.section-title span { color: var(--gold-2); border: 1px solid var(--line); border-radius: 999px; padding: .25rem .55rem; font-size: .75rem; font-weight: 900; }
.section-title h2 { margin: 0; letter-spacing: -.03em; }
label { display: grid; gap: .35rem; color: var(--muted); font-size: .82rem; font-weight: 800; margin-bottom: .85rem; }
input, select, textarea { width: 100%; border: 1px solid rgba(255,255,255,.12); border-radius: 14px; background: rgba(3,13,26,.58); color: var(--text); padding: .75rem .8rem; outline: none; }
textarea { resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(216,170,67,.14); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.mini-card { border: 1px dashed var(--line); border-radius: 18px; padding: .9rem; background: rgba(216,170,67,.07); color: var(--muted); line-height: 1.45; }
.mini-card strong { color: var(--gold-2); }
.hero-grid { display: grid; grid-template-columns: 1fr 280px; gap: 1rem; }
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; }
.finalist-card { border-radius: 20px; border: 1px solid rgba(255,255,255,.1); background: rgba(255,255,255,.045); padding: 1rem; }
.finalist-card.active { border-color: var(--gold); background: rgba(216,170,67,.1); }
.finalist-card button { width: 100%; margin-top: .7rem; padding: .55rem; }
.pills { display: flex; flex-wrap: wrap; gap: .35rem; margin: .65rem 0; }
.pill { border: 1px solid rgba(255,255,255,.12); color: var(--muted); border-radius: 999px; padding: .25rem .5rem; font-size: .72rem; }
.score-card { border-radius: 22px; padding: 1rem; background: #071526; border: 1px solid var(--line); }
.score { font-size: 4.5rem; line-height: .9; letter-spacing: -.08em; font-weight: 950; color: var(--gold-2); }
.risk-label { font-weight: 900; margin: .5rem 0; }
.meter { height: .75rem; background: rgba(255,255,255,.08); border-radius: 999px; overflow: hidden; }
.meter span { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, var(--ok), var(--warn), var(--danger)); transition: width .25s ease; }
.muted { color: var(--muted); line-height: 1.5; }
.driver-grid, .lever-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .8rem; }
.driver-card, .lever-card, .check-item { border: 1px solid rgba(255,255,255,.1); border-radius: 18px; background: rgba(255,255,255,.04); padding: .9rem; }
.driver-head { display: flex; justify-content: space-between; gap: .7rem; align-items: center; }
.driver-head h3 { margin-bottom: .45rem; font-size: 1rem; }
.driver-head output { color: var(--gold-2); font-weight: 950; }
input[type="range"] { accent-color: var(--gold); padding: 0; }
.lever-card strong { display: block; color: var(--gold-2); margin-bottom: .35rem; }
.lever-card p { color: var(--muted); line-height: 1.45; margin-bottom: 0; }
.checklist { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; }
.check-item { display: flex; gap: .7rem; align-items: flex-start; color: var(--muted); }
.check-item input { width: auto; margin-top: .25rem; accent-color: var(--gold); }
.check-item strong { color: var(--text); display: block; }
.brief-panel textarea { min-height: 420px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9rem; background: #06111f; }
.actions { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; margin-top: .85rem; }
.save-state { color: var(--muted); font-size: .85rem; }
@media (max-width: 1050px) {
  .layout, .hero-grid { grid-template-columns: 1fr; }
  .context-panel { position: static; }
  .cards, .driver-grid, .lever-grid, .checklist { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 650px) {
  .topbar { flex-direction: column; }
  .cards, .driver-grid, .lever-grid, .checklist, .two-col { grid-template-columns: 1fr; }
}
@media print {
  body { background: white; color: #111; }
  .topbar, .context-panel, .panel:not(.brief-panel), .actions { display: none; }
  .layout { display: block; padding: 0; }
  .brief-panel { border: 0; box-shadow: none; background: white; }
  .brief-panel textarea { color: #111; border: 0; background: white; min-height: 95vh; }
}
