:root {
  --bg: #eef1f3;
  --surface: #ffffff;
  --surface-2: #f6f8f9;
  --ink: #17232b;
  --ink-2: #4a5a65;
  --ink-3: #7a8a95;
  --line: #d5dde2;
  --accent: #1d5c86;
  --accent-ink: #ffffff;
  --accent-soft: #dbe9f3;
  --focus: #2f7fd0;

  --ok: #2e7d4f;
  --ok-soft: #e1f2e7;
  --warn: #a8670a;
  --warn-soft: #fbefd9;
  --err: #b42f2f;
  --err-soft: #fbe3e1;
  --info: #3d6b8f;
  --info-soft: #e3edf5;

  --lvl-cp: #5d6d78;
  --lvl-honors: #1f6f6a;
  --lvl-ap: #7a3f91;

  --lane-0: rgba(29, 92, 134, 0.07);
  --lane-1: rgba(46, 125, 79, 0.07);
  --lane-2: rgba(168, 103, 10, 0.07);
  --lane-3: rgba(122, 63, 145, 0.06);
  --lane-4: rgba(31, 111, 106, 0.07);
  --lane-5: rgba(180, 47, 47, 0.05);
  --lane-6: rgba(80, 90, 160, 0.07);
  --lane-7: rgba(90, 90, 90, 0.07);
  --ink-0: #1d5c86; --ink-1: #2e6b47; --ink-2l: #8a5608; --ink-3l: #6c3a82;
  --ink-4: #1f6f6a; --ink-5: #9c3030; --ink-6: #4a55a0; --ink-7: #555f66;

  --arrow: #6f8796;
  --shadow: 0 1px 2px rgba(20, 35, 45, 0.08), 0 2px 6px rgba(20, 35, 45, 0.05);
  --radius: 8px;
  --font: "IBM Plex Sans", system-ui, sans-serif;
  --font-display: "Archivo", "IBM Plex Sans", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11171b;
    --surface: #192227;
    --surface-2: #1f2a30;
    --ink: #e2e9ed;
    --ink-2: #a9b8c1;
    --ink-3: #7c8d97;
    --line: #2d3a42;
    --accent: #6fb0e0;
    --accent-ink: #0d1a22;
    --accent-soft: #1f3646;
    --focus: #7cc0f5;
    --ok: #63c08a;
    --ok-soft: #1b3326;
    --warn: #e5a54a;
    --warn-soft: #3a2c15;
    --err: #f07a73;
    --err-soft: #3d1f1d;
    --info: #8ab6d8;
    --info-soft: #1d2d3a;
    --lvl-cp: #8d9ca6;
    --lvl-honors: #5cc0b8;
    --lvl-ap: #c58fdb;
    --lane-0: rgba(111, 176, 224, 0.07);
    --lane-1: rgba(99, 192, 138, 0.06);
    --lane-2: rgba(229, 165, 74, 0.06);
    --lane-3: rgba(197, 143, 219, 0.06);
    --lane-4: rgba(92, 192, 184, 0.06);
    --lane-5: rgba(240, 122, 115, 0.05);
    --lane-6: rgba(140, 150, 230, 0.07);
    --lane-7: rgba(200, 200, 200, 0.05);
    --ink-0: #7fb8e3; --ink-1: #74c495; --ink-2l: #e2a956; --ink-3l: #c99ade;
    --ink-4: #6cc6be; --ink-5: #ee8b85; --ink-6: #a3abf0; --ink-7: #aab4bb;
    --arrow: #7f97a6;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.45 var(--font); }
h1, h2 { font-family: var(--font-display); letter-spacing: -0.01em; margin: 0; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-2); margin-bottom: 8px; }
button, select, input { font: inherit; color: inherit; }
button, .btn {
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px;
  padding: 6px 12px; cursor: pointer; font-weight: 500;
}
button:hover { border-color: var(--ink-3); }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
select, input[type="search"] {
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; min-width: 0;
}
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.empty { color: var(--ink-3); font-style: italic; list-style: none; }
.hint { color: var(--ink-3); font-size: 12px; margin: 6px 0 0; }
cite { font-style: normal; font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); }

