/*
 * altamus.css — design tokens and every shared component style of Hyperion Health.
 *
 * Values come from frontend/lib/ui/theme/altamus_tokens.dart and altamus_theme.dart,
 * which follow altamusinc.com. Views and components should build from these
 * classes and add their own file only for what is specific to them.
 *
 * Colours: components use the semantic tokens of section 1 (--color-*, --status-*,
 * --series-*, --tree-*, --shadow*, --scrim), which switch with the theme
 * (light / dark, js/theme.js). Never a brand colour or a literal for a role.
 *
 * Contents
 *   1. Tokens (light, dark)  8. Tags, chips, dots      15. Tooltip
 *   2. Base                  9. Fields and selects     16. Spinner and loading
 *   3. Typography           10. Switch and checkbox    17. Toast
 *   4. App shell            11. Tabs                   18. Tree rows and strips
 *   5. Page layout          11b. Segmented control     19. Empty state
 *   6. Buttons              12. Dialog                 20. Login page
 *   7. Cards and panels     13. Popup menu             20b. Settings page
 *                           14. Table                  21. Utilities
 *                                                      22. Responsive utilities
 */

/* ------------------------------------------------------------------ 1. Tokens */

/*
 * Three kinds of variables:
 *
 * 1a. Brand colours (--navy, --purple, --orange, --yellow …) and the light
 *     palette constants (--ink, --muted, --line, --surface, --white, the
 *     tints …). They never change with the theme. Do NOT use them for roles
 *     (backgrounds, text, borders) in components: they stay light in dark mode.
 *     Only brand-fixed artwork uses them (the navy login hero).
 *
 * 1b. Semantic tokens (--color-*, plus --status-*, --series-*, --tree-*,
 *     --shadow*, --scrim). Every component uses these. Their light values are
 *     the original look; [data-theme="dark"] and the OS dark preference
 *     (while the choice is System) switch them to the navy dark palette below.
 *
 * 1c. Shape and layout (--radius-*, --header-height, --font).
 *
 * The theme is chosen with js/theme.js (System / Light / Dark); see README.
 */

