/* ==========================================================================
   VISIONARY — shared stylesheet
   Tokens, shell chrome, and the UI kit every module builds with.
   Modules must not define their own colours. Use the tokens.

   Follows the Visions Group Design System: magenta with grey as an accent,
   ink #1D1D1B for type, page ground #F9F9FA, square cards, 2px controls,
   uppercase display headings, Figtree for running copy.
   ========================================================================== */

/* The hidden attribute always hides: component styles that set display
   (buttons are inline-flex) must not bring a hidden element back. */
[hidden] { display: none !important; }

/* --------------------------------------------------------------------------
   BRAND — light is the default, as in the design system.

   --brand is magenta-500 for fills, markers and the primary button.
   --accent is magenta-600 for magenta TYPE: magenta-500 is exactly 4.5:1 on
   white and drops under AA on the #F9F9FA page ground.

   Deviations from the design system, each for contrast on small text:
     --ok    #1b7a51  (status-success #1f8a5b is 4.3:1 on white)
     --warn  #9e5f00  (status-warning #b5760a is 3.8:1 on white)
   The depot colours are Visionary's own; the design system has none.
   -------------------------------------------------------------------------- */
:root {
  --brand:       #e6007e;   /* magenta-500 */
  --brand-deep:  #c4006b;   /* magenta-600: primary hover */
  --brand-press: #9e0056;   /* magenta-700: primary press */
  --accent:      #c4006b;   /* magenta type on light grounds */
  --accent-soft: #fde0ef;   /* magenta-100: quiet fills and borders */

  --ink:        #f9f9fa;    /* page ground (grey-50) */
  --surface:    #ffffff;    /* cards */
  --surface-2:  #f1f0f3;    /* grey-100: hover, subtle */
  --surface-3:  #e3e2e6;    /* grey-200: sunken */
  --line:       #c4c2c9;    /* grey-300: control borders */
  --line-soft:  #e3e2e6;    /* grey-200: card hairline */
  --text:       #1d1d1b;    /* grey-900: brand ink */
  --text-2:     #5b5a63;    /* grey-600 */
  --muted:      #74727b;    /* grey-500, the Pantone grey */
  --inverse:    #1d1d1b;    /* footer / ink bands */
  --on-brand:   #ffffff;

  --suttons:    #1f8078;
  --wayfields:  #8a6100;

  --warn:       #9e5f00;
  --danger:     #c00030;    /* status-danger */
  --ok:         #1b7a51;
  --info:       #2c6ba8;    /* status-info */

  /* Post-its on the logistics board, one colour per kind of run. Pale
     enough that --text holds AAA on every one. */
  --note-yellow: #fff2a8;
  --note-blue:   #d3e9ff;
  --note-green:  #d6f2d3;
  --note-pink:   #ffd9e9;

  /* Chart series, in this order only (never cycled): the first three slots
     of the data-viz reference palette, validated on --surface in both modes
     (adjacent CVD ΔE ≥ 9.2). --series-3 is under 3:1 on white, so charts
     carry visible values and a table view. */
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --note-orange: #ffe1c4;

  /* Pal label previews: black ink on a white sheet in either theme, as it prints. */
  --label-sheet: #ffffff;
  --label-ink:   #000000;
  --label-ref:   #a8a6ae;

  --r-sm: 2px;              /* controls */
  --r-md: 2px;              /* controls */
  --r-lg: 0;                /* cards and media are square */
  --sidebar-w: 252px;
  --rail-w: 72px;
  --tabbar-h: 64px;
  --touch: 44px;

  --font-display: "Archivo Black", system-ui, sans-serif;
  --font-body:    "Figtree", system-ui, sans-serif;
  --font-mono:    ui-monospace, "SFMono-Regular", Menlo, monospace;

  --shadow-sm: 0 1px 3px rgb(29 29 27 / .08), 0 1px 2px rgb(29 29 27 / .04);
  --shadow-md: 0 4px 12px rgb(29 29 27 / .09);
  --shadow-lg: 0 12px 32px rgb(29 29 27 / .12);
  --ring-focus: 0 0 0 3px rgb(230 0 126 / .35);

  --ease: cubic-bezier(.2,.7,.3,1);
  --ease-entrance: cubic-bezier(.16,1,.3,1);
  --fast: 150ms;
  --base: 250ms;

  color-scheme: light;
}

/* Dark — for the warehouse, night-time vehicle checks and wall screens.
   Built from the design system's grey ramp; magenta lifts to magenta-300
   for type so it holds AA on grey-800. */
[data-theme="dark"] {
  --brand:       #e6007e;
  --brand-deep:  #c4006b;
  --brand-press: #9e0056;
  --accent:      #f57fbb;   /* magenta-300 */
  --accent-soft: #4a0029;   /* magenta-900 */

  --ink:        #1d1d1b;    /* grey-900 */
  --surface:    #242328;
  --surface-2:  #2c2b31;    /* grey-800 */
  --surface-3:  #36353c;
  --line:       #5b5a63;    /* grey-600 */
  --line-soft:  #43424a;    /* grey-700 */
  --text:       #f9f9fa;
  --text-2:     #c4c2c9;    /* grey-300 */
  --muted:      #9e9ca5;    /* grey-400 */
  --inverse:    #141413;

  --suttons:    #3fb8ae;
  --wayfields:  #e0a32e;

  --warn:       #ef8b4a;
  --danger:     #f57a83;
  --ok:         #4fbd76;
  --info:       #7fb0e0;

  --note-yellow: #4d4517;
  --note-blue:   #1d3a56;
  --note-green:  #213f26;
  --note-pink:   #4f2238;

  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --note-orange: #4d3119;
  --label-sheet: #f4f4f5;
  --label-ink:   #000000;
  --label-ref:   #a8a6ae;

  --shadow-md: 0 4px 12px rgb(0 0 0 / .35);
  --shadow-lg: 0 12px 32px rgb(0 0 0 / .45);

  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }

body {
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  box-shadow: var(--ring-focus);
}

/* Eyebrow — structural labels. Uppercase, 0.14em, as the design system's
   eyebrows and micro-labels. */
.stencil {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
}

/* ==========================================================================
   AUTH GATE
   ========================================================================== */
#gate { position: fixed; inset: 0; display: grid; place-items: center;
        background: var(--ink); z-index: 100; padding: 24px; }
#gate[hidden] { display: none; }

.gate-card {
  width: 100%; max-width: 400px; background: var(--surface);
  border: 1px solid var(--line-soft); border-top: 4px solid var(--brand);
  padding: 32px 28px;
}

.gate-card h1 {
  font-family: var(--font-display); font-weight: 400; text-transform: uppercase;
  font-size: 34px; letter-spacing: -.015em; line-height: .98; margin: 0 0 10px;
}
.gate-card h1 em { font-style: normal; color: var(--accent); }
.gate-logo { display: block; width: 210px; height: auto; margin: 0 0 14px; }
.gate-app { display: block; font-size: 22px; }
.gate-card p { color: var(--text-2); margin: 0 0 28px; }

.gate-rule { width: 40px; height: 2px; background: var(--brand); margin: 0 0 20px; }
.gate-meta { color: var(--muted); margin-bottom: 14px; }

.btn-signin {
  width: 100%; display: flex; align-items: center; justify-content: center;
  gap: 10px; min-height: var(--touch); padding: 12px 16px;
  background: var(--brand); color: var(--on-brand);
  border: 0; border-radius: var(--r-md); font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em; font-size: 13px;
  transition: background-color var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.btn-signin:hover { background: var(--brand-deep); }
.btn-signin:active { background: var(--brand-press); transform: scale(.985); }

.gate-error {
  margin-top: 16px; padding: 11px 13px; border: 1px solid var(--danger);
  border-radius: var(--r-md); color: var(--danger); font-size: 13px;
}
.gate-error[hidden] { display: none; }

/* ==========================================================================
   SHELL
   Three layouts from one markup, chosen by width:
     under 640px   phone    — bottom tab bar, sidebar as a drawer
     640–1024px    tablet   — icon rail that expands over the content
     over 1024px   desktop  — full side nav
   ========================================================================== */
#app { display: none; }
#app.ready { display: block; }

.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
  background: var(--surface); border-right: 1px solid var(--line-soft);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}

.brand {
  padding: 24px 20px 20px; font-family: var(--font-display);
  text-transform: uppercase; font-size: 21px; letter-spacing: -.015em; line-height: .98;
}
.brand em { font-style: normal; color: var(--accent); }
.brand-logo { display: block; width: 150px; height: auto; }
.brand-v { display: none; }
.brand-sub {
  display: block; margin-top: 8px; color: var(--muted);
  font-family: var(--font-body); letter-spacing: .14em;
}

.nav { flex: 1; padding: 4px 12px 20px; }
.nav-group { margin-bottom: 18px; }
.nav-group > .stencil { display: block; padding: 0 8px 8px; color: var(--muted); }

.nav-item {
  position: relative; display: flex; align-items: center; gap: 10px;
  min-height: 36px; padding: 8px; color: var(--text-2); font-size: 14px;
  transition: background-color var(--fast) var(--ease), color var(--fast) var(--ease);
}
.nav-item::after {
  content: ""; position: absolute; left: 8px; right: 8px; bottom: 4px; height: 2px;
  background: var(--brand); transform: scaleX(0); transform-origin: left;
  transition: transform var(--base) var(--ease);
}
.nav-item:hover { color: var(--accent); }
.nav-item:hover::after { transform: scaleX(1); }
.nav-item.on { background: var(--surface-2); color: var(--text); font-weight: 600; }
.nav-item.on svg { color: var(--accent); opacity: 1; }
.nav-item.is-soon { color: var(--muted); cursor: default; }
.nav-item.is-soon:hover { color: var(--muted); }
.nav-item.is-soon:hover::after { transform: scaleX(0); }
.nav-item svg { flex: none; width: 18px; height: 18px; opacity: .8; }

/* Depot dot — Visionary's own coding, not a design-system device */
.nav-item[data-depot]::before {
  content: ""; order: 3; margin-left: auto; width: 6px; height: 6px;
  border-radius: 999px; background: var(--suttons); flex: none;
}
.nav-item[data-depot="wayfields"]::before { background: var(--wayfields); }
.nav-item[data-depot="both"]::before {
  background: linear-gradient(90deg, var(--suttons) 0 50%, var(--wayfields) 50% 100%);
}

.sidebar-foot {
  padding: 14px 20px 18px; border-top: 1px solid var(--line-soft);
  color: var(--muted); display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.sidebar-foot .btn-out { display: none; margin-left: auto; }

.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center;
  gap: 14px; padding: 12px 28px; min-height: 64px;
  background: var(--surface); border-bottom: 1px solid var(--line-soft);
  transition: box-shadow var(--base) var(--ease);
}
.topbar.is-scrolled { box-shadow: var(--shadow-sm); }

.search {
  flex: 1; max-width: 420px; display: flex; align-items: center; gap: 9px;
  min-height: 40px; padding: 0 12px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-md);
  transition: border-color var(--fast) var(--ease);
}
.search:hover { border-color: var(--muted); }
.search:focus-within { border-color: var(--brand); box-shadow: var(--ring-focus); }
.search svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
.search input {
  flex: 1; background: none; border: 0; outline: none;
  color: var(--text); font: inherit; min-width: 0;
}
.search input::placeholder { color: var(--muted); }
.search kbd {
  font-family: var(--font-mono); font-size: 11px; padding: 1px 6px;
  border: 1px solid var(--line); border-radius: var(--r-sm); color: var(--muted);
}

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }

#push[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); }
.icon-btn {
  display: grid; place-items: center; width: 40px; height: 40px;
  background: transparent; border: 1px solid var(--line);
  border-radius: var(--r-md); color: var(--text);
  transition: background-color var(--fast) var(--ease), color var(--fast) var(--ease),
              border-color var(--fast) var(--ease);
}
.icon-btn:hover { background: var(--text); border-color: var(--text); color: var(--surface); }
.icon-btn svg { width: 18px; height: 18px; }

/* Offline / unsent indicator, filled by hub-outbox.js */
.sync-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px;
  border-radius: 999px; border: 1px solid var(--warn); color: var(--warn);
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  white-space: nowrap;
}
.sync-pill[hidden] { display: none; }
.sync-pill.is-offline { border-color: var(--danger); color: var(--danger); }

.who { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 36px; height: 36px; border-radius: 999px; background: var(--accent-soft);
  display: grid; place-items: center; font-size: 12px; font-weight: 700;
  color: var(--accent); overflow: hidden; flex: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.who-text { line-height: 1.25; }
.who-name { font-size: 14px; font-weight: 600; }
.who-role { color: var(--muted); }

.btn-out {
  min-height: 40px; padding: 0 14px; background: transparent;
  border: 1px solid var(--text); border-radius: var(--r-md); color: var(--text);
  font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  transition: background-color var(--fast) var(--ease), color var(--fast) var(--ease);
}
.btn-out:hover { background: var(--text); color: var(--surface); }

.content { padding: 32px 28px 72px; }

/* Bottom tab bar — phones only. Built from the registry in hub.js. */
.tabbar { display: none; }

/* ==========================================================================
   HOME GRID
   ========================================================================== */
.section { margin-bottom: 40px; }

.section-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.section-head .stencil { color: var(--accent); flex: none; }
.section-head .rule { flex: 1; height: 1px; background: var(--line-soft); }
.section-head .count { font-family: var(--font-mono); font-size: 11px; color: var(--muted); flex: none; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(288px, 1fr)); gap: 16px; }

