/*
 * MK4S button system: the one source of truth for every button on the portal (RJL, 20 Nov 2026).
 *
 * Built by workspace-ui.js button() and kit.js holdButton(). Four variants only:
 *   primary   (default)       solid brand blue            e.g. Announce, Save, Start watching
 *   secondary (.secondary)    white surface, slate border e.g. Hear it here, Cancel
 *   ghost     (.ghost, and every segmented control)        e.g. Announcement / Live talk, Live view / Camera setup
 *   danger    (.danger, .hold for press-and-hold)          e.g. Start fire / evacuation, Delete
 * Sizes: md (default, 36px) and lg (48px, for kiosk and emergency touch screens). On a touch screen (coarse pointer) md
 * grows to 44px so a finger can hit it reliably; the shape, type and colours stay the same.
 *
 * Status read-outs (System state, Contractors on site, Sick bay, Weather, Grass pollen, Asthma storm) are NOT buttons:
 * they are flat cards with no shadow, lift or press, and nothing to click (see "Status cards" below).
 *
 * Loaded last (index.html), and scoped under #mk4s (the <html> id), so it wins over the older per-page button rules in
 * operations.css, portal.css and realism.css without !important. Not applied on the sign-in screen, which keeps its own look.
 * Deliberately left alone: the recorder keypad and PTZ pad (they copy a physical recorder), camera and student tiles,
 * the side menu, the Keys bubble and the status beacon (tiles and keys, not standard buttons); and the large touch
 * targets on emergency and kiosk screens: the lockdown bar, roll-call rows, the visitor kiosk keys, and projector mode
 * (64px). Shrinking those to 36px would make them harder to hit when it matters most.
 */

#mk4s {
  --btn-h: calc(36rem / 14);   /* 36px at the portal's 14px root; scales with the reader's text size */
  --btn-h-lg: calc(48rem / 14); /* 48px: kiosk and emergency screens */
  --btn-px: 1rem;              /* 14px */
  --btn-radius: calc(8rem / 14); /* 8px */
  --btn-fs: 1rem;              /* 14px */
  --btn-weight: 500;
  --btn-gap: calc(8rem / 14);  /* 8px */
  --btn-ease: cubic-bezier(.2, 0, 0, 1);
  --btn-speed: 150ms;
  --btn-shadow: 0 1px 2px rgba(15, 23, 42, .05);
  --btn-shadow-hover: 0 4px 10px -2px rgba(15, 23, 42, .12), 0 1px 2px rgba(15, 23, 42, .06);
  --btn-focus: #2563eb;

  --btn-primary: #2563eb;  --btn-primary-hover: #1d4ed8;  --btn-primary-text: #fff;
  --btn-secondary: #fff;   --btn-secondary-hover: #f8fafc; --btn-secondary-text: #0f172a; --btn-secondary-border: #cbd5e1;
  --btn-ghost-text: #334155; --btn-ghost-hover: #f1f5f9;  --btn-ghost-track: #f1f5f9; --btn-ghost-active: #fff;
  --btn-danger: #dc2626;   --btn-danger-hover: #b91c1c;   --btn-danger-text: #fff;
}
#mk4s[data-theme="dark"] {
  --btn-secondary: #1e293b; --btn-secondary-hover: #273449; --btn-secondary-text: #f1f5f9; --btn-secondary-border: #334155;
  --btn-ghost-text: #cbd5e1; --btn-ghost-hover: #1e293b; --btn-ghost-track: #0f172a; --btn-ghost-active: #1e293b;
  --btn-focus: #60a5fa;
}

/* ---------- Base geometry, shared by every variant ---------- */
#mk4s body:not(.signin-mode) :is(.button, .page-setup-btn, .ts-watch-toggle,
  .keys-ai-send, .keys-ai-yes, .keys-ai-no, .keys-ai-confirm, .nvr-min) {
  position: relative; isolation: isolate; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--btn-gap);
  min-height: var(--btn-h); height: auto; padding: 0 var(--btn-px); margin: 0;
  border: 1px solid transparent; border-radius: var(--btn-radius);
  font-family: inherit; font-size: var(--btn-fs); font-weight: var(--btn-weight); line-height: 1.2; letter-spacing: 0;
  text-transform: none; text-shadow: none; text-decoration: none; white-space: nowrap;
  background: var(--btn-primary); color: var(--btn-primary-text);
  box-shadow: var(--btn-shadow), inset 0 1px 0 rgba(255, 255, 255, .14);
  filter: none; transform: translateY(0) scale(1); cursor: pointer;
  transition: background-color var(--btn-speed) var(--btn-ease), border-color var(--btn-speed) var(--btn-ease),
    color var(--btn-speed) var(--btn-ease), box-shadow var(--btn-speed) var(--btn-ease), transform var(--btn-speed) var(--btn-ease),
    opacity var(--btn-speed) var(--btn-ease);
  -webkit-tap-highlight-color: transparent;
}
/* The older 3D bevel layer (realism.css) drew a raised key with ::before. The new system has no bevels. */
#mk4s body:not(.signin-mode) .button::before { content: none; }
#mk4s body:not(.signin-mode) :is(.button, .page-setup-btn) svg { width: calc(16rem / 14); height: calc(16rem / 14); flex: none; }

/* Hover: colour shift, 1px lift, a little more shadow. */
#mk4s body:not(.signin-mode) :is(.button, .page-setup-btn, .ts-watch-toggle,
  .keys-ai-send, .keys-ai-yes, .keys-ai-no, .keys-ai-confirm, .nvr-min):hover:not(:disabled) {
  transform: translateY(-1px); box-shadow: var(--btn-shadow-hover), inset 0 1px 0 rgba(255, 255, 255, .14); filter: none;
}
/* Press: back down and a touch smaller, instantly, so a click feels crisp. */
#mk4s body:not(.signin-mode) :is(.button, .page-setup-btn, .ts-watch-toggle,
  .keys-ai-send, .keys-ai-yes, .keys-ai-no, .keys-ai-confirm, .nvr-min):active:not(:disabled) {
  transform: translateY(0) scale(.98); box-shadow: var(--btn-shadow); transition-duration: 0ms; padding-block: 0;
}
/* Keyboard focus: a 2px ring with a 2px gap, only for keyboard users. */
#mk4s body:not(.signin-mode) :is(.button, .page-setup-btn, .ts-watch-toggle,
  .keys-ai-send, .keys-ai-yes, .keys-ai-no, .keys-ai-confirm, .nvr-min,
  .pa-mode, .dash-tab, .cctv-layout, .sr-tab, .student-popup-tab, .pa-switch):focus-visible {
  outline: 2px solid var(--btn-focus); outline-offset: 2px;
}
/* Disabled and loading: half strength, nothing happens on hover or click. */
#mk4s body:not(.signin-mode) :is(.button, .page-setup-btn, .ts-watch-toggle,
  .keys-ai-send, .keys-ai-yes, .keys-ai-no, .keys-ai-confirm, .nvr-min):is(:disabled, [aria-disabled="true"], .is-loading) {
  opacity: .5; pointer-events: none; cursor: default; transform: none; box-shadow: var(--btn-shadow);
}
/* Loading: the words fade and a spinner turns in their place (setButtonLoading in workspace-ui.js). */
#mk4s body:not(.signin-mode) .button.is-loading { color: transparent; }
#mk4s body:not(.signin-mode) .button.is-loading::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: calc(16rem / 14); height: calc(16rem / 14); border-radius: 50%;
  border: 2px solid var(--btn-spinner, currentColor); border-right-color: transparent; color: var(--btn-primary-text);
  animation: btn-spin .7s linear infinite;
}
@keyframes btn-spin { to { transform: rotate(360deg); } }