:root {
  /* 1a. Brand (fixed) */
  --navy: #1B2E4B;
  --navy-900: #111F35;
  --navy-700: #24406A;
  --purple: #7C4DFF;
  --purple-600: #6A3CF0;
  --orange: #FF6E40;
  --orange-ink: #C8431B;
  --yellow: #FFD740;

  /* 1a. Light palette constants (fixed; use the semantic tokens instead) */
  --ink: #2F2F2F;
  --muted: #5A6474;
  --line: #E3E7EE;
  --surface: #F5F7FA;
  --white: #FFFFFF;
  --purple-tint: #EFEAFF;
  --orange-tint: #FFEEE8;
  --error-tint: #FCE9EA;
  --error-ink: #B4232A;
  --field-outline: #C9D0DB;
  --disabled-fill: rgba(47, 47, 47, 0.10);
  --disabled-ink: rgba(47, 47, 47, 0.38);

  /* 1b. Semantic tokens: light values */
  color-scheme: light;

  /* Surfaces */
  --color-bg: #F5F7FA;                         /* page background */
  --color-surface: #FFFFFF;                    /* header, bottom bar, cards, sections, panels */
  --color-surface-raised: #FFFFFF;             /* dialogs, menus, sheets, the login card */
  --color-surface-sunken: #F5F7FA;             /* wells inside a surface: switch track */
  --color-row-hover: #F5F7FA;                  /* hovered list row, menu item, table row */
  --color-hover: rgba(27, 46, 75, 0.06);       /* neutral wash on a hovered button */
  --color-veil: rgba(255, 255, 255, 0.7);      /* over content that is reloading */
  --color-border: #E3E7EE;                     /* card edges, dividers, table rules */
  --color-border-strong: #C9D0DB;              /* hovered card edge, sheet handle, emphasised divider */

  /* Text */
  --color-text: #2F2F2F;                       /* body text */
  --color-text-muted: #5A6474;                 /* secondary text, labels, hints, icons */
  --color-heading: #1B2E4B;                    /* headings, titles, nav links, default button text, icons in menus */
  --color-text-disabled: rgba(47, 47, 47, 0.38);
  --color-fill-disabled: rgba(47, 47, 47, 0.10);

  /* Accent (purple) */
  --color-accent: #7C4DFF;                     /* fills: primary button, checked switch, tab underline, spinner */
  --color-accent-strong: #6A3CF0;              /* hovered / pressed accent fill */
  --color-accent-text: #7C4DFF;                /* links, text buttons, selected nav, eyebrows, accent icons */
  --color-on-accent: #FFFFFF;                  /* text and icons on an accent fill */
  --color-accent-tint: #EFEAFF;                /* tonal button, pressed segment */
  --color-accent-tint-hover: #E4DCFF;
  --color-on-accent-tint: #6A3CF0;             /* text on the accent tint */
  --color-accent-hover: rgba(124, 77, 255, 0.08);    /* hovered icon / text button, tab */
  --color-accent-selected: rgba(124, 77, 255, 0.10); /* selected nav link, icon badge */
  --color-accent-pressed: rgba(124, 77, 255, 0.14);  /* pressed icon button, open menu anchor */
  --color-focus: #7C4DFF;                      /* focus rings, focused field outline */

  /* Status text and tints (the status colours themselves are below) */
  --color-error-text: #B4232A;                 /* error text on --color-error-tint or a surface */
  --color-error-tint: #FCE9EA;
  --color-warning-text: #8A6500;               /* warning text (the yellow is too light for text) */
  --color-orange-text: #C8431B;
  --color-orange-tint: #FFEEE8;

  /* Fields */
  --color-field-fill: #FFFFFF;
  --color-field-outline: #C9D0DB;
  --color-field-changed: #FFF1BC;              /* fill of a field whose value differs from the saved one */
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%235A6474' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");

  /* Overlays */
  --color-tooltip-bg: #111F35;                 /* tooltips, chart tooltips */
  --color-tooltip-text: #FFFFFF;
  --color-toast-bg: #1B2E4B;
  --color-toast-error-bg: #B4232A;
  --color-toast-text: #FFFFFF;
  --color-toast-action: #FFD740;
  --color-skeleton: #E9EDF3;                   /* loading placeholder */
  --color-skeleton-highlight: #F5F7FA;         /* the shimmer passing over it */
  --scrim: rgba(17, 31, 53, 0.5);              /* behind dialogs and sheets */
  --shadow: 0 10px 30px rgba(27, 46, 75, 0.08);       /* panels, hovered cards */
  --shadow-lg: 0 20px 50px rgba(27, 46, 75, 0.16);    /* dialogs, sheets, login card */
  --shadow-raised: 0 8px 24px rgba(27, 46, 75, 0.2);  /* popup menus */

  /* Charts and canvases: read with cssColor() from js/theme.js at draw time */
  --color-chart-grid: #C9D0DB;                 /* day boundaries, grid lines */
  --color-chart-axis: #E3E7EE;                 /* axis rule, strip baseline */
  --color-chart-label: #1B2E4B;                /* primary axis labels */
  --color-chart-label-muted: #5A6474;          /* secondary labels, ticks, axis titles */
  --color-chart-now: #7C4DFF;                  /* "Now" marker */
  --color-chart-hover: rgba(27, 46, 75, 0.08); /* hovered bucket / column */
  --color-chart-outline: #1B2E4B;              /* selection outline, strip outline */
  --color-chart-band: rgba(27, 46, 75, 0.045); /* every other day */
  --color-lane-healthy: rgba(34, 160, 107, 0.32); /* healthy cell in a lane */
  --color-lane-empty: #DCE1E9;                 /* empty bucket baseline, lane track */

  /* Health and connection status (dots, bars, chips, tags, card edges) */
  --status-ok: #22A06B;
  --status-info: #3D7BF7;
  --status-warning: #F5B300;
  --status-error: #E5484D;
  --status-unknown: #9AA4B2;
  --status-safe-mode: #7C4DFF;
  --status-particle-only: #FF6E40;

  /* Chart series (scanner telemetry) */
  --series-temperature: #FF6E40;
  --series-rssi: #7C4DFF;
  --series-current: #12A5A5;
  --series-voltage: #1B2E4B;

  /* Tree connectors: site/space/boundary hierarchy and scanner hierarchy */
  --tree-data: rgba(124, 77, 255, 0.45);
  --tree-hardware: rgba(255, 110, 64, 0.7);

  /* 1c. Shape */
  --radius-card: 14px;
  --radius-button: 10px;
  --radius-field: 10px;
  --radius-menu: 12px;
  --radius-pill: 999px;

  /* 1c. Layout */
  --header-height: 64px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

/*
 * 1b. Semantic tokens: dark values. A navy palette after the website's dark
 * surfaces (#111F35 with light text and purple accents). Borders do more of the
 * separation, shadows less. Text contrast (WCAG): body text 12.8:1 on
 * --color-surface, muted 6.9:1 (5.95:1 on raised), accent text 7.2:1, status
 * colours 5:1 or more on every surface; field outline 3.3:1 or more.
 *
 * The same block twice: chosen Dark, and System while the OS prefers dark.
 * Keep the two copies identical.
 */
:root[data-theme='dark'] {
  color-scheme: dark;
  --color-bg: #0B1526;
  --color-surface: #111F35;
  --color-surface-raised: #1A2B47;
  --color-surface-sunken: #0B1526;
  --color-row-hover: rgba(255, 255, 255, 0.06);
  --color-hover: rgba(255, 255, 255, 0.08);
  --color-veil: rgba(11, 21, 38, 0.7);
  --color-border: #2C4064;
  --color-border-strong: #647A9E;
  --color-text: #DCE3EE;
  --color-text-muted: #9AA9BF;
  --color-heading: #F4F7FB;
  --color-text-disabled: rgba(220, 227, 238, 0.38);
  --color-fill-disabled: rgba(220, 227, 238, 0.10);
  --color-accent: #7C4DFF;
  --color-accent-strong: #6A3CF0;
  --color-accent-text: #B39DFF;
  --color-on-accent: #FFFFFF;
  --color-accent-tint: #2A2352;
  --color-accent-tint-hover: #352C66;
  --color-on-accent-tint: #C9B8FF;
  --color-accent-hover: rgba(166, 138, 255, 0.12);
  --color-accent-selected: rgba(166, 138, 255, 0.16);
  --color-accent-pressed: rgba(166, 138, 255, 0.22);
  --color-focus: #A68AFF;
  --color-error-text: #FF9EA1;
  --color-error-tint: #3A1D2A;
  --color-warning-text: #FFD45C;
  --color-orange-text: #FFA585;
  --color-orange-tint: #3A2522;
  --color-field-fill: #111F35;
  --color-field-outline: #647A9E;
  --color-field-changed: #3D3415;
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%239AA9BF' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  --color-tooltip-bg: #2B4166;
  --color-tooltip-text: #FFFFFF;
  --color-toast-bg: #24406A;
  --color-toast-error-bg: #8F2A31;
  --color-toast-text: #FFFFFF;
  --color-toast-action: #FFD740;
  --color-skeleton: #1A2B47;
  --color-skeleton-highlight: #233756;
  --scrim: rgba(2, 6, 14, 0.72);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.45);
  --shadow-raised: 0 6px 18px rgba(0, 0, 0, 0.4);
  --color-chart-grid: #3A5075;
  --color-chart-axis: #2C4064;
  --color-chart-label: #DCE3EE;
  --color-chart-label-muted: #9AA9BF;
  --color-chart-now: #A68AFF;
  --color-chart-hover: rgba(255, 255, 255, 0.10);
  --color-chart-outline: #F4F7FB;
  --color-chart-band: rgba(255, 255, 255, 0.035);
  --color-lane-healthy: rgba(60, 203, 138, 0.30);
  --color-lane-empty: #22344F;
  --status-ok: #3CCB8A;
  --status-info: #6B9BFF;
  --status-warning: #F5B300;
  --status-error: #FF6B70;
  --status-unknown: #8E9AAD;
  --status-safe-mode: #A68AFF;
  --status-particle-only: #FF8A65;
  --series-temperature: #FF8A65;
  --series-rssi: #A68AFF;
  --series-current: #2EC4C4;
  --series-voltage: #8FB0E8;
  --tree-data: rgba(166, 138, 255, 0.55);
  --tree-hardware: rgba(255, 138, 101, 0.7);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --color-bg: #0B1526;
    --color-surface: #111F35;
    --color-surface-raised: #1A2B47;
    --color-surface-sunken: #0B1526;
    --color-row-hover: rgba(255, 255, 255, 0.06);
    --color-hover: rgba(255, 255, 255, 0.08);
    --color-veil: rgba(11, 21, 38, 0.7);
    --color-border: #2C4064;
    --color-border-strong: #647A9E;
    --color-text: #DCE3EE;
    --color-text-muted: #9AA9BF;
    --color-heading: #F4F7FB;
    --color-text-disabled: rgba(220, 227, 238, 0.38);
    --color-fill-disabled: rgba(220, 227, 238, 0.10);
    --color-accent: #7C4DFF;
    --color-accent-strong: #6A3CF0;
    --color-accent-text: #B39DFF;
    --color-on-accent: #FFFFFF;
    --color-accent-tint: #2A2352;
    --color-accent-tint-hover: #352C66;
    --color-on-accent-tint: #C9B8FF;
    --color-accent-hover: rgba(166, 138, 255, 0.12);
    --color-accent-selected: rgba(166, 138, 255, 0.16);
    --color-accent-pressed: rgba(166, 138, 255, 0.22);
    --color-focus: #A68AFF;
    --color-error-text: #FF9EA1;
    --color-error-tint: #3A1D2A;
    --color-warning-text: #FFD45C;
    --color-orange-text: #FFA585;
    --color-orange-tint: #3A2522;
    --color-field-fill: #111F35;
    --color-field-outline: #647A9E;
    --color-field-changed: #3D3415;
    --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%239AA9BF' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    --color-tooltip-bg: #2B4166;
    --color-tooltip-text: #FFFFFF;
    --color-toast-bg: #24406A;
    --color-toast-error-bg: #8F2A31;
    --color-toast-text: #FFFFFF;
    --color-toast-action: #FFD740;
    --color-skeleton: #1A2B47;
    --color-skeleton-highlight: #233756;
    --scrim: rgba(2, 6, 14, 0.72);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.45);
    --shadow-raised: 0 6px 18px rgba(0, 0, 0, 0.4);
    --color-chart-grid: #3A5075;
    --color-chart-axis: #2C4064;
    --color-chart-label: #DCE3EE;
    --color-chart-label-muted: #9AA9BF;
    --color-chart-now: #A68AFF;
    --color-chart-hover: rgba(255, 255, 255, 0.10);
    --color-chart-outline: #F4F7FB;
    --color-chart-band: rgba(255, 255, 255, 0.035);
    --color-lane-healthy: rgba(60, 203, 138, 0.30);
    --color-lane-empty: #22344F;
    --status-ok: #3CCB8A;
    --status-info: #6B9BFF;
    --status-warning: #F5B300;
    --status-error: #FF6B70;
    --status-unknown: #8E9AAD;
    --status-safe-mode: #A68AFF;
    --status-particle-only: #FF8A65;
    --series-temperature: #FF8A65;
    --series-rssi: #A68AFF;
    --series-current: #2EC4C4;
    --series-voltage: #8FB0E8;
    --tree-data: rgba(166, 138, 255, 0.55);
    --tree-hardware: rgba(255, 138, 101, 0.7);
  }
}

