/* Smart Filter Monitoring: shared styles (Phase 1 foundation).
   Mobile-first. One set of tokens, one spacing scale, one type scale.
   Pages should use these components instead of one-off styles.
   Status terms are fixed: Good / Change soon / Past due (always text + color). */

/* DM Sans, self-hosted (latin subset, 400/500/600/700). Licence: static/fonts/OFL-LICENSE.txt */
@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/dm-sans-latin-400.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/dm-sans-latin-500.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/dm-sans-latin-600.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/dm-sans-latin-700.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ------------------------------------------------------------------ */
/* 1. Tokens                                                          */
/* ------------------------------------------------------------------ */
:root {
  /* Brand (names from .claude/rules/frontend.md) */
  --sbs-red: #c8102e;
  --sbs-red-dark: #a00d25;
  --sbs-ink: #2a2b2a;
  --sbs-muted: #6b6c6b;
  --sbs-dark: #1c2228;
  --sbs-line: #e4e4e2;
  --sbs-bg: #f6f6f4;
  /* Older names kept so existing rules still work; both now point at brand tokens */
  --sbs-navy: var(--sbs-dark);
  --sbs-page: var(--sbs-bg);
  --sbs-white: #ffffff;
  /* Card, input and panel background (v1.2.0: its own token so dark mode can re-point it) */
  --sbs-surface: #ffffff;
  /* Muted text: a darker shade of --sbs-muted so it passes 4.5:1 on every
     background it sits on (6.5:1 on white, 6.0:1 on --sbs-bg, 5.1:1 on --sbs-line).
     --sbs-muted itself is only 4.1:1 on --sbs-line. */
  --sbs-muted-text: #5d5e5d;
  /* Borders that are the only edge of a control need 3:1 against white (WCAG 1.4.11) */
  --sbs-control-line: #8a8b8a;

  /* Status: text on background, plus a bar color */
  --ok: #1e7b3c;
  --ok-bg: #e6f4ea;
  --ok-bar: #2e9e5b;
  --warn: #8a5a00;
  --warn-bg: #fff3d6;
  --warn-bar: #f0a400;
  --bad: #b00d27;
  --bad-bg: #fde8eb;
  --bad-bar: #c8102e;

  /* Type */
  --font-sans: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --fs-xs: 0.8125rem; /* 13: smallest text anywhere (v1.2.0; was 12) */
  --fs-sm: 0.875rem;  /* 14 */
  --fs-md: 1rem;      /* 16 */
  --fs-lg: 1.125rem;  /* 18 */
  --fs-xl: 1.375rem;  /* 22 */
  --fs-2xl: 1.75rem;  /* 28 */
  --fs-3xl: 2.25rem;  /* 36 */
  --lh-tight: 1.25;
  --lh-body: 1.5;

  /* Spacing scale */
  --sp-1: 0.25rem;  /* 4 */
  --sp-2: 0.5rem;   /* 8 */
  --sp-3: 0.75rem;  /* 12 */
  --sp-4: 1rem;     /* 16 */
  --sp-5: 1.5rem;   /* 24 */
  --sp-6: 2rem;     /* 32 */
  --sp-7: 3rem;     /* 48 */
  --sp-8: 4rem;     /* 64 */

  /* Shape */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pill: 41px;
  --shadow-1: 0 1px 2px rgba(22, 28, 46, 0.06), 0 1px 3px rgba(22, 28, 46, 0.08);
  --shadow-2: 0 4px 16px rgba(22, 28, 46, 0.14);

  /* Interaction */
  --tap: 44px;
  --focus-ring: 0 0 0 2px var(--sbs-white), 0 0 0 5px var(--sbs-navy);
  --dur: 150ms;

  /* Layers */
  --z-header: 100;
  --z-tabbar: 110;
  --z-menu: 120;
  --z-toast: 130;

  /* Layout */
  --content-max: 1200px;
  --tabbar-h: 64px;
  --appbar-h: 56px;
  /* Full viewport height: 100vh fallback, 100dvh where supported (phone browser bars) */
  --app-vh: 100vh;
  /* Safe areas (notch, home indicator); 0 on everything else */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  /* Surfaces used by the signed-in app (re-pointed in dark mode below) */
  --app-bg: var(--sbs-bg);
  --app-surface: #ffffff;
  --app-surface-2: #f0f0ee;
  --app-ink: var(--sbs-ink);
  --app-muted: var(--sbs-muted-text);
  --app-line: var(--sbs-line);
  --app-press: rgba(28, 34, 40, 0.08);
}

@supports (height: 100dvh) {
  :root {
    --app-vh: 100dvh;
  }
}

/* ------------------------------------------------------------------ */
/* 2. Base                                                            */
/* ------------------------------------------------------------------ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--sbs-ink);
  background-color: var(--sbs-page);
  line-height: var(--lh-body);
}

a {
  color: var(--sbs-red-dark);
}

a:hover {
  color: var(--sbs-red);
}

:focus-visible {
  /* Transparent outline: invisible normally, but forced-colors / High Contrast
     modes draw it, because they drop box-shadows. */
  outline: 2px solid transparent;
  outline-offset: 2px;
  box-shadow: var(--focus-ring);
}

.skip-link {
  position: absolute;
  left: var(--sp-3);
  top: -100px;
  z-index: var(--z-toast);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-pill);
  background: var(--sbs-navy);
  color: var(--sbs-white);
  font-weight: 700;
  text-decoration: none;
}

.skip-link:focus {
  top: var(--sp-3);
  color: var(--sbs-white);
}

/* hidden always wins, even over component display rules */
[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Readings and numbers line up in columns */
.num {
  font-variant-numeric: tabular-nums;
}

/* Units are always shown next to readings, e.g. 0.22 in. w.c. */
.unit {
  margin-left: 0.2em;
  font-size: max(var(--fs-xs), 0.85em);
  color: var(--sbs-muted-text);
  white-space: nowrap;
}

/* Long names wrap instead of overflowing */
.wrap-anywhere {
  overflow-wrap: anywhere;
  word-break: normal;
}

.app-main {
  display: block;
  min-height: 50vh;
}

.app-main:focus {
  outline: none;
}

.container-sbs {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--sp-4);
}

@media (min-width: 768px) {
  .container-sbs {
    padding: 0 var(--sp-5);
  }
}

/* ------------------------------------------------------------------ */
/* 3. Shell: top strip, header, nav, footer                           */
/* ------------------------------------------------------------------ */
.topstrip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0 var(--sp-1);
  min-height: var(--tap);
  background: var(--sbs-red);
  color: var(--sbs-white);
  font-size: var(--fs-sm);
  text-align: center;
  padding: 0 var(--sp-4);
}

/* the 44px tap target stays inside the red strip (white text needs the red behind it) */
.topstrip a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0 var(--sp-1);
  color: var(--sbs-white);
  font-weight: 700;
  text-decoration: underline;
}

.topstrip a:hover {
  color: var(--sbs-white);
  text-decoration: none;
}

.app-header {
  position: relative;
  z-index: var(--z-header);
  background: var(--sbs-surface);
  border-bottom: 1px solid var(--sbs-line);
}

.app-header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3);
  min-height: 64px;
  padding-top: var(--sp-2);
  padding-bottom: var(--sp-2);
}

.brand {
  display: flex;
  align-items: center;
  min-height: var(--tap);
  gap: var(--sp-3);
  min-width: 0;
  color: var(--sbs-ink);
  text-decoration: none;
}

.brand:hover {
  color: var(--sbs-ink);
  text-decoration: none;
}

.brand__mark {
  flex: none;
  width: 54px;
  height: 40px;
}

.brand__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: var(--lh-tight);
}

.brand__name {
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--sbs-ink);
}

.brand__by {
  font-size: var(--fs-xs);
  color: var(--sbs-muted-text);
}

.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--tap);
  height: var(--tap);
  margin-left: auto;
  padding: 0;
  border: 1px solid var(--sbs-control-line);
  border-radius: var(--radius-pill);
  background: var(--sbs-surface);
  color: var(--sbs-ink);
  cursor: pointer;
}

.nav-toggle svg {
  width: 22px;
  height: 22px;
}

.app-nav {
  display: none;
  width: 100%;
}

.app-nav.is-open {
  display: block;
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  margin: 0;
  padding: var(--sp-2) 0 var(--sp-3);
  list-style: none;
}

.nav-link-sbs {
  display: flex;
  align-items: center;
  min-height: var(--tap);
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--radius-pill);
  color: var(--sbs-ink);
  font-weight: 600;
  text-decoration: none;
}

.nav-link-sbs:hover {
  background: var(--sbs-bg);
  color: var(--sbs-ink);
  text-decoration: none;
}

.nav-link-sbs[aria-current="page"] {
  background: var(--sbs-navy);
  color: var(--sbs-white);
}

.nav-note {
  display: flex;
  align-items: center;
  min-height: var(--tap);
  padding: var(--sp-2) var(--sp-4);
  color: var(--sbs-muted-text);
  font-size: var(--fs-sm);
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  padding-bottom: var(--sp-3);
}

@media (min-width: 992px) {
  .app-header__inner {
    flex-wrap: nowrap;
  }

  .nav-toggle {
    display: none;
  }

  .app-nav,
  .app-nav.is-open {
    display: flex;
    align-items: center;
    width: auto;
    flex: 1 1 auto;
    min-width: 0;
  }

  .nav-list {
    flex-direction: row;
    flex-wrap: wrap;
    padding: 0;
    margin-left: var(--sp-4);
  }

  .header-actions {
    margin-left: auto;
    padding-bottom: 0;
    flex-wrap: nowrap;
  }
}

.app-footer {
  margin-top: var(--sp-7);
  border-top: 4px solid var(--sbs-red);
  background: var(--sbs-surface);
  color: var(--sbs-muted-text);
  font-size: var(--fs-sm);
}

.app-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding-top: var(--sp-5);
  padding-bottom: var(--sp-5);
}

.app-footer a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  color: var(--sbs-ink);
}

.app-footer a:hover {
  color: var(--sbs-red-dark);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-4);
  margin: 0;
  padding: 0;
  list-style: none;
}

/* ------------------------------------------------------------------ */
/* 4. Account menu (disclosure)                                       */
/* ------------------------------------------------------------------ */
.account {
  position: relative;
}

.account-menu {
  position: absolute;
  right: 0;
  top: calc(100% + var(--sp-2));
  z-index: var(--z-menu);
  min-width: 240px;
  max-width: calc(100vw - 2 * var(--sp-4));
  padding: var(--sp-2);
  border: 1px solid var(--sbs-line);
  border-radius: var(--radius-md);
  background: var(--sbs-surface);
  box-shadow: var(--shadow-2);
}

.account-menu__who {
  padding: var(--sp-2) var(--sp-3);
  color: var(--sbs-muted-text);
  font-size: var(--fs-sm);
  overflow-wrap: anywhere;
}

.account-menu a {
  display: flex;
  align-items: center;
  min-height: var(--tap);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-sm);
  color: var(--sbs-ink);
  text-decoration: none;
}

.account-menu a:hover {
  background: var(--sbs-bg);
}

/* ------------------------------------------------------------------ */
/* 5. Buttons (pills, 44px minimum)                                   */
/* ------------------------------------------------------------------ */
.btn-sbs {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: var(--tap);
  padding: var(--sp-2) var(--sp-5);
  border: 2px solid transparent;
  border-radius: var(--radius-pill);
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--dur) ease, border-color var(--dur) ease, color var(--dur) ease;
}

.btn-sbs:hover {
  text-decoration: none;
}

.btn-sbs--primary {
  background: var(--sbs-red);
  color: var(--sbs-white);
}

.btn-sbs--primary:hover {
  background: var(--sbs-red-dark);
  color: var(--sbs-white);
}

.btn-sbs--secondary {
  background: #000000;
  color: var(--sbs-white);
}

.btn-sbs--secondary:hover {
  background: var(--sbs-dark);
  color: var(--sbs-white);
}

.btn-sbs--outline {
  background: var(--sbs-surface);
  border-color: var(--sbs-ink);
  color: var(--sbs-ink);
}

.btn-sbs--outline:hover {
  background: var(--sbs-bg);
  color: var(--sbs-ink);
}

.btn-sbs--sm {
  padding: var(--sp-1) var(--sp-4);
  font-size: var(--fs-sm);
}

.btn-sbs[disabled],
.btn-sbs[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-sbs[aria-busy="true"]::after {
  content: "";
  width: 1em;
  height: 1em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: sbs-spin 0.8s linear infinite;
}

@keyframes sbs-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Button-looking reset for nav items that are <button>s */
.btn-reset {
  width: 100%;
  border: 0;
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

/* ------------------------------------------------------------------ */
/* 6. Cards, panels, labels                                           */
/* ------------------------------------------------------------------ */
.card-sbs {
  background: var(--sbs-surface);
  border: 1px solid var(--sbs-line);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
  box-shadow: var(--shadow-1);
}

.card-sbs img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
}

@media (min-width: 768px) {
  .card-sbs {
    padding: var(--sp-5);
  }
}

.hero {
  background: var(--sbs-navy);
  color: var(--sbs-white);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
}

.hero a:not(.btn-sbs) {
  color: inherit;
}

.eyebrow {
  display: block;
  margin-bottom: var(--sp-1);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sbs-muted-text);
}

.hero .eyebrow {
  color: #c9cfdb;
}

/* ------------------------------------------------------------------ */
/* 7. Status: pill, level bar, legend (text + color, never color only)*/
/* ------------------------------------------------------------------ */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: 0.125rem var(--sp-3);
  border-radius: var(--radius-pill);
  font-size: var(--fs-sm);
  font-weight: 700;
  line-height: 1.5;
  white-space: nowrap;
  background: var(--sbs-bg);
  color: var(--sbs-ink);
}

.status-pill::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: currentColor;
}

.status-pill--ok {
  background: var(--ok-bg);
  color: var(--ok);
}

.status-pill--warn {
  background: var(--warn-bg);
  color: var(--warn);
}

.status-pill--bad {
  background: var(--bad-bg);
  color: var(--bad);
}

.level-bar {
  display: block;
  width: 100%;
}

.level-bar__track {
  position: relative;
  height: 10px;
  border-radius: var(--radius-pill);
  background: var(--sbs-line);
  overflow: hidden;
}

.level-bar__fill {
  display: block;
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--ok-bar);
}

.level-bar--ok .level-bar__fill {
  background: var(--ok-bar);
}

.level-bar--warn .level-bar__fill {
  background: var(--warn-bar);
}

.level-bar--bad .level-bar__fill {
  background: var(--bad-bar);
}

.level-bar__label {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-2);
  margin-top: var(--sp-1);
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

/* ------------------------------------------------------------------ */
/* 8. Data freshness                                                  */
/* ------------------------------------------------------------------ */
.freshness {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  font-size: var(--fs-sm);
  color: var(--sbs-muted-text);
  font-variant-numeric: tabular-nums;
}

.freshness--stale {
  color: var(--warn);
  font-weight: 700;
}

/* ------------------------------------------------------------------ */
/* 9. Forms                                                           */
/* ------------------------------------------------------------------ */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  margin-bottom: var(--sp-4);
}

.field__label {
  font-weight: 700;
  font-size: var(--fs-sm);
}

.field__hint {
  font-size: var(--fs-sm);
  color: var(--sbs-muted-text);
}

.field__error {
  font-size: var(--fs-sm);
  color: var(--bad);
  font-weight: 600;
}

.input-sbs {
  width: 100%;
  min-height: var(--tap);
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid #8a8f98;
  border-radius: var(--radius-md);
  background: var(--sbs-surface);
  color: var(--sbs-ink);
  font: inherit;
}

/* ------------------------------------------------------------------ */
/* 10. Toolbar: search, filter chips, sort, groups (Phase 2 uses it)  */
/* ------------------------------------------------------------------ */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
}

.toolbar__search {
  flex: 1 1 240px;
  min-width: 0;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  min-height: var(--tap);
  padding: var(--sp-1) var(--sp-4);
  border: 1px solid var(--sbs-control-line);
  border-radius: var(--radius-pill);
  background: var(--sbs-surface);
  color: var(--sbs-ink);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
}

.chip[aria-pressed="true"] {
  background: var(--sbs-navy);
  border-color: var(--sbs-navy);
  color: var(--sbs-white);
}

.group-heading {
  margin: var(--sp-5) 0 var(--sp-2);
  font-size: var(--fs-sm);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--sbs-muted-text);
}

/* ------------------------------------------------------------------ */
/* 11. Table to cards on small screens                                */
/* ------------------------------------------------------------------ */
.table-sbs {
  width: 100%;
  /* separate + 0 spacing so the rounded corners show */
  border-collapse: separate;
  border-spacing: 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--sbs-surface);
}

.table-sbs tbody tr:last-child > th,
.table-sbs tbody tr:last-child > td {
  border-bottom: 0;
}

.table-sbs th,
.table-sbs td {
  padding: var(--sp-3);
  border-bottom: 1px solid var(--sbs-line);
  text-align: left;
  vertical-align: top;
}

