/* QEHBS - Marking design system — ported from the "Modernist" tokens and component classes in
   the QEHBS Home Work prototype. Retune the look here; components in Components/Shared are thin
   wrappers over these classes. Mobile-first where it matters: every layout class below has a
   narrow-screen rule (see the "responsive" section at the end). */

@font-face {
  font-family: 'Archivo'; font-style: normal; font-weight: 400 800; font-stretch: 100%; font-display: swap;
  src: url("../fonts/archivo-vietnamese.woff2") format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: 'Archivo'; font-style: normal; font-weight: 400 800; font-stretch: 100%; font-display: swap;
  src: url("../fonts/archivo-latin-ext.woff2") format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Archivo'; font-style: normal; font-weight: 400 800; font-stretch: 100%; font-display: swap;
  src: url("../fonts/archivo-latin.woff2") format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --color-bg: #f3f2f2;
  --color-surface: #eae9e9;
  --color-text: #201e1d;
  --color-accent: #ec3013;
  --color-accent-2: #e15b47;
  --color-divider: color-mix(in srgb, #201e1d 40%, transparent);

  /* Tonal ramps — OKLCH on one shared lightness scale. */
  --color-neutral-100: #f8f4f4;
  --color-neutral-200: #eae7e7;
  --color-neutral-300: #d7d3d3;
  --color-neutral-400: #bab6b6;
  --color-neutral-500: #9b9797;
  --color-neutral-600: #7d7979;
  --color-neutral-700: #605d5d;
  --color-neutral-800: #444141;
  --color-neutral-900: #2d2b2b;

  --color-accent-100: #fff2ef;
  --color-accent-200: #ffe0d9;
  --color-accent-300: #ffc4b8;
  --color-accent-400: #ff9783;
  --color-accent-500: #ff563c;
  --color-accent-600: #dd2b0f;
  --color-accent-700: #ae1800;
  --color-accent-800: #7c1405;
  --color-accent-900: #4d170e;

  --color-accent-2-100: #fff2ef;
  --color-accent-2-200: #ffe0da;
  --color-accent-2-300: #ffc4b9;
  --color-accent-2-400: #ff9784;
  --color-accent-2-500: #ef6853;
  --color-accent-2-600: #c94b39;
  --color-accent-2-700: #9e3526;
  --color-accent-2-800: #71261b;
  --color-accent-2-900: #471d16;

  /* Primary action colour — the QEHBS logo yellow. The prototype applied this as a per-button
     override of --color-accent; it's a token of its own here. */
  --color-primary: #ffb800;
  --color-primary-600: #efa900;
  --color-primary-700: #d99a00;
  --color-on-primary: var(--color-neutral-900);

  --font-heading: "Archivo", system-ui, sans-serif;
  --font-heading-weight: 800;
  --font-body: "Archivo", system-ui, sans-serif;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;

  --radius-sm: 0px;
  --radius-md: 0px;
  --radius-lg: 0px;

  --shadow-sm: 0 1px 2px color-mix(in srgb, #2d2b2b 14%, transparent);
  --shadow-md: 0 3px 10px color-mix(in srgb, #2d2b2b 16%, transparent);
  --shadow-lg: 0 12px 32px color-mix(in srgb, #2d2b2b 22%, transparent);

  --page-gutter: 32px;
  --page-max: 1200px;
}

/* — base — */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-size: 15px; line-height: 1.55; font-weight: 400;
  background: var(--color-bg); color: var(--color-text); font-family: var(--font-body);
}
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading); font-weight: var(--font-heading-weight);
  line-height: 1.12; letter-spacing: -0.015em; margin: 0 0 var(--space-2);
}
h1 { font-size: 42px; }
h2 { font-size: 32px; }
h3 { font-size: 25px; }
h4 { font-size: 20px; }
h5 { font-size: 16px; }
h6 { font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; }
p { margin: 0 0 var(--space-3); }
a { color: var(--color-accent-700); text-underline-offset: 3px; }
a:hover { color: var(--color-accent); }
img { display: block; max-width: 100%; }
figure { margin: 0; }
.text-muted { color: color-mix(in srgb, var(--color-text) 55%, transparent); }
.text-error { color: var(--color-accent-700); font-size: 13px; margin: 0; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--color-accent) 30%, transparent); }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* — rules — */
.hr { height: 2px; border: 0; margin: var(--space-4) 0; background: var(--color-divider); }