/* -------------------------------------------------------------------- 2. Base */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

body.has-dialog {
  overflow: hidden;
}

/* Set by ui.js while a modal dialog or a menu sheet is open: the page under it does not scroll. */
html.is-scroll-locked,
html.is-scroll-locked body {
  overflow: hidden;
  overscroll-behavior: none;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

a {
  color: var(--color-accent-text);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

hr,
.divider {
  height: 1px;
  margin: 8px 0;
  border: 0;
  background: var(--color-border);
}

:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

#app {
  height: 100%;
}

/* -------------------------------------------------------------- 3. Typography */

h1,
h2,
h3,
h4,
.heading {
  margin: 0;
  color: var(--color-heading);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

h1,
.h1 {
  font-size: 32px;
  font-weight: 800;
}

h2,
.h2 {
  font-size: 28px;
  font-weight: 800;
}

h3,
.h3 {
  font-size: 24px;
  font-weight: 700;
}

h4,
.h4 {
  font-size: 22px;
  font-weight: 700;
}

/* Section heading inside a page (Live Issues sections, dialog sections). */
.section-title {
  margin: 12px 0 8px;
  font-size: 18px;
  font-weight: 700;
  color: var(--color-heading);
}

.title-md {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-heading);
}

.title-sm {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-heading);
}

.body-lg {
  font-size: 16px;
}

.body-sm {
  font-size: 12px;
  color: var(--color-text-muted);
}

.lead {
  font-size: 16px;
  color: var(--color-text-muted);
}

.muted {
  color: var(--color-text-muted);
}

/* Small uppercase label above a heading. */
.eyebrow {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--eyebrow-color, var(--color-accent-text));
}

.eyebrow--yellow {
  --eyebrow-color: var(--yellow);
}

/* --------------------------------------------------------------- 4. App shell */

.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}

.app-header {
  display: flex;
  flex: none;
  align-items: center;
  height: calc(var(--header-height) + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) max(12px, env(safe-area-inset-right, 0px)) 0 max(20px, env(safe-area-inset-left, 0px));
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

/* Header buttons are 44px touch targets. */
.app-header .icon-btn {
  width: 44px;
  height: 44px;
}

.brand {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 10px;
}

.brand__name {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.42px;
  color: var(--color-heading);
}

.nav {
  display: flex;
  gap: 4px;
  margin-left: 28px;
}

.nav__link {
  min-height: 44px;
  padding: 8px 14px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-size: 15px;
  font-weight: 600;
  color: var(--color-heading);
  cursor: pointer;
}

.nav__link:hover {
  background: var(--color-hover);
}

.nav__link.is-selected {
  background: var(--color-accent-selected);
  color: var(--color-accent-text);
}

.nav__link.is-selected:hover {
  background: color-mix(in srgb, var(--color-accent-text) 16%, transparent);
}

.app-header__actions {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
}

.app-main {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.bottom-nav {
  display: none;
  flex: none;
  height: calc(64px + env(safe-area-inset-bottom, 0px));
  padding: 0 env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
}

.bottom-nav__item:focus-visible {
  outline-offset: -4px;
}

.bottom-nav__item {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: 0;
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-heading);
  cursor: pointer;
}

.bottom-nav__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 30px;
  border-radius: var(--radius-button);
  font-size: 22px;
  line-height: 1;
}

.bottom-nav__item.is-selected {
  font-weight: 700;
  color: var(--color-accent-text);
}

.bottom-nav__item.is-selected .bottom-nav__icon {
  background: var(--color-accent-selected);
}

/* Below 720px the page links move from the header to the bottom bar. */
@media (max-width: 719.98px) {
  .nav {
    display: none;
  }

  .bottom-nav {
    display: flex;
  }
}

/* Below 380px the HEALTH tag is dropped from the brand. */
@media (max-width: 379.98px) {
  .brand .tag {
    display: none;
  }
}

/* Phones: a tighter header; the account menu is on the Settings page (see app.js). */
@media (max-width: 599.98px) {
  .app-header {
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(8px, env(safe-area-inset-right, 0px));
  }

  .brand__name {
    font-size: 19px;
  }

  .app-header .app-header__account {
    display: none;
  }
}

.app-splash {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

/* ------------------------------------------------------------- 5. Page layout */

.page {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

/* Title on the left, actions on the right; wraps on narrow screens. */
.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 24px 8px;
}

.page-title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--color-heading);
}

.page-header__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.page-body {
  flex: 1;
  padding: 8px 16px 24px;
}

.page-body--padded {
  padding: 8px 24px 24px;
}

/* Centred column for text pages (Settings). */
.page-narrow {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 24px;
}

.page-center {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  padding: 24px;
  color: var(--color-text-muted);
}

/* ----------------------------------------------------------------- 6. Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 64px;
  min-height: 40px;
  padding: 8px 14px;
  border: 2px solid transparent;
  border-radius: var(--radius-button);
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--color-heading);
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

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

/* Primary: purple fill. */
.btn--primary {
  background: var(--color-accent);
  color: var(--color-on-accent);
}

.btn--primary:hover,
.btn--primary:active {
  background: var(--color-accent-strong);
}

/* Outline: 2px navy border. */
.btn--outline {
  border-color: var(--color-heading);
  color: var(--color-heading);
}

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

/* Danger outline: actions on physical hardware and other destructive actions. */
.btn--danger {
  border-color: var(--status-error);
  color: var(--status-error);
}

.btn--danger:hover {
  background: var(--color-error-tint);
}

/* Tonal: purple on a purple tint. */
.btn--tonal {
  background: var(--color-accent-tint);
  color: var(--color-on-accent-tint);
}

.btn--tonal:hover {
  background: var(--color-accent-tint-hover);
}

/* Text button: purple, no border. */
.btn--text {
  padding: 8px 12px;
  color: var(--color-accent-text);
}

.btn--text:hover {
  background: var(--color-accent-hover);
}

.btn--lg {
  min-height: 48px;
  padding: 12px 20px;
  font-size: 15px;
}

.btn--sm {
  min-width: 0;
  min-height: 32px;
  padding: 4px 10px;
  font-size: 13px;
}

.btn--block {
  display: flex;
  width: 100%;
}

.btn:disabled,
.btn.is-disabled {
  border-color: transparent;
  background: var(--color-fill-disabled);
  color: var(--color-text-disabled);
  cursor: not-allowed;
}

.btn--outline:disabled,
.btn--danger:disabled {
  border-color: var(--color-border);
  background: transparent;
}

.btn--text:disabled {
  background: transparent;
}

/* A button that shows a spinner keeps its size and is not clickable. */
.btn.is-loading {
  pointer-events: none;
}

/* Round icon button (header actions, refresh, dialog close). */
.icon-btn {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  font-size: 20px;
  line-height: 1;
  color: var(--color-heading);
  cursor: pointer;
}

.icon-btn:hover {
  background: var(--color-accent-hover);
}

.icon-btn:active,
.icon-btn.is-open {
  background: var(--color-accent-pressed);
}

.icon-btn:disabled {
  color: var(--color-text-disabled);
  cursor: not-allowed;
}