.tile {
  position: relative; display: block; padding: 20px; background: var(--surface);
  border: 1px solid var(--line-soft); border-radius: var(--r-lg); overflow: hidden;
  transition: border-color var(--base) var(--ease), box-shadow var(--base) var(--ease),
              transform var(--base) var(--ease);
}
/* Magenta rule wipes across the bottom on hover */
.tile::before {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px;
  background: var(--brand); transform: scaleX(0); transform-origin: left;
  transition: transform var(--base) var(--ease); pointer-events: none;
}
.tile:hover { border-color: var(--brand); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.tile:hover::before { transform: scaleX(1); }
.tile.is-soon { border-style: dashed; border-color: var(--line); background: transparent; pointer-events: none; }
.tile.is-soon h3, .tile.is-soon p { color: var(--muted); }
.tile.is-soon:hover { transform: none; box-shadow: none; }

/* Depot marker — a 3px band across the top */
.tile[data-depot]::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; }
.tile[data-depot="suttons"]::after   { background: var(--suttons); }
.tile[data-depot="wayfields"]::after { background: var(--wayfields); }
.tile[data-depot="both"]::after {
  background: linear-gradient(90deg, var(--suttons) 0 50%, var(--wayfields) 50% 100%);
}

.tile-top { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 16px; position: relative; }
.tile-icon {
  display: grid; place-items: center; width: 40px; height: 40px;
  background: var(--accent-soft); color: var(--accent); flex: none;
}
.tile-icon svg { width: 20px; height: 20px; }
.tile-code { margin-left: auto; color: var(--muted); padding-top: 4px; }

.tag {
  font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted);
  margin-left: auto; flex: none;
}
.tag.soon { border-color: var(--line); color: var(--muted); }
.tag.beta { border-color: var(--accent); color: var(--accent); }

.tile h3 {
  font-family: var(--font-display); font-weight: 400; text-transform: uppercase;
  font-size: 16px; letter-spacing: -.005em; line-height: 1.1;
  margin: 0 0 8px; position: relative;
}
.tile p { margin: 0; color: var(--text-2); font-size: 14px; position: relative; max-width: 66ch; }

.pin {
  position: absolute; bottom: 10px; right: 10px; width: var(--touch); height: var(--touch);
  display: grid; place-items: center; border: 0; background: none;
  color: var(--muted); opacity: 0;
  transition: opacity var(--fast) var(--ease), color var(--fast) var(--ease);
}
.tile:hover .pin, .pin.on, .pin:focus-visible { opacity: 1; }
.pin.on { color: var(--accent); }
.pin:hover { color: var(--accent); }
.pin svg { width: 16px; height: 16px; }
@media (hover: none) { .pin { opacity: 1; } }

.empty {
  padding: 56px 20px; text-align: center; color: var(--muted);
  border: 1px dashed var(--line);
}
.empty strong { display: block; color: var(--text); font-size: 16px; margin-bottom: 6px; }

/* ==========================================================================
   HOME DASHBOARD — hub-dashboard.js. A diary of jobs, one row per day;
   today's numbers and your tools beside it on a desk, above it on a phone.
   ========================================================================== */
.dash-cols { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
.dash-side { display: grid; gap: 24px; position: sticky; top: 88px; align-content: start;
  /* Pinned beside the calendar, but never taller than the screen: it scrolls on its own. */
  max-height: calc(100vh - 104px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }

.cal { margin-bottom: 0; }
.cal-head h3 { font-size: 18px; }
.cal-nav { display: flex; gap: 6px; }
.cal-step { width: 40px; padding: 0; }
.cal-step svg { width: 18px; height: 18px; }
.cal-step--next svg { transform: scaleX(-1); }
.cal-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  padding: 12px 20px; border-bottom: 1px solid var(--line-soft); }
.cal-filters .h-select { width: auto; }
.cal-sync { margin-left: auto; color: var(--muted); font-size: 12px; }

.cal-month {
  margin: 0; padding: 18px 20px 10px; font-family: var(--font-display); font-weight: 400;
  text-transform: uppercase; font-size: 15px; letter-spacing: -.005em;
  background: var(--surface-2); border-bottom: 1px solid var(--line-soft);
}
.cal-day { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 14px;
  padding: 12px 20px; border-bottom: 1px solid var(--line-soft); }
.cal-date { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; align-self: start;
  padding-top: 2px; line-height: 1; }
.cal-dow { font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.cal-num { font-family: var(--font-display); font-size: 26px; margin-top: 6px; font-variant-numeric: tabular-nums; }
.cal-day.is-weekend .cal-dow { color: var(--muted); }
/* Today: the date sits on a magenta square — a fill, with large white type */
.cal-day.is-today .cal-date { background: var(--brand); color: var(--on-brand); padding: 8px 0 10px; }
.cal-day.is-today .cal-dow { color: var(--on-brand); }
.cal-events { display: grid; gap: 10px; min-width: 0; align-content: center; }
.cal-none, .cal-loading { margin: 0; color: var(--muted); align-self: center; }
.cal-loading { padding: 24px 20px; }
.cal-list[aria-busy="true"] { opacity: .6; }

/* A job on a day: hairline card with a 4px bar along the bottom — magenta
   going out, ink on site, grey coming back. The words say it too. */
.cal-ev {
  position: relative; display: grid; gap: 6px; padding: 12px 14px 14px;
  background: var(--surface); border: 1px solid var(--line-soft); color: var(--text);
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.cal-ev::after { content: ""; position: absolute; left: -1px; right: -1px; bottom: -1px; height: 4px; background: var(--brand); }
.cal-ev--site::after { background: var(--text); }
.cal-ev--back::after { background: var(--line); }
a.cal-ev:hover { border-color: var(--brand); box-shadow: var(--shadow-sm); }
.cal-ev-title { font-weight: 700; font-size: 16px; line-height: 1.25; }
.cal-ev-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.cal-no { font-family: var(--font-mono); letter-spacing: .02em; color: var(--text); border-color: var(--text); }
.cal-ev-when { font-size: 14px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.cal-ev-when strong { color: var(--text); }
.cal-ev-where { font-size: 13px; color: var(--muted); }
.cal-more { padding: 16px 20px; }
.cal-more:empty { display: none; }

.dash-today > .stencil { display: block; color: var(--accent); margin-bottom: 10px; }
.dash-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.dash-stat { display: flex; flex-direction: column; gap: 6px; padding: 14px 12px;
  background: var(--surface); border: 1px solid var(--line-soft); color: var(--text); }
a.dash-stat:hover { border-color: var(--brand); }
.dash-stat-n { font-family: var(--font-display); font-size: 30px; line-height: 1; font-variant-numeric: tabular-nums; }
.dash-stat-label { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-2); }
.dash-stat.is-late { border-color: var(--danger); }
.dash-stat.is-late .dash-stat-n, .dash-stat.is-late .dash-stat-label { color: var(--danger); }

.dash-tools .section-head { margin-bottom: 8px; }
.dash-tool-list { display: grid; }
.dash-tool { display: flex; align-items: center; gap: 12px; min-height: var(--touch);
  padding: 8px 4px; border-bottom: 1px solid var(--line-soft); color: var(--text); font-weight: 600; }
.dash-tool svg { width: 18px; height: 18px; color: var(--accent); flex: none; }
.dash-tool:hover { color: var(--accent); }
.dash-tool--all { color: var(--text-2); }
.dash-tool-form { margin: 0; }
button.dash-tool { width: 100%; background: none; border: 0; border-bottom: 1px solid var(--line-soft); font: inherit; font-weight: 600; text-align: left; cursor: pointer; }
.dash-tool--app span { flex: 1; }
.dash-tool--app svg:last-child { width: 14px; height: 14px; color: var(--muted); }

/* Your day: inbox and calendar under Today */
.dash-day { display: grid; gap: 12px; }
.dash-box { background: var(--surface); border: 1px solid var(--line-soft); padding: 12px 14px; display: grid; gap: 8px; }
.dash-box-head { display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; }
.dash-box-head svg { width: 18px; height: 18px; color: var(--accent); flex: none; }
.dash-box-head strong { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; flex: 1; }
.dash-box-n { font-family: var(--font-display); font-size: 24px; line-height: 1; font-variant-numeric: tabular-nums; }
.dash-box-unit { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-2); }
.dash-box-list { list-style: none; margin: 0; padding: 0; display: grid; }
.dash-box-list li { display: flex; align-items: flex-start; gap: 8px; border-top: 1px solid var(--line-soft); }
.dash-box-list li > a:first-child { flex: 1; min-width: 0; display: grid; gap: 1px; padding: 8px 0; color: var(--text); text-decoration: none; }
.dash-box-list li > a:first-child:hover .dash-box-what { color: var(--accent); }
.dash-box-who { font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-box-what { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-box-when { font-size: 12px; color: var(--muted); }
.dash-box-list li.is-over { opacity: .55; }
.dash-box-list li.is-now .dash-box-when { color: var(--accent); font-weight: 700; }
.dash-join { margin-top: 8px; flex: none; text-decoration: none; }
.dash-box-more { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-2); text-decoration: none; }
.dash-box-more svg { width: 13px; height: 13px; }
.dash-box-more:hover { color: var(--accent); }

@media (max-width: 1100px) {
  .dash-cols { grid-template-columns: 1fr; }
  .dash-side { position: static; order: -1; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; max-height: none; overflow: visible; }
}

/* ==========================================================================
   FLEET — fleet-map.js markers and the dashboard's vehicles card.
   Squares filled by status: magenta moving (with a notch for its heading),
   amber idling, grey parked. The words say it too.
   ========================================================================== */
/* Leaflet stacks its panes and controls at z-index 400–1000. Isolating the
   map keeps those inside it, so the menu drawer, scrim, sticky header and
   tab bar (20–40) still sit on top. */
.fm-map { background: var(--surface-3); font-family: var(--font-body); isolation: isolate; z-index: 0; }
.fm-map .leaflet-container, .fm-map.leaflet-container { font: inherit; }
[data-theme="dark"] .fm-map .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.85) contrast(.9); }
.fm-marker { background: none; border: 0; }
.fm-marker .fm-pin { position: absolute; left: 0; top: 0; }
.fm-pin {
  display: inline-block; position: relative; width: 14px; height: 14px; flex: none;
  background: var(--muted); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line);
  transform: rotate(var(--fm-turn, 0deg));
}
.fm-marker .fm-pin { width: 18px; height: 18px; }
.fm-pin--moving { background: var(--brand); }
.fm-pin--idling { background: var(--warn); }
.fm-pin--parked { background: var(--text-2); }
.fm-pin--not-reporting { background: transparent; box-shadow: 0 0 0 1px var(--muted); border-style: dashed; border-color: var(--muted); }
.fm-pin i {
  position: absolute; left: 50%; top: -10px; transform: translateX(-50%);
  border: 5px solid transparent; border-bottom: 7px solid var(--brand); border-top: 0;
}
.fm-label {
  position: absolute; left: 22px; top: 0; white-space: nowrap; pointer-events: none;
  font: 700 11px/1 var(--font-mono); padding: 3px 5px;
  background: var(--surface); color: var(--text); border: 1px solid var(--line-soft);
}
.fm-map path.fm-depot { stroke: var(--accent); stroke-width: 2; fill: var(--accent); fill-opacity: .08; }

.dash-fleet { margin-bottom: 24px; }
.fleet-counts { display: flex; flex-wrap: wrap; gap: 12px; }
.fleet-count { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); }
.fleet-count .fm-pin { width: 12px; height: 12px; }
.fleet-body { display: grid; grid-template-columns: minmax(0, 1fr) 320px; min-height: 320px; }
.fleet-map { min-height: 320px; height: 100%; }
.fleet-list { list-style: none; margin: 0; padding: 0; max-height: 360px; overflow-y: auto;
  border-left: 1px solid var(--line-soft); }
.fleet-list li { border-bottom: 1px solid var(--line-soft); }
.fleet-van { display: flex; gap: 12px; align-items: flex-start; width: 100%; padding: 10px 16px;
  background: none; border: 0; text-align: left; color: var(--text); font: inherit; min-height: var(--touch); }
.fleet-van:not(:disabled):hover { background: var(--surface-2); }
.fleet-van:disabled { color: var(--text-2); cursor: default; }
.fleet-van .fm-pin { margin-top: 3px; }
.fleet-van-text { display: grid; gap: 2px; min-width: 0; }
.fleet-van-reg { font-family: var(--font-mono); font-size: 12px; color: var(--text-2); }
.fleet-van-where, .fleet-van-driver { font-size: 13px; color: var(--text-2); }
.fleet-note { padding: 16px 20px; color: var(--muted); margin: 0; }

