/* LTDC LMS design system.
   Layout follows the school's current LMS (white top bar with the seal and term, icon sidebar,
   breadcrumbs, class header card, tabbed class page, dark mode) with one brand colour throughout.
   --brand and --accent come from Settings → Branding (set on :root by js/shell.js);
   every shade is mixed from them, so any school colour works. */

@font-face { font-family: 'DM Sans'; src: url('../fonts/DMSans-Regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'DM Sans'; src: url('../fonts/DMSans-Medium.ttf') format('truetype'); font-weight: 500 600; font-display: swap; }
@font-face { font-family: 'DM Sans'; src: url('../fonts/DMSans-Bold.ttf') format('truetype'); font-weight: 700 800; font-display: swap; }

:root {
  --brand: #5d0013;
  --accent: #c28618;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --text: #111827;
  --text-2: #374151;
  --muted: #6b7280;
  --brand-ink: #ffffff;
  --brand-soft: color-mix(in srgb, var(--brand) 9%, var(--surface));
  --brand-softer: color-mix(in srgb, var(--brand) 4%, var(--surface));
  --brand-line: color-mix(in srgb, var(--brand) 28%, var(--surface));
  --brand-strong: color-mix(in srgb, var(--brand) 82%, #000);
  --brand-text: var(--brand);
  --accent-soft: color-mix(in srgb, var(--accent) 14%, var(--surface));
  --success: #15803d; --success-soft: #dcfce7;
  --warn: #a16207; --warn-soft: #fef3c7;
  --danger: #b91c1c; --danger-soft: #fee2e2;
  --info: #1d4ed8; --info-soft: #dbeafe;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.14);
  --topbar: 64px;
  --sidebar: 256px;
  color-scheme: light;
  font-family: 'DM Sans', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  color: var(--text);
}
:root[data-theme='dark'] {
  --bg: #0b1120;
  --surface: #111827;
  --surface-2: #162032;
  --border: #243044;
  --border-strong: #334155;
  --text: #e5e7eb;
  --text-2: #cbd5e1;
  --muted: #94a3b8;
  --brand-soft: color-mix(in srgb, var(--brand) 26%, var(--surface));
  --brand-softer: color-mix(in srgb, var(--brand) 14%, var(--surface));
  --brand-line: color-mix(in srgb, var(--brand) 50%, var(--surface));
  --brand-text: color-mix(in srgb, var(--brand) 45%, #fff);
  --accent-soft: color-mix(in srgb, var(--accent) 22%, var(--surface));
  --success: #4ade80; --success-soft: #14532d55;
  --warn: #fbbf24; --warn-soft: #78350f55;
  --danger: #f87171; --danger-soft: #7f1d1d55;
  --info: #93c5fd; --info-soft: #1e3a8a55;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); }
body { line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--brand-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.2; margin: 2px 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--text); }
h2 { font-size: 16px; font-weight: 700; margin: 0 0 14px; color: var(--text); }
h3 { font-size: 14px; font-weight: 700; margin: 22px 0 10px; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.04em; }
code { background: var(--brand-soft); color: var(--brand-text); padding: 1px 6px; border-radius: 4px; font-size: 0.92em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, 'SFMono-Regular', Consolas, monospace; font-size: 0.92em; }
.pre { white-space: pre-wrap; line-height: 1.6; margin: 0; }
.spacer { flex: 1; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.hint { font-size: 12px; color: var(--muted); margin: 0; font-weight: 400; }
.ic { flex: none; vertical-align: -3px; }

/* ===== App shell ===== */
body.booting .app, body.booting #auth { visibility: hidden; }
body.auth-mode .app { display: none; }
body:not(.auth-mode) #auth { display: none; }

.topbar { position: sticky; top: 0; z-index: 40; height: var(--topbar); display: flex; align-items: center; gap: 12px; padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar .brand { display: flex; align-items: center; gap: 12px; color: var(--text); min-width: 0; }
.topbar .brand > span { min-width: 0; overflow: hidden; }
.topbar .brand { flex: 0 1 auto; }
.topbar .brand:hover { text-decoration: none; }
.topbar .brand img { height: 40px; width: auto; max-width: 140px; object-fit: contain; }
.topbar .brand strong { display: block; font-size: 15px; font-weight: 700; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .brand small { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-chip { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 10px; font-weight: 700; letter-spacing: 0.06em; vertical-align: 2px; }
.topbar-spacer { flex: 1; }
.round-btn { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); display: inline-grid; place-items: center; cursor: pointer; position: relative; }
.round-btn:hover { background: var(--surface-2); }
.round-btn .dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); border: 2px solid var(--surface); }

.user-menu { position: relative; }
.user-btn { display: flex; align-items: center; gap: 10px; padding: 4px 8px 4px 4px; border: 0; background: none; color: var(--text); cursor: pointer; border-radius: 999px; font: inherit; text-align: left; }
.user-btn:hover { background: var(--surface-2); }
.user-btn strong { display: block; font-size: 13px; line-height: 1.2; }
.user-btn small { display: block; font-size: 12px; color: var(--muted); }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-text); display: inline-grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.avatar.lg { width: 56px; height: 56px; font-size: 19px; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; z-index: 60; }
.menu-pop button, .menu-pop a { display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 10px; border: 0; background: none; border-radius: var(--radius-sm); color: var(--text); font: inherit; cursor: pointer; text-align: left; }
.menu-pop button:hover, .menu-pop a:hover { background: var(--surface-2); text-decoration: none; }
.menu-pop .who { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.menu-pop .who small { color: var(--muted); display: block; }
.menu-sep { height: 1px; background: var(--border); margin: 6px 0; }
.menu-label { padding: 6px 10px 4px; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.menu-pop button .grow { flex: 1; }
.menu-pop button.on { background: var(--brand-soft); color: var(--brand-text); font-weight: 600; }
.menu-pop { max-height: calc(100vh - var(--topbar) - 16px); overflow-y: auto; }
.topbar .brand small .campus-name, .campus-name { display: inline; font-size: inherit; font-weight: 600; color: var(--text-2); }

.layout { display: flex; min-height: calc(100vh - var(--topbar)); }
.sidebar { width: var(--sidebar); flex: none; position: sticky; top: var(--topbar); height: calc(100vh - var(--topbar)); overflow-y: auto; background: var(--surface); border-right: 1px solid var(--border); padding: 12px 10px; display: flex; flex-direction: column; }
#nav a { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: var(--radius-sm); color: var(--text-2); font-weight: 500; margin-bottom: 2px; white-space: nowrap; position: relative; }
#nav a:hover { background: var(--surface-2); text-decoration: none; }
#nav a.active { background: var(--brand-soft); color: var(--brand-text); font-weight: 700; }
#nav a.active::before { content: ''; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand); }
#nav .label { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.nav-heading { margin: 16px 12px 6px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.nav-badge { min-width: 20px; padding: 1px 7px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; text-align: center; }
.side-foot { margin-top: auto; padding: 12px; font-size: 11px; color: var(--muted); }
/* Desktop: the menu button folds the sidebar to icons only. */
body.nav-mini .sidebar { width: 68px; }
body.nav-mini #nav .label, body.nav-mini .nav-heading, body.nav-mini .nav-badge, body.nav-mini .side-foot { display: none; }
body.nav-mini #nav a { justify-content: center; padding: 10px; }

main { flex: 1; min-width: 0; padding: 20px 28px 56px; max-width: 1360px; }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 8px; flex-wrap: wrap; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--brand-text); }
.crumbs .cur { color: var(--text-2); font-weight: 500; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions.end { justify-content: flex-end; }
.stack { display: flex; flex-direction: column; gap: 16px; margin-bottom: 16px; }
.stack.tight { gap: 12px; margin: 0; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; align-items: start; }
.cols.wide-left { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }
.card + .card, .card.scroll-x + .card, .cols + .card, .cols + .cols, .card + .cols { margin-top: 16px; }
.cols > .card + .card, .stats > .card + .card, .tiles > * + *, .stack > .card + .card { margin-top: 0; }

/* ===== Surfaces ===== */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.card-head h2 { margin: 0; display: flex; align-items: center; gap: 8px; }
.card-head a { font-size: 13px; font-weight: 500; }
.card.empty, .empty { text-align: center; padding: 36px 20px; color: var(--muted); }
.empty h2 { color: var(--text); margin-bottom: 6px; }
.empty .ic { color: var(--brand-line); margin-bottom: 6px; }
.scroll-x { overflow-x: auto; padding: 0; }
.scroll-x > h2 { padding: 18px 20px 0; }
.notice { display: flex; gap: 10px; align-items: flex-start; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--surface)); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px; color: var(--text); }
.notice p { margin: 0; }
.notice.info { background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 30%, var(--surface)); }
.notice.ok { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 30%, var(--surface)); }
.notice.bad { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, var(--surface)); }

