/* Backpack — "Ledger": cool gray ground, white cards, Geist with mono numerals, one ink-blue accent. */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f5f6f8;
  --line: #e6e8ec;
  --line-soft: #f0f1f4;
  --line-strong: #c9cdd4;
  --ink: #0e1116;
  --text-2: #3a404b;
  --muted: #5b6270;
  --accent: #2449e8;
  --accent-ink: #1a36b3;
  --accent-soft: #eaf0ff;
  --on-accent: #ffffff;
  --button: #0e1116;
  --on-button: #ffffff;
  --amber: #8a5300;
  --amber-soft: #fff2db;
  --red: #b4262b;
  --red-soft: #fdecec;
  --red-line: #f3d0ce;
  --green: #2e9b4b;
  --shadow: 0 1px 2px rgba(14, 17, 22, 0.04);
  --shadow-lg: -12px 0 40px rgba(14, 17, 22, 0.14);
  --radius: 18px;
  --sidebar: 236px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0d11;
    --surface: #15181e;
    --surface-2: #1c2028;
    --line: #262b34;
    --line-soft: #1f232b;
    --line-strong: #3a414d;
    --ink: #f2f4f7;
    --text-2: #c9ced6;
    --muted: #9aa2ae;
    --accent: #7c9bff;
    --accent-ink: #a9bdff;
    --accent-soft: rgba(124, 155, 255, 0.16);
    --on-accent: #0b0d11;
    --button: #f2f4f7;
    --on-button: #0b0d11;
    --amber: #ffc46b;
    --amber-soft: rgba(255, 176, 50, 0.16);
    --red: #ff8a84;
    --red-soft: rgba(255, 90, 80, 0.15);
    --red-line: rgba(255, 90, 80, 0.3);
    --green: #4fd07a;
    --shadow: none;
    --shadow-lg: -12px 0 40px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 "Geist", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-ink); text-decoration: underline; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 28px; padding: 24px 16px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; font-weight: 650; font-size: 17px; letter-spacing: -0.02em; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--button); display: grid; place-items: center; }
.brand-mark svg { stroke: var(--on-button); }
nav.main { display: flex; flex-direction: column; gap: 2px; }
nav.main a {
  display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 0 12px; border-radius: 10px;
  color: var(--text-2); font-weight: 500; transition: background 0.15s var(--ease);
}
nav.main a:hover { background: var(--line-soft); text-decoration: none; }
nav.main a.active { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(14, 17, 22, 0.06); }
nav.main svg { width: 18px; height: 18px; flex: none; stroke: var(--muted); }
nav.main a.active svg { stroke: var(--accent); }
nav.main .count { margin-left: auto; font-family: var(--mono); font-size: 12px; color: var(--muted); }
nav.main .count.warn:not(:empty) { color: var(--amber); background: var(--amber-soft); padding: 1px 7px; border-radius: 999px; }
.classes { display: flex; flex-direction: column; gap: 2px; }
.classes .label { font-size: 12px; font-weight: 600; color: var(--muted); padding: 0 12px 6px; letter-spacing: 0.02em; }
.classes a { display: flex; align-items: center; gap: 10px; min-height: 34px; padding: 0 12px; border-radius: 8px; color: var(--text-2); font-size: 14px; }
.classes a:hover { background: var(--line-soft); text-decoration: none; }
.classes a.active { background: var(--surface); color: var(--ink); }
.swatch { width: 8px; height: 8px; border-radius: 3px; background: var(--c, var(--muted)); flex: none; display: inline-block; }
.side-foot { margin-top: auto; padding: 0 12px; display: grid; gap: 4px; font-size: 13px; }