@media (max-width: 900px) {
  .fleet-body { grid-template-columns: 1fr; }
  .fleet-map { min-height: 260px; height: 260px; }
  .fleet-list { border-left: 0; border-top: 1px solid var(--line-soft); max-height: 300px; }
}
@media (max-width: 639.98px) {
  .dash-fleet { margin: 0 -16px 20px; border-left: 0; border-right: 0; }
  .fleet-map { min-height: 220px; height: 220px; }
}

/* ==========================================================================
   UI KIT — for modules. Prefix h- so nothing collides with shell chrome.
   ========================================================================== */

#module-root { container-type: inline-size; container-name: module; }

.h-head { margin-bottom: 28px; }
.h-back {
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px;
  color: var(--muted); margin-bottom: 10px;
}
.h-back:hover { color: var(--accent); }
.h-back svg { width: 14px; height: 14px; }

.h-title {
  font-family: var(--font-display); font-weight: 400; text-transform: uppercase;
  font-size: 32px; letter-spacing: -.015em; line-height: .98; margin: 0 0 12px;
}
.h-title::after {
  content: ""; display: block; width: 40px; height: 2px;
  background: var(--brand); margin-top: 14px;
}
.h-sub { color: var(--text-2); margin: 0; max-width: 66ch; }

.h-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 20px; }
.h-toolbar .h-spacer { flex: 1; }

/* Buttons: secondary is an ink outline that inverts on hover; primary is
   magenta, one per view. Labels uppercase at 0.08em. */
.h-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px;
  background: transparent; border: 1px solid var(--text);
  border-radius: var(--r-md); color: var(--text);
  font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  transition: background-color var(--fast) var(--ease), color var(--fast) var(--ease),
              border-color var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.h-btn:hover { background: var(--text); color: var(--surface); }
.h-btn:active { transform: scale(.985); }
.h-btn svg { width: 16px; height: 16px; }
.h-btn--primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.h-btn--primary:hover { background: var(--brand-deep); border-color: var(--brand-deep); color: var(--on-brand); }
.h-btn--primary:active { background: var(--brand-press); border-color: var(--brand-press); }
.h-btn--danger:hover { background: var(--danger); border-color: var(--danger); color: var(--on-brand); }
.h-btn:disabled, .h-btn:disabled:hover {
  background: var(--surface-3); border-color: var(--surface-3);
  color: var(--muted); cursor: not-allowed; transform: none;
}

.h-field { display: flex; flex-direction: column; gap: 6px; }
.h-field > label { color: var(--text-2); }

.h-input, .h-select, .h-textarea {
  min-height: 40px; padding: 8px 12px; background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--r-md);
  font: inherit; outline: none; min-width: 0; width: 100%;
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.h-input:hover, .h-select:hover, .h-textarea:hover { border-color: var(--muted); }
.h-input:focus, .h-select:focus, .h-textarea:focus { border-color: var(--brand); box-shadow: var(--ring-focus); }
.h-input::placeholder, .h-textarea::placeholder { color: var(--muted); }
.h-input:disabled, .h-select:disabled, .h-textarea:disabled { background: var(--surface-2); color: var(--muted); }
.h-textarea { resize: vertical; min-height: 84px; }
.h-input--mono { font-family: var(--font-mono); }

.h-card {
  background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: var(--r-lg); padding: 20px; margin-bottom: 16px;
}
.h-card--flush { padding: 0; overflow: hidden; }

.h-card-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 14px 20px; border-bottom: 1px solid var(--line-soft);
}
.h-card-head h3 {
  font-family: var(--font-display); font-weight: 400; text-transform: uppercase;
  font-size: 15px; letter-spacing: -.005em; margin: 0;
}
.h-card-head .h-spacer { flex: 1; }

.h-cols { display: grid; gap: 16px; }
.h-cols--2 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.h-cols--3 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.h-cols--split { grid-template-columns: minmax(0, 320px) minmax(0, 1fr); align-items: start; }
@container module (max-width: 720px) {
  .h-cols--split { grid-template-columns: 1fr; }
}

.h-table { width: 100%; border-collapse: collapse; }
.h-table th {
  text-align: left; padding: 10px 14px; color: var(--muted);
  font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  border-bottom: 1px solid var(--line-soft); white-space: nowrap;
}
.h-table td { padding: 12px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.h-table tr:last-child td { border-bottom: 0; }
.h-table tbody tr:hover { background: var(--surface-2); }
.h-table .h-num { font-family: var(--font-mono); color: var(--text-2); }

.h-chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px;
  border-radius: 999px; border: 1px solid var(--line);
  font-size: 10px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--text-2); white-space: nowrap;
}
.h-chip--suttons   { border-color: var(--suttons);   color: var(--suttons); }
.h-chip--wayfields { border-color: var(--wayfields); color: var(--wayfields); }
.h-chip--ok        { border-color: var(--ok);        color: var(--ok); }
.h-chip--warn      { border-color: var(--warn);      color: var(--warn); }
.h-chip--late      { border-color: var(--danger);    color: var(--danger); }

.h-progress { height: 4px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.h-progress i { display: block; height: 100%; background: var(--brand); transition: width var(--base) var(--ease); }
.h-progress.is-done i { background: var(--ok); }

.h-check {
  display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px;
  border-bottom: 1px solid var(--line-soft);
}
.h-check:last-child { border-bottom: 0; }
.h-check:hover { background: var(--surface-2); }

.h-box {
  appearance: none; flex: none; width: 20px; height: 20px; margin-top: 1px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); cursor: pointer; position: relative;
  transition: background-color var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.h-box:hover { border-color: var(--muted); }
.h-box:checked { background: var(--brand); border-color: var(--brand); }
.h-box:checked::after {
  content: ""; position: absolute; left: 6px; top: 2px;
  width: 5px; height: 10px; border: solid var(--on-brand);
  border-width: 0 2px 2px 0; transform: rotate(45deg);
}

.h-check-body { flex: 1; min-width: 0; }
.h-check-title { font-size: 14px; }
.h-check.done .h-check-title { color: var(--muted); text-decoration: line-through; }
.h-check-meta { color: var(--muted); margin-top: 3px; }

.h-empty {
  padding: 44px 20px; text-align: center; color: var(--muted);
  border: 1px dashed var(--line);
}
.h-empty strong { display: block; color: var(--text); font-size: 16px; margin-bottom: 6px; }

.h-toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  padding: 12px 20px; background: var(--inverse); color: #ffffff;
  border-top: 4px solid var(--brand); font-size: 14px;
  z-index: 200; box-shadow: var(--shadow-lg); max-width: calc(100vw - 32px);
}

.h-note { color: var(--muted); font-size: 13px; }
.h-scroll { overflow-x: auto; }

/* Live update banner — someone else changed the document you're looking at */
.h-live {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 16px; margin-bottom: 16px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-top: 4px solid var(--brand);
  font-size: 14px; color: var(--text-2);
}
.h-live button { margin-left: auto; }

/* Drag handle for reorderable rows */
.h-grip {
  flex: none; cursor: grab; color: var(--muted);
  font-size: 15px; line-height: 1; padding: 2px 2px 0 0; user-select: none;
}
.h-grip:active { cursor: grabbing; }
[draggable="true"] { cursor: default; }

/* ==========================================================================
   TOUCH — 44px targets wherever the pointer is a finger
   ========================================================================== */
.menu-btn { display: none; }

@media (pointer: coarse) {
  .h-btn, .h-input, .h-select, .icon-btn, .btn-out, .search { min-height: var(--touch); }
  .icon-btn { width: var(--touch); height: var(--touch); }
  .nav-item { min-height: var(--touch); }
  .h-box { width: 24px; height: 24px; }
  .h-box:checked::after { left: 8px; top: 3px; width: 6px; height: 12px; }
  .h-check { min-height: var(--touch); align-items: center; }
}

/* ==========================================================================
   TABLET — 640 to 1024px: icon rail, expands over the content
   ========================================================================== */
@media (min-width: 640px) and (max-width: 1024px) {
  .shell { grid-template-columns: var(--rail-w) 1fr; }
  .sidebar { width: var(--rail-w); overflow-x: hidden; z-index: 40;
             transition: width var(--base) var(--ease), box-shadow var(--base) var(--ease); }
  .sidebar:not(.open) .brand { font-size: 0; padding: 22px 0 18px; text-align: center; }
  /* Collapsed, the rail shows the Visions V. */
  .sidebar:not(.open) .brand-logo { display: none; }
  .sidebar:not(.open) .brand-v { display: block; width: 34px; height: auto; margin: 0 auto; }
  .sidebar:not(.open) .brand-sub,
  .sidebar:not(.open) .nav-group > .stencil,
  .sidebar:not(.open) .nav-item span,
  .sidebar:not(.open) .nav-item::before,
  .sidebar:not(.open) .sidebar-foot span { display: none; }
  .sidebar:not(.open) .nav { padding: 4px 8px 20px; }
  .sidebar:not(.open) .nav-group { margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line-soft); }
  .sidebar:not(.open) .nav-item { justify-content: center; padding: 10px 0; }
  .sidebar:not(.open) .nav-item::after { left: 16px; right: 16px; }
  .sidebar:not(.open) .sidebar-foot { justify-content: center; padding: 14px 0; }
  .sidebar.open { width: var(--sidebar-w); box-shadow: var(--shadow-lg); }
  .menu-btn { display: grid; }
  .content { padding: 24px 24px 64px; }
  .topbar { padding: 12px 24px; }
  .who-text { display: none; }
  .scrim { position: fixed; inset: 0; background: rgb(29 29 27 / .6); z-index: 30; }
  .scrim[hidden] { display: none; }
}

/* ==========================================================================
   PHONE — under 640px: single column, bottom tab bar, drawer for the rest
   ========================================================================== */
@media (max-width: 639.98px) {
  body { font-size: 16px; }
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); z-index: 40;
    transform: translateX(-100%); transition: transform var(--base) var(--ease);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .sidebar-foot .btn-out { display: inline-flex; align-items: center; }
  .scrim { position: fixed; inset: 0; background: rgb(29 29 27 / .6); z-index: 30; }
  .scrim[hidden] { display: none; }

  .topbar { padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); gap: 10px; min-height: 56px; }
  .topbar .btn-out, .who-text, .search kbd { display: none; }
  /* The search gives way, so the unsent badge never pushes the bar off the screen. */
  .search { max-width: none; min-width: 0; flex: 1 1 auto; }
  .search input { min-width: 0; width: 100%; }
  .topbar-right { gap: 8px; flex: none; }

  .content { padding: 20px 16px calc(var(--tabbar-h) + 32px + env(safe-area-inset-bottom)); }

  .grid { grid-template-columns: 1fr; gap: 12px; }
  /* The roadmap is for desks; on a phone, show only what can be opened. */
  .tile.is-soon { display: none; }
  .section:not(:has(.tile:not(.is-soon))) { display: none; }
  .section-head .count { display: none; }
  .tile { padding: 16px; }
  .tile:hover { transform: none; }
  .h-title { font-size: 26px; }
  .h-cols--split { grid-template-columns: 1fr; }
  .h-toolbar .h-btn { flex: 1 1 auto; }

  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--surface); border-top: 1px solid var(--line-soft);
  }
  .tabbar-item {
    position: relative; display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 4px; min-width: var(--touch);
    color: var(--muted); background: none; border: 0; padding: 0;
    font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  }
  .tabbar-item svg { width: 22px; height: 22px; }
  .tabbar-item.on { color: var(--accent); }
  .tabbar-item.on::before {
    content: ""; position: absolute; top: 0; left: 25%; right: 25%;
    height: 3px; background: var(--brand);
  }

  /* Tables become stacked cards: same data, one record per card.
     hub.js copies each column header into the cell's data-label. */
  .h-table thead { display: none; }
  .h-table, .h-table tbody, .h-table tr, .h-table td { display: block; width: 100%; }
  .h-table tr { padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
  .h-table tr:last-child { border-bottom: 0; }
  .h-table td {
    display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
    padding: 4px 16px; border: 0; text-align: right;
  }
  .h-table td[data-label]::before {
    content: attr(data-label); flex: none; text-align: left; color: var(--muted);
    font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  }
  .h-table td:first-child { font-weight: 600; text-align: left; }
  .h-table tbody tr:hover { background: transparent; }
  .h-scroll { overflow-x: visible; }

  .h-toast { bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom)); }

  /* Dashboard: the diary runs edge to edge, as a phone calendar does;
     tools are a tab away (More), so only today's numbers stay above it. */
  .dash-side { grid-template-columns: 1fr; }
  .dash-tools { display: none; }
  .dash-stat { padding: 10px; }
  .dash-stat-n { font-size: 24px; }
  .cal { margin: 0 -16px; border-left: 0; border-right: 0; }
  .cal-head, .cal-filters { padding-left: 16px; padding-right: 16px; }
  .cal-filters .h-select { flex: 1 1 auto; }
  .cal-filters .h-btn { flex: 0 0 auto; }
  .cal-sync { width: 100%; margin-left: 0; }
  .cal-month { padding: 16px 16px 8px; }
  .cal-day { grid-template-columns: 52px minmax(0, 1fr); gap: 12px; padding: 12px 16px; }
  .cal-num { font-size: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 1ms !important; animation-duration: 1ms !important; }
  .tile:hover { transform: none; }
}