/* The "?" beside a label, a heading or a button (ui.help): what it is about, in the floating tooltip.
   As small as the text beside it; the negative margin keeps a line of text at its height. */
.help-btn {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin: -4px 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  font-size: 15px;
  line-height: 1;
  color: var(--color-text-muted);
  vertical-align: middle;
  cursor: help;
}

.help-btn:hover,
.help-btn:focus-visible {
  color: var(--color-accent);
  background: var(--color-accent-hover);
}

.help-btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 1px;
}

/* A finger needs more to hit than a mouse. */
@media (pointer: coarse) {
  .help-btn {
    width: 32px;
    height: 32px;
    margin: -8px 0;
  }
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* -------------------------------------------------------- 7. Cards and panels */

/* White surface, 1px line border, 14px radius. */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
}

.card--padded {
  padding: 16px;
}

.card--clickable {
  cursor: pointer;
}

.card--clickable:hover {
  border-color: var(--color-border-strong);
  box-shadow: var(--shadow);
}

/* A card with a 4px status-coloured left edge (live issue cards). */
.card--accent {
  overflow: hidden;
  border-left: 4px solid var(--accent-color, var(--color-accent));
}

/* A card with the website's soft navy shadow. */
.panel {
  padding: 16px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
}

.panel--lg {
  padding: 48px 24px;
}

.card__title {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-heading);
}

/* Collapsible section (ExpansionTile): <details class="expander"><summary>…</summary>…</details> */
.expander > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 4px;
  font-weight: 600;
  color: var(--color-heading);
  list-style: none;
  cursor: pointer;
}

.expander > summary::-webkit-details-marker {
  display: none;
}

.expander > summary::after {
  content: '';
  width: 8px;
  height: 8px;
  margin: 0 8px 4px;
  border-right: 2px solid var(--color-text-muted);
  border-bottom: 2px solid var(--color-text-muted);
  transform: rotate(45deg);
  transition: transform 0.12s ease;
}

.expander[open] > summary::after {
  margin-bottom: -4px;
  transform: rotate(-135deg);
}

/* --------------------------------------------------- 8. Tags, chips and dots */

/* Rounded pill label: solid text on a 12% tint. Set --tag-color for another colour. */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--tag-color, var(--color-accent-text)) 12%, transparent);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.4px;
  color: var(--tag-text, var(--tag-color, var(--color-accent-text)));
  white-space: nowrap;
}

.tag .bi {
  font-size: 14px;
}

.tag--ok {
  --tag-color: var(--status-ok);
}

.tag--info {
  --tag-color: var(--status-info);
}

.tag--warning {
  --tag-color: var(--status-warning);
  --tag-text: var(--color-warning-text);
}

.tag--error {
  --tag-color: var(--status-error);
}

.tag--unknown {
  --tag-color: var(--status-unknown);
  --tag-text: var(--color-text-muted);
}

.tag--orange {
  --tag-color: var(--orange);
  --tag-text: var(--color-orange-text);
}

/* Status chip: a dot and a label on a 14% tint. Set --chip-color. */
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 2px 6px;
  border: 0;
  border-radius: 6px;
  background: color-mix(in srgb, var(--chip-color, var(--status-unknown)) 14%, transparent);
  font-size: 14px;
  line-height: 1.4;
  color: var(--color-text);
}

button.status-chip {
  cursor: pointer;
}

button.status-chip:hover {
  background: color-mix(in srgb, var(--chip-color, var(--status-unknown)) 24%, transparent);
}

.status-chip__label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-dot {
  display: inline-block;
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--chip-color, var(--status-unknown));
}

/* Square badge that holds an icon (empty states, feature lists). */
.icon-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: var(--color-accent-selected);
  font-size: 26px;
  color: var(--color-accent-text);
}

/* ------------------------------------------------------ 9. Fields and selects */

/*
 * Outlined field with a floating label:
 *   <label class="field">
 *     <input class="field__input" placeholder=" ">
 *     <span class="field__label">Username</span>
 *   </label>
 *   <div class="field__error">…</div>
 * The placeholder must be a single space for the label to float.
 */
.field {
  position: relative;
  display: block;
}

.field__input {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 14px 12px;
  border: 1px solid var(--color-field-outline);
  border-radius: var(--radius-field);
  background: var(--field-fill, var(--color-field-fill));
  font-size: 16px;
  line-height: 1.2;
  color: var(--color-text);
  outline: none;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.field__input:hover {
  border-color: var(--color-text-muted);
}

.field__input:focus {
  border-color: var(--color-focus);
  box-shadow: inset 0 0 0 1px var(--color-focus);
}

.field__input:disabled {
  border-color: var(--color-border);
  color: var(--color-text-disabled);
}

.field__label {
  position: absolute;
  top: 14px;
  left: 9px;
  max-width: calc(100% - 18px);
  padding: 0 4px;
  overflow: hidden;
  border-radius: 4px;
  background: var(--field-fill, var(--color-field-fill));
  font-size: 16px;
  line-height: 1.2;
  color: var(--color-text-muted);
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
  transition: top 0.12s ease, font-size 0.12s ease, color 0.12s ease;
}

.field__input:focus ~ .field__label,
.field__input:not(:placeholder-shown) ~ .field__label,
select.field__input ~ .field__label {
  top: -8px;
  font-size: 12px;
  font-weight: 600;
}

.field__input:focus ~ .field__label {
  color: var(--color-accent-text);
}

.field.has-error .field__input {
  border-color: var(--status-error);
}

.field.has-error .field__input:focus {
  box-shadow: inset 0 0 0 1px var(--status-error);
}

.field.has-error .field__label {
  color: var(--status-error);
}

.field__error {
  margin: 4px 12px 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--status-error);
}

.field__helper {
  margin: 4px 12px 0;
  font-size: 12px;
  color: var(--color-text-muted);
}

/* An icon button inside the right end of a field (show/hide password): add .field--has-action to the .field. */
.field--has-action .field__input {
  padding-right: 52px;
}

.field__action {
  position: absolute;
  top: 50%;
  right: 2px;
  width: 44px;
  height: 44px;
  transform: translateY(-50%);
  color: var(--color-text-muted);
}

/* A field whose value differs from the saved one (boundary settings editor). */
.field--changed {
  --field-fill: var(--color-field-changed);
}

.field--compact .field__input {
  min-height: 40px;
  padding: 10px 12px;
  font-size: 14px;
}

.field--compact .field__label {
  top: 11px;
  font-size: 14px;
}

select.field__input {
  padding-right: 36px;
  appearance: none;
  background-image: var(--select-arrow);
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px;
  cursor: pointer;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* A message block inside a form (login failure). */
.form-error {
  padding: 10px 12px;
  border-radius: var(--radius-field);
  background: var(--color-error-tint);
  font-size: 14px;
  font-weight: 500;
  color: var(--color-error-text);
}

/* A feature the current server cannot provide (api capabilities), and why. */
.capability-note {
  margin: 0;
  padding: 8px 12px;
  border-radius: var(--radius-field);
  background: var(--color-accent-tint);
  font-size: 13px;
  line-height: 1.45;
  color: var(--color-on-accent-tint);
}

/* ---------------------------------------------------- 10. Switch and checkbox */

/*
 * Switch row (SwitchListTile):
 *   <label class="switch-row"><span class="switch-row__label">…</span>
 *     <span class="switch"><input type="checkbox"><span class="switch__track"></span></span></label>
 */
.switch-row,
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 6px 16px;
  font-size: 14px;
  color: var(--color-text);
  cursor: pointer;
}