.table-sbs th {
  font-size: var(--fs-sm);
  color: var(--sbs-muted-text);
}

@media (max-width: 767.98px) {
  .table-cards thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .table-cards,
  .table-cards tbody,
  .table-cards tr,
  .table-cards td {
    display: block;
    width: 100%;
  }

  .table-cards tr {
    margin-bottom: var(--sp-3);
    border: 1px solid var(--sbs-line);
    border-radius: var(--radius-lg);
    background: var(--sbs-surface);
    padding: var(--sp-2) var(--sp-3);
  }

  .table-cards td {
    display: flex;
    justify-content: space-between;
    gap: var(--sp-3);
    border-bottom: 0;
    padding: var(--sp-2) 0;
  }

  .table-cards td[data-label]::before {
    content: attr(data-label);
    flex: none;
    font-weight: 700;
    color: var(--sbs-muted-text);
  }
}

/* ------------------------------------------------------------------ */
/* 12. Messages: flash and toasts                                     */
/* ------------------------------------------------------------------ */
/* Flashed messages (moved from login.html unchanged) */
.sbs-flash {
  font-family: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #2a2b2a;
  background-color: #f6f6f4;
  border: 1px solid #e4e4e2;
  border-radius: 12px;
  padding: 12px 16px;
  margin: 0 0 12px 0;
}
.sbs-flash a {
  color: #c8102e;
  font-weight: bold;
  text-decoration: underline;
}
.sbs-flash a:hover {
  color: #a00d25;
}
.sbs-flash-success {
  color: #1e7b3c;
  background-color: #e6f4ea;
}
.sbs-flash-warning {
  color: #8a5a00;
  background-color: #fff3d6;
}
.sbs-flash-error,
.sbs-flash-danger {
  color: #b00d27;
  background-color: #fde8eb;
}

/* Toast region: shell-level messages, top of the page */
.toast-region {
  position: fixed;
  top: var(--sp-3);
  left: 50%;
  z-index: var(--z-toast);
  width: min(560px, calc(100vw - 2 * var(--sp-4)));
  transform: translateX(-50%);
}

.toast-region:empty {
  display: none;
}

.toast-region .sbs-flash {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  box-shadow: var(--shadow-2);
}

.toast-region .sbs-flash__text {
  flex: 1 1 auto;
}

.toast-close {
  flex: none;
  width: var(--tap);
  height: var(--tap);
  margin: calc(-1 * var(--sp-3)) calc(-1 * var(--sp-3)) 0 0;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: inherit;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

/* ------------------------------------------------------------------ */
/* 13. States: empty, loading, error, no access                       */
/* ------------------------------------------------------------------ */
.state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-6) var(--sp-4);
  border: 1px dashed #b9bdc4;
  border-radius: var(--radius-lg);
  background: var(--sbs-surface);
  text-align: center;
}

.state__title {
  margin: 0;
  font-size: var(--fs-lg);
  font-weight: 700;
}

.state__text {
  margin: 0;
  max-width: 48ch;
  color: var(--sbs-muted-text);
}

.state--error {
  border-style: solid;
  border-color: var(--bad);
  background: var(--bad-bg);
}

.state--error .state__title {
  color: var(--bad);
}

.state--no-access {
  border-style: solid;
  border-color: var(--sbs-line);
}

.skeleton {
  display: block;
  height: 1em;
  margin: var(--sp-1) 0;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, #e9ebef 25%, #f4f5f7 37%, #e9ebef 63%);
  background-size: 400% 100%;
  animation: sbs-shimmer 1.4s ease infinite;
}

@keyframes sbs-shimmer {
  0% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0 50%;
  }
}

/* ------------------------------------------------------------------ */
/* 14. Bottom tab bar (phones only)                                   */
/* ------------------------------------------------------------------ */
.tabbar {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: var(--z-tabbar);
  display: flex;
  justify-content: space-around;
  min-height: var(--tabbar-h);
  padding-bottom: env(safe-area-inset-bottom, 0);
  border-top: 1px solid var(--sbs-line);
  background: var(--sbs-surface);
}

.tabbar__item {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: var(--tabbar-h);
  padding: var(--sp-1);
  border: 0;
  background: transparent;
  color: var(--sbs-muted-text);
  font: inherit;
  font-size: var(--fs-xs);
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.tabbar__item-wrap {
  display: flex;
  flex: 1 1 0;
}

.tabbar__item svg {
  width: 24px;
  height: 24px;
}

.tabbar__item:hover {
  color: var(--sbs-ink);
  text-decoration: none;
}

.tabbar__item[aria-current="page"] {
  color: var(--sbs-navy);
}

.tabbar__item[aria-current="page"] svg {
  color: var(--sbs-red);
}

.tabbar .account-menu {
  top: auto;
  bottom: calc(100% + var(--sp-2));
}

body.has-tabbar {
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
}

@media (min-width: 768px) {
  .tabbar {
    display: none;
  }

  body.has-tabbar {
    padding-bottom: 0;
  }
}

/* ------------------------------------------------------------------ */
/* 15a. Page layout pieces (Phase 2)                                  */
/* ------------------------------------------------------------------ */
.page-section {
  padding-top: var(--sp-5);
  padding-bottom: var(--sp-6);
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-2) var(--sp-4);
  margin-bottom: var(--sp-4);
}

.page-title {
  margin: 0;
  font-size: var(--fs-2xl);
  font-weight: 700;
  line-height: var(--lh-tight);
}

.section-title {
  margin: 0 0 var(--sp-3);
  font-size: var(--fs-lg);
  font-weight: 700;
}

.meta-text {
  font-size: var(--fs-sm);
  color: var(--sbs-muted-text);
}

.crumbs {
  margin-bottom: var(--sp-3);
}

.crumbs a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  font-weight: 600;
}

.crumbs a::before {
  content: "\2190";
  margin-right: var(--sp-2);
}

.toolbar__field {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  margin: 0;
}

.toolbar__label {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--sbs-muted-text);
}

.toolbar__field .input-sbs {
  width: auto;
}

.toolbar__count {
  margin: 0 0 0 auto;
  font-size: var(--fs-sm);
  color: var(--sbs-muted-text);
  font-variant-numeric: tabular-nums;
}

.toolbar__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
}

.chip-group {
  display: inline-flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

/* On-off switch (a real checkbox) */
.switch {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: var(--tap);
  margin: 0;
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
}

.switch input {
  width: 1.25rem;
  height: 1.25rem;
  accent-color: var(--sbs-navy);
}

/* Light button for navy panels */
.btn-sbs--light {
  background: transparent;
  border-color: var(--sbs-white);
  color: var(--sbs-white);
}

.btn-sbs--light:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--sbs-white);
}

/* Whole-card link, with buttons inside the card still clickable */
.stretched-link-sbs::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: var(--radius-lg);
}

/* ------------------------------------------------------------------ */
/* 15b. Locations                                                     */
/* ------------------------------------------------------------------ */
.loc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: var(--sp-3);
}

.loc-grid .group-heading {
  grid-column: 1 / -1;
  margin: var(--sp-3) 0 0;
}

.loc-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  transition: border-color var(--dur) ease, box-shadow var(--dur) ease;
}

.loc-card:hover,
.loc-card:focus-within {
  border-color: #b9bdc4;
  box-shadow: var(--shadow-2);
}

.loc-card__icon {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--sbs-bg);
  color: var(--sbs-navy);
}

.loc-card__icon svg {
  width: 24px;
  height: 24px;
}

.loc-card__body {
  flex: 1 1 auto;
  min-width: 0;
}

.loc-card__name {
  margin: 0 0 var(--sp-1);
  font-size: var(--fs-lg);
  font-weight: 700;
  line-height: var(--lh-tight);
}

.loc-card__name a {
  color: var(--sbs-ink);
  text-decoration: none;
}

.loc-card__name a:hover {
  color: var(--sbs-red-dark);
  text-decoration: underline;
}

.loc-card__name a:focus-visible {
  box-shadow: none;
}

.loc-card__name a:focus-visible::after {
  box-shadow: var(--focus-ring);
}

.loc-card__addr {
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--sbs-muted-text);
}

.pin-btn {
  position: relative;
  z-index: 1;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--tap);
  height: var(--tap);
  margin: calc(-1 * var(--sp-2)) calc(-1 * var(--sp-2)) 0 0;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--sbs-muted-text);
  cursor: pointer;
}

.pin-btn svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.pin-btn:hover {
  background: var(--sbs-bg);
  color: var(--sbs-ink);
}

.pin-btn[aria-pressed="true"] {
  color: #8a5a00;
}

.pin-btn[aria-pressed="true"] svg {
  fill: #f0a400;
}

/* ------------------------------------------------------------------ */
/* 15c. Status board (Location detail)                                */
/* ------------------------------------------------------------------ */
.board-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-bottom: var(--sp-4);
}

.board-hero__main {
  min-width: 0;
  flex: 1 1 320px;
}

.hero__title {
  margin: 0 0 var(--sp-2);
  font-size: var(--fs-2xl);
  font-weight: 700;
  line-height: var(--lh-tight);
  color: var(--sbs-white);
}

.hero__meta,
.hero__fresh {
  margin: 0 0 var(--sp-1);
  color: #d7dbe3;
}

.hero__hint {
  font-size: var(--fs-sm);
}

.hero__badge {
  display: inline-block;
  margin-left: var(--sp-2);
  padding: 0 var(--sp-2);
  border: 1px solid #d7dbe3;
  border-radius: var(--radius-pill);
  font-size: var(--fs-xs);
  font-weight: 700;
}

.board-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

@media (max-width: 575.98px) {
  .board-hero__actions .btn-sbs {
    flex: 1 1 100%;
  }
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}

.stat-tile {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-lg);
  border: 1px solid var(--sbs-line);
  background: var(--sbs-surface);
}

.stat-tile__num {
  font-size: var(--fs-2xl);
  font-weight: 700;
  line-height: 1;
}

.stat-tile__label {
  font-size: var(--fs-sm);
  font-weight: 700;
}

.stat-tile--ok {
  background: var(--ok-bg);
  color: var(--ok);
}

.stat-tile--warn {
  background: var(--warn-bg);
  color: var(--warn);
}

.stat-tile--bad {
  background: var(--bad-bg);
  color: var(--bad);
}

.board-toolbar {
  justify-content: space-between;
}

.next-steps {
  margin-bottom: var(--sp-4);
  border-left: 6px solid var(--warn-bar);
}

.next-steps__list {
  margin: 0 0 var(--sp-3);
  padding-left: var(--sp-5);
}

.next-steps__list li {
  margin-bottom: var(--sp-2);
}

.next-steps__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.booth-list {
  display: grid;
  gap: var(--sp-4);
}

.booth-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-3);
}

.booth-card__title-wrap {
  min-width: 0;
}

.booth-card__title {
  margin: 0;
  font-size: var(--fs-xl);
  font-weight: 700;
  line-height: var(--lh-tight);
}

.booth-card__power {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
  margin: var(--sp-2) 0 var(--sp-3);
  font-size: var(--fs-sm);
}

.power-dot,
.sensor-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #8a8f98;
}

.power-dot--online,
.sensor-dot--online {
  background: var(--ok-bar);
}

.power-dot--battery {
  background: var(--warn-bar);
}

.power-dot--offline,
.sensor-dot--offline {
  background: var(--bad-bar);
}

.sensor-dot {
  margin-right: var(--sp-1);
}

.filter-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.filter-row {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "name status"
    "reading reading"
    "bar bar"
    "actions actions";
  gap: var(--sp-2) var(--sp-3);
  padding: var(--sp-3) 0;
  border-top: 1px solid var(--sbs-line);
}

.filter-row__name {
  grid-area: name;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.filter-row__label {
  font-weight: 700;
}

.filter-row__reading {
  grid-area: reading;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--sp-2);
}

.reading {
  font-size: var(--fs-xl);
  font-weight: 700;
}

.filter-row__bar {
  grid-area: bar;
}

.filter-row__status {
  grid-area: status;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.status-orig {
  font-size: var(--fs-xs);
  color: var(--sbs-muted-text);
  text-align: right;
}

.filter-row__actions {
  grid-area: actions;
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

@media (min-width: 900px) {
  .filter-row {
    grid-template-columns: minmax(150px, 1.3fr) 150px minmax(160px, 1.5fr) 170px auto;
    grid-template-areas: "name reading bar status actions";
    align-items: center;
  }

  .filter-row__actions {
    justify-content: flex-end;
  }
}

.tv-exit {
  display: none;
}

/* ------------------------------------------------------------------ */
/* 15d. Slide-over panel (native <dialog>)                            */
/* ------------------------------------------------------------------ */
.slideover {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(480px, 100vw);
  max-width: 100vw;
  height: 100%;
  max-height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--sbs-surface);
  color: var(--sbs-ink);
  box-shadow: var(--shadow-2);
  overflow-y: auto;
}

.slideover::backdrop {
  background: rgba(22, 28, 46, 0.5);
}

.slideover__head {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--sbs-line);
  background: var(--sbs-surface);
}

.slideover__head .section-title {
  margin: 0;
}

.slideover__close {
  width: var(--tap);
  height: var(--tap);
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--sbs-bg);
  color: var(--sbs-ink);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.slideover__body {
  padding: var(--sp-4) var(--sp-5) var(--sp-6);
}

.help-h {
  margin: var(--sp-5) 0 var(--sp-2);
  font-size: var(--fs-md);
  font-weight: 700;
}

.help-levels {
  margin: 0;
  padding: 0;
  list-style: none;
}

.help-levels li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-2);
}

.help-steps {
  padding-left: var(--sp-5);
}

/* ------------------------------------------------------------------ */
/* 15e. Control-room display (TV mode)                                */
/* ------------------------------------------------------------------ */
body.tv-mode {
  background: var(--sbs-navy);
  padding-bottom: 0;
}

body.tv-mode .topstrip,
body.tv-mode .app-header,
body.tv-mode .app-footer,
body.tv-mode .tabbar,
body.tv-mode .crumbs,
body.tv-mode .board-toolbar,
body.tv-mode .next-steps,
body.tv-mode .board-hero__actions,
body.tv-mode .filter-row__actions,
body.tv-mode .status-orig,
body.tv-mode .toast-region {
  display: none !important;
}

body.tv-mode .container-sbs {
  max-width: none;
}

body.tv-mode .tv-exit {
  display: inline-flex;
  position: fixed;
  top: var(--sp-3);
  right: var(--sp-3);
  z-index: var(--z-toast);
  background: var(--sbs-navy);
}

body.tv-mode .board-hero {
  padding: var(--sp-3) 0;
  margin-bottom: var(--sp-3);
}

body.tv-mode .hero__title {
  font-size: 2.5rem;
}

body.tv-mode .stat-tile__num {
  font-size: 3rem;
}

body.tv-mode .stat-tile__label {
  font-size: var(--fs-xl);
}

body.tv-mode .booth-list {
  grid-template-columns: repeat(auto-fill, minmax(560px, 1fr));
}

body.tv-mode .booth-card {
  border: 0;
}

body.tv-mode .booth-card__title {
  font-size: var(--fs-2xl);
}

body.tv-mode .filter-row {
  grid-template-columns: 1.3fr auto 1fr auto;
  grid-template-areas: "name reading bar status";
  align-items: center;
  font-size: var(--fs-lg);
}

body.tv-mode .reading {
  font-size: var(--fs-2xl);
}

body.tv-mode .level-bar__label {
  display: none;
}

body.tv-mode .status-pill {
  font-size: var(--fs-lg);
  padding: var(--sp-1) var(--sp-4);
}

/* ------------------------------------------------------------------ */
/* 15f. Print report                                                  */
/* ------------------------------------------------------------------ */
.print-only {
  display: none;
}

@media print {
  @page {
    margin: 14mm 12mm;

    @bottom-right {
      content: "Page " counter(page) " of " counter(pages);
      font-size: 9pt;
    }
  }

  .print-only {
    display: block;
  }

  /* the report header replaces the site header on printed status pages */
  .page-board .topstrip,
  .page-board .app-header,
  .page-board .app-footer {
    display: none !important;
  }

  .print-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #000000;
  }

  .crumbs,
  .board-toolbar,
  .board-hero__actions,
  .next-steps__actions,
  .filter-row__actions,
  .tv-exit,
  dialog,
  .loc-card__slot {
    display: none !important;
  }

  .board-hero {
    padding: 0 0 8px;
  }

  .hero__title,
  .hero__meta,
  .hero__fresh {
    color: #000000 !important;
  }

  .stat-tile {
    border: 1px solid #000000;
  }

  .booth-card,
  .filter-row {
    break-inside: avoid;
  }

  .filter-row {
    grid-template-columns: 1.3fr auto 1fr auto;
    grid-template-areas: "name reading bar status";
  }

  .print-sign {
    margin-top: 24px;
    font-size: 11pt;
  }
}