main { min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: flex-end; gap: 12px; flex-wrap: wrap; padding: 20px 40px 0; max-width: 1120px; }
#view { padding: 12px 40px 80px; max-width: 1120px; outline: none; animation: fade 0.35s var(--ease); }
#banner { padding: 0 40px; max-width: 1120px; }
#banner:empty { display: none; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- Status + buttons ---------- */
.status-pill {
  display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 14px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); font-size: 13px; color: var(--text-2); min-width: 0;
}
.status-pill .txt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46vw; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); flex: none; }
.status-dot.warn { background: #e0a100; }
.status-dot.bad { background: var(--red); }
button {
  border: 1px solid var(--line-strong); background: var(--surface); min-height: 40px; padding: 0 16px;
  border-radius: 999px; cursor: pointer; font-size: 14px; font-weight: 600;
  transition: transform 0.12s var(--ease), background 0.15s, opacity 0.15s;
}
button:hover { background: var(--surface-2); }
button:active { transform: scale(0.97); }
button.primary { background: var(--button); color: var(--on-button); border-color: transparent; display: inline-flex; align-items: center; gap: 8px; }
button.primary:hover { opacity: 0.88; }
button.primary svg { stroke: var(--on-button); }
button:disabled { opacity: 0.5; cursor: default; transform: none; }
button.link { border: 0; background: none; padding: 0; min-height: 0; color: var(--accent); text-align: left; border-radius: 0; font-weight: 600; }
button.link:hover { text-decoration: underline; background: none; }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--accent); animation: spin 0.8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Page header ---------- */
.page-head { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 22px; }
.page-head .eyebrow { font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: 0.02em; }
.page-head h1 { margin: 0; font-size: 40px; line-height: 1.05; font-weight: 650; letter-spacing: -0.035em; }
.page-head .sub { margin: 0; color: var(--muted); font-size: 15px; }
.back { display: inline-flex; align-items: center; min-height: 44px; font-size: 14px; font-weight: 600; }

