:root{--emergency:#8E1B1B;--on-emergency:#FFFFFF;--accent:#0570DB;--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:#0570DB;--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;}/* Mulish (all text) and Figtree (headings, see the h1 to h4 rule below), SIL OFL 1.1, self-hosted. Mulish is
   @fontsource-variable/mulish 5.3.0 (latin subset), variable 200 to 1000; Manrope stays as its first fallback.
   Licences: mulish-LICENSE.txt, figtree-LICENSE.txt.
   The Rajdhani faces below were the headings font from 20 to 22 Nov 2026 and are now unused; the files and licence stay until removed on purpose. */
@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;
}
@font-face {
  font-family: "Mulish";
  src: url("/operations/assets/mulish-variable.woff2") format("woff2-variations");
  font-weight: 200 1000;
  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 (Magic Keys 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 Magic Keys 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 Magic Keys 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 (Magic Keys, 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: "Mulish", "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 Magic Keys 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: .88rem; 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: .88rem; 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: .86rem; font-weight: 700; }
.top-actions { display: flex; flex-wrap: wrap; gap: .45rem; }
/* Full width (Magic Keys, 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: .9rem; }
.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: .88rem; 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: .88rem; }
.record-meta dd { font-size: .88rem; margin: .12rem 0 0; overflow-wrap: anywhere; }
.picker { display: grid; gap: .22rem; min-width: min(100%, 14rem); color: var(--muted); font-size: .88rem; }
.table-scroll { overflow-x: auto; }
.table-scroll:focus-visible { outline-offset: 0; }
.data-table { width: 100%; border-collapse: collapse; font-size: .92rem; 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: .88rem; 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: .88rem; 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: .88rem; 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: .88rem; 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: .88rem; margin-top: .07rem; white-space: nowrap; }
.field { display: grid; gap: .28rem; color: var(--muted); font-size: .88rem; }
.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%;
}
/* Show / Hide button inside a password box (22 Nov 2026). Quiet text button on the right edge; the box leaves room for it. */
.password-wrap { position: relative; display: block; }
.password-wrap input { width: 100%; padding-right: 4.4rem; }
.password-toggle { position: absolute; top: 50%; right: .35rem; transform: translateY(-50%); min-height: 32px; padding: 0 .6rem; border: 0; border-radius: 6px;
  background: transparent; color: #0570db; font: inherit; font-size: .9rem; font-weight: 700; cursor: pointer; }
.password-toggle:hover { background: #0570db1a; }
.password-toggle:focus-visible { outline: 2px solid #0570db; outline-offset: 1px; }
.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: .86rem; }
.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: .86rem; margin: .55rem 0 0; }
.feedback { color: var(--ok-text); font-size: .88rem; margin: .35rem 0; }
.message { color: var(--muted); font-size: .9rem; margin: .4rem 0; }
/* A bare <small> would use the browser's "smaller" (11.7px here). Rules with their own size still win. */
small { font-size: .88rem; }
.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: .88rem; color: var(--muted); }
.login-panel a { font-size: .88rem; }
.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: .88rem; 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 (Magic Keys' artwork of 22 Nov 2026, 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 (Magic Keys, 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: .88rem; 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; }

/* Sign-in screens (owner, 28 Nov 2026: "not professional enough for a school login"). One calm white card on the portal's
 * light page, in the approved Magic Keys look (mk4s-portal-ui-2026 / mk4s-mockup-style): page #F5F7FB, card #FFF
 * with a 1px #DDE3EE line and 16px radius, navy #0A1A4F heading and Sign in button, brand blue #0570DB links and focus (test/brand-blue.test.ts), Figtree.
 * The sign-in stays light in both themes: it is the site's front door. Text is 13px or more; targets are 44px or more. */
.mk-login {
  --si-page: #F5F7FB; --si-card: #FFFFFF; --si-line: #DDE3EE; --si-field: #7A8599; --si-navy: #0A1A4F; --si-navy-hover: #13266B;
  --si-navy-pressed: #06103A; --si-ink: #0E1630; --si-muted: #4A5468; --si-link: #0570DB; --si-danger: #9F1239; --si-danger-bg: #FCE8E6;
  display: flex; flex-direction: column; align-items: center; min-height: 100svh; padding: 0 0 32px;
  background: var(--si-page); color: var(--si-ink); color-scheme: light;
  font-family: "Figtree", var(--ui-font), system-ui, sans-serif; font-size: 16px; line-height: 1.5;
  border-top: 4px solid var(--si-navy);
}
.mk-login-panel { display: flex; flex-direction: column; align-items: center; gap: 20px; width: 100%; max-width: 472px; padding: 0 16px; }
.mk-login-card {
  width: 100%; padding: 32px; background: var(--si-card); border: 1px solid var(--si-line); border-radius: 16px;
  box-shadow: 0 1px 2px rgba(14, 22, 48, .04), 0 8px 24px rgba(14, 22, 48, .06);
}
/* The logo spans the full width of the screen in a white band (owner, 29 Nov 2026). On a wide desktop screen it fills the
   width up to the band's height limit so the form stays in view; on phones and tablets it fills the width edge to edge. */
.mk-login-logo { align-self: stretch; display: flex; justify-content: center; padding: 24px 16px; margin-bottom: 32px; background: #fff; border-bottom: 1px solid var(--si-line); }
.mk-login-logo img { display: block; width: 100%; max-width: 1600px; height: auto; max-height: 36vh; object-fit: contain; }
/* Access Control: the banner picture carries its own pale sky, so the band is that sky and the picture runs edge to edge. */
/* The banner spans the whole width. Where the screen is wider than the banner, the bands either side take the colour of the
   banner's own sky, and the banner's edges fade into them, so no seam shows. The logo itself is never cropped. */
.mk-login-logo.mk-login-banner { padding: 0; background: linear-gradient(90deg, #D6DDEE 0 50%, #CADAF2 50% 100%); }
.mk-login-logo.mk-login-banner img { width: auto; max-width: 100%; height: auto; max-height: 44vh; }
@media (min-aspect-ratio: 11/10) {
  .mk-login-logo.mk-login-banner img {
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 6%, #000 94%, transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0, #000 6%, #000 94%, transparent 100%);
  }
}
.mk-login-kicker { margin: 0 0 4px; color: var(--si-muted); font-size: 14px; font-weight: 600; }
.mk-login h1 { margin: 0; color: var(--si-navy); font-family: "Zing Sans Rust", inherit; font-size: 28px; font-weight: 700; line-height: 1.2; letter-spacing: -.01em; text-shadow: none; }
.mk-login h1::after { content: none; }
.mk-login-lede { margin: 8px 0 24px; color: var(--si-muted); font-size: 15px; line-height: 1.5; }
.mk-login p { color: var(--si-muted); }

/* Fields */
.mk-login .fields { display: grid; gap: 20px; }
.mk-login .field { display: grid; gap: 6px; color: var(--si-ink); font-size: 14px; font-weight: 600; }
.mk-login .field small { color: var(--si-muted); font-weight: 400; font-size: 13px; }
.mk-login .field input {
  width: 100%; min-height: 48px; padding: 0 14px; border: 1px solid var(--si-field); border-radius: 12px; background: #fff;
  color: var(--si-ink); font: 400 16px/1.4 inherit; box-shadow: none;
  transition: border-color .15s ease-out;
}
.mk-login .field input::placeholder { color: #6B7487; }
.mk-login .field input:hover { border-color: var(--si-muted); }
.mk-login .field input:focus { outline: none; }
.mk-login .field input:focus-visible { outline: 3px solid var(--si-link); outline-offset: 2px; border-color: var(--si-link); box-shadow: none; }
.mk-login .mk-input { position: relative; display: block; }
.mk-login .mk-input > svg { position: absolute; left: 14px; top: 50%; z-index: 1; width: 20px; height: 20px; transform: translateY(-50%); color: var(--si-muted); pointer-events: none; }
.mk-login .mk-input input { padding-left: 44px; }
.mk-login .password-toggle { color: var(--si-link); font-weight: 600; border-radius: 8px; }
.mk-login .password-toggle:hover { background: #EAF0FF; color: var(--si-link); }
.mk-login .password-toggle:focus-visible { outline: 3px solid var(--si-link); outline-offset: 2px; }
.mk-field-link { position: relative; }
.mk-login .button.mk-forgot { position: absolute; top: -10px; right: 0; min-height: 44px; padding: 0; font-size: 14px; }

/* Buttons: navy primary, white secondary, quiet text links. */
.mk-login .button { border-radius: 12px; font-family: inherit; text-shadow: none; filter: none; transition: background-color .15s ease-out, border-color .15s ease-out, transform .15s ease-out; }
.mk-login .button:focus-visible, .mk-help summary:focus-visible { outline: 3px solid var(--si-link); outline-offset: 2px; box-shadow: none; }
.mk-login .form-actions { margin-top: 24px; }
.mk-login .form-actions .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 48px; padding: 0 24px;
  background: var(--si-navy); color: #fff; border: 1px solid var(--si-navy); box-shadow: none;
  font-size: 16px; font-weight: 600; letter-spacing: 0;
}
.mk-login .form-actions .button:hover { background: var(--si-navy-hover); border-color: var(--si-navy-hover); box-shadow: none; filter: none; }
.mk-login .form-actions .button:active { background: var(--si-navy-pressed); transform: translateY(1px); }
.mk-login .form-actions .button svg { width: 20px; height: 20px; flex: none; }
.mk-login .button.secondary, .mk-login .button.mk-provider, .mk-login .button.mk-quiet {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 48px;
  background: #fff; color: var(--si-navy); border: 1px solid var(--si-line); box-shadow: none; font-size: 15px; font-weight: 600;
}
.mk-login .button.secondary:hover, .mk-login .button.mk-provider:hover, .mk-login .button.mk-quiet:hover { background: var(--si-page); border-color: var(--si-field); filter: none; }
.mk-login .button.mk-provider svg, .mk-login .button.mk-quiet svg { width: 20px; height: 20px; flex: none; }
.mk-login .auth-links { display: grid; gap: 12px; }
.mk-login .auth-divider { display: flex; align-items: center; gap: 12px; margin: 24px 0 16px; color: var(--si-muted); font-size: 13px; font-weight: 600; }
.mk-login .auth-divider::before, .mk-login .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--si-line); }
.mk-login .auth-providers { display: grid; gap: 12px; }
.mk-login .auth-footer { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; margin-top: 16px; }
.mk-login .button.mk-link {
  min-height: 44px; padding: 0 4px; background: none; border: 0; box-shadow: none; color: var(--si-link);
  font-size: 14px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px;
}
.mk-login .button.mk-link:hover { background: none; color: var(--si-navy); text-decoration-thickness: 2px; }
.mk-login .form-error { margin: 0 0 16px; padding: 12px 14px; background: var(--si-danger-bg); border: 1px solid var(--si-danger); border-radius: 12px; color: var(--si-danger); font-size: 14px; }
/* Authenticator QR code (owner, 29 Nov 2026): black on white in a framed box so any phone camera reads it. On a touch phone
   the camera cannot scan its own screen, so the "Open in my authenticator app" button shows there instead. */
.mk-login .mk-qr { display: grid; justify-items: center; gap: 8px; margin: 4px 0 20px; }
.mk-login .mk-qr svg { display: block; width: 200px; max-width: 100%; height: auto; padding: 12px; background: #fff; border: 1px solid var(--si-line); border-radius: 16px; box-shadow: 0 8px 24px -12px rgba(14, 22, 48, .25); }
.mk-login .mk-qr figcaption { color: var(--si-muted); font-size: 13px; }
.mk-login .mk-qr-how-tap { display: none; }
.mk-login .button.mk-qr-open { display: none; width: 100%; margin: 0 0 20px; justify-content: center; text-decoration: none; }
@media (pointer: coarse) and (max-width: 820px) {
  .mk-login .mk-qr, .mk-login .mk-qr-how-scan { display: none; }
  .mk-login .button.mk-qr-open { display: inline-flex; }
  .mk-login .mk-qr-how-tap { display: inline; }
}
.mk-login .token-output { background: var(--si-page); border: 1px solid var(--si-line); border-radius: 12px; color: var(--si-ink); }

/* "Need help signing in?" */
.mk-help { margin-top: 4px; padding-top: 16px; border-top: 1px solid var(--si-line); text-align: center; }
.mk-help summary { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; list-style: none; color: var(--si-ink); font-size: 14px; font-weight: 600; border-radius: 8px; }
.mk-help summary::-webkit-details-marker { display: none; }
.mk-help summary svg { width: 20px; height: 20px; flex: none; color: var(--si-muted); }
.mk-help p { margin: 8px 0 0; font-size: 14px; line-height: 1.55; text-align: left; }

/* Under the card: who may sign in, then Magic Keys. */
.mk-login-assurance { display: flex; align-items: flex-start; justify-content: center; gap: 10px; margin: 0; padding: 0 8px; text-align: left; }
.mk-login-assurance > svg { width: 20px; height: 20px; flex: none; margin-top: 1px; color: var(--si-navy); }
.mk-login-assurance-text { display: grid; gap: 2px; }
.mk-login-assurance span { color: var(--si-ink); font-size: 14px; font-weight: 600; }
.mk-login-assurance small { color: var(--si-muted); font-size: 13px; }
.mk-login-rjl { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--si-muted); font-size: 13px; }
.mk-login-rjl img { display: block; width: 112px; height: auto; }

/* Modern finish (owner, 29 Nov 2026: "keep the desktop the same but more modern ... it has to wow people"). Same layout:
   banner, one centred card, note and Magic Keys logo. Added: a soft glow behind the card in the logo's blue and orange, a
   blue-to-orange line along the top of the card, a pill label, softer fields with a glow on focus, a navy-to-blue
   button that lifts on hover, and a short fade-up when the screen opens (off for reduced motion). */
.mk-login {
  background:
    radial-gradient(900px 480px at 18% 62%, rgba(5, 112, 219, .10), transparent 70%),
    radial-gradient(760px 420px at 84% 78%, rgba(249, 115, 22, .08), transparent 70%),
    radial-gradient(rgba(10, 26, 79, .055) 1px, transparent 1.2px) 0 0 / 22px 22px,
    var(--si-page);
}
.mk-login-logo.mk-login-banner { border-bottom: 0; box-shadow: 0 1px 0 rgba(10, 26, 79, .06), 0 12px 32px -18px rgba(10, 26, 79, .35); }
.mk-login-card {
  position: relative; overflow: hidden; border-radius: 20px; border-color: rgba(221, 227, 238, .9);
  background: linear-gradient(180deg, #FFFFFF 0%, #FBFCFF 100%);
  box-shadow: 0 1px 2px rgba(14, 22, 48, .05), 0 12px 32px -8px rgba(14, 22, 48, .14), 0 32px 64px -24px rgba(5, 112, 219, .22);
  animation: mk-login-rise .5s cubic-bezier(.2, .8, .2, 1) both;
}
.mk-login-card::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 4px;
  background: linear-gradient(90deg, #0A1A4F 0%, #0570DB 55%, #F97316 100%);
}
.mk-login-kicker {
  display: inline-flex; align-items: center; gap: 8px; margin: 0 0 12px; padding: 4px 12px 4px 10px; border-radius: 999px;
  background: #EAF2FD; color: #0A3D8F; font-size: 13px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
}
.mk-login-kicker::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #0570DB; box-shadow: 0 0 0 3px rgba(5, 112, 219, .2); }
.mk-login h1 { font-size: 32px; letter-spacing: -.02em; }
.mk-login .field input { background: #F8FAFD; border-color: #C9D1DF; transition: border-color .15s ease-out, background-color .15s ease-out, box-shadow .15s ease-out; }
.mk-login .field input:hover { background: #fff; }
.mk-login .field input:focus-visible { background: #fff; outline: 2px solid var(--si-link); outline-offset: 0; box-shadow: 0 0 0 5px rgba(5, 112, 219, .16); }
.mk-login .form-actions .button {
  background: linear-gradient(135deg, #0A1A4F 0%, #0B3A8C 60%, #0570DB 100%); border-color: transparent;
  box-shadow: 0 8px 20px -8px rgba(5, 112, 219, .55);
}
.mk-login .form-actions .button:hover { background: linear-gradient(135deg, #13266B 0%, #0D47A8 60%, #0A7DEB 100%); border-color: transparent; transform: translateY(-1px); box-shadow: 0 12px 24px -8px rgba(5, 112, 219, .6); }
.mk-login .form-actions .button svg { transition: transform .15s ease-out; }
.mk-login .form-actions .button:hover svg { transform: translateX(3px); }
.mk-login-assurance, .mk-login-rjl { animation: mk-login-rise .5s .08s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes mk-login-rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

@media (max-width: 520px) {
  .mk-login-card { padding: 24px 20px; }
  .mk-login-logo { padding: 16px 8px; margin-bottom: 20px; }
  .mk-login-logo img { max-height: none; }
  .mk-login-logo.mk-login-banner { padding: 0; }
  .mk-login h1 { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  .mk-login .button, .mk-login .field input { transition: none; }
  .mk-login .form-actions .button:active { transform: none; }
  .mk-login-card, .mk-login-assurance, .mk-login-rjl { animation: none; }
  .mk-login .form-actions .button:hover, .mk-login .form-actions .button:hover svg { transform: none; }
}
@media (forced-colors: active) {
  .mk-login-card { border-color: CanvasText; }
  .mk-login .form-actions .button { border-color: ButtonText; }
  .mk-login-card::before, .mk-login-kicker::before { display: none; }
}

/* 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 #0570db; outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .ts-switch::after { transition: none; } }
.ts-link { font-size: .88rem; color: var(--focus, #0570db); }
.wx-pollen { margin: 0; font-size: .86rem; } .wx-pollen b { margin-right: .35rem; }
.top-strip small { display: block; color: var(--muted); font-size: .86rem; 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: .86rem; font-weight: 700; }
.wx-icon { color: #0570db; 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: .88rem; }
.wx-updated, .wx-credit { color: var(--muted); font-size: .88rem; }
.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: .88rem; }
.wx-ring small { color: var(--muted); font-size: .88rem; margin-top: .15rem; }
.wx-ring-track { fill: none; stroke: #e3e9f4; stroke-width: 4; }
.wx-ring-arc { fill: none; stroke: #0570db; 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: .88rem; 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: .88rem; }
.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 (Magic Keys, 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: .88rem; font-weight: 700; text-align: center; }
.lg-word { font-size: .88rem; 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: .88rem; color: #a7b1b8; }
.cam4-caption { position: absolute; left: 0; right: 0; bottom: 0; padding: 1.1rem .5rem .35rem; font-size: .88rem; 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: .88rem; 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: .88rem; text-transform: none; letter-spacing: 0; }

/* Headings in Zing Sans Rust (owner, 29 Nov 2026: "the font needs to be Zing Sans Rust", demo files approved for now). Headings
   only: it came off body text on 19 Nov because the light-only demo cut was hard to read in tables and forms. */
h1, h2, h3, h4 { font-family: "Zing Sans Rust", "Figtree", var(--ui-font); font-weight: 700; letter-spacing: 0; }

/* Ambient Three.js layer (Today and Access control headers only). Decoration: sits behind content, never takes clicks. */
.ambient-layer { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.page-head.has-ambient { position: relative; isolation: isolate; }
.page-head.has-ambient > :not(.ambient-layer) { position: relative; z-index: 1; }

/* Photo day (Magic Keys, 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, #0570db); 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: .88rem; 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: .88rem; }
.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 (Magic Keys, 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 (Magic Keys, 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; }

/* Office screen width is fluid (Magic Keys, 22 Nov 2026): the shell fills the window at any width. The 1280 to 1920 px lock added on
   21 Nov was removed. Small windows use the breakpoints at 1100, 900 and 720 px here and in portal.css. */

/* Leadership and Accounts restricted sections (Magic Keys, 22 Nov 2026): menu tag, Lock button, access list. */
.nav-restricted { background: rgba(16, 31, 51, 0.12); color: inherit; }
.nav-lock-now { margin: 0.75rem 0.75rem 0; width: calc(100% - 1.5rem); }
.restricted-staff { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.25rem; }
.restricted-staff-row { display: grid; grid-template-columns: 1fr auto auto; gap: 1rem; align-items: center; padding: 0.4rem 0; border-bottom: 1px solid rgba(16, 31, 51, 0.08); }
.restricted-title { opacity: 0.7; }
.restricted-tick { display: inline-flex; gap: 0.35rem; align-items: center; white-space: nowrap; }
.step-up-dialog .message { max-width: 34rem; }
.restricted-staff-row { grid-template-columns: 1fr auto auto auto auto; }
.restricted-keys { font-size: 0.85em; opacity: 0.75; white-space: nowrap; }
.restricted-my-keys { margin-top: 1rem; }
.restricted-key-list { margin: 0.25rem 0 0.75rem; padding-left: 1.1rem; }
.restricted-key-list li { display: flex; gap: 0.75rem; align-items: center; justify-content: space-between; }


/* Product and administrator login navigation, scoped to signed-out screens. */
.mk-product-login,.mk-platform-login { display:grid; gap:10px; min-width:0; margin:0; }
.mk-product-login-heading { margin:0; font-size:.9rem; font-weight:800; text-align:center; }
.mk-product-login-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; min-width:0; }
.mk-product-choice { box-sizing:border-box; display:flex; flex-direction:column; align-items:center; justify-content:center; min-width:0; min-height:52px; gap:6px; padding:10px 8px; border:1px solid #abb6c7; border-radius:10px; background:#fff; color:#10243e; font-size:14px; font-weight:700; text-align:center; text-decoration:none; line-height:1.3; overflow-wrap:anywhere; }
.mk-product-choice img { display:block; width:100%; max-width:155px; height:46px; object-fit:contain; }
.mk-product-choice[data-product="schools"] { border-bottom:3px solid #0B5CC2; }
.mk-product-choice[data-product="access"] { border-bottom:3px solid #FF8A1F; }
.mk-product-choice[aria-current="page"] { outline:2px solid #0B5CC2; outline-offset:1px; }
.mk-product-choice[data-product="access"][aria-current="page"] { outline-color:#FF8A1F; }
.mk-product-choice:hover { background:#eef2f7; }
.mk-product-choice:focus-visible { outline:3px solid #0B5CC2; outline-offset:2px; }
.mk-platform-login { padding:12px 0 0; border-top:1px solid var(--line,var(--border,#cbd5e1)); }
.mk-platform-login p { margin:0; font-size:14px; }
.mk-admin-login-choice { min-height:48px; }
@media(max-width:340px) { .mk-product-login-grid { grid-template-columns:minmax(0,1fr); } }

/* Magic Keys brand colours: blue = Schools, orange = Access Control, green = authorised/confirmed. */
.mk-product-choice[data-product="schools"], .mk-product-choice.schools { color:#0A1A4F; border-color:#A8C8F2; border-bottom:4px solid #0B5CC2; background:linear-gradient(180deg,#fff,#EAF3FF); }
.mk-product-choice[data-product="access"], .mk-product-choice.access { color:#10243E; border-color:#F3C599; border-bottom:4px solid #FF8A1F; background:linear-gradient(180deg,#fff,#FFF1E4); }
.mk-product-choice[data-product="schools"]:hover,.mk-product-choice.schools:hover { background:#DCEAFF; }
.mk-product-choice[data-product="access"]:hover,.mk-product-choice.access:hover { background:#FFE4CB; }
.mk-platform-login { border:1px solid #80BFA0; border-left:4px solid #15803D; border-radius:12px; padding:12px; background:#ECFDF3; color:#14532D; }
.mk-platform-login p { color:#245C40; }
.mk-product-login-heading { color:inherit; }
.mk-product-choice:focus-visible { outline:3px solid #16803D; outline-offset:2px; }

.signin-mode .mk-login { --si-link:#0B5CC2; }
.signin-mode .mk-login-logo { border-bottom:4px solid #0B5CC2; }
.signin-mode .mk-login-card { border-top:4px solid #0B5CC2; }
.signin-mode .mk-login .form-actions .button[type="submit"] { background:linear-gradient(135deg,#0A1A4F,#0B5CC2); color:white; border-color:#0B5CC2; }
.signin-mode .mk-login-assurance > svg { color:#15803D; }
.signin-mode[data-edition="access"] .mk-login-logo,.signin-mode[data-edition="access"] .mk-login-card { border-color:#FF8A1F; }
.signin-mode[data-edition="access"] .mk-login .form-actions .button[type="submit"] { background:linear-gradient(135deg,#FF8A1F,#FFB36A); color:#10141C; border-color:#FF8A1F; }
.mk-admin-page .mk-admin-feedback[data-state="success"],.mk-admin-page .mk-admin-tag[data-state="on"] { color:#166534; background:#ECFDF3; border-color:#15803D; }
.mk-admin-page .mk-admin-request .form-actions .button:first-child { background:#15803D; color:#fff; border-color:#15803D; }
.mk-admin-page .mk-admin-request .form-actions .button:first-child:hover { background:#166534; border-color:#166534; }
.mk-admin-page .mk-admin-feedback[data-state="error"] { color:#9A3412; background:#FFF1E4; }
.mk-admin-page .mk-admin-feedback[data-state="busy"] { color:#174EA6; background:#EAF3FF; }

/* Private owner directory and notebook, responsive down to 360px. */
.owner-directory,.owner-notes,.owner-audit-list { display:grid;gap:12px;min-width:0; }
.owner-site-grid { display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,290px),1fr));gap:12px; }
.owner-site-card,.owner-note-card { display:grid;gap:8px;min-width:0;padding:16px;border:1px solid var(--line,#b9cad8);border-left:4px solid #159a5b;border-radius:14px;background:var(--surface,#fff);color:var(--text,#102346);overflow-wrap:anywhere; }
.owner-site-card[hidden] { display:none!important; }
.owner-site-name {font-size:1.15rem;}
.owner-site-card p,.owner-note-card p {margin:0;}
.owner-note-body {white-space:pre-wrap;overflow-wrap:anywhere;}
.owner-site-actions {display:flex;flex-wrap:wrap;gap:8px;min-width:0;}
.owner-site-actions>* {min-height:44px;white-space:normal;}
.owner-directory input {min-height:44px;width:100%;box-sizing:border-box;}
.owner-visit-banner {display:flex;align-items:center;flex-wrap:wrap;gap:8px;padding:10px 14px;margin:8px 0;border:1px solid #b1c7da;border-radius:12px;background:#e9f2fa;color:#102346;}
.owner-visit-banner a,.owner-visit-banner button {min-height:44px;display:inline-flex;align-items:center;}
@media(max-width:600px){.owner-site-actions>* {flex:1 1 100%;}.owner-site-card,.owner-note-card{padding:12px;}.owner-visit-banner{display:grid;}}