/* Installed as an app: no browser chrome above, so pad for the notch */
@media (display-mode: standalone) {
  .topbar { padding-top: max(12px, env(safe-area-inset-top)); }
}

/* A primary action that stays in reach while a long form scrolls */
.h-sticky-action { position: sticky; bottom: 12px; z-index: 5; }
@media (max-width: 639.98px) {
  .h-sticky-action { bottom: calc(var(--tabbar-h) + 12px + env(safe-area-inset-bottom)); }
}

/* ==========================================================================
   SCREENS — modules/screens.js. Section tabs, layout drawings, cast
   targets and the media library grid.
   ========================================================================== */
.sc-nav { gap: 6px; }
.sc-nav .h-btn { border-color: var(--line); }
.sc-nav .h-btn[aria-current="page"] { background: var(--text); border-color: var(--text); color: var(--surface); }
.sc-groups { display: flex; flex-wrap: wrap; gap: 6px; }
.sc-form-new { border-top: 4px solid var(--brand); }
.sc-stack { display: grid; gap: 14px; align-content: start; }
.sc-stack .sc-layouts { margin: 0; }
.sc-stack [hidden] { display: none; }
.sc-form-title { margin: 0 0 12px; color: var(--accent); }
.sc-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 14px; }
.sc-actions .h-spacer { flex: 1; }
.sc-head-bare { padding: 0; border: 0; margin-bottom: 10px; }
.sc-pad { padding: 12px 20px 0; margin: 0; }
.sc-inline-form { padding: 16px 20px; display: grid; gap: 10px; align-items: end;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.sc-inline-form .h-field { margin: 0; }
.sc-days { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px 14px; border: 0; padding: 0; margin: 0; }
.sc-days legend { padding: 0; margin-bottom: 6px; }
.sc-days label, .sc-check { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; }
.sc-preview { position: relative; aspect-ratio: 16 / 9; border: 1px solid var(--line-soft); background: var(--surface-3); }
.sc-preview iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.sc-slide-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.sc-slide-head .h-spacer { flex: 1; }
.sc-slide-fields { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.sc-add-slide { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }

/* A layout drawn small: main, sidebar and ticker as blocks */
.sc-layout { display: inline-grid; vertical-align: middle; width: 40px; height: 24px; gap: 2px; padding: 2px;
  border: 1px solid var(--line); grid-template-columns: 1fr; grid-template-rows: 1fr; background: var(--surface); }
.sc-layout i { display: block; background: var(--text-2); }
.sc-layout .sc-l-main { background: var(--text); }
.sc-layout--side { grid-template-columns: 2fr 1fr; }
.sc-layout--ticker { grid-template-rows: 1fr 4px; }
.sc-layout--ticker .sc-l-ticker { background: var(--brand); }
.sc-layout--side-ticker { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 4px; }
.sc-layout--side-ticker .sc-l-ticker { grid-column: 1 / -1; background: var(--brand); }
.sc-layouts { border: 0; padding: 0; margin: 14px 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.sc-layouts legend { padding: 0; margin-bottom: 8px; }
.sc-layout-pick { display: flex; align-items: center; gap: 10px; padding: 10px; min-height: var(--touch);
  border: 1px solid var(--line-soft); cursor: pointer; font-size: 13px; }
.sc-layout-pick input { position: absolute; opacity: 0; pointer-events: none; }
.sc-layout-pick:has(input:checked) { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.sc-layout-pick:has(input:focus-visible) { box-shadow: var(--ring-focus); }

.sc-targets { border: 1px solid var(--line-soft); padding: 12px 16px; margin: 0; display: grid; gap: 8px; }
.sc-targets legend { padding: 0 6px; }
.sc-target-group { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; }
.sc-target-group > .h-note { width: 100%; margin: 4px 0 0; }
.sc-casting { border-top: 4px solid var(--text); }

.sc-drop { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
  padding: 28px 20px; border: 1px dashed var(--line); cursor: pointer; }
.sc-drop.is-over { border-color: var(--brand); background: var(--accent-soft); }
.sc-drop .h-btn { margin-top: 6px; }
.sc-media-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.sc-media { margin: 0; display: flex; flex-direction: column; }
.sc-media-thumb { aspect-ratio: 16 / 9; background: var(--surface-3); overflow: hidden; }
.sc-media-thumb img, .sc-media-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.sc-media figcaption { padding: 12px 14px; display: grid; gap: 4px; }
.sc-media figcaption strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-media-actions { display: flex; gap: 6px; margin-top: 6px; }
.of-kpi { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 2fr) auto; gap: 8px; margin-bottom: 8px; }
@media (max-width: 639.98px) { .of-kpi { grid-template-columns: 1fr 1fr; } .of-kpi [data-kk="label"] { grid-column: 1 / -1; } }

/* ==========================================================================
   ACCIDENTS AND NEAR MISSES — modules/incidents.js. Big targets: it's
   filled in on a phone, standing up, possibly shaken.
   ========================================================================== */
.inc-start { display: grid; justify-items: start; gap: 6px; margin-bottom: 20px; }
.inc-report { min-height: 52px; padding: 0 22px; font-size: 13px; }
.inc-waiting { border-left: 4px solid var(--warn); }
.inc-lead { margin-top: 8px; }
.inc-show { width: auto; }
.inc-form { display: grid; gap: 0; max-width: 760px; }
.inc-step { margin: 0; color: var(--accent); }
.inc-types { border: 1px solid var(--line-soft); display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.inc-types legend { padding: 0 6px; }
.inc-type { position: relative; display: grid; gap: 4px; padding: 14px; min-height: 76px; border: 1px solid var(--line); cursor: pointer; }
.inc-type input { position: absolute; opacity: 0; pointer-events: none; }
.inc-type:has(input:checked) { border-color: var(--brand); box-shadow: inset 0 0 0 2px var(--brand); }
.inc-type:has(input:focus-visible) { box-shadow: var(--ring-focus); }
.inc-type--accident:has(input:checked) { border-color: var(--danger); box-shadow: inset 0 0 0 2px var(--danger); }
.inc-type .h-note { margin: 0; }
.inc-yesno { border: 0; padding: 0; margin: 0; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inc-yesno legend { padding: 0; margin-bottom: 8px; width: 100%; }
.inc-yesno .h-btn { min-width: 88px; }
.inc-yesno .h-btn[aria-pressed="true"] { background: var(--text); color: var(--surface); }
.inc-injury { border-left: 3px solid var(--danger); padding-left: 14px; }
.inc-person { display: grid; gap: 8px; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 2fr) auto; align-items: center; }
.inc-photos { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; }
.inc-photos figure { margin: 0; position: relative; width: 140px; }
.inc-photos img { width: 140px; height: 105px; object-fit: cover; display: block; border: 1px solid var(--line-soft); }
.inc-photos figure .h-btn { position: absolute; top: 4px; right: 4px; min-height: 32px; width: 32px; padding: 0; background: var(--surface); }
.inc-add-photo { cursor: pointer; }
.inc-sig { width: 100%; height: 120px; border: 1px solid var(--line); background: var(--surface); touch-action: none; }
.inc-sig-img { max-width: 260px; max-height: 80px; border: 1px solid var(--line-soft); background: var(--surface); }
.inc-problem { padding: 12px 14px; border: 1px solid var(--danger); color: var(--danger); font-weight: 600; margin-bottom: 12px; }
.inc-submit { display: flex; gap: 10px; flex-wrap: wrap; padding: 12px 0; background: var(--ink); }
.inc-submit .h-btn--primary { min-height: 52px; flex: 1 1 200px; }
.inc-sent p { margin: 10px 0 0; }
.inc-summary { white-space: pre-wrap; margin: 14px 0 10px; max-width: 70ch; }
.inc-dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; }
.inc-dl dt { color: var(--text-2); font-size: 13px; }
.inc-dl dd { margin: 0; }
.inc-people { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.inc-riddor-q { border: 0; border-top: 1px solid var(--line-soft); padding: 10px 0 0; margin: 0; display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center; }
.inc-riddor-q legend { float: left; width: 100%; padding: 0 0 6px; font-size: 14px; }
.inc-riddor-result { padding: 12px 14px; background: var(--surface-2); }
.inc-riddor-result.is-reportable { background: transparent; border: 1px solid var(--danger); color: var(--danger); }
.inc-action { display: grid; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line-soft);
  grid-template-columns: minmax(0, 3fr) minmax(0, 1.4fr) minmax(0, 1.2fr) auto auto; }
.inc-action .h-chip { grid-column: 1 / -1; justify-self: start; }
.inc-blockers { padding: 12px 14px; border: 1px solid var(--warn); }
.inc-blockers ul { margin: 6px 0 0; padding-left: 18px; }
.inc-tiles { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 16px; }
.inc-bars { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; align-items: end; height: 180px; margin: 14px 0 8px; }
.inc-bar { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.inc-bar-stack { width: 100%; max-width: 36px; display: flex; flex-direction: column-reverse; min-height: 0; }
.inc-bar-stack i { display: block; min-height: 0; }
.inc-bar-near, .inc-legend .inc-bar-near { background: var(--brand); }
.inc-bar-other, .inc-legend .inc-bar-other { background: var(--text-2); }
.inc-bar-n { font-family: var(--font-mono); font-size: 11px; color: var(--text-2); min-height: 14px; }
.inc-bar-m { font-size: 11px; color: var(--muted); }
.inc-legend { display: flex; gap: 18px; font-size: 13px; color: var(--text-2); margin: 0 0 8px; }
.inc-legend span { display: inline-flex; align-items: center; gap: 6px; }
.inc-legend i { display: inline-block; width: 12px; height: 12px; }
.dash-report { margin-top: 14px; }
@media (max-width: 639.98px) {
  .inc-person { grid-template-columns: minmax(0, 1fr) auto; }
  .inc-person [data-p="role"], .inc-person [data-p="contact"] { grid-column: 1; }
  .inc-action { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .inc-action [data-a="text"] { grid-column: 1 / -1; }
  .inc-submit { position: sticky; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
}

/* ==========================================================================
   JOBS BOARD — Teams chat next to Open in HireHop
   ========================================================================== */
.jb-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.jb-links:empty { display: none; }
.jb-chat-note { margin: 10px 0 0; }
.jb-chat-panel { margin-top: 14px; padding: 16px; border: 1px solid var(--line-soft); background: var(--surface-2); display: grid; gap: 12px; max-width: 640px; }
.jb-chat-title { margin: 0; color: var(--accent); }
.jb-chat-topic { font-weight: 700; }
.jb-chat-members { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.jb-chat-members li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line-soft); }
.jb-chat-members .h-btn { min-height: 32px; width: 32px; padding: 0; }
.jb-pick { position: relative; }
.jb-pick-list { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 4px; }
.jb-pick-person { width: 100%; justify-content: flex-start; gap: 10px; text-transform: none; letter-spacing: 0; font-size: 14px; font-weight: 400; background: var(--surface); border-color: var(--line-soft); flex-wrap: wrap; height: auto; white-space: normal; text-align: left; }
.jb-pick-person .h-note { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* ==========================================================================
   RECEIPTS — modules/receipts.js. Camera first, thumbs-sized targets.
   ========================================================================== */
.rc-start { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.rc-add { min-height: 52px; padding: 0 22px; }
.rc-tabs { margin-top: 4px; }
.rc-count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; margin-left: 4px;
  background: var(--brand); color: var(--on-brand); font-size: 11px; border-radius: 999px; }
.rc-mini { min-height: 32px; padding: 0 10px; margin-left: 4px; }
.rc-query { margin-top: 4px; font-size: 13px; color: var(--danger); }
.rc-form { display: grid; gap: 14px; max-width: 760px; border-top: 4px solid var(--brand); }
.rc-pages { display: flex; gap: 10px; flex-wrap: wrap; }
.rc-pages figure { margin: 0; position: relative; }
.rc-pages img { width: 110px; height: 146px; object-fit: cover; display: block; border: 1px solid var(--line-soft); }
.rc-pages figure .h-btn { position: absolute; top: 4px; right: 4px; min-height: 32px; width: 32px; padding: 0; background: var(--surface); }
.rc-shoot { display: grid; place-items: center; align-content: center; gap: 6px; width: 110px; height: 146px; padding: 8px; text-align: center;
  border: 1px dashed var(--line); color: var(--text-2); font-size: 13px; font-weight: 600; cursor: pointer; }
.rc-shoot svg { width: 22px; height: 22px; color: var(--accent); }
.rc-shoot.is-first { width: 100%; max-width: 360px; height: 120px; border-color: var(--brand); color: var(--text); }
.rc-read { margin: 0; min-height: 1em; }
.rc-big { font-size: 20px; }
.rc-job { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 8px; }
.rc-quick { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.rc-quick legend { padding: 0; margin-bottom: 8px; width: 100%; }
.rc-quick .h-btn[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--surface); }
.rc-quick .h-select { width: auto; flex: 1 1 180px; }
.rc-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.rc-viewer { position: fixed; inset: 0; z-index: 300; background: rgb(29 29 27 / .85); display: flex; gap: 16px;
  align-items: center; justify-content: center; padding: 24px; overflow: auto; cursor: zoom-out; }
.rc-viewer img { max-height: 100%; max-width: 90vw; }
@media (max-width: 639.98px) {
  .rc-job { grid-template-columns: 1fr; }
  .rc-actions .h-btn--primary { flex: 1 1 100%; min-height: 52px; }
}

/* ==========================================================================
   POWER SIGN-OFF ON SITE — limits beside each reading, missing results,
   signatures, the SPR's event view.
   ========================================================================== */
.sg-lim { font-size: 11px; color: var(--text-2); margin-top: 4px; white-space: nowrap; }
.h-input[data-mark="error"] { border-color: var(--danger); box-shadow: inset 0 0 0 1px var(--danger); }
.h-input[data-mark="warning"] { border-color: var(--warn); box-shadow: inset 0 0 0 1px var(--warn); }
.sg-missing { border-left: 3px solid var(--warn); }
.sg-missing ul { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.sg-jump { min-height: 32px; padding: 0 10px; text-transform: none; letter-spacing: 0; font-weight: 600; }
.sg-sign { display: grid; gap: 8px; margin-top: 14px; }
.sg-spr { display: grid; gap: 10px; margin-top: 14px; max-width: 520px; }
.sg-spr-other { display: grid; gap: 10px; }
.sg-log { margin: 12px 0 0; padding-left: 18px; font-size: 13px; color: var(--text-2); display: grid; gap: 4px; }
.sg-g3 { border-top: 4px solid var(--brand); }
.sg-pic { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-height: 48px; }
.sg-pic img { max-height: 48px; max-width: 160px; border: 1px solid var(--line-soft); background: var(--surface); }

/* ==========================================================================
   SCANNER — hub-scan.js. Full screen; the camera view is the one dark
   surface, so the code being read is easy to frame in daylight.
   ========================================================================== */
.h-scan {
  position: fixed; inset: 0; z-index: 300; display: flex; flex-direction: column;
  background: var(--surface); padding-bottom: env(safe-area-inset-bottom);
}
.h-scan-bar {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top));
  border-bottom: 1px solid var(--line-soft); border-top: 4px solid var(--brand);
}
.h-scan-count { margin-left: auto; color: var(--muted); font-size: 13px; }
.h-scan-view { position: relative; flex: 1; min-height: 200px; background: #000; overflow: hidden; }
.h-scan-view video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.h-scan-frame {
  position: absolute; left: 12%; right: 12%; top: 34%; bottom: 34%;
  border: 2px solid #fff; box-shadow: 0 0 0 100vmax rgb(29 29 27 / .45);
}
.h-scan-type { padding: 16px; display: grid; gap: 8px; border-top: 1px solid var(--line-soft); }
.h-scan-list { list-style: none; margin: 0; padding: 0 16px 16px; max-height: 30vh; overflow-y: auto; }
.h-scan-list li { padding: 8px 0; border-bottom: 1px solid var(--line-soft); font-family: var(--font-mono); }
.h-scan-list li.is-dup { color: var(--muted); }
.h-scan-list li.is-wait { color: var(--muted); }
.h-scan-list li.is-ok   { color: var(--ok); }
.h-scan-list li.is-warn { color: var(--warn); }
.h-scan-list li.is-bad  { color: var(--danger); }
.h-scan-head { padding: 10px 16px; border-bottom: 1px solid var(--line-soft); font-size: 15px; }
/* A module's verdict on the last scan: read at arm's length in a dark venue.
   Ink is the surface colour, so it stays legible on the tone in both themes. */
.h-scan-result {
  display: grid; gap: 4px; padding: 16px; font-size: 18px; line-height: 1.3;
  background: var(--line-soft); color: var(--text);
}
.h-scan-result strong { font-size: 22px; }
.h-scan-result.is-ok   { background: var(--ok);     color: var(--surface); }
.h-scan-result.is-warn { background: var(--warn);   color: var(--surface); }
.h-scan-result.is-bad  { background: var(--danger); color: var(--surface); }

/* Toggle buttons (aria-pressed): selected fills with ink, so hovering an
   unselected one must not look the same — it gets a light grey instead. */
.h-btn[aria-pressed="false"]:hover { background: var(--surface-2); color: var(--text); border-color: var(--text); }
.h-scan-nocam { padding: 16px; border-bottom: 1px solid var(--line-soft); }
.h-scan-type { margin-top: auto; }

/* Useful information — SharePoint browser */
.ui-row { align-items: center; }
.ui-icon { flex: none; display: inline-flex; color: var(--muted); }
.ui-icon svg { width: 20px; height: 20px; }
.ui-link { color: var(--text); text-decoration: none; font-weight: 600; overflow-wrap: anywhere; }
.ui-link:hover, .ui-link:focus-visible { color: var(--accent); text-decoration: underline; }
.ui-summary mark { background: var(--accent-soft); color: var(--text); font-weight: 700; padding: 0 2px; }
.ui-crumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0 0 14px; font-size: 13px; color: var(--muted); }
.ui-crumbs a { color: var(--text-2); }
.ui-crumbs [aria-current] { color: var(--text); font-weight: 600; }
.ui-stale { margin: 0 0 12px; color: var(--warn); }
.ui-search-field { flex: 1; max-width: 420px; margin: 0; }
@media (max-width: 639.98px) { .ui-search-field { flex-basis: 100%; max-width: none; } }

/* Meeting notes */
.mn-meetings { display: grid; gap: 8px; }
.mn-meeting {
  display: grid; gap: 2px; text-align: left; padding: 10px 12px; cursor: pointer;
  background: var(--surface); color: var(--text); font: inherit;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  transition: border-color var(--fast) var(--ease), background-color var(--fast) var(--ease);
}
.mn-meeting:hover { border-color: var(--muted); background: var(--surface-2); }
.mn-meeting:focus-visible { outline: none; border-color: var(--brand); box-shadow: var(--ring-focus); }
.mn-meeting[disabled] { opacity: .6; cursor: progress; }
.mn-meeting .h-note { font-size: 12px; }
.mn-action { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 1.2fr) minmax(0, 1fr) auto; gap: 8px; margin-bottom: 8px; align-items: center; }
@media (max-width: 639.98px) { .mn-action { grid-template-columns: 1fr 1fr auto; } .mn-action [data-ak="task"] { grid-column: 1 / -1; } }

/* Vehicle checks — accident or breakdown */
.vc-999 {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; margin-bottom: 16px;
  border: 1px solid var(--danger); border-left-width: 4px; background: var(--surface); color: var(--text);
}
.vc-999 svg { width: 20px; height: 20px; flex: none; color: var(--danger); margin-top: 2px; }
.vc-999 a { color: var(--danger); font-weight: 700; }
.vc-calls { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-bottom: 16px; }
.vc-call { justify-content: flex-start; gap: 12px; min-height: 64px; padding: 12px 16px; text-align: left; text-transform: none; letter-spacing: 0; }
.vc-call > span { display: grid; gap: 2px; }
.vc-call strong { font-size: 15px; }
.vc-call svg { width: 22px; height: 22px; flex: none; }
.vc-detail { font-size: 16px; font-weight: 600; overflow-wrap: anywhere; margin-bottom: 12px; }
.vc-steps { margin: 0; padding: 14px 20px 16px 38px; display: grid; gap: 8px; }
.vc-own-cover { margin: 4px 0 16px; }
.vc-own-cover summary { cursor: pointer; color: var(--text-2); padding: 6px 0; }

/* Screens — device setup notes */
.sc-devices summary { cursor: pointer; color: var(--text-2); }
.sc-devices[open] summary { margin-bottom: 12px; }
.sc-devices h4 { margin: 0 0 6px; font-size: 14px; }
.sc-devices ol { margin: 0 0 12px; padding-left: 18px; display: grid; gap: 6px; color: var(--text-2); }

/* Job margin */
.jm-filters [aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--surface); }
.jm-tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 16px; }
.jm-tiles .h-card { margin: 0; }
.jm-label { color: var(--muted); }
.jm-figure { font-family: var(--font-display); font-size: 26px; line-height: 1.1; margin: 6px 0 4px; }

/* Document anonymiser */
.an-kinds { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.an-kinds legend { margin-bottom: 8px; color: var(--muted); }
.an-find { align-items: center; cursor: pointer; }
.an-find .h-check-title { overflow-wrap: anywhere; }
.an-preview { padding: 16px 20px 20px; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 70vh; overflow-y: auto; font-size: 14px; line-height: 1.6; }
.an-preview mark { background: var(--accent-soft); color: var(--text); font-weight: 700; padding: 0 2px; }

/* Distance calculator */
.dc-stop { display: flex; gap: 8px; align-items: flex-end; margin-bottom: 8px; }

/* Contract templates */
.ct-preview { padding: 16px 20px 20px; max-height: 70vh; overflow-y: auto; font-size: 14px; line-height: 1.6; }
.ct-preview h4 { font-family: var(--font-display); text-transform: uppercase; font-weight: 400; font-size: 14px; margin: 18px 0 6px; padding-bottom: 4px; border-bottom: 1px solid var(--line-soft); }
.ct-preview h5 { font-size: 14px; margin: 12px 0 4px; }
.ct-preview p { margin: 0 0 10px; }
.ct-preview ul { margin: 0 0 10px; padding-left: 18px; }
.ct-preview mark { background: var(--accent-soft); color: var(--text); padding: 0 2px; }
.ct-body { font-family: var(--font-mono); font-size: 13px; line-height: 1.5; }

/* ---- Hub health ---------------------------------------------------------- */
.hh-banner { display: flex; flex-wrap: wrap; gap: 16px 28px; align-items: center; justify-content: space-between; border-left: 4px solid var(--ok); }
.hh-banner--warn { border-left-color: var(--warn); }
.hh-banner--down { border-left-color: var(--danger); }
.hh-headline { display: flex; gap: 14px; align-items: center; min-width: 0; }
.hh-headline > svg { width: 30px; height: 30px; flex: none; color: var(--ok); }
.hh-banner--warn .hh-headline > svg { color: var(--warn); }
.hh-banner--down .hh-headline > svg { color: var(--danger); }
.hh-headline h2 { margin: 0 0 2px; font-family: var(--font-display); font-size: 22px; line-height: 1.2; }
.hh-counts { display: flex; gap: 22px; }
.hh-count { font-family: var(--font-display); font-size: 26px; line-height: 1.1; }
.hh-count--down { color: var(--danger); }
.hh-label { color: var(--muted); }
.hh-list { list-style: none; margin: 0; padding: 0; }
.hh-row { display: flex; gap: 12px 20px; justify-content: space-between; padding: 12px 16px; border-top: 1px solid var(--line-soft); border-left: 3px solid transparent; }
.hh-list > .hh-row:first-child { border-top: 0; }
.hh-row--warn { border-left-color: var(--warn); }
.hh-row--down { border-left-color: var(--danger); }
.hh-row--off .hh-name, .hh-row--off .hh-detail { color: var(--muted); }
.hh-main { min-width: 0; flex: 1 1 auto; }
.hh-detail { margin-top: 2px; overflow-wrap: anywhere; }
.hh-links { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; font-size: 13px; align-items: baseline; }
.hh-links a svg { width: 12px; height: 12px; vertical-align: -1px; }
.hh-settings summary { cursor: pointer; color: var(--muted); }
.hh-settings code { font-size: 12px; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; margin-right: 4px; }
.hh-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; text-align: right; }
.hh-history { display: flex; align-items: center; gap: 8px; }
.hh-strip { display: inline-flex; gap: 1px; height: 18px; align-items: stretch; }
.hh-slot { display: block; width: 2px; background: var(--line-soft); border-radius: 1px; }
.hh-slot--ok { background: var(--ok); }
.hh-slot--warn { background: var(--warn); }
.hh-slot--down { background: var(--danger); }
.hh-slot--off { background: var(--line); }
@media (max-width: 720px) {
  .hh-row { flex-direction: column; }
  .hh-side { align-items: flex-start; text-align: left; }
  .hh-counts { gap: 16px; }
}

/* ---- Meeting rooms ------------------------------------------------------- */
.mr-date { max-width: 170px; }
.mr-hours { display: flex; padding: 10px 16px 0; }
.mr-hours > span { flex: 0 0 200px; }
.mr-hours > div { position: relative; flex: 1; height: 18px; }
.mr-hours i { position: absolute; transform: translateX(-50%); font-style: normal; font-size: 11px; color: var(--muted); }
.mr-row { display: flex; align-items: center; gap: 0; padding: 10px 16px; border-top: 1px solid var(--line-soft); }
.mr-room { flex: 0 0 200px; display: flex; flex-direction: column; gap: 3px; padding-right: 12px; min-width: 0; }
.mr-room .h-chip { align-self: flex-start; }
.mr-track { position: relative; flex: 1; height: 44px; border-radius: var(--r-sm); background: var(--surface-2);
  background-image: repeating-linear-gradient(90deg, transparent 0, transparent calc(10% - 1px), var(--line-soft) calc(10% - 1px), var(--line-soft) 10%); }
.mr-track:hover { outline: 2px solid var(--brand); outline-offset: 1px; }
.mr-busy { position: absolute; top: 4px; bottom: 4px; border-radius: var(--r-sm); background: var(--brand); color: var(--on-brand);
  font-size: 11px; line-height: 36px; padding: 0 6px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.mr-now { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--danger); }
.mr-mine { list-style: none; margin: 0; padding: 0; }
.mr-mine li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line-soft); }
.mr-mine li:first-child { border-top: 0; }
.mr-mine li > div { display: flex; flex-direction: column; min-width: 0; }
.mr-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0 14px; }
.mr-clash { min-height: 28px; margin-bottom: 10px; }
/* ---- Purchase orders ----------------------------------------------------- */
.po-dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.po-dl dt { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding-top: 2px; }
.po-dl dd { margin: 0; overflow-wrap: anywhere; }

