:root{--emergency:#8E1B1B;--on-emergency:#FFFFFF;--accent:#2447D6;--navy:#0A1A4F;--rail:#071530;--rail-2:#0D2247;--ok-solid:#006B58;--warning-solid:#9A6000;--danger-solid:#9F1239;--info-solid:#0B4F9C;--on-navy-ok:#3CCB9A;--on-navy-warning:#F2B632;--on-navy-danger:#FF6B5E;--on-navy-info:#7FC3F7;--on-navy-accent:#8DB4FF;--bg:#F4F5F7;--surface:#FFFFFF;--text:#0E1630;--muted:#4A5468;--primary:#0A1A4F;
    --on-primary:#FFFFFF;--brass:#2447D6;--line-strong:#6B7280;--ok-fill:#00806A;--ok-text:#006B58;--ok-tint:#EAF6F1;--warning-fill:#9A6000;--warning-text:#9A6000;--warning-tint:#FFF3CC;--danger-fill:#9F1239;--danger-text:#9F1239;--danger-tint:#FCE8E6;--info-fill:#0B4F9C;--info-text:#0B4F9C;--info-tint:#E3EEFA;}html[data-theme=dark]{--bg:#0F141A;--surface:#182029;--text:#E8ECEF;--muted:#A9B3BF;--primary:#8DB4FF;
    --on-primary:#06103A;--brass:#FFFFFF;--line-strong:#8A94A3;--ok-fill:#3CCB9A;--ok-text:#3CCB9A;--ok-tint:#0F2E24;--warning-fill:#F2B632;--warning-text:#F2B632;--warning-tint:#3A2C08;--danger-fill:#FF6B5E;--danger-text:#FF8A80;--danger-tint:#3F1613;--info-fill:#7FC3F7;--info-text:#7FC3F7;--info-tint:#12283D;}/* Rajdhani (headings and figures) and Manrope (all other text), both SIL OFL 1.1, from @fontsource/rajdhani 5.3.0 and
   @fontsource-variable/manrope 5.3.0 (latin subset), self-hosted. Chosen by RJL 20 Nov 2026 as the site-wide pair; they replace Liter and Zing Sans Rust.
   Rajdhani has real weights 400 to 700 (static files); Manrope is variable, 200 to 800. Licences: rajdhani-LICENSE.txt, manrope-LICENSE.txt. */
@font-face {
  font-family: "Rajdhani";
  src: url("/operations/assets/rajdhani-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Rajdhani";
  src: url("/operations/assets/rajdhani-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Rajdhani";
  src: url("/operations/assets/rajdhani-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Rajdhani";
  src: url("/operations/assets/rajdhani-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Manrope";
  src: url("/operations/assets/manrope-variable.woff2") format("woff2-variations");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
/* Liter (SIL OFL 1.1, Google Fonts, skugiz/liter), self-hosted: the site-wide portal font from 20 Nov 2026 (RJL chose it from the Google Fonts
   sans-serif list). It has ONE weight (regular), so bold text is the browser's synthetic bold (html font-synthesis: weight below). Licence: liter-LICENSE.txt. */
@font-face {
  font-family: "Liter";
  src: url("/operations/assets/liter.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
/* Inter variable (SIL OFL 1.1, from @fontsource-variable/inter 5.3.0, latin subset), self-hosted. A modern screen font made for
   reading small text on displays: open letter shapes, clear numbers, real weights 100 to 900. Chosen by RJL 19 Nov 2026 as the
   site-wide portal font after Atkinson Hyperlegible Next looked poor on the pages. Licence: inter-LICENSE.txt. */
@font-face {
  font-family: "Inter";
  src: url("/operations/assets/inter-variable.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
/* Atkinson Hyperlegible Next variable (SIL OFL 1.1, from @fontsource-variable/atkinson-hyperlegible-next 5.3.0,
   latin subset), self-hosted. Made by the Braille Institute for readers with low vision: letters that are easy to confuse
   (I, l, 1 / O, 0) are drawn differently. Chosen by RJL 19 Nov 2026 as the site-wide portal font because Zing Sans Rust
   (demo cut, light weight only) was hard to read. Weights 200 to 800. Licence: atkinson-hyperlegible-next-LICENSE.txt. */
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("/operations/assets/atkinson-hyperlegible-next-variable.woff2") format("woff2-variations");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Figtree";
  src: url("/operations/assets/figtree-variable.woff2") format("woff2");
  font-weight: 300 900;
  font-style: normal;
  font-display: swap;
}
/* Montserrat variable (SIL OFL 1.1, from @fontsource-variable/montserrat 5.3.0, latin subset), self-hosted.
   Chosen 16 Nov 2026 as the portal font: the same wide geometric shape as Zing Sans Rust, but with real weights
   from 100 to 900, so headings, menu items and buttons can be properly bold. Licence: montserrat-LICENSE.txt. */
@font-face {
  font-family: "Montserrat";
  src: url("/operations/assets/montserrat-variable.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
/* Zing Sans Rust (Fontfabric) is the DEMO cut: one light weight. Declared 100 to 400 only, so headings (weight 700) get the browser's synthetic bold.
   Characters it lacks (arrows, bullets, check marks) fall through to Figtree. Production licence still needed: see zing-sans-rust-NOTICE.txt. */
@font-face {
  font-family: "Zing Sans Rust";
  src: url("/operations/assets/zing-sans-rust.otf") format("opentype");
  font-weight: 100 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Univers Extended";
  src: url("/operations/assets/univers-extended.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+20-7E, U+A0-A5, U+A7-AB, U+AD-AE, U+B1, U+B4-B6, U+B8, U+BA-BB, U+BD, U+BF-D1, U+D3-D6, U+D8-DC, U+DE-F6, U+F8-FC, U+FE-FF, U+131, U+141-142, U+152-153, U+160-161, U+178, U+192, U+2BA, U+2C6-2C7, U+2C9, U+2D8-2DC, U+2013-2014, U+2018-2019, U+201C-201E, U+2020-2022, U+2026, U+2030, U+2039-203A, U+2122, U+2215, U+2219, U+F001-F002;
}

:root {
  color-scheme: light;
  /* Inter everywhere (RJL, 19 Nov 2026): modern and easy to read for staff on screens and tablets. Replaces Atkinson Hyperlegible Next
     (kept as the first fallback). Figtree and system fonts cover any missing character. */
  --ui-font: "Manrope", "Liter", "Inter", "Atkinson Hyperlegible Next", "Figtree", "Segoe UI", Arial, sans-serif;
  --border: color-mix(in srgb, var(--text) 16%, var(--surface));
  --soft: color-mix(in srgb, var(--bg) 62%, var(--surface));
  /* Navy side menu in the logo colours (navy, blue, orange), approved by RJL 16 Nov 2026. Replaces the white "Round 2" rail.
     White menu text on navy #0A1A4F is 16.6:1. Colour review 20 Nov 2026: orange left the app (logo only); group headings are #C7D3EE and the current-item edge light blue #8DB4FF (checked in test/contrast.test.ts). */
  --rail: #071530;
  --rail-raised: #ffffff1f;
  --rail-text: #ffffff;
  --rail-muted: #ffffff;
  --rail-heading: #c7d3ee;
  --rail-line: #ffffff29;
  --rail-accent: #8db4ff;
  background: var(--bg);
  color: var(--text);
  font-family: var(--ui-font);
  font-size: 14px;
  font-weight: 500;
}

html[data-theme="dark"] { color-scheme: dark; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; line-height: 1.5; }
button, input, select, textarea { font: inherit; }
html { font-synthesis: weight; }
a { color: var(--ok-text); }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 3px; }
.skip-link { position: fixed; top: -60px; left: 1rem; z-index: 5; background: var(--surface); padding: .75rem; }
.skip-link:focus { top: 1rem; }
.shell { min-height: 100vh; display: grid; grid-template-columns: 240px minmax(0, 1fr); }
.sidebar {
  --side-pad-x: 1rem; --side-pad-top: 1.5rem;
  /* Exactly one window tall with its own scroll (20 Nov 2026), so a long menu never makes a short page scroll. */
  height: 100vh; height: 100dvh; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; align-self: start; position: sticky; top: 0;
  padding: var(--side-pad-top) var(--side-pad-x) 1.15rem; display: flex; flex-direction: column; gap: 2rem;
  background: var(--rail); color: var(--rail-text); border-right: 1px solid var(--rail-line);
}
.brand { display: grid; gap: .45rem; padding: 0 .35rem; color: inherit; text-decoration: none; }
.brand img { object-fit: contain; }
.sidebar nav { display: grid; gap: .4rem; }
.nav-item {
  display: flex; align-items: center; gap: .65rem; min-height: 43px; border-radius: .55rem;
  border: 1px solid transparent; padding: .55rem .62rem; color: var(--rail-muted); text-decoration: none;
  font-size: .79rem; font-weight: 700;
}
.nav-item svg { width: 1.15rem; height: 1.15rem; flex: 0 0 auto; }
.nav-item:hover { background: var(--rail-raised); color: var(--rail-text); }
.nav-item[aria-current="page"] { background: #ffffff1a; color: #ffffff; border-color: var(--rail-accent); }
.side-footer {
  margin-top: auto; padding: .8rem .35rem 0; border-top: 1px solid var(--rail-line);
  color: var(--rail-muted); font-size: .72rem; display: flex; align-items: center; gap: .52rem;
}
.side-indicator { width: 7px; height: 7px; background: var(--rail-accent); border-radius: 50%; }
.main-shell { min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: .8rem;
  min-height: 63px; padding: .65rem clamp(1rem, 3vw, 3.1rem); background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.context-title { color: var(--muted); font-size: .83rem; font-weight: 700; }
.top-actions { display: flex; flex-wrap: wrap; gap: .45rem; }
/* Full width (RJL, 18 Nov 2026): the work area uses the whole screen beside the menu instead of a centred 1520px column.
   Grids inside (today-graphs, room-board, gate-grid) add more columns on wide screens; long text keeps its own 75ch limit. */
main { max-width: none; padding: 1.7rem clamp(1rem, 2.4vw, 3.1rem) 3rem; margin-inline: 0; min-width: 0; }
main:focus { outline: none; }
.workspace-loading {
  position: fixed; inset: 0; z-index: 4; display: grid; place-items: center; background: var(--bg);
}
.workspace-loading-mark {
  display: grid; place-items: center; position: relative; width: clamp(10rem, 55vw, 16rem); aspect-ratio: 1;
  border-radius: 50%; background: #fff; box-shadow: 0 10px 36px #0a1a4f1a;
}
.workspace-loading-mark img { width: 72%; height: auto; }
.workspace-loading-mark::after {
  content: ""; position: absolute; inset: 0; border: 3px solid #e0e7f3; border-top-color: var(--accent);
  border-radius: inherit; animation: workspace-spin 1.2s linear infinite;
}
@keyframes workspace-spin { to { transform: rotate(1turn); } }
@media (prefers-reduced-motion: reduce) { .workspace-loading-mark::after { animation: none; } }
@media (scripting: enabled) {
  body:has(.workspace-loading) :is(.sidebar, .topbar, .skip-link) { visibility: hidden; }
}
@media (scripting: none) { .workspace-loading { display: none; } }
.page-head { margin: 0 0 1.2rem; display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: .85rem; }
.page-head h1 { margin: 0; font-size: clamp(1.65rem, 3vw, 2.4rem); letter-spacing: -.06em; line-height: 1.12; }
.page-head p, .panel-head p { color: var(--muted); margin: .37rem 0 0; font-size: .82rem; }
.page-actions, .inline-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.section-stack { display: grid; gap: .9rem; }
.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: .82rem; padding: 1.1rem 1.2rem;
  box-shadow: 0 3px 14px color-mix(in srgb, var(--text) 4%, transparent);
  min-width: 0;
}
.panel-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .65rem; align-items: center; margin-bottom: .7rem; }
.panel-head h2, .panel h2 { font-size: 1rem; margin: 0; letter-spacing: -.025em; }
.panel-head h3 { margin: 0; font-size: .88rem; }
.company-card { display: grid; gap: .95rem; }
.company-head { display: flex; align-items: center; gap: .75rem; min-width: 0; }
.company-head h2 { font-size: 1.2rem; overflow-wrap: anywhere; }
.company-head p { color: var(--muted); font-size: .79rem; margin: .13rem 0 0; }
.company-icon {
  display: grid; place-items: center; flex: 0 0 44px; height: 44px; border-radius: .6rem;
  background: var(--ok-tint); color: var(--ok-text);
}
.company-icon svg { width: 23px; height: 23px; }
.record-meta {
  display: flex; flex-wrap: wrap; column-gap: 2.3rem; row-gap: .65rem; padding-top: .8rem;
  border-top: 1px solid var(--border); margin: 0;
}
.record-meta dt { color: var(--muted); font-size: .71rem; }
.record-meta dd { font-size: .82rem; margin: .12rem 0 0; overflow-wrap: anywhere; }
.picker { display: grid; gap: .22rem; min-width: min(100%, 14rem); color: var(--muted); font-size: .75rem; }
.table-scroll { overflow-x: auto; }
.table-scroll:focus-visible { outline-offset: 0; }
.data-table { width: 100%; border-collapse: collapse; font-size: .79rem; text-align: left; }
.data-table :is(th, td) { padding: .53rem .54rem; vertical-align: middle; }
.data-table :is(th, td):first-child { padding-left: .38rem; }
.data-table th {
  background: var(--soft); color: var(--muted); font-size: .72rem; white-space: nowrap;
  font-weight: 700; border-bottom: 1px solid var(--border);
}
.data-table td { border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table .empty { color: var(--muted); padding: .9rem .38rem; }
.button {
  border: 1px solid transparent; border-radius: .48rem; min-height: 37px;
  padding: .4rem .68rem; background: var(--primary); color: var(--on-primary);
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  font-size: .75rem; line-height: 1.2; font-weight: 700; cursor: pointer; text-decoration: none;
}
.button:hover { filter: brightness(1.09); }
.button.secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.button.small { min-height: 31px; font-size: .7rem; padding-inline: .5rem; }
.button:disabled { opacity: .62; cursor: wait; }
.badge { border-radius: 99px; display: inline-block; white-space: nowrap; padding: .21rem .52rem; background: var(--soft); color: var(--muted); font-size: .69rem; font-weight: 700; }
.badge.ok { background: var(--ok-tint); color: var(--ok-text); }
.badge.warning { background: var(--warning-tint); color: var(--warning-text); }
.badge.danger { background: var(--danger-tint); color: var(--danger-text); }
.date-note { display: block; color: var(--muted); font-size: .67rem; margin-top: .07rem; white-space: nowrap; }
.field { display: grid; gap: .28rem; color: var(--muted); font-size: .77rem; }
.field input, .field select, .picker select, .field textarea {
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: .45rem;
  min-height: 41px; padding: .45rem .58rem; min-width: 0; width: 100%;
}
.field input[type=checkbox] { width: 1.1rem; min-height: 1.1rem; padding: 0; margin: .15rem 0; accent-color: var(--ok-fill); }
.field:has(input[type=checkbox]) { grid-template-columns: auto 1fr; align-items: center; justify-content: start; gap: .5rem; }
.field select[multiple] { min-height: 7rem; }
.field small { color: var(--muted); font-size: .69rem; }
.fields { display: grid; gap: .65rem; }
.form-actions { margin-top: .9rem; display: flex; gap: .55rem; flex-wrap: wrap; }
.form-error { color: var(--danger-text); font-size: .78rem; margin: .55rem 0 0; }
.feedback { color: var(--ok-text); font-size: .78rem; margin: .35rem 0; }
.message { color: var(--muted); font-size: .85rem; margin: .4rem 0; }
.form-dialog {
  color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: .8rem;
  max-height: calc(100dvh - 2rem); width: min(calc(100% - 2rem), 31rem); padding: 1.2rem;
}
.form-dialog::backdrop { background: #071018b3; }
.form-dialog h2 { font-size: 1.12rem; margin: 0 0 .7rem; }
.form-dialog .field { margin-top: .6rem; }
.login-panel { max-width: 33rem; margin-inline: auto; margin-top: 1.6rem; }
.login-panel h2 { margin: 0 0 .75rem; }
.login-panel p { font-size: .82rem; color: var(--muted); }
.login-panel a { font-size: .76rem; }
.auth-links { display: flex; gap: .75rem; flex-wrap: wrap; margin: .8rem 0 0; }
.panel-statuses { display: flex; gap: .65rem; flex-wrap: wrap; }
.panel-statuses p { margin: 0; }
.safety-panel { border-left: 4px solid var(--brass); }
.safety-panel.alarm { border-left-color: var(--danger-text); }
.safety-source { margin: .4rem 0; }
.token-output { width: 100%; min-height: 2.7rem; overflow-wrap: anywhere; }
.nowrap { white-space: nowrap; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 200px minmax(0, 1fr); }
  .sidebar { --side-pad-x: .7rem; padding-inline: var(--side-pad-x); }
}
@media (max-width: 720px) {
  .shell { display: block; }
  .sidebar { position: relative; min-height: auto; height: auto; overflow: visible; gap: .7rem; padding: .65rem .85rem; }
  .sidebar nav { display: flex; flex-wrap: wrap; gap: .28rem; }
  .nav-item { min-height: 37px; font-size: .7rem; padding-inline: .38rem; gap: .35rem; }
  .nav-item svg { width: .95rem; height: .95rem; }
  .brand-card img { width: 100%; height: auto; }
  .side-footer { display: none; }
  .topbar { min-height: 49px; }
  .panel { padding: .85rem .77rem; }
  .data-table :is(th, td) { padding-inline: .45rem; }
}


/* ---------------------------------------------------------------------------------------------
 * Magic Keys brand. Colours are taken from the live Magic Keys portal sign-in page
 * (azure.magickeys-balwyn-portal.com, read 14 Nov 2026) so both products share one theme.
 * The logo is only ever magic-keys-4-schools-logo.webp (official artwork, background removed, colours untouched).
 * It has black and navy lettering, so it sits on a light band that runs the full width of the menu (RJL, 20 Nov 2026:
 * transparent logo, on the background that makes it stand out most, a little bigger). A dark menu would hide the lettering.
 * ------------------------------------------------------------------------------------------- */
.brand-card {
  display: block; padding: .8rem .65rem .7rem; background: linear-gradient(180deg, #ffffff 0%, #eaf2fd 100%);
  margin: calc(-1 * var(--side-pad-top)) calc(-1 * (var(--side-pad-x) + .35rem)) 0; border-bottom: 3px solid var(--accent);
}
.brand-card img { display: block; width: 100%; height: auto; }
.brand-product {
  justify-self: start; padding: .1rem .45rem; border: 1.5px solid var(--on-navy-accent); color: var(--on-navy-accent);
  font-size: .62rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; transform: rotate(-3deg);
}

/* Sign-in screens: no workspace chrome, the split portal layout fills the window. */
body.signin-mode .sidebar, body.signin-mode .topbar { display: none; }
body.signin-mode .shell { display: block; }
body.signin-mode .main-shell { min-height: 100svh; }
body.signin-mode #workspace { padding: 0; max-width: none; margin: 0; }

.mk-login {
  display: grid; grid-template-columns: clamp(400px, 31vw, 480px) minmax(0, 1fr); min-height: 100svh;
  background: #071526; color: #fff;
}
.mk-login-panel {
  display: flex; flex-direction: column; padding: 26px clamp(22px, 2vw, 34px) 20px; z-index: 2;
  background: radial-gradient(ellipse at 0 8%, #007bff66, transparent 58%),
    radial-gradient(ellipse at 100% 62%, #00b8e81a, transparent 50%), linear-gradient(155deg, #004b93, #082947 48%, #0b1421);
  border-right: 1px solid #00f0ff55; box-shadow: 10px 0 36px #00132726;
}
.mk-login-logo { padding: 10px 12px; background: #fff; border-radius: 8px; }
.mk-login-logo img { display: block; width: 100%; height: auto; }
.mk-login-card {
  position: relative; width: 100%; max-width: 420px; margin: 22px auto; padding: 24px;
  background: linear-gradient(140deg, #ffffff14, #ffffff03 48%), #081d3399;
  border: 1px solid #00f0ff55; border-top-color: #c7efff80; border-radius: 16px;
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  box-shadow: inset 0 1px 0 #ffffff29, 0 16px 40px #0005, 0 0 28px #007bff22;
}
.mk-login-card::before {
  content: ""; position: absolute; top: -1px; left: 22%; right: 22%; height: 1px;
  background: linear-gradient(90deg, transparent, #8cf7ff, transparent);
}
.mk-login-kicker { margin: 0 0 10px; color: #7defff; font-weight: 700; font-size: 10px; letter-spacing: .11em; text-transform: uppercase; }
.mk-login h1 {
  margin: 0; color: var(--on-navy-accent); font-size: clamp(27px, 2.2vw, 34px); font-weight: 700; line-height: 1.22;
  letter-spacing: -.025em; text-shadow: 0 2px 2px #051321, 0 0 18px #ff7a0033;
}
.mk-login-lede { margin: 10px 0 22px; font-size: 13px; line-height: 1.65; color: #d1f5ff; }
.mk-login .field { color: #fff; font-size: 12px; font-weight: 700; }
.mk-login .field small { color: #c6e2f0; font-weight: 400; font-size: 11px; }
.mk-login .field input {
  min-height: 48px; padding: 0 14px; border: 1px solid #7dccff66; border-radius: 0; background: #041323b3;
  color: #fff; font-size: 14px; box-shadow: inset 0 2px 6px #0003;
}
.mk-login .field input::placeholder { color: #a6c8dc; }
.mk-login .field input:focus { outline: none; border-color: #00e5ff; box-shadow: 0 0 0 3px #00e5ff26, 0 0 18px #00bfff1f; }
.mk-login .form-actions .button {
  width: 100%; min-height: 50px; border-radius: 0; color: #081322; font-weight: 700;
  background: linear-gradient(135deg, var(--on-navy-accent), var(--on-navy-accent)); border: 1px solid var(--on-navy-accent);
  box-shadow: inset 0 1px #fff6, 0 6px 20px #ff7a002e;
}
.mk-login .form-actions .button:hover { filter: none; background: linear-gradient(135deg, var(--on-navy-accent), var(--on-navy-accent)); box-shadow: 0 6px 26px #ff7a0059; }
.mk-login .button.secondary {
  border-radius: 0; color: #fff; background: linear-gradient(135deg, #185da16b, #0b2a436b); border: 1px solid #7bd8ff70;
}
.mk-login .button.secondary:hover { filter: none; background: #14629b99; border-color: #00e5ff; }
.mk-login .form-error { background: #551b1b80; border: 1px solid var(--on-navy-danger); color: #ffe1dd; padding: 10px 12px; }
.mk-login .auth-links { gap: 10px; }
.mk-login .token-output { background: #071c30; border: 1px solid #54c6ef66; color: #fff; }
.mk-login p { color: #d1f5ff; }
.mk-login-assurance {
  display: grid; gap: 2px; margin: 20px 0 0; padding: 14px 0; border-top: 1px solid #78d9ff33; border-bottom: 1px solid #78d9ff33;
}
.mk-login-assurance span { color: #e5f6ff; font-size: 11px; }
.mk-login-assurance small { color: #bcdcec; font-size: 10px; }

/* Brand stage: white, showing RJL's supplied "Magic Keys 4 Schools" artwork whole and centred. */
.mk-login-stage { position: relative; display: grid; place-items: center; overflow: hidden; background: #fff; min-height: 100svh; }
.mk-login-artwork {
  display: block; width: 100%; height: auto; max-height: 100svh; object-fit: contain;
  animation: mk-stage-in .7s ease-out both;
}
@keyframes mk-stage-in { from { opacity: 0; transform: scale(.98); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .mk-login-artwork { animation: none; } }

@media (max-width: 800px) {
  .mk-login { display: flex; flex-direction: column; }
  .mk-login-stage { order: -1; min-height: 0; height: clamp(200px, 32svh, 280px); }
  .mk-login-panel { min-height: auto; padding: 24px max(16px, calc((100vw - 440px) / 2)); }
  .mk-login-logo { display: none; } /* the brand stage above already shows the logo */
  .mk-login .field input { font-size: 16px; }
}

/* Sidebar: navy in the light theme (see :root). Dark mode keeps its own dark rail. */
.sidebar { background: var(--rail); border-right-color: var(--rail-line); }
html:not([data-theme="dark"]) { --border: #dde3ee; }
html:not([data-theme="dark"]) .page-head h1, html:not([data-theme="dark"]) .panel h2, html:not([data-theme="dark"]) .panel-head h2 { color: #0a1a4f; }
html:not([data-theme="dark"]) .panel { border-radius: 16px; }
html[data-theme="dark"] { --rail: #151c23; --rail-raised: #1d2730; --rail-text: #e8ecef; --rail-muted: #a7b1b8; --rail-heading: #a7b1b8; --rail-line: #2a343c; --rail-accent: #8db4ff; }
html[data-theme="dark"] .nav-item[aria-current="page"] { background: #2a2410; color: var(--on-navy-accent); }

/* Touch targets: every control is at least 44px on both axes (WCAG 2.2 AAA target size, Apple/Google guidance).
   Added after a real-browser check found 13px setup links and 36px search/select controls at phone width. */
.checklist a { display: inline-flex; align-items: center; min-height: 44px; }
.checklist li { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem; }
input, select, textarea { min-height: 44px; }
.skip-link { min-height: 44px; display: inline-flex; align-items: center; }
a.button, button { min-height: 44px; }

/* ---- Top strip: system state, fire button, gate box, connection, weather, user. Light theme. ---- */
body.signin-mode #top-strip, body.projector #top-strip { display: none; }
.top-strip {
  display: flex; flex-wrap: wrap; align-items: stretch; gap: .6rem;
  padding: .65rem clamp(1rem, 3vw, 3.1rem); background: var(--surface); border-bottom: 1px solid var(--border);
}
/* The strip stays in view while the page scrolls, so the weather, pollen and fire button are always there. */
.top-strip { position: sticky; top: 0; z-index: 30; }
/* PA switch: a real button with a sliding knob, the words On/Off, and a 44px target. */
.ts-switch { display: flex; flex-direction: column; justify-content: center; min-height: 44px; padding: .35rem .8rem .35rem 3.4rem; position: relative;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface); text-align: left; cursor: pointer; font: inherit; }
.ts-switch::before { content: ""; position: absolute; left: .7rem; top: 50%; width: 2.1rem; height: 1.15rem; margin-top: -.575rem; border-radius: 999px; background: #8a93a6; }
.ts-switch::after { content: ""; position: absolute; left: .82rem; top: 50%; width: .9rem; height: .9rem; margin-top: -.45rem; border-radius: 50%; background: #fff; transition: transform 150ms ease-out; }
.ts-switch.on::before { background: var(--ok-solid); } .ts-switch.on::after { transform: translateX(.95rem); }
.ts-switch:disabled { cursor: default; opacity: .8; }
.ts-switch:focus-visible { outline: 3px solid #2447d6; outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .ts-switch::after { transition: none; } }
.ts-link { font-size: .68rem; color: var(--focus, #2447d6); }
.wx-pollen { margin: 0; font-size: .85rem; } .wx-pollen b { margin-right: .35rem; }
.top-strip small { display: block; color: var(--muted); font-size: .68rem; letter-spacing: .02em; }
.top-strip strong { color: var(--text); font-size: .86rem; }
.ts-state, .ts-pill, .ts-weather, .ts-user, .ts-fire {
  display: flex; flex-direction: column; justify-content: center; min-height: 44px; padding: .35rem .8rem;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface);
}
.ts-state-row { display: flex; align-items: center; gap: .45rem; }
.ts-dot { width: 9px; height: 9px; border-radius: 50%; background: #8a93a6; flex: 0 0 auto; }
.ts-dot.ok { background: var(--ok-solid); } .ts-dot.warning { background: var(--warning-solid); } .ts-dot.danger { background: var(--danger-solid); }
.ts-note { display: none !important; }
@media (min-width: 1700px) { .ts-note { display: block !important; } }
.ts-fire { text-decoration: none; background: var(--danger-solid); border-color: var(--danger-fill); }
.ts-fire strong, .ts-fire small { color: #fff; }
.ts-fire:hover, .ts-fire:focus-visible { background: var(--danger-solid); }
.ts-pill.ok strong { color: #0b4f9c; } .ts-pill.warning strong { color: var(--warning-text); } .ts-pill.danger strong { color: var(--danger-text); }
.ts-weather { flex-direction: row; align-items: center; gap: .55rem; text-decoration: none; color: var(--text); }
.ts-weather small { display: inline; }
.ts-user { flex-direction: row; align-items: center; gap: .6rem; margin-left: auto; }
.ts-avatar { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: #e8eeff; color: #0a1a4f; font-size: .72rem; font-weight: 700; }
.wx-icon { color: #2447d6; flex: 0 0 auto; }
.wx-clear { color: var(--warning-text); } .wx-storm { color: var(--warning-text); }

/* ---- Weather panel (Today and System settings) ---- */
.wx-panel { display: grid; gap: 1rem; }
.wx-head { display: flex; justify-content: space-between; gap: .8rem; align-items: start; }
.wx-head h2 { margin: 0; } .wx-head p { margin: .2rem 0 0; color: var(--muted); font-size: .82rem; }
.wx-updated, .wx-credit { color: var(--muted); font-size: .72rem; }
.wx-now { display: flex; flex-wrap: wrap; gap: 1.2rem; align-items: center; justify-content: space-between; }
.wx-big { display: flex; align-items: center; gap: .9rem; }
.wx-big > div { display: grid; }
.wx-temp { font-size: 2.6rem; line-height: 1; color: var(--text); }
.wx-rings { display: flex; gap: 1rem; }
.wx-ring { display: grid; justify-items: center; position: relative; }
.wx-ring strong { position: absolute; top: 18px; font-size: .78rem; }
.wx-ring small { color: var(--muted); font-size: .68rem; margin-top: .15rem; }
.wx-ring-track { fill: none; stroke: #e3e9f4; stroke-width: 4; }
.wx-ring-arc { fill: none; stroke: #2447d6; stroke-width: 4; stroke-linecap: round; }
.wx-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .45rem; margin: 0; padding: 0; list-style: none; }
.wx-week li { display: grid; justify-items: center; gap: .1rem; padding: .5rem .2rem; border: 1px solid var(--border); border-radius: 12px; background: var(--soft); }
.wx-week b { font-size: .72rem; color: var(--muted); } .wx-week small { color: var(--muted); }
.wx-credit { justify-self: end; }
.wx-outdoor {
  display: grid; gap: .35rem; padding: .8rem .9rem; border-radius: .55rem;
  color: var(--warning-text); background: var(--warning-tint); border-inline-start: 4px solid currentColor;
}
.wx-outdoor[data-status="outside"] { color: var(--outdoor-ok-text, var(--ok-text)); background: var(--outdoor-ok-bg, #e5f4ec); }
.wx-outdoor[data-status="indoors"] { color: var(--danger-text); background: var(--danger-tint); }
html[data-theme="dark"] .wx-outdoor { --outdoor-ok-text: var(--on-navy-ok); --outdoor-ok-bg: #163225; }
.wx-outdoor h3, .wx-outdoor p { margin: 0; }
.wx-outdoor h3 { font-size: 1rem; }
.wx-outdoor li, .wx-outdoor p { font-size: .85rem; }
.wx-outdoor ul { margin: 0; padding-inline-start: 1.2rem; }
.wx-outdoor a { color: inherit; font-weight: 700; }
@media (max-width: 700px) { .wx-week { grid-template-columns: repeat(4, minmax(0, 1fr)); } .ts-user { margin-left: 0; } }

/* Today, top of page (RJL, 17 Nov 2026): level meters and the four-channel camera block. */
.today-top { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 1rem; align-items: stretch; }
@media (max-width: 1100px) { .today-top { grid-template-columns: 1fr; } }
.deck-head { display: flex; justify-content: space-between; align-items: baseline; gap: .75rem; margin-bottom: .75rem; }
.deck-head h2 { margin: 0; }
.deck-head small { color: var(--muted); }

.lg-row { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .5rem; }
@media (max-width: 640px) { .lg-row { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.lg {
  display: flex; flex-direction: column; align-items: center; gap: .15rem; padding: .6rem .25rem .7rem;
  background: var(--soft); color: var(--text); border: 1px solid var(--border); border-radius: .8rem; cursor: pointer; font: inherit;
  box-shadow: 0 2px 0 color-mix(in srgb, var(--text) 10%, transparent), 0 8px 18px color-mix(in srgb, var(--text) 8%, transparent);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.lg:hover { transform: translateY(-3px); box-shadow: 0 4px 0 color-mix(in srgb, var(--text) 12%, transparent), 0 14px 26px color-mix(in srgb, var(--text) 14%, transparent); }
.lg[aria-pressed="true"] { border-color: var(--brass); box-shadow: inset 0 0 0 2px var(--brass), 0 8px 18px color-mix(in srgb, var(--brass) 22%, transparent); background: var(--surface); }
.lg-meter { width: 3.4rem; height: auto; }
.lg-shell { fill: color-mix(in srgb, var(--text) 14%, var(--surface)); }
.lg-pointer { fill: var(--text); }
.lg-value { font-size: 1.35rem; line-height: 1.1; }
.lg-label { font-size: .78rem; font-weight: 700; text-align: center; }
.lg-word { font-size: .72rem; color: var(--muted); text-align: center; min-height: 1em; }

/* Segment colours, bottom (s0) to top (s5). Fixed traffic-light colours so they read the same in light and dark. */
.lg-seg.off { opacity: .16; }
.scheme-bad-high .s0, .scheme-good-high .s5 { fill: #2e9e3f; }
.scheme-bad-high .s1, .scheme-good-high .s4 { fill: #7cc142; }
.scheme-bad-high .s2, .scheme-good-high .s3 { fill: #c5d335; }
.scheme-bad-high .s3, .scheme-good-high .s2 { fill: #f6c915; }
.scheme-bad-high .s4, .scheme-good-high .s1 { fill: #f08a1c; }
.scheme-bad-high .s5, .scheme-good-high .s0 { fill: #d8261c; }
/* Temperature: cold at the bottom, comfortable in the middle, hot at the top. */
.scheme-band .s0 { fill: #1f6fd6; } .scheme-band .s1 { fill: #58a6e8; } .scheme-band .s2 { fill: #2e9e3f; }
.scheme-band .s3 { fill: #7cc142; } .scheme-band .s4 { fill: #f08a1c; } .scheme-band .s5 { fill: #d8261c; }
.lg-seg.on { animation: lg-light .5s ease both; }
.lg-seg.on.s1 { animation-delay: .05s; } .lg-seg.on.s2 { animation-delay: .1s; } .lg-seg.on.s3 { animation-delay: .15s; }
.lg-seg.on.s4 { animation-delay: .2s; } .lg-seg.on.s5 { animation-delay: .25s; }
@keyframes lg-light { from { opacity: .16; } to { opacity: 1; } }

.lg-readout { margin: .85rem 0 0; padding: .7rem .85rem; border-radius: .6rem; border-left: 4px solid var(--border); background: var(--soft); font-size: .88rem; }
.lg-readout[data-tone="ok"] { border-left-color: var(--ok-fill); }
.lg-readout[data-tone="warning"] { border-left-color: var(--on-navy-accent); }
.lg-readout[data-tone="danger"] { border-left-color: var(--danger-fill); }
.lg-readout a { font-weight: 700; white-space: nowrap; }

.cam4 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .4rem; }
.cam4-tile {
  position: relative; aspect-ratio: 16 / 9; padding: 0; overflow: hidden; border-radius: .55rem; cursor: pointer; font: inherit;
  background: #0a1020; color: #e8ecef; border: 1px solid var(--border); transition: transform .16s ease, box-shadow .16s ease;
}
.cam4-tile:hover:not(:disabled) { transform: scale(1.015); box-shadow: 0 10px 24px color-mix(in srgb, var(--text) 22%, transparent); }
.cam4-tile:disabled { cursor: default; opacity: .75; }
.cam4-tile img { display: block; width: 100%; height: 100%; object-fit: cover; }
.cam4-nofeed { position: absolute; inset: 0; display: grid; place-items: center; font-size: .8rem; color: #a7b1b8; }
.cam4-caption { position: absolute; left: 0; right: 0; bottom: 0; padding: 1.1rem .5rem .35rem; font-size: .74rem; font-weight: 700; color: #fff; text-align: left; background: linear-gradient(transparent, rgba(5, 10, 24, .92) 62%); }
.cam4-caption b { color: var(--on-navy-warning); margin-right: .2rem; }
.cam4-tag { position: absolute; top: .35rem; right: .35rem; padding: .1rem .4rem; border-radius: .3rem; font-size: .65rem; font-weight: 700; background: rgba(5, 10, 24, .78); }
.cam4.focus .cam4-tile:not(.focused) { display: none; }
.cam4.focus { grid-template-columns: 1fr; }
.cam4-foot { margin: .7rem 0 0; }

@media (prefers-reduced-motion: reduce) {
  .lg, .cam4-tile { transition: none; }
  .lg:hover, .cam4-tile:hover:not(:disabled) { transform: none; }
  .lg-seg.on { animation: none; }
}
/* Pollen / asthma-storm watch: full width under the strip, faces and names large enough to scan. */
.ts-watch { flex-basis: 100%; border: 1px solid var(--warning-fill); background: var(--warning-tint); border-radius: 16px; padding: .7rem 1rem; }
.ts-watch h2 { margin: 0 0 .5rem; font-size: 1rem; color: var(--warning-text); }
.ts-watch-list { list-style: none; margin: 0 0 .5rem; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .75rem; max-height: 45vh; overflow: auto; }
.ts-watch-card { display: flex; flex-direction: column; gap: .55rem; min-height: 150px; background: #fff; border: 1px solid #dde3ee; border-radius: 12px; padding: .8rem; box-shadow: 0 1px 2px rgba(14, 22, 48, .06); }
.ts-watch-top { display: flex; gap: .6rem; align-items: center; }
.ts-watch-who strong { display: block; font-size: .9rem; }
.ts-watch-who small { text-transform: none; letter-spacing: 0; color: var(--muted); }
.ts-face { flex: none; width: 48px; height: 48px; border-radius: 50%; overflow: hidden; background: #eef1f6; }
.ts-watch-body { flex: 1; }
.ts-watch-alert { display: block; font-size: .95rem; font-weight: 600; color: #0a1a4f; margin-bottom: .2rem; }
.ts-watch-foot { display: block; padding-top: .45rem; border-top: 1px solid #eef1f6; color: var(--muted); font-size: .75rem; text-transform: none; letter-spacing: 0; }

/* Headings (RJL, 20 Nov 2026): Rajdhani, real bold. Body text is Manrope (--ui-font). */
h1, h2, h3, h4 { font-family: "Rajdhani", var(--ui-font); font-weight: 700; letter-spacing: .01em; }

/* Ambient Three.js layer (sign-in stage and Today header only). Decoration: sits behind content, never takes clicks. */
.ambient-layer { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.mk-login-stage .ambient-layer { mix-blend-mode: multiply; }
.page-head.has-ambient { position: relative; isolation: isolate; }
.page-head.has-ambient > :not(.ambient-layer) { position: relative; z-index: 1; }

/* Photo day (RJL, 20 Nov 2026) */
.photo-day-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); gap: 0.75rem; }
.photo-day-card { display: flex; gap: 0.75rem; align-items: flex-start; flex-wrap: wrap; }
.photo-day-card img { width: 120px; height: 160px; object-fit: cover; border-radius: 6px; background: var(--surface-2, #1b2230); }

/* Students screen: class tiles and the Compass-style student pop-up (20 Nov 2026). */
.student-classes { display: flex; flex-wrap: wrap; gap: .5rem; margin: .8rem 0; }
.student-class-tile { padding: .55rem .9rem; border: 1px solid var(--border); border-radius: .5rem; background: var(--surface); color: var(--text); cursor: pointer; font: inherit; }
.student-class-tile[aria-pressed="true"] { border-color: var(--accent, var(--accent)); box-shadow: inset 0 -3px 0 var(--accent, var(--accent)); }
.link-button { background: none; border: 0; padding: 0; color: inherit; font: inherit; text-decoration: underline; cursor: pointer; }
.student-link { color: inherit; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.student-link:hover { text-decoration-thickness: 2px; }
.student-link:focus-visible { outline: 3px solid var(--accent, #2447d6); outline-offset: 2px; border-radius: 3px; }
.rc-kid { display: flex; align-items: center; gap: .25rem; }
.rc-kid .rc-btn { flex: 1 1 auto; width: auto; }
.rc-open-link { font-size: .75rem; white-space: nowrap; padding: 0 .35rem; }
.student-popup { width: min(calc(100% - 1.5rem), 72rem); height: calc(100dvh - 2rem); }
.student-popup-head { display: flex; align-items: center; flex-wrap: wrap; gap: .75rem; margin-bottom: .6rem; }
.student-popup-head h2 { margin: 0; }
.student-popup-head .button, .student-popup-head button:last-child { margin-left: auto; }
.student-popup-sub { color: var(--muted); font-size: .85rem; }
.student-popup-tabs { display: flex; flex-wrap: wrap; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: .8rem; }
.student-popup-tab { background: none; border: 0; border-bottom: 3px solid transparent; padding: .5rem .8rem; color: var(--muted); font: inherit; cursor: pointer; }
.student-popup-tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent, var(--accent)); }
.student-popup-pane { overflow: auto; }

/* The school's own crest and name under the Magic Keys logo (RJL, 20 Nov 2026). */
.school-brand { display: flex; align-items: center; gap: .55rem; padding: .45rem .5rem; border-radius: 8px; background: rgba(255, 255, 255, .06); }
.school-brand img { width: 40px; height: 40px; object-fit: contain; border-radius: 6px; background: #fff; padding: 3px; flex: none; }
.school-brand-name { font-weight: 700; font-size: .9rem; line-height: 1.2; color: inherit; overflow-wrap: anywhere; }
/* The school's crest as a large faded background behind the pages (RJL, 21 Nov 2026). The page area becomes its own
   layer, and the crest sits at the very back of that layer, so the top strip, the title bar and every panel are drawn in
   front of it. It stays in the middle of the window while the page scrolls. Decoration only: it never takes a click. */
.main-shell.has-watermark { position: relative; isolation: isolate; }
.school-watermark { position: absolute; inset: 0; z-index: -1; pointer-events: none; user-select: none; overflow: clip; }
.school-watermark-hold { position: sticky; top: 0; height: 100vh; height: 100svh; display: grid; place-items: center; }
.school-watermark img { width: min(64vmin, 680px); height: min(64vmin, 680px); object-fit: contain; opacity: .08; }
html[data-theme="dark"] .school-watermark img { opacity: .1; }
/* The page area's own fill would cover the crest, so it is cleared while the crest is shown. Panels keep their fill. */
body:not(.signin-mode) .main-shell.has-watermark > main { background: transparent; }
/* Never on the sign-in page, emergency (plain) screens, the projector view, embedded pages or paper. */
body:is(.signin-mode, .plain-mode, .projector, .embed) .school-watermark { display: none; }
@media print { .school-watermark { display: none; } }
@media (forced-colors: active) { .school-watermark { display: none; } }

/* Payment link shown to the office so they can copy it to a family. */
.payment-link { min-width: 14rem; max-width: 26rem; flex: 1 1 14rem; }

/* ---- Fixed standard screen size (RJL, 21 Nov 2026: "screen fixed at a size that is suitable standard for users") ----
   Designed for 1920 x 1080. The office screen is never laid out narrower than 1280 px: on a smaller window the page
   scrolls sideways instead of squashing tiles and tables. On screens wider than 1920 the page stays 1920 wide and sits
   in the middle. Phones (720 px and under) keep their own one-column layout. Not applied to sign-in, the teacher
   tablet, projector, embedded or app mode, which have their own sizes. */
@media (min-width: 721px) {
  body:not(.signin-mode):not(.app-mode):not(.projector):not(.embed):not([data-view="tablet"]) .shell { min-width: 1280px; }
}
body:not(.signin-mode):not(.app-mode):not(.projector):not(.embed):not([data-view="tablet"]) .shell {
  max-width: 1920px; margin-inline: auto;
}
@media (min-width: 1921px) {
  body:not(.signin-mode):not(.app-mode):not(.projector):not(.embed):not([data-view="tablet"]) { background: #e6e9ef; }
  html[data-theme="dark"] body:not(.signin-mode):not(.app-mode):not(.projector):not(.embed):not([data-view="tablet"]) { background: #05070c; }
  body:not(.signin-mode):not(.app-mode):not(.projector):not(.embed):not([data-view="tablet"]) .shell {
    background: var(--bg, var(--surface)); box-shadow: 0 0 0 1px var(--border), 0 0 24px rgba(0, 0, 0, .12);
  }
}