/* top nav */
.topnav {
  display: flex; align-items: center; gap: 4px; padding: 0 16px; height: 44px;
  background: var(--ink); color: var(--bg); position: sticky; top: 0; z-index: 20; overflow-x: auto;
}
.topnav .brand { font-family: var(--font-display); font-weight: 800; margin-right: 16px; white-space: nowrap; }
.topnav a { color: inherit; opacity: 0.75; text-decoration: none; padding: 12px 10px; white-space: nowrap; border-bottom: 3px solid transparent; }
.topnav a[aria-current="page"] { opacity: 1; border-bottom-color: var(--accent); font-weight: 600; }
.topnav a:hover { opacity: 1; }
@media (prefers-color-scheme: dark) { .topnav { background: #0a0f12; color: var(--ink); } }

/* landing + opportunities */
.landing, .opps { max-width: 760px; margin: 0 auto; padding: 48px 16px; }
.landing h1, .opps h1 { font-size: 32px; font-weight: 800; }
.lede { color: var(--ink-2); font-size: 16px; max-width: 60ch; }
.search input { width: 100%; padding: 12px 14px; font-size: 16px; margin: 12px 0 20px; }
.school-list, .opp-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.school-card {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 16px 18px;
  background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent);
  border-radius: var(--radius); color: inherit; text-decoration: none; box-shadow: var(--shadow);
}
.school-card:hover { border-color: var(--accent); }
.school-name { font-weight: 600; font-size: 16px; }
.school-city { color: var(--ink-2); }
.load-error { color: var(--err); background: var(--err-soft); padding: 10px 12px; border-radius: 6px; }
.opps .filters { display: flex; gap: 8px; margin: 16px 0; }
.opps .filters input { flex: 1; }
.opp { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.opp a { font-weight: 600; color: var(--accent); }
.opp-meta { display: block; color: var(--ink-2); font-size: 12px; }

/* planner */
.planner-head {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.planner-head h1 { font-size: 22px; font-weight: 800; }
.meta { margin: 2px 0 0; color: var(--ink-2); font-size: 13px; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; }
.planner-body {
  display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 12px; padding: 12px;
  align-items: start;
}
.catalog {
  position: sticky; top: 56px; max-height: calc(100vh - 68px); overflow: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px;
}
.path-label { display: grid; gap: 4px; font-size: 12px; color: var(--ink-2); }
.count { display: inline; text-transform: none; letter-spacing: 0; font-family: var(--font); font-weight: 500; color: var(--ink-3); margin-left: 4px; }

.bar { height: 6px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--accent); }
.done .bar span, .req-total-head.done + .bar span { background: var(--ok); }
.tick { color: var(--ok); font-weight: 700; }

/* requirements bar above the builder */
.plan-main { display: grid; gap: 10px; min-width: 0; }
.req-bar { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px; }
.req-bar-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; }
.req-label { margin: 0; font-size: 12px; color: var(--ink); white-space: nowrap; }
.req-total { flex: 1 1 200px; display: flex; align-items: center; gap: 8px; font-size: 12.5px; white-space: nowrap; }
.req-total .bar { flex: 1; min-width: 80px; height: 8px; }
.req-total-num.done strong { color: var(--ok); }
.req-details { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.req-chips { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.req-chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface-2); font-size: 11.5px; white-space: nowrap;
}
.req-chip.done { border-color: var(--ok); background: var(--ok-soft); }
.rc-name { max-width: 14ch; overflow: hidden; text-overflow: ellipsis; }
.rc-num { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-2); }
.ap-mini { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 11.5px; }
.ap-title { font-weight: 600; color: var(--ink-2); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
.ap { font-family: var(--font-mono); font-size: 11px; padding: 1px 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); white-space: nowrap; }
.ap-y { color: var(--ink-3); }
.ap.over { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }
.req-toggle { margin-left: auto; padding: 3px 10px; font-size: 12px; white-space: nowrap; }
.req-toggle .chev { display: inline-block; transition: transform 0.15s; }
.req-bar.open .req-toggle .chev { transform: rotate(180deg); }
.req-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px 18px; }