/* ===== Buttons ===== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 14px; min-height: 36px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; transition: background 0.12s, border-color 0.12s, color 0.12s; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
.btn.gold { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger.ghost, .btn.ghost.danger { background: var(--surface); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--surface)); }
.btn.danger.ghost:hover { background: var(--danger-soft); }
.btn.quiet { border-color: transparent; background: transparent; }
.btn.quiet:hover { background: var(--surface-2); }
.btn.sm { padding: 4px 10px; min-height: 30px; font-size: 13px; }
.btn.block { width: 100%; padding: 11px 16px; font-size: 15px; }
.btn.big { padding: 12px 22px; font-size: 15px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.link { background: none; border: 0; color: var(--brand-text); cursor: pointer; font: inherit; font-weight: 600; padding: 0 2px; }
.link:hover { text-decoration: underline; }
.link.danger { color: var(--danger); }
.link:disabled { color: var(--muted); cursor: not-allowed; text-decoration: none; }
.icon-btn { background: none; border: 0; padding: 6px; border-radius: var(--radius-sm); cursor: pointer; color: var(--muted); display: inline-grid; place-items: center; font-size: 20px; line-height: 1; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.danger:hover { color: var(--danger); background: var(--danger-soft); }
.icon-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* ===== Forms ===== */
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span:first-child { font-weight: 600; font-size: 13px; color: var(--text-2); }
.field em { color: var(--danger); font-style: normal; margin-left: 2px; }
.field.check { flex-direction: row; align-items: flex-start; gap: 10px; }
.field.check > span:first-child, .field.check span { font-weight: 400; color: var(--text); }
.field.check input { margin-top: 2px; }
input, select, textarea { font: inherit; padding: 9px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); width: 100%; }
input[type='checkbox'], input[type='radio'] { width: 16px; height: 16px; accent-color: var(--brand); flex: none; padding: 0; }
input[type='color'] { padding: 2px; height: 38px; width: 64px; }
input:focus, select:focus, textarea:focus { outline: 3px solid color-mix(in srgb, var(--brand) 22%, transparent); border-color: var(--brand); }
textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.days, .checks { display: flex; gap: 14px; flex-wrap: wrap; }
.checks { flex-direction: column; gap: 8px; }
.days label, .checks label { display: flex; align-items: center; gap: 6px; }
.form-error { color: var(--danger); background: var(--danger-soft); border: 1px solid color-mix(in srgb, var(--danger) 25%, var(--surface)); padding: 10px 12px; border-radius: var(--radius-sm); margin: 0; }
.toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.toolbar input[type='search'] { max-width: 320px; }
.toolbar select { width: auto; }
label.inline { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 5px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.chip:hover { background: var(--surface-2); }
.chip.on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.meeting-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ===== Tables ===== */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 700; padding: 11px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table td small { display: block; color: var(--muted); font-size: 12px; }
.table.clickable tbody tr { cursor: pointer; }
.table tbody tr:hover { background: var(--brand-softer); }
.num { text-align: right !important; font-variant-numeric: tabular-nums; white-space: nowrap; }
.warn { color: var(--warn); font-weight: 700; }
.row-actions { white-space: nowrap; text-align: right; }
.row-actions .btn + .btn { margin-left: 6px; }
.notes { color: var(--muted); max-width: 240px; }
.matrix .center { text-align: center; }

/* ===== Badges, stats ===== */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); white-space: nowrap; line-height: 1.5; }
.badge.green { background: var(--success-soft); color: var(--success); border-color: transparent; }
.badge.amber { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.blue { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge.red { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge.gray { background: var(--surface-2); color: var(--muted); }
.badge.brand, .badge.maroon { background: var(--brand-soft); color: var(--brand-text); border-color: transparent; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stats .card { padding: 16px 18px; color: var(--text); display: block; }
.stats a.card:hover { border-color: var(--brand-line); text-decoration: none; }
.stats small { display: block; color: var(--muted); font-size: 12px; font-weight: 600; margin-bottom: 6px; }
.stats strong { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; overflow-wrap: anywhere; }
.stats .card.accent { border-color: var(--brand-line); background: var(--brand-softer); }
.stats .card.accent strong { color: var(--brand-text); }
.stats.small { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; }
.stats.small strong { font-size: 20px; }
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin: 0; }
.info dt { font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.info dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.progress { height: 6px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--brand); border-radius: 999px; }
.seats { display: inline-flex; align-items: center; gap: 8px; }
.seat-bar { width: 70px; height: 6px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.seat-bar i { display: block; height: 100%; background: var(--success); }
.seat-bar.tight i { background: var(--accent); }
.seat-bar.full i { background: var(--danger); }
.reason { color: var(--muted); font-size: 12px; max-width: 280px; display: inline-block; }
.prereq { font-size: 12px; color: var(--muted); }

/* ===== Tabs ===== */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--brand-text); border-bottom-color: var(--brand); }
.tabs .count { font-size: 11px; padding: 0 7px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); }

/* ===== Class header (like the current LMS's class card, plus schedule and progress) ===== */
.class-head { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 0; padding: 0; overflow: hidden; margin-bottom: 18px; }
.class-head .main { padding: 20px 22px; border-left: 4px solid var(--brand); }
.class-head .code { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-text); margin-bottom: 8px; }
.class-head h1 { font-size: 24px; margin: 0 0 10px; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--muted); font-size: 13px; }
.meta span { display: inline-flex; align-items: center; gap: 6px; }
.class-head .teacher { padding: 20px 22px; background: var(--surface-2); border-left: 1px solid var(--border); display: flex; gap: 14px; align-items: center; }
.class-head .teacher small { display: block; color: var(--muted); font-size: 12px; }
.class-head .teacher strong { display: block; font-size: 15px; }

