:root {
  --bg: #080808;
  --card: #161616;
  --card-2: #1f1f1f;
  --fg: #f9f9f9;
  --muted: #d9d9d9;
  --dim: #6b6b6b;
  --line: #2a2a2a;
  --banner: #DFFF9D;
  --pulse: #1DFAA7;
  --primary: #0ea5e9;
  --primary-dim: #0369a1;
  --amber: #fbbf24;
  --red: #ef4444;
  --radius: 10px;
}

[data-theme="light"] {
  --bg: #f5f5f5;
  --card: #ffffff;
  --card-2: #f0f0f0;
  --fg: #1a1a1a;
  --muted: #555555;
  --dim: #888888;
  --line: #e0e0e0;
  --banner: #b8d96e;
  --pulse: #0d9f6e;
  --primary: #0a7ec2;
  --primary-dim: #054d7a;
  --amber: #d97706;
  --red: #dc2626;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--fg); }
body {
  font-family: "InterVariable", Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "liga" 1, "calt" 1;
  font-weight: 400;
  line-height: 1.45;
  min-height: 100vh;
  padding-bottom: 70px;
}

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

.muted { color: var(--muted); }
.muted.small, .small { font-size: 0.85rem; color: var(--dim); }

h1 { font-size: 1.5rem; margin: 0 0 0.5rem 0; font-weight: 500; letter-spacing: -0.01em; }
h2 { font-size: 1rem; margin: 0 0 0.5rem 0; font-weight: 500; color: var(--muted); }

main { max-width: 1100px; margin: 0 auto; padding: 1rem; }

/* Topbar */
.topbar {
  display: flex; align-items: center; gap: 1rem;
  padding: 0.75rem 1rem; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--bg); z-index: 5;
}
.brand { font-weight: 600; font-size: 1.1rem; color: var(--banner); letter-spacing: -0.02em; }
.topnav { display: flex; gap: 1rem; flex: 1; }
.topnav a { color: var(--muted); }
.topnav a:hover { color: var(--pulse); }
.top-actions { display: flex; gap: 0.5rem; align-items: center; }
.theme-toggle {
  background: transparent; color: var(--muted); border: 1px solid var(--line);
  padding: 0.25rem 0.6rem; border-radius: var(--radius); cursor: pointer;
  font-size: 1rem; line-height: 1;
}
.theme-toggle:hover { color: var(--pulse); border-color: var(--primary); }
.logout button {
  background: transparent; color: var(--muted); border: 1px solid var(--line);
  padding: 0.25rem 0.6rem; border-radius: var(--radius); cursor: pointer;
}

/* Bottom nav (mobile) */
.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: none;
  background: var(--card); border-top: 1px solid var(--line);
  padding: 0.5rem; gap: 0.5rem; justify-content: space-around;
}
.bottomnav a {
  flex: 1; text-align: center; padding: 0.5rem; color: var(--muted);
  border-radius: var(--radius); font-size: 0.95rem;
}
.bottomnav a:hover { background: var(--card-2); color: var(--pulse); }

@media (max-width: 720px) {
  .topnav { display: none; }
  .bottomnav { display: flex; }
}

/* Forms */
input, select, textarea, button {
  font-family: inherit; font-size: 1rem; color: var(--fg);
}
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="url"], select, textarea {
  width: 100%; background: var(--card-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 0.6rem 0.75rem;
  min-height: 44px;
}
textarea { min-height: 100px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary); background: var(--card);
}
label { display: block; margin-bottom: 0.75rem; font-size: 0.9rem; color: var(--muted); }
label input, label select, label textarea { margin-top: 0.25rem; }

button {
  background: var(--card-2); color: var(--fg); border: 1px solid var(--line);
  padding: 0.65rem 1rem; border-radius: var(--radius); cursor: pointer;
  min-height: 44px;
}
button:hover { background: var(--card); border-color: var(--primary-dim); }
button.primary {
  background: var(--banner); color: #000; border-color: var(--banner); font-weight: 600;
}
button.primary:hover { background: var(--pulse); border-color: var(--pulse); }
button.danger {
  background: transparent; color: var(--red); border-color: var(--red);
}
button.danger:hover { background: rgba(239,68,68,0.1); }
button.full { width: 100%; }
.ghost { color: var(--muted); padding: 0.5rem 0.75rem; border-radius: var(--radius); }
.ghost:hover { background: var(--card); color: var(--pulse); }