.mr-room strong { overflow-wrap: anywhere; }
/* The day's bookings as a list: on phones only, where the grid is too narrow to read them. */
.mr-day-list { display: none; list-style: none; margin: 8px 0 0; padding: 0; font-size: 13px; }
.mr-day-list li { padding: 2px 0; overflow-wrap: anywhere; }
.mr-day-list .h-num { display: inline-block; min-width: 92px; color: var(--text-2); }
@media (max-width: 720px) {
  /* Phones: each room on its own line, the day grid the full width under it. */
  .mr-hours { padding: 10px 16px 0; }
  .mr-hours > span { display: none; }
  .mr-hours i:nth-child(odd) { display: none; }
  .mr-row { flex-wrap: wrap; }
  .mr-room { flex: 1 1 100%; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 2px 8px; padding: 0 0 8px; }
  .mr-room strong { flex: 1 1 100%; }
  .mr-track { flex: 1 1 100%; height: 36px; }
  .mr-busy { line-height: 28px; font-size: 0; padding: 0; }
  .mr-day-list { display: block; flex: 1 1 100%; }
}

/* Logistics planner — the post-it board. Vehicles down the side, days
   across; the first column and the day headings stay put while it scrolls. */
.lp-tabs .h-btn[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--surface); }
.lp-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 10px; font-size: 12px; color: var(--text-2); }
.lp-swatch { display: inline-block; width: 12px; height: 12px; margin-right: 6px; vertical-align: -2px; background: var(--note-bg); box-shadow: var(--shadow-sm); }
.lp-swatch--clash { background: transparent; outline: 2px solid var(--danger); outline-offset: -2px; }
.lp-board-wrap { overflow: auto; max-height: 75vh; border: 1px solid var(--line-soft); background: var(--surface); margin-bottom: 10px; }
.lp-board { display: grid; grid-template-columns: 184px repeat(var(--lp-days), 164px); width: max-content; }
.lp-corner, .lp-day, .lp-veh, .lp-cell { border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
.lp-corner, .lp-day { position: sticky; top: 0; z-index: 2; padding: 9px 10px; background: var(--surface-2); color: var(--text-2); font-size: 12px; }
.lp-corner { left: 0; z-index: 3; }
.lp-day.is-today { color: var(--accent); box-shadow: inset 0 -3px 0 var(--brand); }
.lp-veh { position: sticky; left: 0; z-index: 1; display: flex; flex-direction: column; gap: 2px; padding: 10px; background: var(--surface); }
.lp-veh .h-note { font-size: 12px; }
.lp-veh-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.lp-veh--none { background: var(--surface-2); }
.lp-cell { position: relative; display: flex; flex-direction: column; gap: 8px; min-height: 104px; padding: 8px; }
.lp-cell.is-weekend, .lp-day.is-weekend { background: var(--surface-2); }
.lp-cell.is-target { background: var(--accent-soft); outline: 2px dashed var(--brand); outline-offset: -4px; }

.lp-note { --note-bg: var(--note-yellow); position: relative; padding: 7px 9px 6px; background: var(--note-bg); color: var(--text);
  font-size: 13px; line-height: 1.3; box-shadow: var(--shadow-sm); cursor: grab; touch-action: none; user-select: none;
  -webkit-user-select: none; transform: rotate(-.5deg); transition: box-shadow var(--fast) var(--ease), transform var(--fast) var(--ease); }
.lp-note:nth-child(even) { transform: rotate(.6deg); }
.lp-note:hover { box-shadow: var(--shadow-md); transform: none; }
.lp-note:focus-visible { outline: none; box-shadow: var(--ring-focus); transform: none; }
.lp-note--yellow { --note-bg: var(--note-yellow); }
.lp-note--blue   { --note-bg: var(--note-blue); }
.lp-note--green  { --note-bg: var(--note-green); }
.lp-note--pink   { --note-bg: var(--note-pink); }
.lp-note--orange { --note-bg: var(--note-orange); }
/* Not on a vehicle yet (Transport to book): plain, outlined. */
.lp-note--plain  { --note-bg: var(--surface); border: 1px dashed var(--line); }
/* OUT / IN / TRANSFER on each post-it. */
.lp-dir { display: inline-block; padding: 0 5px; margin-right: 4px; border-radius: 3px; font-size: 10px; font-weight: 800; letter-spacing: .04em; line-height: 16px; vertical-align: 1px; }
.lp-dir--out { background: var(--text); color: var(--surface); }
.lp-dir--in { background: var(--surface); color: var(--text); box-shadow: inset 0 0 0 1.5px var(--text); }
.lp-dir--transfer { background: var(--surface-2); color: var(--text-2); }
.lp-note-booking { margin-top: 3px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); }
/* The notes bubble: hover or focus a post-it to read its notes. */
.lp-note-bubble { position: relative; display: inline-flex; margin-left: auto; color: var(--text-2); }
.lp-note-bubble svg { width: 14px; height: 14px; }
.lp-note-tip { display: none; position: absolute; z-index: 5; right: -6px; bottom: calc(100% + 6px); width: 220px; padding: 8px 10px;
  background: var(--text); color: var(--surface); font-size: 12px; font-weight: 400; line-height: 1.4; white-space: pre-wrap; box-shadow: var(--shadow-md); }
