:root {
  --navy: #142a52;
  --navy-2: #1e3a6e;
  --gold: #e3b448;
  --gold-soft: #fbf3dc;
  --bg: #f5f6f9;
  --surface: #ffffff;
  --surface-2: #f0f2f6;
  --border: #dfe3ea;
  --border-strong: #c6ccd7;
  --text: #17202f;
  --muted: #5d6879;
  --faint: #626d7e;
  --accent: #1f5bd8;
  --accent-soft: #e8effc;
  --ok: #18794e;
  --ok-soft: #e3f4ea;
  --warn: #9a5b00;
  --warn-soft: #fdf1dc;
  --danger: #c0352b;
  --danger-soft: #fbe8e6;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .18);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
/* Keep a focused field clear of the sticky top bar and the sticky Save / Submit bar. */
html { scroll-padding-top: 120px; scroll-padding-bottom: 110px; }
body { font: 15px/1.5 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; letter-spacing: -.01em; text-wrap: balance; }
h1 { font-size: 26px; }
h2 { font-size: 20px; }
h1.h2 { font-size: 20px; } /* the page's main heading, at section size */
h3 { font-size: 16px; }
p { margin: 0 0 .75em; }
small, .small { font-size: 13px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.boot { padding: 80px; text-align: center; color: var(--muted); }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- top bar ---------- */
.topbar { background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 20; }
.demo-banner { background: var(--gold); color: var(--navy); font-weight: 600; font-size: 13px; text-align: center; padding: 4px 16px; }
.topbar-inner { max-width: 1240px; margin: 0 auto; padding: 0 20px; display: flex; align-items: center; gap: 20px; height: 58px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-mark { background: var(--gold); color: var(--navy); font-weight: 800; font-size: 12px; border-radius: 6px; padding: 4px 6px; letter-spacing: .02em; }
.brand-name { font-weight: 600; }
.nav { display: flex; gap: 2px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.nav a { color: #cdd6e8; padding: 7px 11px; border-radius: 7px; font-size: 14px; white-space: nowrap; }
.nav a:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.nav a.active { background: rgba(255,255,255,.14); color: #fff; }
.userbox { display: flex; align-items: center; gap: 10px; margin-left: auto; white-space: nowrap; }
.role-pill { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; background: rgba(227,180,72,.18); color: var(--gold); padding: 2px 8px; border-radius: 99px; font-weight: 700; }
.userbox .btn { background: transparent; border-color: rgba(255,255,255,.25); color: #fff; }
.userbox .btn:hover { background: rgba(255,255,255,.1); }
.menu-toggle { display: none; }
/* The admin menu has too many items for one row: brand and account on top, menu below. */
/* The administrator's menu fits on the same line on a wide screen and moves to its own line otherwise. */
@media (max-width: 1180px) {
  .topbar-admin .topbar-inner { flex-wrap: wrap; height: auto; padding: 8px 20px 6px; row-gap: 4px; }
  .topbar-admin .nav { order: 3; flex-basis: 100%; margin-left: -11px; }
}

/* ---------- layout ---------- */
.page { max-width: 1240px; margin: 0 auto; padding: 28px 20px 80px; }
.page.narrow { max-width: 820px; }
.subnav { max-width: 1200px; margin: 18px auto -10px; display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.subnav a { font-size: 14px; font-weight: 600; padding: 9px 14px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.subnav a:hover { color: var(--navy); text-decoration: none; }
.subnav a.on { color: var(--navy); border-bottom-color: var(--gold); }
.subnav.narrow { max-width: 780px; }
@media (max-width: 1240px) { .subnav:not(.narrow) { margin-left: 20px; margin-right: 20px; } }
@media (max-width: 820px) { .subnav.narrow { margin-left: 20px; margin-right: 20px; } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 16px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.spacer { flex: 1; }

/* ---------- card ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 20px; }
.card-head { padding: 14px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-head h1, .card-head h2, .card-head h3 { margin: 0; }
.card-body { padding: 20px; }
.card + .card { margin-top: 16px; }
.grid > .card + .card, .board > .card + .card, .timeline > .card + .card { margin-top: 0; }
.grid > .stack + .stack { margin-top: 0; }
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; margin: 0 0 10px; }

.stat { padding: 16px 18px; }
.stat .label { color: var(--muted); font-size: 13px; }
.stat .value { font-size: 28px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .sub { font-size: 12px; color: var(--faint); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-size: 14px; font-weight: 600; padding: 8px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); cursor: pointer; white-space: nowrap; line-height: 1.2; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:focus-visible, button:focus-visible, summary:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* On the navy bar and the navy banner a blue ring disappears: use white there. */
.topbar a:focus-visible, .topbar button:focus-visible, .hero a:focus-visible { outline-color: #fff; }
.btn, .nav a, .subnav a, .tabs button, .toc-item, .chip-toggle, .menu-panel button { transition: background-color .12s ease, border-color .12s ease, color .12s ease; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.primary:hover { background: var(--navy-2); }
.btn.gold { background: var(--gold); border-color: var(--gold); color: var(--navy); }
.btn.gold:hover { filter: brightness(.96); }
.btn.danger { color: var(--danger); border-color: #e9b6b1; }
.btn.danger:hover { background: var(--danger-soft); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn.xs { padding: 2px 7px; font-size: 12px; border-radius: 5px; min-height: 24px; min-width: 24px; }
.btn.lg { padding: 12px 20px; font-size: 16px; }
.icon-btn { width: 30px; height: 30px; padding: 0; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label, .label { font-size: 13px; font-weight: 600; color: #344054; }
.field .hint { font-size: 12px; color: var(--muted); }
.req::after { content: " *"; color: var(--danger); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], input[type=datetime-local], input[type=search], select, textarea {
  font: inherit; font-size: 14px; color: var(--text); background: #fff; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 8px 10px; width: 100%; min-width: 0;
}
textarea { resize: vertical; min-height: 90px; line-height: 1.45; }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--muted); }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--navy); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-section { padding: 22px; border-bottom: 1px solid var(--border); }
.form-section:last-child { border-bottom: 0; }
.form-section > h3 { margin-bottom: 4px; }
.form-section > .muted { margin-bottom: 16px; font-size: 14px; }
.form-actions { padding: 16px 22px; display: flex; gap: 10px; justify-content: flex-end; align-items: center; background: var(--surface-2); border-top: 1px solid var(--border); border-radius: 0 0 var(--radius) var(--radius); flex-wrap: wrap; }
.form-actions.sticky { position: sticky; bottom: 0; z-index: 5; box-shadow: 0 -4px 12px rgba(16, 24, 40, .06); }
.verify-box { margin-top: 8px; }
.verify-box .verified { color: var(--ok); font-weight: 600; }
.warn-text { color: var(--warn); }
.verified-tag { color: var(--ok); font-size: 12px; font-weight: 600; }
.code-input { width: 130px !important; letter-spacing: 3px; font-variant-numeric: tabular-nums; }
.save-state { font-size: 13px; color: var(--faint); min-width: 0; }
.save-state.busy { color: var(--muted); }
.save-state.ok { color: var(--ok); }
.save-state.ok::before { content: '✓ '; }
.save-state.warn { color: var(--warn); }
.save-state.error { color: var(--danger); }
/* The save state and the "Sections" button: part of the row on wide screens, a row of their own on phones. */
.bar-status { display: contents; }
.sections-btn { display: none; }
@media (max-width: 980px) { .sections-btn { display: inline-flex; } }
@media (max-width: 760px) {
  .form-actions.sticky { padding: 10px 14px; }
  .form-actions.sticky .bar-status { display: flex; align-items: center; gap: 10px; flex-basis: 100%; }
  .form-actions.sticky .bar-status .save-state { flex: 1; }
}

/* ---------- section list on the student form ---------- */
.side-sticky { position: sticky; top: 78px; max-height: calc(100vh - 98px); overflow-y: auto; }
.toc { display: grid; gap: 2px; margin: 0 -8px; }
.toc-item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px; border: 0; border-left: 3px solid transparent; border-radius: 6px; background: none; font: inherit; font-size: 14px; color: var(--text); text-align: left; cursor: pointer; }
.toc-item:hover { background: var(--surface-2); }
.toc-item.current { border-left-color: var(--navy); background: var(--accent-soft); font-weight: 600; }
.toc-title { flex: 1; min-width: 0; }
.hero-propose { margin: 10px 0 0; font-size: 14px; color: #b9c4da; }
.hero-propose a { color: #fff; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.proposal-item { padding: 14px 20px; border-top: 1px solid var(--border); }
.proposal-item:first-child { border-top: 0; }
.propose-band { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; padding: 22px 24px; border-left: 4px solid var(--gold, #c9a227); }
.propose-band h3 { margin: 0 0 4px; font-size: 19px; }
.propose-band p { margin: 0; max-width: 760px; }
.modal .toc { margin: 0 -6px; }
.modal .toc-item { padding: 11px 10px; font-size: 15px; }
.toc-count { flex: none; padding: 1px 7px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); font-size: 12px; font-weight: 600; white-space: nowrap; }
.form-section > h3:focus { outline: none; }
@media (max-width: 980px) {
  .side-sticky { position: static; max-height: none; overflow: visible; }
  .toc-card { display: none; }
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-toggle { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border-strong); border-radius: 99px; padding: 5px 12px; font-size: 13px; cursor: pointer; background: #fff; user-select: none; }
.chip-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.chip-toggle.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.chip-toggle:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
button.chip-toggle { font: inherit; font-size: 13px; color: var(--text); text-align: left; }
button.chip-toggle.on { color: #fff; }
.chip-toggle.now { background: var(--accent-soft); border-color: var(--accent); color: var(--navy); }
.course-state { font-size: 11px; font-weight: 700; }
.course-state:empty { display: none; }
.course-state.now { background: var(--accent); color: #fff; border-radius: 99px; padding: 1px 6px; }

.tag-input { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: #fff; }
.tag-input input { border: 0 !important; flex: 1; min-width: 160px; padding: 4px 6px !important; outline: none; }
/* The text box inside has no ring of its own: the whole tag box shows it. */
.tag-input:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.tag-input input { min-height: 24px; }
.userbox > a { display: inline-flex; align-items: center; min-height: 24px; }
.tag { display: inline-flex; align-items: center; gap: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 2px 4px 2px 8px; font-size: 13px; }
.tag button { border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 15px; line-height: 1; padding: 0 4px; min-width: 24px; min-height: 24px; border-radius: 5px; }
.tag button:hover { color: var(--danger); }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--muted); white-space: nowrap; border: 1px solid transparent; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.plain::before { display: none; }
.b-draft { background: #eef0f4; color: #5d6879; }
.b-submitted { background: var(--accent-soft); color: var(--accent); }
.b-interview { background: #efe7fb; color: #6b3fbf; }
.b-accepted { background: var(--ok-soft); color: var(--ok); }
.b-enrolled { background: #d7f0e2; color: #0d5a37; border-color: #a9dbbf; }
.b-waitlisted { background: var(--warn-soft); color: var(--warn); }
.b-rejected { background: var(--danger-soft); color: var(--danger); }
.b-withdrawn { background: #eef0f4; color: var(--faint); border: 1px dashed var(--border-strong); }
.b-under_review { background: var(--accent-soft); color: var(--accent); }
.b-published { background: var(--ok-soft); color: var(--ok); }
.cat { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--navy-2); }
.rec-strong { color: var(--ok); font-weight: 700; }
.rec-yes { color: var(--ok); }
.rec-maybe { color: var(--warn); }
.rec-no { color: var(--danger); font-weight: 600; }

/* ---------- alerts ---------- */
.alert { padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid; font-size: 14px; }
.alert ul { margin: 6px 0 0; padding-left: 20px; }
.alert.info { background: var(--accent-soft); border-color: #c4d5f8; color: #173d8f; }
.alert.ok { background: var(--ok-soft); border-color: #b3dfc6; color: #0f5636; }
.alert.warn { background: var(--warn-soft); border-color: #f0d6a6; color: #6e4100; }
.alert.danger { background: var(--danger-soft); border-color: #f1c0bb; color: #8f241c; }
.alert strong { display: block; margin-bottom: 2px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
/* A sortable heading is a button, so the keyboard reaches it; the arrow shows the current order. */
.th-sort { font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit; background: none; border: 0; padding: 4px 0; margin: -4px 0; cursor: pointer; border-radius: 4px; }
.th-sort:hover { color: var(--text); }
.th-sort::after { content: ' ↕'; opacity: .45; }
th[aria-sort=ascending] .th-sort, th[aria-sort=descending] .th-sort { color: var(--text); }
th[aria-sort=ascending] .th-sort::after { content: ' ▲'; opacity: 1; font-size: 9px; }
th[aria-sort=descending] .th-sort::after { content: ' ▼'; opacity: 1; font-size: 9px; }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: #fafbfd; }
.table tr.selected td { background: #f4f8ff; }
.table td.right, .table th.right { text-align: right; }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.toolbar input[type=search] { max-width: 260px; }
.toolbar select { width: auto; }
.bulkbar { display: flex; gap: 10px; align-items: center; padding: 10px 16px; background: var(--gold-soft); border-bottom: 1px solid #f0dfb0; font-size: 14px; flex-wrap: wrap; }
.bulkbar select { width: auto; }

/* ---------- projects ---------- */
.project-card { display: flex; flex-direction: column; padding: 18px 20px; gap: 8px; }
.project-card h3 { margin: 2px 0 0; font-size: 17px; }
.project-card .client { color: var(--muted); font-size: 14px; }
.project-card .meta { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-top: auto; padding-top: 10px; border-top: 1px dashed var(--border); }
.kv { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 8px 14px; font-size: 14px; }
.kv > dt { color: var(--muted); }
.kv > dd { margin: 0; overflow-wrap: anywhere; }
.prose { font-size: 14.5px; }
.prose h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 16px 0 4px; }

.rank-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.rank-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; }
.rank-num { width: 28px; height: 28px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.rank-item .grow { flex: 1; min-width: 0; }
.rank-item .title { font-weight: 600; }
.pick-list { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.pick-item { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 8px 12px; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); }

/* ---------- landing ---------- */
.hero { background: linear-gradient(135deg, var(--navy) 0%, #213f78 100%); color: #fff; }
.hero-inner { max-width: 1240px; margin: 0 auto; padding: 64px 20px 56px; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 40px; align-items: center; }
.hero .kicker { color: var(--gold); font-weight: 700; letter-spacing: .1em; font-size: 12px; text-transform: uppercase; }
.hero h1 { font-size: 44px; margin: 10px 0 14px; letter-spacing: -.02em; }
.hero p.lead { font-size: 18px; color: #d5ddee; max-width: 560px; }
.hero .facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.fact { background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12); border-radius: var(--radius); padding: 18px; }
.fact .big { font-size: 30px; font-weight: 800; color: var(--gold); }
.fact .lbl { font-size: 13px; color: #cdd6e8; }
.landing-section { max-width: 1240px; margin: 0 auto; padding: 44px 20px 0; }
.landing-section > h2 { font-size: 24px; }
.kind { padding: 18px; }
.kind .n { font-size: 12px; font-weight: 700; color: var(--gold); background: var(--navy); width: 26px; height: 26px; border-radius: 6px; display: grid; place-items: center; margin-bottom: 10px; }
.timeline { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.timeline .when { font-size: 12px; font-weight: 700; letter-spacing: .08em; color: var(--muted); text-transform: uppercase; }
.footer-links { display: inline-flex; gap: 16px; }
.footer-links a { color: var(--muted); display: inline-block; padding: 4px 2px; }
.privacy-section h2 { font-size: 17px; margin: 0 0 8px; }
.privacy-section p:last-child, .privacy-section ul:last-child { margin-bottom: 0; }
.footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px;
  max-width: 1240px; margin: 56px auto 0; padding: 24px 20px 40px; color: var(--muted); font-size: 13px; border-top: 1px solid var(--border); }

/* ---------- auth ---------- */
.auth-wrap { min-height: calc(100vh - 58px); min-height: calc(100dvh - 58px); display: grid; place-items: center; padding: 40px 16px; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card .card-body { display: flex; flex-direction: column; gap: 14px; }

/* ---------- modal / drawer ---------- */
.overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow-y: auto; animation: fade .12s ease-out; }
/* The window is never taller than the screen: its body scrolls, so the title and the buttons stay in view. */
.modal { background: #fff; border-radius: 12px; box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; display: flex; flex-direction: column; max-height: calc(100vh - 12vh); max-height: calc(100dvh - 12vh); }
.modal.wide { max-width: 860px; }
.modal-head { flex: none; padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-body { padding: 20px; overflow-y: auto; min-height: 0; overscroll-behavior: contain; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; align-items: center; flex-wrap: wrap; gap: 10px; flex: none; background: var(--surface-2); border-radius: 0 0 12px 12px; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- toasts ---------- */
/* The message area never takes taps itself, only the messages in it do. */
#toasts { pointer-events: none; }
#toasts > * { pointer-events: auto; }
#toasts { position: fixed; bottom: 20px; right: 20px; z-index: 60; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 40px)); }
.toast { background: #1d2939; color: #fff; padding: 11px 14px; border-radius: 8px; box-shadow: var(--shadow-lg); font-size: 14px; animation: fade .15s; }
.toast.error { background: #a12a21; display: flex; align-items: flex-start; gap: 10px; }
.toast.error > span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.toast-close { flex: none; background: none; border: 0; color: #fff; font-size: 14px; line-height: 1; cursor: pointer; min-width: 24px; min-height: 24px; margin: -3px -6px -3px 0; border-radius: 5px; }
.toast-close:hover { background: rgba(255,255,255,.16); }
.toast button:focus-visible { outline-color: #fff; }
.toast.ok { background: #116441; }

/* ---------- misc ---------- */
.bar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; min-width: 80px; }
.bar > span { display: block; height: 100%; background: var(--navy-2); border-radius: 99px; }
.bar.over > span { background: var(--warn); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tabs button { font: inherit; font-size: 14px; font-weight: 600; background: none; border: 0; padding: 10px 14px; color: var(--muted); border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; }
.tabs button.on { color: var(--navy); border-bottom-color: var(--gold); }
.steps { display: flex; gap: 0; counter-reset: s; margin: 0; padding: 0; list-style: none; }
.steps li { flex: 1; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--faint); position: relative; padding-right: 10px; }
.steps li::before { counter-increment: s; content: counter(s); width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--border-strong); display: grid; place-items: center; font-weight: 700; font-size: 12px; flex: none; background: #fff; }
.steps li.done { color: var(--ok); }
.steps li.done::before { content: "✓"; background: var(--ok); border-color: var(--ok); color: #fff; }
.steps li.now { color: var(--text); font-weight: 600; }
.steps li.now::before { border-color: var(--navy); color: var(--navy); }
.history { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.history li { padding: 8px 0; border-bottom: 1px solid var(--border); display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; }
.history li:last-child { border-bottom: 0; }
.pwbox { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 18px; background: var(--surface-2); border: 1px dashed var(--border-strong); padding: 12px; border-radius: 8px; text-align: center; letter-spacing: .05em; user-select: all; }
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.team { padding: 14px; }
.team h4 { margin: 0; font-size: 15px; }
.team ul { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-direction: column; gap: 6px; }
.team li { display: flex; justify-content: space-between; gap: 8px; align-items: center; font-size: 13px; padding: 6px 8px; background: var(--surface-2); border-radius: 6px; }
.team li { flex-wrap: wrap; }
.team li select { flex: 1 1 100%; padding: 3px 6px; font-size: 12px; }
.team.under { border-color: #f0d6a6; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .cols, .hero-inner { grid-template-columns: minmax(0, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  /* On a phone the top bar takes two to four lines, so it scrolls away with the page instead of staying on screen. */
  .topbar { position: relative; }
  html { scroll-padding-top: 16px; }
  .help-section { scroll-margin-top: 12px; }
  .topbar-inner { flex-wrap: wrap; height: auto; padding: 8px 16px 6px; gap: 4px 10px; }
  /* The menu scrolls sideways on a phone: fade its right edge so that is visible. */
  .nav { order: 3; flex-basis: 100%; padding-right: 28px; -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 30px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 30px), transparent); }
  .brand-name { font-size: 14px; }
  .page { padding: 20px 16px 60px; }
  .subnav, .subnav.narrow, .subnav:not(.narrow) { margin: 12px 16px -8px; }
  .grid-2, .grid-3, .grid-4, .form-grid, .timeline, .hero .facts { grid-template-columns: minmax(0, 1fr); }
  .grid-4:has(> .stat) { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .hero h1 { font-size: 32px; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv > dd { margin-bottom: 8px; }
  .steps { flex-direction: column; align-items: flex-start; gap: 8px; }
}

/* ---------- questionnaire ---------- */
.skill-grid { width: 100%; border-collapse: collapse; font-size: 14px; }
.skill-grid th { font-size: 12px; font-weight: 600; color: var(--muted); text-align: center; padding: 6px 4px; vertical-align: bottom; }
.skill-grid th:first-child { text-align: left; }
.skill-grid td { padding: 7px 4px; border-top: 1px solid var(--border); text-align: center; }
.skill-grid td:first-child { text-align: left; }
.skill-grid input { accent-color: var(--navy); width: 16px; height: 16px; }
.skill-grid tr:hover td { background: #fafbfd; }
.sg-choice { display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; min-width: 32px; min-height: 26px; }
.sg-lbl { display: none; font-size: 13px; }
@media (max-width: 760px) { .sg-lbl { display: inline; } }
.subfields { margin-top: 12px; padding: 14px; background: var(--surface-2); border-radius: var(--radius-sm); border: 1px solid var(--border); }
.subfields[hidden] { display: none; }
.rank-item { flex-wrap: wrap; }
.rank-item .reason { flex-basis: 100%; margin-left: 40px; }
.rank-item .reason textarea { min-height: 54px; font-size: 13px; }
.answer-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.answer-list .q { font-size: 13px; font-weight: 600; color: #344054; }
@media (max-width: 760px) {
  /* Phones: each skill becomes a small card with its choices spelled out, instead of cut-off column headings. */
  .skill-grid thead { display: none; }
  .skill-grid, .skill-grid tbody { display: block; }
  .skill-grid tr { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; padding: 10px 0; border-top: 1px solid var(--border); }
  .skill-grid tr:hover td { background: none; }
  .skill-grid td { border: 0; padding: 2px 0; text-align: left; }
  .skill-grid td:first-child { grid-column: 1 / -1; font-weight: 600; padding-bottom: 4px; }
  .rank-item .reason { margin-left: 0; }
}

.google-btn { width: 100%; background: #fff; border-color: var(--border-strong); color: #1f1f1f; gap: 10px; }
.google-btn:hover { background: #f8f9fb; text-decoration: none; }
.google-btn .g-logo { display: inline-block; width: 20px; height: 20px; flex: none; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Cpath fill='%23EA4335' d='M24 9.5c3.54 0 6.71 1.22 9.21 3.6l6.85-6.85C35.9 2.38 30.47 0 24 0 14.62 0 6.51 5.38 2.56 13.22l7.98 6.19C12.43 13.72 17.74 9.5 24 9.5z'/%3E%3Cpath fill='%234285F4' d='M46.98 24.55c0-1.57-.15-3.09-.38-4.55H24v9.02h12.94c-.58 2.96-2.26 5.48-4.78 7.18l7.73 6c4.51-4.18 7.09-10.36 7.09-17.65z'/%3E%3Cpath fill='%23FBBC05' d='M10.53 28.59c-.48-1.45-.76-2.99-.76-4.59s.27-3.14.76-4.59l-7.98-6.19C.92 16.46 0 20.12 0 24c0 3.88.92 7.54 2.56 10.78l7.97-6.19z'/%3E%3Cpath fill='%2334A853' d='M24 48c6.48 0 11.93-2.13 15.89-5.81l-7.73-6c-2.15 1.45-4.92 2.3-8.16 2.3-6.26 0-11.57-4.22-13.47-9.91l-7.98 6.19C6.51 42.62 14.62 48 24 48z'/%3E%3C/svg%3E") center / contain no-repeat; }

.experience-entry { padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.experience-entry .form-grid { margin-top: 10px; }
.experience-entry input, .experience-entry select, .experience-entry textarea { background: #fff; }

/* ---------- help ---------- */
.help-link { display: inline-flex; align-items: center; gap: 6px; color: #cdd6e8; font-size: 14px; padding: 6px 8px; border-radius: 7px; }
.help-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.help-q { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid currentColor; display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.help-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 20px; align-items: start; }
.help-toc { position: sticky; top: 78px; display: flex; flex-direction: column; gap: 2px; }
.help-toc a { padding: 6px 8px; border-radius: 6px; font-size: 14px; color: var(--text); }
.help-toc a:hover { background: var(--surface-2); text-decoration: none; }
.help-body { display: flex; flex-direction: column; gap: 16px; }
.help-body > .card + .card { margin-top: 0; }
.help-section { scroll-margin-top: 78px; }
.help-section h2 { font-size: 19px; }
.help-section ul, .help-section ol { padding-left: 20px; margin: 0 0 .75em; }
.help-section li { margin-bottom: 4px; }
.help-section .kv { margin-top: 4px; }
.guide-card { border-left: 4px solid var(--gold); }
.guide-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.guide-step { background: var(--surface-2); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 14px; }
.guide-step .n { font-size: 12px; font-weight: 700; color: var(--navy-2); text-transform: uppercase; letter-spacing: .06em; }
.checklist { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-direction: column; gap: 6px; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface-2); font-size: 14px; }
.checklist li.done { color: var(--muted); }
.checklist li.done .ck-title { text-decoration: line-through; }
.checklist .ck { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border-strong); flex: none; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: #fff; }
.checklist li.done .ck { background: var(--ok); border-color: var(--ok); color: #fff; }
.checklist li.skipped .ck { background: #fff; border-color: var(--border-strong); color: var(--muted); }
.checklist .ck-body { flex: 1; min-width: 0; }
.progress { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.progress > span { display: block; height: 100%; background: var(--ok); }
@media (max-width: 980px) {
  .help-layout { grid-template-columns: 1fr; }
  .help-toc { position: static; }
  .guide-steps { grid-template-columns: 1fr; }
}
@media (max-width: 760px) { .help-link span:last-child { display: none; } }
.page > .guide-card { margin-bottom: 20px; }

/* Application form settings (admin) */
.fq-list { margin-top: 16px; }
.fq-head { display: grid; grid-template-columns: 1fr 140px; gap: 12px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; padding-bottom: 6px; }
.fq-row { display: grid; grid-template-columns: 1fr 140px; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); align-items: start; }
.fq-q { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.fq-q textarea { min-height: 0; }
.fq-fixed { font-weight: 600; font-size: 14px; padding: 6px 0 2px; }
.fq-help { font-size: 13px !important; padding-top: 5px !important; padding-bottom: 5px !important; color: var(--muted); }
.fq-note { font-size: 12px; color: var(--muted); }
.fq-changed { color: var(--accent); }
.fq-mode select { width: 100%; }
.fq-mode .tag { margin-top: 8px; display: inline-block; }
@media (max-width: 760px) { .fq-row, .fq-head { grid-template-columns: 1fr 112px; gap: 8px; } }

/* ---------- paired dropdowns (season + year, month + year) ---------- */
.pick-pair { display: flex; gap: 6px; }
.pick-pair select { flex: 1 1 0; min-width: 0; }
.pick-pair select[hidden] { display: none; }
.experience-entry .row > .field { flex: 1 1 200px; min-width: 0; }

/* ---------- missing answers on the student form ---------- */
.issue-list a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
[data-q].missing { outline: 2px solid color-mix(in srgb, var(--warn) 55%, transparent); outline-offset: 4px; border-radius: 6px; }
[data-q].flash { animation: q-flash 1.4s ease-out; }
/* Skills table: once the student has tried to submit, the skills still without a level stand out. */
.skill-box.missing .skill-grid tbody tr:not(:has(input:checked)) td:first-child { color: var(--warn); font-weight: 600; }
@keyframes q-flash { 0% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--warn) 35%, transparent); } 100% { box-shadow: 0 0 0 0 transparent; } }

/* ---------- student result view ---------- */
.steps li.skip { color: var(--faint); }
.steps li.skip::before { content: "–"; border-style: dashed; }
.assigned-card { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; background: #fff; }
.toast.undo { display: flex; align-items: center; gap: 14px; }
.toast-undo { background: none; border: 0; color: #9ec5ff; font-weight: 700; cursor: pointer; padding: 0; font-size: 14px; }
.toast-undo:hover { text-decoration: underline; }

/* Review rounds: accept / decline */
.decide { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.btn.accept.on { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.decline.on { background: var(--danger); border-color: var(--danger); color: #fff; }
tr.dim td { color: var(--muted); }
ol.wrapup { margin: 0; padding-left: 22px; display: grid; gap: 12px; }
ol.wrapup li.done strong { color: var(--ok); }

/* Ranking on a phone: the buttons get their own row and a comfortable size. */
.rank-ctrl { display: flex; gap: 6px; align-items: center; flex: none; }
.contact-row { display: flex; gap: 8px; align-items: center; flex-wrap: nowrap; }
/* Phones: the administrator's six-item menu and the tab rows wrap onto a second line instead of hiding items off the right edge. */
@media (max-width: 640px) {
  .topbar-admin .nav, .tabs, .subnav { flex-wrap: wrap; overflow: visible; }
  .contact-row { flex-wrap: wrap; }
  .contact-row > :first-child { flex-basis: 100%; }
  .contact-row input[type=email] { flex: 1; min-width: 0; }
}
@media (max-width: 640px) {
  .rank-item .grow { flex-basis: calc(100% - 44px); }
  .rank-ctrl { flex-basis: 100%; justify-content: flex-end; }
  .rank-ctrl .btn.xs { min-width: 44px; min-height: 44px; font-size: 15px; }
  .pick-item .btn.xs { min-height: 44px; padding: 6px 12px; font-size: 14px; }
  .pick-item { flex-wrap: wrap; }
  .decide { gap: 10px; }
  .decide .btn { min-height: 44px; padding: 7px 14px; font-size: 14px; }
  .overlay { padding: 3vh 10px; }
  .modal { max-height: calc(100vh - 6vh); max-height: calc(100dvh - 6vh); }
  .modal-body { padding: 16px; }
  /* Toasts at the top on phones, clear of the sticky Save / Submit bar. */
  #toasts { top: 12px; bottom: auto; left: 12px; right: 12px; max-width: none; }
  /* Tables marked cards-on-phone become one card per row, each value labelled. */
  table.cards-on-phone thead { display: none; }
  table.cards-on-phone, table.cards-on-phone tbody, table.cards-on-phone tr { display: block; width: 100%; }
  table.cards-on-phone tr { border-bottom: 1px solid var(--border); padding: 10px 14px; }
  table.cards-on-phone td { display: flex; gap: 10px; justify-content: space-between; align-items: baseline; border: 0; padding: 3px 0; text-align: right; }
  table.cards-on-phone td > * { text-align: right; }
  table.cards-on-phone td::before { content: attr(data-label); font-size: 12px; color: var(--muted); text-align: left; flex: none; }
  table.cards-on-phone td:first-child { display: block; text-align: left; padding-bottom: 6px; }
  table.cards-on-phone td:first-child::before { content: none; }
  table.cards-on-phone td:first-child > * { text-align: left; }
  table.cards-on-phone td.decision-cell { padding-top: 8px; }
  table.cards-on-phone td[colspan] { display: block; text-align: left; }
  table.cards-on-phone td[colspan]::before { content: none; }
  table.cards-on-phone td > ol { text-align: left; }
  /* The buttons of a row sit under its values, left-aligned. */
  table.cards-on-phone td.actions-cell { display: block; text-align: left; padding-top: 8px; }
  table.cards-on-phone td.actions-cell:empty { display: none; }
  table.cards-on-phone td.actions-cell::before { content: none; }
  table.cards-on-phone td.actions-cell > .row { justify-content: flex-start !important; flex-wrap: wrap; }
  /* A table whose first column is a checkbox: the box moves to the corner and the second cell is the card title. */
  table.cards-on-phone.has-select tr { position: relative; }
  table.cards-on-phone.has-select td:first-child:not([colspan]) { position: absolute; top: 12px; right: 14px; padding: 0; }
  table.cards-on-phone.has-select td:first-child input { width: 20px; height: 20px; }
  table.cards-on-phone.has-select td:nth-child(2) { display: block; text-align: left; padding: 3px 40px 6px 0; }
  table.cards-on-phone.has-select td:nth-child(2)::before { content: none; }
  table.cards-on-phone.has-select td:nth-child(2) > * { text-align: left; }

  /* Supervisor pages: one compact card per student instead of a labelled line per value. */
  table.applicants-table tr, table.team-table tr { display: grid; column-gap: 12px; row-gap: 2px; align-items: baseline; padding: 10px 14px 12px; }
  table.applicants-table tr { grid-template-columns: minmax(0, 1fr) auto auto; }
  table.team-table tr { grid-template-columns: minmax(0, 1fr) auto; }
  table.applicants-table td, table.team-table td,
  table.applicants-table td:first-child, table.team-table td:first-child { display: block; padding: 0; text-align: left; min-width: 0; grid-column: 1 / -1; }
  table.applicants-table td > *, table.team-table td > * { text-align: left; }
  table.applicants-table td::before, table.team-table td::before { content: none; }
  table.applicants-table td.c-student, table.team-table td.c-student { grid-area: 1 / 1; overflow-wrap: anywhere; }
  table.applicants-table td.c-choice { grid-area: 1 / 2; }
  table.applicants-table td.c-gpa { grid-area: 1 / 3; }
  table.team-table td.c-status { grid-area: 1 / 2; }
  table.applicants-table td.c-choice, table.applicants-table td.c-gpa { font-size: 13px; white-space: nowrap; }
  table.applicants-table td.c-choice::before, table.applicants-table td.c-gpa::before,
  table.team-table td.c-choice::before { content: attr(data-label) " "; font-size: 12px; color: var(--muted); }
  table.applicants-table td.c-sup::before, table.applicants-table td.c-prereq::before, table.applicants-table td.c-skills::before,
  table.team-table td.c-role::before { content: attr(data-label) ": "; font-size: 12px; color: var(--muted); }
  table.applicants-table td.c-project { font-size: 13.5px; margin-top: 2px; }
  table.applicants-table td.c-program .muted, table.team-table td.c-program .muted { display: inline; }
  table.applicants-table td.c-program .muted::before, table.team-table td.c-program .muted::before { content: " · "; }
  table.applicants-table td.c-prereq { grid-column: 1; }
  table.applicants-table td.c-skills { grid-column: 2 / -1; white-space: nowrap; }
  table.applicants-table td.decision-cell { padding-top: 8px; }
  table.applicants-table td.decision-cell .decide { display: flex; }
  table.applicants-table td.decision-cell .decide .btn { flex: 1; justify-content: center; }
  table.team-table td.c-email { grid-area: 2 / 1; overflow-wrap: anywhere; }
  table.team-table td.c-choice { grid-area: 2 / 2; font-size: 13px; white-space: nowrap; text-align: right; }
  table.applicants-table td[colspan], table.team-table td[colspan] { grid-column: 1 / -1; }
  /* Filters: search on its own line, then two controls per line. */
  .toolbar.filters { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; padding: 12px 14px; }
  .toolbar.filters input[type=search] { grid-column: 1 / -1; max-width: none; }
  .toolbar.filters select { width: 100%; min-width: 0; }
  /* Search, then the long Round list on its own line, then two short lists side by side. */
  .toolbar.filters input[type=search] { order: -2; }
  .toolbar.filters select.wide { grid-column: 1 / -1; order: -1; }
  .toolbar.filters .spacer { display: none; }
  .toolbar.filters > span:last-child { align-self: center; text-align: right; font-size: 12.5px; grid-column: 1 / -1; }
  .toolbar.filters > .full { grid-column: 1 / -1; }
  .toolbar.filters .check { align-self: center; }
  /* Launch checklist: the buttons go under the text instead of squeezing it into a narrow column. */
  .checklist li { flex-wrap: wrap; }
  .checklist .ck-body { flex: 1 1 calc(100% - 30px); }
  .checklist li > .ck-body + * { margin-left: 30px; }
  .card-head { flex-wrap: wrap; }
}

/* A button that reads as a link: the keyboard way into a table row. */
.linklike { background: none; border: 0; padding: 0; font: inherit; font-weight: 600; color: var(--text); cursor: pointer; text-align: left; min-height: 24px; }
.linklike:hover, .linklike:focus-visible { color: var(--accent); text-decoration: underline; }
.modal-foot .foot-nav { display: flex; align-items: center; gap: 8px; margin-right: auto; font-size: 13px; color: var(--muted); }
.field.invalid input, .field.invalid textarea, .field.invalid select { border-color: var(--danger); }
.field .field-error { color: var(--danger); font-size: 13px; margin-top: 4px; }

/* ---------- "More" menu ---------- */
.menu { position: relative; display: inline-block; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-panel { position: fixed; z-index: 60; min-width: 190px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); padding: 4px; display: flex; flex-direction: column; }
.menu-panel button { font: inherit; font-size: 14px; text-align: left; background: none; border: 0; border-radius: 5px; padding: 8px 10px; cursor: pointer; color: var(--text); }
.menu-panel button:hover, .menu-panel button:focus-visible { background: var(--surface-2); }
.menu-panel button.danger { color: var(--danger); }

/* Settings: the rarely changed lists, folded */
.settings-lists > summary { cursor: pointer; list-style: none; display: flex; flex-direction: column; gap: 2px; }
.settings-lists > summary::-webkit-details-marker { display: none; }
.settings-lists > summary h3 { margin: 0; }
.settings-lists > summary h3::after { content: ' ▸'; color: var(--muted); font-weight: 400; }
.settings-lists[open] > summary h3::after { content: ' ▾'; }
.settings-lists[open] > summary { margin-bottom: 8px; }
.settings-lists > .form-section { padding-left: 0; padding-right: 0; }
.settings-lists > .form-section:last-child { border-bottom: 0; padding-bottom: 0; }

/* ---------- skip link, page focus ---------- */
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 70; background: #fff; color: var(--navy); font-weight: 600; padding: 10px 14px; border-radius: 0 0 8px 8px; box-shadow: var(--shadow-lg); }
.skip-link:focus { top: 0; }
/* Focus is moved to the page heading after a page change so screen readers announce it; no ring is needed there. */
main:focus, h1[tabindex="-1"]:focus, h2[tabindex="-1"]:focus, h3[tabindex="-1"]:focus { outline: none; }
/* A page with a sticky Save / Submit bar: messages sit above it instead of on its buttons. */
body:has(.form-actions.sticky) #toasts { bottom: 92px; }
/* Phones keep the messages at the top (this rule must come after the one above). */
@media (max-width: 640px) { body:has(.form-actions.sticky) #toasts { bottom: auto; } }
.modal-error { margin-bottom: 14px; }
.modal-error .btn { flex: none; margin: -2px -6px 0 0; color: inherit; }

/* ---------- password box with Show / Hide ---------- */
.pw-box { position: relative; display: flex; }
.pw-box input { padding-right: 64px; }
.pw-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); border: 0; background: none; font: inherit; font-size: 13px; font-weight: 600; color: var(--accent); cursor: pointer; padding: 4px 8px; min-height: 28px; border-radius: 5px; }
.pw-toggle:hover { background: var(--surface-2); }

/* ---------- long text: a readable line length ---------- */
.help-section p, .help-section li, .privacy-section p, .privacy-section li, .prose p { max-width: 72ch; }

/* ---------- phones and touch screens ---------- */
@media (max-width: 760px), (pointer: coarse) {
  /* 16px text in boxes: below that an iPhone zooms the whole page in when a box is tapped. */
  input:not([type=checkbox]):not([type=radio]), select, textarea { font-size: 16px !important; min-height: 44px; }
  .tag-input input:not([type=checkbox]):not([type=radio]) { min-height: 36px; }
  /* Finger-sized buttons and menu items. */
  .btn { min-height: 44px; }
  .btn.sm { min-height: 40px; padding: 7px 12px; font-size: 14px; }
  .decide .btn.sm { min-height: 44px; padding: 7px 14px; }
  .btn.xs { min-height: 36px; min-width: 36px; padding: 5px 10px; font-size: 13px; }
  .icon-btn { width: 44px; height: 44px; }
  .nav a, .subnav a, .tabs button { min-height: 44px; display: inline-flex; align-items: center; }
  .help-link { min-height: 40px; min-width: 40px; justify-content: center; }
  .menu-panel button { min-height: 44px; padding: 10px 12px; }
  .chip-toggle { min-height: 40px; padding: 8px 14px; }
  .toc-item { min-height: 44px; }
  .tag button { min-width: 36px; min-height: 36px; }
  .linklike { min-height: 36px; }
  .th-sort { padding: 10px 0; margin: -10px 0; }
  .pw-toggle { min-height: 40px; padding: 4px 12px; }
  .toast-close, .toast-undo { min-width: 40px; min-height: 40px; }
  .footer-links a { padding: 10px 6px; }
  .check { min-height: 36px; align-items: center; }
  .check input { margin-top: 0; width: 20px; height: 20px; flex: none; }
  .sg-choice { min-height: 40px; }
  .skill-grid input { width: 20px; height: 20px; }
}

/* ---------- people who ask their device for less motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .btn:active:not(:disabled) { transform: none; }
}