/* toolbox + slide-over drawers */
.toolbox { display: flex; flex-wrap: wrap; gap: 6px; }
.tool-btn { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; font-size: 12.5px; }
.tool-btn[aria-expanded="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.badges { display: inline-flex; gap: 3px; }
.badge { min-width: 18px; padding: 0 5px; border-radius: 9px; font-size: 10.5px; font-weight: 700; line-height: 17px; text-align: center; color: #fff; }
.badge.err { background: var(--err); }
.badge.cond { background: var(--warn); }
@media (prefers-color-scheme: dark) { .badge { color: var(--bg); } }
.tool-btn.pulse { animation: pulse 1.2s ease-out; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 var(--accent); } 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: none; } }
.drawer {
  position: fixed; top: 44px; right: 0; bottom: 0; z-index: 30; width: min(400px, 100vw); display: flex; flex-direction: column;
  background: var(--surface); border-left: 1px solid var(--line); box-shadow: -12px 0 32px rgba(10, 20, 30, 0.18);
}
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { margin: 0; }
.drawer-close { padding: 0 9px; font-size: 18px; line-height: 1.4; }
.drawer-body { flex: 1; overflow: auto; padding: 12px 14px; }
.all-grades { display: flex; justify-content: space-between; align-items: center; margin: 4px 0 6px; font-family: var(--font-display); font-weight: 700; }
@media (max-width: 640px) {
  .drawer { top: auto; left: 0; width: 100vw; max-height: 75vh; border-left: none; border-top: 1px solid var(--line); border-radius: 12px 12px 0 0; box-shadow: 0 -12px 32px rgba(10, 20, 30, 0.2); }
}
.req-head { font-size: 13px; font-weight: 500; margin-bottom: 3px; }
.req-line { display: grid; grid-template-columns: 9ch 1fr; align-items: center; gap: 6px; }
.req-line .num { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-2); white-space: nowrap; }
.req-line + .req-line { margin-top: 2px; }

