/* =====================================================================
   KAAF Timetable — design system
   ===================================================================== */

:root {
  --bg:            #f6f8f7;
  --bg-2:          #ffffff;
  --surface:       #ffffff;
  --surface-2:     #f2f5f3;
  --surface-3:     #e8ede9;
  --border:        #dde5e0;
  --border-strong: #c6d2ca;
  --text:          #14201a;
  --text-2:        #4d5c54;
  --text-3:        #7b8a82;

  --brand:         #0f6b4f;
  --brand-2:       #0b3d2e;
  --brand-soft:    #e3f2ea;
  --brand-ink:     #ffffff;
  --accent:        #b4801f;
  --accent-soft:   #fdf3e0;

  --ok:      #12805c;  --ok-soft:   #e2f5ee;
  --warn:    #a76b00;  --warn-soft: #fdf1dc;
  --err:     #c0392b;  --err-soft:  #fdeceb;
  --info:    #1f6bb5;  --info-soft: #e7f1fb;

  --radius:    14px;
  --radius-sm: 9px;
  --radius-lg: 22px;
  --shadow-1:  0 1px 2px rgba(16,32,26,.06), 0 2px 8px rgba(16,32,26,.05);
  --shadow-2:  0 4px 12px rgba(16,32,26,.08), 0 16px 40px rgba(16,32,26,.09);
  --shadow-3:  0 24px 60px rgba(16,32,26,.16);

  --sans: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace;

  --nav-w: 252px;
  --ease: cubic-bezier(.22,.61,.36,1);
}

:root[data-theme="dark"] {
  --bg:            #0c1310;
  --bg-2:          #0f1815;
  --surface:       #131e19;
  --surface-2:     #18251f;
  --surface-3:     #1f2e27;
  --border:        #23332c;
  --border-strong: #31463c;
  --text:          #e8f0ec;
  --text-2:        #a8bcb2;
  --text-3:        #7a8e85;

  --brand:         #2fbd88;
  --brand-2:       #1c8f66;
  --brand-soft:    #16352a;
  --brand-ink:     #06110c;
  --accent:        #e0a53c;
  --accent-soft:   #3a2d13;

  --ok:   #43cd9a;  --ok-soft:   #12352a;
  --warn: #e0a53c;  --warn-soft: #382b12;
  --err:  #f2685a;  --err-soft:  #3b1d1a;
  --info: #56a8f0;  --info-soft: #16283a;

  --shadow-1: 0 1px 2px rgba(0,0,0,.4), 0 2px 8px rgba(0,0,0,.3);
  --shadow-2: 0 4px 14px rgba(0,0,0,.45), 0 18px 44px rgba(0,0,0,.4);
  --shadow-3: 0 26px 70px rgba(0,0,0,.6);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: background .25s var(--ease), color .25s var(--ease);
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.25; letter-spacing: -.015em; font-weight: 640; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.22rem; }
h3 { font-size: 1.02rem; }
p  { margin: 0 0 .8rem; }

.muted  { color: var(--text-2); }
.small  { font-size: .82rem; }
.mono   { font-family: var(--mono); font-size: .86em; }
.center { text-align: center; }
.right  { text-align: right; }
.nowrap { white-space: nowrap; }
.tight  { margin: .3rem 0 0; padding-left: 1.1rem; }
.tight li { margin-bottom: .15rem; }

/* ============================ shell ================================ */

.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--nav-w);
  flex: 0 0 var(--nav-w);
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  z-index: 40;
}

.brand {
  display: flex; align-items: center; gap: .7rem;
  padding: 1.1rem 1.15rem;
  border-bottom: 1px solid var(--border);
}
.brand-mark {
  width: 38px; height: 38px; flex: none;
  border-radius: 11px;
  background: linear-gradient(140deg, var(--brand), var(--brand-2));
  color: #fff; font-weight: 800; font-size: 1.15rem;
  display: grid; place-items: center;
  box-shadow: 0 4px 14px rgba(15,107,79,.32);
}
.brand-text b { display: block; font-size: .95rem; letter-spacing: -.01em; }
.brand-text span { display: block; font-size: .72rem; color: var(--text-3); }

.nav { flex: 1; overflow-y: auto; padding: .85rem .65rem 1.5rem; }
.nav-group { margin-bottom: 1.1rem; }
.nav-label {
  font-size: .67rem; text-transform: uppercase; letter-spacing: .1em;
  color: var(--text-3); font-weight: 700;
  padding: 0 .6rem; margin-bottom: .35rem;
}
.nav a {
  display: flex; align-items: center; gap: .6rem;
  padding: .5rem .6rem; border-radius: var(--radius-sm);
  color: var(--text-2); font-weight: 520; font-size: .88rem;
  transition: background .16s var(--ease), color .16s var(--ease);
}
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--brand-soft); color: var(--brand); font-weight: 640; }
.nav a .ic { width: 17px; height: 17px; flex: none; opacity: .85; }
.nav a .badge-mini { margin-left: auto; }
.nav-tag {
  margin-left: auto;
  font-size: .62rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: .1rem .4rem; border-radius: 5px;
  background: var(--warn-soft); color: var(--warn);
  border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent);
}