.lp-note:hover .lp-note-tip, .lp-note:focus-visible .lp-note-tip { display: block; }
.lp-legend .lp-note-bubble { margin: 0 2px 0 0; vertical-align: -2px; }
/* A vehicle's kind, with its colour. */
.lp-veh-type { display: inline-flex; align-items: center; font-size: 12px; color: var(--text-2); margin-right: 2px; }
/* Warehouse notes row. */
.lp-veh--warehouse { background: var(--surface-2); }
.lp-cell--warehouse { min-height: 64px; background: var(--surface-2); }
.lp-wnote { padding: 6px 8px; background: var(--surface); border-left: 3px solid var(--text-2); font-size: 12px; line-height: 1.35; cursor: pointer; overflow-wrap: anywhere; }
.lp-wnote:hover { box-shadow: var(--shadow-sm); }
.lp-wnote:focus-visible { outline: none; box-shadow: var(--ring-focus); }
.lp-wnote-veh { display: block; font-family: var(--font-mono); font-size: 11px; font-weight: 700; }
/* The shared pop-up (ctx.popup): forms open over the page, not above it. */
.h-modal { position: fixed; inset: 0; z-index: 150; display: grid; place-items: center;
  padding: 16px; background: rgb(29 29 27 / .6); overflow-y: auto; }
.h-modal-box { width: min(760px, 100%); max-height: calc(100vh - 32px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line-soft); border-top: 4px solid var(--brand);
  border-radius: var(--r-lg); box-shadow: var(--shadow-lg); padding: 18px 20px 20px; }
.h-modal-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.h-modal-head h3 { margin: 0; flex: 1; }
.h-modal-x { border: 0; background: none; color: var(--muted); font-size: 26px; line-height: 1;
  width: 36px; height: 36px; border-radius: 50%; cursor: pointer; }
.h-modal-x:hover { background: var(--surface-2); }
body:has(.h-modal) { overflow: hidden; }
.h-modal-box:focus { outline: none; }
/* Inside it, a tool's own form drops its card edge, and the submit row sits on the pop-up. */
.h-modal .rc-form { border-top: 0; max-width: none; }
.h-modal .inc-submit { background: var(--surface); bottom: 0; padding-bottom: 0; }
@media (max-width: 560px) {
  .h-modal { padding: 8px; place-items: start center; }
  .h-modal-box { padding: 14px; max-height: calc(100vh - 16px); }
  .h-modal .h-cols { grid-template-columns: minmax(0, 1fr); }
  .h-modal .h-cols > .h-field { grid-column: auto !important; }
}
.lp-note--error { outline: 2px solid var(--danger); outline-offset: 1px; }
.lp-note--warn  { outline: 2px dashed var(--warn); outline-offset: 1px; }
.lp-note.is-done { opacity: .5; }
.lp-note.is-lifted { opacity: .25; }
.lp-ghost { position: fixed; z-index: 1000; margin: 0; pointer-events: none; cursor: grabbing; transform: rotate(2deg) scale(1.04); box-shadow: var(--shadow-lg); }
.lp-note-top { display: flex; justify-content: space-between; gap: 6px; font-weight: 700; }
.lp-note-job { font-family: var(--font-mono); font-size: 12px; }
.lp-note-route { margin: 3px 0 5px; overflow-wrap: anywhere; }
.lp-note-foot { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 11px; color: var(--text-2); }
.lp-initials { display: inline-grid; place-items: center; flex: none; width: 22px; height: 22px; border-radius: 50%;
  background: var(--surface); color: var(--text); font-size: 10px; font-weight: 700; }
.lp-nodriver { font-style: italic; }
.lp-note-issue { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; margin-top: 5px; font-size: 11px; font-weight: 600; color: var(--danger); }
.lp-note--warn .lp-note-issue { color: var(--warn); }
.lp-add { display: grid; place-items: center; width: 28px; height: 28px; margin-top: auto; padding: 0; border: 1px dashed var(--line);
  border-radius: var(--r-sm); background: none; color: var(--muted); cursor: pointer; opacity: 0; transition: opacity var(--fast) var(--ease); }
.lp-add svg { width: 14px; height: 14px; }
.lp-cell:hover .lp-add, .lp-add:focus-visible { opacity: 1; }
.lp-add:focus-visible { outline: none; box-shadow: var(--ring-focus); }
@media (hover: none) { .lp-add { opacity: .7; } }
@media (prefers-reduced-motion: reduce) { .lp-note, .lp-note:nth-child(even) { transform: none; transition: none; } }
.lp-drivers { display: flex; flex-wrap: wrap; gap: 6px; }
.lp-chip-x { margin-left: 4px; padding: 0 2px; border: 0; background: none; color: var(--muted); font-size: 14px; line-height: 1; cursor: pointer; }
.lp-chip-x:hover { color: var(--danger); }

/* Home page — a driver's runs */
.dash-runs .dash-run { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px 20px; border-top: 1px solid var(--line-soft); }
.dash-runs .dash-run:first-of-type { border-top: 0; }
.dash-run-when { min-width: 92px; font-weight: 700; }
.dash-run-body { flex: 1; min-width: 180px; }

/* Client brief — the notes that will go into the HireHop job */
.cb-notes { max-height: 280px; overflow: auto; margin: 6px 0 0; padding: 12px; background: var(--surface-2); border: 1px solid var(--line-soft);
  font-family: var(--font-body); font-size: 13px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }

/* Jobs board — margin at the top of a job, and its job tools */
.jb-margin { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 28px; margin-top: 16px; padding: 14px 16px;
  background: var(--surface-2); border: 1px solid var(--line-soft); }
.jb-margin[hidden] { display: none; }
.jb-margin-fig { display: flex; flex-direction: column; gap: 2px; }
.jb-margin-fig .stencil { color: var(--muted); font-size: 11px; }
.jb-margin-fig strong { font-size: 20px; }
.jb-margin--below { color: var(--danger); }
.jb-margin--near { color: var(--warn); }
.jb-margin--ok { color: var(--ok); }
.jb-margin-side { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-left: auto; }
.jb-tool { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 12px 20px; border-top: 1px solid var(--line-soft); }
.jb-tool:first-of-type { border-top: 0; }
.jb-tool-name { min-width: 200px; }
.jb-tool > .h-btn { margin-left: auto; }