/* ===== Tiles, lists ===== */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.tile { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); box-shadow: var(--shadow); position: relative; overflow: hidden; transition: border-color 0.12s, box-shadow 0.12s, transform 0.12s; }
.tile::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--brand); opacity: 0.85; }
a.tile:hover { text-decoration: none; border-color: var(--brand-line); box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.tile .code { font-size: 12px; font-weight: 700; color: var(--brand-text); letter-spacing: 0.02em; margin-top: 4px; }
.tile strong { font-size: 16px; line-height: 1.3; }
.tile small { color: var(--muted); }
.tile .meta { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border); font-size: 12px; }
.tile .progress { margin-top: 4px; }

.list { display: flex; flex-direction: column; }
.list-item { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--border); color: var(--text); }
.list-item:last-child { border-bottom: 0; padding-bottom: 0; }
.list-item:first-child { padding-top: 0; }
a.list-item:hover { text-decoration: none; }
a.list-item:hover strong { color: var(--brand-text); }
.list-item .grow { flex: 1; min-width: 0; }
.list-item small { display: block; color: var(--muted); font-size: 12px; }
.item-ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-text); flex: none; }
.item-ic.warn { background: var(--warn-soft); color: var(--warn); }
.item-ic.danger { background: var(--danger-soft); color: var(--danger); }
.item-ic.ok { background: var(--success-soft); color: var(--success); }
.item-ic.info { background: var(--info-soft); color: var(--info); }
.date-box { width: 46px; flex: none; text-align: center; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface); }
.date-box b { display: block; background: var(--brand); color: var(--brand-ink); font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; padding: 2px 0; }
.date-box span { display: block; font-size: 18px; font-weight: 700; padding: 2px 0 3px; }
.feed-item { padding: 10px 0; border-bottom: 1px solid var(--border); }
.feed-item:last-child { border-bottom: 0; }
.feed-item small { display: block; color: var(--muted); }