/* ------------------------------------------------------------------ */
/* 15g. History page                                                  */
/* ------------------------------------------------------------------ */
.history-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-bottom: var(--sp-4);
}

.history-hero__main {
  flex: 1 1 320px;
  min-width: 0;
}

.history-path {
  margin: 0 0 var(--sp-1);
  color: #d7dbe3;
  font-weight: 600;
}

.history-now {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2) var(--sp-3);
  margin: 0;
}

.history-now .reading {
  color: var(--sbs-ink);
  font-size: var(--fs-2xl);
}

.history-now .unit {
  color: var(--sbs-muted-text);
}

.history-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

@media (max-width: 575.98px) {
  .history-hero__actions .btn-sbs {
    flex: 1 1 100%;
  }
}

.insights {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}

.insight__value {
  margin: 0 0 var(--sp-1);
  font-size: var(--fs-xl);
  font-weight: 700;
  line-height: var(--lh-tight);
}

.insight .meta-text {
  margin: 0;
}

.chart-card {
  margin-bottom: var(--sp-4);
}

.chart-card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-2);
}

.chart-card__head .section-title {
  margin: 0;
}

.chart-legend {
  margin-bottom: var(--sp-2);
  font-size: var(--fs-sm);
  color: var(--sbs-muted-text);
}

.chart-legend li {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  margin-right: var(--sp-3);
}

.legend__swatch {
  display: inline-block;
  width: 18px;
  height: 10px;
  border-radius: 3px;
}

.legend__swatch--line {
  height: 3px;
  background: var(--sbs-navy);
}

.legend__swatch--warn {
  background: rgba(240, 164, 0, 0.35);
  border-top: 2px dashed #b37800;
}

.legend__swatch--bad {
  background: rgba(200, 16, 46, 0.25);
  border-top: 2px dashed var(--sbs-red);
}

.chart-wrap {
  position: relative;
  width: 100%;
  height: clamp(260px, 45vw, 420px);
}

.chart-fallback {
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-md);
  background: var(--warn-bg);
  color: var(--warn);
  font-weight: 600;
}

.chart-summary {
  margin: var(--sp-3) 0 var(--sp-1);
}

.history-next {
  margin-bottom: var(--sp-4);
}

.state + .next-steps__actions {
  margin-top: var(--sp-3);
}

.readings > summary {
  cursor: pointer;
  min-height: var(--tap);
  display: flex;
  align-items: center;
}

.readings__scroll {
  margin-top: var(--sp-2);
}

@media print {
  .page-history .topstrip,
  .page-history .app-header,
  .page-history .app-footer,
  .page-history .crumbs,
  .page-history .history-hero__actions,
  .page-history .chart-card__head .chip-group,
  .page-history .history-next {
    display: none !important;
  }

  .page-history .history-path,
  .page-history .history-now .reading,
  .page-history .history-now .unit,
  .page-history .hero__hint {
    color: #000000 !important;
  }

  .page-history .chart-wrap {
    height: 300px;
  }

  .page-history .readings .table-cards thead {
    position: static;
    width: auto;
    height: auto;
    clip: auto;
  }
}

/* ------------------------------------------------------------------ */
/* 15. Page families (rules moved from repeated page styles, scoped)  */
/* ------------------------------------------------------------------ */
/* Sign-in / registration / password pages (layouts/auth.html) */
.auth-shell {
  display: grid;
  gap: var(--sp-4);
  max-width: 960px;
  margin: 0 auto;
}

@media (min-width: 900px) {
  .auth-shell {
    grid-template-columns: 1fr 1.1fr;
    align-items: stretch;
  }
}

.auth-intro {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--sp-3);
}

.auth-intro__title {
  margin: 0;
  font-size: var(--fs-2xl);
  font-weight: 700;
  line-height: var(--lh-tight);
  color: var(--sbs-white);
}

.auth-intro__list {
  margin: 0;
  padding-left: var(--sp-5);
  color: #d7dbe3;
}

.auth-intro__list li {
  margin-bottom: var(--sp-1);
}

.auth-intro__help {
  margin: 0;
  color: #d7dbe3;
}

.auth-intro__help a {
  font-weight: 700;
}

@media (max-width: 899.98px) {
  .auth-intro {
    padding: var(--sp-4);
  }

  .auth-intro__title {
    font-size: var(--fs-xl);
  }

  .auth-intro__list {
    display: none;
  }
}

.auth-card {
  padding: var(--sp-5);
}

@media (min-width: 768px) {
  .auth-card {
    padding: var(--sp-6);
  }
}

.auth-title {
  margin: 0 0 var(--sp-2);
  font-size: var(--fs-2xl);
  font-weight: 700;
  line-height: var(--lh-tight);
}

.auth-lead {
  margin: 0 0 var(--sp-4);
}

.auth-card > .sbs-flash {
  margin-bottom: var(--sp-4);
}

.auth-form .input-sbs {
  font-size: 1rem; /* 16px+ so phones don't zoom in */
}

.field-row {
  display: grid;
  gap: 0 var(--sp-3);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
}

.pw-wrap {
  position: relative;
  display: flex;
}

.pw-wrap .input-sbs {
  padding-right: 5rem;
}

.pw-toggle {
  position: absolute;
  top: 0;
  right: 0;
  min-width: var(--tap);
  height: 100%;
  padding: 0 var(--sp-3);
  border: 0;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  background: transparent;
  color: var(--sbs-red-dark);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 700;
  cursor: pointer;
}

.check {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: var(--tap);
  margin: 0 0 var(--sp-3);
  cursor: pointer;
}

.check input {
  width: 1.25rem;
  height: 1.25rem;
  accent-color: var(--sbs-navy);
}

.auth-submit {
  width: 100%;
}

.auth-links {
  margin: var(--sp-4) 0 0;
  text-align: center;
}

.auth-links a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  font-weight: 700;
}

.field--invalid .input-sbs {
  border-color: var(--bad);
  border-width: 2px;
}

.optional-fields {
  margin-bottom: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--sbs-line);
  border-radius: var(--radius-md);
}

.optional-fields > summary {
  display: flex;
  align-items: center;
  min-height: var(--tap);
  font-weight: 700;
  cursor: pointer;
}

/* Admin (Phase 5): admin.html tabs and tables, and the *_form.html edit forms */
.btn-sbs--danger {
  border-color: var(--bad);
  background: var(--sbs-surface);
  color: var(--bad);
}

.btn-sbs--danger:hover,
.btn-sbs--danger:focus-visible {
  background: var(--bad);
  color: var(--sbs-white);
}

.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
  padding-bottom: var(--sp-2);
  border-bottom: 1px solid var(--sbs-line);
}

.admin-tab {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: var(--sp-2);
  min-height: var(--tap);
  padding: var(--sp-1) var(--sp-4);
  border: 1px solid var(--sbs-control-line);
  border-radius: var(--radius-pill);
  background: var(--sbs-surface);
  color: var(--sbs-ink);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
}

.admin-tab[aria-selected="true"] {
  border-color: var(--sbs-navy);
  background: var(--sbs-navy);
  color: var(--sbs-white);
}

.admin-tab__count {
  font-weight: 400;
  opacity: 0.85;
}

.admin-panel {
  padding: var(--sp-4);
}

.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2) var(--sp-3);
  margin-bottom: var(--sp-3);
}

.admin-toolbar .section-title {
  flex: 1 1 100%;
  margin: 0;
}

.admin-search {
  flex: 1 1 220px;
  width: auto;
}

.admin-count {
  margin: 0;
}

.admin-warning {
  margin: var(--sp-4) 0;
  padding: var(--sp-3) var(--sp-4);
  border-left: 4px solid var(--warn-bar);
  border-radius: var(--radius-md);
  background: var(--warn-bg);
  color: var(--sbs-ink);
}

.admin-intro-list li {
  margin-bottom: var(--sp-2);
}

/* Table: header stays in view while the table scrolls */
.admin-table-wrap {
  max-height: 70vh;
  overflow: auto;
  border: 1px solid var(--sbs-line);
  border-radius: var(--radius-md);
}

.admin-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--sbs-bg);
  color: var(--sbs-ink);
  white-space: nowrap;
}

.admin-table tbody tr:nth-child(even) {
  background: #fafafa;
}

.admin-edit {
  width: 1%;
  white-space: nowrap;
}

.admin-col-30 {
  width: 30%;
}

.admin-col-70 {
  width: 70%;
}

.sort-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  min-height: 32px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.sort-btn::after {
  content: "\2195";
  font-size: 0.85em;
  opacity: 0.5;
}

th[aria-sort="ascending"] .sort-btn::after {
  content: "\2191";
  opacity: 1;
}

th[aria-sort="descending"] .sort-btn::after {
  content: "\2193";
  opacity: 1;
}

.badge-test,
.badge-flag {
  display: inline-block;
  margin-left: var(--sp-1);
  padding: 0 var(--sp-2);
  border-radius: var(--radius-pill);
  font-size: var(--fs-xs);
  font-weight: 700;
  line-height: 1.6;
  vertical-align: middle;
  white-space: nowrap;
}

.badge-test {
  background: #e8eaf6;
  color: #283593;
}

.badge-flag {
  margin: 0 var(--sp-1) var(--sp-1) 0;
  background: var(--warn-bg);
  color: var(--warn);
}

.badge-flag--bad {
  background: var(--bad-bg);
  color: var(--bad);
}

.badge-flag--ok {
  background: var(--ok-bg);
  color: var(--ok);
}

.admin-range-summary:not(:empty) {
  margin-bottom: var(--sp-3);
}

.pin-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.pin-list__pin {
  display: inline-block;
  min-width: 3.5rem;
  color: var(--sbs-muted-text);
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 767.98px) {
  .admin-table-wrap {
    max-height: none;
    overflow: visible;
    border: 0;
  }

  .admin-table tbody tr:nth-child(even) {
    background: var(--sbs-surface);
  }

  .admin-edit {
    width: 100%;
  }

  .admin-col-30,
  .admin-col-70 {
    width: 100%;
  }

  .admin-table td {
    flex-wrap: wrap;
  }
}

/* Edit forms: the original appnitro markup (ul > li > label.description, .element, .guidelines) restyled */
.admin-form-card {
  max-width: 760px;
  padding: var(--sp-5);
}

.page-admin-form .appnitro ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.page-admin-form .appnitro li {
  margin: 0 0 var(--sp-4);
  padding: var(--sp-3) var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--sbs-line);
  border-radius: var(--radius-md);
}

/* Replaces admin_form_view.js, which shaded the field group being edited ("highlighted" class on focus) */
.page-admin-form .appnitro li:focus-within {
  background: #f4f6fa;
  box-shadow: inset 4px 0 0 var(--sbs-navy);
}

.page-admin-form .appnitro li:last-child {
  border-bottom: 0;
}

.page-admin-form .appnitro li::after {
  content: "";
  display: table;
  clear: both;
}

.page-admin-form .description {
  display: block;
  margin: 0 0 var(--sp-2);
  font-size: var(--fs-lg);
  font-weight: 700;
}

.page-admin-form .appnitro li > div {
  margin-bottom: var(--sp-3);
}

.page-admin-form .appnitro li > div > label,
.page-admin-form .appnitro td > label,
.page-admin-form .appnitro .col-5 > label,
.page-admin-form .appnitro .col-1 > label {
  display: block;
  margin-top: var(--sp-1);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--sbs-muted-text);
}

.page-admin-form .element {
  width: 100%;
  max-width: 100%;
  min-height: var(--tap);
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid #8a8f98;
  border-radius: var(--radius-md);
  background: var(--sbs-surface);
  color: var(--sbs-ink);
  font: inherit;
}

.page-admin-form textarea.element {
  min-height: 10rem;
  resize: vertical;
}

.page-admin-form .element:disabled {
  border-color: var(--sbs-line);
  background: var(--sbs-bg);
  color: var(--sbs-muted-text);
}

.page-admin-form .element.small {
  max-width: 10rem;
}

.page-admin-form .element.medium {
  max-width: 24rem;
}

.page-admin-form .guidelines {
  margin: 0 0 var(--sp-3);
  color: var(--sbs-muted-text);
}

.page-admin-form .guidelines small {
  font-size: var(--fs-sm);
}

.page-admin-form .access_list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--sp-2) var(--sp-2);
  align-items: center;
}

.page-admin-form .access_list br {
  display: none;
}

.page-admin-form .access_list input[type="checkbox"] {
  width: 20px;
  height: 20px;
}

.page-admin-form .access_list label {
  margin: 0;
  color: var(--sbs-ink);
  font-size: var(--fs-md);
  font-weight: 400;
}

.page-admin-form .appnitro table {
  width: 100%;
  border-collapse: collapse;
}

.page-admin-form .appnitro td {
  padding: var(--sp-2) var(--sp-2) var(--sp-2) 0;
  vertical-align: bottom;
}

/* range_formv2 rows use class="row"; stop Bootstrap 4 turning a table row into a flex row */
.page-admin-form .appnitro tr.row {
  display: table-row;
  margin: 0;
}

.page-admin-form .range-note {
  margin-top: var(--sp-3);
}

.page-admin-form .appnitro .row > .col-1 {
  flex: 0 0 10rem;
  max-width: 10rem;
}

.page-admin-form .appnitro td .element.small {
  min-width: 5rem;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
}

.admin-actions__note {
  margin: 0;
}

.range-error {
  margin: var(--sp-1) 0 0;
  color: var(--bad);
  font-size: var(--fs-sm);
  font-weight: 600;
}

.page-admin-form .element[aria-invalid="true"] {
  border-color: var(--bad);
  box-shadow: 0 0 0 1px var(--bad);
}

@media (min-width: 768px) {
  .page-admin-form .appnitro .left,
  .page-admin-form .appnitro .right {
    display: inline-block;
    width: calc(50% - var(--sp-2));
    vertical-align: top;
  }

  .page-admin-form .appnitro .left {
    margin-right: var(--sp-3);
  }
}

@media (max-width: 767.98px) {
  .admin-form-card {
    padding: var(--sp-4);
  }

  .page-admin-form .appnitro table,
  .page-admin-form .appnitro tbody,
  .page-admin-form .appnitro tr,
  .page-admin-form .appnitro td {
    display: block;
    width: 100%;
  }

  .page-admin-form .appnitro tr {
    margin-bottom: var(--sp-3);
    padding: var(--sp-3);
    border: 1px solid var(--sbs-line);
    border-radius: var(--radius-md);
  }
}

@media print {
  .admin-tabs,
  .admin-toolbar,
  .admin-edit {
    display: none !important;
  }

  .admin-table-wrap {
    max-height: none;
    overflow: visible;
  }
}


/* ------------------------------------------------------------------ */
/* 16. Motion and print                                               */
/* ------------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  .topstrip,
  .app-nav,
  .nav-toggle,
  .header-actions,
  .tabbar,
  .toast-region,
  .skip-link,
  .btn-sbs {
    display: none !important;
  }

  body,
  body.has-tabbar {
    padding: 0;
    background: var(--sbs-surface);
    color: #000000;
  }

  .app-header,
  .app-footer,
  .card-sbs,
  .hero {
    background: #ffffff !important;
    color: #000000 !important;
    border-color: #000000;
    box-shadow: none;
  }

  .card-sbs,
  .table-cards tr {
    break-inside: avoid;
  }

  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
  }
}

/* ------------------------------------------------------------------ */
/* 17. Phase 4: menu buttons, language switch, help center, tour      */
/* ------------------------------------------------------------------ */
/* Buttons in the Account menu look like its links */
.account-menu button {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: var(--tap);
  padding: var(--sp-2) var(--sp-3);
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--sbs-ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.account-menu button:hover {
  background: var(--sbs-bg);
}

/* A button styled as a text link (footer, sign-in page) */
.link-btn {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.app-footer .link-btn,
.link-btn--light {
  color: var(--sbs-white);
}

.auth-intro__lang {
  margin: var(--sp-4) 0 0;
}

.help-more {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-top: var(--sp-5);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--sbs-line);
}

/* Feedback form */
.slideover__body .field {
  margin-bottom: var(--sp-4);
}

.slideover__body textarea.input-sbs {
  width: 100%;
  min-height: 8rem;
  resize: vertical;
}

/* Help center pages (static/help/) */
.help-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-left: auto;
}

.help-layout {
  display: grid;
  gap: var(--sp-5);
}

.help-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.help-article {
  padding: var(--sp-5);
}

.help-article p,
.help-article li,
.help-article dl {
  max-width: 72ch;
  line-height: var(--lh-body);
}

.help-article .section-title {
  margin-top: var(--sp-5);
}

.help-cards {
  display: grid;
  gap: var(--sp-4);
  margin: var(--sp-5) 0 0;
  padding: 0;
  list-style: none;
}

.help-cards li {
  max-width: none;
}

.help-card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  height: 100%;
  padding: var(--sp-4);
  color: var(--sbs-ink);
  text-decoration: none;
}

.help-card:hover {
  border-color: var(--sbs-navy);
  color: var(--sbs-ink);
  text-decoration: none;
}