/* ---------- Week strip ---------- */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; margin-bottom: 24px; }
.day {
  display: flex; flex-direction: column; gap: 6px; padding: 12px 12px 14px; border-radius: 14px; min-width: 0;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink); transition: transform 0.2s var(--ease);
}
.day:hover { text-decoration: none; transform: translateY(-1px); }
.day .dname { font-size: 12px; font-weight: 600; color: var(--muted); }
.day .dnum { font-family: var(--mono); font-size: 24px; font-weight: 500; letter-spacing: -0.03em; line-height: 1.1; }
.day .dots { display: flex; gap: 4px; flex-wrap: wrap; min-height: 6px; }
.day .dots i { width: 6px; height: 6px; border-radius: 2px; background: var(--c); }
.day .free { font-size: 12px; color: var(--muted); }
.day.today { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.day.today .dname { color: var(--on-accent); opacity: 0.85; }
.day.today .dots i { background: var(--on-accent); }
.day.empty { background: transparent; border-style: dashed; color: var(--muted); }

/* ---------- Columns ---------- */
.cols { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.col-main { flex: 999 1 460px; min-width: 0; display: flex; flex-direction: column; gap: 24px; }
.col-side { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 24px; }

/* ---------- Cards and lists ---------- */
.card { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow); overflow: hidden; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 18px 20px 8px; }
.card-head h2, .side-card h2 { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: -0.015em; display: flex; align-items: center; gap: 8px; }
.card-head .aside { font-size: 13px; color: var(--muted); }
.list > * + * { border-top: 1px solid var(--line-soft); }
.card-head + .list { border-top: 1px solid var(--line-soft); }
.side-card { padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.sec { margin: 0 0 24px; }

.item {
  display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 3px 14px; align-items: start;
  padding: 14px 20px; cursor: pointer; transition: background 0.15s var(--ease), opacity 0.3s, transform 0.3s var(--ease);
}
.item:hover { background: var(--surface-2); }
.item.leaving { opacity: 0; transform: translateX(12px); }
.check {
  width: 24px; height: 24px; min-height: 0; border-radius: 50%; border: 1.5px solid var(--line-strong);
  background: var(--surface); padding: 0; margin-top: 1px; display: grid; place-items: center; color: transparent;
  transition: all 0.2s var(--ease); font-size: 13px;
}
.check:hover { border-color: var(--accent); background: var(--accent-soft); }
.check.on { background: var(--green); border-color: var(--green); color: #fff; }
.item .title { font-weight: 600; line-height: 1.35; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.item .meta { grid-column: 2; display: flex; gap: 6px 8px; align-items: center; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.item .due { grid-row: 1 / span 2; grid-column: 3; text-align: right; font-family: var(--mono); font-size: 13px; color: var(--ink); white-space: nowrap; padding-top: 2px; }
.item .due.none { color: var(--muted); }
.item .due.late { color: var(--red); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); display: inline-block; flex: none; }
.course-tag { display: inline-flex; align-items: center; gap: 6px; }
.course-tag::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: var(--c, var(--muted)); }

.done-line { display: flex; flex-wrap: wrap; gap: 8px 16px; padding: 12px 20px 16px; font-size: 13px; color: var(--muted); }
.done-line span { display: inline-flex; align-items: center; gap: 6px; }
.done-line s { color: var(--text-2); }
.done-line svg { stroke: var(--green); }

.badge { font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 999px; white-space: nowrap; letter-spacing: 0; }
.badge.kind { background: var(--line-soft); color: var(--text-2); font-weight: 500; }
.badge.test { background: var(--red-soft); color: var(--red); }
.badge.inferred { background: var(--accent-soft); color: var(--accent); }
.badge.ambiguous, .badge.conflict, .badge.changed { background: var(--amber-soft); color: var(--amber); }
.badge.new { background: var(--accent); color: var(--on-accent); }

.empty { padding: 26px 20px; color: var(--muted); text-align: center; }
.empty strong { display: block; color: var(--ink); font-weight: 600; margin-bottom: 2px; }

/* Past-due banner */
.alert { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-radius: 16px; background: var(--surface); border: 1px solid var(--red-line); }
.alert .ico { width: 36px; height: 36px; border-radius: 10px; background: var(--red-soft); display: grid; place-items: center; flex: none; }
.alert .ico svg { stroke: var(--red); }
.alert h2 { margin: 0; font-size: 15px; font-weight: 600; }
.alert p { margin: 0; font-size: 13px; color: var(--muted); }
.alert .grow { flex: 1; min-width: 0; }
.alert button.link { min-height: 44px; }

/* Side cards */
.tests-row { display: flex; gap: 14px; align-items: center; cursor: pointer; border-radius: 10px; }
.tests-row:hover .t { text-decoration: underline; }
.date-tile { width: 44px; flex: none; text-align: center; border-radius: 10px; background: var(--surface-2); padding: 6px 0; }
.date-tile .w { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; }
.date-tile .n { font-family: var(--mono); font-size: 18px; font-weight: 500; }
.date-tile.hot { background: var(--red-soft); }
.date-tile.hot .w, .date-tile.hot .n { color: var(--red); }
.tests-row .t { font-weight: 600; font-size: 14px; }
.tests-row .s { font-size: 13px; color: var(--muted); }
.big-num { display: flex; align-items: baseline; gap: 6px; }
.big-num b { font-family: var(--mono); font-size: 28px; font-weight: 500; letter-spacing: -0.03em; }
.big-num span { font-size: 13px; color: var(--muted); }
.meter { height: 6px; border-radius: 999px; background: var(--line-soft); display: flex; overflow: hidden; }
.meter .ok { background: var(--green); }
.meter .bad { background: #e0a100; }
.kv { display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: var(--text-2); }
.kv div { display: flex; justify-content: space-between; gap: 12px; }
.kv div span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kv div span:last-child { color: var(--muted); white-space: nowrap; }
.side-card .more { font-size: 14px; font-weight: 600; min-height: 44px; display: flex; align-items: center; }
.side-card .note { margin: 0; font-size: 13px; color: var(--muted); }

/* Announcements */
.ann { padding: 14px 20px; cursor: pointer; }
.ann .head { display: flex; gap: 8px; font-size: 13px; color: var(--muted); margin-bottom: 4px; flex-wrap: wrap; }
.ann .notice { font-weight: 600; }
.ann .body { color: var(--text-2); font-size: 14px; white-space: pre-wrap; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ann.open .body { -webkit-line-clamp: unset; }

/* Onboarding + notices */
.notice-card { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 16px 18px; margin-top: 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.notice-card.warn { background: var(--amber-soft); border-color: transparent; }
.notice-card h3 { margin: 0 0 2px; font-size: 15px; }
.notice-card p { margin: 0; color: var(--text-2); font-size: 14px; }
.onboard { text-align: center; padding: 72px 20px; }
.onboard h1 { font-size: 44px; letter-spacing: -0.04em; margin: 0 0 10px; line-height: 1.05; }
.onboard p { color: var(--text-2); max-width: 520px; margin: 0 auto 24px; font-size: 17px; }
.onboard form { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.onboard input { width: min(380px, 100%); min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); }
.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 44px auto 0; max-width: 780px; text-align: left; }
.steps div { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px; font-size: 14px; color: var(--text-2); }
.steps b { display: block; color: var(--ink); margin-bottom: 4px; }

/* Courses */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.course-card { display: block; padding: 18px 20px; color: var(--ink); transition: transform 0.2s var(--ease), box-shadow 0.2s; }
.course-card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 8px 28px rgba(14, 17, 22, 0.08); }
.course-card .name { font-weight: 650; font-size: 16px; display: flex; gap: 10px; align-items: center; }
.course-card .stats { margin-top: 12px; font-size: 13px; color: var(--muted); display: flex; gap: 14px; flex-wrap: wrap; }

.source { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 12px 20px; font-size: 14px; }
.source .t { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source .s { grid-column: 1 / -1; font-size: 12.5px; color: var(--muted); }
.st { font-size: 12px; font-weight: 600; }
.st.ok { color: var(--green); }
.st.bad { color: var(--amber); }

/* ---------- Detail drawer ---------- */
.scrim { position: fixed; inset: 0; background: rgba(14, 17, 22, 0.24); z-index: 20; animation: fadein 0.2s; }
@keyframes fadein { from { opacity: 0; } }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); z-index: 21; overflow-y: auto;
  background: var(--surface); box-shadow: var(--shadow-lg); padding: 24px 28px 40px;
  transform: translateX(104%); transition: transform 0.35s var(--ease);
  display: flex; flex-direction: column; gap: 22px;
}
.drawer.open { transform: none; }
.drawer .top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.drawer .crumb { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.drawer .x { width: 44px; height: 44px; padding: 0; border-radius: 50%; display: grid; place-items: center; flex: none; }
.drawer h1 { font-size: 28px; line-height: 1.15; letter-spacing: -0.03em; margin: 0; font-weight: 650; }
.due-box { display: flex; gap: 14px; padding: 16px; border-radius: 14px; background: var(--surface-2); }
.due-box .date-tile { width: 52px; background: var(--surface); border: 1px solid var(--line); padding: 8px 0; border-radius: 12px; }
.due-box .date-tile .n { font-size: 22px; }
.due-box .what { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 600; }
.due-box p { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.drawer .facts { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 10px 16px; margin: 0; font-size: 14px; }
.drawer .facts dt { color: var(--muted); }
.drawer .facts dd { margin: 0; }
.drawer h3 { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin: 0 0 8px; }
.prose { white-space: pre-wrap; font-size: 14.5px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.quote { margin: 0; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line); font-size: 14px; color: var(--text-2); white-space: pre-wrap; }
.chain { list-style: none; padding: 0; margin: 0; font-size: 14px; }
.chain li { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 12px; padding-bottom: 14px; position: relative; }
.chain li:last-child { padding-bottom: 0; }
.chain li::before { content: ""; width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--line-strong); background: var(--surface); margin: 5px 0 0 3px; box-sizing: border-box; }
.chain li::after { content: ""; position: absolute; left: 8px; top: 18px; bottom: 0; width: 2px; background: var(--line); }
.chain li:last-child::after { display: none; }
.chain li:last-child::before { width: 11px; height: 11px; border: 0; background: var(--accent); margin: 4px 0 0 2px; }
.chain .k { display: block; color: var(--muted); font-size: 12px; }
.chain .t { font-weight: 500; }
.chain li:last-child .t { font-weight: 600; }
.linkbox { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); color: var(--ink); font-size: 14px; }
.linkbox + .linkbox { margin-top: 8px; }
.linkbox:hover { text-decoration: none; background: var(--surface-2); }
.linkbox span:last-child { font-size: 12px; color: var(--muted); }
.warnbox { background: var(--amber-soft); color: var(--ink); border-radius: 12px; padding: 12px 14px; font-size: 14px; }
.drawer .actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: auto; padding-top: 8px; }
.drawer .actions > * { flex: 1 1 180px; min-height: 48px; border-radius: 999px; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 15px; font-weight: 600; }
.drawer .actions a { border: 1px solid var(--line-strong); color: var(--ink); }
.drawer .actions a:hover { text-decoration: none; background: var(--surface-2); }
.changes { font-size: 13px; color: var(--text-2); padding-left: 18px; margin: 0; }

/* ---------- Settings dialog ---------- */
dialog { border: 0; border-radius: 20px; padding: 0; width: min(500px, 94vw); background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgba(14, 17, 22, 0.24); }
dialog::backdrop { background: rgba(14, 17, 22, 0.3); }
dialog form { padding: 24px; display: grid; gap: 14px; }
dialog h2 { margin: 0; font-size: 20px; letter-spacing: -0.02em; }
dialog h3 { margin: 4px 0 0; font-size: 14px; }
dialog label { display: grid; gap: 6px; font-size: 14px; font-weight: 500; }
dialog label.row { display: flex; gap: 8px; align-items: center; font-weight: 400; }
dialog input:not([type=checkbox]), dialog select { min-height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface-2); }
.settings-sec { border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 8px; }
.settings-sec p { margin: 0; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; }
.btns.end { justify-content: flex-end; }

/* ---------- Phone ---------- */
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: auto; bottom: 0; left: 0; right: 0; height: auto; z-index: 10; overflow: visible;
    flex-direction: row; gap: 0; padding: 6px 8px calc(10px + env(safe-area-inset-bottom));
    background: var(--surface); border-top: 1px solid var(--line);
  }
  .brand, .classes, .side-foot { display: none; }
  nav.main { flex-direction: row; flex: 1; justify-content: space-around; }
  nav.main a { flex-direction: column; gap: 3px; min-height: 48px; justify-content: center; padding: 0 6px; font-size: 11px; background: none !important; box-shadow: none !important; }
  nav.main a.active { color: var(--accent); }
  nav.main .count { display: none; }
  nav.main svg { width: 22px; height: 22px; }
  main { padding-bottom: 84px; }
  .topbar { padding: 16px 16px 0; }
  .topbar .status-pill { display: none; }
  #view, #banner { padding-left: 16px; padding-right: 16px; }
  .page-head h1 { font-size: 32px; }
  .week { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
  .week .day:nth-child(n+6) { display: none; }
  .day { padding: 8px 6px 10px; align-items: center; }
  .day .dnum { font-size: 18px; }
  .item { padding: 12px 16px; }
  .steps { grid-template-columns: 1fr; }
  .drawer { padding: 20px 18px 32px; }
  .drawer .facts { grid-template-columns: 90px minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Section spacing: cards in the Today columns are spaced by the column gap. */
.col-main .sec, .col-side .sec { margin: 0; }
div.sec > h2 { margin: 0 0 10px 4px; font-size: 17px; font-weight: 650; letter-spacing: -0.015em; display: flex; gap: 8px; align-items: baseline; }
div.sec > h2 .n { font-size: 13px; font-weight: 500; color: var(--muted); }
.warnbox + .sec, .warnbox { margin-bottom: 16px; }
.classes a { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; }
.course-card:hover { color: var(--ink); }
.course-card .name::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--c); flex: none; }