/* ---------- Variants ---------- */
#mk4s body:not(.signin-mode) .button:not(.secondary):not(.ghost):not(.danger):not(.hold):hover:not(:disabled) { background: var(--btn-primary-hover); }

#mk4s body:not(.signin-mode) :is(.button.secondary, .page-setup-btn, .ts-watch-toggle, .keys-ai-no) {
  background: var(--btn-secondary); color: var(--btn-secondary-text); border-color: var(--btn-secondary-border); box-shadow: var(--btn-shadow);
}
#mk4s body:not(.signin-mode) :is(.button.secondary, .page-setup-btn, .ts-watch-toggle, .keys-ai-no):hover:not(:disabled) {
  background: var(--btn-secondary-hover); box-shadow: var(--btn-shadow-hover);
}
#mk4s body:not(.signin-mode) .button.secondary.is-loading::after { color: var(--btn-secondary-text); }

#mk4s body:not(.signin-mode) .button.ghost { background: transparent; color: var(--btn-ghost-text); border-color: transparent; box-shadow: none; }
#mk4s body:not(.signin-mode) .button.ghost:hover:not(:disabled) { background: var(--btn-ghost-hover); box-shadow: none; transform: none; }

#mk4s body:not(.signin-mode) :is(.button.danger, .button.hold) { background: var(--btn-danger); color: var(--btn-danger-text); border-color: var(--btn-danger-hover); }
#mk4s body:not(.signin-mode) :is(.button.danger, .button.hold):hover:not(:disabled) { background: var(--btn-danger-hover); }

/* Press-and-hold (kit.js holdButton): a darker band fills left to right over 1.5 seconds; letting go early empties it. */
#mk4s body:not(.signin-mode) .button.hold { user-select: none; touch-action: none; }
#mk4s body:not(.signin-mode) .button.hold .hold-fill {
  position: absolute; inset: 0 auto 0 0; width: 0%; z-index: -1; border-radius: inherit;
  background: rgba(69, 10, 10, .45); transition-property: width; transition-timing-function: linear;
}
#mk4s body:not(.signin-mode) .button.hold .hold-label { position: relative; }
#mk4s body:not(.signin-mode) .button.hold.holding { transform: translateY(0) scale(.98); }

/* Sizes. "small" is kept as a name only: every standard button is the same height. */
#mk4s body:not(.signin-mode) .button.small { min-height: var(--btn-h); font-size: var(--btn-fs); padding-inline: var(--btn-px); }
#mk4s body:not(.signin-mode) .button.lg { min-height: var(--btn-h-lg); font-size: calc(16rem / 14); padding-inline: calc(20rem / 14); }
@media (pointer: coarse) {
  #mk4s body:not(.signin-mode) :is(.button, .page-setup-btn, .ts-watch-toggle, .keys-ai-send, .keys-ai-yes, .keys-ai-no,
    .keys-ai-confirm, .nvr-min, .pa-mode, .dash-tab, .cctv-layout, .sr-tab, .student-popup-tab) { min-height: calc(44rem / 14); }
}

/* ---------- Ghost / segmented: one track, the chosen item is a raised white pill ---------- */
#mk4s body:not(.signin-mode) :is(.pa-modes, .dash-tabs, .cctv-layouts, .sr-tabs, .student-popup-tabs) {
  display: inline-flex; align-items: center; gap: calc(2rem / 14); padding: calc(3rem / 14); border-radius: calc(var(--btn-radius) + calc(2rem / 14));
  background: var(--btn-ghost-track); border: 1px solid var(--btn-secondary-border); box-shadow: none;
}
#mk4s body:not(.signin-mode) :is(.pa-mode, .dash-tab, .cctv-layout, .sr-tab, .student-popup-tab) {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--btn-gap);
  min-height: calc(var(--btn-h) - calc(8rem / 14)); padding: 0 calc(12rem / 14); margin: 0;
  border: 1px solid transparent; border-radius: var(--btn-radius); background: transparent; color: var(--btn-ghost-text);
  font-family: inherit; font-size: var(--btn-fs); font-weight: var(--btn-weight); line-height: 1.2; text-shadow: none;
  box-shadow: none; filter: none; transform: none; cursor: pointer; white-space: nowrap;
  transition: background-color var(--btn-speed) var(--btn-ease), color var(--btn-speed) var(--btn-ease), box-shadow var(--btn-speed) var(--btn-ease);
}
#mk4s body:not(.signin-mode) :is(.pa-mode, .dash-tab, .cctv-layout, .sr-tab, .student-popup-tab)::before { content: none; }
#mk4s body:not(.signin-mode) :is(.pa-mode, .dash-tab, .cctv-layout, .sr-tab, .student-popup-tab):hover:not([aria-checked="true"]):not([aria-selected="true"]):not(.active) {
  background: color-mix(in srgb, var(--btn-ghost-active) 60%, transparent); color: var(--btn-secondary-text);
}
#mk4s body:not(.signin-mode) :is(.pa-mode, .dash-tab, .cctv-layout, .sr-tab, .student-popup-tab):is([aria-checked="true"], [aria-selected="true"], .active) {
  background: var(--btn-ghost-active); color: var(--btn-secondary-text); border-color: var(--btn-secondary-border);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .08), 0 1px 1px rgba(15, 23, 42, .04);
}
#mk4s body:not(.signin-mode) :is(.pa-mode, .dash-tab, .cctv-layout, .sr-tab, .student-popup-tab):active { transform: scale(.98); transition-duration: 0ms; }

/* PA on/off switch: a ghost-style control in the same geometry. */
#mk4s body:not(.signin-mode) .pa-switch {
  display: inline-flex; align-items: center; gap: var(--btn-gap); min-height: var(--btn-h); padding: 0 var(--btn-px);
  border-radius: var(--btn-radius); border: 1px solid var(--btn-secondary-border); background: var(--btn-secondary);
  color: var(--btn-secondary-text); font-size: var(--btn-fs); font-weight: var(--btn-weight); box-shadow: var(--btn-shadow);
  transition: background-color var(--btn-speed) var(--btn-ease), border-color var(--btn-speed) var(--btn-ease);
}
#mk4s body:not(.signin-mode) .pa-switch small { font-size: calc(12rem / 14); font-weight: 500; color: inherit; opacity: .7; }
#mk4s body:not(.signin-mode) .pa-switch strong { font-weight: 600; }
#mk4s body:not(.signin-mode) .pa-switch.on { border-color: #16a34a; }
#mk4s body:not(.signin-mode) .pa-switch.on strong { color: #15803d; }
/* "Log" next to the PA bar is a link styled as a ghost button. */
#mk4s body:not(.signin-mode) .pa-link {
  display: inline-flex; align-items: center; min-height: var(--btn-h); padding: 0 var(--btn-px); border-radius: var(--btn-radius);
  color: var(--btn-ghost-text); font-size: var(--btn-fs); font-weight: var(--btn-weight); text-decoration: none;
  transition: background-color var(--btn-speed) var(--btn-ease);
}
#mk4s body:not(.signin-mode) .pa-link:hover { background: var(--btn-ghost-hover); }
#mk4s body:not(.signin-mode) .pa-link:focus-visible { outline: 2px solid var(--btn-focus); outline-offset: 2px; }