/* Linked cards: .card-sbs sets a box-shadow that would otherwise hide the focus ring */
a.card-sbs:focus-visible,
.help-card:focus-visible {
  border-color: var(--sbs-navy);
  box-shadow: var(--focus-ring);
}

.help-card strong {
  font-size: var(--fs-lg);
}

.help-card span {
  color: var(--sbs-muted-text);
}

details.faq {
  max-width: 72ch;
  border-bottom: 1px solid var(--sbs-line);
}

.faq summary {
  display: flex;
  align-items: center;
  min-height: var(--tap);
  padding: var(--sp-2) 0;
  font-weight: 700;
  cursor: pointer;
}

details.faq p {
  margin: 0 0 var(--sp-4);
}

.contact-card {
  display: grid;
  gap: var(--sp-2);
  margin-top: var(--sp-4);
  padding: var(--sp-4);
  border: 1px solid var(--sbs-line);
  border-radius: var(--radius-md);
  background: var(--sbs-bg);
}

.contact-card p {
  margin: 0;
}

@media (min-width: 768px) {
  .help-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 992px) {
  .help-layout {
    grid-template-columns: 240px minmax(0, 1fr);
    align-items: start;
  }

  .help-nav ul {
    flex-direction: column;
  }

  .help-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Walkthrough (coach marks) */
.tour-target {
  position: relative;
  z-index: calc(var(--z-menu) - 1);
  border-radius: var(--radius-md);
  box-shadow: 0 0 0 4px var(--sbs-white), 0 0 0 7px var(--sbs-red);
}

.tour-pop {
  position: fixed;
  right: var(--sp-3);
  bottom: calc(var(--tabbar-h) + var(--sp-3) + env(safe-area-inset-bottom, 0px));
  left: var(--sp-3);
  z-index: var(--z-toast);
  padding: var(--sp-4);
  border-radius: var(--radius-lg);
  background: var(--sbs-navy);
  color: var(--sbs-white);
  box-shadow: var(--shadow-2);
}

.tour-pop__count {
  margin: 0 0 var(--sp-1);
  font-size: var(--fs-sm);
  opacity: 0.85;
}

.tour-pop__title {
  margin: 0 0 var(--sp-2);
  font-size: var(--fs-lg);
  font-weight: 700;
}

.tour-pop p {
  margin: 0 0 var(--sp-3);
}

.tour-pop__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  justify-content: flex-end;
}

.tour-pop .btn-sbs--outline {
  border-color: var(--sbs-white);
  background: transparent;
  color: var(--sbs-white);
}

@media (min-width: 768px) {
  .tour-pop {
    position: absolute;
    right: auto;
    bottom: auto;
    width: 360px;
  }
}

@media print {
  .tour-pop,
  .help-nav,
  .help-more {
    display: none !important;
  }

  .tour-target {
    box-shadow: none;
  }
}

.page-help .m-0 {
  margin: 0;
}

/* ------------------------------------------------------------------ */
/* 18. Public pages (Phase 6): home, products, contact, 404, states   */
/* ------------------------------------------------------------------ */
.public-hero {
  background: var(--sbs-navy);
  color: var(--sbs-white);
}

.public-hero__inner {
  display: grid;
  gap: var(--sp-5);
  align-items: center;
  padding-top: var(--sp-6);
  padding-bottom: var(--sp-6);
}

.public-hero .eyebrow {
  color: var(--sbs-muted-text);
}

.public-hero__title {
  margin: var(--sp-2) 0 var(--sp-3);
  font-size: var(--fs-2xl);
  font-weight: 700;
  line-height: var(--lh-tight);
}

.public-hero__lead {
  max-width: 40rem;
  margin: 0 0 var(--sp-5);
  font-size: var(--fs-lg);
  color: var(--sbs-muted-text);
}

.public-hero__media img {
  display: block;
  width: 100%;
  max-width: 420px;
  height: auto;
  margin: 0 auto;
  border-radius: var(--radius-lg);
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3);
}

.link-on-dark {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  color: var(--sbs-white);
  font-weight: 600;
  text-decoration: underline;
}

.link-on-dark:hover {
  color: var(--sbs-white);
}

.public-section {
  padding: var(--sp-6) 0;
}

.public-section--alt {
  background: var(--sbs-surface);
}

.public-section--dark {
  background: #0f131f;
  color: var(--sbs-white);
}

.public-h2 {
  margin: 0 0 var(--sp-4);
  font-size: var(--fs-xl);
  font-weight: 700;
}

.steps,
.level-cards {
  display: grid;
  gap: var(--sp-4);
  margin: 0;
  padding: 0;
  list-style: none;
}

.step,
.level-cards li {
  padding: var(--sp-4);
}

.step__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--sbs-red);
  color: var(--sbs-white);
  font-weight: 700;
}

.step__title {
  margin: var(--sp-3) 0 var(--sp-2);
  font-size: var(--fs-lg);
  font-weight: 700;
}

.step p,
.level-cards p {
  margin: var(--sp-2) 0 0;
}

.public-split {
  display: grid;
  gap: var(--sp-5);
}

.public-split--top {
  margin-top: var(--sp-5);
  align-items: start;
}

.check-list {
  margin: 0;
  padding-left: var(--sp-5);
  list-style: square;
}

.check-list li {
  margin-bottom: var(--sp-3);
  padding-left: var(--sp-1);
}

.check-list li::marker {
  color: var(--sbs-red);
  font-size: 1.2em;
}

.check-list--questions {
  list-style: disc;
}

.check-list--questions li::marker {
  color: var(--sbs-navy);
}

.alert-flow {
  display: block;
  width: 100%;
  max-width: 760px;
  height: auto;
  margin: 0 0 var(--sp-4);
  border-radius: var(--radius-md);
}

.alert-steps {
  max-width: 44rem;
  margin: 0;
  padding-left: var(--sp-5);
}

.alert-steps li {
  margin-bottom: var(--sp-2);
}

.spec-wrap {
  overflow-x: auto;
  border: 1px solid var(--sbs-line);
  border-radius: var(--radius-md);
  background: var(--sbs-surface);
}

.spec-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
}

.spec-table th,
.spec-table td {
  padding: var(--sp-3);
  border-bottom: 1px solid var(--sbs-line);
  text-align: left;
  vertical-align: top;
}

.spec-table thead th {
  background: var(--sbs-bg);
  font-size: var(--fs-sm);
}

.spec-table tbody th {
  width: 30%;
  color: var(--sbs-muted-text);
  font-weight: 600;
}

@media (max-width: 767.98px) {
  .spec-wrap {
    overflow: visible;
    border: 0;
    background: none;
  }

  .spec-table {
    min-width: 0;
  }

  .spec-table tbody th {
    display: block;
    width: 100%;
    padding: 0 0 var(--sp-1);
    border: 0;
    color: var(--sbs-ink);
    font-weight: 700;
  }

  .spec-table.table-cards td {
    border-bottom: 0;
  }

  .spec-table .spec-list {
    text-align: right;
    list-style-position: inside;
  }
}

.spec-model {
  color: var(--sbs-red);
  font-size: var(--fs-lg);
  font-weight: 700;
}

.spec-list {
  margin: 0;
  padding-left: var(--sp-4);
}

.public-note {
  padding: var(--sp-4);
  border-left: 4px solid var(--sbs-red);
  border-radius: var(--radius-md);
  background: var(--sbs-surface);
  font-weight: 600;
}

.cta-band {
  background: var(--sbs-navy);
  color: var(--sbs-white);
}

.cta-band__inner {
  display: grid;
  gap: var(--sp-4);
  padding-top: var(--sp-6);
  padding-bottom: var(--sp-6);
}

.cta-band p {
  margin: 0;
  color: #e3e6ee;
}

.contact-grid {
  display: grid;
  gap: var(--sp-4);
}

.contact-block {
  padding: var(--sp-5);
}

.contact-address {
  margin: 0 0 var(--sp-3);
  font-style: normal;
}

.contact-lines {
  margin: 0 0 var(--sp-3);
  padding: 0;
  list-style: none;
}

.contact-lines li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
  min-height: var(--tap);
}

.contact-lines__label {
  min-width: 5.5rem;
  color: var(--sbs-muted-text);
  font-size: var(--fs-sm);
}

.contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}

.state-page .state {
  margin-bottom: var(--sp-4);
}

@media (min-width: 768px) {
  .steps,
  .level-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .public-split,
  .contact-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .public-hero__title {
    font-size: var(--fs-3xl);
  }
}

@media (min-width: 992px) {
  .public-hero__inner {
    grid-template-columns: minmax(0, 1fr) 420px;
    padding-top: var(--sp-7);
    padding-bottom: var(--sp-7);
  }

  .cta-band__inner {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }
}

@media print {
  .public-hero,
  .cta-band,
  .public-section--dark {
    background: #ffffff !important;
    color: #000000 !important;
  }
}

/* ------------------------------------------------------------------ */
/* Audit fixes: sample dashboard (/dashboard) and system check (/test) */
/* ------------------------------------------------------------------ */
.sample-dash {
  display: grid;
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
}

.sample-dash__shot {
  margin: 0;
}

.sample-dash__shot figcaption {
  margin-top: var(--sp-2);
}

.sample-dash__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.sample-dash__row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--sp-1) var(--sp-3);
  align-items: center;
  padding: var(--sp-3) 0;
  border-top: 1px solid var(--sbs-line);
}

.sample-dash__row .status-pill {
  justify-self: start;
}

@media (min-width: 576px) {
  .sample-dash__row {
    grid-template-columns: 1fr auto 9rem;
  }

  .sample-dash__row .status-pill {
    justify-self: end;
  }
}

@media (min-width: 992px) {
  .sample-dash {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    align-items: start;
  }
}

.test-list__items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 12rem), 1fr));
  gap: var(--sp-2) var(--sp-4);
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Status with no usable reading: neutral, still labelled in text */
.status-pill--none {
  background: var(--sbs-bg);
  color: var(--sbs-ink);
  border: 1px dashed var(--sbs-control-line);
}

.attention-empty {
  margin: var(--sp-4) 0;
}

/* ================================================================== */
/* v1.1.0: Batch A (location, history, locations list)                 */
/* ================================================================== */

/* Page banners (stale data, offline) */
.banner {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  margin: 0 0 var(--sp-4);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
}

.banner[hidden] {
  display: none;
}

.banner__icon {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  margin-top: 1px;
}

.banner__text {
  margin: 0;
  font-weight: 600;
}

.banner--warn {
  background: var(--warn-bg);
  border-color: #f0d28a;
  color: var(--warn);
}

.banner--offline {
  background: var(--sbs-dark);
  color: var(--sbs-white);
}

.meta-text--quiet {
  font-size: var(--fs-xs);
}

/* "in. w.c." tip */
.tip {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.tip__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25em;
  min-height: var(--tap);
  margin: -10px 0;
  padding: 0 2px;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  cursor: help;
}

.tip__i {
  display: inline-grid;
  place-items: center;
  width: 1.5em;
  height: 1.5em;
  border: 1px solid var(--sbs-control-line);
  border-radius: 50%;
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--sbs-muted-text);
}

.tip__text {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  z-index: var(--z-menu);
  display: none;
  width: max-content;
  max-width: min(280px, 80vw);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-sm);
  background: var(--sbs-dark);
  color: var(--sbs-white);
  font-size: var(--fs-sm);
  font-weight: 400;
  line-height: var(--lh-body);
  white-space: normal;
  text-align: left;
  transform: translateX(-50%);
  box-shadow: var(--shadow-2);
}

.tip.is-open .tip__text {
  display: block;
}

/* Booth card head: status + snapshot button */
.booth-card__head-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-2);
}

.filter-row--empty {
  display: block;
}

/* Call your local office */
.office-block {
  margin-bottom: var(--sp-4);
}

.office-block__line {
  margin: 0;
  font-size: var(--fs-lg);
}

.office-block__phone {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  font-weight: 700;
}

/* TV mode bar: rotation controls + exit */
.tv-bar {
  display: contents;
}

.tv-rotate {
  display: none;
}

body.tv-mode .tv-bar {
  position: fixed;
  top: var(--sp-3);
  right: var(--sp-3);
  z-index: var(--z-toast);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-2);
  max-width: calc(100vw - 2 * var(--sp-3));
}

body.tv-mode .tv-bar .tv-exit {
  position: static;
}

body.tv-mode .tv-rotate:not([hidden]) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--radius-pill);
  background: var(--sbs-dark);
  color: var(--sbs-white);
}

.switch--light input {
  accent-color: var(--sbs-white);
}

.input-sbs--sm {
  min-height: 36px;
  padding: var(--sp-1) var(--sp-2);
  font-size: var(--fs-sm);
}

.tv-rotate__status {
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
}

/* Locations: collapsible state groups */
.group-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: var(--tap);
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: inherit;
  cursor: pointer;
}

.group-toggle::before {
  content: "";
  width: 0.5em;
  height: 0.5em;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  margin-top: -0.2em;
}

.group-toggle[aria-expanded="false"]::before {
  transform: rotate(-45deg);
  margin-top: 0;
}

.loc-card.is-collapsed {
  display: none;
}

/* History: table view and change markers */
.legend__swatch--change {
  border-left: 2px dashed var(--ok);
  background: none !important;
  width: 0 !important;
  height: 14px !important;
}

.table-view {
  margin-top: var(--sp-2);
}

.table-view__wrap {
  margin-top: var(--sp-3);
  max-height: 420px;
  overflow: auto;
}

.table-view__wrap[hidden] {
  display: none;
}

.print-changes ul {
  margin: 4px 0 8px;
  padding-left: 18px;
}

@media print {
  /* Booth snapshot: only the chosen booth, with the report header */
  body.print-booth .summary-strip,
  body.print-booth .next-steps,
  body.print-booth .office-block,
  body.print-booth .banner--offline,
  body.print-booth .booth-card:not(.is-print-target),
  body.print-booth .attention-empty,
  body.print-booth .print-foot {
    display: none !important;
  }

  .booth-print,
  .tv-bar,
  .tip__i,
  .tip__text,
  .table-view > button,
  .office-block {
    display: none !important;
  }

  .tip__btn {
    min-height: 0;
    margin: 0;
  }

  /* Audit report: single clean column */
  .page-history .insights {
    grid-template-columns: 1fr 1fr 1fr;
  }

  .page-history .table-view__wrap {
    display: none !important;
  }

  .page-history .readings {
    display: block;
  }

  .page-history .readings__scroll {
    max-height: none;
    overflow: visible;
  }

  .page-board .booth-list,
  .page-history .page-section {
    display: block;
  }

  .page-board .booth-card {
    break-inside: avoid;
    margin-bottom: 10px;
  }

  .tabbar,
  .skip-link,
  .app-nav,
  .header-actions {
    display: none !important;
  }
}

.booth-card__head {
  flex-wrap: wrap;
}

.booth-card__title-wrap {
  flex: 1 1 10rem;
}

@media (max-width: 575.98px) {
  .booth-card__head-actions {
    flex: 1 1 100%;
    justify-content: space-between;
  }
}

/* ================================================================== */
/* v1.1.0: Batch B (admin forms, paging, intro dashboard)             */
/* ================================================================== */
.admin-form .form_description {
  margin-bottom: var(--sp-4);
}

.admin-form-card--wide {
  max-width: 1080px;
}

.form-section {
  min-width: 0;
  margin: 0 0 var(--sp-4);
  padding: var(--sp-4);
  border: 1px solid var(--sbs-line);
  border-radius: var(--radius-md);
}

.form-section:focus-within {
  border-color: var(--sbs-control-line);
}

.form-section__title {
  float: left; /* keeps the legend inside the rounded box */
  width: 100%;
  margin: 0 0 var(--sp-3);
  padding: 0;
  font-size: var(--fs-lg);
  font-weight: 700;
}

.form-section__title + * {
  clear: left;
}

.form-section--muted {
  background: var(--sbs-bg);
}

.form-section .field:last-child {
  margin-bottom: 0;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 0 var(--sp-4);
}

.req {
  color: var(--bad);
}

.input-sbs--short {
  max-width: 12rem;
}

.input-sbs:disabled {
  border-color: var(--sbs-line);
  background: var(--sbs-bg);
  color: var(--sbs-muted-text);
}

textarea.input-sbs {
  min-height: 10rem;
  resize: vertical;
}

.field--invalid .input-sbs,
.admin-form .input-sbs[aria-invalid="true"] {
  border-color: var(--bad);
  box-shadow: 0 0 0 1px var(--bad);
}

.field__error[hidden] {
  display: none;
}

.access-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: var(--sp-1) var(--sp-4);
}

.check {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: var(--tap);
}

.page-admin-form .check input[type="checkbox"] {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  accent-color: var(--sbs-navy);
}

.page-admin-form .check label {
  margin: 0;
  font-weight: 400;
  color: var(--sbs-ink);
}

.form-actions {
  justify-content: flex-start;
  margin-top: var(--sp-5);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--sbs-line);
}

.form-actions .admin-actions__note {
  flex: 1 1 100%;
}