/* export menu */
.menu { position: relative; }
.menu > summary { list-style: none; display: inline-block; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-list {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 40; min-width: 180px; display: grid; padding: 4px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 8px 24px rgba(10, 20, 30, 0.18);
}
.menu-list button { border: none; text-align: left; background: transparent; padding: 7px 10px; }
.menu-list button:hover, .menu-list button:focus-visible { background: var(--accent-soft); }

.issues { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.issue {
  display: flex; gap: 8px; width: 100%; text-align: left; font-weight: 400; font-size: 12.5px; line-height: 1.4;
  padding: 6px 8px; border: 1px solid transparent; border-left-width: 3px;
}
.lv-icon {
  flex: none; display: inline-grid; place-items: center; width: 17px; height: 17px; border-radius: 50%;
  font-size: 10px; font-weight: 700; color: #fff; margin-top: 1px;
}
.lv-error { background: var(--err-soft); border-left-color: var(--err); }
.lv-error .lv-icon { background: var(--err); }
.lv-warning { background: var(--warn-soft); border-left-color: var(--warn); }
.lv-warning .lv-icon { background: var(--warn); }
.lv-info { background: var(--info-soft); border-left-color: var(--info); }
.lv-info .lv-icon { background: var(--info); font-style: italic; font-family: Georgia, serif; }
@media (prefers-color-scheme: dark) { .lv-icon { color: var(--bg); } }

/* chart */
.chart-wrap {
  overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  max-height: calc(100vh - 68px);
}
.chart {
  position: relative; isolation: isolate; display: grid;
  /* columns are set inline by app.js (lane label, then per year: summer + one per term) */
}
.colhead, .corner {
  position: sticky; top: 0; z-index: 5; background: var(--surface); border-bottom: 1px solid var(--line);
  padding: 8px; font-family: var(--font-display); font-weight: 700; font-size: 13px;
}
.colhead { height: 30px; white-space: nowrap; border-left: 1px solid var(--line); }
.colhead.sub { top: 30px; height: 24px; padding: 3px 8px; font-family: var(--font-mono); font-size: 11px; font-weight: 500; color: var(--ink-2); border-left: 1px dashed var(--line); }
.colhead.su { height: 54px; overflow: hidden; padding: 8px 2px; color: var(--ink-3); font-weight: 600; font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; display: flex; justify-content: center; }
.colhead.su span { align-self: center; }
.corner { grid-row: 1 / 3; }
.corner { left: 0; z-index: 6; }
.lane-label {
  position: sticky; left: 0; z-index: 4; padding: 10px 8px; font-weight: 600; font-size: 12px;
  border-bottom: 1px solid var(--line); border-right: 1px solid var(--line);
  background: linear-gradient(var(--lane-bg), var(--lane-bg)), var(--surface);
}
.cell {
  min-height: 84px; border-bottom: 1px solid var(--line); border-right: 1px dashed var(--line);
  display: flex; flex-direction: column; gap: 6px; background: var(--lane-bg);
}
.cell.su { background: repeating-linear-gradient(135deg, var(--lane-bg) 0 6px, transparent 6px 12px); }
.lane-0 { --lane-bg: var(--lane-0); --lane-ink: var(--ink-0); } .lane-1 { --lane-bg: var(--lane-1); --lane-ink: var(--ink-1); }
.lane-2 { --lane-bg: var(--lane-2); --lane-ink: var(--ink-2l); } .lane-3 { --lane-bg: var(--lane-3); --lane-ink: var(--ink-3l); }
.lane-4 { --lane-bg: var(--lane-4); --lane-ink: var(--ink-4); } .lane-5 { --lane-bg: var(--lane-5); --lane-ink: var(--ink-5); }
.lane-6 { --lane-bg: var(--lane-6); --lane-ink: var(--ink-6); } .lane-7 { --lane-bg: var(--lane-7); --lane-ink: var(--ink-7); }
.lane-label { box-shadow: inset 4px 0 0 var(--lane-ink); padding-left: 10px; }
.chart.dragging .cell.drop-ok { outline: 2px dashed var(--ok); outline-offset: -3px; background: var(--ok-soft); }
.chart.dragging .cell.drop-ok.over { background: var(--accent-soft); outline-color: var(--accent); }
.chart.dragging .cell.drop-dim { opacity: 0.35; }

.arrows { position: absolute; left: 0; top: 0; z-index: 1; pointer-events: none; overflow: visible; }
.arrows g path { fill: none; stroke-width: 1.6; }
.arrows g path.met { stroke: var(--ok); }
.arrows g path.conditional { stroke: var(--warn); stroke-dasharray: 1.5 4; stroke-linecap: round; stroke-width: 2; }
.arrows g path.unmet { stroke: var(--err); stroke-dasharray: 6 4; }
.ah-met { fill: var(--ok); } .ah-conditional { fill: var(--warn); } .ah-unmet { fill: var(--err); }
.pills { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.pill {
  position: absolute; transform: translate(-50%, -50%); white-space: nowrap; font-size: 10px; font-weight: 600;
  padding: 0 6px; line-height: 16px; border-radius: 8px; background: var(--surface); border: 1px solid currentColor;
}
.pill.met { color: var(--ok); } .pill.conditional { color: var(--warn); border-style: dotted; } .pill.unmet { color: var(--err); }

.card {
  position: relative; z-index: 2; background: var(--ok-soft); border: 1px solid var(--ok);
  border-left: 4px solid var(--ok); border-radius: 6px; padding: 6px 7px; box-shadow: var(--shadow);
  font-size: 12.5px; cursor: grab;
}
.cell.year-end { border-right: 1px solid var(--line); }
.card { margin: 5px 4px; align-self: start; min-width: 0; max-width: 100%; overflow: hidden; }
.card.su, .card.part { font-size: 11.5px; padding: 5px 4px; }
.card.su .gl, .card.su .units, .card.part .gl { display: none; }
.card.su .ss { align-items: flex-start; }
.card.st-warning, .card.st-conditional { border-color: var(--warn); background: var(--warn-soft); }
.card.st-conditional { border-style: dotted; border-left-style: solid; }
.card.st-error { border-color: var(--err); background: var(--err-soft); }
.card-issues { list-style: none; margin: 5px 0 0; padding: 0; display: grid; gap: 2px; font-size: 11px; line-height: 1.3; font-weight: 500; }
.card-issues li { display: flex; gap: 4px; }
.ci-error { color: var(--err); } .ci-warning, .ci-conditional { color: var(--warn); }
.card.selected { outline: 2px solid var(--accent); outline-offset: 1px; }
.card.flash { animation: flash 1.6s ease-out; }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 5px var(--warn); } 100% { box-shadow: var(--shadow); } }
/* header: icon | name; the remove button is pinned top-right inside the card */
.card-top { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 5px; padding-right: 16px; }
.card .name { min-width: 0; overflow-wrap: anywhere; hyphens: auto; font-weight: 600; line-height: 1.25; }
.card .rm { position: absolute; top: 2px; right: 1px; }
.card-meta > * { max-width: 100%; }
.card-meta .prov { overflow: hidden; text-overflow: ellipsis; }
.card-issues li { min-width: 0; overflow-wrap: anywhere; }
.card .grade { grid-template-columns: minmax(0, 1fr); }
.card .grade select { min-width: 0; }
.card .ss { min-width: 0; overflow-wrap: anywhere; }
.st-icon {
  flex: none; display: inline-grid; place-items: center; width: 15px; height: 15px; border-radius: 50%;
  font-size: 9px; font-weight: 700; color: #fff; background: var(--ok); margin-top: 1px;
}
.st-warning .st-icon { background: var(--warn); }
.st-error .st-icon { background: var(--err); }
.st-conditional .st-icon { background: var(--warn); }
@media (prefers-color-scheme: dark) { .st-icon { color: var(--bg); } }
.rm { padding: 0 5px; line-height: 1.2; border: none; background: transparent; color: var(--ink-3); font-size: 15px; }
.rm:hover { color: var(--err); }
.card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 4px 0; }
.units { font-family: var(--font-mono); font-size: 11px; color: var(--ink-2); }
.term { padding: 0 6px; font-size: 10.5px; font-family: var(--font-mono); background: var(--accent-soft); border-color: var(--accent); }
.lvl {
  display: inline-block; font-size: 10px; font-weight: 600; letter-spacing: 0.03em; padding: 0 5px; border-radius: 3px;
  border: 1px solid currentColor; line-height: 15px;
}
.lvl-CP { color: var(--lvl-cp); }
.lvl-Honors { color: var(--lvl-honors); }
.lvl-AP { color: var(--lvl-ap); }
.prov { font-size: 10px; padding: 0 5px; border-radius: 3px; background: var(--info-soft); color: var(--info); border: 1px dashed var(--info); white-space: nowrap; }
.grade { display: grid; gap: 2px; font-size: 10.5px; color: var(--ink-2); }
.grade select { padding: 1px 4px; font-size: 12px; width: 100%; }
.ss { display: flex; gap: 4px; align-items: center; font-size: 11px; color: var(--ink-2); margin-top: 3px; }