.row { display: flex; gap: 0.5rem; align-items: center; }
.row.spaced { justify-content: space-between; margin-top: 1rem; }
.stack > * + * { margin-top: 0.75rem; }
.cta { padding: 0.65rem 1rem; border-radius: var(--radius); display: inline-block; }
.primary.cta { background: var(--banner); color: #000; font-weight: 600; }
.primary.cta:hover { background: var(--pulse); }

/* Login */
.login {
  max-width: 360px; margin: 4rem auto; padding: 2rem;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
}
.login h1 { color: var(--banner); }
.login .error { color: var(--red); font-size: 0.9rem; margin: 0.5rem 0; }
.login button { width: 100%; margin-top: 0.5rem; }

/* Page head */
.page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; gap: 1rem; flex-wrap: wrap; }

/* Pipeline */
.lanes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}
@media (max-width: 720px) {
  .lanes { grid-template-columns: 1fr; }
}
.lane { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.75rem; }
.lane h2 { display: flex; justify-content: space-between; align-items: center; }
.lane .count { color: var(--dim); font-weight: 400; }
.card-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.card { background: var(--card-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.6rem 0.75rem; }
.card:hover { border-color: var(--primary-dim); }
.card-link { color: inherit; display: block; }
.card-title { font-weight: 500; }
.card-sub { font-size: 0.85rem; color: var(--muted); margin-top: 0.15rem; }
.card-meta { display: flex; gap: 0.5rem; align-items: center; margin-top: 0.4rem; font-size: 0.85rem; color: var(--muted); }
.card-foot { font-size: 0.75rem; margin-top: 0.25rem; }

/* Verdict */
.verdict { padding: 0.15rem 0.5rem; border-radius: 4px; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.04em; }
.verdict.pass    { background: var(--pulse); color: #000; }
.verdict.caution { background: var(--amber); color: #000; }
.verdict.reject  { background: var(--red); color: #fff; }
.verdict.needs   { background: var(--dim); color: #000; }

.verdict-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem; margin-bottom: 1rem;
  border-left: 4px solid var(--dim);
}
.verdict-card.pass    { border-left-color: var(--pulse); }
.verdict-card.caution { border-left-color: var(--amber); }
.verdict-card.reject  { border-left-color: var(--red); }
.verdict-card.needs   { border-left-color: var(--dim); }

.verdict-row { display: flex; justify-content: space-between; align-items: baseline; }
.vlabel { font-size: 1.1rem; font-weight: 600; letter-spacing: 0.02em; }
.vscore { font-size: 1.5rem; font-weight: 600; font-feature-settings: "tnum" 1; }
.vscore small { font-size: 0.7rem; color: var(--dim); font-weight: 400; }
.verdict-bar { background: var(--card-2); height: 6px; border-radius: 3px; margin: 0.5rem 0; overflow: hidden; }
.bar-fill { height: 100%; background: var(--pulse); transition: width 0.3s; }
.verdict-card.caution .bar-fill { background: var(--amber); }
.verdict-card.reject  .bar-fill { background: var(--red); }
.verdict-card.needs   .bar-fill { background: var(--dim); }

.verdict-stats { list-style: none; margin: 0.5rem 0 0; padding: 0; font-size: 0.85rem; color: var(--muted); }
.verdict-stats li { padding: 0.15rem 0; }
.ok { color: var(--pulse); }
.bad { color: var(--red); }

.flags { list-style: none; margin: 0.5rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.flag { padding: 0.15rem 0.5rem; border-radius: 4px; font-size: 0.75rem; }
.flag.red { background: rgba(239,68,68,0.2); color: var(--red); border: 1px solid rgba(239,68,68,0.3); }
.flag.yellow { background: rgba(251,191,36,0.15); color: var(--amber); border: 1px solid rgba(251,191,36,0.3); }

.failed-gates { margin-top: 0.5rem; font-size: 0.85rem; }
.failed-gates summary { cursor: pointer; color: var(--red); }

/* Wizard */
.wizard { max-width: 520px; margin: 0 auto; }
.wizard-head { margin-bottom: 1.5rem; }
.step-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 0.5rem; }
.section-tag { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--banner); }
progress {
  width: 100%; height: 4px; border: none; background: var(--card-2); border-radius: 2px; margin-top: 0.5rem;
}
progress::-webkit-progress-bar { background: var(--card-2); border-radius: 2px; }
progress::-webkit-progress-value { background: var(--pulse); border-radius: 2px; }
progress::-moz-progress-bar { background: var(--pulse); border-radius: 2px; }

.q { font-size: 1.4rem; font-weight: 500; margin: 1rem 0 0.25rem; }
.choices { display: grid; gap: 0.5rem; margin: 1.5rem 0; }
.choices.stack { grid-template-columns: 1fr; }
.choices:not(.stack) { grid-template-columns: 1fr; }
.choice {
  width: 100%; min-height: 56px; font-size: 1rem; text-align: left;
  padding: 0.75rem 1rem;
}
.choice.yes { border-color: rgba(29,250,167,0.4); }
.choice.yes:hover, .choice.yes.sel { background: rgba(29,250,167,0.15); border-color: var(--pulse); }
.choice.unk:hover, .choice.unk.sel { background: rgba(217,217,217,0.1); border-color: var(--muted); }
.choice.no { border-color: rgba(239,68,68,0.4); }
.choice.no:hover, .choice.no.sel { background: rgba(239,68,68,0.15); border-color: var(--red); }

.slider-wrap { margin: 1.5rem 0; }
.slider-wrap input[type="range"] { width: 100%; }
.slider-wrap output { display: block; text-align: center; font-size: 2rem; color: var(--pulse); margin: 0.5rem 0; font-weight: 600; }
.slider-wrap .scale { display: flex; justify-content: space-between; margin-bottom: 1rem; }

.num-wrap { margin: 1.5rem 0; }
.num-wrap { display: flex; flex-direction: column; gap: 0.5rem; }
.num-wrap .prefix { display: none; }
.num-wrap input { font-size: 1.5rem; padding: 0.75rem; text-align: center; }

.wizard-foot { margin-top: 2rem; }
.wizard-nav { display: flex; justify-content: space-between; margin-top: 1rem; }

/* Opp detail */
.opp { max-width: 800px; margin: 0 auto; }
.opp-head { margin-bottom: 1rem; }
.status-form { display: inline-block; margin-top: 0.5rem; }
.status-form select { display: inline-block; width: auto; }
details {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  margin-bottom: 0.75rem; padding: 0.75rem 1rem;
  overflow: hidden;
}
details summary { cursor: pointer; font-weight: 500; user-select: none; }
details[open] summary { margin-bottom: 0.75rem; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.grid-2 > * { min-width: 0; }
.grid-2 .span-2 { grid-column: span 2; }
@media (max-width: 480px) { .grid-2 { grid-template-columns: 1fr; } .grid-2 .span-2 { grid-column: span 1; } }

.gates-list { list-style: none; margin: 0; padding: 0; }
.gates-list li {
  display: grid; grid-template-columns: 1fr auto; gap: 0.75rem;
  padding: 0.5rem 0; border-bottom: 1px solid var(--line); align-items: center;
}
.gates-list li:last-child { border-bottom: none; }
.gate-label { font-size: 0.9rem; }
.gates-list select { width: 110px; }

.slider-row { display: grid; grid-template-columns: 1fr; gap: 0.25rem; padding: 0.5rem 0; border-bottom: 1px solid var(--line); }
.slider-row:last-child { border-bottom: none; }
.slider-row span { font-size: 0.9rem; color: var(--muted); }

/* Compare */
.cmp-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.cmp { width: 100%; border-collapse: collapse; }
.cmp th, .cmp td { padding: 0.6rem 0.75rem; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.cmp th { background: var(--card); position: sticky; top: 0; }
.cmp td:first-child, .cmp th:first-child { color: var(--muted); font-size: 0.85rem; }

/* Form-narrow */
.form-narrow { max-width: 520px; margin: 0 auto; }

/* Status accent dots on lane headers (subtle) */
.lane.status-lead h2::before        { content:"●"; color: var(--dim); margin-right: 0.4rem; }
.lane.status-talking h2::before     { content:"●"; color: var(--primary); margin-right: 0.4rem; }
.lane.status-interviewing h2::before{ content:"●"; color: var(--amber); margin-right: 0.4rem; }
.lane.status-offer h2::before       { content:"●"; color: var(--pulse); margin-right: 0.4rem; }
.lane.status-declined h2::before    { content:"●"; color: var(--red); margin-right: 0.4rem; }
.lane.status-accepted h2::before    { content:"●"; color: var(--banner); margin-right: 0.4rem; }
.lane.status-archived h2::before    { content:"●"; color: var(--dim); margin-right: 0.4rem; }

/* Drag & drop */
.card { cursor: grab; }
.card:active { cursor: grabbing; }
.card.dragging {
  opacity: 0.5;
  transform: rotate(2deg);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
.lane.drop-target {
  border-color: var(--primary);
  transition: background 0.15s, border-color 0.15s;
}
.lane.drag-over {
  background: rgba(14, 165, 233, 0.08);
  border-color: var(--pulse);
}