/* ---------- Status cards: read-only, flat, nothing to click ----------
   Their look (flat navy, blue edge, white words) is set in portal.css next to the strip's other rules. Here they only
   lose every button behaviour: no pointer, no lift, no press. */
#mk4s body:not(.signin-mode) .top-strip :is(.ts-state, .ts-pill, .ts-weather) { cursor: default; transform: none; filter: none; text-decoration: none; }
#mk4s body:not(.signin-mode) .top-strip :is(.ts-state, .ts-pill, .ts-weather):is(:hover, :active) { transform: none; }
#mk4s body:not(.signin-mode) .top-strip :is(.ts-state, .ts-pill, .ts-weather):focus { outline: 2px solid var(--btn-focus); outline-offset: 2px; }

/* Header emergency trigger: the danger hold button in the same geometry, a little wider so its words fit. */
#mk4s body:not(.signin-mode) .top-strip .ts-fire.button { min-width: 13rem; align-self: center; }

@media (prefers-reduced-motion: reduce) {
  #mk4s body:not(.signin-mode) :is(.button, .page-setup-btn, .ts-watch-toggle, .pa-mode, .dash-tab, .cctv-layout, .sr-tab, .student-popup-tab) {
    transition-duration: 0ms;
  }
  #mk4s body:not(.signin-mode) :is(.button, .page-setup-btn):hover:not(:disabled) { transform: none; }
  #mk4s body:not(.signin-mode) .button.is-loading::after { animation-duration: 2s; }
}

/* Navy panel headers: every button there uses the white secondary style so it reads clearly on navy. Danger stays red. */
#mk4s body:not(.signin-mode) .panel > .panel-head .button:not(.danger):not(.hold) {
  background: var(--btn-secondary); color: var(--btn-secondary-text); border-color: var(--btn-secondary-border);
}
#mk4s body:not(.signin-mode) .panel > .panel-head .button:not(.danger):not(.hold):hover:not(:disabled) { background: var(--btn-secondary-hover); }
#mk4s body:not(.signin-mode) .panel > .panel-head .button:focus-visible { outline-color: #fff; }

/* The PA bar sits on navy: its ghost link uses light words so it stays readable (contrast above 4.5:1). */
#mk4s body:not(.signin-mode) .pa-bar .pa-link { color: #e2e8f0; }
#mk4s body:not(.signin-mode) .pa-bar .pa-link:hover { background: rgba(255, 255, 255, .1); }

/* Projector mode keeps its 64px buttons (read from across a room); same shape and colours as everywhere else. */
#mk4s body.projector:not(.signin-mode) .button { min-height: calc(64rem / 14); font-size: 1.1rem; }

/* PA bar row: every control is one height, and the typing box gives way first so the row fits on a 1280px screen. */
#mk4s body:not(.signin-mode) #top-strip .pa-bar { flex-wrap: nowrap; }
#mk4s body:not(.signin-mode) #top-strip .pa-bar .pa-status { display: none; }
#mk4s body:not(.signin-mode) #top-strip .pa-bar .pa-status:not(:empty) { display: block; position: absolute; left: .7rem; right: .7rem; top: 100%; margin-top: .25rem;
  padding: .3rem .6rem; border-radius: var(--btn-radius); background: var(--rail, #071530); z-index: 5; }
#mk4s body:not(.signin-mode) #top-strip .pa-bar { position: relative; }
#mk4s body:not(.signin-mode) .pa-field { flex: 1 1 10rem; min-height: var(--btn-h); border-radius: var(--btn-radius); }
#mk4s body:not(.signin-mode) .pa-text { min-height: calc(var(--btn-h) - 2px); font-size: var(--btn-fs); }
#mk4s body:not(.signin-mode) .pa-voice { min-height: var(--btn-h); max-width: 10rem; border-radius: var(--btn-radius); font-size: var(--btn-fs); }
#mk4s body:not(.signin-mode) .pa-bar .button { min-height: var(--btn-h); flex: none; }
/* Announce, armed: the second tap sends it. Shown in the danger colour so the change is unmissable (words change too). */
#mk4s body:not(.signin-mode) .pa-bar .button.armed { background: var(--btn-danger); border-color: var(--btn-danger-hover); color: var(--btn-danger-text); }
@media (max-width: 1100px) {
  #mk4s body:not(.signin-mode) #top-strip .pa-bar { flex-wrap: wrap; }
}

/* ---------- Emergency trigger under a hinged clear cover (kit.js coveredHoldButton; RJL, 20 Nov 2026) ----------
   The one deliberate exception to "no bevels": it is drawn like a real covered emergency switch so nobody mistakes it
   for an ordinary button. Lift the cover, then press and hold. Sized in px/14 so it scales with the reader's text. */
#mk4s body:not(.signin-mode) .evac-mount {
  position: relative; flex: none; align-self: center; width: calc(232rem / 14); padding: calc(3rem / 14);
  border-radius: calc(12rem / 14); background: linear-gradient(180deg, #d8dde6 0%, #b8c0cc 100%);
  box-shadow: 0 6px 14px rgba(0, 0, 0, .18), 0 1px 3px rgba(0, 0, 0, .12), inset 0 2px 1px rgba(255, 255, 255, .8), inset 0 -2px 3px rgba(0, 0, 0, .25);
  perspective: 900px; user-select: none; -webkit-user-select: none;
}
#mk4s body:not(.signin-mode) .evac-mount[hidden] { display: none; }
#mk4s body:not(.signin-mode) .evac-well {
  position: relative; padding: calc(3rem / 14) calc(3rem / 14) calc(6rem / 14); border-radius: calc(9rem / 14); background: #23272e;
  box-shadow: inset 0 4px 10px rgba(0, 0, 0, .75), 0 1px 0 rgba(255, 255, 255, .7); transform-style: preserve-3d;
}
#mk4s body:not(.signin-mode) .evac-mount .evac-button.button {
  display: flex; width: 100%; min-width: 0; min-height: var(--btn-h); border: 0; border-radius: calc(7rem / 14);
  background: linear-gradient(180deg, #e53935 0%, #c62828 85%, #8e0000 100%); color: #fff; font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .55);
  box-shadow: 0 4px 0 #7f0000, 0 6px 10px rgba(0, 0, 0, .6), inset 0 1px 1px rgba(255, 255, 255, .45);
  transform: none; transition: transform 80ms ease, box-shadow 80ms ease, filter 150ms ease;
}
#mk4s body:not(.signin-mode) .evac-mount .evac-button.button:hover:not(:disabled) { transform: none; filter: brightness(1.06);
  box-shadow: 0 4px 0 #7f0000, 0 6px 10px rgba(0, 0, 0, .6), inset 0 1px 1px rgba(255, 255, 255, .45); }