/* range_formv2: Bootstrap row/cols kept for the existing classes, laid out by the grid instead */
.page-admin-form .admin-form .row.field-grid {
  display: grid;
  margin: 0;
}

.page-admin-form .admin-form .row.field-grid > [class*="col-"] {
  max-width: none;
  padding: 0;
}

.range-table-wrap {
  overflow-x: auto;
}

.page-admin-form .range-table .field {
  margin: 0;
}

.page-admin-form .range-table .field__label {
  margin: 0 0 var(--sp-1);
}

.page-admin-form .range-row__id {
  width: 0;
  padding: 0 !important;
}

.page-admin-form .range-table tr.range-row + tr.range-row td {
  border-top: 1px solid var(--sbs-line);
}

/* Admin table paging */
.admin-table tr[data-off-page] {
  display: none !important;
}

.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2) var(--sp-4);
  margin-top: var(--sp-3);
}

.pager__size {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  margin: 0;
  font-size: var(--fs-sm);
  font-weight: 600;
}

.pager__size .input-sbs {
  width: auto;
  min-height: var(--tap);
}

.pager__info {
  font-size: var(--fs-sm);
  color: var(--sbs-muted-text);
  font-variant-numeric: tabular-nums;
}

.pager__btns {
  display: inline-flex;
  gap: var(--sp-2);
  margin-left: auto;
}

.pager__btns[hidden] {
  display: none;
}

.pager .btn-sbs:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Admin intro dashboard */
.admin-dash {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: var(--sp-3);
  margin: 0 0 var(--sp-5);
  padding: 0;
  list-style: none;
}

.admin-dash__tile {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-4);
  border: 1px solid var(--sbs-line);
  border-radius: var(--radius-md);
  background: var(--sbs-bg);
}

.admin-dash__count {
  display: flex;
  flex-direction: column;
  min-height: var(--tap);
  color: var(--sbs-ink);
  text-decoration: none;
}

.admin-dash__count .num {
  font-size: var(--fs-2xl);
  font-weight: 700;
  line-height: 1.1;
}

.admin-dash__label {
  font-weight: 600;
  color: var(--sbs-muted-text);
}

.admin-dash__count:hover .admin-dash__label,
.admin-dash__count:focus-visible .admin-dash__label {
  text-decoration: underline;
}

.admin-dash__tile .btn-sbs {
  align-self: flex-start;
}

/* Admin row actions: full-size tap targets */
.admin-edit .btn-sbs {
  min-height: var(--tap);
  min-width: var(--tap);
}

.field > .field__hint,
.field > .field__error,
.field > .admin-warning,
.form-section > .field__hint {
  margin: 0;
}

.form-section > .field__hint {
  margin-bottom: var(--sp-3);
}

@media (min-width: 768px) {
  .page-admin-form .range-table td.field {
    display: table-cell;
    padding: var(--sp-2) var(--sp-2) var(--sp-2) 0;
    vertical-align: bottom;
  }

  .page-admin-form .range-table td.field > .field__label {
    display: block;
  }
}

.page-admin-form .range-table {
  table-layout: auto;
  width: 100%;
}

.page-admin-form .range-table td.field {
  flex: none;
  max-width: none;
}

@media (min-width: 768px) {
  .page-admin-form .range-table td.col-1 { width: 8.5rem; }
  .page-admin-form .range-table td.col-2 { width: 10rem; }
  .page-admin-form .range-table td.col-5 { width: auto; }
  .page-admin-form .range-table td .input-sbs { min-width: 0; width: 100%; }
}

/* ================================================================== */
/* v1.1.0: Batch C (tap targets, offline, help additions)             */
/* ================================================================== */
/* 44 x 44 px minimum for everything people tap */
.sort-btn,
.input-sbs--sm {
  min-height: var(--tap);
}

.filter-row__actions .btn-sbs,
.chart-card .chip,
.admin-edit .btn-sbs,
.pager .btn-sbs,
.booth-print {
  min-height: var(--tap);
  min-width: var(--tap);
}

/* Links inside footer text are underlined, not told apart by colour alone (WCAG 1.4.1) */
.app-footer p a {
  text-decoration: underline;
}

/* Add to home screen help page */
.a2hs-steps {
  display: grid;
  gap: var(--sp-4);
  margin: var(--sp-4) 0;
}

@media (min-width: 768px) {
  .a2hs-steps {
    grid-template-columns: 1fr 1fr;
  }
}

.a2hs-steps ol {
  margin: 0;
  padding-left: 1.25rem;
}

.a2hs-steps li {
  margin-bottom: var(--sp-2);
}

.a2hs-icon {
  display: inline-block;
  width: 1.2em;
  height: 1.2em;
  vertical-align: -0.2em;
  color: var(--sbs-navy);
}

/* ================================================================== */
/* v1.1.0: Batch D (public pages, help pages, version)                */
/* ================================================================== */
.footer-version {
  flex: 1 1 100%;
  margin: var(--sp-2) 0 0;
  font-size: var(--fs-xs);
  opacity: 0.85;
}

.footer-version a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  color: inherit;
}

/* Customer story */
.story-band {
  padding: var(--sp-6) 0;
}

.story {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-5);
  margin: 0;
  padding: var(--sp-5);
}

.story__photo {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: var(--radius-lg);
}

.story > div {
  flex: 1 1 18rem;
}

.story__quote {
  margin: 0 0 var(--sp-3);
  font-size: var(--fs-xl);
  line-height: 1.4;
}

.story__quote p {
  margin: 0;
}

.story__quote p::before {
  content: "\201C";
}

.story__quote p::after {
  content: "\201D";
}

.story__who {
  font-weight: 700;
  color: var(--sbs-muted-text);
}

/* Product specs */
.spec-card {
  overflow-x: auto;
  margin-bottom: var(--sp-4);
}

.spec-table th[scope="row"] {
  font-weight: 600;
  text-align: left;
}

.contact-hours {
  margin: var(--sp-3) 0 0;
}

/* Help: chart guide and alert steps */
.chart-guide {
  margin: var(--sp-4) 0;
  padding: var(--sp-3);
  border: 1px solid var(--sbs-line);
  border-radius: var(--radius-md);
  background: var(--sbs-surface);
}

.chart-guide__svg {
  display: block;
  width: 100%;
  height: auto;
  font-family: var(--font-sans);
}

.chart-guide figcaption {
  margin-top: var(--sp-2);
}

.chart-guide__list {
  counter-reset: guide;
  padding-left: 0;
  list-style: none;
}

.chart-guide__list li {
  position: relative;
  margin-bottom: var(--sp-3);
  padding-left: 2.5rem;
}

.chart-guide__list li::before {
  counter-increment: guide;
  content: counter(guide);
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: var(--sbs-red);
  color: var(--sbs-white);
  font-weight: 700;
  font-size: var(--fs-sm);
}

.step-guide {
  margin: var(--sp-4) 0;
  padding: 0;
  list-style: none;
}

.step-guide__item {
  display: flex;
  gap: var(--sp-4);
  align-items: flex-start;
  padding: var(--sp-4) 0;
  border-bottom: 1px solid var(--sbs-line);
}

.step-guide__item:last-child {
  border-bottom: 0;
}

.step-guide__icon {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
}

.step-guide__title {
  margin: 0 0 var(--sp-1);
  font-size: var(--fs-lg);
  font-weight: 700;
}

.step-guide__item p {
  margin: 0;
}


/* ================================================================== */
/* 16. v1.2.0: touch, pressed states, motion, type floor               */
/* ================================================================== */
html {
  -webkit-tap-highlight-color: rgba(28, 34, 40, 0.12);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

a,
button,
summary,
label,
select,
input,
textarea,
[role="button"],
[role="tab"] {
  touch-action: manipulation; /* no double-tap zoom delay on taps */
}

/* Pressed feedback for everything tappable (hover is never the only cue) */
.btn-sbs:active,
.chip:active,
.admin-tab:active,
.tabbar__item:active,
.appbar__btn:active,
.sheet__item:active,
.pin-btn:active {
  transform: scale(0.97);
  filter: brightness(0.95);
}

.btn-sbs,
.chip,
.admin-tab,
.tabbar__item,
.appbar__btn,
.sheet__item {
  transition: transform 80ms ease, filter 80ms ease, background-color var(--dur) ease, color var(--dur) ease;
}

.loc-card:active,
.filter-row:active,
.app-list__item:active {
  background-color: var(--app-surface-2);
}

/* Phones: inputs at 16px+ so iOS never zooms in on focus */
@media (max-width: 767.98px) {
  .input-sbs,
  input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]),
  select,
  textarea {
    font-size: max(16px, 1rem);
  }

  /* Larger checkboxes and radios (24px; their labels make the 44px target) */
  input[type="checkbox"],
  input[type="radio"] {
    width: 24px;
    height: 24px;
  }

  /* Footer and contact links get a full 44px row */
  .footer-links a,
  .footer-links .link-btn,
  .footer-version a,
  .contact-lines a {
    display: inline-flex;
    align-items: center;
    min-height: var(--tap);
  }

  .footer-links {
    gap: 0 var(--sp-4);
  }
}

/* Scroll areas don't drag the whole page (or trigger pull-to-refresh) at their ends */
.admin-table-wrap,
.range-table-wrap,
.readings__scroll,
.table-view__wrap,
.chip-group,
.admin-tabs,
.sheet__body {
  overscroll-behavior: contain;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .btn-sbs:active,
  .chip:active,
  .admin-tab:active,
  .tabbar__item:active,
  .appbar__btn:active,
  .sheet__item:active,
  .pin-btn:active {
    transform: none;
  }
}

/* ================================================================== */
/* 17. v1.2.0 app shell (signed-in pages on phones)                    */
/*     Desktop (768px+) keeps the v1.1.0 header, nav and footer.       */
/* ================================================================== */
.appbar,
.sheet {
  display: none;
}

/* Thin progress bar while the next page loads (link tapped) */
.nav-progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: calc(var(--z-toast) + 1);
  width: 100%;
  height: 3px;
  background: var(--sbs-red);
  transform: scaleX(0);
  transform-origin: 0 50%;
  opacity: 0;
  pointer-events: none;
}

body.is-leaving .nav-progress {
  opacity: 1;
  animation: nav-progress 2.4s cubic-bezier(0.1, 0.7, 0.3, 1) forwards;
}

@keyframes nav-progress {
  from { transform: scaleX(0.05); }
  to { transform: scaleX(0.9); }
}

body.is-leaving .app-main {
  opacity: 0.55;
  transition: opacity 200ms ease 120ms;
}

@media (max-width: 767.98px) {
  body.has-tabbar {
    min-height: var(--app-vh);
    padding-top: calc(var(--appbar-h) + var(--safe-top));
    padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom));
    background: var(--app-bg);
    color: var(--app-ink);
  }

  /* No marketing chrome inside the app on phones: the app bar, tab bar and Account sheet replace it */
  body.has-tabbar .topstrip,
  body.has-tabbar .app-header,
  body.has-tabbar .app-footer,
  body.has-tabbar .crumbs {
    display: none;
  }

  body.has-tabbar .page-section {
    padding-top: var(--sp-4);
  }

  /* Pages fade in lightly (skipped with reduced motion) */
  body.has-tabbar .app-main {
    animation: app-in 180ms ease-out both;
  }

  .appbar {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: var(--z-header);
    display: flex;
    align-items: center;
    gap: var(--sp-1);
    height: calc(var(--appbar-h) + var(--safe-top));
    padding: var(--safe-top) calc(var(--sp-1) + var(--safe-right)) 0 calc(var(--sp-1) + var(--safe-left));
    border-bottom: 1px solid var(--app-line);
    background: var(--app-surface);
    color: var(--app-ink);
  }

  .appbar__title {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    padding: 0 var(--sp-2);
    overflow: hidden;
    font-size: var(--fs-lg);
    font-weight: 700;
    line-height: var(--lh-tight);
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .appbar__btn {
    display: inline-grid;
    flex: 0 0 auto;
    place-items: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    cursor: pointer;
  }

  .appbar__btn svg {
    width: 26px;
    height: 26px;
  }

  .appbar__btn:hover,
  .appbar__btn:active {
    background: var(--app-press);
    text-decoration: none;
  }

  .appbar__back[href=""] {
    display: none;
  }

  /* Title starts at the edge when there's no back arrow */
  .appbar__back[href=""] + .appbar__title {
    padding-left: var(--sp-3);
  }

  /* Bottom tab bar: 4 tabs, labels 13px, 48px+ targets, above the home indicator */
  .tabbar {
    padding: 0 var(--safe-right) var(--safe-bottom) var(--safe-left);
    border-top-color: var(--app-line);
    background: var(--app-surface);
  }

  .tabbar__item {
    position: relative;
    min-width: 48px;
    color: var(--app-muted);
    font-size: var(--fs-xs);
  }

  .tabbar__item[aria-current="page"] {
    color: var(--app-ink);
  }

  .tabbar__item[aria-current="page"]::before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    width: 32px;
    height: 3px;
    border-radius: 0 0 3px 3px;
    background: var(--sbs-red);
    transform: translateX(-50%);
  }

  .tabbar__icon {
    position: relative;
    display: inline-flex;
  }

  .tabbar__badge {
    position: absolute;
    top: -6px;
    left: 14px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border: 2px solid var(--app-surface);
    border-radius: 10px;
    background: var(--bad);
    color: #fff;
    font-size: var(--fs-xs);
    font-weight: 700;
    line-height: 16px;
    text-align: center;
  }

  .tabbar__badge--warn {
    background: var(--warn);
  }

  /* Account menu becomes a bottom sheet with full-width rows */
  .tabbar .account-menu.account-sheet {
    position: fixed;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: var(--z-menu);
    max-width: none;
    max-height: calc(var(--app-vh) - var(--safe-top) - var(--sp-6));
    padding: var(--sp-3) calc(var(--sp-3) + var(--safe-right)) calc(var(--sp-4) + var(--safe-bottom)) calc(var(--sp-3) + var(--safe-left));
    overflow-y: auto;
    overscroll-behavior: contain;
    border: 0;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    background: var(--app-surface);
    color: var(--app-ink);
    box-shadow: 0 0 0 100vmax rgba(15, 19, 23, 0.45), var(--shadow-2);
    animation: sheet-up 200ms ease-out both;
  }

  .account-sheet a,
  .account-sheet button {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 52px;
    padding: var(--sp-2) var(--sp-3);
    border-radius: var(--radius-md);
    color: var(--app-ink);
    font-size: var(--fs-md);
    text-align: left;
  }

  .account-sheet a:hover,
  .account-sheet button:hover {
    background: transparent;
  }

  .account-sheet a:active,
  .account-sheet button:active {
    background: var(--app-press);
  }

  .account-sheet .account-menu__who {
    color: var(--app-muted);
  }

  .account-sheet a[href="/logout/"] {
    margin-top: var(--sp-2);
    border-top: 1px solid var(--app-line);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    color: var(--bad);
    font-weight: 700;
  }

  /* Generic bottom sheet (page actions) */
  .sheet:not([hidden]) {
    position: fixed;
    inset: 0;
    z-index: var(--z-menu);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    background: rgba(15, 19, 23, 0.45);
  }

  .sheet__panel {
    max-height: calc(var(--app-vh) - var(--safe-top) - var(--sp-6));
    padding: 0 calc(var(--sp-4) + var(--safe-right)) calc(var(--sp-4) + var(--safe-bottom)) calc(var(--sp-4) + var(--safe-left));
    overflow-y: auto;
    overscroll-behavior: contain;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    background: var(--app-surface);
    color: var(--app-ink);
    box-shadow: var(--shadow-2);
    animation: sheet-up 200ms ease-out both;
  }

  .sheet__head {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    padding-top: var(--sp-3);
    background: inherit;
  }

  .sheet__grip {
    position: absolute;
    top: 6px;
    left: 50%;
    width: 40px;
    height: 4px;
    border-radius: 2px;
    background: var(--app-line);
    transform: translateX(-50%);
  }

  .sheet__title {
    flex: 1 1 auto;
    margin: 0;
    font-size: var(--fs-lg);
    font-weight: 700;
  }

  .sheet__close {
    width: 48px;
    height: 48px;
    border: 0;
    border-radius: 50%;
    background: var(--app-surface-2);
    color: inherit;
    font-size: 1.75rem;
    line-height: 1;
  }

  .sheet__body {
    display: grid;
    gap: var(--sp-2);
    padding-top: var(--sp-3);
  }

  /* Anything moved into the sheet: full-width rows */
  .sheet__body > *,
  .sheet__body .toolbar__actions,
  .sheet__body .chip-group {
    width: 100%;
  }

  .sheet__body .btn-sbs,
  .sheet__item {
    display: flex;
    justify-content: flex-start;
    width: 100%;
    min-height: 52px;
  }

  .sheet__body .toolbar__actions {
    display: grid;
    gap: var(--sp-2);
  }

  .sheet__body .toolbar__field {
    display: grid;
    gap: var(--sp-1);
  }

  .sheet__body .toolbar__field .input-sbs {
    width: 100%;
  }

  .sheet__body .switch {
    min-height: 52px;
  }
}