/* catalog (left panel) */
.combo { position: relative; margin-bottom: 10px; }
.combo-label { display: block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-2); margin-bottom: 4px; }
.combo input { width: 100%; padding: 8px 10px; }
.combo-list {
  position: absolute; left: 0; right: 0; top: 100%; margin: 4px 0 0; padding: 4px; list-style: none; z-index: 30;
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 8px 24px rgba(10, 20, 30, 0.18);
  max-height: 320px; overflow: auto;
}
.combo-list li[role="option"] { display: grid; gap: 1px; padding: 6px 8px; border-radius: 4px; cursor: pointer; }
.combo-list li.active, .combo-list li[role="option"]:hover { background: var(--accent-soft); }
.combo-list li[aria-selected="true"] .opt-name { font-weight: 600; }
.combo-list li[aria-selected="true"] .opt-name::before { content: "✓ "; color: var(--accent); }
.opt-kind { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-3); white-space: nowrap; }
.src-head .src-name { margin: 0 0 6px; font-family: var(--font-display); font-weight: 700; font-size: 15px; }
.src-note { margin: 0 0 8px; padding: 6px 8px; font-size: 11.5px; line-height: 1.4; color: var(--warn); background: var(--warn-soft); border-left: 3px solid var(--warn); border-radius: 4px; }
.subject-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.schip { padding: 1px 8px; font-size: 11px; font-weight: 500; border-radius: 10px; }
.schip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.grade-group { border-top: 1px solid var(--line); }
.grade-group > summary {
  display: flex; justify-content: space-between; align-items: center; padding: 8px 2px; cursor: pointer;
  font-family: var(--font-display); font-weight: 700; list-style: none;
}
.grade-group > summary::-webkit-details-marker { display: none; }
.grade-group > summary span:first-child::before { content: "▸ "; color: var(--ink-3); }
.grade-group[open] > summary span:first-child::before { content: "▾ "; }
.gcount { font-family: var(--font-mono); font-size: 11px; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 0 7px; }
.tiles { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 5px; }
.subgroup { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-3); margin-top: 4px; }
.tile {
  background: var(--surface-2); border: 1px solid var(--line); border-left: 4px solid var(--lane-ink);
  border-radius: 6px; padding: 5px 6px 5px 8px; cursor: grab; font-size: 12.5px;
}
.tile:hover { border-color: var(--ink-3); border-left-color: var(--lane-ink); }
.tile-row { display: flex; align-items: center; gap: 6px; }
.tile-row + .tile-row { margin-top: 2px; }
.subj { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--lane-ink); }
.in-plan { margin-left: auto; font-size: 10px; color: var(--ink-3); }
.tile-name { flex: 1; font-weight: 600; line-height: 1.25; }
.info-btn {
  flex: none; width: 19px; height: 19px; padding: 0; border: 1.5px solid var(--accent); border-radius: 50%;
  background: transparent; color: var(--accent); font: italic 700 12px/1 Georgia, serif;
}
.info-btn[aria-expanded="true"] { color: var(--accent-ink); background: var(--accent); }
.tile .add { padding: 1px 7px; font-size: 11px; white-space: nowrap; }
.tile.used { opacity: 0.75; }
.tile-info {
  margin: 6px 0 2px; padding: 6px 8px; display: grid; grid-template-columns: auto 1fr; gap: 3px 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 4px; font-size: 11.5px; cursor: auto;
}
.tile-info dt { color: var(--ink-3); font-weight: 600; }
.tile-info dd { margin: 0; overflow-wrap: anywhere; }