#mk4s body:not(.signin-mode) .evac-mount .evac-button.button.holding { transform: translateY(3px);
  box-shadow: 0 1px 0 #7f0000, 0 2px 5px rgba(0, 0, 0, .6), inset 0 2px 4px rgba(0, 0, 0, .4); }
#mk4s body:not(.signin-mode) .evac-mount .evac-button .hold-fill {
  background: linear-gradient(90deg, rgba(255, 193, 7, .35), rgba(255, 235, 59, .65)); z-index: 0;
}
#mk4s body:not(.signin-mode) .evac-mount .evac-button.holding .hold-fill { border-right: 2px solid #fff59d; }
#mk4s body:not(.signin-mode) .evac-mount .evac-button .hold-label { z-index: 1; font-variant-numeric: tabular-nums; }
/* The cover: a real button over the whole well, hinged along its top edge. */
#mk4s body:not(.signin-mode) .evac-cover {
  position: absolute; inset: -3px; z-index: 20; margin: 0; padding: 0; border: 0; background: none; cursor: pointer;
  transform-origin: 50% -2px; transform-style: preserve-3d; transition: transform 450ms cubic-bezier(.22, 1.35, .36, 1);
}
#mk4s body:not(.signin-mode) .evac-mount.open .evac-cover { transform: rotateX(142deg); pointer-events: none; }
#mk4s body:not(.signin-mode) .evac-cover:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
#mk4s body:not(.signin-mode) .evac-cover-shell {
  position: absolute; inset: 0; overflow: hidden; border-radius: calc(11rem / 14);
  background: linear-gradient(130deg, rgba(255, 255, 255, .42) 0%, rgba(235, 248, 255, .12) 32%, rgba(255, 255, 255, .04) 55%, rgba(220, 240, 250, .22) 100%);
  border: 2px solid rgba(255, 255, 255, .75); border-bottom: 4px solid rgba(210, 230, 240, .85);
  box-shadow: 0 8px 14px rgba(0, 0, 0, .32), 0 2px 4px rgba(0, 0, 0, .2), inset 0 2px 3px rgba(255, 255, 255, .9),
    inset 0 -3px 6px rgba(180, 215, 230, .45), inset 3px 0 4px rgba(255, 255, 255, .5), inset -3px 0 4px rgba(255, 255, 255, .5);
}
#mk4s body:not(.signin-mode) .evac-cover-shell::before {
  content: ""; position: absolute; top: -40%; left: -20%; width: 65%; height: 180%; transform: rotate(24deg);
  background: linear-gradient(to right, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, .38) 50%, rgba(255, 255, 255, 0) 100%);
}
#mk4s body:not(.signin-mode) .evac-cover-tab {
  position: absolute; bottom: -6px; left: 50%; transform: translateX(-50%); width: calc(48rem / 14); height: 7px;
  background: linear-gradient(180deg, rgba(245, 252, 255, .85), rgba(190, 215, 230, .9)); border: 1px solid rgba(255, 255, 255, .9);
  border-radius: 0 0 6px 6px; box-shadow: 0 3px 5px rgba(0, 0, 0, .3);
}
#mk4s body:not(.signin-mode) .evac-close {
  position: absolute; top: 100%; right: 0; z-index: 30; margin-top: calc(6rem / 14); padding: calc(3rem / 14) calc(8rem / 14);
  border: 1px solid var(--btn-secondary-border); border-radius: calc(6rem / 14); background: #fff; color: #334155;
  font-family: inherit; font-size: calc(11rem / 14); font-weight: 600; line-height: 1.3; min-height: 0; cursor: pointer; box-shadow: 0 2px 6px rgba(0, 0, 0, .12);
}
#mk4s body:not(.signin-mode) .evac-close[hidden] { display: none; }
#mk4s body:not(.signin-mode) .evac-close:focus-visible { outline: 2px solid var(--btn-focus); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  #mk4s body:not(.signin-mode) .evac-cover { transition: none; }
  #mk4s body:not(.signin-mode) .evac-mount.open .evac-cover { transform: none; opacity: 0; }
}

/* Laptops 800px tall or less: the recorder keypad's keys tighten a little more so every key stays in view. */
@media (min-width: 1100px) and (max-height: 820px) {
  #mk4s body:not(.signin-mode) .cctv-wall > .nvr-board :is(.nvr-key, .nvr-nav button, .nvr-rec button) { min-height: calc(24rem / 14); }
  /* 21 Nov 2026, measured at 1366x768: the keypad's display was crushed to 12px (its text cut in half) and the last
     3px of the keypad was hidden. Three changes, on the Cameras screen only: the display keeps its full height, the
     keys are a fixed 25px instead of growing to 28px, and the empty strip under the page shrinks from 42px to 12px so
     the cameras and keypad get that height. views/cameras.js measures the strip, so the wall grows by itself. */
  #mk4s body[data-view="cameras"]:not(.signin-mode) #workspace { padding-bottom: calc(12rem / 14); }
  #mk4s body:not(.signin-mode) .cctv-wall > .nvr-board .nvr-lcd { flex-shrink: 0; min-height: calc(48rem / 14); }
  /* Very short windows (a 1366x768 laptop with browser bars shows about 650px): the page scrolls a little rather than
     crushing the keypad. 326px is the compact keypad's full height. */
  #mk4s body:not(.signin-mode) .cctv-wall:has(> .cctv-screen) { min-height: calc(326rem / 14); }
  #mk4s body:not(.signin-mode) .cctv-wall > .nvr-board :is(.nvr-key, .nvr-nav button, .nvr-rec button) { height: calc(25rem / 14); padding-block: 0; }
}

/* ---------- 3D keycap buttons (RJL, 20 Nov 2026: "buttons need to be 3D realistic") ----------
   Adapted from the AnimatedWebs "Rectangle Buttons" component, variants Meridian Keycap Primary / Secondary (MIT
   licence, from Jarrod's AnimatedWebs Pro account). Each button is a housing with a raised cap sitting in it: the cap
   has a hard base edge, a soft drop shadow and a top highlight, and it travels down when pressed. This replaces the
   flat look from earlier the same day. Geometry is unchanged (36px high, 8px corners, 14px text), and so are the four
   variants. Ghost buttons and segmented tabs stay flat by design; the covered emergency button keeps its own look.
   Colours come from the cap variables below, so a variant only sets variables. */