@keyframes app-in {
  from { opacity: 0.4; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

@keyframes sheet-up {
  from { transform: translateY(24px); opacity: 0.6; }
  to { transform: none; opacity: 1; }
}

html.has-sheet,
html.has-sheet body {
  overflow: hidden;
}

/* Page actions live in the app bar's "..." sheet on phones; in place on desktop */
@media (max-width: 767.98px) {
  body.has-tabbar [data-app-action] {
    display: none;
  }

  body.has-tabbar .sheet__body > [data-app-action] {
    display: grid;
  }
}

/* ================================================================== */
/* 18. v1.2.0 Locations: status on cards, Alerts and History views     */
/* ================================================================== */
.loc-card__body {
  flex: 1 1 auto;
  min-width: 0;
}

.loc-card__chev {
  display: none;
}

.loc-card__slot:not([hidden]) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-1) var(--sp-2);
  margin-top: var(--sp-2);
}

.loc-card__counts {
  font-size: var(--fs-sm);
  font-weight: 600;
}

.loc-card__asof {
  flex-basis: 100%;
  color: var(--sbs-muted-text);
  font-size: var(--fs-xs);
}

/* Worst status shown on the card edge too (with the pill's text, never color alone) */
.loc-card[data-level="bad"] {
  box-shadow: inset 4px 0 0 var(--bad-bar), var(--shadow-1);
}

.loc-card[data-level="warn"] {
  box-shadow: inset 4px 0 0 var(--warn-bar), var(--shadow-1);
}

.loc-status-note {
  margin: 0 0 var(--sp-3);
}

/* Loading placeholders */
.skeleton {
  display: inline-block;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--sbs-line) 0%, var(--sbs-bg) 50%, var(--sbs-line) 100%);
  background-size: 200% 100%;
  animation: skeleton 1.2s ease-in-out infinite;
}

.skeleton--pill {
  width: 140px;
  height: 26px;
}

@keyframes skeleton {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}

/* Alerts / History lists */
.app-view .page-head {
  align-items: center;
}

.app-view .page-title:focus {
  outline: none;
}

.app-list {
  display: grid;
  gap: var(--sp-3);
  margin-top: var(--sp-3);
}

.app-group {
  padding: 0;
  overflow: hidden;
}

.app-group__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-1) var(--sp-3);
  min-height: 52px;
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--sbs-line);
  color: var(--sbs-ink);
  text-decoration: none;
}

.app-group__head:hover {
  text-decoration: none;
}

.app-group__title {
  margin: 0;
  font-size: var(--fs-lg);
  font-weight: 700;
}

.app-list__items {
  margin: 0;
  padding: 0;
  list-style: none;
}

.app-list__items > li + li {
  border-top: 1px solid var(--sbs-line);
}

.app-list__item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "main value" "main pill";
  align-items: center;
  gap: var(--sp-1) var(--sp-3);
  min-height: 64px;
  padding: var(--sp-3) var(--sp-4);
  color: var(--sbs-ink);
  text-decoration: none;
}

a.app-list__item:hover {
  background: var(--sbs-bg);
  text-decoration: none;
}

.app-list__main {
  grid-area: main;
  display: grid;
  gap: 2px;
  min-width: 0;
}

.app-list__title {
  font-size: var(--fs-md);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.app-list__sub,
.app-list__when {
  color: var(--sbs-muted-text);
  font-size: var(--fs-sm);
  overflow-wrap: anywhere;
}

.app-list__when {
  font-size: var(--fs-xs);
}

.app-list__value {
  grid-area: value;
  justify-self: end;
  font-size: var(--fs-xl);
  font-weight: 700;
}

.app-list__item .status-pill {
  grid-area: pill;
  justify-self: end;
}

@media (max-width: 767.98px) {
  /* One big card per location; the whole card opens it */
  .loc-grid {
    gap: var(--sp-3);
  }

  .loc-card {
    align-items: center;
    min-height: 88px;
    padding: var(--sp-4);
    border-radius: var(--radius-lg);
  }

  .loc-card__icon {
    display: none;
  }

  .loc-card__street {
    display: none;
  }

  .loc-card__name {
    font-size: 1.1875rem;
  }

  .loc-card__chev {
    display: block;
    flex: none;
    order: 3;
    width: 24px;
    height: 24px;
    color: var(--sbs-muted-text);
  }

  .loc-card .pin-btn {
    order: 2;
    align-self: flex-start;
    margin: calc(-1 * var(--sp-2)) 0 0;
  }

  .loc-toolbar .toolbar__search {
    flex: 1 1 100%;
  }

  body.has-tabbar [data-view-main] > .page-head .eyebrow,
  body.has-tabbar .app-view .page-head .eyebrow {
    display: none;
  }
}

/* ================================================================== */
/* 19. v1.2.0 install card and pull to refresh                         */
/* ================================================================== */
.install-card {
  position: fixed;
  right: calc(var(--sp-3) + var(--safe-right));
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + var(--sp-3));
  left: calc(var(--sp-3) + var(--safe-left));
  z-index: var(--z-toast);
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-4);
  border: 1px solid var(--sbs-line);
  border-radius: var(--radius-lg);
  background: var(--sbs-surface);
  color: var(--sbs-ink);
  box-shadow: var(--shadow-2);
  animation: sheet-up 220ms ease-out both;
}

.install-card__icon {
  flex: none;
  border-radius: var(--radius-md);
}

.install-card__body {
  flex: 1 1 auto;
  min-width: 0;
}

.install-card__title {
  margin: 0;
  font-weight: 700;
}

.install-card__text {
  margin: var(--sp-1) 0 var(--sp-3);
  color: var(--sbs-muted-text);
  font-size: var(--fs-sm);
}

.install-card__glyph {
  width: 18px;
  height: 18px;
  vertical-align: -3px;
  color: #0a84ff;
}

.install-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

@media (min-width: 768px) {
  .install-card {
    display: none;
  }
}

.ptr {
  position: fixed;
  top: calc(var(--appbar-h) + var(--safe-top) - 36px);
  left: 50%;
  z-index: var(--z-header);
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--sbs-surface);
  color: var(--sbs-muted-text);
  box-shadow: var(--shadow-2);
  opacity: 0;
  transform: translate(-50%, 0);
  pointer-events: none;
}

.ptr svg {
  width: 22px;
  height: 22px;
}

.ptr.is-ready {
  color: var(--sbs-red);
}

.ptr.is-loading svg {
  animation: ptr-spin 0.8s linear infinite;
}

@keyframes ptr-spin {
  to { transform: rotate(360deg); }
}

/* ================================================================== */
/* 20. v1.2.0 location page: collapsible booths, filter tiles          */
/* ================================================================== */
.booth-toggle {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: var(--tap);
  height: var(--tap);
  margin-left: auto;
  padding: 0;
  border: 1px solid var(--sbs-control-line);
  border-radius: 50%;
  background: var(--sbs-surface);
  color: var(--sbs-ink);
  cursor: pointer;
}

.booth-toggle svg {
  width: 24px;
  height: 24px;
  transition: transform var(--dur) ease;
}

.booth-toggle[aria-expanded="false"] svg {
  transform: rotate(-90deg);
}

.booth-card__title-wrap {
  cursor: pointer;
}

.booth-card.is-collapsed .filter-list,
.booth-card.is-collapsed .booth-card__power {
  display: none;
}

.filter-row__chev {
  display: none;
}

@media print {
  .booth-toggle {
    display: none !important;
  }

  .booth-card.is-collapsed .filter-list {
    display: block !important;
  }
}

@media (max-width: 767.98px) {
  /* Compact hero: the name is also in the app bar; actions in one swipeable row */
  .board-hero {
    gap: var(--sp-3);
    padding: var(--sp-4);
  }

  .board-hero .hero__title {
    font-size: var(--fs-xl);
  }

  .board-hero .hero__hint {
    display: none;
  }

  /* Booth cards */
  .booth-card {
    padding: var(--sp-4);
  }

  .booth-card__head {
    align-items: center;
  }

  .booth-card__title-wrap {
    flex: 1 1 auto;
    min-width: 0;
  }

  .booth-card__title {
    font-size: var(--fs-lg);
  }

  .booth-card__head-actions {
    flex-wrap: nowrap;
  }

  .booth-card__head-actions .booth-print {
    min-height: 40px;
    padding-inline: var(--sp-3);
    font-size: var(--fs-xs);
  }

  /* Each filter: one big tile; tap anywhere to open its history */
  .filter-row {
    position: relative;
    grid-template-columns: minmax(0, 1fr) auto 20px;
    grid-template-areas:
      "name status chev"
      "reading actions chev"
      "bar bar chev";
    align-items: center;
    gap: var(--sp-1) var(--sp-3);
    margin: 0 calc(-1 * var(--sp-2));
    padding: var(--sp-3) var(--sp-2);
    border-radius: var(--radius-md);
  }

  .filter-row__label {
    font-size: var(--fs-md);
  }

  .filter-row .reading {
    font-size: 1.625rem;
    line-height: 1.1;
    white-space: nowrap;
  }

  .filter-row .reading .tip__btn {
    white-space: nowrap;
  }

  .filter-row .status-orig {
    display: none;
  }

  .filter-row__chev {
    grid-area: chev;
    display: block;
    align-self: center;
    width: 20px;
    height: 20px;
    color: var(--sbs-muted-text);
  }

  .filter-row__history {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: auto;
    min-height: 0;
    border: 0;
    border-radius: var(--radius-md);
    background: transparent;
    color: transparent;
    overflow: hidden;
  }

  .filter-row__history:hover,
  .filter-row__history:active {
    background: transparent;
    color: transparent;
  }

  .filter-row .tip,
  .filter-row [data-order-link] {
    position: relative;
    z-index: 2;
  }

  .filter-row__actions {
    justify-content: flex-end;
  }

  /* Booth header: name + collapse button on one line, status and snapshot below */
  .booth-card__head {
    flex-wrap: wrap;
  }

  .booth-card__head .booth-toggle {
    order: 2;
  }

  .booth-card__head-actions {
    order: 3;
    flex: 1 1 100%;
    justify-content: space-between;
  }

  .filter-row [data-order-link] {
    min-height: 40px;
    padding-inline: var(--sp-3);
  }

  .level-bar__label {
    font-size: var(--fs-xs);
  }
}

/* Swipeable rows contain their own screen-reader-only labels (no page-wide sideways scroll) */
.board-hero__actions,
.chip-group,
.admin-tabs,
.history-hero__actions,
.insights {
  position: relative;
}

@media (max-width: 359.98px) {
  .filter-row .reading {
    font-size: 1.375rem;
  }
}

/* ================================================================== */
/* 21. v1.2.0 history page                                             */
/* ================================================================== */
/* Range buttons as one segmented control */
.chip-group.seg {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--sbs-line);
  border-radius: var(--radius-pill);
  background: var(--sbs-bg);
}

.chip-group.seg .chip {
  flex: 1 1 0;
  justify-content: center;
  min-width: 0;
  border-color: transparent;
  background: transparent;
  color: var(--sbs-ink);
  white-space: nowrap;
}

.chip-group.seg .chip[aria-pressed="true"] {
  border-color: var(--sbs-line);
  background: var(--sbs-surface);
  color: var(--sbs-ink);
  box-shadow: var(--shadow-1);
}


@media (max-width: 767.98px) {
  .history-hero {
    padding: var(--sp-4);
  }

  .history-hero .hero__title {
    font-size: var(--fs-xl);
  }

  .chart-card {
    padding: var(--sp-4) var(--sp-3);
  }

  .chart-card__head {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .chip-group.seg {
    display: flex;
    width: 100%;
  }

  .chip-group.seg .chip {
    padding-inline: var(--sp-2);
  }

  .chart-wrap {
    height: 290px;
  }

  .chart-legend {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-1) var(--sp-3);
    font-size: var(--fs-xs);
  }

  /* Readings stay a compact table (not 90 stacked cards) and scroll in their own box */
  .readings .readings__scroll,
  .table-view__wrap {
    max-height: 60vh;
    overflow: auto;
    border: 1px solid var(--sbs-line);
    border-radius: var(--radius-md);
  }

  .readings .table-cards,
  .table-view .table-cards {
    display: table;
  }

  .readings .table-cards thead,
  .table-view .table-cards thead {
    position: sticky;
    top: 0;
    z-index: 1;
    display: table-header-group;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
    background: var(--sbs-surface);
  }

  .readings .table-cards tbody,
  .table-view .table-cards tbody {
    display: table-row-group;
  }

  .readings .table-cards tr,
  .table-view .table-cards tr {
    display: table-row;
    margin: 0;
    padding: 0;
    border: 0;
  }

  .readings .table-cards th,
  .readings .table-cards td,
  .table-view .table-cards th,
  .table-view .table-cards td {
    display: table-cell;
    width: auto;
    padding: var(--sp-2);
    border-bottom: 1px solid var(--sbs-line);
    font-size: var(--fs-sm);
    vertical-align: middle;
  }

  .readings .table-cards td[data-label]::before,
  .table-view .table-cards td[data-label]::before {
    content: none;
  }

  .readings .table-cards .unit {
    display: none; /* the column heading carries the unit */
  }
}

/* Phone on its side: the chart gets the whole screen */
@media (orientation: landscape) and (max-height: 500px) {
  body.page-history .topstrip,
  body.page-history .app-header {
    display: none;
  }

  body.page-history .chart-wrap {
    height: calc(var(--app-vh) - 84px);
    min-height: 220px;
  }

  body.page-history .chart-card {
    padding: var(--sp-2) var(--sp-3);
    scroll-margin-top: 0;
  }

  body.page-history .chart-card__head {
    margin-bottom: var(--sp-1);
  }

  body.page-history .chart-card .section-title {
    margin: 0;
    font-size: var(--fs-md);
  }

  body.page-history .chart-legend {
    display: none; /* the bands are labelled on the chart itself */
  }
}

/* ================================================================== */
/* 22. v1.2.0 forms on phones                                          */
/* ================================================================== */
@media (max-width: 767.98px) {
  .auth-submit,
  .auth-form .btn-sbs--primary {
    width: 100%;
    min-height: 52px;
  }

  /* While the on-screen keyboard is open: no fixed bars over the field being typed in */
  body.kb-open .tabbar,
  body.kb-open .history-hero__actions,
  body.kb-open .install-card {
    display: none;
  }
}

/* ================================================================== */
/* 23. v1.2.0 admin on phones                                          */
/* ================================================================== */
.row-more {
  display: none;
}

@media (max-width: 767.98px) {
  /* Cards: title line, key fields two to a row, "..." for actions; tap the card to edit */
  .admin-table.table-cards tr {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: var(--sp-2) var(--sp-3);
    padding: var(--sp-3) var(--sp-4);
  }

  .admin-table.table-cards td {
    display: block;
    min-width: 0;
    padding: 0;
    overflow-wrap: anywhere;
  }

  .admin-table.table-cards td[data-label]::before {
    display: block;
    margin-bottom: 2px;
    font-size: var(--fs-xs);
    font-weight: 600;
  }

  .admin-table.table-cards td:empty {
    display: none;
  }

  /* The first field is the card title */
  .admin-table.table-cards td.admin-edit + td {
    grid-column: 1 / -1;
    padding-right: 52px;
    font-size: var(--fs-lg);
    font-weight: 700;
  }

  .admin-table.table-cards td.admin-edit + td::before {
    display: none;
  }

  .admin-table.table-cards td.admin-edit {
    position: static;
    width: auto;
    padding: 0;
  }

  /* The Edit link covers the whole card */
  .admin-table.table-cards td.admin-edit .btn-sbs {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: auto;
    min-height: 0;
    border: 0;
    border-radius: var(--radius-lg);
    background: transparent;
    color: transparent;
    overflow: hidden;
  }

  .admin-table.table-cards td.admin-edit .btn-sbs:active {
    background: var(--app-press);
  }

  .row-more {
    position: absolute;
    top: var(--sp-1);
    right: var(--sp-1);
    z-index: 2;
    display: inline-grid;
    place-items: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--sbs-ink);
  }

  .row-more:active {
    background: var(--app-press);
  }

  .row-more svg {
    width: 24px;
    height: 24px;
  }

  /* Links and badges inside a card stay tappable above the card link */
  .admin-table.table-cards td a:not(.btn-sbs),
  .admin-table.table-cards td button:not(.row-more) {
    position: relative;
    z-index: 2;
  }

  /* Paging: big thumb-friendly controls */
  .pager {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-2);
  }

  .pager__info {
    grid-column: 1 / -1;
    order: -1;
    text-align: center;
  }

  .pager__size {
    grid-column: 1 / -1;
    justify-content: space-between;
  }

  .pager__btns {
    display: contents;
  }

  .pager__btns .btn-sbs {
    width: 100%;
    min-height: 48px;
  }

  .pager__size .input-sbs {
    font-size: 16px;
  }
}