.sidebar-foot { padding: .8rem; border-top: 1px solid var(--border); }
.user-chip {
  display: flex; align-items: center; gap: .6rem;
  padding: .5rem; border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.avatar {
  width: 32px; height: 32px; border-radius: 9px; flex: none;
  background: linear-gradient(140deg, var(--accent), #8a5f12);
  color: #fff; font-weight: 700; font-size: .8rem;
  display: grid; place-items: center;
}
.user-chip .who { min-width: 0; }
.user-chip .who b { display: block; font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip .who span { display: block; font-size: .7rem; color: var(--text-3); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 1rem;
  padding: .8rem 1.4rem;
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar h1 { margin: 0; font-size: 1.12rem; }
.topbar .sub { font-size: .78rem; color: var(--text-3); }
.topbar .spacer { flex: 1; }

.content { padding: 1.4rem; max-width: 1500px; width: 100%; }
.content.wide { max-width: none; }

/* ============================ cards ================================ */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
}
.card.pad { padding: 1.1rem 1.2rem; }
.card + .card { margin-top: 1rem; }
.card-head {
  display: flex; align-items: center; gap: .7rem;
  padding: .85rem 1.2rem; border-bottom: 1px solid var(--border);
}
.card-head h2, .card-head h3 { margin: 0; }
.card-head .spacer { flex: 1; }
.card-body { padding: 1.1rem 1.2rem; }
.card-body.flush { padding: 0; }

.grid { display: grid; gap: 1rem; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.sidebar-right { grid-template-columns: minmax(0,1fr) 340px; }

/* ============================ stats ================================ */

.stat {
  position: relative; overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow-1);
  transition: transform .18s var(--ease), box-shadow .18s var(--ease);
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.stat::after {
  content: ''; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: linear-gradient(90deg, var(--brand), var(--accent));
  opacity: .9;
}
.stat .k { font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); font-weight: 700; }
.stat .v { font-size: 1.85rem; font-weight: 700; letter-spacing: -.03em; margin: .15rem 0 .05rem; }
.stat .d { font-size: .78rem; color: var(--text-2); }
.stat.err::after   { background: linear-gradient(90deg, var(--err), #e08b6c); }
.stat.warn::after  { background: linear-gradient(90deg, var(--warn), var(--accent)); }
.stat.ok::after    { background: linear-gradient(90deg, var(--ok), var(--brand)); }

/* ============================ buttons ============================== */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .5rem .9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font: inherit; font-size: .86rem; font-weight: 560;
  cursor: pointer; white-space: nowrap;
  transition: background .15s var(--ease), border-color .15s var(--ease),
              transform .12s var(--ease), box-shadow .15s var(--ease), color .15s var(--ease);
}
.btn:hover { background: var(--surface-2); text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }
.btn.primary {
  background: linear-gradient(140deg, var(--brand), var(--brand-2));
  border-color: transparent; color: #fff;
  box-shadow: 0 2px 10px rgba(15,107,79,.28);
}
.btn.primary:hover { box-shadow: 0 6px 20px rgba(15,107,79,.36); }
.btn.accent { background: linear-gradient(140deg, var(--accent), #8a5f12); border-color: transparent; color: #fff; }
.btn.danger { color: var(--err); border-color: color-mix(in srgb, var(--err) 40%, var(--border)); }
.btn.danger:hover { background: var(--err-soft); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.sm { padding: .32rem .6rem; font-size: .78rem; border-radius: 7px; }
.btn.lg { padding: .7rem 1.3rem; font-size: .95rem; }
.btn.block { width: 100%; }
.btn-row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* ============================ forms ================================ */

label { display: block; font-size: .82rem; font-weight: 580; color: var(--text-2); margin-bottom: .7rem; }
label > input, label > select, label > textarea { margin-top: .28rem; }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=time], input[type=search], select, textarea {
  width: 100%;
  padding: .5rem .65rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
  color: var(--text);
  font: inherit; font-size: .88rem;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent);
}
input[type=file] { font-size: .85rem; }
textarea { min-height: 84px; resize: vertical; }
select { cursor: pointer; }

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; }
.row4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: .8rem; }
.stack > * { margin-bottom: 0; }
.stack { display: grid; gap: .75rem; }

.field-inline { display: flex; align-items: center; gap: .5rem; }
.field-inline label { margin: 0; }

.toolbar {
  display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
  margin-bottom: 1rem;
}
.toolbar select, .toolbar input { width: auto; min-width: 160px; }

/* ============================ tables =============================== */

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .86rem; }
table.data th {
  text-align: left; font-weight: 660; font-size: .73rem;
  text-transform: uppercase; letter-spacing: .06em; color: var(--text-3);
  padding: .6rem .75rem; border-bottom: 1px solid var(--border);
  background: var(--surface-2); position: sticky; top: 0; z-index: 2;
  white-space: nowrap;
}
table.data td { padding: .55rem .75rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tbody tr { transition: background .12s var(--ease); }
table.data tbody tr:hover { background: var(--surface-2); }
table.data tbody tr:last-child td { border-bottom: none; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data .actions { display: flex; gap: .3rem; justify-content: flex-end; }

/* A footer row carries totals, not column names, so it drops the header
   treatment and sits at the bottom rather than sticking to the top. */
table.data tfoot th {
  position: static; text-transform: none; letter-spacing: 0;
  font-size: .86rem; font-weight: 700; color: var(--text);
  border-top: 2px solid var(--border-strong); border-bottom: none;
}
/* The one column that is actually in play, among several shown for context. */
table.data td.strong, table.data th.strong { font-weight: 700; color: var(--text); }
/* A row that is listed for completeness but is not active right now. */
table.data tbody tr.dim td { opacity: .55; }
table.data tbody tr.dim:hover td { opacity: 1; }

/* The courses that push a lecturer past the mandate. */
table.data tbody tr.over-row td { background: var(--err-soft); }

/* An empty period offers itself: quiet until pointed at, so a full grid does
   not look like it is covered in buttons. */
/* The mark is drawn rather than written into the markup: a full timetable has
   thousands of empty periods, and a span in each of them is pure page weight. */
.slot-empty.can-add { cursor: pointer; position: relative; }
.slot-empty.can-add::after {
  content: '+';
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: 1.05rem; font-weight: 600; line-height: 1;
  color: var(--text-3); opacity: 0;
  transition: opacity .14s var(--ease), background .14s var(--ease);
  border-radius: var(--radius-sm);
}
.slot-empty.can-add:hover::after,
.slot-empty.can-add:focus-visible::after {
  opacity: 1; background: var(--brand-soft); color: var(--brand);
}

/* Choosing what goes into a period. */
.picker-backdrop {
  position: fixed; inset: 0; z-index: 120;
  background: rgba(8, 16, 13, .55);
  display: grid; place-items: center; padding: 1rem;
}
.picker {
  width: min(46rem, 100%); max-height: min(38rem, 90vh);
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-3);
  overflow: hidden;
}
.picker-head {
  display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
  padding: .8rem 1rem; border-bottom: 1px solid var(--border);
}
.picker-head .picker-when { margin-left: auto; }
.picker-search { padding: .7rem 1rem; border-bottom: 1px solid var(--border); }
.picker-search input { width: 100%; }
.picker-list { overflow-y: auto; flex: 1; }
.picker-foot { padding: .6rem 1rem; border-top: 1px solid var(--border); }

.picker-opt {
  display: flex; align-items: center; gap: .7rem; width: 100%;
  padding: .6rem 1rem; text-align: left;
  background: none; border: none; border-bottom: 1px solid var(--border);
  color: inherit; font: inherit; cursor: pointer;
}
.picker-opt:hover, .picker-opt:focus-visible { background: var(--surface-2); }
.picker-opt[disabled] { opacity: .5; cursor: progress; }
.picker-opt .mono { flex: 0 0 6.5rem; font-weight: 700; }
.picker-opt-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.picker-opt-main > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-opt-meta { display: flex; align-items: center; gap: .4rem; flex: none; }

/* A heading inside the picker, separating a cohort's own courses from the
   ones being borrowed from another class. */
.picker-group {
  padding: .55rem 1rem .35rem;
  font-size: .7rem; text-transform: uppercase; letter-spacing: .07em;
  font-weight: 700; color: var(--text-3);
  background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.picker-opt.is-other .mono { color: var(--text-2); }

/* The public link, shown so it can be selected and copied in one go. */
.share-url { display: flex; gap: .4rem; align-items: center; }
.share-url input {
  flex: 1; min-width: 0; font-family: var(--mono); font-size: .78rem;
  background: var(--surface-2);
}

/* The frame a shared timetable is read in — no sidebar, no account. */
body.public { background: var(--bg); }
.public-shell { max-width: 1400px; margin: 0 auto; padding: 0 1rem 2rem; }
.public-head {
  display: flex; align-items: center; gap: .75rem;
  padding: 1rem .2rem; margin-bottom: .4rem;
  border-bottom: 1px solid var(--border);
}
.public-body { padding-top: .8rem; }
.public-foot {
  display: flex; flex-wrap: wrap; gap: .5rem 1.2rem;
  margin-top: 1.6rem; padding-top: .9rem;
  border-top: 1px solid var(--border);
  font-size: .8rem; color: var(--text-3);
}
.print-only { display: none; }
@media print { .print-only { display: block; margin-bottom: .6rem; } }
.print-head b { font-size: 1.05rem; }

/* An empty period, waiting for something to be put in it. */
td.tt-empty { min-width: 7rem; }

/* The copy / Excel / PDF / print row above a listing. */
.export-row { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.export-row .btn svg { opacity: .75; }

/* Printing a listing: drop the furniture and let the table have the page. */
@media print {
  .sidebar, .topbar, .no-print, .export-row, .toolbar { display: none !important; }
  .app, .main, .content { display: block; padding: 0; margin: 0; max-width: none; }
  .card { border: none; box-shadow: none; page-break-inside: auto; }
  .card + .card { margin-top: .6rem; }
  table.data { font-size: 10.5px; }
  table.data th { background: #eee !important; color: #000 !important; position: static; }
  table.data tr { page-break-inside: avoid; }
  .table-wrap { overflow: visible !important; }
  a { color: #000; text-decoration: none; }
  .badge { border: 1px solid #999; color: #000 !important; background: none !important; }
}

/* A stat card that is also a filter. It has to look pressable, and show
   plainly when it is the one being applied. */
.stat-link { display: block; color: inherit; text-decoration: none; cursor: pointer; }
.stat-link:hover { text-decoration: none; border-color: var(--border-strong); }
.stat-link.is-on {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px var(--brand-soft), var(--shadow-1);
}
.stat-link.is-on .k { color: var(--brand); }

/* The session a clash report sent you to look at. */
.sess.is-focused {
  outline: 2px solid var(--info);
  outline-offset: 1px;
  box-shadow: 0 0 0 5px var(--info-soft);
  animation: focus-pulse 1.6s var(--ease) 2;
}
@keyframes focus-pulse {
  0%, 100% { box-shadow: 0 0 0 5px var(--info-soft); }
  50%      { box-shadow: 0 0 0 9px var(--info-soft); }
}

/* A set of records that arrived more than once, shown together so the copies
   can be compared before any of them is removed. */
.dup-group { border-top: 1px solid var(--border); }
.dup-group:first-child { border-top: none; }
.dup-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: .45rem;
  padding: .7rem .9rem .5rem; background: var(--surface-2);
}
.dup-head .mono { font-size: .9rem; }

/* How much of a lecturer's load sits inside the mandate, and how much beyond. */
.load-bar {
  display: flex; height: 12px; border-radius: 999px; overflow: hidden;
  background: var(--surface-3); border: 1px solid var(--border);
}
.load-bar .in   { background: var(--ok); }
.load-bar .over { background: var(--err); }

.empty {
  padding: 2.5rem 1.5rem; text-align: center; color: var(--text-3);
}
.empty .big { font-size: 2rem; margin-bottom: .4rem; opacity: .5; }

/* ============================ badges =============================== */

.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .16rem .5rem; border-radius: 999px;
  font-size: .72rem; font-weight: 650; letter-spacing: .01em;
  background: var(--surface-3); color: var(--text-2);
  white-space: nowrap;
}
.badge.ok   { background: var(--ok-soft);   color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.err  { background: var(--err-soft);  color: var(--err); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.brand{ background: var(--brand-soft);color: var(--brand); }
.badge-mini {
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; font-size: .68rem; font-weight: 700;
  display: inline-grid; place-items: center;
  background: var(--err); color: #fff;
}

.dot-status { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-status.ok { background: var(--ok); }
.dot-status.warn { background: var(--warn); }
.dot-status.err { background: var(--err); }

/* ============================ alerts =============================== */

.alert {
  padding: .7rem .9rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-2);
  font-size: .87rem; margin-bottom: .8rem;
  display: flex; gap: .6rem; align-items: flex-start;
}
.alert.ok   { background: var(--ok-soft);   border-color: color-mix(in srgb, var(--ok) 30%, transparent);   color: var(--ok); }
.alert.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); color: var(--warn); }
.alert.err  { background: var(--err-soft);  border-color: color-mix(in srgb, var(--err) 30%, transparent);  color: var(--err); }
.alert.info { background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 30%, transparent); color: var(--info); }
.alert strong { color: inherit; }

.flash-stack {
  position: fixed; top: 14px; right: 14px; z-index: 200;
  display: grid; gap: .5rem; max-width: 380px;
}
.flash-stack .alert {
  box-shadow: var(--shadow-2);
  animation: slideIn .3s var(--ease);
  background: var(--surface);
}
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } }

/* ============================ meters =============================== */

.meter { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 3px; background: var(--brand); transition: width .4s var(--ease); }
.meter.warn > i { background: var(--warn); }
.meter.err  > i { background: var(--err); }

/* ============================ timetable grid ======================= */

.tt-scroll { overflow-x: auto; padding-bottom: .5rem; }

table.tt {
  border-collapse: separate; border-spacing: 4px;
  min-width: 900px; width: 100%;
}
table.tt th.day {
  width: 110px; text-align: left; vertical-align: middle;
  padding: .6rem .7rem;
  background: linear-gradient(140deg, var(--brand-2), var(--brand));
  color: #fff; border-radius: var(--radius-sm);
  font-size: .78rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
}
table.tt th.band {
  padding: .45rem .5rem; text-align: center;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .73rem; font-weight: 660; color: var(--text-2);
  white-space: nowrap;
}
table.tt td {
  padding: 0; vertical-align: top;
  min-width: 140px;
}
table.tt td.break-cell {
  background: repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 6px, var(--surface-3) 6px, var(--surface-3) 12px);
  border-radius: var(--radius-sm);
  text-align: center; color: var(--text-3);
  font-size: .7rem; font-weight: 700; letter-spacing: .12em;
  writing-mode: vertical-rl; text-orientation: mixed;
  padding: .5rem 0; min-width: 34px; width: 34px;
}

.slot-empty {
  height: 100%; min-height: 74px;
  border: 1px dashed var(--border); border-radius: var(--radius-sm);
  transition: background .15s var(--ease), border-color .15s var(--ease);
}
/* the stream does not teach at this hour on this day */
/* An hour the stream does not teach: nothing to offer, so nothing is drawn. */
table.tt td.na { background: var(--bg-2); }
.slot-empty.drop-ok   { border-color: var(--ok);  background: var(--ok-soft); border-style: solid; }
.slot-empty.drop-bad  { border-color: var(--err); background: var(--err-soft); border-style: solid; }

.sess {
  position: relative;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  border-left: 3px solid var(--brand);
  background: var(--surface);
  padding: .5rem .6rem;
  min-height: 74px;
  box-shadow: var(--shadow-1);
  cursor: grab;
  transition: transform .15s var(--ease), box-shadow .15s var(--ease);
}
.sess:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); z-index: 5; }
.sess:active { cursor: grabbing; }
.sess.dragging { opacity: .45; transform: scale(.97); }
.sess .code { font-weight: 720; font-size: .8rem; letter-spacing: -.01em; }
.sess .title {
  font-size: .74rem; color: var(--text-2); line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  margin: .1rem 0 .2rem;
}
.sess .meta { font-size: .7rem; color: var(--text-3); display: flex; flex-wrap: wrap; gap: .1rem .45rem; }
.sess .meta b { font-weight: 600; color: var(--text-2); }
.sess.has-error  { border-left-color: var(--err); background: color-mix(in srgb, var(--err-soft) 55%, var(--surface)); }
.sess.has-warn   { border-left-color: var(--warn); }
.sess.online     { border-left-color: var(--info); border-style: dashed; }
.sess .flag {
  position: absolute; top: 5px; right: 5px;
  width: 7px; height: 7px; border-radius: 50%;
}
.sess .flag.err  { background: var(--err); box-shadow: 0 0 0 3px var(--err-soft); }
.sess .flag.warn { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }

/* colour-by-level accents */
.sess[data-level="100"] { border-left-color: #2f9bd8; }
.sess[data-level="200"] { border-left-color: #6b57d8; }
.sess[data-level="300"] { border-left-color: #d8813c; }
.sess[data-level="400"] { border-left-color: #16a06f; }
.sess.has-error { border-left-color: var(--err) !important; }

/* ============================ print ================================ */

.print-sheet { background: #fff; color: #111; padding: 18mm 14mm; }

@media print {
  .sidebar, .topbar, .no-print, .flash-stack { display: none !important; }
  body { background: #fff; color: #000; font-size: 10pt; }
  .content { padding: 0; max-width: none; }
  .card { border: none; box-shadow: none; }
  table.tt { border-spacing: 0; min-width: 0; }
  table.tt th.day, table.tt th.band, .sess, .slot-empty { border: .6pt solid #444 !important; border-radius: 0; }
  table.tt th.day { background: #eee !important; color: #000 !important; }
  .sess { box-shadow: none; min-height: 0; page-break-inside: avoid; }
  .page-break { page-break-after: always; }
}

/* ============================ auth ================================= */

.auth-body {
  min-height: 100vh; display: grid; place-items: center;
  background:
    radial-gradient(1000px 500px at 15% -10%, color-mix(in srgb, var(--brand) 22%, transparent), transparent 60%),
    radial-gradient(900px 500px at 100% 110%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 55%),
    var(--bg);
  padding: 2rem 1rem;
}
.auth-shell { width: 100%; max-width: 420px; }
.auth-card {
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-3);
  padding: 2rem 1.8rem;
  text-align: center;
}
.auth-card.wide { max-width: none; }
.auth-shell:has(.auth-card.wide) { max-width: 620px; }
.auth-card .brand-mark { margin: 0 auto .9rem; width: 52px; height: 52px; font-size: 1.5rem; border-radius: 15px; }
.auth-card h1 { font-size: 1.28rem; }
.auth-card form { margin-top: 1.2rem; text-align: left; }
.auth-card label { font-size: .8rem; }

.install-checks { display: grid; gap: .35rem; margin: 1.1rem 0; text-align: left; }
.check { display: flex; align-items: center; gap: .5rem; font-size: .84rem; color: var(--text-2); }
.check .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--err); }
.check.pass .dot { background: var(--ok); }
.check.pass { color: var(--text); }

/* ============================ misc ================================= */

.hint {
  font-size: .78rem; color: var(--text-3);
  background: var(--surface-2); border-left: 3px solid var(--brand);
  padding: .55rem .75rem; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.steps { display: grid; gap: .6rem; counter-reset: s; }
.step {
  display: flex; gap: .8rem; align-items: flex-start;
  padding: .8rem .9rem; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface-2);
}
.step .n {
  counter-increment: s; flex: none;
  width: 26px; height: 26px; border-radius: 8px;
  background: var(--brand); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: .8rem;
}
.step .n::before { content: counter(s); }
.step b { display: block; font-size: .88rem; }
.step p { margin: .1rem 0 0; font-size: .82rem; color: var(--text-2); }

.legend { display: flex; gap: .9rem; flex-wrap: wrap; font-size: .76rem; color: var(--text-2); }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: .3rem; vertical-align: -1px; }

.split-pane { display: grid; grid-template-columns: minmax(0,1fr) 320px; gap: 1rem; align-items: start; }

.issue-list { display: grid; gap: .45rem; max-height: 520px; overflow-y: auto; }
.issue {
  display: flex; gap: .55rem; align-items: flex-start;
  padding: .55rem .65rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-2);
  font-size: .82rem;
}
.issue .sev { width: 7px; height: 7px; border-radius: 50%; margin-top: .42rem; flex: none; }
.issue.ERROR   { border-color: color-mix(in srgb, var(--err) 32%, var(--border)); }
.issue.ERROR   .sev { background: var(--err); }
.issue.WARNING .sev { background: var(--warn); }
.issue.INFO    .sev { background: var(--info); }
.issue .t { font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); font-weight: 700; }

.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px); z-index: 100;
  opacity: 0; pointer-events: none; transition: opacity .2s var(--ease);
}
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 92vw);
  background: var(--surface); border-left: 1px solid var(--border);
  box-shadow: var(--shadow-3); z-index: 101;
  transform: translateX(100%); transition: transform .28s var(--ease);
  display: flex; flex-direction: column;
}
.drawer.open { transform: none; }
.drawer header {
  padding: 1rem 1.1rem; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: .6rem;
}
.drawer .body { padding: 1.1rem; overflow-y: auto; flex: 1; }
.drawer footer { padding: .9rem 1.1rem; border-top: 1px solid var(--border); display: flex; gap: .5rem; }