#mk4s body:not(.signin-mode) .button:not(.ghost):not(.evac-button):not(.link):not(.stat-tile) {
  --cap: linear-gradient(180deg, #2f6df0, #1d4ed8); --cap-press: linear-gradient(180deg, #2563eb, #1e40af);
  --cap-edge: #1e3a8a; --cap-glow: rgba(30, 64, 175, .35); --cap-shine: rgba(255, 255, 255, .45);
  --housing: #dbe7f6; --housing-line: rgba(37, 99, 235, .3);
  background: var(--housing); border: 0; padding: 0 var(--btn-px) calc(4rem / 14);
  box-shadow: inset 0 0 0 1px var(--housing-line); transform: none; filter: none;
}
#mk4s body:not(.signin-mode) .button:not(.ghost):not(.evac-button):not(.link):not(.stat-tile)::before {
  content: ""; position: absolute; z-index: -1; inset: 2px 2px 6px; border: 0; border-radius: calc(var(--btn-radius) - 2px);
  background: var(--cap); opacity: 1; filter: none; pointer-events: none; transform: translateY(0);
  box-shadow: 0 4px 0 var(--cap-edge), 0 7px 12px -2px var(--cap-glow), inset 0 1px var(--cap-shine);
  transition: transform 130ms cubic-bezier(.22, .61, .36, 1), box-shadow 130ms cubic-bezier(.22, .61, .36, 1);
}
/* Hover: the cap settles 1px. Press: it travels 3px onto its base and the words go with it. */
#mk4s body:not(.signin-mode) .button:not(.ghost):not(.evac-button):not(.link):not(.stat-tile):hover:not(:disabled) {
  background: var(--housing); transform: none; filter: none; box-shadow: inset 0 0 0 1px var(--housing-line);
}
#mk4s body:not(.signin-mode) .button:not(.ghost):not(.evac-button):not(.link):not(.stat-tile):hover:not(:disabled)::before {
  transform: translateY(1px); box-shadow: 0 3px 0 var(--cap-edge), 0 5px 9px -2px var(--cap-glow), inset 0 1px var(--cap-shine);
}
#mk4s body:not(.signin-mode) .button:not(.ghost):not(.evac-button):not(.link):not(.stat-tile):is(:active, .holding):not(:disabled) {
  background: var(--housing); transform: none; padding: calc(3rem / 14) var(--btn-px) calc(1rem / 14);
  box-shadow: inset 0 0 0 1px var(--housing-line);
}
#mk4s body:not(.signin-mode) .button:not(.ghost):not(.evac-button):not(.link):not(.stat-tile):is(:active, .holding):not(:disabled)::before {
  transform: translateY(3px); background: var(--cap-press); transition-duration: 0ms;
  box-shadow: 0 1px 0 var(--cap-edge), 0 2px 5px -2px var(--cap-glow), inset 0 1px var(--cap-shine);
}
#mk4s body:not(.signin-mode) .button:not(.ghost):not(.evac-button):not(.link):not(.stat-tile):is(:disabled, [aria-disabled="true"], .is-loading) {
  box-shadow: inset 0 0 0 1px var(--housing-line);
}
/* Secondary: a light cap. Also every non-danger button in a navy panel heading. */
#mk4s body:not(.signin-mode) .button.secondary:not(.ghost):not(.evac-button):not(.link):not(.stat-tile),
#mk4s body:not(.signin-mode) .panel > .panel-head .button:not(.danger):not(.hold):not(.ghost):not(.evac-button) {
  --cap: linear-gradient(180deg, #fbfcfe, #e3e8f1); --cap-press: linear-gradient(180deg, #eef2f7, #d8dfea);
  --cap-edge: #aeb9c9; --cap-glow: rgba(4, 7, 13, .2); --cap-shine: #fff;
  --housing: #dfe5ee; --housing-line: rgba(4, 7, 13, .12); color: var(--btn-secondary-text);
}
#mk4s[data-theme="dark"] body:not(.signin-mode) .button.secondary:not(.ghost):not(.evac-button):not(.link):not(.stat-tile) {
  --cap: linear-gradient(180deg, #2a3142, #1c2230); --cap-press: linear-gradient(180deg, #232a39, #171c28);
  --cap-edge: #080b11; --cap-glow: rgba(0, 0, 0, .6); --cap-shine: rgba(255, 255, 255, .11);
  --housing: #0c1017; --housing-line: rgba(255, 255, 255, .07); color: #dde5f2;
}
/* Danger, press-and-hold, and Announce while it is armed. */
#mk4s body:not(.signin-mode) .button:is(.danger, .hold):not(.ghost):not(.evac-button):not(.link):not(.stat-tile),
#mk4s body:not(.signin-mode) .pa-bar .button.armed:not(.ghost):not(.evac-button):not(.link):not(.stat-tile) {
  --cap: linear-gradient(180deg, #dc2626, #b91c1c); --cap-press: linear-gradient(180deg, #c81e1e, #991b1b);
  --cap-edge: #7f0000; --cap-glow: rgba(127, 0, 0, .4); --cap-shine: rgba(255, 255, 255, .4);
  --housing: #f6dcdc; --housing-line: rgba(185, 28, 28, .35); color: #fff;
}
/* The hold fill runs across the cap, not the housing. */
#mk4s body:not(.signin-mode) .button.hold:not(.evac-button) .hold-fill { inset: 2px auto 6px 2px; border-radius: calc(var(--btn-radius) - 2px) 0 0 calc(var(--btn-radius) - 2px); max-width: calc(100% - 4px); }
#mk4s body:not(.signin-mode) .button.hold.holding:not(.evac-button) .hold-fill { transform: translateY(3px); }
@media (prefers-reduced-motion: reduce) {
  #mk4s body:not(.signin-mode) .button:not(.ghost):not(.evac-button)::before { transition: none; }
}

/* ---------- Students: 3D class tiles and a 3D student profile (RJL, 21 Nov 2026) ----------
   "Make these student tabs 3D looking, and the profile all 3D also." Same keycap language as the buttons above
   (AnimatedWebs Rectangle Buttons / Meridian Keycap, MIT). Plain CSS: nothing extra is installed or downloaded.
   Raised things (tiles, tabs, panels, the pop-up itself, the photo) have a hard base edge and a soft shadow.
   Sunken things (the tab track, alert and collector lines) are wells with an inner shadow.
   A chosen tile or tab stays pressed down and turns blue, so "which one am I on" reads without colour alone. */