.switch-row {
  justify-content: space-between;
}

.switch-row:hover,
.checkbox-row:hover {
  background: var(--color-row-hover);
}

.switch-row__label,
.checkbox-row__label {
  flex: 1;
  min-width: 0;
}

.switch {
  position: relative;
  display: inline-block;
  flex: none;
  width: 44px;
  height: 26px;
}

.switch input {
  position: absolute;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.switch__track {
  position: absolute;
  inset: 0;
  border: 2px solid var(--color-field-outline);
  border-radius: var(--radius-pill);
  background: var(--color-surface-sunken);
  pointer-events: none;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}

.switch__track::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--color-text-muted);
  transform: translateY(-50%);
  transition: left 0.12s ease, width 0.12s ease, height 0.12s ease, background-color 0.12s ease;
}

.switch input:checked + .switch__track {
  border-color: transparent;
  background: var(--color-accent);
}

.switch input:checked + .switch__track::after {
  left: 20px;
  width: 18px;
  height: 18px;
  background: var(--color-on-accent);
}

.switch input:disabled + .switch__track {
  opacity: 0.5;
}

.switch input:focus-visible + .switch__track {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

/* Checkbox: <label class="checkbox-row"><input class="checkbox" type="checkbox"><span>…</span></label> */
.checkbox {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 0;
  border: 1.5px solid var(--color-text-muted);
  border-radius: 4px;
  background: transparent;
  appearance: none;
  cursor: pointer;
}

.checkbox:checked {
  border-color: var(--color-accent);
  background: var(--color-accent)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23fff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.5 8.5l3 3 6-7'/%3E%3C/svg%3E")
    center / 14px no-repeat;
}

/* Some of what it stands for is ticked (set `indeterminate` on the input from script). */
.checkbox:indeterminate {
  border-color: var(--color-accent);
  background: var(--color-accent)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23fff' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M4 8h8'/%3E%3C/svg%3E")
    center / 14px no-repeat;
}

.checkbox:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.checkbox-row--compact {
  min-height: 32px;
  padding: 2px 8px;
}

/* -------------------------------------------------------------------- 11. Tabs */

.tabs {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.tabs__list {
  display: flex;
  flex: none;
  border-bottom: 1px solid var(--color-border);
}

.tabs__tab {
  display: inline-flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 44px;
  padding: 8px 12px;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: transparent;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-muted);
  cursor: pointer;
}

.tabs__tab .bi {
  font-size: 18px;
}

.tabs__tab:hover {
  background: var(--color-accent-hover);
}

.tabs__tab.is-selected {
  border-bottom-color: var(--color-accent);
  font-weight: 600;
  color: var(--color-heading);
}

.tabs__panel {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.tabs__panel[hidden] {
  display: none;
}

/* ------------------------------------------------------ 11b. Segmented control */

/*
 * components/segmented.js: a row of toggle buttons, one pressed (aria-pressed).
 * Timeline layout switch, Overview range, Appearance (Settings, display options).
 */
.segmented {
  display: inline-flex;
  flex: none;
  max-width: 100%;
  padding: 2px;
  border: 1px solid var(--color-field-outline);
  border-radius: var(--radius-button);
  background: var(--color-field-fill);
}

.segmented__option {
  min-height: 34px;
  padding: 4px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--color-heading);
  white-space: nowrap;
  cursor: pointer;
}

.segmented__option:hover {
  background: var(--color-hover);
}

.segmented__option[aria-pressed='true'] {
  background: var(--color-accent-tint);
  color: var(--color-on-accent-tint);
}

.segmented__option:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 0;
}

.segmented--sm .segmented__option {
  min-height: 30px;
  padding: 2px 10px;
}

/* Fills its row; the options share it equally (sheets, the Appearance choice). */
.segmented--block {
  display: flex;
  width: 100%;
}

.segmented--block .segmented__option {
  flex: 1 1 0;
  min-height: 44px;
}

/* ------------------------------------------------------------------ 12. Dialog */

.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: var(--scrim);
}

.dialog {
  display: flex;
  flex-direction: column;
  width: 560px;
  max-width: 100%;
  max-height: 100%;
  overflow: hidden;
  border-radius: var(--radius-card);
  background: var(--color-surface-raised);
  box-shadow: var(--shadow-lg);
  outline: none;
}

/* 90% of the window in both directions (scan, scanner, space-time, boundary dialogs). */
.dialog--full {
  width: 90vw;
  height: 90vh;
}

.dialog__header {
  display: flex;
  flex: none;
  align-items: center;
  gap: 12px;
  padding: 16px 16px 8px 24px;
}

.dialog__title {
  flex: 1;
  min-width: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--color-heading);
}

.dialog__body {
  position: relative;
  flex: 1;
  min-height: 0;
  padding: 8px 24px 24px;
  overflow: auto;
}

/* For content that fills the dialog edge to edge (3D viewers). */
.dialog__body--flush {
  padding: 0;
}

.dialog__footer {
  display: flex;
  flex: none;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 24px 20px;
}

/* A close button over flush content when the dialog has no title bar. */
.dialog__close--floating {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  background: color-mix(in srgb, var(--color-surface-raised) 85%, transparent);
}

/* The drag handle of a bottom sheet; only shown on phones. */
.sheet__handle {
  display: none;
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--color-border-strong);
}

/*
 * Phones (below 600px): a dialog is a full-screen sheet. The title bar stays at
 * the top, the body scrolls, the footer (actions) stays at the bottom. The
 * widths and heights given to openDialog are ignored. `.dialog--bottom`
 * (openDialog phoneLayout: 'bottom') is a bottom sheet sized to its content.
 */
@media (max-width: 599.98px) {
  .dialog-backdrop {
    align-items: stretch;
    padding: 0;
  }

  .dialog,
  .dialog--full {
    width: 100% !important;
    max-width: none;
    height: 100% !important;
    max-height: none;
    border-radius: 0;
    box-shadow: none;
  }

  .dialog__header {
    min-height: calc(56px + env(safe-area-inset-top, 0px));
    padding: calc(6px + env(safe-area-inset-top, 0px)) max(6px, env(safe-area-inset-right, 0px)) 6px max(16px, env(safe-area-inset-left, 0px));
    border-bottom: 1px solid var(--color-border);
  }

  .dialog__title {
    font-size: 18px;
  }

  .dialog__header .icon-btn,
  .dialog__close--floating {
    width: 44px;
    height: 44px;
  }

  .dialog__close--floating {
    top: calc(6px + env(safe-area-inset-top, 0px));
    right: max(6px, env(safe-area-inset-right, 0px));
  }

  .dialog__body {
    padding: 16px max(16px, env(safe-area-inset-right, 0px)) calc(24px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
    overscroll-behavior: contain;
  }

  .dialog__body:has(+ .dialog__footer) {
    padding-bottom: 16px;
  }

  .dialog__body.dialog__body--flush {
    padding: 0;
  }

  .dialog__footer {
    padding: 12px max(16px, env(safe-area-inset-right, 0px)) calc(12px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
    border-top: 1px solid var(--color-border);
    background: var(--color-surface-raised);
  }

  .dialog__footer > .btn {
    flex: 1 1 auto;
    min-height: 48px;
  }

  .dialog-backdrop--bottom {
    align-items: flex-end;
    padding-top: calc(24px + env(safe-area-inset-top, 0px));
  }

  .dialog--bottom {
    position: relative;
    height: auto !important;
    max-height: 100%;
    border-radius: 16px 16px 0 0;
    box-shadow: var(--shadow-lg);
  }

  .dialog--bottom .dialog__header {
    min-height: 0;
    padding-top: 22px;
    border-bottom: 0;
    touch-action: none;
  }

  .dialog--bottom .sheet__handle {
    position: absolute;
    top: 8px;
    left: 50%;
    display: block;
    transform: translateX(-50%);
  }

  .dialog--bottom .dialog__footer {
    border-top: 0;
  }
}

/* -------------------------------------------------------------- 13. Popup menu */

.menu {
  position: fixed;
  z-index: 1100;
  min-width: 180px;
  max-width: calc(100vw - 16px);
  padding: 8px 0;
  overflow: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-menu);
  background: var(--color-surface-raised);
  box-shadow: var(--shadow-raised);
}

.menu__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  padding: 8px 16px;
  border: 0;
  background: transparent;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text);
  text-align: left;
  cursor: pointer;
}