.posts { display: flex; flex-direction: column; gap: 12px; }
.post { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.post header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 8px; }
.post h3 { margin: 0; text-transform: none; font-size: 17px; letter-spacing: 0; color: var(--text); display: flex; align-items: center; gap: 8px; }
.post .by { font-size: 12px; color: var(--muted); }
.post.draft { background: var(--surface-2); border-style: dashed; }
.post .attach { display: inline-flex; align-items: center; gap: 8px; margin-top: 10px; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); background: var(--surface-2); }
.author { display: flex; gap: 10px; align-items: center; }
.author strong { display: block; font-size: 14px; }
.reactions { display: flex; gap: 6px; align-items: center; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.react { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text-2); font: inherit; font-size: 13px; cursor: pointer; }
.react:hover { background: var(--surface-2); }
.react.on { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand-text); font-weight: 600; }
.comments { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.comment { display: flex; gap: 10px; align-items: flex-start; }
.comment .bubble { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 8px 12px; flex: 1; }
.comment .bubble b { font-size: 13px; }
.comment .avatar { width: 30px; height: 30px; font-size: 11px; }
.comment-form { display: flex; gap: 8px; margin-top: 10px; }
.comment-form input { flex: 1; }

/* Resources: list beside a preview pane (as in the current LMS, with readable sizes) */
.res-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 16px; align-items: start; }
.res-item { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); cursor: pointer; margin-bottom: 8px; }
.res-item:hover { border-color: var(--brand-line); }
.res-item.sel { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 15%, transparent); }
.res-item .grow { flex: 1; min-width: 0; }
.res-item strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res-item small { color: var(--muted); }
.preview { position: sticky; top: calc(var(--topbar) + 16px); min-height: 320px; }
.preview iframe, .preview video, .preview img { width: 100%; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.preview iframe { height: 60vh; }
.preview img { max-height: 60vh; object-fit: contain; }
.dropzone { border: 2px dashed var(--border-strong); border-radius: var(--radius); padding: 22px; text-align: center; color: var(--muted); background: var(--surface-2); cursor: pointer; }
.dropzone.over { border-color: var(--brand); background: var(--brand-softer); color: var(--brand-text); }

/* Quizzes */
.q-card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 16px 18px; margin-bottom: 12px; }
.q-card header { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.q-card .qn { font-weight: 700; color: var(--brand-text); }
.q-prompt { font-size: 15px; font-weight: 500; margin: 0 0 12px; white-space: pre-wrap; }
.opt { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 8px; cursor: pointer; background: var(--surface); }
.opt:hover { border-color: var(--brand-line); }
.opt:has(input:checked) { border-color: var(--brand); background: var(--brand-softer); }
.opt.right { border-color: var(--success); background: var(--success-soft); }
.opt.wrong { border-color: var(--danger); background: var(--danger-soft); }
.q-edit .opt-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: center; margin-bottom: 6px; }
.q-nav { display: flex; flex-wrap: wrap; gap: 6px; }
.q-nav a { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 8px; border: 1px solid var(--border); color: var(--text-2); font-weight: 600; font-size: 13px; }
.q-nav a.done { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand-text); }
.quiz-layout { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 16px; align-items: start; }
.quiz-side { position: sticky; top: calc(var(--topbar) + 16px); }
.timer { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.timer.low { color: var(--danger); }
.save-state { font-size: 12px; color: var(--muted); }

/* Attendance */
.att-table td.att, .att-table th.att { text-align: center; padding: 8px 4px; min-width: 34px; }
.att-dot { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; font-size: 11px; font-weight: 700; }
.att-dot.present { background: var(--success-soft); color: var(--success); }
.att-dot.late { background: var(--warn-soft); color: var(--warn); }
.att-dot.absent { background: var(--danger-soft); color: var(--danger); }
.att-dot.excused { background: var(--info-soft); color: var(--info); }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.seg label { padding: 6px 10px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--muted); border-right: 1px solid var(--border); display: inline-flex; align-items: center; }
.seg label:last-child { border-right: 0; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg label:has(input:checked).present { background: var(--success-soft); color: var(--success); }
.seg label:has(input:checked).late { background: var(--warn-soft); color: var(--warn); }
.seg label:has(input:checked).absent { background: var(--danger-soft); color: var(--danger); }
.seg label:has(input:checked).excused { background: var(--info-soft); color: var(--info); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); align-items: center; }