#mk4s { --d3-cap: linear-gradient(180deg, #fbfcfe, #e3e8f1); --d3-cap-edge: #aeb9c9; --d3-cap-text: #0d2247; --d3-shine: #fff;
  --d3-on: linear-gradient(180deg, #2f6df0, #1d4ed8); --d3-on-edge: #1e3a8a; --d3-slab: linear-gradient(180deg, #f6f8fb, #e9edf3);
  --d3-slab-edge: #a9b3c4; --d3-well: #dfe4ec; --d3-well-shade: rgba(4, 7, 13, .18); --d3-drop: rgba(4, 7, 13, .28); }
#mk4s[data-theme="dark"] { --d3-cap: linear-gradient(180deg, #2a3142, #1c2230); --d3-cap-edge: #080b11; --d3-cap-text: #dde5f2; --d3-shine: rgba(255, 255, 255, .11);
  --d3-slab: linear-gradient(180deg, #1a2030, #121724); --d3-slab-edge: #05070b; --d3-well: #0c1017; --d3-well-shade: rgba(0, 0, 0, .6); --d3-drop: rgba(0, 0, 0, .6); }

/* Class tiles on the Students page, and the tabs across the top of a student's pop-up: raised keys. */
#mk4s body:not(.signin-mode) .student-classes { gap: calc(12rem / 14); padding-bottom: calc(6rem / 14); }
#mk4s body:not(.signin-mode) :is(.student-class-tile, .student-popup-tab) {
  display: inline-flex; align-items: center; justify-content: center; min-height: calc(44rem / 14); padding: 0 calc(18rem / 14); margin: 0;
  border: 1px solid rgba(4, 7, 13, .12); border-radius: calc(10rem / 14); background: var(--d3-cap); color: var(--d3-cap-text);
  font-family: inherit; font-size: var(--btn-fs); font-weight: 600; line-height: 1.2; white-space: nowrap; cursor: pointer;
  box-shadow: 0 4px 0 var(--d3-cap-edge), 0 9px 14px -3px var(--d3-drop), inset 0 1px var(--d3-shine); transform: translateY(0);
  transition: transform 130ms cubic-bezier(.22, .61, .36, 1), box-shadow 130ms cubic-bezier(.22, .61, .36, 1);
}
#mk4s body:not(.signin-mode) :is(.student-class-tile, .student-popup-tab):hover {
  background: var(--d3-cap); color: var(--d3-cap-text); transform: translateY(1px);
  box-shadow: 0 3px 0 var(--d3-cap-edge), 0 6px 10px -3px var(--d3-drop), inset 0 1px var(--d3-shine);
}
#mk4s body:not(.signin-mode) :is(.student-class-tile, .student-popup-tab):active {
  transform: translateY(4px); transition-duration: 0ms; box-shadow: 0 0 0 var(--d3-cap-edge), 0 1px 3px -1px var(--d3-drop), inset 0 1px var(--d3-shine);
}
#mk4s body:not(.signin-mode) :is(.student-class-tile[aria-pressed="true"], .student-popup-tab[aria-selected="true"]) {
  background: var(--d3-on); color: #fff; border-color: rgba(30, 58, 138, .6); transform: translateY(3px);
  box-shadow: 0 1px 0 var(--d3-on-edge), 0 3px 6px -2px rgba(30, 64, 175, .45), inset 0 1px rgba(255, 255, 255, .45);
}
/* The tab row is a sunken tray the keys sit in. */
#mk4s body:not(.signin-mode) .student-popup-tabs {
  display: flex; flex-wrap: wrap; align-items: flex-start; gap: calc(8rem / 14); padding: calc(8rem / 14) calc(8rem / 14) calc(12rem / 14);
  margin-bottom: calc(16rem / 14); border: 0; border-radius: calc(14rem / 14); background: var(--d3-well);
  box-shadow: inset 0 2px 5px var(--d3-well-shade), 0 1px 0 var(--d3-shine);
}

/* The pop-up itself: a thick slab lifted off the page. */
#mk4s body:not(.signin-mode) dialog.student-popup {
  height: calc(100dvh - 3rem); border: 1px solid rgba(255, 255, 255, .7); border-radius: calc(16rem / 14); background: var(--d3-slab);
  box-shadow: 0 10px 0 var(--d3-slab-edge), 0 34px 60px -12px rgba(4, 7, 13, .6), inset 0 1px var(--d3-shine);
}
#mk4s body:not(.signin-mode) .student-popup-head { padding-bottom: calc(6rem / 14); }
#mk4s body:not(.signin-mode) .student-popup-head h2 { text-shadow: 0 1px 0 var(--d3-shine); }

/* Every panel inside the pop-up is a raised block. */
#mk4s body:not(.signin-mode) .student-popup :is(.section-stack, .student-page-grid) { gap: calc(22rem / 14); }
#mk4s body:not(.signin-mode) .student-popup .panel {
  border: 1px solid rgba(4, 7, 13, .1); border-radius: calc(12rem / 14); overflow: hidden;
  box-shadow: 0 5px 0 var(--d3-slab-edge), 0 16px 24px -8px var(--d3-drop), inset 0 1px var(--d3-shine);
}
#mk4s body:not(.signin-mode) .student-popup .panel > .panel-head { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2), inset 0 -3px 6px rgba(0, 0, 0, .25); }
#mk4s body:not(.signin-mode) .student-popup .student-popup-pane { padding: calc(4rem / 14) calc(4rem / 14) calc(14rem / 14); }
/* Card, alerts and who-may-collect on the left; the record on the right. One column on a narrow screen. */
#mk4s body:not(.signin-mode) .student-page-grid { display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 70rem) { #mk4s body:not(.signin-mode) .student-page-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); } }

/* The photo: a framed plate standing proud of the card. */
#mk4s body:not(.signin-mode) .student-popup .sp-face {
  border: 3px solid #fff; border-radius: calc(16rem / 14);
  box-shadow: 0 6px 0 #0b1a3a, 0 20px 28px -8px rgba(4, 7, 13, .5), inset 0 2px 6px rgba(255, 255, 255, .28), inset 0 -14px 24px rgba(0, 0, 0, .28);
}
#mk4s body:not(.signin-mode) .student-popup .sp-initials { text-shadow: 0 2px 0 rgba(0, 0, 0, .35), 0 6px 12px rgba(0, 0, 0, .35); }

/* Alert and collector lines: sunken wells, one per line, wording on the left and the button on the right. */
#mk4s body:not(.signin-mode) .student-lines { list-style: none; margin: 0; padding: 0; display: grid; gap: calc(10rem / 14); }
#mk4s body:not(.signin-mode) .student-line {
  display: flex; align-items: center; justify-content: space-between; gap: calc(12rem / 14); padding: calc(10rem / 14) calc(12rem / 14);
  border-radius: calc(10rem / 14); background: var(--d3-well); box-shadow: inset 0 2px 4px var(--d3-well-shade), 0 1px 0 var(--d3-shine);
}
#mk4s body:not(.signin-mode) .student-line-text { display: grid; gap: calc(3rem / 14); min-width: 0; }
#mk4s body:not(.signin-mode) .student-line-text > span { color: var(--muted); font-size: calc(13rem / 14); }
/* Critical alert pills and status chips get a base edge so they sit on the surface, not in it. */
#mk4s body:not(.signin-mode) .student-popup .sr-alert { box-shadow: 0 3px 0 rgba(0, 0, 0, .28), 0 8px 12px -4px var(--d3-drop), inset 0 1px rgba(255, 255, 255, .4); }
#mk4s body:not(.signin-mode) .student-popup .chip { box-shadow: 0 2px 0 rgba(4, 7, 13, .14), inset 0 1px var(--d3-shine); }
@media (prefers-reduced-motion: reduce) {
  #mk4s body:not(.signin-mode) :is(.student-class-tile, .student-popup-tab) { transition: none; }
}

/* ---------- Students 3D, part 2 (RJL, 21 Nov 2026): the list of names, and the tabs with nothing recorded ----------
   Each student in a class or search list is its own raised strip, so the list reads as things to press rather than a
   flat table. The base edge is drawn per cell with no blur, so the cells of one row join into one strip. */