/* Website sign-in screen */
body.gated .app { display: none; }
.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.gate-card { width: min(420px, 100%); text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.gate-card img { width: 64px; height: 64px; }
.gate-card h1 { margin: 6px 0 0; font-size: 44px; letter-spacing: -0.04em; line-height: 1; }
.gate-card p { margin: 0; color: var(--text-2); font-size: 17px; }
.gate-card .fine { font-size: 13px; color: var(--muted); max-width: 340px; }
.gate-card button { margin-top: 12px; min-height: 48px; padding: 0 22px; font-size: 15px; }
.gate-card .err { color: var(--red); font-size: 14px; min-height: 1em; }

/* ---------- Grades ---------- */
.grade-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 16px; }
.grade-card { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.gc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; color: var(--ink); }
.gc-head:hover { text-decoration: none; color: var(--ink); }
.gc-head:hover .gc-name { text-decoration: underline; }
.gc-name { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 16px; min-width: 0; }
.gc-grade { display: inline-flex; align-items: baseline; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.grade-big { font-family: var(--mono); font-size: 30px; font-weight: 500; letter-spacing: -0.03em; line-height: 1; }
.grade-sub { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.chip { font-family: var(--mono); font-size: 12px; font-weight: 500; padding: 2px 7px; border-radius: 999px; }
.chip.up { color: var(--green); background: color-mix(in srgb, var(--green) 14%, transparent); }
.chip.down { color: var(--red); background: var(--red-soft); }
.spark { width: 100%; height: 32px; color: var(--accent); }
.gc-sec { display: flex; flex-direction: column; gap: 8px; }
.gc-label { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: 0.02em; }
.cats { display: flex; flex-direction: column; gap: 10px; }
.cat { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; font-size: 14px; }
.cat-val { font-size: 13px; }
.bar { grid-column: 1 / -1; height: 6px; border-radius: 999px; background: var(--line-soft); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.scores { display: flex; flex-direction: column; }
.score { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1px 12px; padding: 8px 0; color: var(--ink); font-size: 14px; border-top: 1px solid var(--line-soft); }
.score:first-child { border-top: 0; }
.score:hover { text-decoration: none; }
.score:hover .t { text-decoration: underline; }
.score .t { display: flex; align-items: center; gap: 6px; min-width: 0; }
.score .v { font-size: 13px; white-space: nowrap; }
.score .v.bad { color: var(--red); font-weight: 600; font-family: inherit; }
.score .m { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }
.side-card.missing { border-color: var(--red-line); }
.cc-grade { margin-left: auto; font-size: 14px; font-weight: 500; color: var(--text-2); }

@media (max-width: 760px) {
  /* Six sections don't fit a phone tab bar; Completed is reachable from Today. */
  nav.main a[data-view="completed"] { display: none; }
}