/* — buttons — */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  cursor: pointer; text-decoration: none;
  font-family: var(--font-heading); font-weight: var(--font-heading-weight);
  font-size: 14px; line-height: 1.2; color: var(--color-text);
  background: transparent; border: 1px solid transparent;
  padding: var(--space-2) calc(var(--space-3) * 1.2);
  border-radius: var(--radius-md);
  min-height: 36px;
}
.btn svg { display: block; flex: none; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--color-primary); color: var(--color-on-primary); }
.btn-primary:hover:not(:disabled) { background: var(--color-primary-600); color: var(--color-on-primary); }
.btn-primary:active:not(:disabled) { background: var(--color-primary-700); }
.btn-secondary { border-color: var(--color-divider); }
.btn-secondary:hover:not(:disabled) { background: color-mix(in srgb, var(--color-text) 7%, transparent); color: var(--color-text); }
.btn-secondary:active:not(:disabled) { background: color-mix(in srgb, var(--color-text) 14%, transparent); }
.btn-ghost { color: var(--color-accent-700); padding-inline: var(--space-1); }
.btn-ghost:hover:not(:disabled) { color: var(--color-accent-700); background: color-mix(in srgb, var(--color-accent) 10%, transparent); }
.btn-ghost:active:not(:disabled) { background: color-mix(in srgb, var(--color-accent) 18%, transparent); }
.btn-icon { width: 36px; height: 36px; padding: 0; }
.btn-sm { padding: 6px 12px; font-size: 13px; min-height: 32px; }
.btn-block { width: 100%; margin-top: var(--space-2); }
.btn-back { align-self: flex-start; padding: 4px 0; }

/* — forms — */
.field > label {
  display: block; font-size: 12px; margin-bottom: 5px;
  color: color-mix(in srgb, var(--color-text) 70%, transparent);
}
.field-hint { font-size: 12px; margin: 5px 0 0; }
.input {
  width: 100%; min-height: 36px; padding: 6px 10px; font: inherit;
  font-size: 14px; color: var(--color-text); caret-color: var(--color-accent);
  background: var(--color-surface);
  border: 1px solid var(--color-divider); border-radius: var(--radius-md);
}
.input:hover { border-color: color-mix(in srgb, var(--color-text) 45%, transparent); }
.input:focus-visible { border-color: var(--color-accent); outline-offset: 0; }
.input:disabled { opacity: 0.6; }
textarea.input { min-height: 90px; resize: vertical; }
.form-grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-3); }