.spinner {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid color-mix(in srgb, currentColor 25%, transparent);
  border-top-color: currentColor;
  animation: spin .7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.progress-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  display: none; place-items: center;
}
.progress-overlay.on { display: grid; }
.progress-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-3);
  padding: 2rem 2.4rem; text-align: center; max-width: 380px;
}
.progress-box .spinner { width: 30px; height: 30px; border-width: 3px; color: var(--brand); margin-bottom: .8rem; }

.chip-row { display: flex; gap: .35rem; flex-wrap: wrap; }
.chip {
  padding: .28rem .6rem; border-radius: 999px; font-size: .78rem;
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text-2); cursor: pointer;
  -webkit-user-select: none; user-select: none;
  transition: all .15s var(--ease);
}
.chip:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ---------------------------- branding ---------------------------- */

.brand-row { display: flex; gap: 1.2rem; flex-wrap: wrap; align-items: flex-start; }
.brand-logo-box { width: 190px; flex: none; }
.logo-preview {
  width: 100%; height: 118px;
  border: 1px dashed var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface-2);
  display: grid; place-items: center; overflow: hidden;
}
.logo-preview img { max-width: 90%; max-height: 90%; object-fit: contain; }
.logo-placeholder {
  width: 58px; height: 58px; border-radius: 16px;
  background: linear-gradient(140deg, var(--brand), var(--brand-2));
  color: #fff; font-weight: 800; font-size: 1.6rem;
  display: grid; place-items: center;
}