@media (max-width: 767.98px) {
  .admin-table.table-cards .badge-flag {
    max-width: 100%;
    white-space: normal;
  }
}

/* ================================================================== */
/* 24. v1.2.0 public pages on phones                                   */
/* ================================================================== */
.cta-bar {
  display: none;
}

@media (max-width: 767.98px) {
  /* Sticky Call + Book a demo (signed out, marketing pages only) */
  .cta-bar {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: var(--z-tabbar);
    display: grid;
    grid-template-columns: 1fr 1.6fr;
    gap: var(--sp-2);
    padding: var(--sp-2) calc(var(--sp-4) + var(--safe-right)) calc(var(--sp-2) + var(--safe-bottom)) calc(var(--sp-4) + var(--safe-left));
    border-top: 1px solid var(--sbs-line);
    background: var(--sbs-surface);
    box-shadow: 0 -4px 12px rgba(22, 28, 46, 0.08);
  }

  .cta-bar .btn-sbs {
    width: 100%;
    min-height: 48px;
  }

  .cta-bar svg {
    width: 20px;
    height: 20px;
    margin-right: var(--sp-1);
  }

  body.page-public:not(.has-tabbar) {
    padding-bottom: calc(64px + var(--safe-bottom));
  }

  /* Readable line length and calmer hero spacing */
  .page-public .hero p,
  .page-public .section p {
    max-width: 62ch;
  }

  .page-public img {
    height: auto;
  }
}

/* Menu slides in from the right with large targets (header shows the menu button below 992px) */
@media (max-width: 991.98px) {
  .app-nav.is-open {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: var(--z-menu);
    width: min(340px, 86vw);
    padding: calc(var(--safe-top) + 72px) calc(var(--sp-4) + var(--safe-right)) calc(var(--sp-5) + var(--safe-bottom)) var(--sp-4);
    overflow-y: auto;
    overscroll-behavior: contain;
    border-radius: var(--radius-lg) 0 0 var(--radius-lg);
    background: var(--sbs-surface);
    box-shadow: 0 0 0 100vmax rgba(15, 19, 23, 0.45), var(--shadow-2);
    animation: nav-in 200ms ease-out both;
  }

  .app-nav.is-open .nav-link-sbs {
    min-height: 52px;
    font-size: var(--fs-lg);
  }

  .app-nav.is-open .header-actions {
    display: grid;
    gap: var(--sp-2);
    padding-top: var(--sp-3);
    border-top: 1px solid var(--sbs-line);
  }

  .app-nav.is-open .header-actions .btn-sbs {
    width: 100%;
    min-height: 48px;
  }

  .nav-toggle[aria-expanded="true"] {
    position: relative;
    z-index: calc(var(--z-menu) + 1);
  }
}

@keyframes nav-in {
  from { transform: translateX(24px); opacity: 0.6; }
  to { transform: none; opacity: 1; }
}

body.nav-open .cta-bar {
  display: none;
}

/* v1.2.0 tap-target fixes found by the phone audit */
@media (max-width: 767.98px) {
  .footer-links a,
  .footer-links .link-btn {
    justify-content: center;
    min-width: var(--tap);
  }

  .filter-row [data-order-link],
  .booth-card__head-actions .booth-print {
    min-height: var(--tap);
  }

  .tip__btn {
    justify-content: center;
    min-width: var(--tap);
  }

  .access-grid input[type="checkbox"],
  .page-admin-form .access_list input[type="checkbox"] {
    width: 28px;
    height: 28px;
  }

  .access-grid label {
    display: inline-flex;
    align-items: center;
    min-height: var(--tap);
  }

  .auth-card p a[href^="tel:"],
  .sbs-flash a[href^="tel:"],
  .state a[href^="tel:"] {
    display: inline-block;
    padding-block: 11px;
  }
}

.footer-links a,
.footer-links .link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--tap);
  min-height: var(--tap);
}

/* ================================================================== */
/* 25. v1.2.1 mobile cleanup                                           */
/*     Light only; one spacing and type scale; no sideways scrolling;  */
/*     names wrap; status = icon + word + color; app bar + tab bar are */
/*     the only fixed bars on phones.                                  */
/* ================================================================== */
:root {
  color-scheme: light;
  --card-pad: 16px;
  --card-gap: 12px;
  --gutter: 16px;
  --h1: 1.5rem;      /* 24 */
  --h2: 1.25rem;     /* 20 */
  --h3: 1.0625rem;   /* 17 */
  --h4: 0.9375rem;   /* 15 */
  --fs-body: 0.9375rem; /* 15: smallest body/meta text on phones */
  --icon-ok: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 16.2 4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4z'/%3E%3C/svg%3E");
  --icon-warn: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z'/%3E%3C/svg%3E");
  --icon-bad: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M15.7 3H8.3L3 8.3v7.4L8.3 21h7.4l5.3-5.3V8.3L15.7 3zM13 17h-2v-2h2v2zm0-4h-2V7h2v6z'/%3E%3C/svg%3E");
}

html,
body {
  background: var(--sbs-bg);
}

main img,
main canvas,
main video {
  max-width: 100%;
}

/* ---- 2. Light heroes and sections: white card, brand-red accent ---- */
.hero {
  border: 1px solid var(--sbs-line);
  border-left: 4px solid var(--sbs-red);
  background: var(--sbs-surface);
  color: var(--sbs-ink);
  box-shadow: var(--shadow-1);
}

.hero .eyebrow,
.hero__meta,
.hero__fresh,
.history-path,
.auth-intro__list,
.auth-intro__help {
  color: var(--sbs-muted-text);
}

.hero__title,
.auth-intro__title {
  color: var(--sbs-ink);
}

.hero__badge {
  border-color: var(--sbs-control-line);
  color: var(--sbs-ink);
}

.history-now .reading {
  color: var(--sbs-ink);
}

.btn-sbs--light {
  border-color: var(--sbs-control-line);
  background: var(--sbs-surface);
  color: var(--sbs-ink);
}

.btn-sbs--light:hover {
  border-color: var(--sbs-ink);
  background: var(--app-surface-2);
  color: var(--sbs-ink);
}

.public-hero,
.public-section--dark,
.cta-band {
  border-left: 0;
  background: var(--sbs-surface);
  color: var(--sbs-ink);
}

.public-hero {
  border-bottom: 1px solid var(--sbs-line);
}

.public-section--dark,
.cta-band {
  border-top: 4px solid var(--sbs-red);
  background: #fbfbfa;
}

.public-hero .eyebrow,
.public-hero__lead,
.cta-band p {
  color: var(--sbs-muted-text);
}

.public-hero__title,
.public-section--dark .public-h2,
.cta-band .public-h2 {
  color: var(--sbs-ink);
}

/* ---- 11. Status: icon + word + color ---- */
.status-pill--ok::before,
.status-pill--warn::before,
.status-pill--bad::before,
.count::before,
.stat-tile__label::before,
.next-steps__line::before {
  content: "";
  display: inline-block;
  flex: none;
  width: 1.05em;
  height: 1.05em;
  background: currentColor;
  -webkit-mask: var(--icon-ok) center / contain no-repeat;
  mask: var(--icon-ok) center / contain no-repeat;
}

.status-pill--warn::before,
.count--warn::before,
.stat-tile--warn .stat-tile__label::before,
.next-steps__line--warn::before {
  -webkit-mask-image: var(--icon-warn);
  mask-image: var(--icon-warn);
}

.status-pill--bad::before,
.count--bad::before,
.stat-tile--bad .stat-tile__label::before,
.next-steps__line--bad::before {
  -webkit-mask-image: var(--icon-bad);
  mask-image: var(--icon-bad);
}

.count {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  font-weight: 700;
}

.count--ok {
  color: var(--ok);
}

.count--warn {
  color: var(--warn);
}

.count--bad {
  color: var(--bad);
}

/* ---- 12. Only the first "in. w.c." on a page is an info button ---- */
.tip--plain .tip__i,
.tip--plain .tip__text {
  display: none !important;
}

.tip--plain .tip__btn {
  min-height: 0;
  margin: 0;
  pointer-events: none;
  cursor: default;
}

.tip__text {
  white-space: normal;
}

/* ---- 13. Skeletons and reserved space ---- */
.skeleton--num {
  display: inline-block;
  width: 5.5em;
  height: 1em;
  margin: 0;
  vertical-align: middle;
}

.chart-wrap.is-loading {
  border-radius: var(--radius-md);
  background: linear-gradient(90deg, #eef0f2 25%, #f6f7f8 37%, #eef0f2 63%);
  background-size: 400% 100%;
  animation: sbs-shimmer 1.4s ease infinite;
}

.history-when {
  min-height: 1.5em;
  margin: 0;
}

/* ---- Page foot ("Page updated") ---- */
.page-foot {
  margin: var(--sp-5) 0 0;
  text-align: center;
}

/* ---- Locations: portfolio line and counts ---- */
.portfolio {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-1) var(--sp-3);
  margin: 0 0 var(--card-gap);
  padding: var(--sp-3) var(--card-pad);
  border: 1px solid var(--sbs-line);
  border-radius: var(--radius-lg);
  background: var(--sbs-surface);
  font-size: 1.0625rem;
}

.loc-card__counts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1) var(--sp-3);
}

/* ---- Location page ---- */
.btn-sbs__long {
  white-space: nowrap;
}

.summary-strip .stat-tile {
  font: inherit;
  text-align: left;
  color: inherit;
  cursor: pointer;
}

.stat-tile[aria-pressed="true"] {
  box-shadow: inset 0 0 0 2px currentColor;
}

.stat-tile__label {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
}

.chip__short {
  display: none;
}

.next-steps__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0 var(--sp-3);
}

.next-steps__head .section-title {
  margin: 0;
}

.next-steps__toggle {
  font-weight: 700;
}

.next-steps__short {
  display: grid;
  gap: var(--sp-1);
  margin: var(--sp-2) 0 0;
  padding: 0;
  list-style: none;
}

.next-steps__line {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
  overflow-wrap: anywhere;
}

.next-steps__line::before {
  margin-top: 0.22em;
}

.next-steps__line--warn::before {
  color: var(--warn);
}

.next-steps__line--bad::before {
  color: var(--bad);
}

.next-steps__more {
  margin-top: var(--sp-3);
}

.booth-card__sum {
  display: none;
}

.booth-card.is-collapsed .booth-card__sum {
  display: block;
}

.booth-card.is-collapsed .booth-card__foot {
  display: none;
}

/* Good filters in a booth with a problem: folded on phones only */
.filter-row--more {
  display: none;
  list-style: none;
}

@media (max-width: 767.98px) {
  .booth-card:not(.show-quiet) .filter-row[data-quiet] {
    display: none;
  }

  .is-filtered .booth-card .filter-row[data-quiet]:not([hidden]) {
    display: grid;
  }

  .booth-card .filter-list {
    display: flex;
    flex-direction: column;
  }

  .filter-row--more {
    display: block;
    order: 99;
    border-top: 1px solid var(--sbs-line);
  }

  .filter-row__bar {
    min-width: 48px;
  }

  .is-filtered .filter-row--more {
    display: none;
  }

  .quiet-toggle {
    font-weight: 700;
  }
}

@media print {
  .filter-row[data-quiet] {
    display: grid !important;
  }

  .filter-row--more {
    display: none !important;
  }
}

.booth-card__foot {
  display: flex;
  justify-content: flex-end;
  margin-top: var(--sp-3);
}

/* ---- History page ---- */
.history-hero {
  align-items: stretch;
}

.history-path__eyebrow {
  margin: 0;
}

.history-outlook {
  flex: 1 1 260px;
  display: grid;
  align-content: center;
  gap: var(--sp-2);
  min-width: 0;
}

.history-outlook p {
  margin: 0;
}

.history-outlook__headline {
  font-size: 1.125rem;
}

.history-outlook__headline strong {
  font-size: 1.375rem;
}

.history-outlook__line {
  color: var(--sbs-muted-text);
}

.history-outlook__line strong {
  color: var(--sbs-ink);
}

.outlook-bar {
  position: relative;
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--sbs-line);
}

.outlook-bar__fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--ok-bar);
  transition: width var(--dur) ease;
}

[data-level="warn"] > .outlook-bar .outlook-bar__fill {
  background: var(--warn-bar);
}

[data-level="bad"] > .outlook-bar .outlook-bar__fill {
  background: var(--bad);
}

/* the Change soon point (0.20 of 0.30) */
.outlook-bar__mark--warn {
  position: absolute;
  top: -3px;
  left: 66.7%;
  width: 2px;
  height: 14px;
  background: var(--warn);
}

.history-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin: 0 0 var(--sp-4);
}

.chart-notes {
  margin-top: var(--sp-2);
}

.chart-notes summary {
  display: flex;
  align-items: center;
  min-height: var(--tap);
  font-weight: 700;
  cursor: pointer;
}

.chart-notes p {
  margin: 0 0 var(--sp-2);
}

/* ---- Confirm step (Delete) ---- */
.confirm-panel {
  margin-top: var(--sp-3);
  padding: var(--card-pad);
  border: 1px solid var(--bad);
  border-radius: var(--radius-lg);
  background: var(--bad-bg);
}

.confirm-panel__text {
  margin: 0 0 var(--sp-3);
  font-weight: 700;
  color: var(--bad);
}

.confirm-panel__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.confirm-panel .btn-sbs--danger {
  border-color: var(--bad);
  background: var(--bad);
  color: var(--sbs-white);
}

/* Delete sits apart from Save, after a divider */
.form-actions input[value="Delete"] {
  margin-left: auto;
}

/* ---- Admin section picker: phones only ---- */
.admin-pick {
  display: none;
}

/* ---- Range form: summary buttons are for phones ---- */
.range-row__sum {
  display: none;
}

/* ---- Help accordions ---- */
.help-acc {
  border-top: 1px solid var(--sbs-line);
}

.help-acc__q {
  list-style: none;
}

.help-acc__q::-webkit-details-marker {
  display: none;
}

.help-acc__q > h2 {
  flex: 1 1 auto;
  margin: 0;
}

.link-btn--light {
  color: var(--sbs-ink);
}

/* Help topics fold behind one button on phones */
.help-nav__toggle {
  display: none;
}

@media (max-width: 767.98px) {
  .help-nav__toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: var(--tap);
    padding: var(--sp-2) var(--card-pad);
    border: 1px solid var(--sbs-line);
    border-radius: var(--radius-lg);
    background: var(--sbs-surface);
    color: var(--sbs-ink);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
  }

  .help-nav__toggle::after {
    content: "";
    width: 10px;
    height: 10px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
  }

  .help-nav__toggle[aria-expanded="true"]::after {
    transform: rotate(-135deg);
  }

  .help-nav.is-folded ul {
    display: none;
  }
}

.help-acc__q::after {
  content: "";
  flex: none;
  width: 12px;
  height: 12px;
  margin-left: var(--sp-3);
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translate(-3px, -3px);
  transition: transform var(--dur) ease;
}

.help-acc[open] > .help-acc__q::after {
  transform: rotate(-135deg) translate(-3px, -3px);
}

.help-acc__a {
  padding-bottom: var(--sp-3);
}

/* ---- Public sections that fold on phones ---- */
.phone-collapse__btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  width: 100%;
  min-height: var(--tap);
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.phone-collapse__btn::after {
  content: "";
  flex: none;
  width: 12px;
  height: 12px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-135deg) translate(-3px, -3px);
}

.phone-collapse__btn[aria-expanded="false"]::after {
  transform: rotate(45deg) translate(-3px, -3px);
}

/* ---- Names wrap everywhere (no "...") ---- */
.loc-card__name,
.booth-card__title,
.filter-row__label,
.hero__title,
.app-group__title,
.app-list__title,
.app-list__sub,
.appbar__title {
  overflow-wrap: anywhere;
  word-break: normal;
}