.radio { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.radio input, .seg-opt input { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.radio .dot { width: 16px; height: 16px; flex: none; border-radius: 50%; border: 1.5px solid var(--color-divider); }
.radio:hover .dot { border-color: var(--color-accent); }
.radio input:checked + .dot {
  border-color: var(--color-accent); background: var(--color-accent);
  box-shadow: inset 0 0 0 4px var(--color-bg);
}
.radio input:focus-visible + .dot { outline: 2px solid var(--color-accent); outline-offset: 2px; }

/* Checkbox — same construction as .radio, square mark. */
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; position: relative; }
.check input { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.check .box {
  width: 18px; height: 18px; flex: none; border: 1.5px solid var(--color-divider);
  display: grid; place-items: center; background: var(--color-bg);
}
.check:hover .box { border-color: var(--color-accent); }
.check input:checked + .box { border-color: var(--color-accent); background: var(--color-accent); }
.check input:checked + .box::after {
  content: ""; width: 5px; height: 10px; margin-top: -2px;
  border: solid var(--color-bg); border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.check input:focus-visible + .box { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.check:has(input:disabled) { cursor: not-allowed; opacity: 0.5; }

/* Callouts — information or a problem the person should act on. */
.notice {
  padding: 12px 14px; font-size: 14px; background: var(--color-surface);
  border-left: 3px solid var(--color-primary);
}
.notice-error { border-left-color: var(--color-accent); background: var(--color-accent-100); color: var(--color-accent-800); }

/* Segmented control — scrolls sideways instead of overflowing the page on narrow screens. */
.seg {
  display: inline-flex; max-width: 100%; overflow-x: auto; scrollbar-width: thin;
  border: 1px solid var(--color-divider); border-radius: var(--radius-md);
}
.seg-opt {
  display: inline-flex; align-items: center; gap: 6px; flex: none; white-space: nowrap;
  padding: 7px 12px; font-size: 13px; cursor: pointer;
}
.seg-opt + .seg-opt { border-left: 1px solid var(--color-divider); }
.seg-opt:has(input:checked) { background: var(--color-accent); color: var(--color-bg); }
.seg-opt:not(:has(input:checked)):hover { background: color-mix(in srgb, var(--color-text) 7%, transparent); }
.seg-opt:has(input:focus-visible) { outline: 2px solid var(--color-accent); outline-offset: -2px; }

/* Drop zone for file uploads — a transparent file input covers it (see FileDropZone.razor). */
.dropzone {
  position: relative;
  border: 2px dashed var(--color-divider); padding: 28px; background: var(--color-surface);
  display: flex; flex-direction: column; gap: 10px; align-items: flex-start;
}
.dropzone-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 1; }
.dropzone:hover, .dropzone:focus-within { border-color: var(--color-accent); }
.dropzone.is-busy { opacity: 0.6; }
.dropzone-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 4px; }
.dropzone-actions > :not(:first-child) { position: relative; z-index: 2; }

/* A list of files with actions. */
.file-list { display: flex; flex-direction: column; border-top: 1px solid var(--color-divider); }
.file-row { display: flex; align-items: center; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--color-divider); flex-wrap: wrap; }
.file-row-actions { margin-left: auto; display: flex; gap: 8px; }

/* Week picker: ‹ [Week 6 · 12–18 October] › */
.week-picker { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 6px; align-items: center; }
.week-picker select[aria-label="Term"] { grid-column: 1 / -1; }
.week-picker select.input { width: 100%; min-width: 0; }

/* — cards — */
.card {
  display: flex; flex-direction: column; gap: var(--space-2);
  padding: var(--space-3); border-radius: var(--radius-md); background: var(--color-surface);
}
.card-kicker { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--color-accent); }
.card-title { font-family: var(--font-heading); font-weight: var(--font-heading-weight); font-size: 17px; line-height: 1.2; }
.card-body { margin: 0; font-size: 13px; opacity: 0.8; flex: 1; }
.card-meta { display: flex; align-items: center; gap: 6px; font-size: 11px; color: color-mix(in srgb, var(--color-text) 50%, transparent); }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 20px; }
.elev-sm { box-shadow: var(--shadow-sm); }
.elev-md { box-shadow: var(--shadow-md); }
.elev-lg { box-shadow: var(--shadow-lg); }

/* — tags — */
.tag {
  display: inline-flex; align-items: center; font-size: 11px; white-space: nowrap;
  letter-spacing: 0.02em; padding: 3px 10px;
  border-radius: calc(var(--radius-md) * 0.75);
}
.tag-accent { background: var(--color-accent-100); color: var(--color-accent-800); }
.tag-accent-2 { background: var(--color-accent-2-100); color: var(--color-accent-2-800); }
.tag-neutral { background: var(--color-neutral-100); color: var(--color-neutral-800); }
.tag-outline { border: 1px solid var(--color-accent); color: var(--color-accent); }