.colour-field { display: flex; gap: .4rem; align-items: center; margin-top: .28rem; }
.colour-field input[type=color] {
  width: 42px; height: 34px; padding: 2px; flex: none; cursor: pointer;
  border: 1px solid var(--border-strong); border-radius: 8px; background: var(--bg-2);
}
.colour-field input[type=text] { font-family: var(--mono); text-transform: lowercase; }

.brand-preview {
  display: flex; align-items: center; gap: .55rem; flex-wrap: wrap;
  padding: .7rem .8rem; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface-2);
}
.bp-mark {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  color: #fff; font-weight: 800; display: grid; place-items: center;
}
.bp-accent {
  padding: .22rem .6rem; border-radius: 999px;
  font-size: .76rem; font-weight: 650;
}

/* the sidebar mark becomes the uploaded logo when there is one */
.brand-mark.has-logo {
  background: var(--surface-2); box-shadow: none;
  border: 1px solid var(--border); overflow: hidden; padding: 3px;
}
.brand-mark.has-logo img { width: 100%; height: 100%; object-fit: contain; display: block; }

.auth-card .brand-mark.has-logo { padding: 6px; }

/* ---------------------------- pagination -------------------------- */

.pager {
  display: flex; align-items: center; gap: .9rem; flex-wrap: wrap;
  padding: .65rem .9rem;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 0 0 var(--radius) var(--radius);
  font-size: .8rem;
}
.pager-count { color: var(--text-2); }
.pager-count b { color: var(--text); font-variant-numeric: tabular-nums; }
.pager-clear { margin-left: .35rem; font-size: .76rem; }
.pager-nav { display: flex; gap: .25rem; margin-left: auto; flex-wrap: wrap; }
.pager-size { display: flex; align-items: center; gap: .22rem; }