.menu__item:hover,
.menu__item:focus-visible {
  background: var(--color-row-hover);
}

.menu__item:disabled {
  color: var(--color-text-muted);
  cursor: default;
}

.menu__item:disabled:hover {
  background: transparent;
}

.menu__item--danger {
  color: var(--status-error);
}

.menu__item .bi {
  font-size: 16px;
  color: var(--color-heading);
}

/* Non-interactive first line of a menu (account menu's welcome text). */
.menu__header {
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 700;
  color: var(--color-heading);
}

/* Label above a group of items (a submenu shown inline). */
.menu__group-label {
  padding: 8px 16px 2px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.menu__divider {
  height: 1px;
  margin: 8px 0;
  background: var(--color-border);
}

/* Free-form content inside a menu (site selector, display options). */
.menu__section {
  padding: 8px 16px;
}

.menu__scroll {
  max-height: min(60vh, 560px);
  overflow: auto;
}

/* ui.js focuses the menu when it opens, for the arrow keys; no ring around the whole menu. */
.menu:focus {
  outline: none;
}

/* A text link at the end of a menu ("All settings"). */
.menu__footer-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: 44px;
  padding: 8px 16px;
  border: 0;
  border-top: 1px solid var(--color-border);
  margin-top: 8px;
  margin-bottom: -8px;
  background: transparent;
  font-weight: 600;
  color: var(--color-accent-text);
  cursor: pointer;
}

.menu__footer-link:hover {
  background: var(--color-accent-hover);
}

/*
 * Phones: openMenu shows the menu as a bottom sheet over a backdrop:
 *   <div class="menu-backdrop"><div class="menu menu--sheet">
 *     <div class="menu__grip"><span class="sheet__handle"></span><div class="menu__sheet-title">…</div></div>
 *     …items or content…
 *   </div></div>
 */
.menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: flex-end;
  padding-top: calc(24px + env(safe-area-inset-top, 0px));
  background: var(--scrim);
}

.menu.menu--sheet {
  position: relative;
  width: 100%;
  min-width: 0;
  max-width: none;
  max-height: 100%;
  padding: 0 env(safe-area-inset-right, 0px) calc(8px + env(safe-area-inset-bottom, 0px)) env(safe-area-inset-left, 0px);
  border: 0;
  border-radius: 16px 16px 0 0;
  box-shadow: var(--shadow-lg);
  overscroll-behavior: contain;
}

.menu__grip {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 0 0;
  background: var(--color-surface-raised);
  touch-action: none;
}

.menu--sheet .sheet__handle {
  display: block;
  margin-bottom: 8px;
}

.menu__sheet-title {
  align-self: stretch;
  padding: 4px 20px 12px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 8px;
  font-size: 16px;
  font-weight: 700;
  color: var(--color-heading);
}

.menu--sheet .menu__item {
  min-height: 52px;
  padding: 12px 20px;
  gap: 14px;
  font-size: 16px;
}

.menu--sheet .menu__item .bi {
  font-size: 20px;
}

.menu--sheet .switch-row,
.menu--sheet .checkbox-row {
  min-height: 52px;
  padding: 8px 20px;
  font-size: 16px;
}

.menu--sheet .checkbox {
  width: 22px;
  height: 22px;
}

.menu--sheet .menu__header,
.menu--sheet .menu__group-label,
.menu--sheet .menu__section {
  padding-left: 20px;
  padding-right: 20px;
}

/* The sheet scrolls as a whole; no scroll area inside it. */
.menu--sheet .menu__scroll {
  max-height: none;
  overflow: visible;
}

.menu--sheet .menu__footer-link {
  min-height: 52px;
  margin-bottom: 0;
  font-size: 16px;
}

/* Sheets slide in; nothing moves for people who ask for reduced motion. */
@media (max-width: 599.98px) and (prefers-reduced-motion: no-preference) {
  .dialog-backdrop,
  .menu-backdrop {
    animation: overlay-fade-in 0.18s ease-out;
  }

  /* A full-screen sheet comes down from the top and leaves the same way, as the classic
     Hyperion dialogs do on a phone; a bottom sheet rises from, and sinks to, the bottom. */
  .dialog {
    animation: sheet-slide-down 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  }

  .dialog--bottom,
  .menu--sheet {
    animation: sheet-slide-up 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
  }

  /* Closing (ui.js keeps the backdrop for CLOSE_SLIDE_MS): no input, and the sheet slides away. */
  .dialog-backdrop.is-closing {
    pointer-events: none;
    animation: overlay-fade-out 0.22s ease-in forwards;
  }

  .dialog-backdrop.is-closing .dialog {
    animation: sheet-leave-up 0.22s ease-in forwards;
  }

  .dialog-backdrop.is-closing .dialog--bottom {
    animation: sheet-leave-down 0.22s ease-in forwards;
  }

  .dialog--bottom:not(.is-dragging),
  .menu--sheet:not(.is-dragging) {
    transition: transform 0.18s ease-out;
  }
}

@keyframes overlay-fade-in {
  from {
    opacity: 0;
  }
}

@keyframes sheet-rise {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
}

@keyframes sheet-slide-up {
  from {
    transform: translateY(100%);
  }
}

@keyframes sheet-slide-down {
  from {
    transform: translateY(-100%);
  }
}

@keyframes overlay-fade-out {
  to {
    opacity: 0;
  }
}

@keyframes sheet-leave-up {
  to {
    transform: translateY(-100%);
  }
}

@keyframes sheet-leave-down {
  to {
    transform: translateY(100%);
  }
}

/* ------------------------------------------------------------------- 14. Table */

.table {
  width: 100%;
  border-collapse: collapse;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

.table th,
.table td {
  padding: 10px 12px;
  text-align: left;
  vertical-align: middle;
}

.table th {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-muted);
}

.table tr + tr td,
.table thead + tbody tr:first-child td {
  border-top: 1px solid var(--color-border);
}

.table--hover tbody tr:hover {
  background: var(--color-row-hover);
}

.table td.num,
.table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Label/value pairs (scanner details, boundary entry info). */
.kv {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 16px;
  margin: 0;
}

.kv dt {
  color: var(--color-text-muted);
}

.kv dd {
  margin: 0;
  overflow-wrap: anywhere;
}

/* ----------------------------------------------------------------- 15. Tooltip */

/* Floating tooltip positioned by ui.js. */
.tooltip {
  position: fixed;
  z-index: 1200;
  max-width: 400px;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--color-tooltip-bg);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--color-tooltip-text);
  white-space: pre-line;
  pointer-events: none;
}

/* CSS-only tooltip for static text: <button data-tooltip="Refresh">. */
/* :where keeps this at zero specificity, so a class that positions the element wins. */
:where([data-tooltip]) {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  z-index: 1200;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--color-tooltip-bg);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.4;
  color: var(--color-tooltip-text);
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transform: translateX(-50%);
  pointer-events: none;
  transition: opacity 0.12s ease 0.3s, visibility 0s linear 0.3s;
}