/* Timetable */
.timetable { display: grid; grid-template-columns: 54px repeat(var(--days), minmax(110px, 1fr)); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.tt-head { padding: 10px 8px; text-align: center; font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); border-bottom: 1px solid var(--border); background: var(--surface-2); }
.tt-col { position: relative; border-left: 1px solid var(--border); margin: 10px 0 12px; }
.tt-hours { position: relative; margin: 10px 0 12px; }
.tt-hour { position: absolute; left: 0; right: 0; font-size: 11px; color: var(--muted); padding: 0 6px; transform: translateY(-50%); text-align: right; }
.tt-line { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--border); }
.tt-block { position: absolute; left: 4px; right: 4px; padding: 6px 8px; border-radius: 8px; background: var(--brand); color: var(--brand-ink); font-size: 12px; line-height: 1.3; overflow: hidden; }
.tt-block:hover { text-decoration: none; filter: brightness(1.08); }
.tt-block b { display: block; font-size: 13px; }
.tt-block.pending { background: var(--accent-soft); color: var(--text); border: 1px dashed var(--accent); }
.scroll-x.tt-wrap { background: none; border: 0; box-shadow: none; }

/* Switches (admin modules) */
.switch { position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 40px; height: 22px; border-radius: 999px; background: var(--border-strong); position: relative; transition: background 0.15s; flex: none; }
.switch .track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform 0.15s; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); }
.switch input:checked + .track { background: var(--success); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { outline: 3px solid color-mix(in srgb, var(--brand) 30%, transparent); }
.module-row td { vertical-align: top; }
.module-row .desc { color: var(--muted); font-size: 13px; margin-top: 4px; max-width: 380px; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; width: 108px; text-align: center; font-size: 12px; background: var(--surface); }
.swatch i { width: 44px; height: 44px; border-radius: 50%; display: block; border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--border); }
.swatch:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.swatch input[type='radio'] { position: absolute; opacity: 0; }
.logo-box { display: flex; align-items: center; gap: 16px; }
.logo-box img { height: 64px; max-width: 200px; object-fit: contain; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px; background: #fff; }

/* Enrollment history */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 6px 0 6px 16px; border-left: 2px solid var(--brand-line); position: relative; font-size: 13px; }
.timeline li::before { content: ''; position: absolute; left: -5px; top: 11px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.timeline small { color: var(--muted); }
.grade-input { width: 84px; text-align: right; }
.score-cell { text-align: center !important; font-variant-numeric: tabular-nums; }
.gradebook th.score-cell { white-space: normal; min-width: 92px; }

/* ===== Modal & toast ===== */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.5); display: flex; align-items: flex-start; justify-content: center; padding: 7vh 16px; z-index: 80; overflow-y: auto; }
.modal { background: var(--surface); color: var(--text); border-radius: 14px; width: 100%; max-width: 540px; box-shadow: var(--shadow-lg); overflow: hidden; border: 1px solid var(--border); }
.modal.wide { max-width: 820px; }
.modal header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal header h2 { margin: 0; font-size: 17px; }
.modal-title p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.modal-body { padding: 20px; }
.modal .form-error { margin: 0 20px 12px; }
.modal footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); }
#toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 20px); background: var(--text); color: var(--surface); padding: 11px 18px; border-radius: 10px; opacity: 0; pointer-events: none; transition: all 0.2s; z-index: 100; font-weight: 500; box-shadow: var(--shadow-lg); max-width: calc(100vw - 32px); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.error { background: var(--danger); color: #fff; }

