:root {
  --bg: #0b1220;
  --surface: #ffffff;
  --ink: #0f172a;
  --ink-soft: #475569;
  --muted: #94a3b8;
  --line: #e2e8f0;
  --primary: #1e3a8a;
  --primary-ink: #ffffff;
  --primary-soft: #eef2ff;
  --accent: #dc2626;
  --success: #16a34a;
  --warning: #f59e0b;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15,23,42,.06), 0 8px 24px rgba(15,23,42,.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  color: var(--ink);
  background: #f1f5f9;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

header.topbar {
  background: var(--bg);
  color: #cbd5e1;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
}
header.topbar .brand { color: #fff; font-weight: 700; letter-spacing: .2px; }
header.topbar .brand span { color: #93c5fd; }
header.topbar nav a { color: #cbd5e1; margin-left: 16px; font-size: 14px; }

.progress {
  position: sticky; top: 56px; z-index: 40;
  background: #fff; border-bottom: 1px solid var(--line);
  padding: 10px 24px;
}
.progress .bar { background: var(--line); border-radius: 999px; height: 8px; overflow: hidden; }
.progress .bar > span { display:block; height:100%; background: var(--primary); transition: width .3s ease; }
.progress .label { font-size: 12px; color: var(--ink-soft); margin-bottom: 6px; display:flex; justify-content: space-between; }

.container {
  max-width: 880px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}
.container.wide { max-width: 1200px; }

h1 { font-size: 34px; line-height: 1.15; margin: 0 0 8px; letter-spacing: -.5px; }
h2 { font-size: 22px; margin: 0 0 8px; }
h3 { font-size: 16px; margin: 0 0 4px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .5px; }
p.lead { color: var(--ink-soft); font-size: 18px; margin: 0 0 24px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

label { display:block; font-weight: 600; font-size: 14px; margin: 14px 0 6px; color: var(--ink); }
input[type="text"], input[type="email"], select, textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  background: #fff;
  color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30,58,138,.15);
}
textarea { min-height: 110px; resize: vertical; }

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 600px) { .row { grid-template-columns: 1fr; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 15px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .05s, background .15s, box-shadow .15s;
  text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn.primary   { background: var(--primary); color: #fff; }
.btn.primary:hover { background: #1d4ed8; text-decoration: none; }
.btn.secondary { background: #fff; color: var(--ink); border-color: var(--line); }
.btn.secondary:hover { background: #f8fafc; text-decoration: none; }
.btn.urgent    { background: var(--accent); color: #fff; }
.btn.urgent:hover { background: #b91c1c; text-decoration: none; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.full { width: 100%; }

.actions { display:flex; gap:12px; justify-content: flex-end; margin-top: 24px; flex-wrap: wrap; }
.actions.left { justify-content: flex-start; }
.actions.between { justify-content: space-between; }

.toast {
  position: fixed; right: 20px; bottom: 20px;
  background: #0f172a; color: #fff; padding: 12px 16px; border-radius: 8px;
  box-shadow: var(--shadow);
  opacity: 0; transform: translateY(10px); transition: opacity .2s, transform .2s;
  z-index: 100; max-width: 340px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--accent); }
.toast.ok    { background: var(--success); }

.muted { color: var(--ink-soft); }
.small { font-size: 13px; }
.hint  { color: var(--ink-soft); font-size: 13px; margin-top: 6px; }

.pill {
  display:inline-block; padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: var(--primary-soft); color: var(--primary);
}
.pill.green  { background:#dcfce7; color:#166534; }
.pill.yellow { background:#fef9c3; color:#854d0e; }
.pill.red    { background:#fee2e2; color:#991b1b; }

/* Stage 1: needs ranking */
.needs-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 700px) { .needs-grid { grid-template-columns: 1fr; } }
.topic-pool, .topic-rank {
  border: 1px dashed var(--line); border-radius: 10px; padding: 12px; min-height: 220px;
  background: #fafafa;
}
.topic-rank { background: #f8fafc; border-style: solid; }
.topic-rank ol { padding-left: 22px; margin: 0; }
.topic-rank li { padding: 8px 0; }
.topic-chip {
  display:inline-flex; align-items:center; gap:6px; cursor:pointer;
  background:#fff; border:1px solid var(--line); border-radius:999px;
  padding:8px 12px; margin: 4px; font-size: 14px; user-select: none;
}
.topic-chip:hover { border-color: var(--primary); }
.topic-chip.disabled { opacity: .35; cursor: not-allowed; }
.topic-chip.ranked { background: var(--primary); color: #fff; border-color: var(--primary); }
.rank-row {
  display:flex; align-items:center; justify-content:space-between;
  padding: 8px 12px; margin: 6px 0;
  background:#fff; border:1px solid var(--line); border-radius:8px;
}
.rank-row .num { font-weight:700; color: var(--primary); margin-right: 10px; }
.rank-row .x { color: var(--ink-soft); cursor: pointer; padding: 0 4px; }
.rank-row .x:hover { color: var(--accent); }

/* Map */
#map { width: 100%; height: 540px; border-radius: var(--radius); border: 1px solid var(--line); }
.map-side {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-top: 12px;
}
.map-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
@media (max-width: 900px) { .map-grid { grid-template-columns: 1fr; } #map { height: 380px; } }

/* Results */
.score-hero {
  display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap;
}
.score-hero .number {
  font-size: 88px; font-weight: 800; line-height: 1; letter-spacing: -2px;
}
.score-hero .number.green  { color: var(--success); }
.score-hero .number.yellow { color: var(--warning); }
.score-hero .number.red    { color: var(--accent); }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 16px; }
@media (max-width: 700px) { .metric-grid { grid-template-columns: repeat(2, 1fr); } }
.metric {
  background:#fff; border:1px solid var(--line); border-radius: 10px; padding: 14px;
}
.metric .label { font-size: 12px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .5px; }
.metric .value { font-size: 28px; font-weight: 700; margin-top: 4px; }
.bar-mini { background: var(--line); height: 6px; border-radius: 999px; margin-top: 8px; overflow:hidden; }
.bar-mini > span { display:block; height: 100%; }
.bar-mini > span.green  { background: var(--success); }
.bar-mini > span.yellow { background: var(--warning); }
.bar-mini > span.red    { background: var(--accent); }

/* CTA box */
.cta-box {
  border-radius: var(--radius);
  padding: 24px;
  margin-top: 20px;
  border: 1px solid var(--line);
  background: #fff;
}
.cta-box.urgent      { background: #fef2f2; border-color: #fecaca; }
.cta-box.recommended { background: #fefce8; border-color: #fde68a; }
.cta-box.optional    { background: #f0fdf4; border-color: #bbf7d0; }
.cta-box h2 { margin-bottom: 8px; }

/* Stage list (results sub-axes) */
.weakness { padding: 10px 0; border-bottom: 1px dashed var(--line); }
.weakness:last-child { border-bottom: none; }
