:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --text: #1b2333;
  --muted: #5b6577;
  --border: #e2e6ef;
  --primary: #b45309;
  --primary-ink: #ffffff;
  --accent: #1f4e8c;
  --ok: #1a7f4b;
  --warn: #a15c00;
  --reach: #b4235a;
  --target: #1f4e8c;
  --likely: #1a7f4b;
  --callout: #fff4ea;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 14px rgba(16, 24, 40, .06);
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f141c; --surface: #171e29; --text: #e7ecf3; --muted: #9aa5b8; --border: #2a3342;
    --primary: #f08a3c; --primary-ink: #1a1006; --accent: #7fb0ff; --ok: #4cc38a; --warn: #f0b35a;
    --reach: #ff7aa8; --target: #7fb0ff; --likely: #4cc38a; --callout: #241b13;
    --shadow: 0 1px 2px rgba(0,0,0,.4);
  }
}
:root[data-theme="dark"] {
  --bg: #0f141c; --surface: #171e29; --text: #e7ecf3; --muted: #9aa5b8; --border: #2a3342;
  --primary: #f08a3c; --primary-ink: #1a1006; --accent: #7fb0ff; --ok: #4cc38a; --warn: #f0b35a;
  --reach: #ff7aa8; --target: #7fb0ff; --likely: #4cc38a; --callout: #241b13;
  --shadow: 0 1px 2px rgba(0,0,0,.4);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 70px; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
a { color: var(--accent); }
h1 { font-size: clamp(1.6rem, 4vw, 2.3rem); line-height: 1.2; margin: .6em 0 .3em; }
h2 { font-size: 1.25rem; margin: .2em 0 .5em; }
h3 { font-size: 1.05rem; margin: 0 0 .4em; }
ul, ol { padding-left: 1.2em; margin: .4em 0; }
li { margin: .25em 0; }
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.lead { font-size: 1.08rem; color: var(--muted); max-width: 75ch; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 8px; top: 8px; background: var(--surface); padding: 8px; z-index: 10; }

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 5; background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 58px; flex-wrap: wrap; }
.brand { font-weight: 700; text-decoration: none; color: var(--text); white-space: nowrap; }
#nav { display: flex; gap: 2px; flex-wrap: wrap; }
#nav a { text-decoration: none; color: var(--muted); padding: 6px 9px; border-radius: 8px; font-size: .92rem; }
#nav a:hover { background: var(--bg); color: var(--text); }
#nav a.active { background: var(--primary); color: var(--primary-ink); }
.pill:not(:empty) { display: inline-block; min-width: 1.4em; text-align: center; font-size: .72rem; background: var(--accent); color: #fff; border-radius: 999px; padding: 0 5px; margin-left: 2px; }
.menu-btn { display: none; }
@media (max-width: 1000px) {
  .menu-btn { display: inline-block; background: none; border: 1px solid var(--border); color: var(--text); padding: 6px 12px; border-radius: 8px; font: inherit; }
  #nav { display: none; width: 100%; flex-direction: column; padding-bottom: 10px; }
  #nav.open { display: flex; }
}

/* Layout */
main { padding-bottom: 40px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); }
.g3 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.g4 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px; min-width: 0; }
.grid > .card { margin-bottom: 0; }
.section-title { margin-top: 1.6em; }
.callout { background: var(--callout); border-color: color-mix(in srgb, var(--primary) 35%, var(--border)); margin-top: 16px; }
.warn-card { border-left: 4px solid var(--reach); margin-top: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.between { justify-content: space-between; }
.span-all { grid-column: 1 / -1; }

/* Hero & steps */
.hero { padding: 28px 0 18px; }
.eyebrow { color: var(--primary); font-weight: 600; letter-spacing: .02em; margin: 0; font-size: .92rem; }
.hero-cta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.steps { margin-bottom: 16px; }
.step { text-decoration: none; color: var(--text); display: flex; flex-direction: column; gap: 2px; }
.step b { width: 30px; height: 30px; border-radius: 50%; background: var(--primary); color: var(--primary-ink); display: grid; place-items: center; }
.step span { font-weight: 700; margin-top: 6px; }
.step small { color: var(--muted); }
.step:hover { border-color: var(--primary); }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat-label { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.stat-value { font-size: 1.5rem; font-weight: 700; }
.stat-value.sm { font-size: 1.05rem; }

/* Controls */
.btn { display: inline-block; border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 10px 16px; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--primary); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
label { display: block; font-size: .88rem; font-weight: 600; margin-bottom: 4px; }
input, select { font: inherit; padding: 9px 10px; border: 1px solid var(--border); border-radius: 9px; background: var(--bg); color: var(--text); width: 100%; max-width: 100%; }
.row input[type=text] { flex: 1 1 240px; width: auto; }
.row select { width: auto; }
.form { margin-bottom: 4px; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 60%, transparent); outline-offset: 2px; }
.filters { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr)); }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { margin: 0; font-weight: 500; cursor: pointer; }
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip span { display: inline-block; padding: 7px 13px; border: 1px solid var(--border); border-radius: 999px; background: var(--bg); font-size: .92rem; }
.chip input:checked + span { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.chip input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--primary) 60%, transparent); }
.chip input:disabled + span { opacity: .45; cursor: not-allowed; }