/* — tables — always inside .table-wrap so wide tables scroll rather than break the page — */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap;
  color: color-mix(in srgb, var(--color-text) 60%, transparent);
  padding: var(--space-2); border-bottom: 2px solid var(--color-divider);
}
.table td { padding: var(--space-2); border-bottom: 1px solid var(--color-divider); vertical-align: middle; }
.table tbody tr:hover { background: color-mix(in srgb, var(--color-text) 4%, transparent); }
.table .cell-actions { text-align: right; white-space: nowrap; }

/* — dialog — */
.dialog-backdrop {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  padding: var(--space-6); overflow-y: auto;
  background: color-mix(in srgb, var(--color-neutral-900) 50%, transparent);
}
.dialog {
  width: min(460px, 100%); max-height: calc(100vh - 48px); overflow-y: auto;
  display: flex; flex-direction: column; gap: var(--space-3);
  padding: var(--space-4); border-radius: var(--radius-lg);
  background: var(--color-surface); box-shadow: var(--shadow-lg);
}
.dialog-title { font-family: var(--font-heading); font-weight: var(--font-heading-weight); font-size: 20px; }
.dialog-body { font-size: 14px; display: flex; flex-direction: column; gap: 14px; }
.dialog-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-2); }

/* — toast — */
.toast {
  position: fixed; left: 24px; bottom: 24px; z-index: 60; max-width: 420px;
  background: var(--color-neutral-900); color: var(--color-bg);
  padding: 12px 16px; font-size: 14px; box-shadow: var(--shadow-lg);
}

/* ══ App shell ══════════════════════════════════════════════════════════ */

.shell { min-height: 100vh; display: flex; flex-direction: column; background: var(--color-bg); }

/* Top bar: brand · nav links · user area. On narrow screens the links and user area fold into
   a menu opened by the ☰ button — a CSS-only checkbox toggle, so it works on statically
   rendered pages as well as interactive ones. */
.topbar {
  position: relative; display: flex; align-items: center; gap: var(--space-4);
  padding: var(--space-3) var(--space-4); border-bottom: 2px solid var(--color-divider);
  background: var(--color-bg);
}
.brand {
  display: inline-flex; align-items: center; gap: 10px; margin-right: auto;
  font-family: var(--font-heading); font-weight: var(--font-heading-weight); font-size: 18px;
  color: inherit; text-decoration: none; white-space: nowrap;
}
.brand:hover { color: inherit; }
.brand img { width: 36px; height: 36px; flex: none; }
.topbar-menu { display: flex; align-items: center; gap: var(--space-4); }
.topbar-links { display: flex; align-items: center; gap: var(--space-4); }
.topbar-links a {
  display: inline-flex; align-items: center; gap: 6px;
  color: inherit; text-decoration: none; font-size: 14px; white-space: nowrap;
}
.topbar-links a:hover, .topbar-links a[aria-current='page'] { color: var(--color-accent); }
.topbar-user { display: flex; align-items: center; gap: var(--space-4); margin-left: var(--space-4); }
.topbar-user-label {
  font-size: 12px; max-width: 24ch; line-height: 1.3;
  overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.topbar-user a { font-size: 13px; white-space: nowrap; }
.topbar-user form { margin: 0; }
.topbar-user .btn { white-space: nowrap; }
.topbar-toggle { display: none; }
.topbar-toggle-btn { display: none; }

.page {
  width: 100%; max-width: var(--page-max); margin: 0 auto;
  padding: var(--page-gutter) var(--page-gutter) 96px;
  display: flex; flex-direction: column; gap: 20px;
}
.page-narrow { max-width: calc(760px + 2 * var(--page-gutter)); }

/* Page header: kicker + heading on the left, actions/filters on the right; wraps when tight. */
.page-header { display: flex; align-items: flex-end; gap: 12px 20px; flex-wrap: wrap; }
.page-header-kicker { margin: 0 0 4px; color: var(--color-accent-700); }
.page-header h2 { margin: 0; }
.page-header-sub { margin: 6px 0 0; font-size: 14px; max-width: 60ch; }
.page-header-actions { margin-left: auto; display: flex; gap: 8px 12px; align-items: center; flex-wrap: wrap; }

/* Two-pane layouts (review screen, new-task form): side by side with a divider on wide
   screens, stacked with a top rule on narrow ones. */
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.split > :first-child { padding-right: 28px; border-right: 2px solid var(--color-divider); }
.split > :last-child { padding-left: 28px; }
.stack { display: flex; flex-direction: column; gap: 14px; }

/* One column per tuition group (Weekly tasks) — divided like the prototype on wide screens,
   stacked with rules between them on narrow ones. */
.group-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); border-top: 1px solid var(--color-divider); }
.group-column { padding: 20px 20px 20px 0; border-right: 2px solid var(--color-divider); display: flex; flex-direction: column; gap: 12px; }
.group-column + .group-column { padding-left: 20px; }
.group-column:last-child { border-right: 0; }
/* Feedback: What went well | Next steps, divided like the prototype; stacked on phones. */
.feedback-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); border-top: 2px solid var(--color-divider); }
.feedback-columns > div { padding: 16px 0; }
.feedback-columns > div:first-child { padding-right: 20px; }
.feedback-columns > div + div { padding-left: 20px; border-left: 2px solid var(--color-divider); }
@media (max-width: 600px) {
  .feedback-columns > div:first-child { padding-right: 0; }
  .feedback-columns > div + div { padding-left: 0; border-left: 0; border-top: 1px solid var(--color-divider); }
}