.pager-btn {
  min-width: 30px; height: 28px; padding: 0 .5rem;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border-strong); border-radius: 7px;
  background: var(--surface); color: var(--text-2);
  font-size: .78rem; font-weight: 560; font-variant-numeric: tabular-nums;
  transition: background .14s var(--ease), color .14s var(--ease), border-color .14s var(--ease);
}
.pager-btn:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.pager-btn.on {
  background: var(--brand); border-color: var(--brand); color: #fff;
}
.pager-btn.off { opacity: .4; pointer-events: none; }
.pager-btn.tiny { min-width: 26px; height: 24px; padding: 0 .38rem; font-size: .72rem; }
.pager-gap { padding: 0 .2rem; color: var(--text-3); align-self: center; }

.search-form { display: flex; align-items: center; gap: .4rem; }
.search-wrap { position: relative; display: flex; align-items: center; }
.search-wrap svg {
  position: absolute; left: .55rem; color: var(--text-3); pointer-events: none;
}
.search-wrap input {
  padding-left: 1.9rem; min-width: 240px;
}

@media (max-width: 700px) {
  .pager { flex-direction: column; align-items: stretch; gap: .55rem; }
  .pager-nav { margin-left: 0; justify-content: center; }
  .pager-size { justify-content: center; }
  .search-wrap input { min-width: 0; width: 100%; }
  .search-form { width: 100%; }
}

/* dropdown menus built on <details> */
.menu > summary { cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 40;
  min-width: 258px; padding: .5rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-2);
  display: grid; gap: .25rem;
}
.menu-label {
  font-size: .64rem; text-transform: uppercase; letter-spacing: .09em;
  font-weight: 700; color: var(--text-3);
  padding: .35rem .4rem .1rem;
}
.menu-panel .btn { justify-content: flex-start; }

/* The add-a-cohort panel is a small form rather than a list of links, so it
   needs room for three intake boxes side by side. */
.add-panel { width: min(30rem, calc(100vw - 2.5rem)); padding: .7rem .8rem .8rem; }
.add-panel label { display: block; font-size: .78rem; font-weight: 600; color: var(--text-2); }
.add-panel input, .add-panel select { margin-top: .2rem; }
.add-panel .btn.block { justify-content: center; }
.add-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; }
@media (max-width: 480px) { .add-cols { grid-template-columns: 1fr 1fr; } }

.stream-box {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); padding: .6rem .7rem;
}
.stream-box-head {
  display: flex; align-items: center; gap: .35rem;
  margin-bottom: .4rem; padding-bottom: .35rem;
  border-bottom: 1px solid var(--border);
  font-size: .82rem;
}
.stream-box-head b { flex: 1; }
.stream-opt {
  display: flex; align-items: flex-start; gap: .5rem;
  margin: 0 0 .3rem; padding: .35rem .4rem;
  border-radius: 7px; cursor: pointer; font-weight: 400;
  transition: background .12s var(--ease);
}
.stream-opt:hover { background: var(--surface-3); }
.stream-opt input { width: auto; margin-top: .2rem; flex: none; }
.stream-opt b { display: block; font-size: .84rem; color: var(--text); }
.stream-opt .small { display: block; }
.stream-opt.is-empty { opacity: .45; cursor: not-allowed; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: .3rem .8rem; font-size: .84rem; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; font-weight: 560; }

.theme-toggle {
  width: 34px; height: 34px; border-radius: 10px;
  border: 1px solid var(--border-strong); background: var(--surface);
  display: grid; place-items: center; cursor: pointer; color: var(--text-2);
}
.theme-toggle:hover { color: var(--brand); border-color: var(--brand); }

/* ============================ responsive =========================== */

@media (max-width: 1180px) {
  .grid.c4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid.sidebar-right, .split-pane { grid-template-columns: minmax(0,1fr); }
}
@media (max-width: 900px) {
  .sidebar {
    position: fixed; left: 0; top: 0;
    transform: translateX(-100%); transition: transform .25s var(--ease);
    box-shadow: var(--shadow-3);
  }
  .sidebar.open { transform: none; }
  .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: minmax(0,1fr); }
  .row2, .row3, .row4 { grid-template-columns: 1fr; }
  .content { padding: 1rem; }
  .menu-btn { display: grid !important; }
}
/* The hamburger is always available: a wide timetable often wants the whole
   screen, not just a narrow one. */
.menu-btn { display: grid; }

/* Collapsing only means something on a wide screen. Below 900px the sidebar is
   already an off-canvas overlay, so the same button opens and closes that
   instead — and this rule must not zero its width there, or opening it would
   show nothing. */
@media (min-width: 901px) {
  .sidebar { transition: width .2s var(--ease), flex-basis .2s var(--ease); }
  .sidebar > * { transition: opacity .12s var(--ease); }
  /* .nav-closed is set on the root before paint, from what was remembered, so
     a hidden sidebar never flashes into view; the script then moves it to
     .nav-collapsed on the app once the DOM exists. */
  html.nav-closed .sidebar,
  .app.nav-collapsed .sidebar {
    width: 0; flex-basis: 0; overflow: hidden;
    border-right-color: transparent;
  }
  html.nav-closed .sidebar > *,
  .app.nav-collapsed .sidebar > * { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .sidebar, .sidebar > * { transition: none; }
}

/* ---------------------- upload workbook cards --------------------- */

.wb-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: .7rem; }
.wb-card {
  position: relative;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); padding: .85rem .9rem;
}
.wb-card b { display: block; font-size: .9rem; margin-bottom: .15rem; padding-right: 1.6rem; }
.wb-card p { margin: 0 0 .5rem; }
.wb-num {
  position: absolute; top: .7rem; right: .7rem;
  width: 22px; height: 22px; border-radius: 7px;
  background: var(--brand); color: #fff;
  display: grid; place-items: center;
  font-size: .74rem; font-weight: 700;
}
@media (max-width: 860px) { .wb-grid { grid-template-columns: 1fr; } }

/* ---------------------- report tabs & load cards ------------------ */

