:root {
    /* Brand - muted, professional. Deep pine instead of vivid KNUST green;
       brass instead of bright gold. */
    --green:#523900; --green-600:#523900; --green-050:#fff9db; --gold:#e8a50e;
    /* Neutrals (Apple-style greys) */
    --bg:#f5f5f7; --surface:#ffffff; --surface-2:#f9f9fb; --ink:#1d1d1f;
    --ink-2:#6e6e73; --line:#e8e8ed; --line-strong:#d2d2d7;
    /* Status (desaturated) */
    --danger:#b3362b; --danger-050:#f9edeb; --ok:#c28e00;
    /* Shape & depth */
    --r-sm:9px; --r:12px; --r-lg:16px; --r-pill:999px;
    --sh-1:0 1px 2px rgba(0,0,0,.05), 0 1px 3px rgba(0,0,0,.04);
    --sh-2:0 8px 24px rgba(0,0,0,.10), 0 2px 8px rgba(0,0,0,.06);
    --sh-focus:0 0 0 3.5px rgba(82,57,0,.25);
    /* Motion */
    --ease:cubic-bezier(.2,.7,.3,1); --dur:.18s;
  }

  * { box-sizing:border-box; }
  body { margin:0; color:var(--ink); background:var(--bg); font-size:15px; line-height:1.5;
    font-family:-apple-system,BlinkMacSystemFont,"SF Pro Text","Segoe UI",Roboto,Helvetica,Arial,sans-serif;
    -webkit-font-smoothing:antialiased; }
  a { color:var(--green); text-decoration:none; }
  .hidden { display:none !important; }
  .muted { color:var(--ink-2); }
  :focus-visible { outline:none; box-shadow:var(--sh-focus); border-radius:var(--r-sm); }

  /* ============================ Login ============================ */
  .login-wrap { min-height:100vh; display:grid; place-items:center; padding:24px;
    background:radial-gradient(1100px 520px at 50% -12%, rgba(255,255,255,.10), transparent 60%),
               linear-gradient(165deg, #c28e00 0%, #523900 100%); }
  .login-card { width:100%; max-width:384px; background:var(--surface); border-radius:var(--r-lg);
    padding:34px 30px; box-shadow:var(--sh-2); animation:rise var(--dur) var(--ease); }
  .brand { text-align:center; margin-bottom:24px; }
  .brand .mark { width:52px; height:52px; border-radius:14px; margin:0 auto 12px;
    background:var(--green); color:#ffffff; font-weight:700; font-size:19px;
    display:grid; place-items:center; }
  .brand h1 { font-size:18px; margin:0 0 3px; letter-spacing:-.01em; }
  .brand p { margin:0; font-size:13px; color:var(--ink-2); }

  /* ============================ App shell ============================ */
  .topbar { position:sticky; top:0; z-index:20; display:flex; align-items:center; gap:14px;
    padding:11px 22px; background:rgba(255,255,255,.85); color:var(--ink);
    -webkit-backdrop-filter:saturate(180%) blur(18px); backdrop-filter:saturate(180%) blur(18px);
    border-bottom:1px solid var(--line); }
  .topbar .mark { width:32px; height:32px; border-radius:9px; background:var(--green);
    color:#ffffff; font-weight:700; display:grid; place-items:center; font-size:13px; }
  .topbar h1 { flex:1; margin:0; font-size:15px; font-weight:600; letter-spacing:-.01em; }
  .topbar .who { text-align:right; font-size:12.5px; line-height:1.3; color:var(--ink-2); }
  .topbar .who b { display:block; font-weight:600; }

  .layout { display:flex; align-items:flex-start; min-height:calc(100vh - 58px); }
  .side { position:sticky; top:58px; align-self:flex-start; width:196px; flex:none; padding:16px 10px;
    background:var(--surface); border-right:1px solid var(--line); min-height:calc(100vh - 58px); }
  .side .group { font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.07em;
    color:var(--ink-2); padding:14px 12px 6px; }
  .side button { display:flex; align-items:center; justify-content:space-between; gap:8px; width:100%;
    text-align:left; border:0; background:transparent; color:var(--ink); padding:9px 12px;
    border-radius:var(--r-sm); cursor:pointer; font-size:14px; transition:background var(--dur) var(--ease); }
  .side button:hover { background:var(--surface-2); }
  .side button.active { background:var(--green-050); color:var(--green-600); font-weight:600; }
  .side button .count { font-size:11px; font-weight:600; color:var(--ink-2); background:var(--bg);
    padding:1px 8px; border-radius:var(--r-pill); }
  .side button.active .count { color:var(--green-600); background:rgba(82,57,0,.14); }

  .content { flex:1; min-width:0; padding:24px 28px; }

  /* ============================ Buttons ============================ */
  .btn { appearance:none; border:1px solid transparent; cursor:pointer; font:inherit; font-weight:600;
    font-size:14px; padding:9px 16px; border-radius:var(--r-sm); background:var(--green); color:#ffffff;
    transition:background var(--dur) var(--ease), transform var(--dur) var(--ease), opacity var(--dur); }
  .btn:hover { background:var(--green-600); }
  .btn:active { transform:translateY(1px); }
  .btn:disabled { opacity:.55; cursor:not-allowed; }
  .btn.secondary { background:var(--surface); color:var(--ink); border-color:var(--line-strong); }
  .btn.secondary:hover { background:var(--surface-2); }
  .btn.gold { background:var(--gold); color:var(--green-600); }
  .btn.gold:hover { filter:brightness(.96); }
  .btn.danger { background:var(--danger); }
  .btn.danger:hover { filter:brightness(.94); }
  .btn.sm { padding:6px 11px; font-size:12.5px; }
  .btn.ghost { background:var(--surface-2); color:var(--ink); border-color:var(--line); }
  .btn.ghost:hover { background:var(--line); }

  /* ============================ Cards & forms ============================ */
  .card { background:var(--surface); border:1px solid var(--line); border-radius:var(--r);
    box-shadow:var(--sh-1); padding:22px; margin-bottom:20px; }
  .card h2 { margin:0 0 3px; font-size:18px; letter-spacing:-.01em; }
  .card .sub { margin:0 0 18px; color:var(--ink-2); font-size:13.5px; }

  label { display:block; font-size:13px; font-weight:600; margin:14px 0 5px; }
  label .req { color:var(--danger); }
  input, select, textarea { width:100%; padding:10px 12px; font:inherit; font-size:14px; color:var(--ink);
    background:var(--surface); border:1px solid var(--line-strong); border-radius:var(--r-sm);
    transition:border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
  input:focus, select:focus, textarea:focus { outline:none; border-color:var(--green); box-shadow:var(--sh-focus); }
  input.invalid, select.invalid { border-color:var(--danger); box-shadow:0 0 0 3px var(--danger-050); }
  input[type="checkbox"], input[type="radio"] { width:16px; height:16px; padding:0; margin:0;
    flex:0 0 auto; accent-color:var(--green); }
  textarea { resize:vertical; }
  .hint { font-size:12px; color:var(--ink-2); margin-top:5px; }
  .grid2 { display:grid; grid-template-columns:1fr 1fr; gap:2px 20px; }

  /* Segmented control (tabs) */
  .segmented { display:inline-flex; background:#ececf0; border:0;
    border-radius:9px; padding:2px; gap:2px; margin-bottom:18px; }
  .segmented button { border:0; background:transparent; cursor:pointer; font:inherit; font-size:13px;
    font-weight:600; color:var(--ink-2); padding:6px 15px; border-radius:7px;
    transition:all var(--dur) var(--ease); }
  .segmented button.active { background:var(--surface); color:var(--ink);
    box-shadow:0 1px 3px rgba(0,0,0,.12), 0 0 1px rgba(0,0,0,.08); }

  /* Toolbar */
  .toolbar { display:flex; align-items:center; gap:12px; margin-bottom:14px; }
  .toolbar .search { flex:1; max-width:320px; position:relative; }
  .toolbar .search input { padding-left:34px; }
  .toolbar .search svg { position:absolute; left:11px; top:50%; transform:translateY(-50%); opacity:.5; }
  .toolbar .total { font-size:13px; color:var(--ink-2); margin-left:auto; }

  /* ============================ Table ============================ */
  .table-wrap { overflow-x:auto; border:1px solid var(--line); border-radius:var(--r); }
  table { width:100%; border-collapse:collapse; font-size:13.5px; }
  thead th { background:var(--surface-2); text-align:left; font-size:11px; font-weight:700;
    text-transform:uppercase; letter-spacing:.05em; color:var(--ink-2); padding:11px 12px;
    border-bottom:1px solid var(--line); }
  tbody td { padding:11px 12px; border-bottom:1px solid var(--line); vertical-align:top; }
  tbody tr:last-child td { border-bottom:0; }
  tbody tr:hover td { background:var(--surface-2); }
  .mono { font-family:ui-monospace,SFMono-Regular,Menlo,monospace; font-size:11.5px; color:var(--ink-2); }
  .pill { display:inline-block; padding:2px 10px; border-radius:var(--r-pill); font-size:11.5px;
    font-weight:600; background:var(--green-050); color:var(--green); }
  .pill.warn { background:#f6f1e4; color:#7c6320; }
  .chip-lec { display:inline-block; background:#eef2f8; color:#3a5a80; border-radius:var(--r-pill);
    padding:3px 10px; font-size:12.5px; margin:2px 4px 2px 0; }
  .chip-lec .x { cursor:pointer; color:var(--danger); font-weight:700; margin-left:5px; text-decoration:none; }
  .segmented.sm { margin:0; padding:2px; }
  .segmented.sm button { padding:4px 12px; font-size:12px; }
  .row-actions { display:flex; gap:6px; white-space:nowrap; }

  .empty { text-align:center; color:var(--ink-2); padding:40px 20px; }
  .empty svg { opacity:.35; margin-bottom:10px; }

  /* ============================ Skeleton ============================ */
  .skeleton { border-radius:var(--r-sm);
    background:linear-gradient(90deg,#efeff2 25%,#e4e4e9 37%,#efeff2 63%);
    background-size:400% 100%; animation:shimmer 1.3s ease infinite; height:14px; }
  .sk-row { height:44px; margin-bottom:8px; }
  @keyframes shimmer { 0%{background-position:100% 0;} 100%{background-position:0 0;} }

  /* ============================ Modal ============================ */
  .modal-backdrop { position:fixed; inset:0; z-index:100; display:grid; place-items:center; padding:20px;
    background:rgba(0,0,0,.34); -webkit-backdrop-filter:blur(7px); backdrop-filter:blur(7px);
    animation:fade var(--dur) var(--ease); }
  .modal { width:100%; max-width:460px; background:var(--surface); border-radius:16px;
    box-shadow:0 24px 64px rgba(0,0,0,.22), 0 4px 16px rgba(0,0,0,.10);
    overflow:hidden; animation:rise var(--dur) var(--ease); }
  .modal .head { padding:20px 22px 0; }
  .modal .head h3 { margin:0 0 4px; font-size:17px; letter-spacing:-.01em; }
  .modal .head p { margin:0; color:var(--ink-2); font-size:13.5px; }
  .modal .body { padding:14px 22px; max-height:60vh; overflow:auto; }
  .modal .foot { display:flex; justify-content:flex-end; gap:10px; padding:14px 22px 20px;
    border-top:1px solid var(--line); margin-top:6px; }

  /* ============================ Toast ============================ */
  #toast { position:fixed; right:20px; bottom:20px; z-index:200; display:flex; flex-direction:column; gap:8px; }
  .toast { display:flex; align-items:center; gap:8px; max-width:360px; background:#1d1d1f; color:#ffffff;
    padding:12px 15px; border-radius:var(--r); box-shadow:var(--sh-2); font-size:13.5px;
    animation:rise var(--dur) var(--ease); }
  .toast.ok { background:var(--ok); }
  .toast.err { background:var(--danger); }

  /* Reports & misc */
  .report { background:var(--surface-2); border:1px dashed var(--line-strong); border-radius:var(--r-sm);
    padding:14px; margin-top:14px; font-size:13px; }
  .report .err { color:var(--danger); }
  .spinner { display:inline-block; width:15px; height:15px; border:2px solid rgba(255,255,255,.35);
    border-top-color:#ffffff; border-radius:50%; animation:spin .7s linear infinite; vertical-align:-2px; }
  .spinner.dark { border-color:var(--line-strong); border-top-color:var(--green); }
  @keyframes spin { to { transform:rotate(360deg); } }
  @keyframes rise { from{transform:translateY(8px);opacity:0;} to{transform:none;opacity:1;} }
  @keyframes fade { from{opacity:0;} to{opacity:1;} }

  /* ============================ Dashboard ============================ */
  .welcome h2 { font-size:20px; }
  .row-between { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:12px; }
  .stat-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(150px,1fr)); gap:14px; margin-bottom:20px; }
  .stat { text-align:left; cursor:pointer; border:1px solid var(--line); background:var(--surface);
    border-radius:var(--r); padding:16px 18px; box-shadow:var(--sh-1); display:flex; flex-direction:column; gap:2px;
    transition:transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur); }
  .stat:hover { transform:translateY(-2px); box-shadow:var(--sh-2); border-color:var(--line-strong); }
  .stat .n { font-size:28px; font-weight:700; letter-spacing:-.02em; color:var(--green); line-height:1.1; }
  .stat .l { font-size:12.5px; font-weight:600; color:var(--ink-2); }

  /* Capacity bars */
  .bars { display:flex; flex-direction:column; gap:10px; }
  .bar-row { display:grid; grid-template-columns:160px 1fr 64px; align-items:center; gap:12px; font-size:13px; }
  .bar-l { color:var(--ink); }
  .bar-track { height:10px; background:var(--bg); border-radius:var(--r-pill); overflow:hidden; }
  .bar-fill { height:100%; border-radius:var(--r-pill);
    background:linear-gradient(90deg, var(--green), #c28e00); transition:width .4s var(--ease); }
  .bar-v { text-align:right; font-variant-numeric:tabular-nums; color:var(--ink-2); font-weight:600; }

  /* Activity feed */
  .feed { display:flex; flex-direction:column; }
  .feed-item { display:flex; gap:12px; padding:11px 2px; border-bottom:1px solid var(--line); }
  .feed-item:last-child { border-bottom:0; }
  .feed-item .dot { width:9px; height:9px; border-radius:50%; margin-top:6px; flex:none; }
  .fi-main { flex:1; min-width:0; }
  .fi-main .muted { margin-left:2px; }
  .fi-time { font-size:12px; color:var(--ink-2); margin-top:2px; }
  .dot-inline { display:inline-block; width:8px; height:8px; border-radius:50%; margin-right:7px; vertical-align:1px; }

  /* ======================= Page bar (unified header) =======================
     One slim strip replaces the old stack of tall header cards. Row 1 carries
     the page name and context selectors on the left, tools and status on the
     right. Row 2 (optional) carries filters. It sticks under the topbar so the
     controls stay reachable while a long timetable scrolls. */
  .pagebar { background:var(--surface); border:1px solid var(--line); border-radius:var(--r);
    box-shadow:var(--sh-1); margin-bottom:18px; position:sticky; top:58px; z-index:15; }
  .pagebar-row { display:flex; align-items:center; gap:10px; padding:8px 13px; flex-wrap:wrap; row-gap:0; }
  .pagebar-row + .pagebar-row { border-top:1px solid var(--line); padding-top:8px; padding-bottom:8px; }
  .pb-id { display:flex; align-items:center; gap:7px; min-width:0; }
  .pb-title { margin:0; font-size:15.5px; font-weight:700; letter-spacing:-.01em; white-space:nowrap; }
  /* `margin-left:auto` pinned the tools to the right, which meant that WHENEVER
     they wrapped they landed right-aligned with dead space beside them - the
     orphan row. Letting the context group absorb the slack instead pushes the
     tools right while they fit, and drops them flush left the moment they do
     not, at any width and with no breakpoint to keep in step. */
  .pb-right { display:flex; align-items:center; gap:7px; }
  .pagebar-row:has(.pb-group) .pb-right { margin-left:0; }
  .pagebar-row:not(:has(.pb-group)) .pb-right { margin-left:auto; }
  .pb-group { display:flex; align-items:center; gap:8px; min-width:0; flex:1 1 auto; }
  .pb-sep { width:1px; align-self:stretch; min-height:24px; background:var(--line); margin:0 1px; }

  /* Compact inline context field: small caps label beside a small select. */
  .pb-field { display:inline-flex; align-items:center; gap:6px; margin:0; position:relative; }
  .pb-field > .pb-lab { font-size:10px; font-weight:700; letter-spacing:.04em; text-transform:uppercase;
    color:var(--ink-2); white-space:nowrap; }
  .pb-field select { width:auto; min-width:88px; max-width:210px; padding:5px 8px; font-size:13px;
    font-weight:600; border-radius:8px; background:var(--surface-2); border-color:var(--line); }
  .pb-field select:hover { border-color:var(--line-strong); background:var(--surface); }
  .pb-static { font-size:13px; font-weight:600; color:var(--ink); white-space:nowrap; }

  /* Bar buttons - quieter than .btn so the bar reads as chrome, not content. */
  .pb-btn { display:inline-flex; align-items:center; gap:5px; border:1px solid var(--line-strong);
    background:var(--surface); color:var(--ink); font:inherit; font-size:12.5px; font-weight:600;
    padding:6px 10px; border-radius:8px; cursor:pointer; white-space:nowrap;
    transition:background var(--dur) var(--ease), border-color var(--dur) var(--ease); }
  .pb-btn:hover { background:var(--surface-2); border-color:var(--ink-2); }
  .pb-btn .caret { font-size:9px; color:var(--ink-2); }
  .pb-btn.warn { border-color:#e8c98f; background:#fff7ea; color:#8a5a00; }
  .pb-btn.warn:hover { background:#fdf0da; }
  .pb-btn.primary { background:var(--green); border-color:var(--green); color:#ffffff; }
  .pb-btn.primary:hover { background:var(--green-600); border-color:var(--green-600); }
  .pb-help { width:21px; height:21px; padding:0; justify-content:center; border-radius:50%;
    font-size:12px; color:var(--ink-2); border-color:var(--line); }
  .pagebar .segmented.sm button { padding:4px 11px; }

  /* Status pill that doubles as its own menu button. */
  .pb-status { display:inline-flex; align-items:center; gap:6px; border:1px solid; border-radius:var(--r-pill);
    padding:5px 11px; font:inherit; font-size:12px; font-weight:700; cursor:pointer; white-space:nowrap; }
  .pb-status .dot { width:7px; height:7px; border-radius:50%; flex:0 0 auto; }
  .pb-status.draft { background:#fff7ea; color:#8a5a00; border-color:#e8c98f; }
  .pb-status.draft .dot { background:#d89b24; }
  .pb-status.rel { background:var(--green-050); color:#523900; border-color:#fbd65d; }
  .pb-status.rel .dot { background:var(--ok); }
  /* Nothing published yet, or published then withdrawn - neutral, not alarming. */
  .pb-status.none { background:var(--surface-2); color:var(--ink-2); border-color:var(--line-strong); }
  .pb-status.none .dot { background:var(--line-strong); }
  .pb-status.plain { cursor:default; }
  .menu .mtick { display:inline-block; width:15px; color:var(--green); font-weight:700; }

  /* Filter row: a labelled segmented control per axis. */
  .pb-fgroup { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
  .pb-flabel { font-size:10.5px; font-weight:700; letter-spacing:.05em; text-transform:uppercase;
    color:var(--ink-2); white-space:nowrap; }
  .pb-fgroup .segmented { margin-bottom:0; }

  /* ---- keeping the bar on ONE line -------------------------------------
     The bar never breaks into a second row on a working-size window. As space
     runs out it gives up ornament in order of how little it is missed, so the
     controls themselves survive intact at every stage:
       <1600  the YEAR / SEMESTER captions go (the values say what they are,
              and the select keeps its aria-label and tooltip)
       <1280  separators, the help "?" and some padding go
       <1140  the page title goes - the sidebar already says which page this is
       <1000  type and padding step down one notch
     Only below 960px, where one line is genuinely impossible, does it wrap - and
     then the tools take a bordered row of their own, flush with the left edge.
     Nothing here uses overflow:hidden, which would clip the dropdowns. */
  @media (max-width:1600px){
    .pb-field > .pb-lab { position:absolute; width:1px; height:1px; margin:-1px; padding:0;
      overflow:hidden; clip:rect(0 0 0 0); clip-path:inset(50%); white-space:nowrap; border:0; }
  }
  @media (max-width:1280px){
    .pagebar-row { gap:8px; padding:8px 11px; }
    .pb-sep, .pb-help { display:none; }
    .pb-group { gap:6px; }
    .pb-right { gap:6px; }
    .pb-btn { padding:6px 9px; }
    .pb-status { padding:5px 10px; }
    .pagebar .segmented.sm button { padding:4px 10px; }
  }
  @media (max-width:1140px){
    .pb-id { display:none; }
    .pb-field select { max-width:150px; }
  }
  @media (max-width:1000px){
    .pagebar-row { gap:6px; padding:7px 9px; }
    .pb-right { gap:5px; }
    .pb-btn, .pb-status { font-size:12px; padding:5px 8px; }
    .pagebar .segmented.sm button { padding:4px 9px; font-size:11.5px; }
    .pb-field select { max-width:128px; padding:5px 6px; font-size:12.5px; }
  }
  @media (max-width:959px){
    .pagebar { position:static; }
    .pagebar-row { flex-wrap:wrap; }
    .pb-group { flex-wrap:wrap; }
    .pb-right { margin-left:0; width:100%; justify-content:flex-start; flex-wrap:wrap;
      border-top:1px solid var(--line); margin-top:8px; padding-top:8px; }
    .pb-field select { min-width:0; flex:1 1 auto; }
  }

  /* ============================ Timetable ============================ */
  .ctx-bar { display:flex; flex-wrap:wrap; gap:10px 14px; align-items:flex-end; padding:12px 14px; margin:12px 0 4px;
    background:var(--surface-2); border:1px solid var(--line); border-radius:var(--r); }
  .ctx-bar label { margin:0 0 4px; font-size:10.5px; font-weight:700; letter-spacing:.05em; color:var(--ink-2); text-transform:uppercase; }
  .ctx-bar select { min-width:152px; padding:7px 10px; font-size:13.5px; }
  .ctx-bar > * { display:flex; flex-direction:column; }
  .ctx-static { font-size:13.5px; font-weight:600; color:var(--ink); padding:7px 10px; min-width:152px;
    background:var(--surface); border:1px solid var(--line); border-radius:var(--r-input,10px); }

  /* Page header: title/description left, grouped action toolbar right */
  .page-head { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; flex-wrap:wrap; margin-bottom:4px; }
  .page-head-text { min-width:260px; flex:1 1 340px; }
  .tt-toolbar { display:flex; align-items:center; gap:10px; flex-wrap:wrap; justify-content:flex-end; }
  .tt-toolbar .tt-actions { display:inline-flex; gap:8px; flex-wrap:wrap; }
  .tt-toolbar .btn.sm { white-space:nowrap; }
  .segmented.wrap { flex-wrap:wrap; }
  .tt-controls { display:flex; flex-wrap:wrap; gap:10px; margin:14px 0 6px; }
  .tt-legend { display:flex; flex-wrap:wrap; gap:16px; font-size:12px; color:var(--ink-2); margin:6px 0 14px; }
  .tt-legend .lg { display:inline-block; width:12px; height:12px; border-radius:3px; vertical-align:-2px; margin-right:5px; }
  .tt-legend .lg-conf { background:var(--danger-050); border:1.5px solid var(--danger); }
  .tt-legend .lg-ro { background:var(--surface-2); border:1.5px solid var(--line-strong); }
  .tt-legend .lg-over { background:#fff6e6; border:1.5px solid #e8a50e; }
  .tt-legend .lg-under { background:#eaf1fb; border:1.5px solid #4a80c8; }

  /* The grid scrolls inside its own box. It used to scroll horizontally only,
     so vertical scrolling happened on the page and the sticky header pinned to
     the viewport top - behind the page bar. Owning both axes means the header
     pins to the top of the GRID, where it belongs. */
  .tt-wrap { overflow:auto; max-height:calc(100vh - 250px); min-height:260px;
    border:1px solid var(--line-strong); border-radius:var(--r); background:var(--surface); }
  table.tt { border-collapse:separate; border-spacing:0; width:100%; }
  table.tt th, table.tt td { border-bottom:1px solid var(--line); border-right:1px solid var(--line); }
  table.tt th { background:var(--surface-2); font-size:11.5px; font-weight:700; letter-spacing:.02em;
    color:var(--ink); padding:9px 10px; text-align:left; position:sticky; top:0; z-index:2; white-space:nowrap;
    box-shadow:inset 0 -2px 0 var(--line-strong); }
  table.tt th.ro { color:var(--ink-2); background:#f3f5f4; }
  table.tt th.tt-time, table.tt td.tt-time { position:sticky; left:0; z-index:1; background:var(--surface-2);
    min-width:120px; font-size:12.5px; }
  table.tt th.tt-time { z-index:3; }
  table.tt td.tt-time { color:var(--ink); padding:9px 10px; border-right:2px solid var(--line-strong); }
  table.tt td.tt-time .muted { font-size:11px; }

  /* Adjacent programme columns need to be told apart at a glance: a stronger
     rule between them, and alternating tints so the eye can track a column
     down a long grid. */
  table.tt th:not(.tt-time), table.tt td:not(.tt-time) { border-right:1px solid var(--line-strong); }
  table.tt td:nth-of-type(even):not(.tt-time) { background:#fafbfa; }
  table.tt tbody tr:hover td:not(.tt-time) { background:#fffcec; }
  table.tt tbody tr:hover td.tt-time { background:#fffae0; }

  .tt-cell { padding:5px; vertical-align:top; min-width:150px; background:var(--surface); position:relative; }
  .tt-cell.ro { background:var(--surface-2); }
  .tt-cell.conflict { background:var(--danger-050); box-shadow:inset 0 0 0 2px rgba(192,57,43,.35); }
  /* Started but not finished - needs attention, but it is not an error. */
  .tt-cell.partial { background:#fffbf0; box-shadow:inset 0 0 0 2px rgba(216,155,36,.45); }
  .partial-badge { position:absolute; top:3px; right:4px; font-size:9px; color:#d89b24; }
  .tt-legend .lg-part { background:#fffbf0; border:1.5px solid #d89b24; }

  .chip { display:block; width:100%; text-align:left; border-radius:7px; padding:5px 9px; margin-bottom:4px;
    font-size:12.5px; line-height:1.25; border:1px solid transparent; transition:background var(--dur) var(--ease); }
  .chip:last-child { margin-bottom:0; }
  .chip-course   { background:var(--green-050); color:var(--green-600); font-weight:700; }
  .chip-lecturer { background:#eef2f8; color:#3a5a80; }
  .chip-resource { background:#f6f1e4; color:#7c6320; }
  .chip-activity { background:#ede7f6; color:#5b3fa0; font-weight:600; font-size:11px; }
  .tt-cell.softwarn { box-shadow: inset 0 0 0 2px #f4b740; }
  .travel-badge, .load-badge { position:absolute; font-size:10px; font-weight:800; color:#ffffff;
    background:#c77700; border-radius:4px; padding:0 3px; line-height:14px; }
  .travel-badge { top:2px; right:2px; }
  .load-badge { top:2px; right:20px; background:#8a5a00; }
  .fix-room { position:absolute; bottom:2px; right:2px; font-size:9px; padding:1px 4px;
    border:1px solid var(--green-400,#c28e00); background:#ffffff; color:var(--green-600,#523900);
    border-radius:4px; cursor:pointer; }
  .fix-room:hover { background:var(--green-050,#fffae0); }
  /* Exam timetable */
  .exam-week { display:grid; grid-template-columns:repeat(auto-fill,minmax(180px,1fr)); gap:10px; }
  .exam-slot { border:1px solid var(--line,#e3e3e7); border-radius:8px; overflow:hidden; }
  .exam-slot-head { background:var(--green-050,#fffae0); padding:6px 8px; font-weight:600; font-size:12.5px; }
  .exam-slot-body { padding:6px; display:flex; flex-direction:column; gap:6px; min-height:40px; }
  .exam-card { border:1px solid var(--line,#e3e3e7); border-radius:6px; padding:6px 7px; background:#ffffff; }
  .exam-card.bad { border-color:#e5484d; background:#fff5f5; }
  .ex-code { font-weight:700; font-size:12.5px; }
  .ex-rooms { color:#3c3c43; }
  .ex-actions { margin-top:5px; display:flex; gap:5px; }
  .ex-flag { display:inline-block; font-size:9px; font-weight:800; color:#ffffff; border-radius:3px; padding:0 4px; margin-left:4px; vertical-align:middle; }
  .ex-flag.clash { background:#e5484d; } .ex-flag.over { background:#c77700; } .ex-flag.load { background:#8a5a00; } .ex-flag.mix { background:#5b3fa0; }
  /* CBT is a state, not a problem: teal rather than a warning colour. The span
     counter next to it says which session of the run this card is. */
  .ex-flag.cbt { background:#523900; } .ex-flag.span { background:#4a5568; }
  .exam-card.cbt { border-left:3px solid #523900; }
  /* The continuation card is quieter - the real entry is the session above. */
  .exam-card.cont { opacity:.72; border-style:dashed; }
  .exam-unplaced { display:grid; grid-template-columns:repeat(auto-fill,minmax(180px,1fr)); gap:8px; }
  .btn.xs { font-size:10px; padding:2px 7px; }
  .cfg-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(180px,1fr)); gap:10px; margin-bottom:10px; }
  .cfg-block { margin-top:10px; } .cfg-h { font-weight:600; margin-bottom:6px; }
  .day-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(120px,1fr)); gap:4px; }
  .chkline { display:flex; align-items:center; gap:6px; font-size:13px; }
  .sess-row { display:grid; grid-template-columns:1fr auto auto auto; gap:6px; margin-bottom:6px; align-items:center; }
  .ex-sess { margin-bottom:12px; } .ex-sess-h { font-weight:600; background:var(--green-050,#fffae0); padding:5px 8px; border-radius:6px 6px 0 0; }
  table.exs { width:100%; border-collapse:collapse; font-size:12px; }
  table.exs th, table.exs td { border:1px solid var(--line,#e3e3e7); padding:3px 6px; text-align:left; }
  table.exs th.n, table.exs td.n { text-align:right; }
  table.exs tr.tot td { font-weight:700; background:#fafafa; }
  table.exs td.ex-rowact { white-space:nowrap; }
  .btn.xs { font-size:10px; padding:2px 6px; }
  /* Print-style exam document (View mode) */
  .exam-doc { background:#ffffff; padding:16px; position:relative; overflow:hidden; }
  /* Watermark tiled down the document, behind the tables. Repeated rather than
     centred once, so it reads on a long multi-day timetable as well as a short
     one. Purely decorative - aria-hidden, and never intercepts clicks. */
  .exd-wm { position:absolute; inset:0; z-index:0; pointer-events:none; user-select:none;
    display:flex; flex-direction:column; justify-content:space-around; align-items:center; }
  .exd-wm span { font-size:clamp(38px, 9vw, 96px); font-weight:800; letter-spacing:.14em;
    color:rgba(179,54,43,.07); transform:rotate(-24deg); white-space:nowrap; line-height:1; }
  .exd-wm.final span { color:rgba(82,57,0,.08); }
  .exam-doc > *:not(.exd-wm) { position:relative; z-index:1; }
  .exd-head { text-align:center; margin-bottom:12px; }
  .exd-title { font-weight:800; font-size:15px; letter-spacing:.02em; }
  .status-bar { margin-top:8px; padding:8px 10px; border:1px solid var(--line,#e3e3e7); border-radius:8px; background:var(--surface-2,#fafafa); font-size:12.5px; }
  /* ---- exam toolbar (horizontal, tidy) ---- */
  .exbar-h { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:10px; }
  .exbar-left, .exbar-right { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
  .exbar-summary { background:none; border:none; color:#555555; font-size:12.5px; cursor:pointer; padding:4px 2px; white-space:nowrap; }
  .exbar-summary .caret { color:#999999; font-size:10px; }
  .exbar-summary:hover { color:#111111; }
  /* dropdown menu */
  .menu-wrap { position:relative; display:inline-block; }
  .menu { position:absolute; top:calc(100% + 4px); left:0; z-index:40; min-width:210px;
    background:#ffffff; border:1px solid var(--line,#d9d9de); border-radius:10px; box-shadow:0 10px 28px rgba(0,0,0,.14);
    padding:5px; display:none; }
  .menu.right { left:auto; right:0; }
  .menu.wide { min-width:260px; }
  .menu.show { display:block; }
  .menu button { display:block; width:100%; text-align:left; background:none; border:none; border-radius:7px;
    padding:8px 11px; font-size:13px; cursor:pointer; color:var(--ink,#222222); }
  .menu button:hover { background:var(--surface-2,#f2f3f5); }
  .menu button.danger { color:#b3261e; }
  .menu button.danger:hover { background:#fdeceb; }
  .menu .menu-sec { font-size:10.5px; text-transform:uppercase; letter-spacing:.04em; color:#8a8a90;
    padding:7px 11px 3px; font-weight:700; }
  .menu .menu-div { height:1px; background:var(--line,#eeeeee); margin:5px 4px; }
  .menu .menu-info { padding:6px 11px; font-size:12px; color:#444444; line-height:1.4; }
  @media (max-width:640px){ .exbar-h { flex-direction:column; align-items:stretch; } .exbar-right { justify-content:flex-start; } }
  .status-bar select { margin:0 4px; }
  .tt-badge { display:inline-block; padding:2px 8px; border-radius:999px; font-weight:700; font-size:11.5px; }
  .tt-badge.draft { background:#fff4e5; color:#8a5a00; border:1px solid #e8c98f; }
  .tt-badge.rel { background:#fffade; color:#523900; border:1px solid #fbd65d; }
  .exd-sub { font-weight:700; font-size:12.5px; margin-top:2px; margin-bottom:8px; }
  /* Exam document tables: strong, complete borders and consistent fixed columns */
  table.exd-tbl { width:100%; border-collapse:collapse; table-layout:fixed;
    margin:0 0 12px; font-size:11.5px; border:1.5px solid #111111; }
  table.exd-tbl th, table.exd-tbl td {
    border:1px solid #333333; padding:2px 6px; text-align:left; vertical-align:top;
    line-height:1.25; overflow:hidden; overflow-wrap:anywhere; }
  table.exd-tbl th.n, table.exd-tbl td.n { text-align:right; }
  /* fixed column widths (table-layout:fixed makes these authoritative) */
  col.c-code { width:8%; } col.c-name { width:24%; } col.c-exmr { width:16%; }
  col.c-cls { width:9%; } col.c-stds { width:6%; } col.c-room { width:31%; }
  col.c-prt { width:6%; } col.c-act { width:10%; }
  tr.exd-day th { text-align:center; font-weight:800; background:#e9e9e9; font-size:12.5px; border:1.5px solid #111111; }
  tr.exd-sess th { text-align:center; font-weight:700; background:#f4f4f4; border:1px solid #333333; }
  tr.exd-cols th { background:#e0e0e0; font-weight:700; border:1px solid #111111; }
  table.exd-tbl tbody tr:last-child td { border-bottom:1.5px solid #111111; }
  td.exd-room-merged { text-align:center; font-weight:700; vertical-align:middle; }
  tr.exd-tot td { font-weight:700; background:#fafafa; }
  .exd-tbl .mono { font-family:'DejaVu Sans Mono',Consolas,monospace; white-space:nowrap; }
  .exd-tbl td.ex-rowact { white-space:nowrap; }
  .exd-tbl td.ex-rowact .btn.xs { padding:1px 5px; font-size:9.5px; }
  .ex-modetog { display:inline-flex; border:1px solid var(--line-strong,#c9c9cf); border-radius:6px; overflow:hidden; vertical-align:middle; }
  .ex-modetog button { border:none; background:#ffffff; padding:4px 12px; cursor:pointer; font-size:12px; }
  .ex-modetog button.active { background:var(--green-600,#523900); color:#ffffff; }
  .chk-col { width:34px; text-align:center; }
  .chk-col input { cursor:pointer; width:16px; height:16px; }
  tr.row-sel td { background:var(--green-050); }
  .sel-bar { display:flex; align-items:center; gap:10px; padding:8px 12px; margin:6px 0;
    background:#fff7e6; border:1px solid var(--gold-300, #e5c55a); border-radius:8px; }
  .sel-bar #selCount { font-weight:600; color:var(--ink-1, #1c1c1e); margin-right:auto; }
  .vc-act { font-size:10.5px; color:#5b3fa0; font-weight:600; text-transform:uppercase; letter-spacing:.02em; margin-top:1px; }
  /* Flat: no dashed boxes on every empty field. An empty chip is a quiet slot
     that names itself when you reach for it. */
  .chip.empty { background:transparent; color:transparent; border:1px solid transparent;
    font-weight:500; min-height:24px; }
  .tt-cell:not(.ro) .chip.empty:hover::before,
  .tt-cell:not(.ro) .chip.empty:focus::before { content:attr(data-ph); color:var(--ink-2); }
  .tt-cell:not(.ro) .chip.empty:hover,
  .tt-cell:not(.ro) .chip.empty:focus { background:var(--surface-2); border-color:var(--line-strong); }
  /* A hint that the row holds something, without spelling it out on all of them. */
  .tt-cell:hover .chip.empty { border-color:var(--line); }
  .tt-cell:not(.ro) .chip[role="button"] { cursor:pointer; }
  .tt-cell:not(.ro) .chip[role="button"]:hover { filter:brightness(.97); }
  .tt-cell:not(.ro) .chip.empty:hover::before { color:var(--green); }
  .chip[role="button"]:focus-visible { box-shadow:var(--sh-focus); }
  .chip.chip-conf { box-shadow:inset 0 0 0 1.5px var(--danger); }

  /* Picker dialog list */
  .pick-list { max-height:46vh; overflow:auto; border:1px solid var(--line); border-radius:12px; padding:4px; }
  .pick-item { display:flex; align-items:center; gap:10px; width:100%; text-align:left; border:0;
    background:transparent; padding:10px 12px; cursor:pointer; font:inherit; font-size:14px;
    border-bottom:1px solid var(--line); }
  .pick-item:last-child { border-bottom:0; }
  .pick-item:hover { background:var(--surface-2); }
  .pick-item.sel { background:var(--green-050); }
  .pick-item .muted { margin-left:auto; font-size:12.5px; }
  .pick-item .tick { color:var(--green); font-weight:700; margin-left:8px; }

  /* ============================ Responsive ============================ */
  @media (max-width:720px) {
    .layout { flex-direction:column; }
    .side { position:static; width:auto; min-height:0; border-right:0; border-bottom:1px solid var(--line);
      display:flex; flex-wrap:wrap; gap:6px; }
    .side .group { width:100%; }
    .side button { width:auto; }
    .grid2 { grid-template-columns:1fr; }
    .content { padding:18px 16px; }
  }
  @media (prefers-reduced-motion:reduce) { * { animation:none !important; transition:none !important; } }

  /* Multi-select rows: fixed 16px control column, text takes the rest. */
  .pick-check { display:grid; grid-template-columns:16px 1fr; align-items:start; column-gap:12px;
    padding:10px 12px; min-height:42px; border-radius:9px; cursor:pointer; font-size:14px; line-height:1.4; }
  .pick-check:hover { background:var(--surface-2); }
  .pick-check input { margin-top:2px; }
  .pick-check .pl { min-width:0; overflow-wrap:anywhere; }
  .pick-check .pl .muted { display:block; font-size:12.5px; margin-top:1px; }

  /* Timetable clean VIEW mode: content only, deeper borders */
  .tt.view-mode { border:2px solid #3a3a3c; }
  .tt.view-mode th, .tt.view-mode td { border:1.5px solid #3a3a3c; }
  .tt.view-mode th { background:var(--green); color:#ffffff; }
  .tt.view-mode .tt-cell.view { padding:6px 7px; min-width:90px; }
  .vc-course { font-weight:700; font-size:12.5px; }
  .vc-sub { font-size:11.5px; color:#3c3c43; margin-top:1px; }

  .modal-backdrop.closing { animation:fadeOut .16s var(--ease) forwards; }
  .modal-backdrop.closing .modal { animation:sink .16s var(--ease) forwards; }
  @keyframes fadeOut { to { opacity:0; } }
  @keyframes sink { to { transform:translateY(6px) scale(.98); opacity:0; } }

  /* Resource Allocation grid */
  .ra-legend { display:flex; gap:8px; margin:0 0 10px; flex-wrap:wrap; }
  .ra-pill { font-size:11.5px; font-weight:600; padding:3px 10px; border-radius:var(--r-pill); border:1px solid var(--line); }
  .ra-pill.fac { background:#eaf1fb; color:#1d4e9e; border-color:#c9dbf5; }
  .ra-pill.dep { background:var(--green-050); color:var(--green-600); border-color:#fce28c; }
  .ra-pill.mine { background:var(--gold); color:#3a2b00; border-color:transparent; }
  .ra-pill.free { background:#ffffff; color:var(--muted); }
  .ra-grid td.ra-cell { min-width:86px; height:40px; text-align:center; vertical-align:middle; }
  .ra-grid td.ra-cell.can { cursor:pointer; }
  .ra-grid td.ra-cell.can:hover { box-shadow:inset 0 0 0 2px var(--green); }
  .ra-grid td.ra-cell.fac { background:#eaf1fb; }
  .ra-grid td.ra-cell.dep { background:var(--green-050); }
  .ra-grid td.ra-cell.mine { box-shadow:inset 0 0 0 2.5px var(--gold); }
  .ra-grid .ra-tag { font-size:11px; font-weight:700; color:var(--ink); }
  .ra-grid td.ra-cell.fac .ra-tag { color:#1d4e9e; }
  .ra-grid td.ra-cell.dep .ra-tag { color:var(--green-600); }

  /* Resource Allocation - top-down builder additions */
  .ra-assignbar { display:flex; align-items:flex-end; justify-content:space-between; gap:14px;
    background:var(--green-050); border:1px solid #fce28c; border-radius:var(--r-md); padding:12px 14px; margin:0 0 12px; flex-wrap:wrap; }
  .ra-assign-left { display:flex; flex-direction:column; gap:5px; min-width:280px; flex:1; }
  .ra-assign-left label { font-size:12px; font-weight:600; color:var(--muted); }
  .ra-assign-left select { min-width:280px; }
  .ra-assign-right { display:flex; align-items:center; gap:10px; }
  .ra-day { margin:16px 0 6px; font-size:13px; color:var(--green-600); }
  .ra-pill.pick { background:var(--gold); color:#3a2b00; border-color:transparent; }
  .ra-grid td.ra-cell.pick { background:var(--gold); box-shadow:inset 0 0 0 2px var(--green-600); }
  .ra-grid td.ra-cell.pick .ra-tag { color:#3a2b00; }
  .ra-grid td.ra-cell.locked { opacity:.55; cursor:not-allowed; }

  /* Clash tooltip + badge */
  .tt-cell.conflict { position:relative; }
  .clash-badge { position:absolute; top:2px; right:3px; width:15px; height:15px; line-height:15px;
    text-align:center; font-size:11px; font-weight:800; color:#ffffff; background:var(--danger,#d8422a);
    border-radius:50%; box-shadow:0 1px 2px rgba(0,0,0,.25); pointer-events:none; }
  .clash-tip { position:absolute; z-index:1000; max-width:340px; background:#1d1d1f; color:#ffffff;
    border-radius:10px; padding:9px 11px; font-size:12px; line-height:1.5;
    box-shadow:0 8px 26px rgba(0,0,0,.28); pointer-events:none; animation:tipIn .12s var(--ease); }
  .clash-tip b { display:block; margin-bottom:3px; color:#ffd9d2; font-size:12.5px; }
  .clash-tip div { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  @keyframes tipIn { from{opacity:0; transform:translateY(-3px);} to{opacity:1; transform:none;} }

  /* Timetable workflow banner */
  #ttWorkflow:empty { display:none; }
  .wf-bar { display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap;
    background:var(--surface-2); border:1px solid var(--line); border-radius:var(--r); padding:10px 14px; margin:12px 0 2px; }
  .wf-left, .wf-right { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
  .wf-chip { font-size:12px; font-weight:600; padding:3px 10px; border-radius:var(--r-pill); background:var(--green-050); color:var(--green-600); border:1px solid #fce28c; }
  .wf-chip.final { background:#fdebe7; color:#b23a20; border-color:#f3c4b8; }
  .wf-chip.st-submitted { background:#fff4d6; color:#8a6100; border-color:#f0dca0; }
  .wf-chip.st-approved { background:var(--green-050); color:var(--green-600); border-color:#fce28c; }
  .wf-chip.st-rejected { background:#fdebe7; color:#b23a20; border-color:#f3c4b8; }
  .wf-chip.st-draft { background:#ececf0; color:#555555; border-color:var(--line); }
  .wf-note { font-size:12px; font-style:italic; color:var(--ink-2); }
  .wf-field { display:inline-flex; align-items:center; gap:6px; }
  .wf-field label { font-size:12px; font-weight:600; color:var(--ink-2); margin:0; }
  .wf-field select { padding:5px 8px; }
  .wf-review, .wf-ver { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:10px 4px; border-bottom:1px solid var(--line); }
  .wf-review:last-child, .wf-ver:last-child { border-bottom:none; }

  /* Over-capacity (class size > room seats): amber, distinct from red clash */
  .tt-cell.overcap { background:#fff6e6; box-shadow:inset 0 0 0 1.5px #e8a50e; }
  .over-badge { position:absolute; top:2px; right:3px; width:15px; height:15px; line-height:15px;
    text-align:center; font-size:10px; color:#7a5600; background:#f6c651; border-radius:50%;
    box-shadow:0 1px 2px rgba(0,0,0,.2); pointer-events:none; }
  /* Class-size inputs */
  .sz-input { width:84px; padding:5px 8px; font-size:13px; }
  .sz-grid { display:grid; grid-template-columns:1fr 1fr; gap:10px 16px; }
  .sz-row { display:flex; align-items:center; gap:10px; }
  .sz-row label { font-size:12.5px; font-weight:600; color:var(--ink-2); min-width:56px; margin:0; }

  /* Workflow publish row + implication text */
  .wf-bar.wf-publish { margin-top:8px; background:var(--surface); border-style:dashed; }
  .wf-pub-label { font-size:12px; font-weight:700; letter-spacing:.02em; text-transform:uppercase; color:var(--ink-2); margin-right:4px; }
  .wf-impl { margin-top:12px; padding:10px 12px; border-radius:10px; background:var(--green-050);
    border:1px solid #fce28c; font-size:12.5px; line-height:1.5; color:var(--ink); }
  .wf-impl.danger { background:#fdebe7; border-color:#f3c4b8; color:#7a2414; }
  .over-badge.shift { right:20px; }   /* sit left of the clash badge when both show */

  /* Under-utilized room (room >= 2x class): blue, distinct from amber over-cap */
  .tt-cell.undercap { background:#eaf1fb; box-shadow:inset 0 0 0 1.5px #4a80c8; }
  .under-badge { position:absolute; top:2px; right:3px; width:15px; height:15px; line-height:15px;
    text-align:center; font-size:9px; color:#1d4e9e; background:#bbd3f2; border-radius:50%;
    box-shadow:0 1px 2px rgba(0,0,0,.15); pointer-events:none; }

  .row-archived { opacity:.72; }
  .row-archived .mono { font-style:italic; }

  /* Resource allocation - list builder */
  .ra-toolbar-row { margin:10px 0 4px; }
  .ra-mode { display:inline-flex; }
  .ra-draft-wrap { display:flex; flex-direction:column; gap:8px; margin:10px 0 14px; }
  .ra-draft-row { display:flex; align-items:center; gap:8px; flex-wrap:nowrap;
    background:var(--surface-2); border:1px solid var(--line); border-radius:var(--r); padding:10px 12px; }
  .ra-draft-row select { padding:6px 8px; font-size:13px; flex:1 1 0; min-width:0; }
  .ra-draft-arrow { color:var(--ink-2); font-weight:700; flex:0 0 auto; }
  .ra-draft-meta { display:flex; gap:8px; font-size:12.5px; flex:0 0 auto; white-space:nowrap; }
  .ra-draft-meta span { padding:3px 8px; border-radius:var(--r-pill); background:var(--green-050); color:var(--green-600); border:1px solid #fce28c; }
  .ra-draft-act { display:flex; gap:6px; flex:0 0 auto; }
  @media (max-width: 860px){
    .ra-draft-row { flex-wrap:wrap; }
    .ra-draft-row select { flex:1 1 45%; }
    .ra-draft-meta { margin-left:auto; }
  }

  .ra-list-grantee { display:flex; align-items:center; gap:10px; margin:12px 0 6px; }
  .ra-list-grantee label { font-size:13px; font-weight:600; color:var(--ink-2); margin:0; }
  .ra-list-grantee select { min-width:280px; padding:7px 10px; }
  /* list-builder rows are horizontal; selects share width evenly */

  .ra-level-note { margin:12px 0; padding:12px 14px; border-radius:var(--r); background:#fff9e8;
    border:1px solid #f0dca0; color:#6b5300; font-size:13px; line-height:1.5; }

  .ra-level-inline { font-size:12.5px; color:#6b5300; background:#fff9e8; border:1px solid #f0dca0;
    padding:6px 10px; border-radius:8px; }

  .ra-saveall { display:flex; gap:8px; margin-top:6px; }
  .ra-draft-row select:disabled, .ra-draft-row option:disabled { color:var(--ink-3); }

  /* Resource availability chart */
  .av-summary { display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin:8px 0 14px; }
  .av-pill { padding:3px 10px; border-radius:var(--r-pill); font-size:12.5px; font-weight:600; }
  .av-pill.idle { background:#eaf1fb; color:#1d4e9e; }
  .av-pill.low  { background:#fff6e6; color:#9a6a00; }
  .av-pill.high { background:var(--green-050); color:var(--green-600); }
  .av-chart { display:flex; flex-direction:column; gap:6px; }
  .av-bar-row { display:flex; align-items:center; gap:10px; width:100%; text-align:left; background:transparent;
    border:1px solid transparent; border-radius:var(--r); padding:6px 8px; cursor:pointer; font:inherit; }
  .av-bar-row:hover { background:var(--surface-2); }
  .av-bar-row.active { border-color:var(--green); background:var(--green-050); }
  .av-bar-l { flex:0 0 34%; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:13px; }
  .av-bar-track { flex:1 1 auto; height:16px; background:var(--surface-3,#eef0f2); border-radius:8px; overflow:hidden; }
  .av-bar-fill { display:block; height:100%; border-radius:8px; }
  .av-bar-fill.idle { background:#b9cdec; } .av-bar-fill.low { background:#f0b94e; }
  .av-bar-fill.mid { background:#faca2e; } .av-bar-fill.high { background:var(--green); }
  .av-bar-v { flex:0 0 auto; font-size:12.5px; min-width:96px; text-align:right; }
  .av-legend { display:flex; gap:14px; flex-wrap:wrap; margin-top:12px; font-size:12px; color:var(--ink-2); align-items:center; }
  .av-sw { display:inline-block; width:12px; height:12px; border-radius:3px; vertical-align:-1px; margin-right:4px; }
  .av-sw.idle{background:#b9cdec;} .av-sw.low{background:#f0b94e;} .av-sw.mid{background:#faca2e;} .av-sw.high{background:var(--green);}
  .av-detail { margin-top:14px; padding:14px; border:1px solid var(--line); border-radius:var(--r); background:var(--surface-2); }
  .av-detail-head { display:flex; justify-content:space-between; align-items:flex-start; gap:10px; margin-bottom:10px; }
  .av-detail-stat { display:flex; gap:6px; }
  .av-free-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:10px; }
  .av-free-day { background:var(--surface); border:1px solid var(--line); border-radius:8px; padding:8px; }
  .av-free-daylabel { font-weight:600; font-size:12.5px; margin-bottom:6px; }
  .av-free-cell { display:block; font-size:12px; padding:2px 0; }
  /* cross-college requests */
  .req-h { font-size:14px; margin:6px 0 8px; }
  .req-card { border:1px solid var(--line); border-radius:var(--r); padding:12px; margin-bottom:10px; background:var(--surface); }
  .req-top { display:flex; justify-content:space-between; align-items:center; gap:10px; }
  .req-note { margin-top:6px; font-size:13px; font-style:italic; color:var(--ink-2); }
  .req-decision { margin-top:6px; font-size:13px; padding:6px 10px; background:var(--surface-2); border-radius:8px; }
  .req-actions { display:flex; gap:6px; margin-top:10px; }
  .wf-chip.st-pending { background:#fff6e6; color:#9a6a00; }
  .wf-chip.st-rejected { background:#fbecec; color:#a3352e; }
  .row-2 { display:grid; grid-template-columns:1fr 1fr; gap:10px; }

  /* GPS geopoint field */
  .geo-wrap { grid-column:1 / -1; }
  .geo-field { display:flex; flex-direction:column; gap:8px; }
  .geo-inputs { display:flex; gap:8px; }
  .geo-inputs input { flex:1 1 0; min-width:0; }
  .geo-actions { display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
  .geo-map-link { font-size:12.5px; color:var(--green-600); text-decoration:none; }
  .geo-map-link:hover { text-decoration:underline; }

  /* ===================== Motion =========================================
     Transitions are short and consistent: things fade in while rising a few
     pixels, never slide across the screen. The point is to show that the
     screen CHANGED, not to make the user wait for an effect, so nothing here
     runs longer than 260ms. */
  .view-in { animation: viewIn .26s var(--ease) both; }
  @keyframes viewIn { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:none; } }

  /* Boot splash - owns the screen until we know whether a session exists. */
  .boot-wrap { min-height:100vh; display:grid; place-items:center; background:var(--bg); }
  .boot-card { text-align:center; }
  .boot-card .mark { width:52px; height:52px; margin:0 auto 20px; border-radius:14px;
    background:var(--green); color:#ffffff; display:grid; place-items:center;
    font-weight:800; font-size:16px; letter-spacing:.02em; }
  .boot-bar { width:180px; height:3px; margin:0 auto; border-radius:2px;
    background:var(--line); overflow:hidden; }
  .boot-bar i { display:block; width:40%; height:100%; border-radius:2px; background:var(--green);
    animation: bootSlide 1.1s var(--ease) infinite; }
  @keyframes bootSlide { 0% { transform:translateX(-100%); } 100% { transform:translateX(350%); } }
  .boot-msg { margin:16px 0 0; font-size:13px; color:var(--ink-2); }

  /* Page enter. Only the direct children stagger, so a long table does not
     animate every row - that reads as jank rather than polish.

     While this animation plays each child has a transform and so its own
     stacking context; without the rule below the later child would paint over
     an open dropdown in the earlier one. The class is also removed once the
     animation ends (see animatePageIn_), so nothing lingers. */
  .page-in > * { animation: pageIn .24s var(--ease) both; }
  .page-in > *:has(.pagebar), .page-in > .pagebar { position:relative; z-index:20; }
  .page-in > *:nth-child(2) { animation-delay:.04s; }
  .page-in > *:nth-child(3) { animation-delay:.07s; }
  .page-in > *:nth-child(n+4) { animation-delay:.09s; }
  @keyframes pageIn { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:none; } }

  /* Network progress bar: one thin line under the topbar. */
  #netbar { position:fixed; top:0; left:0; height:2px; width:100%; z-index:60;
    pointer-events:none; opacity:0; transition:opacity .18s var(--ease); }
  #netbar.on { opacity:1; }
  #netbar.on::after { content:''; position:absolute; inset:0 auto 0 0; width:35%;
    background:var(--green); border-radius:0 2px 2px 0;
    animation: netSlide 1s var(--ease) infinite; }
  #netbar.done { opacity:1; }
  #netbar.done::after { content:''; position:absolute; inset:0; background:var(--green);
    animation: netDone .3s var(--ease) forwards; }
  @keyframes netSlide { 0% { transform:translateX(-100%); } 100% { transform:translateX(300%); } }
  @keyframes netDone { to { opacity:0; } }

  /* In-page loading state, for screens that fetch before they can draw. */
  /* Reuses the existing .spinner and its @keyframes spin rather than
     redefining either - one spinner in the design system, not two. */
  .page-loading { display:grid; place-items:center; gap:14px; padding:60px 0; color:var(--ink-2); }
  .page-loading .spinner { width:22px; height:22px; }
  .page-loading p { margin:0; font-size:13px; }

  /* Sidebar and card feedback - small, immediate, not decorative. */
  .side button { transition: background var(--dur) var(--ease), color var(--dur) var(--ease),
    padding-left var(--dur) var(--ease); }
  .side button:hover { padding-left:16px; }
  .exam-card, .card { transition: box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease); }

  /* Anyone who has asked their system to stop animating gets no animation.
     The interface must still WORK - so this removes motion, never content. */
  @media (prefers-reduced-motion: reduce) {
    .view-in, .page-in > *, .boot-bar i, #netbar.on::after, .spinner {
      animation:none !important;
    }
    .view-in, .page-in > * { opacity:1 !important; transform:none !important; }
    .side button:hover { padding-left:12px; }
    * { transition-duration:.01ms !important; }
  }

  /* Papers with no slot - shown after the timetable under their own heading,
     never as an exam day. */
  .exd-tail { margin-top:26px; page-break-inside:avoid; }
  .exd-tail-h { font-weight:800; font-size:13px; letter-spacing:.04em; text-transform:uppercase;
    padding:7px 10px; background:var(--surface-2); border:1px solid var(--line-strong); border-bottom:none; }
  .exd-tail-n { margin:0; padding:6px 10px; font-size:11.5px; color:var(--ink-2);
    border:1px solid var(--line-strong); border-bottom:none; background:#ffffff; }

  /* ---- Resizable dialogs ------------------------------------------------
     A long list in a fixed-height dialog is miserable to work through, so the
     modal carries a native resize grip. min/max keep it usable: never smaller
     than its controls, never taller than the window. */
  .modal { resize:both; overflow:auto; min-width:320px; min-height:200px;
    max-width:96vw; max-height:92vh; }
  .modal.wide { min-width:520px; }
  .modal::-webkit-resizer { background:transparent; }
  .modal-resize-hint { position:absolute; right:3px; bottom:3px; width:12px; height:12px;
    pointer-events:none; opacity:.45;
    background:linear-gradient(135deg, transparent 45%, var(--ink-2) 45%, var(--ink-2) 55%, transparent 55%,
      transparent 70%, var(--ink-2) 70%, var(--ink-2) 80%, transparent 80%); }
  @media (max-width:760px){ .modal { resize:none; } }

  /* ============ Density: seeing many cells at once ======================
     On the timetable screens the grid IS the work. Everything above it was
     costing roughly 300px before a single row appeared - two full-width
     workflow cards, a legend row, and generous cell padding. */

  /* Sidebar toggle in the topbar. */
  .nav-toggle { display:inline-flex; flex-direction:column; justify-content:center; gap:3px;
    width:30px; height:30px; padding:0 7px; margin-right:2px; border-radius:8px;
    border:1px solid transparent; background:transparent; cursor:pointer; }
  .nav-toggle span { display:block; height:2px; border-radius:1px; background:var(--ink-2); }
  .nav-toggle:hover { background:var(--surface-2); border-color:var(--line); }
  .layout.nav-collapsed .side { display:none; }

  /* Governance + publishing share one slim strip. */
  .wf-bar { display:flex; align-items:center; gap:10px; flex-wrap:wrap;
    padding:7px 12px; margin-bottom:10px; background:var(--surface);
    border:1px solid var(--line); border-radius:var(--r); }
  .wf-bar .wf-right { margin-left:auto; display:flex; align-items:center; gap:6px; }
  .wf-sep { width:1px; height:18px; background:var(--line); margin:0 3px; }
  .btn.xs { padding:4px 9px; font-size:11.5px; border-radius:7px; }

  /* The colour key is reference, not a control - folded away by default. */
  .tt-legend-wrap { margin-bottom:8px; }
  .tt-legend-wrap > summary { cursor:pointer; font-size:11.5px; color:var(--ink-2);
    list-style:none; display:inline-flex; align-items:center; gap:5px; padding:2px 0; }
  .tt-legend-wrap > summary::-webkit-details-marker { display:none; }
  .tt-legend-wrap > summary::before { content:'\25B8'; font-size:9px; transition:transform var(--dur) var(--ease); }
  .tt-legend-wrap[open] > summary::before { transform:rotate(90deg); }
  .tt-legend-wrap .tt-legend { margin:6px 0 0; }

  /* Denser grid: more columns and more rows on screen at once. */
  .tt-wrap { max-height:calc(100vh - 190px); }
  table.tt th { font-size:10.5px; padding:6px 7px; }
  table.tt td.tt-time { padding:5px 7px; font-size:11.5px; min-width:92px; }
  table.tt th.tt-time, table.tt td.tt-time { min-width:92px; }
  table.tt td.tt-time .muted { font-size:10px; }
  .tt-cell { padding:3px; min-width:104px; }
  .chip { padding:3px 6px; margin-bottom:2px; font-size:11px; border-radius:5px; line-height:1.2; }
  .chip.empty { min-height:18px; }
  .clash-badge, .over-badge, .under-badge, .travel-badge, .partial-badge { font-size:8.5px; }

  /* Roomier again on a large screen, where the space is there to spend. */
  @media (min-width:1700px){
    .tt-cell { min-width:124px; }
    .chip { font-size:11.5px; }
  }

  /* Coverage and discrepancies */
  .cov-tabs { display:flex; gap:6px; flex-wrap:wrap; margin:0 0 12px;
    border-bottom:1px solid var(--line); padding-bottom:10px; }
  .cov-tab { display:inline-flex; align-items:center; gap:7px; font:inherit; font-size:12.5px;
    font-weight:600; padding:6px 11px; border-radius:8px; cursor:pointer;
    border:1px solid var(--line-strong); background:var(--surface); color:var(--ink); }
  .cov-tab:hover { background:var(--surface-2); }
  .cov-tab.active { background:var(--green); border-color:var(--green); color:#ffffff; }
  .cov-n { min-width:20px; text-align:center; border-radius:var(--r-pill); padding:0 6px;
    font-size:11px; font-weight:800; background:var(--surface-2); color:var(--ink-2); }
  .cov-tab.active .cov-n { background:rgba(255,255,255,.22); color:#ffffff; }
  /* A non-zero count is the thing worth looking at, so it is coloured. */
  .cov-n.hot { background:#fff7ea; color:#8a5a00; }
  .cov-tab.active .cov-n.hot { background:rgba(255,255,255,.22); color:#ffffff; }
  .cov-prog { margin-bottom:14px; border:1px solid var(--line); border-radius:var(--r); overflow:hidden; }
  .cov-prog-h { display:flex; align-items:center; gap:8px; padding:7px 11px;
    background:var(--surface-2); border-bottom:1px solid var(--line); font-size:12.5px; }
  .cov-prog-h .cov-count { margin-left:auto; font-size:11px; font-weight:800; color:var(--ink-2); }
  .cov-prog .tbl { margin:0; }
  .cov-prog .tbl td { padding:5px 11px; font-size:12.5px; border-bottom:1px solid var(--line); }
  .cov-prog .tbl tr:last-child td { border-bottom:none; }
  .cfg-sec { margin:16px 0 8px; font-size:11px; font-weight:800; letter-spacing:.06em;
    text-transform:uppercase; color:var(--ink-2); border-top:1px solid var(--line); padding-top:12px; }
  /* Direct room editing */
  .re-row { display:flex; align-items:center; gap:8px; margin-bottom:7px; }
  .re-row select { flex:1; min-width:0; }
  .re-row input[type=number] { width:88px; flex:0 0 auto; }
  .re-cap { font-size:11.5px; color:var(--ink-2); white-space:nowrap; min-width:64px; }
  .re-total { font-size:13.5px; padding:8px 11px; border-radius:var(--r);
    background:var(--green-050); border:1px solid #fbd65d; }
  .re-total.short { background:var(--danger-050); border-color:#e7a9a3; }
  .re-issues { list-style:none; margin:10px 0 0; padding:0; }
  .re-issues li { font-size:12.5px; padding:6px 10px; border-radius:7px; margin-bottom:5px;
    border-left:3px solid; }
  .re-issues li.error { background:var(--danger-050); border-color:var(--danger); color:#8a2b22; }
  .re-issues li.warn { background:#fff7ea; border-color:#d89b24; color:#8a5a00; }
  .re-ok { margin:10px 0 0; font-size:12.5px; color:#523900; }
  /* Scroll container for a table inside a dialog. This class was used in five
     places and styled in none - four of them happened to carry inline
     overflow, so only the fifth misbehaved. The rule belongs here; the inline
     max-heights stay, since each dialog wants its own. */
  .tbl-wrap { overflow:auto; max-width:100%; border:1px solid var(--line);
    border-radius:var(--r); background:var(--surface); }
  .tbl-wrap .tbl { margin:0; }

  /* ===================== Interaction feel ===============================
     Modals, toasts and page changes already animate. What still read as
     static was the absence of response to the pointer itself: a button that
     does not depress, a row that does not acknowledge the cursor, a control
     that changes state with no transition. These are small and fast - the
     point is confirmation that the click landed, not decoration. */

  /* Press feedback. 1px is enough to feel; more looks like a toy. */
  .btn:active:not(:disabled), .pb-btn:active, .cov-tab:active,
  .segmented button:active, .chip[role="button"]:active { transform:translateY(1px); }
  .btn, .pb-btn, .cov-tab, .segmented button, .pb-status {
    transition:background var(--dur) var(--ease), border-color var(--dur) var(--ease),
               color var(--dur) var(--ease), transform .06s var(--ease), box-shadow var(--dur) var(--ease); }

  /* A toast belongs to the corner it comes from, so it slides in from there
     rather than rising out of the page. */
  .toast { animation:toastIn .22s var(--ease); }
  @keyframes toastIn { from { opacity:0; transform:translateX(16px); } to { opacity:1; transform:none; } }

  /* Cards and rows acknowledge the cursor. */
  .card:hover { box-shadow:var(--sh-2); }
  .tbl tbody tr { transition:background var(--dur) var(--ease); }
  .tbl tbody tr:hover { background:var(--surface-2); }
  .exam-card { transition:box-shadow var(--dur) var(--ease), transform .08s var(--ease); }
  .exam-card:hover { box-shadow:var(--sh-1); }

  /* Inputs settle into focus instead of snapping. */
  input, select, textarea { transition:border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }

  /* A control waiting on the server says so, rather than looking ignored. */
  .btn.is-busy { position:relative; color:transparent !important; pointer-events:none; }
  .btn.is-busy::after { content:''; position:absolute; inset:0; margin:auto; width:14px; height:14px;
    border-radius:50%; border:2px solid rgba(255,255,255,.45); border-top-color:#ffffff;
    animation:spin .7s linear infinite; }
  .btn.secondary.is-busy::after, .btn.ghost.is-busy::after {
    border-color:var(--line-strong); border-top-color:var(--green); }

  /* The designation dialog groups programmes under a course row. */
  .dg-course td { background:var(--surface-2); font-size:12.5px; }
  .dg-prog td:first-child { border-left:3px solid var(--line); }

  @media (prefers-reduced-motion: reduce) {
    .toast { animation:none !important; }
    .btn:active:not(:disabled), .pb-btn:active, .cov-tab:active,
    .segmented button:active, .chip[role="button"]:active { transform:none !important; }
    .btn.is-busy::after { animation:none !important; }
  }
  /* Uploads hub */
  .up-group { margin:0 0 12px; font-size:12px; font-weight:800; letter-spacing:.05em;
    text-transform:uppercase; color:var(--ink-2); }
  .up-list { display:flex; flex-direction:column; gap:2px; }
  .up-row { display:flex; align-items:center; gap:14px; padding:11px 2px;
    border-bottom:1px solid var(--line); }
  .up-row:last-child { border-bottom:none; }
  .up-meta { flex:1; min-width:0; }
  .up-meta b { font-size:13.5px; }
  .up-meta p { margin:2px 0 0; font-size:12.5px; color:var(--ink-2); }
  .up-act { display:flex; gap:7px; flex:0 0 auto; }
  /* ---- Focus mode: the grid gets the whole window ---------------------- */
  body.focus-mode .topbar,
  body.focus-mode .side,
  /* The filter row STAYS: picking the year and day is the whole job in focus
     mode, so hiding it would make the mode useless. Only the identity row and
     the tools go. */
  body.focus-mode .pagebar-row:first-child,
  body.focus-mode .tt-legend-wrap { display:none !important; }
  body.focus-mode .pagebar { position:sticky; top:0; margin-bottom:8px; }
  body.focus-mode .pagebar-row + .pagebar-row { border-top:none; }
  body.focus-mode .content { padding:8px !important; }
  body.focus-mode .card { border:none; box-shadow:none; padding:0; margin:0; }
  body.focus-mode .tt-wrap { max-height:calc(100vh - 20px); }
  .focus-exit { position:fixed; right:14px; bottom:14px; z-index:90;
    display:inline-flex; align-items:center; gap:7px; padding:8px 14px;
    border-radius:var(--r-pill); border:1px solid var(--line-strong);
    background:var(--surface); color:var(--ink); font:inherit; font-size:12.5px;
    font-weight:600; cursor:pointer; box-shadow:var(--sh-2); }
  .focus-exit:hover { background:var(--surface-2); }
  .focus-exit::before { content:''; width:8px; height:8px; border-radius:50%; background:var(--green); }

  /* Icon-only bar buttons, so a crowded bar still fits on one line. */
  .pb-btn.icon { padding:6px 8px; }
  .pb-btn.icon svg { display:block; }
  /* Every badge is in the key, shown at the size it appears in the grid. */
  .tt-legend .lg-h { font-weight:800; font-size:10px; letter-spacing:.06em; text-transform:uppercase;
    color:var(--ink-2); align-self:center; margin-right:2px; }
  .lgb { position:static !important; display:inline-grid; place-items:center; vertical-align:-2px;
    margin-right:3px; font-style:normal; }

  /* Constraint tooltip: one row per problem, tagged with its own badge so the
     tooltip and the cell say the same thing. */
  .clash-tip { padding:9px; max-width:340px; }
  .ct-row { display:flex; gap:9px; align-items:flex-start; padding:6px 4px; }
  .ct-row + .ct-row { border-top:1px solid rgba(255,255,255,.14); }
  .ct-badge { position:static !important; flex:0 0 auto; margin-top:1px;
    display:inline-grid; place-items:center; font-style:normal; }
  .ct-text { min-width:0; }
  .ct-text b { display:block; font-size:12.5px; margin-bottom:1px; }
  .ct-text div { font-size:12px; opacity:.85; line-height:1.35; }
  /* ---- The key: two aligned columns, every marker drawn ----------------
     Self-contained classes. The grid's own badges are absolutely positioned
     into a cell corner, so reusing them here meant the key depended on an
     override staying in place - and when it did not, the labels appeared with
     no markers at all. */
  .key { display:grid; grid-template-columns:repeat(auto-fit, minmax(290px, 1fr));
    gap:14px 26px; margin-top:10px; }
  .key-col h4 { margin:0 0 7px; font-size:10.5px; font-weight:800; letter-spacing:.06em;
    text-transform:uppercase; color:var(--ink-2); }
  .key-row { display:flex; align-items:center; gap:9px; padding:3px 0; font-size:12.5px; }
  .key-row span { min-width:0; }
  .key-row b { font-weight:700; }

  /* Cell-background swatches. Every modifier is scoped to .key-row so it
     out-ranks the base rule - with a bare .sw-part the shorthand `border`
     below won, its currentColor border-colour overrode the tint, and all five
     swatches came out looking identically white. */
  .key-row .sw { flex:0 0 auto; width:16px; height:16px; border-radius:4px; }
  .key-row .sw-part  { background:#fff4d6; border:1.5px solid #d89b24; }
  .key-row .sw-conf  { background:#fbe3e1; border:1.5px solid var(--danger); }
  .key-row .sw-over  { background:#fde9c8; border:1.5px solid #c77700; }
  .key-row .sw-under { background:#dce7fb; border:1.5px solid #3b6fd4; }
  .key-row .sw-ro    { background:#ecedef; border:1.5px solid var(--line-strong); }

  /* Corner badges, drawn as they appear in the grid: the four round ones are
     round, the two lettered ones are the same rounded tags the cells use. */
  .key-row .kb { flex:0 0 auto; display:inline-grid; place-items:center; min-width:17px; height:17px;
    padding:0 4px; border-radius:4px; font-size:10px; font-weight:800; font-style:normal;
    line-height:1; color:#ffffff; }
  .key-row .kb-clash  { background:#e5484d; border-radius:50%; width:17px; padding:0; }
  .key-row .kb-over   { background:#c77700; border-radius:50%; width:17px; padding:0; }
  .key-row .kb-under  { background:#3b6fd4; border-radius:50%; width:17px; padding:0; }
  .key-row .kb-part   { background:#d89b24; border-radius:50%; width:17px; padding:0; }
  .key-row .kb-travel { background:#5b3fa0; }
  .key-row .kb-load   { background:#8a5a00; }
  .key-row .kb-fix    { background:var(--surface); color:var(--ink-2);
    border:1px solid var(--line-strong); font-size:9px; }
  /* Exam period configuration: sections, not one wide wrapping grid. */
  .cfg-head { padding:10px 12px; margin:0 0 4px; border-radius:var(--r);
    background:var(--green-050); border:1px solid #fbd65d; }
  .cfg-head b { display:block; font-size:13.5px; color:#523900; }
  .cfg-head span { display:block; font-size:12.5px; color:var(--ink-2); margin-top:2px; }
  .cfg-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(230px, 1fr)); gap:10px 18px; }
  .cfg-grid > label { margin:0; }
  .sess-head { display:grid; grid-template-columns:1fr auto auto auto; gap:6px; margin-bottom:4px; }
  .sess-head span { font-size:10.5px; font-weight:800; letter-spacing:.05em;
    text-transform:uppercase; color:var(--ink-2); }
  /* The dialog opens tall enough that the sessions are visible without
     scrolling - they were below the fold and nobody found them. */
  .modal.wide { min-height:min(660px, 86vh); }
  /* Unplaced-paper reasons */
  .unp-group { display:flex; gap:12px; align-items:flex-start; padding:11px 0;
    border-bottom:1px solid var(--line); }
  .unp-group:last-child { border-bottom:none; }
  .unp-n { flex:0 0 auto; min-width:34px; height:26px; display:grid; place-items:center;
    border-radius:var(--r-pill); background:var(--danger-050); color:#8a2b22;
    font-weight:800; font-size:12.5px; }
  .unp-text b { display:block; font-size:13px; margin-bottom:2px; }
  .unp-text div { font-size:12.5px; color:var(--ink-2); line-height:1.4; }
  .unp-eg { margin-top:4px; font-size:11.5px; font-style:italic; }