/* Thumbnails of uploaded pages on the review screen. */
.page-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.page-thumbs a { display: block; border: 1px solid var(--color-neutral-300); background: var(--color-neutral-200); aspect-ratio: 3 / 4; overflow: hidden; }
.page-thumbs img { width: 100%; height: 100%; object-fit: cover; object-position: top; }

/* — submissions grid: students down, the week's tasks across; the name column stays put while it scrolls — */
.matrix-summary { display: flex; flex-wrap: wrap; gap: 6px 20px; font-size: 14px; }
.matrix th, .matrix td { white-space: nowrap; }
.matrix th:first-child, .matrix td:first-child { position: sticky; left: 0; z-index: 1; background: var(--color-bg); }
.matrix-task { display: flex; flex-direction: column; gap: 2px; min-width: 150px; color: inherit; text-decoration: none; }
.matrix-task-title { font-weight: 400; text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--color-text); white-space: normal; }
.matrix-cell { display: inline-flex; gap: 6px; align-items: center; text-decoration: none; min-height: 32px; }
.matrix-cell:hover .tag { filter: brightness(0.95); text-decoration: underline; }

.task-item { display: flex; flex-direction: column; gap: 4px; padding: 10px 0; border-bottom: 1px solid var(--color-divider); color: inherit; text-decoration: none; }
.task-item:hover { color: inherit; background: color-mix(in srgb, var(--color-text) 4%, transparent); }

/* Signed-out landing: hero + sign-in form. */
.hero { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); border-bottom: 2px solid var(--color-divider); }
.hero-intro { padding: 64px 48px; display: flex; flex-direction: column; gap: 16px; border-right: 2px solid var(--color-divider); }
.hero-intro img { width: 96px; height: 96px; }
.hero-intro h1 { margin: 0; max-width: 12ch; }
.hero-intro p { margin: 0; max-width: 44ch; font-size: 16px; text-wrap: pretty; }
.hero-form { padding: 64px 48px; display: flex; flex-direction: column; gap: 20px; width: 100%; max-width: 520px; }

/* ══ Responsive ═════════════════════════════════════════════════════════ */