.tabs {
  display: flex; gap: .3rem; flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem; padding-bottom: .55rem;
}
.tab {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .42rem .8rem; border-radius: 9px;
  color: var(--text-2); font-size: .86rem; font-weight: 560;
  border: 1px solid transparent;
  transition: background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.tab:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.tab.on {
  background: var(--brand-soft); color: var(--brand);
  border-color: color-mix(in srgb, var(--brand) 28%, transparent);
  font-weight: 680;
}
.tab-count {
  min-width: 20px; padding: 0 .32rem; border-radius: 6px;
  background: var(--surface-3); color: var(--text-2);
  font-size: .72rem; font-weight: 700; text-align: center;
  font-variant-numeric: tabular-nums;
}
.tab-count.err  { background: var(--err-soft);  color: var(--err); }
.tab-count.warn { background: var(--warn-soft); color: var(--warn); }
.tab-count.ok   { background: var(--ok-soft);   color: var(--ok); }
.tab-count.info { background: var(--info-soft); color: var(--info); }

.load-card { margin-bottom: .55rem; }
.load-card.open { box-shadow: var(--shadow-2); }
.load-head {
  display: flex; align-items: center; gap: .6rem;
  cursor: pointer; color: inherit; border-bottom: none;
}
.load-card.open .load-head { border-bottom: 1px solid var(--border); }
.load-head:hover { text-decoration: none; background: var(--surface-2); border-radius: var(--radius) var(--radius) 0 0; }
.load-caret { color: var(--text-3); font-size: .8rem; width: 12px; flex: none; }
.load-meter { width: 110px; flex: none; }
.load-meter .meter { width: 100%; }

table.data tr.row-extra { background: color-mix(in srgb, var(--warn-soft) 55%, transparent); }

@media (max-width: 780px) {
  .load-meter { display: none; }
  .load-head .badge { font-size: .68rem; }
}

/* a batch that alternates fortnightly with its twin in the same room */
.batch-tag {
  display: inline-block; margin: .15rem 0;
  padding: .05rem .34rem; border-radius: 5px;
  font-size: .63rem; font-weight: 700; letter-spacing: .02em;
  background: var(--info-soft); color: var(--info);
  border: 1px solid color-mix(in srgb, var(--info) 28%, transparent);
}

/* ---------------------- clear-the-system picker ------------------- */

.reset-list { display: grid; gap: .4rem; }
.reset-item {
  display: flex; gap: .6rem; align-items: flex-start;
  margin: 0; padding: .6rem .7rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); cursor: pointer; font-weight: 400;
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
.reset-item:hover { border-color: color-mix(in srgb, var(--err) 40%, var(--border)); }
.reset-item:has(input:checked) {
  background: var(--err-soft);
  border-color: color-mix(in srgb, var(--err) 45%, transparent);
}
.reset-item input { width: auto; flex: none; margin-top: .25rem; }
.reset-item b { margin-right: .4rem; }
.reset-item .small { display: block; margin-top: .15rem; }

/* ---------------------- week-by-week schedule --------------------- */

.week-card { margin-bottom: .7rem; }
.week-no {
  width: 34px; height: 34px; flex: none; border-radius: 10px;
  background: linear-gradient(140deg, var(--brand), var(--brand-2));
  color: #fff; font-weight: 700; font-size: .95rem;
  display: grid; place-items: center;
}
@media print {
  .week-card { page-break-inside: avoid; }
}

/* a heading row that groups a table, e.g. venues by block */
table.data tr.group-row td {
  background: var(--surface-3);
  font-size: .78rem; padding: .45rem .75rem;
  border-bottom: 1px solid var(--border);
}
table.data tr.group-row b { margin-right: .5rem; }
table.data tr.group-row:hover td { background: var(--surface-3); }


/* Ticking which departments owe a shared course: a long list that has to stay
   readable, grouped under the faculty each department belongs to. */
.check-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
  gap: .1rem .6rem; margin-bottom: .5rem;
}
.check-grid .check-head { grid-column: 1 / -1; margin-top: .4rem; font-weight: 600; }
.check-grid .check {
  display: flex; align-items: center; gap: .4rem;
  padding: .18rem .1rem; font-size: .84rem; cursor: pointer;
}
.check-grid .check input { margin: 0; flex: none; }
.check-grid .check span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }


/* Settling the lecturer and the room before the class goes in, rather than
   placing first and correcting afterwards. */
.picker-choice {
  border-top: 1px solid var(--border);
  padding: .7rem .9rem;
  display: grid; gap: .55rem;
  background: var(--surface-2);
}
.picker-chosen b { color: var(--text-1); }
.picker-fields { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.picker-fields label { display: grid; gap: .2rem; font-size: .8rem; color: var(--text-3); margin: 0; }
.picker-fields select { margin: 0; }
.picker-opt.is-picked {
  background: var(--brand-soft);
  box-shadow: inset 3px 0 0 var(--brand);
}
@media (max-width: 640px) {
  .picker-fields { grid-template-columns: 1fr; }
}


/* What is wrong with one class's week, kept beside that class. */
.block-clashes {
  border-top: 1px solid var(--border);
  padding: .7rem .9rem .8rem;
  background: var(--surface-2);
}
.block-clashes-head {
  display: flex; align-items: center; gap: .5rem;
  flex-wrap: wrap; margin-bottom: .45rem;
}
.block-clashes .issue-list { margin: 0; }
.block-clashes .issue-list li { padding: .3rem 0; }
@media print { .block-clashes { display: none; } }


/* ======================= charts ==================================== */
/* The categorical slots, used in this order and never cycled. Both modes are
   chosen rather than flipped: the dark steps are the same hues re-stepped for
   a dark surface, and each set was validated for colour-blind separation
   against the surface it sits on. */
:root {
  --viz-1: #2a78d6;              /* blue   */
  --viz-2: #eb6834;              /* orange */
  --viz-3: #1baf7a;              /* aqua   */
  /* Status colours are fixed, never themed, and always ship with a written
     label beside them - on a light surface the warning step is deliberately
     below 3:1 and the words are what carry it. */
  --viz-critical: #d03b3b;
  --viz-warning: #fab219;
  --viz-track: color-mix(in srgb, currentColor 8%, transparent);
  --viz-track-strong: color-mix(in srgb, currentColor 22%, transparent);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --viz-1: #3987e5;
    --viz-2: #d95926;
    --viz-3: #199e70;
  }
}
:root[data-theme="dark"] {
  --viz-1: #3987e5;
  --viz-2: #d95926;
  --viz-3: #199e70;
}