/* ===== Sign-in ===== */
.auth-screen { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 100vh; background: var(--bg); }
.auth-hero { position: relative; overflow: hidden; color: #fff; padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between; gap: 24px;
  background: radial-gradient(circle at 15% 15%, color-mix(in srgb, var(--accent) 30%, transparent), transparent 40%), linear-gradient(150deg, var(--brand) 0%, color-mix(in srgb, var(--brand) 60%, #000) 100%); }
.auth-hero::after { content: ''; position: absolute; right: -140px; bottom: -140px; width: 460px; height: 460px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.16); box-shadow: 0 0 0 50px rgba(255, 255, 255, 0.04), 0 0 0 110px rgba(255, 255, 255, 0.03); }
.auth-hero .seal { display: flex; align-items: center; gap: 14px; }
.auth-hero .seal img { height: 64px; width: auto; max-width: 180px; object-fit: contain; background: rgba(255, 255, 255, 0.95); border-radius: 12px; padding: 6px; }
.auth-hero .seal strong { font-size: 17px; display: block; }
.auth-hero .seal small { opacity: 0.8; }
.auth-kicker { font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; opacity: 0.85; margin: 0 0 12px; }
.auth-hero h1 { color: #fff; font-size: 44px; line-height: 1.08; display: block; margin: 0 0 14px; }
.auth-hero p { font-size: 16px; opacity: 0.9; margin: 0; max-width: 460px; }
.auth-points { list-style: none; padding: 0; margin: 22px 0 0; display: grid; gap: 10px; }
.auth-points li { display: flex; gap: 10px; align-items: center; font-size: 14px; }
.auth-points .ic { padding: 6px; width: 30px; height: 30px; border-radius: 8px; background: rgba(255, 255, 255, 0.14); }
.auth-hero small { opacity: 0.75; position: relative; z-index: 1; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 410px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 30px; display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow-lg); }
.auth-card h2 { font-size: 24px; margin: 0; }
.auth-card > p { margin: -6px 0 4px; }
.auth-logo { display: none; height: 56px; width: auto; max-width: 200px; object-fit: contain; align-self: center; }
.auth-foot { text-align: center; font-size: 12px; color: var(--muted); margin: 0; }
.auth-switch { text-align: center; font-size: 13px; margin: 0; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 60px; }
.pw-wrap .link { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-size: 12px; }
#auth > .empty { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; }

/* ===== University Portal (/) ===== */
.hub-main { padding: 0 0 0; max-width: none; display: block; min-height: calc(100vh - var(--topbar)); display: flex; flex-direction: column; }
.hub-wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 24px; }
section.hub-wrap { margin-top: 28px; }
.hub-hero { color: #fff; padding: 40px 0 46px; position: relative; overflow: hidden;
  background: radial-gradient(circle at 85% 20%, color-mix(in srgb, var(--accent) 35%, transparent), transparent 35%), linear-gradient(135deg, var(--brand) 0%, color-mix(in srgb, var(--brand) 62%, #000) 100%); }
.hub-hero::after { content: ''; position: absolute; right: -90px; top: -120px; width: 380px; height: 380px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.15); box-shadow: 0 0 0 46px rgba(255, 255, 255, 0.04); }
.hub-hero h1 { color: #fff; font-size: 34px; margin: 4px 0 8px; }
.hub-hero p { margin: 0; opacity: 0.9; font-size: 15px; max-width: 640px; }
.hub-kicker { font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; opacity: 0.85 !important; }
.hub-role { display: inline-flex; align-items: center; gap: 6px; margin-top: 16px; padding: 4px 12px; border-radius: 999px; background: rgba(255, 255, 255, 0.16); font-size: 13px; font-weight: 600; }
.hub-role + .hub-role { margin-left: 8px; }
.hub-switch { color: #fff; text-decoration: underline; padding: 0; font-weight: 600; }
.hub-soon-tag { display: inline-block; margin-left: 6px; padding: 0 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.16); font-size: 11px; font-weight: 600; }
.sys-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.sys-card { display: flex; flex-direction: column; gap: 6px; padding: 20px; min-height: 240px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; color: var(--text); box-shadow: var(--shadow); position: relative; overflow: hidden; transition: transform 0.14s, box-shadow 0.14s, border-color 0.14s; }
.sys-card::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--brand); }
a.sys-card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--brand-line); }
.sys-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 6px; }
.sys-ic { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-text); }
.sys-name { font-size: 26px; font-weight: 800; letter-spacing: 0.01em; color: var(--brand-text); line-height: 1.1; }
.sys-title { font-size: 14px; line-height: 1.3; }
.sys-card p { margin: 2px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.sys-open { margin-top: auto; padding-top: 12px; display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--brand-text); }
.sys-card.soon { background: var(--surface-2); box-shadow: none; cursor: not-allowed; }
.sys-card.soon::before { background: var(--border-strong); }
.sys-card.soon .sys-ic { background: var(--surface); color: var(--muted); border: 1px solid var(--border); filter: grayscale(1); }
.sys-card.soon .sys-name, .sys-card.soon .sys-open { color: var(--muted); }
.sys-card.soon .sys-title { color: var(--text-2); }
.sys-card.soon .sys-open { font-weight: 500; }
.hub-foot { margin-top: auto; padding: 22px 0; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; }
.hub-foot .hub-wrap { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
#feed { margin-bottom: 32px; }
body.hub .topbar { padding-left: 24px; }

/* ===== Phones and tablets ===== */
.nav-scrim { display: none; }
@media (max-width: 960px) {
  .topbar { padding: 0 10px; gap: 8px; }
  .topbar .brand img { height: 34px; }
  .user-btn .who-text { display: none; }
  .sidebar { position: fixed; top: var(--topbar); left: 0; bottom: 0; height: auto; z-index: 55; width: min(84vw, 290px); transform: translateX(-102%); transition: transform 0.2s ease, visibility 0.2s; visibility: hidden; box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; visibility: visible; }
  body.nav-mini .sidebar { width: min(84vw, 290px); }
  body.nav-mini #nav .label, body.nav-mini .nav-heading { display: initial; }
  .nav-scrim { display: block; position: fixed; inset: var(--topbar) 0 0 0; z-index: 50; background: rgba(15, 23, 42, 0.45); }
  .nav-scrim[hidden] { display: none; }
  main { padding: 16px 16px 48px; }
  h1 { font-size: 22px; }
  .card { padding: 16px; }
  .page-head { flex-direction: column; align-items: stretch; gap: 12px; }
  .page-head .actions .btn { flex: 1 1 auto; }
  .cols.wide-left, .res-layout, .quiz-layout, .class-head { grid-template-columns: 1fr; }
  .class-head .teacher { border-left: 0; border-top: 1px solid var(--border); }
  .quiz-side, .preview { position: static; }
  .grid, .grid.two { grid-template-columns: 1fr; }
  .span-2, .span-3 { grid-column: auto; }
  .sys-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hub-wrap { padding: 0 16px; }
  .hub-hero h1 { font-size: 26px; }
  body.hub .topbar { padding-left: 12px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stats strong { font-size: 22px; }
  .auth-screen { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .auth-logo { display: block; }
  .toolbar > input, .toolbar > select, .toolbar > label.inline { flex: 1 1 100%; max-width: none; }
  .toolbar input[type='search'] { max-width: none; }
  .toolbar label.inline > input[type='checkbox'] { flex: none; }
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal, .modal.wide { max-width: none; border-radius: 16px 16px 0 0; max-height: 92vh; display: flex; flex-direction: column; }
  .modal-body { overflow-y: auto; flex: 1 1 auto; }
  .modal footer { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .modal footer .btn { flex: 1; }
  #toast { left: 16px; right: 16px; transform: translateY(20px); text-align: center; max-width: none; }
  #toast.show { transform: none; }
}
@media (max-width: 760px) {
  .topbar .brand small { display: none; }
  /* Tables become a list of small cards of "Label: value" lines. */
  .scroll-x:has(.table.stackable) { overflow-x: visible; }
  .card.scroll-x:has(.table.stackable) { padding: 0 16px 6px; }
  .table.stackable thead { display: none; }
  .table.stackable, .table.stackable tbody, .table.stackable tfoot, .table.stackable tr { display: block; width: 100%; }
  .table.stackable tr { padding: 12px 2px; border-bottom: 1px solid var(--border); }
  .table.stackable tbody tr:hover { background: none; }
  .table.stackable td { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; padding: 4px 0; border: 0; text-align: right; }
  .table.stackable td::before { content: attr(data-label); flex-shrink: 0; text-align: left; font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
  .table.stackable td:not([data-label])::before { content: none; }
  .table.stackable td:first-child { display: block; text-align: left; font-size: 15px; padding-bottom: 6px; }
  .table.stackable td:first-child::before { content: none; }
  .table.stackable td.is-empty { display: none; }
  .table.stackable td.row-actions, .table.stackable td:last-child:not([data-label]) { justify-content: flex-end; flex-wrap: wrap; gap: 8px; padding-top: 8px; }
  .table.stackable td.row-actions .btn { flex: 1 1 auto; }
  .table.stackable .cell-v { text-align: right; min-width: 0; }
  .table.stackable td:first-child .cell-v { text-align: left; }
  .scroll-x.tt-wrap { overflow-x: auto; }
  .timetable { grid-template-columns: 44px repeat(var(--days), minmax(96px, 1fr)); }
  .tiles { grid-template-columns: 1fr; }
  .sys-grid { grid-template-columns: 1fr; }
  .sys-card { min-height: 0; }
}
@media print {
  .sidebar, .topbar, .nav-scrim, .no-print, #toast { display: none !important; }
  body, main { background: #fff; padding: 0; }
}