/* Pal labels */
.pl-search { max-width: 280px; }
.pl-copies { width: 72px; min-height: 36px; }
.pl-table td strong { font-weight: 700; }
.pl-print-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 12px; }
.pl-print-opts { display: grid; gap: 8px; margin: 4px 0 14px; }
.pl-print-opts label { display: flex; gap: 10px; align-items: center; }
.pl-warn { border-left: 3px solid var(--warn); padding: 10px 14px; margin: 0 0 12px; display: grid; gap: 4px; }
.pl-edit { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@container module (max-width: 860px) { .pl-edit { grid-template-columns: 1fr; } }
.pl-gap { margin-top: 14px; }
.pl-h { font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; margin: 22px 0 10px; color: var(--text-2); }
.pl-h--first { margin-top: 0; }
.pl-inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pl-inline > .h-input { flex: 1; }
.pl-item { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.pl-item > .h-input:not(.pl-qty) { flex: 1; }
.pl-item--main > .h-input:not(.pl-qty) { font-weight: 700; }
.pl-qty { width: 64px; flex: none; text-align: center; }
.pl-icon { min-height: 36px; padding: 0 10px; }
.pl-boxbtn[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--surface); }
.pl-preview { position: sticky; top: 12px; }
.pl-preview-head { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.pl-paper { background: var(--label-sheet); border-radius: var(--r-md); padding: 16px; display: flex; justify-content: center; }
.pl-svg { width: 100%; max-height: 70vh; height: auto; font-family: Helvetica, Arial, sans-serif; fill: var(--label-ink); }
.pl-svg .pl-cut, .pl-svg .pl-rule { fill: none; stroke: var(--label-ink); }
.pl-svg .pl-cut { stroke-width: .25; }
.pl-svg .pl-rule { stroke-width: .3; }
.pl-svg .pl-logo { filter: brightness(0); }
.pl-svg .pl-ref { fill: var(--label-ref); opacity: 1; }
.pl-svg line.pl-ref, .pl-svg rect.pl-rule.pl-ref { stroke: var(--label-ref); }
.pl-svg rect.pl-rule.pl-ref { fill: none; }
.pl-svg .pl-logo.pl-ref { filter: brightness(0); opacity: .3; }
.pl-svg .pl-logo--white { filter: brightness(0) invert(1); }
.pl-sizes .h-input { max-width: 120px; }
.pl-swatch { width: 64px; height: 40px; padding: 2px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); cursor: pointer; }

/* Tour labels */
.tl-chip { display: inline-flex; align-items: center; gap: 6px; margin: 2px 10px 2px 0; }
.tl-dot { width: 12px; height: 12px; border-radius: 50%; border: 1px solid var(--line); flex: none; }
.tl-actions { white-space: nowrap; text-align: right; }
.tl-set { border: 1px solid var(--line-soft); border-radius: var(--r-md); padding: 14px; margin-bottom: 12px; }
.tl-set--on { border-color: var(--brand); }
.tl-label { color: var(--text-2); }
.tl-swatches { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tl-swatch { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); cursor: pointer; padding: 0; }
.tl-swatch[aria-checked="true"] { outline: 3px solid var(--text); outline-offset: 2px; }
.tl-logo-thumb { max-height: 40px; max-width: 120px; object-fit: contain; background: var(--label-sheet); border: 1px solid var(--line-soft); border-radius: var(--r-md); padding: 4px; }

/* De Prep Bible */
.dpb-tabs [aria-selected="true"] { background: var(--text); border-color: var(--text); color: var(--surface); }
.dpb-find { display: grid; gap: 10px; margin-bottom: 16px; }
.dpb-depts { display: flex; flex-wrap: wrap; gap: 6px; }
.dpb-depts .h-btn { min-height: 34px; padding: 0 12px; }
.dpb-depts [aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--surface); }
.dpb-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 20px; background: none; border: 0; border-top: 1px solid var(--line-soft); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.dpb-row:hover { background: var(--surface-2); }
.dpb-row-title { flex: 1; min-width: 0; font-weight: 600; }
.dpb-title { margin: 4px 0 12px; font-size: 22px; }
.dpb-note { margin: 0 0 12px; }
.dpb-steps { margin: 0; padding-left: 22px; display: grid; gap: 6px; }
.dpb-steps .dpb-step { padding: 4px 0; }
.dpb-steps .dpb-sub { list-style: none; margin: 10px 0 0 -22px; font-weight: 700; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-2); }
.dpb-steps .h-check { padding: 6px 0; border-bottom: 0; }
.dpb-pic { display: block; max-width: 100%; margin-top: 16px; border: 1px solid var(--line-soft); border-radius: var(--r-md); }
.dpb-ref { margin-top: 16px; padding: 12px 14px; background: var(--surface-2); border-radius: var(--r-md); display: grid; gap: 4px; }
.dpb-jobhead { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.dpb-item-head { border-top: 0; }
.dpb-item-body { padding: 4px 20px 16px; border-top: 1px solid var(--line-soft); }
.dpb-steps-edit { font-family: var(--font-mono); }
.dpb-pad { padding: 12px 20px 0; margin: 0; }

/* Venue wiki */
.vw-search { flex: 1; min-width: 180px; max-width: 420px; }
.vw-type { width: auto; }
.vw-preview { margin: 0 0 12px; }
.vw-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 12px 20px; border-top: 1px solid var(--line-soft); color: var(--text); text-decoration: none; }
.vw-row:first-child { border-top: 0; }
.vw-row:hover { background: var(--surface-2); }
.vw-row-main { flex: 1; min-width: 200px; display: grid; gap: 2px; }
.vw-head h2 { margin: 0 0 4px; font-size: 22px; }
.vw-head p { margin: 0 0 8px; }
.vw-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.vw-checked { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.vw-rules { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin-bottom: 16px; }
.vw-rule { background: var(--surface); border: 1px solid var(--line-soft); border-top: 4px solid var(--ok); padding: 16px 18px; }
.vw-rule--dont { border-top-color: var(--danger); }
.vw-rule h3 { margin: 0 0 8px; font-family: var(--font-display); font-weight: 400; text-transform: uppercase; font-size: 15px; color: var(--ok); }
.vw-rule--dont h3 { color: var(--danger); }
.vw-rule ul { list-style: none; margin: 0 0 10px; padding: 0; }
.vw-rule li { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line-soft); }
.vw-rule li:first-child { border-top: 0; padding-top: 0; }
.vw-by { display: block; margin-top: 2px; }
.vw-add { display: flex; gap: 8px; }
.vw-add .h-input { flex: 1; }
.vw-x { flex: none; width: 28px; height: 28px; background: none; border: 0; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; }
.vw-x:hover { color: var(--danger); }
.vw-section h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-family: var(--font-display); font-weight: 400; text-transform: uppercase; font-size: 15px; }
.vw-section h3 svg { width: 18px; height: 18px; color: var(--accent); }
.vw-section dl { margin: 0; display: grid; grid-template-columns: minmax(140px, 240px) 1fr; gap: 8px 16px; }
.vw-section dt { color: var(--text-2); }
.vw-section dd { margin: 0; }
@container module (max-width: 560px) { .vw-section dl { grid-template-columns: 1fr; gap: 2px; } .vw-section dd { margin-bottom: 8px; } }
.vw-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.vw-photos figure { margin: 0; }
.vw-photos img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--surface-2); }
.vw-photos figcaption { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 12px; color: var(--text-2); min-height: 28px; }
.vw-foot { margin: 8px 0 0; }
.vw-editrow { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.vw-editrow .h-input { flex: 1 1 140px; }
.jb-venue-rules { margin: 0; padding: 12px 20px 14px 36px; display: grid; gap: 4px; }

/* All jobs: the list's filters and the month calendar */
.aj-filters .h-select { width: auto; }
.aj-search { flex: 1 1 260px; min-width: 200px; }
.aj-table a { color: inherit; }
.aj-more { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.aj-month { min-width: 150px; text-align: center; }
.aj-cal { overflow-x: auto; border: 1px solid var(--line-soft); background: var(--surface); }
.aj-cal-inner { min-width: 760px; }
.aj-dow, .aj-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.aj-dow { border-bottom: 1px solid var(--line); }
.aj-dow div { padding: 6px 8px; font-size: 12px; font-weight: 600; color: var(--muted); }
.aj-week { row-gap: 3px; min-height: 84px; border-bottom: 1px solid var(--line-soft); }
.aj-week:last-child { border-bottom: 0; }
.aj-day { min-width: 0; padding: 5px 8px; border-left: 1px solid var(--line-soft); }
.aj-day:first-child { border-left: 0; }
.aj-day--other { background: var(--surface-2); }
.aj-day--other .aj-date { color: var(--muted); }
.aj-date { font-size: 12px; }
.aj-day--today .aj-date { font-weight: 700; color: var(--accent); }
.aj-day--today { box-shadow: inset 0 2px 0 var(--accent); }
.aj-bar { position: relative; z-index: 1; min-width: 0; margin: 0 3px; padding: 2px 6px; overflow: hidden; font-size: 12px; line-height: 1.35;
  white-space: nowrap; text-overflow: ellipsis; color: var(--text); text-decoration: none; background: var(--surface-2);
  border: 1px solid var(--line); border-left-width: 3px; border-radius: 3px; }
.aj-bar:hover { border-color: var(--text); }
.aj-bar--suttons { border-left-color: var(--suttons); }
.aj-bar--wayfields { border-left-color: var(--wayfields); }
.aj-bar--before { margin-left: 0; border-left-width: 1px; border-left-style: dashed; border-radius: 0 3px 3px 0; }
.aj-bar--after { margin-right: 0; border-right-style: dashed; border-radius: 3px 0 0 3px; }
.aj-bar--before.aj-bar--after { border-radius: 0; }

/* Hub health: what's only in this browser */
.hh-local-group { display: grid; gap: 4px; margin: 12px 0; }
.hh-local-row { padding: 2px 0; border: 0; min-height: 0; }

/* Staff handbook */
.hb-review { margin: 0 0 12px; }
.hb-welcome { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px;
  margin: 0 0 16px; padding: 20px 22px; background: var(--surface); border: 1px solid var(--line-soft); border-left: 4px solid var(--brand); }
.hb-welcome .stencil { margin: 0 0 6px; color: var(--accent); }
.hb-welcome h2 { margin: 0; font-size: 22px; line-height: 1.2; }
.hb-search { flex: 1 1 240px; max-width: 360px; }
.hb-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.hb-layout > .h-card { margin: 0; }
.hb-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.hb-row { display: flex; align-items: flex-start; gap: 12px; height: 100%; padding: 16px; color: inherit; text-decoration: none;
  background: var(--surface); border: 1px solid var(--line-soft); box-shadow: var(--shadow-sm); transition: border-color .15s, box-shadow .15s, transform .15s; }
.hb-row:hover { border-color: var(--brand); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.hb-icon { width: 34px; height: 34px; flex: none; }
.hb-row-main { display: grid; gap: 4px; justify-items: start; flex: 1; min-width: 0; }
.hb-row-main .h-note { margin: 0; overflow-wrap: anywhere; }
.hb-row-main .h-chip { margin-top: 4px; }
.hb-check-head { padding: 0 0 10px; }
.hb-progress { height: 6px; margin: 0 0 10px; overflow: hidden; background: var(--surface-2); border-radius: 3px; }
.hb-progress span { display: block; height: 100%; background: var(--brand); transition: width .2s; }
.hb-tick { display: flex; align-items: flex-start; gap: 10px; padding: 7px 0; line-height: 1.35; }
.hb-tick .h-box { flex: none; margin-top: 2px; }
.hb-page { line-height: 1.6; }
.hb-page-head { display: flex; align-items: center; gap: 14px; margin: 0 0 18px; padding: 0 0 16px; border-bottom: 1px solid var(--line-soft); }
.hb-page-icon { width: 44px; height: 44px; flex: none; }
.hb-page-head h2 { margin: 0; font-size: 26px; line-height: 1.15; }
.hb-page-head .h-note { margin: 3px 0 0; }
.hb-page h3 { margin: 24px 0 10px; font-size: 17px; }
.hb-page h3::before { content: ""; display: inline-block; width: 18px; height: 3px; margin-right: 8px; vertical-align: middle; background: var(--brand); }
.hb-page p { margin: 0 0 12px; max-width: 72ch; }
.hb-page ul { margin: 0 0 12px; padding-left: 20px; max-width: 72ch; }
.hb-page li { margin: 0 0 7px; }
.hb-page li::marker { color: var(--brand); }
.hb-page a:not(.h-btn) { color: var(--accent); }
.hb-lead { font-size: 18px; line-height: 1.5; font-weight: 500; }
.hb-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin: 18px 0; }
.hb-info { padding: 16px; background: var(--surface-2); border-top: 3px solid var(--brand); }
.hb-info h4 { margin: 0 0 10px; font-size: 16px; }
.hb-info ul { margin: 0; }
.hb-videos { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; margin: 12px 0 20px; }
.hb-video { margin: 0; min-width: 0; }
.hb-video figcaption { margin-top: 7px; font-size: 14px; font-weight: 600; line-height: 1.3; }
.hb-play, .hb-frame { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; background: var(--surface-2); }
.hb-play { position: relative; padding: 0; overflow: hidden; cursor: pointer; }
.hb-play img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .2s; }
.hb-play:hover img { transform: scale(1.03); }
.hb-play-icon { position: absolute; top: 50%; left: 50%; width: 54px; height: 54px; margin: -27px 0 0 -27px; background: var(--brand); border-radius: 50%; box-shadow: var(--shadow-md); }
.hb-play-icon::after { content: ""; position: absolute; top: 16px; left: 21px; border-style: solid; border-width: 11px 0 11px 17px; border-color: transparent transparent transparent var(--surface); }
.hb-next { display: flex; justify-content: space-between; gap: 12px; margin: 14px 0 0; }
.hb-flip { display: inline-flex; transform: scaleX(-1); }
.hb-editor { width: 100%; font-family: inherit; line-height: 1.5; }
.hb-preview-head { margin: 18px 0 8px; }
@media (max-width: 900px) {
  .hb-layout { grid-template-columns: minmax(0, 1fr); }
  .hb-search { max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  .hb-row, .hb-row:hover, .hb-play img, .hb-play:hover img { transform: none; transition: none; }
}

/* Pop-ups at login, and the tool that sends them */
.hub-announce { width: min(480px, calc(100vw - 32px)); padding: 26px; color: var(--text); background: var(--surface);
  border: 0; border-top: 4px solid var(--brand); box-shadow: var(--shadow-lg); }
.hub-announce::backdrop { background: rgb(29 29 27 / .55); }
.hub-announce-mark { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin: 0 0 14px; color: var(--accent); background: var(--accent-soft); }
.hub-announce-mark svg { width: 24px; height: 24px; }
.hub-announce h2 { margin: 0 0 10px; font-size: 24px; line-height: 1.2; }
.hub-announce-body p { margin: 0 0 10px; line-height: 1.5; overflow-wrap: anywhere; }
.hub-announce-result { margin: 8px 0 0; }
.hub-announce-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.an-head { padding: 0 0 12px; }
.an-roles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 2px 12px; margin: 0 0 12px; }
.an-how { display: grid; gap: 2px; margin: 0 0 10px; }
.an-check { padding: 4px 0; border: 0; min-height: 0; }
.an-actions { margin: 0; }
.an-list { list-style: none; margin: 0; padding: 0; }
.an-list li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 12px 16px; border-top: 1px solid var(--line-soft); }
.an-main { display: grid; gap: 2px; min-width: 0; }
.an-main .h-note { margin: 0; }
.an-none { padding: 0 16px 14px; }