/* ================================================================== */
/* Phones                                                               */
/* ================================================================== */
@media (max-width: 767.98px) {
  /* 6/7. Type floor and one heading scale */
  body {
    font-size: 1rem;
  }

  .meta-text,
  .freshness,
  .field__hint,
  .field__error,
  .toolbar__count,
  .loc-card__addr,
  .hero__hint,
  .app-footer,
  .topstrip,
  .chip,
  .status-pill,
  .btn-sbs--sm,
  .admin-tab,
  .switch,
  .table-sbs th,
  .tip__text,
  .app-list__when,
  .loc-card__counts,
  .install-card__text {
    font-size: var(--fs-body);
  }

  .page-title,
  .hero__title,
  .auth-intro__title,
  .public-hero__title {
    font-size: var(--h1);
    line-height: 1.2;
  }

  .public-h2,
  .help-article .section-title,
  .chart-card .section-title,
  .form_description .page-title {
    font-size: var(--h2);
  }

  .section-title,
  .booth-card__title,
  .app-group__title,
  .form-section__title,
  .step__title {
    font-size: var(--h3);
  }

  .help-h,
  .filter-row__label,
  .loc-card__name {
    font-size: var(--h3);
  }

  .eyebrow,
  .level-bar__label,
  .chart-legend,
  .admin-table.table-cards td[data-label]::before {
    font-size: var(--fs-xs);
  }

  /* 5. One spacing system */
  .container-sbs {
    padding-right: calc(var(--gutter) + var(--safe-right));
    padding-left: calc(var(--gutter) + var(--safe-left));
  }

  .page-section {
    padding-top: var(--sp-4);
    padding-bottom: var(--sp-5);
  }

  .card-sbs,
  .hero,
  .booth-card,
  .admin-panel,
  .chart-card,
  .auth-card,
  .admin-form-card,
  .contact-block,
  .help-article {
    padding: var(--card-pad);
  }

  .card-sbs + .card-sbs,
  .booth-list > * + *,
  .loc-grid,
  .app-list {
    gap: var(--card-gap);
  }

  .hero,
  .summary-strip,
  .board-toolbar,
  .next-steps,
  .booth-list > .booth-card,
  .office-block,
  .chart-card,
  .history-next,
  .readings,
  .portfolio {
    margin-bottom: var(--card-gap);
  }

  .page-head {
    margin-bottom: var(--card-gap);
  }

  /* 8. Tap targets: 44px everywhere, 48px fields */
  .input-sbs,
  select.input-sbs,
  .input-sbs--sm {
    min-height: 48px;
  }

  .crumbs a,
  .auth-links a,
  .app-footer a,
  .help-nav a,
  .footer-links a,
  .pw-toggle,
  .link-btn,
  .access-grid .check,
  .check,
  .switch,
  .faq summary {
    display: inline-flex;
    align-items: center;
    min-height: var(--tap);
  }

  .access-grid .check,
  .check {
    display: flex;
    min-height: 48px;
  }

  .btn-sbs,
  .btn-sbs--sm,
  .chip {
    min-height: var(--tap);
  }

  /* 4. App bar title: wraps to two lines, never cut off */
  .appbar__title {
    display: -webkit-box;
    overflow: visible;
    font-size: var(--h3);
    line-height: 1.2;
    white-space: normal;
    text-overflow: clip;
    -webkit-box-orient: vertical;
  }

  .appbar__title.is-long {
    font-size: var(--h4);
  }

  .appbar__search {
    margin-left: auto;
  }

  .appbar__search + .appbar__more {
    margin-left: 0;
  }

  /* Crumbs: the app bar's back arrow does this job on phones */
  body.has-tabbar .crumbs {
    display: none;
  }

  /* ---- 14/15. Locations ---- */
  body.has-tabbar .loc-toolbar {
    flex-wrap: wrap;
    margin-bottom: var(--card-gap);
  }

  body.has-tabbar .loc-toolbar [data-search-row] {
    display: none;
  }

  body.has-tabbar.search-open .loc-toolbar [data-search-row] {
    display: block;
    flex: 1 1 100%;
  }

  .loc-toolbar .toolbar__field {
    flex: 1 1 140px;
    min-width: 0;
  }

  .loc-toolbar .toolbar__field .input-sbs {
    width: 100%;
  }

  .loc-toolbar .toolbar__label {
    font-size: var(--fs-xs);
  }

  .loc-toolbar .toolbar__count {
    flex: 1 1 100%;
    margin: 0;
  }

  .loc-card {
    min-height: 72px;
    padding: var(--card-pad);
  }

  .loc-card__name {
    margin: 0;
    line-height: 1.25;
  }

  .loc-card__slot {
    min-height: 1.5em;
  }

  .loc-card__slot .status-pill {
    display: none;
  }

  .loc-card .pin-btn {
    width: var(--tap);
    height: var(--tap);
  }

  .app-list__item {
    min-height: 64px;
    padding: var(--sp-3) var(--card-pad);
  }

  .app-group__head {
    min-height: var(--tap);
    padding: var(--sp-3) var(--card-pad);
  }

  /* ---- 18-24. Location page ---- */
  .board-hero,
  .history-hero {
    grid-template-columns: minmax(0, 1fr);
    justify-content: stretch;
    align-items: start;
  }

  .board-hero {
    display: grid;
    gap: var(--sp-3);
  }

  .board-hero .eyebrow {
    display: none;
  }

  .board-hero .hero__title {
    margin: 0 0 var(--sp-1);
  }

  .board-hero .hero__meta {
    margin: 0;
    font-size: var(--fs-body);
  }

  .board-hero__actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-2);
  }

  .board-hero__actions .btn-sbs {
    width: 100%;
    min-height: 48px;
    padding-inline: var(--sp-2);
  }

  .board-hero__primary {
    grid-column: 1 / -1;
  }

  .board-hero__actions .btn-sbs__long {
    display: none;
  }

  .summary-strip {
    gap: var(--sp-2);
  }

  .summary-strip .stat-tile {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0 var(--sp-2);
    min-height: 56px;
    padding: var(--sp-2) var(--sp-3);
  }

  .summary-strip .stat-tile__num {
    font-size: 1.5rem;
  }

  .summary-strip .stat-tile__label {
    font-size: var(--fs-xs);
    line-height: 1.2;
  }

  .board-toolbar {
    margin-bottom: var(--card-gap);
  }

  .board-seg {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
  }

  .board-seg .chip {
    justify-content: center;
    padding-inline: var(--sp-1);
    white-space: nowrap;
  }

  .board-seg .chip__long {
    display: none;
  }

  .board-seg .chip__short {
    display: inline;
  }

  .next-steps {
    border-left-width: 4px;
  }

  .next-steps__actions {
    display: grid;
    gap: var(--sp-2);
  }

  .next-steps__actions .btn-sbs {
    width: 100%;
  }

  .booth-card__head {
    flex-wrap: nowrap;
    align-items: center;
    gap: var(--sp-2);
  }

  .booth-card__title-wrap {
    cursor: pointer;
  }

  .booth-card__title-wrap .eyebrow {
    display: none;
  }

  .booth-card__title {
    margin: 0;
  }

  .booth-card__head .booth-toggle {
    order: 3;
    margin-left: 0;
  }

  .booth-card__head-actions {
    order: 2;
    flex: none;
  }

  .booth-card__foot {
    justify-content: flex-start;
    margin-top: 0;
  }

  .booth-card__foot .btn-sbs {
    min-height: var(--tap);
    padding: 0;
    border: 0;
    background: none;
    color: var(--sbs-muted-text);
    font-weight: 600;
    text-decoration: underline;
  }

  .loc-card__name .link {
    display: inline-flex;
    align-items: center;
    min-height: var(--tap);
  }

  .booth-card:not(.is-collapsed) .booth-card__head {
    margin-bottom: var(--sp-1);
  }

  /* name + status on top; reading, a thin bar and Order below; the whole row opens History */
  .filter-row {
    grid-template-columns: auto minmax(0, 1fr) auto 16px;
    grid-template-areas:
      "name name status chev"
      "reading bar actions chev";
    align-items: center;
    gap: var(--sp-1) var(--sp-3);
    margin: 0;
    padding: var(--sp-3) 0;
  }

  .filter-row__name {
    align-self: center;
  }

  .filter-row .reading {
    font-size: 1.375rem;
  }

  .filter-row__status {
    justify-self: end;
  }

  .filter-row__bar {
    align-self: center;
  }

  .filter-row .level-bar__track {
    height: 6px;
  }

  .filter-row .level-bar__label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .filter-row [data-order-link] {
    min-height: var(--tap);
  }

  .filter-row__chev {
    width: 16px;
    height: 16px;
  }

  .office-block {
    margin-top: var(--card-gap);
  }

  /* ---- 25-31. History page ---- */
  .history-hero {
    display: grid;
    gap: var(--sp-3);
    margin-bottom: var(--card-gap);
  }

  .history-path {
    margin-bottom: 2px;
    font-size: var(--fs-xs);
    font-weight: 600;
    line-height: 1.3;
  }

  .history-path__eyebrow {
    display: none;
  }

  /* The filter name is the app bar title on phones, so the heading here is for screen readers */
  body.has-tabbar .history-hero .hero__title {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .history-hero .hero__title {
    margin: 0 0 var(--sp-1);
    font-size: var(--h2);
  }

  .history-now {
    gap: var(--sp-1) var(--sp-2);
  }

  .history-now .reading {
    font-size: 1.625rem;
    line-height: 1.1;
  }

  .history-when {
    font-size: var(--fs-body);
    color: var(--sbs-muted-text);
  }

  .history-outlook {
    grid-template-columns: auto auto;
    justify-content: space-between;
    align-items: baseline;
    gap: 6px var(--sp-2);
    padding-top: var(--sp-2);
    border-top: 1px solid var(--sbs-line);
  }

  .history-outlook__headline {
    font-size: var(--fs-body);
    white-space: nowrap;
  }

  .history-outlook .outlook-bar {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .history-outlook__line {
    grid-row: 1;
    grid-column: 2;
    text-align: right;
    font-size: var(--fs-body);
  }

  .history-outlook__headline strong {
    font-size: 1.25rem;
    white-space: nowrap;
  }

  .chart-card {
    display: flex;
    flex-direction: column;
  }

  .chart-card__head {
    display: contents;
  }

  .history-hero {
    gap: var(--sp-2);
  }

  .chart-card {
    padding-top: var(--sp-3);
  }

  .chart-card__head .section-title {
    order: 1;
    margin: 0 0 var(--sp-1);
    font-size: var(--h4);
    color: var(--sbs-muted-text);
  }

  .chart-card .chart-wrap {
    order: 2;
    height: 260px;
  }

  .chart-card__head .seg {
    order: 3;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: 100%;
    margin-top: var(--sp-2);
  }

  .chart-card__head .seg .chip {
    padding-inline: 2px;
    white-space: normal;
    line-height: 1.15;
    text-align: center;
  }

  .chart-card .chart-legend {
    order: 4;
    display: flex;
    flex-wrap: wrap;
    gap: 2px var(--sp-3);
    margin-top: var(--sp-2);
  }

  .chart-card > :not(.chart-card__head):not(.chart-wrap):not(.chart-legend) {
    order: 5;
  }

  .history-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .history-actions .btn-sbs {
    width: 100%;
    padding-inline: var(--sp-2);
  }

  .history-next .next-steps__actions {
    display: grid;
    gap: var(--sp-2);
  }

  .history-next .next-steps__actions .btn-sbs {
    width: 100%;
  }

  .readings .table-cards td,
  .table-view .table-cards td {
    font-size: var(--fs-body);
  }

  .readings__scroll,
  .table-view__wrap {
    overflow-x: hidden;
  }

  .readings .table-cards,
  .table-view .table-cards {
    width: 100%;
    table-layout: fixed;
  }

  .readings .table-cards th:nth-child(1),
  .table-view .table-cards th:nth-child(1) {
    width: 42%;
  }

  .readings .table-cards th:nth-child(2),
  .table-view .table-cards th:nth-child(2) {
    width: 22%;
  }

  .readings .table-cards td,
  .table-view .table-cards td {
    padding-inline: var(--sp-2);
    overflow-wrap: anywhere;
  }

  .readings .table-cards .status-pill,
  .table-view .table-cards .status-pill {
    padding-inline: var(--sp-2);
    white-space: normal;
  }

  /* ---- 34. Admin: Section drop-down instead of tabs; nothing sticky ---- */
  .admin-pick {
    display: grid;
    gap: var(--sp-1);
    margin-bottom: var(--card-gap);
  }

  body.has-tabbar .admin-tabs {
    display: none;
  }

  .admin-toolbar {
    flex-wrap: wrap;
  }

  .admin-toolbar .input-sbs {
    flex: 1 1 100%;
  }

  /* 37. Admin tables as clean stacked cards */
  .admin-table.table-cards tr {
    gap: var(--sp-2) var(--sp-3);
    padding: var(--card-pad);
  }

  .admin-table.table-cards td {
    font-size: var(--fs-body);
  }

  /* 35/38. Forms: labels above, 48px fields, Save full width at the end, Delete apart */
  .admin-form .form-actions {
    display: grid;
    gap: var(--sp-2);
    margin-top: var(--sp-4);
  }

  .admin-form .form-actions > * {
    width: 100%;
    min-height: 48px;
    margin: 0;
  }

  .admin-form .form-actions input[value="Delete"] {
    order: 5;
    margin-top: var(--sp-3);
  }

  .admin-form .form-actions .admin-actions__note {
    order: 6;
  }

  .admin-form .form-actions::after {
    content: "";
    order: 4;
    height: 1px;
    margin-top: var(--sp-2);
    background: var(--sbs-line);
  }

  .field-grid,
  .field-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .input-sbs--short {
    width: 100%;
    max-width: none;
  }

  /* 36. Range form: one summary line per range; tap to open */
  .range-table-wrap {
    overflow: visible;
  }

  .range-table,
  .range-table tbody {
    display: block;
    width: 100%;
  }

  .range-table tr.range-row {
    display: block;
    margin: 0 0 var(--card-gap);
    padding: 0;
    border: 1px solid var(--sbs-line);
    border-radius: var(--radius-lg);
    background: var(--sbs-surface);
  }

  .range-table tr.range-row > td {
    display: none;
    width: auto;
    max-width: none;
    padding: 0 var(--card-pad) var(--sp-3);
    flex: none;
  }

  .range-table tr.range-row > td.range-row__sum {
    display: block;
    padding: 0;
  }

  .range-table tr.range-row.is-open > td:not(.range-row__id) {
    display: block;
  }

  .range-table tr.range-row > td.range-row__id {
    display: none !important;
  }

  .range-row__toggle {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 2px var(--sp-2);
    width: 100%;
    min-height: 56px;
    padding: var(--sp-2) var(--card-pad);
    border: 0;
    border-radius: var(--radius-lg);
    background: none;
    color: var(--sbs-ink);
    font: inherit;
    text-align: left;
    cursor: pointer;
  }

  .range-row__toggle::after {
    content: "";
    grid-row: 1 / span 2;
    grid-column: 2;
    align-self: center;
    width: 10px;
    height: 10px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
  }

  .range-row__toggle[aria-expanded="true"]::after {
    transform: rotate(-135deg);
  }

  .range-row__n {
    font-size: var(--fs-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--sbs-muted-text);
  }

  .range-row__text {
    font-weight: 700;
  }

  .range-table thead {
    display: none;
  }

  /* ---- 39. Public pages: tighter, smaller images ---- */
  .public-section {
    padding: var(--sp-5) 0;
  }

  .public-hero__inner {
    gap: var(--sp-4);
    padding-top: var(--sp-5);
    padding-bottom: var(--sp-5);
  }

  .public-hero__media img {
    max-height: 200px;
    width: auto;
    object-fit: contain;
  }

  .alert-flow {
    width: 100%;
    height: auto;
    max-height: 120px;
    object-fit: contain;
  }

  /* Links inside sentences: a 44px tap area without changing the line spacing */
  main :is(p, li, dd, td, figcaption) > a:not(.btn-sbs),
  .auth-intro a:not(.btn-sbs),
  .state a:not(.btn-sbs) {
    display: inline-block;
    padding-block: 11px;
    margin-block: -11px;
  }

  /* Example chart on the help page: the drawing scales down on phones, so its labels are
     drawn bigger (28 units ≈ 13px on screen) */
  .chart-guide__svg text {
    font-size: 28px;
  }

  .chart-guide__svg g text {
    font-size: 22px;
  }

  .chart-guide__svg g circle {
    r: 17px;
  }

  .steps,
  .level-cards {
    gap: var(--card-gap);
  }

  .steps .card-sbs,
  .level-cards .card-sbs {
    padding: var(--card-pad);
  }

  .cta-band__inner {
    padding-top: var(--sp-5);
    padding-bottom: var(--sp-5);
  }

  .phone-collapse__btn {
    font-size: inherit;
    font-weight: inherit;
  }

  [data-phone-collapse] .public-h2 {
    margin-bottom: 0;
  }

  .phone-collapse__body {
    margin-top: var(--sp-3);
  }

  .sample-dash figure img {
    max-height: 220px;
    width: auto;
    margin: 0 auto;
  }

  /* ---- 41. Sign-in: 48px fields, light intro ---- */
  .auth-form .input-sbs {
    min-height: 48px;
  }

  .pw-toggle {
    min-width: var(--tap);
    justify-content: center;
  }
}

/* Very narrow phones (320px) */
@media (max-width: 359.98px) {
  .summary-strip .stat-tile {
    padding-inline: var(--sp-2);
  }

  .summary-strip .stat-tile__num {
    font-size: 1.375rem;
  }

  .board-seg .chip {
    font-size: var(--fs-xs);
  }

  .history-actions {
    grid-template-columns: 1fr;
  }
}

@media print {
  .page-foot,
  .admin-pick,
  .confirm-panel,
  .next-steps__toggle,
  .next-steps__short {
    display: none !important;
  }

  .next-steps__more[hidden] {
    display: block !important;
  }

  .hero {
    border-left-width: 1px;
  }
}