/* ---- horizontal bars ---- */
.viz-bars { display: grid; gap: .3rem; }
.viz-row {
  display: grid;
  grid-template-columns: minmax(6rem, 11rem) minmax(0, 1fr) 3.4rem;
  align-items: center; gap: .6rem;
}
.viz-bars.wide .viz-row { grid-template-columns: minmax(8rem, 15rem) minmax(0, 1fr) 3.4rem; }

.viz-name {
  font-size: .82rem; color: var(--text-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  text-align: right;
}
.viz-name .viz-note {
  display: block; font-size: .7rem; color: var(--text-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.viz-track {
  height: 14px; border-radius: 4px;
  background: var(--viz-track);
  overflow: hidden;
}
.viz-track > i {
  display: block; height: 100%;
  border-radius: 4px;                 /* rounded data end, anchored at the base */
  transition: width .3s var(--ease), opacity .12s var(--ease);
}
.viz-row:hover .viz-track > i { opacity: .85; }

/* Values wear text colour, never the colour of their series. */
.viz-num {
  font-size: .82rem; font-weight: 600; color: var(--text-1);
  font-variant-numeric: tabular-nums; text-align: right;
}

/* ---- several series over the same categories ---- */
.viz-bars.grouped .viz-row { grid-template-columns: minmax(7rem, 13rem) minmax(0, 1fr); }
.viz-group { display: grid; gap: 2px; }        /* 2px keeps the bars separate */
.viz-sub { display: grid; grid-template-columns: minmax(0,1fr) 3.2rem; align-items: center; gap: .5rem; }
.viz-sub .viz-track { height: 10px; }
.viz-subnum {
  font-size: .74rem; font-weight: 500; color: var(--text-2);
  font-variant-numeric: tabular-nums; text-align: right;
}

/* ---- parts of a whole ---- */
.viz-stack {
  display: flex; height: 18px; border-radius: 5px; overflow: hidden;
  background: var(--viz-track); gap: 2px;
}
.viz-stack > i { display: block; height: 100%; border-radius: 4px; }

/* ---- key ---- */
.viz-legend {
  display: flex; flex-wrap: wrap; gap: .3rem .9rem;
  margin-top: .6rem; font-size: .78rem; color: var(--text-2);
}
.viz-key { display: inline-flex; align-items: center; gap: .35rem; }
.viz-key > i {
  width: 10px; height: 10px; border-radius: 3px; flex: none;
  box-shadow: 0 0 0 2px var(--surface);   /* a ring, so keys never touch */
}
.viz-key b { color: var(--text-1); font-variant-numeric: tabular-nums; }
.viz-empty { padding: 1.4rem .2rem; text-align: center; }

/* ---- the week, as a heatmap ---- */
.viz-heat { display: grid; gap: 2px; min-width: 32rem; }
.viz-heat-corner { }
.viz-heat-hour {
  font-size: .7rem; color: var(--text-3); text-align: center; padding-bottom: .15rem;
}
.viz-heat-day {
  font-size: .78rem; color: var(--text-2); text-align: right;
  padding-right: .5rem; align-self: center;
}
.viz-heat-cell {
  min-height: 26px; border-radius: 4px;
  display: grid; place-items: center;
  font-size: .76rem; font-weight: 600;
  color: var(--text-1);
  background: color-mix(in srgb, var(--viz-1) calc(var(--t) * 100%), transparent);
}
.viz-heat-cell.is-strong { color: #fff; }
.viz-heat-cell.is-empty { background: var(--viz-track); }

.stat-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
  gap: .7rem; margin-bottom: 1rem;
}

@media (max-width: 700px) {
  .viz-row, .viz-bars.wide .viz-row, .viz-bars.grouped .viz-row {
    grid-template-columns: minmax(5rem, 8rem) minmax(0, 1fr) 2.8rem;
  }
}
@media print {
  .viz-track > i, .viz-stack > i { opacity: 1 !important; }
  .viz-heat-cell.is-strong { color: #000; }
}


/* ================== type-to-search dropdowns ======================= */
/* The native <select> is still there, still named, still submitting. It is
   taken out of the layout rather than removed, so nothing about the form
   changes and the page still works with no script. */
.ss { position: relative; }
.ss-native {
  position: absolute; width: 1px; height: 1px;
  opacity: 0; pointer-events: none; margin: 0;
}
.ss-btn {
  width: 100%; text-align: left;
  font: inherit; font-size: .88rem;
  padding: .5rem 2rem .5rem .7rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text-1);
  cursor: pointer; position: relative;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ss-btn::after {
  content: ''; position: absolute; right: .7rem; top: 50%;
  width: 7px; height: 7px; margin-top: -5px;
  border-right: 1.6px solid var(--text-3);
  border-bottom: 1.6px solid var(--text-3);
  transform: rotate(45deg);
}
.ss-btn:hover { border-color: var(--border-strong); }
.ss-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.ss-btn.is-empty { color: var(--text-3); }

.ss-panel {
  position: absolute; z-index: 60; left: 0; right: 0; top: calc(100% + 4px);
  min-width: 15rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-3);
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
  max-height: 19rem; overflow: hidden;
}
.ss-panel.drop-up { top: auto; bottom: calc(100% + 4px); }
.ss-search { padding: .45rem; border-bottom: 1px solid var(--border); }
.ss-search input { margin: 0; width: 100%; font-size: .85rem; }
.ss-list { overflow-y: auto; padding: .25rem; }
.ss-opt {
  display: block; width: 100%; text-align: left;
  font: inherit; font-size: .84rem;
  padding: .4rem .55rem; border: 0; border-radius: var(--radius-sm);
  background: none; color: var(--text-1); cursor: pointer;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ss-opt:hover, .ss-opt.is-active { background: var(--surface-3); }
.ss-opt.is-on { color: var(--brand); font-weight: 600; }
.ss-opt[disabled] { color: var(--text-3); cursor: default; }
.ss-none { padding: .6rem; font-size: .8rem; color: var(--text-3); text-align: center; }

@media print { .ss-panel { display: none !important; } }