#mk4s body:not(.signin-mode) .student-results .data-table { border-collapse: separate; border-spacing: 0 calc(10rem / 14); background: transparent; }
#mk4s body:not(.signin-mode) .student-results .data-table thead th { background: transparent; border: 0; }
#mk4s body:not(.signin-mode) .student-results .data-table tbody td {
  background: var(--d3-cap); border: 0; border-block: 1px solid rgba(4, 7, 13, .1); color: var(--d3-cap-text);
  padding-block: calc(12rem / 14); box-shadow: 0 4px 0 var(--d3-cap-edge), inset 0 1px var(--d3-shine);
  transition: transform 130ms cubic-bezier(.22, .61, .36, 1), box-shadow 130ms cubic-bezier(.22, .61, .36, 1);
}
#mk4s body:not(.signin-mode) .student-results .data-table tbody td:first-child { border-inline-start: 1px solid rgba(4, 7, 13, .1); border-radius: calc(10rem / 14) 0 0 calc(10rem / 14); }
#mk4s body:not(.signin-mode) .student-results .data-table tbody td:last-child { border-inline-end: 1px solid rgba(4, 7, 13, .1); border-radius: 0 calc(10rem / 14) calc(10rem / 14) 0; }
#mk4s body:not(.signin-mode) .student-results .data-table tbody tr:hover td { transform: translateY(1px); box-shadow: 0 3px 0 var(--d3-cap-edge), inset 0 1px var(--d3-shine); }
#mk4s body:not(.signin-mode) .student-results .data-table tbody tr:active td { transform: translateY(4px); box-shadow: 0 0 0 var(--d3-cap-edge), inset 0 1px var(--d3-shine); transition-duration: 0ms; }
#mk4s body:not(.signin-mode) .student-results .data-table .link-button { color: inherit; font-weight: 600; }
/* A tab with nothing to show yet: the same raised block as the panels, not a flat box. */
#mk4s body:not(.signin-mode) .student-popup .empty-state {
  border: 1px solid rgba(4, 7, 13, .1); border-radius: calc(12rem / 14); background: var(--d3-cap); color: var(--d3-cap-text);
  box-shadow: 0 5px 0 var(--d3-slab-edge), 0 16px 24px -8px var(--d3-drop), inset 0 1px var(--d3-shine);
}
@media (prefers-reduced-motion: reduce) { #mk4s body:not(.signin-mode) .student-results .data-table tbody td { transition: none; } }
/* Record entries (an allergy, a report, a sport result): raised cards. They lift on hover in the base styles; here they
   get the hard base edge. In dark mode the record used fixed light colours, so a white card carried pale text and the
   section headings vanished; the dark rules below make every line readable. */
#mk4s body:not(.signin-mode) .sr-card {
  background: var(--d3-cap); color: var(--d3-cap-text); border-color: rgba(4, 7, 13, .1);
  box-shadow: 0 4px 0 var(--d3-cap-edge), 0 12px 18px -8px var(--d3-drop), inset 0 1px var(--d3-shine);
}
#mk4s[data-theme="dark"] body:not(.signin-mode) .sr-card { border-left-color: #6ea0ff; }
#mk4s[data-theme="dark"] body:not(.signin-mode) .sr-section-head h4 { color: #c9d6ee; }
#mk4s[data-theme="dark"] body:not(.signin-mode) .sr-details dt { color: #a9b6cc; }
#mk4s[data-theme="dark"] body:not(.signin-mode) .sp-file { color: #b8ccff; border-color: #6ea0ff; }
#mk4s[data-theme="dark"] body:not(.signin-mode) .sr-form { background: #121a2b; border-color: #6ea0ff; }

/* ---------- 3D tabs, site-wide (RJL, 21 Nov 2026: "make all the tabs site wide look realistic") ----------
   Every tab row in the portal now matches the student pop-up tabs: the row is a sunken tray, each tab is a raised key
   with a hard base edge, and the chosen tab stays pressed down and turns blue. Covers the PA bar (Announcement / Live
   talk), the Today tabs, the Cameras tabs and channel picker, the teacher tablet tabs, and the tabs inside a student
   record. Plain CSS in the same keycap style as the buttons (AnimatedWebs Rectangle Buttons / Meridian Keycap, MIT):
   nothing is installed or downloaded. Sizes are compact (28px keys in a 36px-class tray) so the header and the Cameras
   toolbar keep their one-row height; touch screens still get 44px keys from the pointer:coarse rule above. */
#mk4s body:not(.signin-mode) :is(.pa-modes, .dash-tabs, .cctv-layouts, .sr-tabs) {
  display: inline-flex; flex-wrap: wrap; align-items: flex-start; gap: calc(4rem / 14); padding: calc(3rem / 14) calc(4rem / 14) calc(5rem / 14);
  border: 0; border-radius: calc(11rem / 14); background: var(--d3-well); overflow: visible;
  box-shadow: inset 0 2px 4px var(--d3-well-shade), 0 1px 0 var(--d3-shine);
}
#mk4s body:not(.signin-mode) :is(.pa-mode, .dash-tab, .cctv-layout, .sr-tab) {
  border: 1px solid rgba(4, 7, 13, .12); border-radius: calc(8rem / 14); background: var(--d3-cap); color: var(--d3-cap-text); font-weight: 600;
  box-shadow: 0 3px 0 var(--d3-cap-edge), 0 6px 9px -3px var(--d3-drop), inset 0 1px var(--d3-shine); transform: translateY(0);
  transition: transform 130ms cubic-bezier(.22, .61, .36, 1), box-shadow 130ms cubic-bezier(.22, .61, .36, 1);
}
#mk4s body:not(.signin-mode) :is(.pa-mode, .dash-tab, .cctv-layout, .sr-tab):hover:not([aria-checked="true"]):not([aria-selected="true"]):not(.active):not(:disabled) {
  background: var(--d3-cap); color: var(--d3-cap-text); transform: translateY(1px);
  box-shadow: 0 2px 0 var(--d3-cap-edge), 0 4px 7px -3px var(--d3-drop), inset 0 1px var(--d3-shine);
}
#mk4s body:not(.signin-mode) :is(.pa-mode, .dash-tab, .cctv-layout, .sr-tab):active:not(:disabled) {
  transform: translateY(3px); transition-duration: 0ms; box-shadow: 0 0 0 var(--d3-cap-edge), 0 1px 2px -1px var(--d3-drop), inset 0 1px var(--d3-shine);
}
#mk4s body:not(.signin-mode) :is(.pa-mode, .dash-tab, .cctv-layout, .sr-tab):is([aria-checked="true"], [aria-selected="true"], .active) {
  background: var(--d3-on); color: #fff; border-color: rgba(30, 58, 138, .6); transform: translateY(2px);
  box-shadow: 0 1px 0 var(--d3-on-edge), 0 2px 5px -2px rgba(30, 64, 175, .45), inset 0 1px rgba(255, 255, 255, .45);
}
#mk4s body:not(.signin-mode) :is(.pa-mode, .dash-tab, .cctv-layout, .sr-tab):disabled { opacity: .55; cursor: not-allowed; }
/* Teacher tablet: its three roll tabs are full buttons (already raised keys); they get the same sunken tray. */
#mk4s body:not(.signin-mode) .tablet-bar .tablet-tabs {
  flex: 0 1 auto; margin-right: auto; align-items: flex-start; padding: calc(4rem / 14) calc(5rem / 14) calc(7rem / 14); border-radius: calc(12rem / 14); background: var(--d3-well);
  box-shadow: inset 0 2px 4px var(--d3-well-shade), 0 1px 0 var(--d3-shine);
}
/* The student record's tabs used to sit on an underline; the tray replaces it. */
#mk4s body:not(.signin-mode) .sr-tabs { border-bottom: 0; margin-bottom: calc(12rem / 14); }
@media (prefers-reduced-motion: reduce) {
  #mk4s body:not(.signin-mode) :is(.pa-mode, .dash-tab, .cctv-layout, .sr-tab) { transition: none; }
}

/* ---------- Top strip: equal tiles (RJL, 21 Nov 2026: "make these tabs all the same size and they can take up more
   space on that line") ----------
   Every status tile, the fire switch and the user card share the row equally (flex: 1 1 0). Below the minimum width a
   tile wraps to the next line rather than squashing its text. The PA bar keeps its own full-width row. */