/* Ask Visionary */
.ak-go { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.ak-go .h-note { flex: 1 1 240px; margin: 0; }
.ak-text { margin-top: 8px; line-height: 1.55; }
.ak-text p { margin: 0 0 8px; }
.ak-text ul { margin: 0 0 8px; padding-left: 20px; }
.ak-sources { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
.ak-sources .h-chip { text-transform: none; letter-spacing: 0; text-decoration: none; }

/* ==========================================================================
   CRM — modules/crm.js. Monday-style colour cells: the tone fills the cell
   and the ink is the surface colour, so it reads in both themes.
   ========================================================================== */
.crm-cell { font-weight: 700; font-size: 13px; white-space: nowrap; text-align: center;
  background: var(--surface-2); color: var(--text); }
.crm-cell--ok     { background: var(--ok);     color: var(--surface); }
.crm-cell--warn   { background: var(--warn);   color: var(--surface); }
.crm-cell--danger { background: var(--danger); color: var(--surface); }
.crm-cell--info   { background: var(--info);   color: var(--surface); }
.crm-cell--brand  { background: var(--brand);  color: var(--on-brand); }
.crm-cell--muted  { background: var(--muted);  color: var(--surface); }
.crm-badge { display: inline-block; padding: 4px 10px; border-radius: var(--r-sm); }
.crm-group { border-left: 6px solid var(--muted); }
.crm-group--ok { border-left-color: var(--ok); }
.crm-group--info { border-left-color: var(--info); }
.crm-group--danger { border-left-color: var(--danger); }
.crm-group-head { display: flex; align-items: center; gap: 10px; width: 100%; padding: 14px 20px; border: 0;
  background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; min-height: 48px; }
.crm-group-head h3 { margin: 0; }
.crm-group-head svg { width: 14px; height: 14px; transition: transform .15s; }
.crm-group-head[aria-expanded="false"] svg { transform: rotate(-90deg); }
.crm-row { cursor: pointer; }
.crm-row:hover td { background: var(--surface-2); }
.crm-row:hover td.crm-cell--ok, .crm-row:hover td.crm-cell--warn, .crm-row:hover td.crm-cell--danger,
.crm-row:hover td.crm-cell--info, .crm-row:hover td.crm-cell--brand, .crm-row:hover td.crm-cell--muted { filter: brightness(.95); }
.crm-sub { display: block; color: var(--muted); font-size: 12px; }
.crm-avatar { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 12px; }
.crm-initials { display: inline-flex; align-items: center; justify-content: center; width: 56px; height: 56px; flex: none;
  background: var(--brand); color: var(--on-brand); font-family: var(--font-display); font-size: 20px; }
.crm-header { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.crm-header h2 { margin: 0; font-family: var(--font-display); text-transform: uppercase; }
.crm-tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 16px; }
.crm-tiles .h-card { margin: 0; }
.crm-pick { width: 36px; padding-right: 0; }
.crm-pick input { width: 18px; height: 18px; margin: 0; cursor: pointer; }
.crm-bulk { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; position: sticky; top: 88px; z-index: 5; margin-bottom: 12px; }
.crm-bulk .h-input { width: auto; min-width: 180px; }
.crm-layout { display: grid; gap: 16px; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); align-items: start; }
@media (max-width: 1100px) { .crm-layout { grid-template-columns: minmax(0, 1fr); } }
.crm-contact { padding: 12px 20px; border-top: 1px solid var(--line-soft); }
.crm-contact a { color: var(--accent); }
/* CRM: the repeat banner, year strip, tasks, automations and phone view */
.crm-alert { border-left: 6px solid var(--info); }
.crm-alert--danger { border-left-color: var(--danger); }
.crm-alert--warn { border-left-color: var(--warn); }
.crm-alert .stencil { color: var(--text-2); }
.crm-years { display: flex; gap: 6px; flex-wrap: wrap; }
.crm-year { display: inline-flex; align-items: center; justify-content: center; min-width: 58px; min-height: 32px; padding: 0 8px;
  border: 2px solid var(--line); color: var(--muted); font-weight: 700; font-size: 13px; }
.crm-year.is-booked { background: var(--ok); border-color: var(--ok); color: var(--surface); }
.crm-year.is-next { border-style: dashed; color: var(--text); }
.crm-year--danger { border-color: var(--danger); } .crm-year--warn { border-color: var(--warn); }
.crm-year--info { border-color: var(--info); } .crm-year--ok { border-color: var(--ok); }
.crm-task { display: flex; gap: 10px; align-items: flex-start; padding: 10px 20px; border-top: 1px solid var(--line-soft); }
.crm-task input[type=checkbox], .crm-check input[type=checkbox] { width: 20px; height: 20px; margin-top: 2px; flex: none; accent-color: var(--brand); }
.crm-task.is-done > div > div:first-child { text-decoration: line-through; color: var(--muted); }
.crm-link-btn { border: 0; background: none; padding: 0; font: inherit; color: var(--accent); text-decoration: underline; cursor: pointer; }
.crm-cell-wrap { padding: 4px !important; }
select.crm-cell { width: 100%; min-width: 120px; border: 0; border-radius: var(--r-sm); appearance: auto; cursor: pointer; }
.crm-automations { background: var(--text); color: var(--surface); padding: 20px; }
.crm-automations h3 { margin: 0 0 12px; color: var(--surface); font-family: var(--font-display); text-transform: uppercase; }
.crm-auto { padding: 12px 0; border-top: 1px solid var(--muted); }
.crm-auto p { margin: 6px 0 0; line-height: 1.5; }
.crm-auto.is-off p { opacity: .6; }
.crm-auto-note { margin: 0 0 8px; opacity: .8; font-size: 13px; }
.crm-auto-toggle { display: inline-flex; gap: 6px; align-items: center; font-weight: 700; font-size: 13px; min-height: 32px; }
.crm-auto-num { display: inline-block; width: 64px; padding: 2px 6px; margin: 0 2px; }
.crm-phone-head { display: flex; align-items: center; gap: 10px; background: var(--text); color: var(--surface); padding: 12px 16px; margin-bottom: 12px; }
.crm-phone-head h2 { margin: 0; font-family: var(--font-display); color: var(--surface); }
.crm-phone-head .h-btn svg { width: 18px; height: 18px; }
.crm-segs { display: flex; margin-bottom: 12px; border: 1px solid var(--line); }
.crm-seg { flex: 1; min-height: 44px; border: 0; background: var(--surface); color: var(--text); font: inherit; font-weight: 700; cursor: pointer; }
.crm-seg + .crm-seg { border-left: 1px solid var(--line); }
.crm-seg.is-on { background: var(--brand); color: var(--on-brand); }
.crm-alert-card { margin-bottom: 10px; }
.crm-check { display: flex; gap: 12px; align-items: center; min-height: 52px; padding: 8px 20px; border-top: 1px solid var(--line-soft); cursor: pointer; }
.crm-check > span { display: flex; flex-direction: column; }
/* CRM phase 3: board views, Kanban, forecast, calendar, activity feed */
.crm-tabs { display: flex; gap: 0; flex-wrap: wrap; margin: 0 0 14px; border-bottom: 2px solid var(--line-soft); }
.crm-tab { border: 0; background: none; padding: 10px 16px; min-height: 44px; font: inherit; font-weight: 700; color: var(--text-2);
  border-bottom: 3px solid transparent; margin-bottom: -2px; cursor: pointer; }
.crm-tab.is-on { color: var(--accent); border-bottom-color: var(--brand); }
.crm-kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.crm-col { background: var(--surface-2); padding: 10px; min-height: 160px; border: 2px dashed transparent; }
.crm-col.is-over { border-color: var(--brand); }
.crm-col-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.crm-card { background: var(--surface); border: 1px solid var(--line-soft); padding: 10px 12px; margin-bottom: 8px; cursor: grab; }
.crm-card.is-dragging { opacity: .5; }
.crm-card a { color: var(--text); }
.crm-move { width: auto; min-height: 32px; padding: 2px 6px; font-size: 12px; }
.crm-forecast th, .crm-forecast td { white-space: nowrap; }
.crm-forecast td.crm-cell { font-size: 12px; }
.crm-enquiry { display: inline-block; padding: 2px 8px; border: 2px dashed var(--info); font-size: 12px; font-weight: 700; color: var(--text); }
.crm-enquiry--danger { border-color: var(--danger); } .crm-enquiry--warn { border-color: var(--warn); } .crm-enquiry--ok { border-color: var(--ok); }
.crm-cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.crm-cal-dow { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--muted); padding: 4px; }
.crm-cal-day { min-height: 90px; padding: 4px; background: var(--surface); border: 1px solid var(--line-soft); overflow: hidden; }
.crm-cal-day.is-empty { background: none; border-color: transparent; }
.crm-cal-day.is-today { border: 2px solid var(--brand); }
.crm-cal-n { display: block; font-size: 12px; font-weight: 700; color: var(--muted); }
.crm-cal-item { display: block; margin-top: 3px; padding: 2px 4px; font-size: 11px; line-height: 1.3; color: var(--surface);
  background: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crm-cal-item--danger { background: var(--danger); } .crm-cal-item--brand { background: var(--brand); color: var(--on-brand); }
.crm-cal-item--info { background: var(--info); }
.crm-cal-item--enquiry { background: none; color: var(--text); border: 1px dashed var(--info); }
@media (max-width: 700px) { .crm-cal-day { min-height: 56px; } .crm-cal-item { font-size: 10px; } }
.crm-kind { display: inline-flex; gap: 6px; align-items: center; min-height: 36px; padding: 0 10px; border: 1px solid var(--line); cursor: pointer; }
.crm-mention-pick { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.crm-feed-item--system, .crm-feed-item--hirehop_status { background: var(--surface-2); }
/* CRM reports: repeat work by month */
.crm-bars { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px; align-items: end; height: 170px; padding: 10px 20px 4px; }
.crm-bar { display: flex; flex-direction: column; align-items: stretch; height: 100%; }
.crm-bar-stack { flex: 1; display: flex; flex-direction: column-reverse; }
.crm-bar-exp { display: block; background: var(--brand); min-height: 0; }
.crm-bar-booked { display: block; background: var(--ok); min-height: 0; }
.crm-bar-label { font-size: 10px; text-align: center; color: var(--muted); margin-top: 4px; white-space: nowrap; }

/* ------------------------------------------------------------------
   DELIVERY TRACKER  (modules/deliveries.js)
   ------------------------------------------------------------------ */
.dl-list { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); margin-bottom: 20px; }
.dl-card { display: grid; gap: 10px; align-content: start; border-left: 4px solid var(--line); }
.dl-card.is-overdue { border-left-color: var(--danger); }
.dl-card-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.dl-from { font-size: 16px; }
.dl-facts dd { min-width: 0; overflow-wrap: anywhere; }
.dl-told-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.dl-told { cursor: default; }
.dl-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.dl-actions .rc-mini { margin-left: 0; min-height: 40px; }
.dl-actions .rc-mini:first-child:not([data-photo]), .dl-actions [data-collect] { flex: 1 1 140px; }
.dl-pass { border-top: 1px solid var(--line-soft); padding-top: 10px; }
.dl-filter { margin-bottom: 14px; }
.dl-filter .h-btn[aria-current="page"], .dl-form [aria-pressed="true"] { background: var(--text); color: var(--surface); }
.dl-picked { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--brand); }
.dl-who { display: block; }
.dl-who .jb-pick-list { margin: 6px 0 10px; }
.dl-inline { display: flex; gap: 6px; }
.dl-inline .h-input { flex: 1; min-width: 0; }
.dl-h { margin: 18px 0 10px; }
.dl-push { margin-bottom: 16px; border-left: 4px solid var(--brand); }
@media (max-width: 700px) { .dl-list { grid-template-columns: 1fr; } }