[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after {
  opacity: 1;
  visibility: visible;
}

/* Keeps the tooltip of a control at the right edge of the window on screen. */
[data-tooltip][data-tooltip-align='end']::after {
  right: 0;
  left: auto;
  transform: none;
}

[data-tooltip].is-open::after {
  display: none;
}

/* Touch screens have no hover: a tap would leave the tooltip stuck on screen. */
@media (hover: none) {
  [data-tooltip]::after {
    display: none;
  }
}

/* ------------------------------------------------------ 16. Spinner and loading */

.spinner {
  display: inline-block;
  flex: none;
  width: 36px;
  height: 36px;
  border: 4px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner--sm {
  width: 22px;
  height: 22px;
  border-width: 2.5px;
}

/* On a filled (purple or navy) background. */
.spinner--light {
  border-color: rgba(255, 255, 255, 0.35);
  border-top-color: var(--color-on-accent);
}

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

/* Spinner with an optional message, centred in its container. */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 120px;
  height: 100%;
  color: var(--color-text-muted);
}

/* Covers a positioned parent while its content reloads. */
.loading-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-veil);
}

.is-busy {
  opacity: 0.5;
}

/* ------------------------------------------------------------------- 17. Toast */

.toast-host {
  position: fixed;
  bottom: 24px;
  left: 50%;
  z-index: 1300;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: calc(100vw - 32px);
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border-radius: var(--radius-button);
  background: var(--color-toast-bg);
  font-size: 14px;
  font-weight: 500;
  color: var(--color-toast-text);
  pointer-events: auto;
}

.toast--error {
  background: var(--color-toast-error-bg);
}

/* On a phone at the top, under the header (60px in next.css): at the bottom they covered the buttons of the
   bottom bar, of the dialogs and of the sheets. */
@media (max-width: 719.98px) {
  .toast-host {
    top: calc(68px + env(safe-area-inset-top, 0px));
    bottom: auto;
  }
}

.toast__action {
  padding: 0;
  border: 0;
  background: transparent;
  font-weight: 700;
  color: var(--color-toast-action);
  cursor: pointer;
}

/* The "x" at the end of a toast: the message goes before its time is up. */
.toast__close {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin: -6px -8px -6px -4px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  font-size: 14px;
  line-height: 1;
  color: var(--color-toast-text);
  opacity: 0.8;
  cursor: pointer;
}

.toast__close:hover,
.toast__close:focus-visible {
  opacity: 1;
  background: rgba(255, 255, 255, 0.12);
}

/* ------------------------------------------------- 18. Tree rows and strips */

/*
 * A site panel on the timeline is a .card holding a .tree. Each row has a
 * fixed-width label cell and a track that fills the rest:
 *   <div class="tree-row">
 *     <span class="tree-row__connector tree-row__connector--data"></span>
 *     <div class="tree-row__label">…</div>
 *     <div class="tree-row__track">…health strip…</div>
 *   </div>
 */
.tree {
  padding: 8px;
}

.tree-row {
  display: flex;
  align-items: center;
  min-height: 40px;
}

.tree-row--site {
  min-height: 80px;
}

.tree-row--group {
  min-height: 20px;
  font-weight: 600;
  color: var(--color-text-muted);
}

.tree-row__label {
  flex: none;
  width: 150px;
  padding-right: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tree-row--site .tree-row__label {
  width: 200px;
  font-size: 16px;
  font-weight: 600;
  color: var(--color-heading);
}

.tree-row--space .tree-row__label {
  font-weight: 600;
}

.tree-row--boundary .tree-row__label {
  color: var(--color-text-muted);
}

.tree-row__track {
  position: relative;
  flex: 1;
  min-width: 0;
}

/* Elbow connector drawn to the left of a row label. */
.tree-row__connector {
  flex: none;
  align-self: stretch;
  width: 15px;
  margin-right: 10px;
  background:
    linear-gradient(var(--connector-color), var(--connector-color)) left top / 2px 50% no-repeat,
    linear-gradient(var(--connector-color), var(--connector-color)) left center / 100% 2px no-repeat;
}

/* The vertical line carries on to the next sibling. */
.tree-row__connector--continue {
  background:
    linear-gradient(var(--connector-color), var(--connector-color)) left top / 2px 100% no-repeat,
    linear-gradient(var(--connector-color), var(--connector-color)) left center / 100% 2px no-repeat;
}

/* A pass-through line with no elbow (an ancestor that has later siblings). */
.tree-row__connector--line {
  margin-right: 0;
  background: linear-gradient(var(--connector-color), var(--connector-color)) left top / 2px 100% no-repeat;
}

.tree-row__connector--blank {
  margin-right: 0;
  background: none;
}

.tree-row__connector--data {
  --connector-color: var(--tree-data);
}

.tree-row__connector--hardware {
  --connector-color: var(--tree-hardware);
}

/* Base of a health strip: dots and bars over a time range. */
.health-strip {
  position: relative;
  width: 100%;
  height: 20px;
}

/* Severity colours as classes, for dots, bars and legends. */
.severity-debug {
  --severity-color: var(--status-ok);
}

.severity-info {
  --severity-color: var(--status-info);
}

.severity-warning {
  --severity-color: var(--status-warning);
}

.severity-error {
  --severity-color: var(--status-error);
}

/* ------------------------------------------------------------- 19. Empty state */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
}

.empty-state__title {
  margin-top: 10px;
  font-size: 16px;
  font-weight: 600;
  color: var(--color-heading);
}

.empty-state__text {
  max-width: 460px;
  line-height: 1.5;
  color: var(--color-text-muted);
}

/* -------------------------------------------------------------- 20. Login page */

.login {
  display: flex;
  height: 100%;
  padding: max(24px, env(safe-area-inset-top, 0px)) max(24px, env(safe-area-inset-right, 0px)) max(24px, env(safe-area-inset-bottom, 0px)) max(24px, env(safe-area-inset-left, 0px));
  overflow: auto;
  background: radial-gradient(1200px 500px at 85% -10%, #2A4470 0%, transparent 60%), var(--navy);
}

/* margin: auto centres the content but lets it scroll from its top when it is taller than the window
   (a phone with the keyboard open), where align-items: center would cut the top off. */
.login__inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 64px;
  width: 100%;
  max-width: 1120px;
  margin: auto;
}

.login__hero {
  display: none;
  flex: 1;
  min-width: 0;
}

.login__headline {
  margin: 18px 0 20px;
  font-size: 46px;
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.92px;
  color: var(--white);
}

.login__lead {
  max-width: 540px;
  margin: 0;
  font-size: 18px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.86);
}

.login__card {
  flex: none;
  width: 100%;
  max-width: 420px;
  padding: 32px;
  border-radius: var(--radius-card);
  background: var(--color-surface);
  box-shadow: var(--shadow-lg);
}

.login__title {
  margin: 10px 0 6px;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.56px;
  color: var(--color-heading);
}

.login__subtitle {
  margin: 0 0 24px;
  color: var(--color-text-muted);
}

.login__submit {
  margin-top: 8px;
}

/* The server choice: a collapsed line that names the server, opened to change it. */
.login__server {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-field);
}

.login__server > summary {
  min-height: 48px;
  padding: 8px 8px 8px 12px;
  gap: 8px;
  font-weight: 500;
}

.login__server-label {
  flex: none;
  color: var(--color-text-muted);
}