/* Tablet and below: fold the top bar into a menu. */
@media (max-width: 960px) {
  .topbar { flex-wrap: wrap; }
  .topbar-toggle-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; cursor: pointer; border: 1px solid var(--color-divider);
  }
  .topbar-toggle:focus-visible + .topbar-toggle-btn { outline: 2px solid var(--color-accent); outline-offset: 2px; }
  .topbar-menu {
    display: none; width: 100%; flex-direction: column; align-items: stretch; gap: 0;
    border-top: 1px solid var(--color-divider); margin-top: var(--space-2);
  }
  .topbar-toggle:checked ~ .topbar-menu { display: flex; }
  .topbar-links { flex-direction: column; align-items: stretch; gap: 0; }
  .topbar-links a { padding: 12px 4px; border-bottom: 1px solid color-mix(in srgb, var(--color-text) 15%, transparent); font-size: 15px; }
  .topbar-user { margin-left: 0; padding: 12px 4px 4px; flex-wrap: wrap; gap: 8px 16px; }
  .topbar-user-label { flex-basis: 100%; max-width: none; }

  .hero { grid-template-columns: minmax(0, 1fr); }
  .hero-intro { border-right: 0; border-bottom: 2px solid var(--color-divider); padding: 40px 32px; }
  .hero-form { padding: 40px 32px; max-width: none; }

  .group-column, .group-column + .group-column { padding: 16px 0; border-right: 0; border-bottom: 2px solid var(--color-divider); }

  .split { grid-template-columns: minmax(0, 1fr); }
  .split > :first-child { padding: 0 0 24px; border-right: 0; }
  .split > :last-child { padding: 24px 0 0; border-top: 2px solid var(--color-divider); }
}

/* Phone. */
@media (max-width: 600px) {
  :root { --page-gutter: 16px; }
  body { font-size: 15px; }
  h1 { font-size: 32px; }
  h2 { font-size: 26px; }
  h3 { font-size: 22px; }
  .page { padding-bottom: 64px; gap: 16px; }
  .topbar { padding: var(--space-2) var(--page-gutter); }
  .brand { font-size: 16px; }
  .brand img { width: 32px; height: 32px; }
  .hero-intro { padding: 28px var(--page-gutter); gap: 12px; }
  .hero-intro img { width: 64px; height: 64px; }
  .hero-form { padding: 28px var(--page-gutter); }
  .page-header-actions { margin-left: 0; width: 100%; }
  .page-header-actions .week-picker { width: 100%; }
  .form-grid-2 { grid-template-columns: minmax(0, 1fr); }
  .btn { min-height: 44px; }               /* comfortable touch targets */
  .btn-sm { min-height: 36px; }
  .input { min-height: 44px; font-size: 16px; }  /* 16px stops iOS zooming on focus */
  .table-wrap .table td { white-space: nowrap; }  /* compact rows; the wrapper scrolls instead */

  /* .table-cards: for tables with controls in their rows — each row becomes a card and each
     cell shows its column name (data-label) instead of scrolling sideways. */
  .table-cards thead { display: none; }
  .table-cards, .table-cards tbody, .table-cards tr, .table-cards td { display: block; width: 100%; }
  .table-cards tr { padding: 10px 0; border-bottom: 2px solid var(--color-divider); }
  .table-cards tbody tr:hover { background: none; }
  .table-cards td { border: 0; padding: 4px 0; white-space: normal !important; }
  .table-cards td[data-label]::before {
    content: attr(data-label); display: block; font-size: 11px; letter-spacing: 0.08em;
    text-transform: uppercase; color: color-mix(in srgb, var(--color-text) 60%, transparent);
  }
  .table-cards .cell-actions { text-align: left; }
  .dropzone { padding: 20px; }
  .dialog-backdrop { padding: var(--space-3); align-items: end; }
  .dialog { max-height: calc(100vh - 24px); }
  .dialog-actions .btn { flex: 1; }
  .toast { left: var(--space-3); right: var(--space-3); bottom: var(--space-3); max-width: none; }
}

/* — subjects list (admin): a tick per subject, its task count and actions — */
.subject-list { display: flex; flex-direction: column; border-top: 2px solid var(--color-divider); }
.subject-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--color-divider); flex-wrap: wrap; }
.subject-add { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