#mk4s body:not(.signin-mode) #top-strip > :is(.ts-state, .evac-mount, .ts-pill, .ts-weather, .ts-user) {
  flex: 1 1 0; box-sizing: border-box; min-width: calc(150rem / 14); margin-left: 0;
}
/* Flex shares the space left after each tile's padding and border, so the fire plate gets the same padding plus border
   total as the tiles (.8rem + 1.5px a side, measured) and comes out the same width. */
#mk4s body:not(.signin-mode) #top-strip > .evac-mount { padding: calc(3rem / 14) calc(.8rem + 1.5px); width: auto; min-width: calc(176rem / 14); align-self: stretch; display: flex; flex-direction: column; justify-content: center; }
#mk4s body:not(.signin-mode) #top-strip > .evac-mount[hidden] { display: none; }

/* ---------- Status lights: three traffic-signal heads (RJL, 21 Nov 2026) ----------
   Black rounded housing with a hood over each lens. Unlit lenses are dark tinted glass with a faint reflection; the lit
   lens is bright from the centre out, with a glow and a highlight like a real LED signal. Exactly one is lit.
   The housing is black in both light and dark themes, as on a real signal. Classes only (CSP). */
#mk4s body:not(.signin-mode) .status-lights {
  flex: none; align-self: stretch; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: calc(3rem / 14); padding: 0 calc(4rem / 14);
}
#mk4s body:not(.signin-mode) .sl-heads { display: flex; gap: calc(6rem / 14); }
#mk4s body:not(.signin-mode) .sl-head {
  position: relative; display: grid; place-items: center; width: calc(40rem / 14); height: calc(40rem / 14);
  border-radius: calc(9rem / 14);
  background: linear-gradient(160deg, #3a3d42 0%, #17181b 45%, #0b0c0e 100%);
  box-shadow: 0 3px 6px rgba(0, 0, 0, .45), 0 1px 1px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .14), inset 0 -2px 3px rgba(0, 0, 0, .6);
}
/* Hood (visor) over the top half of the lens, as on a real signal head. */
#mk4s body:not(.signin-mode) .sl-head::before {
  content: ""; position: absolute; z-index: 2; left: calc(5rem / 14); right: calc(5rem / 14); top: calc(2rem / 14); height: calc(11rem / 14);
  border-radius: calc(16rem / 14) calc(16rem / 14) calc(3rem / 14) calc(3rem / 14);
  background: linear-gradient(180deg, #2b2d31 0%, #08090a 100%);
  box-shadow: 0 2px 3px rgba(0, 0, 0, .7), inset 0 1px 0 rgba(255, 255, 255, .12);
}
/* Lens: dark tinted glass when off. */
#mk4s body:not(.signin-mode) .sl-lamp {
  position: relative; width: calc(28rem / 14); height: calc(28rem / 14); border-radius: 50%;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, .8), 0 0 0 calc(2rem / 14) #050506, 0 0 0 calc(3rem / 14) #2c2e33;
  transition: background 200ms ease, box-shadow 200ms ease, filter 200ms ease;
}
/* Glass highlight: a soft reflection at the upper left, present lit or not. */
#mk4s body:not(.signin-mode) .sl-lamp::after {
  content: ""; position: absolute; left: 18%; top: 14%; width: 38%; height: 26%; border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(255, 255, 255, .55) 0%, rgba(255, 255, 255, 0) 70%); opacity: .35;
}
#mk4s body:not(.signin-mode) .sl-lamp.red { background: radial-gradient(circle at 50% 55%, #4a0d0d 0%, #2a0607 60%, #150203 100%); }
#mk4s body:not(.signin-mode) .sl-lamp.amber { background: radial-gradient(circle at 50% 55%, #4a3006 0%, #2b1b03 60%, #160d01 100%); }
#mk4s body:not(.signin-mode) .sl-lamp.green { background: radial-gradient(circle at 50% 55%, #0b3a1c 0%, #05220f 60%, #021207 100%); }
/* Lit: bright core, coloured body, glow outside the lens. LED dot texture from a fine repeating radial pattern. */
#mk4s body:not(.signin-mode) .sl-lamp.lit::after { opacity: .9; }
#mk4s body:not(.signin-mode) .sl-lamp.red.lit {
  background: radial-gradient(circle, rgba(255, 255, 255, .22) 0 1px, transparent 1.4px) 0 0 / 4px 4px,
    radial-gradient(circle at 50% 50%, #fff1ec 0%, #ff6a5a 22%, #ff1f1f 50%, #c40000 85%, #7a0000 100%);
  box-shadow: inset 0 0 6px rgba(120, 0, 0, .6), 0 0 0 calc(2rem / 14) #050506, 0 0 0 calc(3rem / 14) #2c2e33,
    0 0 10px 3px rgba(255, 40, 30, .75), 0 0 22px 8px rgba(255, 30, 20, .35);
}
#mk4s body:not(.signin-mode) .sl-lamp.amber.lit {
  background: radial-gradient(circle, rgba(255, 255, 255, .22) 0 1px, transparent 1.4px) 0 0 / 4px 4px,
    radial-gradient(circle at 50% 50%, #fffbe6 0%, #ffd65a 22%, #ffab00 50%, #d37a00 85%, #7d4200 100%);
  box-shadow: inset 0 0 6px rgba(120, 60, 0, .6), 0 0 0 calc(2rem / 14) #050506, 0 0 0 calc(3rem / 14) #2c2e33,
    0 0 10px 3px rgba(255, 170, 0, .75), 0 0 22px 8px rgba(255, 150, 0, .35);
}
#mk4s body:not(.signin-mode) .sl-lamp.green.lit {
  background: radial-gradient(circle, rgba(255, 255, 255, .22) 0 1px, transparent 1.4px) 0 0 / 4px 4px,
    radial-gradient(circle at 50% 50%, #effff4 0%, #6dffa4 22%, #12e06a 50%, #00a347 85%, #005a26 100%);
  box-shadow: inset 0 0 6px rgba(0, 80, 30, .6), 0 0 0 calc(2rem / 14) #050506, 0 0 0 calc(3rem / 14) #2c2e33,
    0 0 10px 3px rgba(20, 230, 110, .7), 0 0 22px 8px rgba(20, 220, 100, .3);
}
/* Red alert lamp breathes slowly so it is noticed; off for people who ask for reduced motion. */
@keyframes sl-breathe { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.25); } }
#mk4s body:not(.signin-mode) .sl-lamp.red.lit { animation: sl-breathe 1.6s ease-in-out infinite; }
#mk4s body:not(.signin-mode) .sl-word {
  font-size: calc(10.5rem / 14); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted);
}
#mk4s body:not(.signin-mode) .status-lights[data-level="danger"] .sl-word { color: var(--danger-text); }
#mk4s body:not(.signin-mode) .status-lights[data-level="warning"] .sl-word { color: var(--warning-text); }
@media (prefers-reduced-motion: reduce) {
  #mk4s body:not(.signin-mode) .sl-lamp { transition: none; }
  #mk4s body:not(.signin-mode) .sl-lamp.red.lit { animation: none; }
}