.login__server-value {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-weight: 600;
  color: var(--color-heading);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.login__server-body {
  padding: 8px 12px 12px;
}

@media (max-width: 599.98px) {
  .login {
    padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  }

  .login__card {
    padding: 24px 20px;
  }

  .login__title {
    font-size: 24px;
  }

  .login__subtitle {
    margin-bottom: 20px;
  }
}

/* At 900px and above the hero text sits beside the sign-in card. */
@media (min-width: 900px) {
  .login {
    padding: 40px 56px;
  }

  .login__hero {
    display: block;
  }
}

/* ---------------------------------------------------------- 20b. Settings page */

.settings {
  max-width: 760px;
  padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px));
}

.settings-section {
  margin-top: 24px;
  overflow: hidden;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
}

.settings-section__head {
  padding: 18px 20px 14px;
}

.settings-section__title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--color-heading);
}

.settings-section__title .bi {
  font-size: 18px;
  color: var(--color-accent-text);
}

.settings-section__desc {
  margin: 4px 0 0;
  color: var(--color-text-muted);
}

.settings-section__body {
  border-top: 1px solid var(--color-border);
}

.settings-section__footer {
  padding: 12px 20px 16px;
  border-top: 1px solid var(--color-border);
}

/* Switch rows of a settings section: large, with an optional hint under the label. */
.settings-section .switch-row,
.settings-section .checkbox-row {
  min-height: 56px;
  padding: 10px 20px;
  font-size: 15px;
}

.settings-section .switch-row + .switch-row,
.settings-section .checkbox-row + .checkbox-row {
  border-top: 1px solid var(--color-border);
}

.switch-row__hint {
  display: block;
  margin-top: 2px;
  font-size: 13px;
  color: var(--color-text-muted);
}

.settings-section .checkbox {
  width: 20px;
  height: 20px;
}

/* Site visibility: search, bulk buttons and a count above the list. */
.site-visibility__tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 12px 20px;
}

.site-visibility__search {
  flex: 1 1 220px;
  min-width: 0;
}

.site-visibility__search .field__input {
  min-height: 44px;
}

/* Links in the settings cards are 44px tall touch targets. */
.settings-kv a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.site-visibility__count {
  padding: 0 20px 8px;
  font-size: 13px;
  color: var(--color-text-muted);
}

.site-visibility__empty {
  padding: 16px 20px;
  color: var(--color-text-muted);
}

.site-visibility__list {
  border-top: 1px solid var(--color-border);
}

/* In the header menu: the site list scrolls inside the popup. */
.menu .site-visibility__tools {
  padding: 8px 16px;
}

.menu .site-visibility__count {
  padding: 0 16px 4px;
}

.menu .site-visibility__list {
  max-height: min(55vh, 520px);
  overflow: auto;
}

.menu--sheet .site-visibility__tools,
.menu--sheet .site-visibility__count {
  padding-left: 20px;
  padding-right: 20px;
}

.menu--sheet .site-visibility__list {
  max-height: none;
  overflow: visible;
}

@media (min-width: 600px) {
  .settings-section .site-visibility__list {
    max-height: 440px;
    overflow: auto;
  }
}

.settings-field {
  padding: 16px 20px;
  border-top: 1px solid var(--color-border);
}

/* The Appearance choice (a full-width .segmented). */
.settings-appearance {
  padding: 16px 20px;
}

/* Label/value rows of the Connection and About sections. */
.settings-kv {
  padding: 14px 20px;
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 20px 16px;
}

@media (max-width: 599.98px) {
  .settings {
    padding: 16px max(12px, env(safe-area-inset-right, 0px)) calc(32px + env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px));
  }

  .settings .page-title {
    font-size: 26px;
  }

  .settings-section {
    margin-top: 16px;
  }

  .settings-section__head {
    padding: 16px 16px 12px;
  }

  .settings-section .switch-row,
  .settings-section .checkbox-row,
  .site-visibility__tools,
  .site-visibility__count,
  .site-visibility__empty,
  .settings-appearance,
  .settings-field,
  .settings-kv {
    padding-left: 16px;
    padding-right: 16px;
  }

  .settings-actions {
    padding: 0 16px 16px;
  }

  .settings-actions > .btn {
    flex: 1 1 auto;
    min-height: 48px;
  }
}

/* --------------------------------------------------------------- 21. Utilities */

.row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.row--wrap {
  flex-wrap: wrap;
}

.row--between {
  justify-content: space-between;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.grow {
  flex: 1;
  min-width: 0;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-center {
  text-align: center;
}

.mt-8 {
  margin-top: 8px;
}

.mt-16 {
  margin-top: 16px;
}

.mt-24 {
  margin-top: 24px;
}

.hidden,
[hidden] {
  display: none !important;
}

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

/* ------------------------------------------------- 22. Responsive utilities */

/*
 * Breakpoints used across the app (CSS variables cannot be used in media queries):
 *   below 600px  phone: dialogs and menus are sheets (ui.isPhoneLayout())
 *   below 720px  the page links move to the bottom bar
 *   900px+       the login page shows its hero text
 * All of these are opt-in: none changes an existing class on a desktop.
 */

/* At least 44 x 44px, for small controls that are tapped. */
.touch-target {
  min-width: 44px;
  min-height: 44px;
}

/* A 44px icon button (the default .icon-btn is 40px). */
.icon-btn.icon-btn--lg {
  width: 44px;
  height: 44px;
}

/* Visible only above / only below the phone breakpoint. */
@media (max-width: 599.98px) {
  .hide-phone {
    display: none !important;
  }
}

@media (min-width: 600px) {
  .only-phone {
    display: none !important;
  }
}

/* .btn-row variants: right-aligned; buttons stacked full width on a phone. */
.btn-row--end {
  justify-content: flex-end;
}

@media (max-width: 599.98px) {
  .btn-row--stack-phone {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-row--stack-phone > .btn {
    width: 100%;
    min-height: 48px;
  }

  /* .btn-row--fill-phone: buttons share the row equally on a phone. */
  .btn-row--fill-phone > .btn {
    flex: 1 1 0;
    min-height: 48px;
  }
}

/* .kv variants: .kv--stack always puts the value under its label; .kv--responsive only on a phone. */
.kv--stack {
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
}

.kv--stack dd + dt {
  margin-top: 10px;
}

@media (max-width: 599.98px) {
  .kv--responsive {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .kv--responsive dd + dt {
    margin-top: 10px;
  }
}

/* Fields side by side that stack on a phone: <div class="form-row">field-group, field-group…</div>. */
.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.form-row > * {
  flex: 1 1 200px;
  min-width: 0;
}

@media (max-width: 599.98px) {
  .form-row > * {
    flex-basis: 100%;
  }

  /* .fields-phone-full: every field and select inside fills the width on a phone. */
  .fields-phone-full .field-group,
  .fields-phone-full .field,
  .fields-phone-full .field__input {
    width: 100%;
    max-width: none;
  }
}

/*
 * Actions pinned to the bottom of a scrolling area (a dialog body, a sheet, a page):
 * <div class="sheet-footer">buttons</div> as the last child of the scroller.
 * It keeps clear of the home indicator on phones.
 */
.sheet-footer {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--color-border);
  background: var(--color-surface-raised);
}

@media (max-width: 599.98px) {
  .sheet-footer > .btn {
    flex: 1 1 auto;
    min-height: 48px;
  }
}

/* Padding that keeps content clear of the notch / home indicator. */
.safe-bottom {
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.safe-top {
  padding-top: env(safe-area-inset-top, 0px);
}

/* A wide table scrolls sideways inside this wrapper instead of widening the page. */
.table-scroll {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