.next-sub { margin: 0 0 8px; font-size: 12.5px; }
.next ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.next li { display: flex; gap: 7px; font-size: 12.5px; }
.next li.yes .lv-icon { background: var(--ok); }
.next li.cond .lv-icon { background: var(--warn); }
.next li.no .lv-icon { background: var(--err); }
.next small { color: var(--ink-2); }
.lv-conditional { background: var(--warn-soft); border-left-color: var(--warn); border-left-style: dotted; }
.lv-conditional .lv-icon { background: var(--warn); }
.chain small { color: var(--ink-2); }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50; max-width: min(520px, calc(100vw - 32px));
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25); font-size: 13px;
}
.path-result p { display: flex; gap: 7px; font-size: 12.5px; margin: 8px 0 4px; }
.path-result .ok .lv-icon { background: var(--ok); }
.path-result .bad .lv-icon { background: var(--err); }
.chain { margin: 0; padding-left: 20px; font-size: 12.5px; }
.chain .yr { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); }

dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); padding: 18px; min-width: 300px; }
dialog::backdrop { background: rgba(10, 20, 25, 0.4); }
dialog form { display: grid; gap: 12px; }
dialog h2 { text-transform: none; letter-spacing: 0; font-size: 17px; color: var(--ink); }
dialog label { display: grid; gap: 4px; font-size: 13px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }

@media (max-width: 1180px) {
  .planner-body { grid-template-columns: minmax(0, 1fr); }
  .catalog { position: static; max-height: none; }
  .catalog-groups { max-height: 60vh; overflow: auto; }
  .chart-wrap { max-height: 75vh; }
}

