/* App layer on top of the "Industry" design system (vendor/industry/styles.css).
   Only layout glue, the dark theme and a few app-specific pieces live here;
   components come from the design system's classes. */

/* Dark theme: the design system is light-only. Same roles, ramps reversed
   (step k takes the light theme's step 1000-k) so tinted fills stay subtle
   and deep steps stay readable. */
@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #17191a;
    --color-surface: #202224;
    --color-text: #e7e7ea;
    --color-accent: #749dc4;
    --color-divider: color-mix(in srgb, #e7e7ea 18%, transparent);

    --color-neutral-100: #2b2b2d;
    --color-neutral-200: #424244;
    --color-neutral-300: #5d5d60;
    --color-neutral-400: #7a7a7d;
    --color-neutral-500: #98989b;
    --color-neutral-600: #b7b7ba;
    --color-neutral-700: #d4d4d7;
    --color-neutral-800: #e7e7ea;
    --color-neutral-900: #f5f5f8;

    --color-accent-100: #1d2d3d;
    --color-accent-200: #2c455d;
    --color-accent-300: #416180;
    --color-accent-400: #597ea3;
    --color-accent-500: #749dc4;
    --color-accent-600: #94bce3;
    --color-accent-700: #b5d9fd;
    --color-accent-800: #d6ebff;
    --color-accent-900: #eef6ff;

    --shadow-sm: 0 0 0 1px color-mix(in srgb, #e7e7ea 8%, transparent), 0 1px 2px #0008;
    --shadow-md: 0 0 0 1px color-mix(in srgb, #e7e7ea 8%, transparent), 0 3px 10px #0009;
    --shadow-lg: 0 0 0 1px color-mix(in srgb, #e7e7ea 8%, transparent), 0 12px 32px #000a;
  }
}

/* Header bar (matches the board's AppNav) */
.nav { border-bottom: 1px solid var(--color-divider); padding: 12px 28px; gap: 26px; }
.nav-brand { display: flex; align-items: center; gap: 10px; color: var(--color-text); text-decoration: none; }
.nav .nav-end { display: flex; align-items: center; gap: 18px; padding-left: 18px; border-left: 1px solid var(--color-divider); }
.nav form { margin: 0; }

.page { max-width: 1200px; margin: 0 auto; padding: 32px 40px; display: flex; flex-direction: column; gap: 28px; }
.page-head h1 { margin: 0; font-size: 48px; }
.page-head .text-muted { font-size: 14px; }

.stack { display: flex; flex-direction: column; gap: 14px; }
.narrow { max-width: 420px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; align-items: start; }
.card.blueprint { padding: 20px; gap: 12px; }

/* Status messages (the board's accent notice) */
.notice { border: 1px solid var(--color-accent); background: var(--color-accent-100); color: var(--color-accent-800); padding: 10px 12px; font-size: 14px; }
.notice-error { border-color: var(--color-text); background: transparent; color: var(--color-text); font-weight: 500; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .card { width: min(380px, 100%); padding: 28px; gap: 16px; }
.login pre { white-space: pre-wrap; word-break: break-all; font-size: 12px; background: var(--color-surface); padding: 10px; margin: 0; }

@media (max-width: 760px) {
  .page { padding: 24px 16px; }
  .page-head h1 { font-size: 36px; }
  .grid-2 { grid-template-columns: 1fr; }
  .nav { padding: 12px 16px; gap: 16px; flex-wrap: wrap; }
}

/* Checkboxes (the design system's .radio hides its input; checkboxes stay native) */
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.check input { accent-color: var(--color-accent); width: 16px; height: 16px; margin: 0; }

/* Curriculum map (board screen 02) */
.map-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; min-height: calc(100vh - 58px); }
.map-main { padding: 26px 32px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.map-head { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.map-head h2 { margin: 0; flex: 1; min-width: 240px; }
.map-filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin: 0; }
.map-dept { width: auto; min-width: 200px; }
.map-legend { display: flex; gap: 22px; font-size: 13px; align-items: center; flex-wrap: wrap; }
.map-legend span { display: inline-flex; gap: 7px; align-items: center; }
.map-summary { margin-left: auto; }
.swatch { width: 14px; height: 14px; display: inline-block; }
.swatch-done { background: var(--color-accent-600); }
.swatch-active { background: var(--color-accent-100); border: 2px solid var(--color-accent); }
.swatch-available { border: 1px solid var(--color-neutral-700); }
.swatch-locked { border: 1px dashed var(--color-neutral-500); }
.map-canvas { flex: 1; min-height: 480px; position: relative; }
#cy { position: absolute; inset: 0; }
.map-zoom { position: absolute; right: 12px; bottom: 12px; display: flex; flex-direction: column; gap: 6px; }
.map-zoom .btn { background: var(--color-bg); }
.map-empty { max-width: 520px; }

.map-aside { border-left: 1px solid var(--color-divider); padding: 26px; display: flex; flex-direction: column; gap: 14px; }
.panel-title { display: flex; flex-direction: column; gap: 2px; }
.panel-number { font-family: var(--font-heading); font-weight: 600; font-size: 40px; line-height: 1; }
.panel-name { font-family: var(--font-heading); font-size: 22px; line-height: 1.15; }
.panel-section { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.panel-label { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: color-mix(in srgb, var(--color-text) 55%, transparent); }
.panel-row { display: flex; gap: 8px; align-items: baseline; }
.panel-row-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel-row .btn-ghost { padding: 0 6px; }
.panel-quote { font-style: italic; }
.panel-oneof { font-size: 12px; color: var(--color-accent-700); margin-top: 4px; }
.panel-alt { padding-left: 12px; border-left: 2px solid var(--color-accent-300); }
.panel-add { display: flex; flex-direction: column; gap: 6px; margin: 0; }
.panel-add-row { display: flex; gap: 8px; }
.panel-add .notice { margin: 0; }

/* Catalog */
.catalog-filters { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.catalog-filters .field { min-width: 150px; }
.catalog-filters .field:first-child { flex: 1; min-width: 200px; }
.catalog-filters .check { height: 36px; }

/* Settings: catalog */
.status-list { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; font-size: 14px; margin: 0; }
.status-list dt { color: color-mix(in srgb, var(--color-text) 55%, transparent); }
.status-list dd { margin: 0; }
.dept-grid { display: grid; grid-template-columns: 1fr; gap: 8px; }

@media (max-width: 900px) {
  .map-layout { grid-template-columns: 1fr; }
  .map-aside { border-left: 0; border-top: 1px solid var(--color-divider); }
  .map-main { padding: 20px 16px; }
}

/* Course page (board screen 03) */
.course-head { display: flex; align-items: flex-end; gap: 24px; flex-wrap: wrap; }
.course-title { flex: 1; min-width: 280px; }
.course-title h1 { margin: 0; font-size: 44px; }
.course-meta { display: flex; gap: 14px; align-items: center; font-size: 14px; margin-top: 6px; }
.course-side { display: flex; flex-direction: column; gap: 10px; width: 260px; }
.progress-line { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
.progress-bar { height: 6px; border: 1px solid var(--color-divider); }
.progress-bar > div { height: 100%; background: var(--color-accent); }

.week-grid { border-top: 1px solid var(--color-divider); }
.week-row { display: grid; grid-template-columns: 110px repeat(4, minmax(0, 1fr)); border-bottom: 1px solid var(--color-divider); }
.week-head span { padding: 8px 10px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: color-mix(in srgb, var(--color-text) 55%, transparent); }
.week-label { padding: 10px; font-family: var(--font-heading); font-weight: 600; font-size: 17px; }
.week-cell { padding: 8px 10px; display: flex; flex-direction: column; gap: 8px; border-left: 1px solid color-mix(in srgb, var(--color-text) 8%, transparent); min-width: 0; }
.check-item { display: flex; gap: 10px; align-items: flex-start; }
.check-box { flex: none; width: 18px; height: 18px; margin-top: 2px; padding: 0; cursor: pointer; display: grid; place-items: center;
  border: 1px solid var(--color-neutral-600); background: transparent; color: transparent; }
.check-box:disabled { cursor: not-allowed; opacity: .45; }
.is-done .check-box { background: var(--color-accent); border-color: var(--color-accent); color: var(--color-bg); }
.check-text { display: flex; flex-direction: column; min-width: 0; font-size: 14px; line-height: 1.3; }
.check-text a { color: var(--color-text); text-decoration: none; overflow-wrap: anywhere; }
.check-text a:hover { color: var(--color-accent); text-decoration: underline; }
.check-text .text-muted { font-size: 12px; }
.is-done .check-text a { opacity: .6; }
.extras { margin-top: 8px; }
.extras-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px 24px; }

@media (max-width: 900px) {
  .week-row { grid-template-columns: 1fr; }
  .week-head { display: none; }
  .week-cell { border-left: 0; }
  .week-cell:empty { display: none; }
  .week-cell::before { content: attr(data-label); font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
    color: color-mix(in srgb, var(--color-text) 55%, transparent); }
  .week-cell:not(:has(.check-item)) { display: none; }
}

/* Lecture page */
.lecture-head { display: flex; align-items: flex-end; gap: 16px; }
.lecture-head h1 { margin: 0; flex: 1; font-size: 36px; }
.lecture-head > div { flex: 1; }
.lecture-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 28px; align-items: start; }
.video-frame { aspect-ratio: 16 / 9; }
.video-frame iframe, .video-frame #player { width: 100%; height: 100%; display: block; }
.lecture-aside { display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.lecture-nav { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
@media (max-width: 900px) { .lecture-layout { grid-template-columns: 1fr; } }
.download-status { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }

/* PDF viewer (board screen 04) */
.viewer-bar { display: flex; align-items: center; gap: 14px; padding: 10px 28px; border-bottom: 1px solid var(--color-divider); flex-wrap: wrap; }
.viewer-title { font-family: var(--font-heading); font-weight: 600; font-size: 18px; flex: 1; min-width: 200px; }
.viewer { display: grid; grid-template-columns: 132px minmax(0, 1fr) 360px; height: calc(100vh - 58px - 57px); }
.thumbs { border-right: 1px solid var(--color-divider); padding: 16px; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; }
.thumb { display: grid; grid-template-columns: 64px 1fr; grid-template-rows: auto auto; gap: 0 8px; padding: 0; border: 0; background: transparent;
  cursor: pointer; text-align: left; font: 12px var(--font-body); color: var(--color-text); }
.thumb canvas { grid-row: span 2; width: 64px; min-height: 82px; background: var(--color-neutral-100); border: 1px solid var(--color-divider); }
.thumb.current canvas { border: 2px solid var(--color-accent); }
.thumb-notes { color: var(--color-accent-700); }
.page-area { background: var(--color-neutral-300); overflow: auto; padding: 24px; display: flex; justify-content: center; align-items: flex-start; }
.page-area canvas { box-shadow: var(--shadow-md); background: #fff; }
.viewer-notes { border-left: 1px solid var(--color-divider); padding: 20px 22px; overflow-y: auto; }

/* Notes panel (viewer and lecture page) */
.notes-panel { display: flex; flex-direction: column; gap: 12px; }
.notes-head { display: flex; align-items: baseline; gap: 8px; }
.notes-head .card-kicker { flex: 1; }
.notes-head .text-muted { font-size: 12px; }
.notes-list { display: flex; flex-direction: column; gap: 14px; }
.note { padding: 12px 14px; gap: 6px; }
.note-body { font-size: 14px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.note-ts { align-self: flex-start; font-variant-numeric: tabular-nums; padding: 0 4px; }
.note .card-meta .btn { margin-left: auto; padding: 0 4px; font-size: 11px; }
.note-form { display: flex; flex-direction: column; gap: 8px; margin: 0; }
.note-form .notice { margin: 0; }

@media (max-width: 1000px) {
  .viewer { grid-template-columns: 1fr; height: auto; }
  .thumbs { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--color-divider); }
  .page-area { min-height: 70vh; }
  .viewer-notes { border-left: 0; border-top: 1px solid var(--color-divider); }
}

/* Problem set attempt (board screen 05) */
.attempt-head { display: flex; align-items: flex-end; gap: 16px; }
.attempt-head > div { flex: 1; }
.attempt-head h1 { margin: 0; font-size: 40px; }
.attempt-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; align-items: start; }
.attempt-main { display: flex; flex-direction: column; gap: 24px; }
.attempt-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.attempt-actions form { margin: 0; }
.clock { font-family: var(--font-heading); font-weight: 600; font-size: 72px; line-height: 1; font-variant-numeric: tabular-nums; }
.clock.small { font-size: 40px; }
.lock-title { display: flex; gap: 12px; align-items: center; }
.score { font-family: var(--font-heading); font-weight: 600; font-size: 56px; line-height: 1; }
.score .text-muted { font-size: 26px; }
.grade-form { display: flex; flex-direction: column; gap: 12px; margin: 0; }
.grade-form .input { max-width: 120px; }
.grade-form td:first-child .input { max-width: 100px; }
.attempt-side { display: flex; flex-direction: column; gap: 12px; }
.photo-form { display: flex; gap: 8px; margin: 0; }
.photo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.photo-grid figure { padding: 6px; }
.photo-grid img { width: 100%; height: auto; }
.photo-grid figcaption { display: flex; justify-content: space-between; align-items: center; }
.item-attempt { font-size: 12px; }
.tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--color-divider); }
.tabs a { padding: 8px 0; text-decoration: none; color: var(--color-text); font-size: 14px; }
.tabs a[aria-current="page"] { color: var(--color-accent); border-bottom: 2px solid var(--color-accent); }
@media (max-width: 900px) { .attempt-grid { grid-template-columns: 1fr; } .clock { font-size: 56px; } }

/* Review queue (board screen 06) */
.review-head { display: flex; align-items: flex-end; gap: 36px; flex-wrap: wrap; }
.review-head > div:first-child { flex: 1; }
.review-head h1 { margin: 0; font-size: 44px; }
.stat { display: flex; flex-direction: column; }
.stat span:last-child { font-family: var(--font-heading); font-weight: 600; font-size: 34px; line-height: 1; }
.stat .text-muted { font-size: 12px; }
.review-how { max-width: 760px; font-size: 14px; }
.redo-title { display: flex; flex-direction: column; gap: 2px; }
.redo-title .text-muted { font-size: 12px; }
.redo-title .notice { margin: 4px 0 0; padding: 4px 8px; font-size: 12px; }
.redo-track { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.redo-track span { font-size: 11px; text-align: center; padding: 3px 0; border: 1px solid var(--color-divider);
  color: color-mix(in srgb, var(--color-text) 55%, transparent); }
.redo-track .past { background: var(--color-accent-600); border-color: var(--color-accent); color: var(--color-bg); }
.redo-track .current { background: var(--color-accent-100); border-color: var(--color-accent); color: var(--color-accent-800); }
.review-table td:nth-child(5) { white-space: nowrap; }
td.due { font-weight: 700; }
.redo-actions { display: flex; gap: 8px; justify-content: flex-end; }
tr.reviewed { background: color-mix(in srgb, var(--color-accent) 6%, transparent); }
.concept-slot { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--color-divider); }
.concept-form { display: flex; flex-direction: column; gap: 8px; margin: 0; }
.concept-form .notice { margin: 0; }
@media (max-width: 900px) { .review-table th:nth-child(4), .review-table td:nth-child(4) { display: none; } }

/* Exam mode (board screen 07): full screen, dark in both themes */
/* Fixed to the light theme's accent ramp: the exam is dark in both themes. */
.exam { --ex-900: #1d2d3d; --ex-800: #2c455d; --ex-700: #416180; --ex-600: #597ea3; --ex-400: #94bce3; --ex-300: #b5d9fd; }
.exam { min-height: 100vh; box-sizing: border-box; display: flex; flex-direction: column; padding: 32px 44px;
  background: var(--ex-900); color: #f2f2f2; }
.exam-head, .exam-foot { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.exam-title { font-family: var(--font-heading); font-weight: 600; font-size: 20px; flex: 1; }
.exam-note { font-size: 14px; color: var(--ex-300); }
.exam-foot .exam-note { flex: 1; min-width: 240px; }
.exam-center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 24px 0; }
.exam-state { font-size: 14px; letter-spacing: .14em; text-transform: uppercase; color: var(--ex-300); }
.exam-clock { font-family: var(--font-heading); font-weight: 600; font-size: clamp(96px, 16vw, 200px); line-height: .9;
  letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.exam-bar { width: min(640px, 90%); height: 4px; background: var(--ex-800); }
.exam-bar > div { height: 100%; background: var(--ex-400); }
.exam.is-over .exam-bar > div { background: #e0a458; }
.exam.is-over .exam-state { color: #e0a458; }
.exam-limit { font-size: 13px; color: var(--ex-300); }
.exam-problems { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; margin-top: 10px; }
.exam-problem { cursor: pointer; width: 130px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px;
  align-items: flex-start; background: transparent; border: 1px solid var(--ex-600); color: #f2f2f2;
  font-family: var(--font-body); }
.exam-problem.is-flagged { background: var(--ex-700); border-color: var(--ex-300); }
.exam-problem-n { font-family: var(--font-heading); font-weight: 600; font-size: 22px; }
.exam-problem-state { font-size: 12px; color: var(--ex-300); }
.exam-add { border-style: dashed; }
.exam-btn { color: #f2f2f2; border-color: var(--ex-600); background: transparent; padding: 10px 18px; }
.exam-end { background: #f2f2f2; color: var(--ex-900); border-color: #f2f2f2; padding: 10px 18px; }
.exam-end .corner { color: var(--ex-300); }
tr.flagged td:first-child { box-shadow: inset 3px 0 0 var(--color-accent); }
@media (max-width: 700px) { .exam { padding: 20px 16px; } }

/* Explain It (Phase 9) */
.writing-banner { padding: 8px 40px; font-size: 14px; background: var(--color-accent-100); color: var(--color-accent-800);
  border-bottom: 1px solid var(--color-accent); }
.writing-banner a { margin-left: 8px; font-weight: 600; }
.explain-head { display: flex; align-items: flex-end; gap: 24px; flex-wrap: wrap; margin-bottom: 18px; }
.explain-head > div:first-child { flex: 1; min-width: 240px; }
.explain-head h1 { margin: 0; font-size: 40px; }
.explain-steps { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; flex-wrap: wrap; }
.explain-steps li { font-size: 12px; padding: 4px 10px; border: 1px solid var(--color-divider);
  color: color-mix(in srgb, var(--color-text) 60%, transparent); }
.explain-steps li.current { border-color: var(--color-accent); background: var(--color-accent-100); color: var(--color-accent-800); }
.explain-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 32px; }
.explain-list-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 32px; align-items: start; }
.explain-write { display: flex; flex-direction: column; gap: 10px; }
.explain-write textarea { min-height: 420px; font-size: 15px; line-height: 1.5; resize: vertical; }
.explain-side { display: flex; flex-direction: column; gap: 14px; }
.explain-preview { display: flex; flex-direction: column; gap: 8px; max-height: 420px; overflow: auto; }
.explain-point { padding: 8px 10px 8px 34px; border: 1px solid var(--color-divider); position: relative; white-space: pre-wrap; font-size: 14px; }
.explain-point::before { content: attr(data-n); position: absolute; left: 10px; top: 8px; font-family: var(--font-heading);
  font-weight: 600; color: var(--color-accent); }
.explain-intro { max-width: 760px; }
.explain-point-text, .explain-answer { white-space: pre-wrap; }
.explain-questions .card { gap: 12px; }
.explain-sources { display: flex; flex-direction: column; gap: 4px; margin: 0 0 18px; }
.explain-done-point { padding: 10px 0; border-bottom: 1px solid var(--color-divider); display: flex; flex-direction: column; gap: 4px; }
.explain-done-point > .math { white-space: pre-wrap; }
.explain-done-point.has-gap { box-shadow: inset 3px 0 0 var(--color-accent); padding-left: 12px; }
.explain-answer { font-size: 14px; padding-left: 12px; border-left: 2px solid var(--color-divider); }
.explain-source-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.explain-source-list .missed { color: color-mix(in srgb, var(--color-text) 55%, transparent); text-decoration: line-through; }
@media (max-width: 900px) { .explain-grid, .explain-list-grid { grid-template-columns: 1fr; } .writing-banner { padding: 8px 16px; } }

/* Dashboard (board screen 01) and its charts */
:root { --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100; }
@media (prefers-color-scheme: dark) {
  :root { --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500; }
}
.dash-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.dash-head > div { flex: 1; min-width: 280px; }
.dash-head h1 { margin: 0; font-size: 44px; line-height: 1.05; }
.dash-row3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; }
.dash-row2 { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 28px; }
.dash-row3 .card, .dash-row2 .card { gap: 12px; }
.dash-row3 > *, .dash-row2 > * { min-width: 0; }  /* let the SVG charts shrink on a phone */
.dash-big { display: flex; align-items: baseline; gap: 8px; }
.dash-big span:first-child { font-family: var(--font-heading); font-weight: 600; font-size: 44px; line-height: 1; }
.dash-big .text-muted { font-size: 13px; }
.dash-course { font-size: 26px; text-decoration: none; color: var(--color-text); }
.dash-progress { display: flex; flex-direction: column; gap: 6px; margin-top: auto; }
.dash-progress-row { display: flex; justify-content: space-between; font-size: 13px; }
.dash-progress-bar { height: 6px; border: 1px solid var(--color-divider); }
.dash-progress-bar > div { height: 100%; background: var(--color-accent); }
.dash-stages { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--color-divider); margin-top: auto; }
.dash-stages > div { padding: 10px 12px; display: flex; flex-direction: column; }
.dash-stages > div + div { border-left: 1px solid var(--color-divider); }
.dash-stages .text-muted { font-size: 12px; }
.dash-stages span:last-child { font-family: var(--font-heading); font-size: 24px; font-weight: 600; }
.dash-chart-head { display: flex; align-items: center; gap: 16px; }
.dash-chart-head .card-kicker { flex: 1; }
.dash-queue-row { display: flex; align-items: center; gap: 12px; padding: 9px 0; text-decoration: none; color: var(--color-text);
  border-bottom: 1px solid color-mix(in srgb, var(--color-text) 8%, transparent); }
.dash-queue-row .tag { width: 44px; justify-content: center; }
.dash-queue-title { flex: 1; min-width: 0; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-queue-row .text-muted { font-size: 12px; }
.dash-backup { margin: 0; font-size: 13px; text-decoration: none; }
@media (max-width: 1000px) { .dash-row3, .dash-row2 { grid-template-columns: 1fr; } .dash-head h1 { font-size: 34px; } }

.viz { width: 100%; height: auto; display: block; overflow: visible; }
.viz text { font-family: var(--font-body); font-size: 11px;
  paint-order: stroke; stroke: var(--color-bg); stroke-width: 3px; stroke-linejoin: round; }  /* a halo where text crosses a line */
.viz-label { fill: color-mix(in srgb, var(--color-text) 60%, transparent); }
.viz-value, .viz-end { fill: var(--color-text); }
.viz-end { font-size: 12px; font-weight: 600; }
.viz-axis, .viz-grid { stroke: var(--color-divider); stroke-width: 1; }
.viz-ref { stroke: color-mix(in srgb, var(--color-text) 35%, transparent); stroke-width: 1; }
.viz-bar { fill: var(--color-accent-500); }
.viz-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.viz-dot { stroke: var(--color-bg); stroke-width: 2; }
.viz-line.s1 { stroke: var(--series-1); } .viz-dot.s1, .viz-legend .s1 { fill: var(--series-1); background: var(--series-1); }
.viz-line.s2 { stroke: var(--series-2); } .viz-dot.s2, .viz-legend .s2 { fill: var(--series-2); background: var(--series-2); }
.viz-line.s3 { stroke: var(--series-3); } .viz-dot.s3, .viz-legend .s3 { fill: var(--series-3); background: var(--series-3); }
.viz-line.s4 { stroke: var(--series-4); } .viz-dot.s4, .viz-legend .s4 { fill: var(--series-4); background: var(--series-4); }
.viz-hit { fill: transparent; cursor: default; outline: none; }
.viz-hit:focus-visible { stroke: var(--color-accent); stroke-width: 1; }
.viz-legend { display: flex; gap: 14px; font-size: 12px; }
.viz-legend span { display: flex; align-items: center; gap: 6px; }
.viz-legend i { width: 16px; height: 2px; display: inline-block; }
.viz-table summary { font-size: 12px; cursor: pointer; color: color-mix(in srgb, var(--color-text) 60%, transparent); }
.viz-tip { position: absolute; z-index: 20; pointer-events: none; padding: 6px 10px; font-size: 12px; max-width: 320px;
  background: var(--color-surface, var(--color-bg)); color: var(--color-text); border: 1px solid var(--color-divider); box-shadow: var(--shadow-md); }

/* Projects (board screen 09) */
.projects-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 0; }
.projects-main { padding-right: 32px; display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.projects-h1 { margin: 0; font-size: 44px; }
.projects-board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.projects-column { display: flex; flex-direction: column; gap: 16px; border-top: 2px solid var(--color-text); padding-top: 10px; min-width: 0; }
.projects-column-head { display: flex; justify-content: space-between; font-family: var(--font-heading); font-weight: 600; font-size: 18px; }
.project-card { padding: 14px; gap: 8px; }
.project-card .card-title { text-decoration: none; color: var(--color-text); }
.project-card .btn { align-self: flex-start; }
.project-tags, .project-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.projects-side { border-left: 1px solid var(--color-divider); padding-left: 26px; display: flex; flex-direction: column; gap: 14px; }
.project-chip input { position: absolute; opacity: 0; pointer-events: none; }
.project-chip span { display: inline-block; font-size: 12px; padding: 3px 8px; border: 1px solid var(--color-divider); cursor: pointer; }
.project-chip input:checked + span { background: var(--color-accent-100); border-color: var(--color-accent); color: var(--color-accent-800); }
.project-chip input:focus-visible + span { outline: 2px solid var(--color-accent); outline-offset: 1px; }
.project-note { display: flex; flex-direction: column; gap: 4px; padding: 10px 0; border-top: 1px solid var(--color-divider); }
.project-note .math { white-space: pre-wrap; }
.project-seg { display: flex; gap: 6px; }
.project-seg .btn[disabled] { opacity: 1; cursor: default; }
.project-text { white-space: pre-wrap; margin: 0; }
.project-edit summary { cursor: pointer; list-style: none; }
.project-edit[open] summary { margin-bottom: 12px; }
@media (max-width: 1000px) {
  .projects-layout { grid-template-columns: 1fr; gap: 28px; }
  .projects-main { padding-right: 0; }
  .projects-board { grid-template-columns: 1fr; }
  .projects-side { border-left: 0; padding-left: 0; border-top: 1px solid var(--color-divider); padding-top: 20px; }
}

/* Search */
.nav-search { margin: 0; }
.nav-search .input { width: 150px; padding: 5px 10px; font-size: 13px; }
.search-form { display: flex; gap: 10px; margin-top: 14px; max-width: 720px; }
.search-form .input { flex: 1; }
.search-meta { display: block; margin-top: 8px; font-size: 13px; }
.search-group { display: flex; flex-direction: column; gap: 4px; max-width: 900px; }
.search-hit { display: flex; flex-direction: column; gap: 2px; padding: 10px 0; border-bottom: 1px solid var(--color-divider);
  text-decoration: none; color: var(--color-text); }
.search-hit:hover .search-where { text-decoration: underline; }
.search-where { font-size: 13px; color: var(--color-accent-700); }
.search-snippet { font-size: 14px; white-space: pre-wrap; }
.search-snippet mark { background: var(--color-accent-200); color: inherit; padding: 0 1px; }
@media (max-width: 1100px) { .nav-search { display: none; } }

/* Flashcards */
[hidden] { display: none !important; }  /* design-system classes (e.g. .btn) mustn't override it */
.card-session { display: flex; flex-direction: column; gap: 14px; max-width: 760px; }
.card-counts { display: flex; gap: 14px; align-items: baseline; }
.card-counts span:first-child { font-family: var(--font-heading); font-weight: 600; font-size: 28px; }
.flashcard { gap: 16px; min-height: 260px; }
.flashcard-text { font-size: 22px; line-height: 1.4; white-space: pre-wrap; }
.flashcard-back { display: flex; flex-direction: column; gap: 10px; padding-top: 16px; border-top: 1px solid var(--color-divider); }
.flashcard-show { align-self: flex-start; }
.flashcard-show .text-muted { color: inherit; opacity: .7; font-weight: 400; }
.flashcard-grades { display: flex; gap: 10px; flex-wrap: wrap; }
.flashcard-days { font-weight: 400; opacity: .75; margin-left: 4px; }
.card-form .math { white-space: pre-wrap; min-height: 1.4em; }
.card-preview { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border: 1px dashed var(--color-divider); }

/* Friends (Settings, admin) */
.invite-row { display: flex; flex-direction: column; gap: 4px; padding: 10px 0; border-top: 1px solid var(--color-divider); }
.invite-row .input { font-family: ui-monospace, monospace; font-size: 12px; }

/* Settings: a browser's Approve / Remove on one line */
.row-actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; white-space: nowrap; }

/* Staging copy (MITSTUDY_ENV=staging): impossible to mistake for the real site */
.staging-banner { background: repeating-linear-gradient(135deg, #c9a227 0 12px, #1a1a1a 12px 24px); text-align: center; padding: 5px 12px; }
.staging-banner span { background: #1a1a1a; color: #fff; font-size: 13px; font-weight: 600; letter-spacing: .04em; padding: 2px 10px; }