/* Rank */
.rank-list { list-style: none; padding: 0; }
.rank-list li { padding: 10px 12px; border-radius: 10px; margin: 8px 0; border: 1px solid var(--border); }
.rank-list li.ok { border-left: 4px solid var(--ok); }
.rank-list li.warn { border-left: 4px solid var(--warn); }

/* Universities */
.uni-head h3 { margin-bottom: 0; }
.uni-head p { margin: 0; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 4px; }
.badge { font-size: .78rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; border: 1px solid currentColor; }
.badge.reach { color: var(--reach); } .badge.target { color: var(--target); } .badge.likely { color: var(--likely); }
.badge.auto { background: var(--likely); color: #fff; border-color: var(--likely); }
.badge.neutral { color: var(--muted); }
.badge.warnb { color: var(--warn); }
.rank-line { margin: 6px 0 0; font-weight: 600; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin: 12px 0; }
.kv div { background: var(--bg); border-radius: 10px; padding: 8px 10px; }
.kv span { display: block; font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.kv strong { font-size: .95rem; overflow-wrap: anywhere; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.tag { font-size: .75rem; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); padding: 2px 8px; border-radius: 999px; font-weight: 600; }
.tag.lg { font-size: .9rem; padding: 5px 12px; }
.links { display: flex; flex-wrap: wrap; gap: 10px 14px; font-size: .9rem; border-top: 1px solid var(--border); padding-top: 10px; }
.uni-mini { list-style: none; padding: 0; margin: 0; }
.uni-mini li { padding: 7px 0; border-bottom: 1px solid var(--border); }
.uni-mini.cols { columns: 2 280px; column-gap: 24px; }
.uni-mini.cols li { break-inside: avoid; }
.tier h3 { border-bottom: 3px solid; padding-bottom: 6px; }
.tier.reach h3 { border-color: var(--reach); } .tier.target h3 { border-color: var(--target); } .tier.likely h3 { border-color: var(--likely); }

/* Career paths */
.path-card { display: flex; gap: 14px; text-decoration: none; color: var(--text); }
.path-card:hover { border-color: var(--primary); }
.path-card h3 { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.path-card .cluster { margin: 0 0 2px; text-transform: uppercase; letter-spacing: .05em; font-size: .72rem; }
.path-icon { font-size: 1.8rem; line-height: 1; flex: 0 0 auto; }
.path-icon.big { font-size: 3rem; }
.path-hero { display: flex; gap: 18px; align-items: flex-start; }
.path-hero h1 { margin-top: .1em; }
.linkish { color: var(--accent); font-weight: 600; }
.match { font-size: .75rem; background: var(--primary); color: var(--primary-ink); padding: 2px 8px; border-radius: 999px; }
.crumbs { margin: 16px 0 0; }
.kit-list { list-style: none; padding: 0; margin: 0; }
.kit-list li { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.kit-list li:last-child { border-bottom: 0; }
.add { flex: 0 0 auto; font: inherit; font-size: .8rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--primary); color: var(--primary); background: transparent; cursor: pointer; white-space: nowrap; }
.add:hover { background: var(--primary); color: var(--primary-ink); }
.add.added { border-color: var(--likely); color: var(--likely); cursor: default; background: transparent; }

/* Quiz */
.progress { height: 8px; background: var(--bg); border-radius: 999px; overflow: hidden; border: 1px solid var(--border); }
.progress > div { height: 100%; width: 0; background: var(--primary); transition: width .3s; }
.rate { border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px 12px; margin: 0 0 10px; }
.rate legend { font-weight: 600; padding: 0 4px; }
.rate-opt { display: inline-block; margin: 6px 6px 0 0; font-weight: 500; cursor: pointer; }
.rate-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.rate-opt span { display: inline-block; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg); }
.rate-opt input:checked + span { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.rate-opt input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--primary) 60%, transparent); }
.bars { margin: 14px 0; }
.bar-row { display: grid; grid-template-columns: minmax(0, 1.3fr) 2fr 44px; gap: 10px; align-items: center; margin: 6px 0; font-size: .9rem; }
.bar { height: 10px; background: var(--bg); border-radius: 999px; overflow: hidden; border: 1px solid var(--border); }
.bar > div { height: 100%; background: var(--primary); border-radius: 999px; }
@media (max-width: 560px) { .bar-row { grid-template-columns: 1fr 44px; } .bar-row .bar { grid-column: 1 / -1; grid-row: 2; } }