/* Print / PDF: only the print view, as a landscape plan table + requirements + issues */
.print-view { display: none; }
@media print {
  @page { size: landscape; margin: 10mm; }
  body { background: #fff; color: #000; font-size: 10px; }
  body > *:not(.print-view) { display: none !important; }
  .print-view { display: block; }
  .pv-head h1 { font-size: 16px; margin: 0 0 2px; }
  .pv-head p { margin: 0 0 8px; color: #444; }
  .print-view h2 { font-size: 12px; color: #000; margin: 12px 0 4px; text-transform: none; letter-spacing: 0; }
  .print-view table { width: 100%; border-collapse: collapse; }
  .print-view th, .print-view td { border: 1px solid #999; padding: 3px 4px; vertical-align: top; text-align: left; }
  .print-view thead th { background: #e8edf0; }
  .print-view tbody th { background: #f4f6f7; width: 11%; }
  .pv-plan { table-layout: fixed; }
  .pv-plan td div + div { border-top: 1px dotted #bbb; margin-top: 2px; padding-top: 2px; }
  .print-view tr { break-inside: avoid; }
  .print-view cite { color: #555; }
}

.app-version { padding: 12px 16px 20px; font-size: 11px; color: var(--muted, #6b7280); text-align: center; }
.app-version:empty { display: none; }

/* one-term cards are narrow: the name takes the full width on its own row under the status icon */
.card.part .name { grid-column: 1 / -1; }

/* ---------- Home ---------- */
.topnav a.brand { opacity: 1; font-family: var(--font-display); font-weight: 800; margin-right: 12px; border-bottom-color: transparent; }
@media (max-width: 640px) {
  .topnav { height: auto; flex-wrap: wrap; padding: 4px 12px; overflow: visible; }
  .topnav a.brand { width: 100%; padding: 8px 0 2px; }
  .topnav a { padding: 8px 8px 8px 0; margin-right: 6px; white-space: normal; }
}
.home { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.home h2 { font-size: clamp(22px, 3vw, 28px); font-weight: 800; text-transform: none; letter-spacing: -0.01em; color: var(--ink); margin: 0 0 18px; }
.home h3 { font-family: var(--font-display); font-size: 17px; font-weight: 700; margin: 0 0 6px; }
.home p { max-width: 68ch; }
.btn.big { display: inline-block; padding: 11px 18px; font-size: 15px; font-weight: 600; text-decoration: none; color: var(--ink); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
a.btn:hover { border-color: var(--ink-3); }

.hero { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 48px; align-items: center; padding: 64px 0 56px; }
.hero h1 { font-size: clamp(32px, 4.6vw, 52px); line-height: 1.06; font-weight: 800; letter-spacing: -0.025em; max-width: 16ch; }
.hero-sub { font-size: 17px; line-height: 1.55; color: var(--ink-2); margin: 20px 0 28px; }
.hero-ctas { display: flex; flex-wrap: wrap; gap: 10px; }

/* the builder in miniature: one math lane, 9th → 12th */
.mini { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 16px 12px; box-shadow: 0 10px 30px rgba(20, 35, 45, 0.08); }
.mini-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) 18px minmax(0, 1fr) 18px minmax(0, 1fr) 18px minmax(0, 1fr);
  align-items: start; padding: 0 6px 10px; border-radius: 8px;
  background: linear-gradient(var(--lane-0), var(--lane-0)) 0 44px / 100% calc(100% - 44px) no-repeat;
}
.mini-yr { grid-row: 1; font-family: var(--font-display); font-weight: 700; font-size: 13px; padding: 0 2px 6px; border-bottom: 1px solid var(--line); }
.mini-grid > span:not([class]) { grid-row: 1; border-bottom: 1px solid var(--line); }
.mini-lane { grid-row: 2; grid-column: 1 / -1; font-size: 11px; font-weight: 600; color: var(--ink-0); padding: 8px 2px 2px; }
.mini-pill-cell { grid-row: 3; grid-column: 4; position: relative; height: 22px; }
.mini-pill {
  position: absolute; left: 50%; top: 2px; transform: translateX(-50%); white-space: nowrap; z-index: 1;
  font-size: 10.5px; font-weight: 600; line-height: 16px; padding: 0 7px; border-radius: 8px;
  color: var(--warn); background: var(--surface); border: 1px dotted var(--warn);
}
.mini-card, .mini-arrow { grid-row: 4; }
.mini-card {
  min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 5px; padding: 7px 6px;
  border: 1px solid var(--ok); border-left-width: 4px; border-radius: 6px; background: var(--ok-soft); font-size: 12px; line-height: 1.25;
}
.mini-card b { overflow-wrap: anywhere; hyphens: auto; }
.mini-card small { grid-column: 1 / -1; color: var(--ink-2); font-size: 10.5px; overflow-wrap: anywhere; }
.mini-card.cond { border-color: var(--warn); border-style: dotted; border-left-style: solid; background: var(--warn-soft); }
.mini-card.cond small { color: var(--warn); font-weight: 600; }
.mini-st { display: inline-grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; font-size: 9px; font-weight: 700; color: var(--surface); background: var(--ok); margin-top: 1px; }
.mini-card.cond .mini-st { background: var(--warn); }
.mini-arrow { width: 18px; height: 12px; margin-top: 11px; overflow: visible; }
.mini-arrow .met { stroke: var(--ok); stroke-width: 1.6; fill: none; }
.mini-arrow .met-head { fill: var(--ok); }
.mini-arrow .cond { stroke: var(--warn); stroke-width: 2; stroke-dasharray: 1.5 3.5; stroke-linecap: round; fill: none; }
.mini-arrow .cond-head { fill: var(--warn); }
.mini figcaption { font-size: 12.5px; color: var(--ink-2); margin-top: 10px; }

.home-sec { padding: 48px 0; border-top: 1px solid var(--line); }
.why-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; }
.why-list li { border-left: 3px solid var(--accent); padding-left: 16px; }
.why-list p, .steps p { margin: 0; color: var(--ink-2); line-height: 1.55; }
.steps { list-style: none; counter-reset: step; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 40px minmax(0, 1fr); grid-template-rows: auto 1fr; align-items: start; column-gap: 12px; }
.steps li::before {
  content: counter(step); grid-row: 1 / 3; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 800; color: var(--accent); border: 2px solid var(--accent);
}

.price-note { color: var(--ink-2); line-height: 1.55; margin: -6px 0 22px; }
.tiers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; align-items: stretch; }
.tier { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 22px; }
.tier.featured { border: 2px solid var(--accent); box-shadow: 0 12px 32px rgba(29, 92, 134, 0.14); }
.tier h3 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 19px; }
.tag { font-family: var(--font); font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 10px; color: var(--accent-ink); background: var(--accent); }
.price { margin: 6px 0 0; color: var(--ink-2); }
.price .amt { font-family: var(--font-display); font-size: 34px; font-weight: 800; color: var(--ink); letter-spacing: -0.02em; margin-right: 4px; }
.tier-for { margin: 2px 0 14px; color: var(--ink-2); font-size: 13.5px; min-height: 1.5em; }
.tier ul { list-style: none; margin: 0 0 20px; padding: 14px 0 0; border-top: 1px solid var(--line); display: grid; gap: 8px; flex: 1; align-content: start; font-size: 14px; line-height: 1.4; }
.tier li { position: relative; padding-left: 20px; }
.tier li::before { content: "✓"; position: absolute; left: 0; color: var(--ok); font-weight: 700; }
.soon { font-size: 11px; font-weight: 600; color: var(--ink-3); border: 1px solid var(--line); border-radius: 8px; padding: 0 6px; white-space: nowrap; }
.tier-cta { display: block; text-align: center; padding: 10px 14px; font-weight: 600; text-decoration: none; color: var(--ink); }
.tier-cta.primary { color: var(--accent-ink); }
.founding { margin: 16px 0 0; color: var(--ink-2); font-size: 14px; }

.schools-sec .home-schools { font-size: 17px; margin: 0 0 6px; }
.home-schools a { color: var(--accent); font-weight: 600; }
.schools-sec p { color: var(--ink-2); }

.home-foot { border-top: 1px solid var(--line); padding: 28px 0 40px; font-size: 13px; color: var(--ink-2); }
.home-foot p { margin: 0 0 8px; line-height: 1.5; }
.foot-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--ink-3); }
.foot-meta a, .app-foot a { color: var(--ink-2); }
.app-foot { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 16px; padding: 12px 16px 20px; font-size: 11px; color: var(--ink-3); }
.app-foot .app-version { padding: 0; }
body[data-view="home"] .app-foot { display: none; }

/* contact dialog (contact.js) */
.contact-dialog { width: min(460px, calc(100vw - 24px)); padding: 0; }
.contact-form { padding: 20px; gap: 12px; }
.contact-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.contact-close { padding: 0 9px; font-size: 18px; line-height: 1.4; }
.contact-intro { margin: 0; color: var(--ink-2); font-size: 14px; }
.contact-form input, .contact-form textarea { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); width: 100%; }
.contact-actions { display: flex; justify-content: flex-end; }
.contact-result { margin: 0; padding: 8px 10px; border-radius: 6px; background: var(--accent-soft); font-size: 13.5px; }
.contact-addr { margin: 0; font-size: 13px; color: var(--ink-2); display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.contact-addr .addr { user-select: all; font-family: var(--font-mono); background: var(--surface-2); padding: 2px 6px; border-radius: 4px; color: var(--ink); }
.contact-addr .btn { padding: 2px 8px; font-size: 12px; }

@media (max-width: 900px) {
  .hero { grid-template-columns: minmax(0, 1fr); gap: 32px; padding: 40px 0; }
  .why-list, .steps, .tiers { grid-template-columns: minmax(0, 1fr); }
  .tier.featured { order: -1; }
}
@media (max-width: 420px) {
  .home { padding: 0 14px; }
  .mini { padding: 12px 10px 10px; }
  .mini-grid { grid-template-columns: minmax(0, 1fr) 12px minmax(0, 1fr) 12px minmax(0, 1fr) 12px minmax(0, 1fr); padding: 0 2px 8px; }
  .mini-arrow { width: 12px; }
  .mini-card { font-size: 10.5px; padding: 5px 4px; }
  .mini-card b { grid-column: 1 / -1; overflow-wrap: break-word; }
  .mini-card small { font-size: 9.5px; }
  .hero-ctas .btn { flex: 1 1 100%; text-align: center; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