/* Timeline */
.timeline { list-style: none; padding: 0; }
.timeline > li { display: grid; grid-template-columns: 170px 1fr; gap: 16px; margin: 0 0 16px; }
.tl-when { font-weight: 700; color: var(--primary); padding-top: 18px; }
.timeline > li.past { opacity: .6; }
.timeline > li.current .card { border: 2px solid var(--primary); }
.here { display: block; width: max-content; margin-top: 6px; font-size: .75rem; background: var(--primary); color: var(--primary-ink); padding: 2px 8px; border-radius: 999px; }
@media (max-width: 640px) { .timeline > li { grid-template-columns: 1fr; gap: 4px; } .tl-when { padding-top: 0; } }

/* Build page */
.email { white-space: pre-wrap; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 12px; font: .85rem/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; overflow-wrap: anywhere; }

/* Resources */
.res { display: flex; gap: 12px; align-items: flex-start; text-decoration: none; color: var(--text); }
.res:hover { border-color: var(--primary); }
.res p { margin: 2px 0 0; }
.yt { flex: 0 0 auto; width: 36px; height: 26px; border-radius: 7px; background: #d61f1f; color: #fff; display: grid; place-items: center; font-size: .8rem; }
.yt.gov { background: var(--accent); font-weight: 700; }
.link-list { display: flex; flex-wrap: wrap; gap: 10px; }
.link-list a { background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 6px 14px; text-decoration: none; font-size: .92rem; }

/* Plan checklist */
.checklist { list-style: none; padding: 0; margin: 6px 0 0; }
.checklist li { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--border); padding: 8px 0; }
.checklist label { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; font-size: 1rem; cursor: pointer; margin: 0; }
.checklist input { width: 20px; height: 20px; flex: 0 0 auto; margin-top: 3px; accent-color: var(--primary); }
.checklist input:checked + span { text-decoration: line-through; color: var(--muted); }
.link-btn { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; padding: 0 4px; }
.link-btn:hover { color: var(--reach); }

.footer { border-top: 1px solid var(--border); padding: 20px 16px 40px; font-size: .9rem; }

@media print {
  .topbar, .footer, .no-print, .add, #quizBox, .skip { display: none !important; }
  body { background: #fff; color: #000; }
  .card { box-shadow: none; break-inside: avoid; }
}

/* Opportunities */
.opp h3 a { text-decoration: none; }
.opp h3 a:hover { text-decoration: underline; }
.opp .cluster { margin: 0 0 4px; text-transform: uppercase; letter-spacing: .05em; font-size: .72rem; }
.opp .row { margin-top: 8px; }

/* Deadline highlighting */
.opp { position: relative; overflow: hidden; }
.opp.dl-open, .opp.dl-upcoming { border: 2px solid var(--accent); }
.opp.dl-soon { border: 2px solid var(--reach); }
.opp.dl-closed { opacity: .75; }
.dl-banner { margin: -18px -18px 12px; padding: 8px 18px; font-weight: 700; font-size: .9rem; color: #fff; background: var(--accent); }
.dl-banner.dl-soon { background: var(--reach); }
.dl-banner.dl-upcoming { background: color-mix(in srgb, var(--accent) 75%, #000); }
.dl-banner .cycle { white-space: nowrap; display: inline-block; font-weight: 600; font-size: .75rem; background: rgba(255,255,255,.22); border-radius: 999px; padding: 1px 8px; margin-left: 6px; }
.dl-text.dl-soon, .soon-text { color: var(--reach); font-weight: 700; }
.dl-text.dl-open { color: var(--accent); font-weight: 600; }
.verified { color: var(--likely); font-weight: 600; text-decoration: none; }
.verified:hover { text-decoration: underline; }
.highlight-bar { background: var(--callout); margin-top: 0; }
.link-btn.accent { color: var(--accent); font-weight: 700; text-decoration: underline; padding: 0; }

/* Backup */
.backup { border-left: 4px solid var(--accent); }
.backup label.btn { margin: 0; font-size: 1rem; }
.nag { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; border-left: 4px solid var(--warn); }
@media print { .backup, #backupNag { display: none !important; } }

/* Freshness notes (spec 001, US5) */
.stale-note { margin: 4px 0 8px; color: var(--muted); }
.stale-note.stale { color: var(--warn); font-weight: 600; }
