/* Calibre Dispatch styles.
   Brand colours from the Calibre style guide: charcoal and sage.
   Cards look like the OneNote board; big buttons for phones.

   HOW THIS FILE IS ORGANISED: every colour, size and spacing is a named value in
   :root just below. Change a value there and it changes everywhere. Please don't
   type a new hex colour further down: add a name here instead. */

/* Fonts live in /fonts (no outside service, so they load with a poor signal).
   Montserrat = headings and the name; Figtree = everything else. */
@font-face {
  font-family: "Montserrat"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../fonts/montserrat-latin-wght.woff2") format("woff2");
}
@font-face {
  font-family: "Figtree"; font-style: normal; font-weight: 300 900; font-display: swap;
  src: url("../fonts/figtree-latin-wght.woff2") format("woff2");
}

:root {
  /* brand */
  --charcoal: #4B4C4E;
  --charcoal-2: #5a5b5e;       /* lighter charcoal: hover, round arrows on the dark bar */
  --charcoal-3: #6b6c70;
  --sage: #858C84;
  --sage-light: #e6e8e4;
  --paper: #F4F4F1;
  --tint: #f6f7f4;             /* very light panel background */
  --card: #ffffff;
  --me: #fff7cc;               /* "this is you" highlight on the board */

  /* Look-ahead chart: crew hours by status, and the capacity line */
  --la-complete: #c3c7c0;
  --la-in_progress: var(--warn);
  --la-scheduled: var(--ok);
  --la-awarded: var(--charcoal);
  --la-estimated: #9db7c6;
  --la-subbed: var(--sage);
  --la-capacity: var(--ink);
  /* week load: room (green), nearly full (golden yellow, clearly apart from the red), over (red) */
  --la-near: #d6a21c;

  /* text and lines */
  --ink: #2b2c2e;
  --ink-soft: #55585a;
  --muted: #6b6f6a;
  --line: #d3d5d0;
  --line-strong: #9a9d98;
  --line-soft: #eceeea;

  /* status colours: each has a strong colour, a text colour and a pale background */
  --ok: #2f7d3e;      --ok-text: #1e6b2e;      --ok-bg: #e3f3e6;       /* done, approved, saved */
  --warn: #b45309;    --warn-text: #7c4a03;    --warn-bg: #fef3c7;     /* check this, waiting */
  --alert: #d9480f;   --alert-text: #b53a08;   --alert-bg: #fde8df;    /* changed, needs attention */
  --danger: #c00000;                           --danger-bg: #fee2e2;   /* error, declined, delete */
  --red: var(--danger);

  /* shape */
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.18);

  /* spacing steps (use these for gaps and padding) */
  --s1: 0.25rem; --s2: 0.5rem; --s3: 1rem; --s4: 1.5rem; --s5: 2rem;

  /* type */
  --font-body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-head: "Montserrat", "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-board: "Calibri", "Segoe UI", system-ui, -apple-system, sans-serif;   /* board cards keep the OneNote look */
  --h1: 1.6rem; --h2: 1.3rem; --h3: 1.05rem;

  /* buttons and boxes: tap sizes (bigger on phones, see the phone block at the bottom) */
  --tap: 40px;
  --tap-big: 52px;

  font-family: var(--font-body);
  color: var(--ink);
}
* { box-sizing: border-box; }

/* No zooming: blocks pinch and double-tap zoom on phones and tablets. */
html, body { touch-action: pan-x pan-y; -webkit-text-size-adjust: 100%; }

/* Charcoal behind the page: iPhone Safari uses it for the area around the
   clock and when you pull the page down, so it matches the top bar. */
html { background: var(--charcoal); height: 100%; }
/* "clip" keeps the pinned top bar working. min-height is a percentage, not 100vh:
   on iPhone 100vh is taller than the screen, so short pages scrolled for no reason. */
body { margin: 0; background: var(--paper); overflow-x: clip; min-height: 100%; }
.boot { padding: 2rem; color: var(--muted); }
/* Stops a page's top margin (the sign-in card) pushing the whole body down and showing the charcoal behind it as a bar. */
#app { display: flow-root; }

/* Loading screen: logo, name, spinner, centred */
.splash {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem;
  background: var(--paper);
}
.splash-mark { height: 120px; }
.splash-name { font-size: 1.4rem; color: var(--charcoal); }
.spinner {
  width: 28px; height: 28px; margin-top: 0.5rem;
  border: 3px solid var(--sage-light); border-top-color: var(--sage); border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.grow { flex: 1; }
.hint { color: var(--muted); font-size: 0.9rem; }

/* Brand name: "CALIBRE DISPATCH" */
.brand { font-weight: 800; letter-spacing: 0.06em; }
.brand-light { color: var(--sage); }
/* "CALIBRE" is the official logo lettering (an image, img/calibre-wordmark-*.png); "DISPATCH" stays live text.
   The image is sized from the text around it: change the font-size and both scale together. */
.brand-lockup { display: inline-flex; align-items: center; gap: 0.45em; vertical-align: middle; }
.brand-lockup .wordmark { height: 0.74em; width: auto; display: block; }

/* ---- headings: one scale for every page ---- */
h1, h2, h3 { font-family: var(--font-head); color: var(--charcoal); line-height: 1.2; font-weight: 700; }
h1 { font-size: var(--h1); margin: 0 0 var(--s3); }
h2 { font-size: var(--h2); margin: 0 0 var(--s2); }
h3 { font-size: var(--h3); margin: 0 0 var(--s2); }

/* A clear ring around whatever the keyboard or a switch is on. */
:where(button, a, input, select, textarea, summary):focus-visible { outline: 3px solid var(--sage); outline-offset: 2px; }

/* ---- buttons and inputs ----
   Three kinds of button, used the same way on every page:
     .btn.primary  solid charcoal: the one main action (Send, Approve, Save, Done)
     .btn          outlined: everything else
     .btn.danger   red outline: cancel / decline;  .danger-solid: the final "yes, delete" */
.btn {
  font: inherit; font-weight: 600;
  min-height: var(--tap);
  padding: 0.4rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}
.btn:hover { background: var(--sage-light); }
.btn.active { background: var(--charcoal); color: #fff; border-color: var(--charcoal); }
.btn.primary { background: var(--charcoal); color: #fff; border-color: var(--charcoal); }
.btn.primary:hover { background: var(--charcoal-2); }
.btn.danger { color: var(--danger); border-color: #e3b4b4; }
.btn.danger:hover { background: var(--danger-bg); }
.btn.danger-solid { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.danger-solid:hover { background: #a00000; }
.btn.small { min-height: 32px; padding: 0.2rem 0.7rem; font-size: 0.9rem; }
.btn.big { padding: 0.8rem 1.2rem; font-size: 1.1rem; min-height: var(--tap-big); }
.btn.wide { display: block; width: 100%; margin-top: 0.75rem; }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn:disabled:hover { background: #fff; }
.btn.primary:disabled:hover, .btn.active:disabled:hover { background: var(--charcoal); }
/* TV picture and PDF buttons: an icon and a short word. The colour is the message:
   grey = not saved yet, green = saved and up to date, orange-red = board changed since saving. */
.btn.save-btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; white-space: nowrap; }
.btn.save-btn svg { flex: none; }
.btn.btn-saved { border-color: var(--ok); background: var(--ok-bg); color: var(--ok-text); }
.btn.btn-saved:hover { background: #d3ecd8; }
.btn.btn-stale { border-color: var(--alert); background: var(--alert-bg); color: var(--alert-text); }
.btn.btn-stale:hover { background: #fbd7c6; }

input[type="text"], input[type="email"], input[type="search"], input[type="date"], input[type="time"],
input[type="number"], input[type="tel"], textarea, select {
  font: inherit;
  min-height: var(--tap);
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  max-width: 100%;
}
textarea { min-height: 5rem; }
input:focus, select:focus, textarea:focus { border-color: var(--sage); }
input[type="checkbox"], input[type="radio"] { width: 1.3rem; height: 1.3rem; accent-color: var(--charcoal); }input.short { width: 12rem; }
.check { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.95rem; }
.button-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-top: 0.5rem; }

/* ---- top bar and messages ---- */
/* Brand on the left, current page name, then the three-line menu.
   Pinned to the top while scrolling. Its top padding fills the space behind
   the iPhone clock/battery with charcoal. (The card editor sits above it.) */
.top-bar {
  /* "fixed" (not "sticky"): newer iPhone Safari only matches the clock
     area's colour to a bar that is fixed to the top of the screen. */
  position: fixed; top: 0; left: 0; right: 0; z-index: 9;
  display: flex; align-items: center; gap: 0.75rem;
  height: calc(56px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 1rem 0;
  background: var(--charcoal); color: #fff;
}
/* Space under the fixed top bar, so the page starts below it. */
.top-bar-space { height: calc(56px + env(safe-area-inset-top)); }
.top-brand { display: flex; align-items: center; gap: 0.55rem; margin-right: auto; min-width: 0; }
.top-mark { height: 32px; display: block; }
.top-bar .brand { white-space: nowrap; }
.top-page { color: #c9ccc7; font-size: 0.95rem; white-space: nowrap; }

/* Three-line menu (top right) */
.top-menu { position: relative; }
.menu-button {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px;
  border: 1px solid #6b6d70; border-radius: var(--radius);
  background: transparent; color: #fff; cursor: pointer;
}
.menu-button:hover, .menu-button.open { background: var(--charcoal-2); }
/* Number of time-off requests waiting for approval (admin only). */
.menu-badge {
  position: absolute; top: -3px; right: -5px;
  min-width: 20px; height: 20px; padding: 0 5px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 999px; background: var(--alert); color: #fff; border: 2px solid var(--charcoal);
  font-size: 0.75rem; font-weight: bold; line-height: 1;
}
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 8px);
  min-width: 240px; max-width: calc(100vw - 1.5rem);
  background: #fff; color: var(--ink);
  border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  padding: 0.35rem 0;
  z-index: 30;
}
.menu-item {
  display: flex; align-items: center; width: 100%;
  min-height: 48px; padding: 0 1rem;
  border: none; background: none; font: inherit; font-size: 1.05rem; text-align: left;
  color: var(--ink); cursor: pointer;
}
.menu-item:hover { background: var(--sage-light); }
.menu-item.active { font-weight: 700; background: var(--sage-light); }
.menu-icon { flex: none; margin-right: 0.8rem; color: var(--sage); }
.menu-item.active { box-shadow: inset 4px 0 0 var(--charcoal); }
.menu-item.active .menu-icon { color: var(--charcoal); }
/* Who is signed in, at the top of the menu */
.menu-who { padding: 0.35rem 1rem 0.5rem; font-size: 0.75rem; color: var(--muted); }
.menu-who strong { color: var(--muted); font-weight: 600; }
.menu-panel hr { border: none; border-top: 1px solid var(--line); margin: 0.35rem 0; }

/* ---- Left page column (computer-sized screens only) ----
   Phones keep the three-line menu. Here the pages above the divider sit in a
   column on the left, so they are always one click away. About and Sign out
   stay in the three-line menu. */
.side-nav { display: none; }
@media (min-width: 801px) {
  .side-nav {
    display: block;
    position: fixed; left: 0; top: 56px; bottom: 0; width: 210px; z-index: 8;
    padding: 0.6rem 0; overflow-y: auto;
    background: #fff; border-right: 1px solid var(--line);
  }
  .page-area { margin-left: 210px; }
  .menu-panel .menu-main { display: none; }
}
@media print {
  .page-area { margin-left: 0; }
}

/* Look-ahead > Needs a look > Option estimates: option and main estimate side by side in plain blocks */
.la-opt { margin: 0.5rem 0; padding: 0.5rem 0.7rem; border-left: 4px solid var(--alert); background: var(--paper); border-radius: var(--radius-sm); }
.la-opt-main { border-left-color: var(--sage); }
.la-opt-head { font-size: 1rem; }
.la-opt-facts { display: flex; flex-wrap: wrap; gap: 0.2rem 1rem; margin-top: 0.2rem; font-size: 0.92rem; }
.la-opt-diff { margin-top: 0.25rem; font-size: 0.92rem; font-weight: 600; }

/* ---- About page: quiet, smaller text ---- */
.about-page { max-width: 520px; margin: 0 auto; padding: 2rem 1rem 3rem; text-align: center; color: var(--muted); }
.about-mark { height: 72px; }
.about-page h1 { font-size: 1.4rem; color: var(--charcoal); margin: 0.5rem 0 0.2rem; }
.about-tagline { margin: 0; font-size: 0.95rem; }
.about-version { margin: 0.2rem 0 1.5rem; font-size: 0.85rem; }
.about-details { text-align: left; font-size: 0.85rem; background: var(--card); border-radius: var(--radius); padding: 0.8rem 1rem; margin: 0 0 1.2rem; }
.about-details dt { font-weight: bold; color: var(--charcoal); margin-top: 0.6rem; }
.about-details dt:first-child { margin-top: 0; }
.about-details dd { margin: 0.1rem 0 0; }
.about-small { font-size: 0.78rem; margin: 0.4rem 0; }
.about-copy { margin-top: 1.5rem; }

/* ---- admin: People and Trucks ---- */
.admin-page { max-width: 1100px; margin: 0 auto; padding: 1rem; }
.admin-section { background: var(--card); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
.admin-section h2 { margin: 0 0 0.4rem; }
.admin-search { width: 100%; margin: 0.5rem 0; }
.person {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.6rem 1rem;
  padding: 0.7rem 0; border-bottom: 1px solid var(--line-soft);
}
.person.blocked { opacity: 0.55; }
.field { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.85rem; color: var(--muted); }
.field.check { flex-direction: row; align-items: center; color: var(--ink); font-size: 0.95rem; padding-bottom: 0.45rem; }
.field.grow { flex: 1 1 14rem; }
/* ---- People page: one tidy row per person ---- */
.admin-search { width: 100%; max-width: 26rem; }
.pp-help { margin: 0.4rem 0 0.8rem; }
.pp-help summary { cursor: pointer; color: var(--charcoal); font-weight: bold; }
.pp-help ul { margin: 0.5rem 0 0; padding-left: 1.2rem; color: var(--muted); font-size: 0.92rem; }
.pp-help li { margin-bottom: 0.3rem; }
.pp-tools { display: flex; flex-direction: column; gap: 0.5rem; margin: 0.6rem 0 0.8rem; }
.pp-filters { display: flex; flex-wrap: wrap; gap: 0.35rem; }
/* Button rows (Admin tabs, People filters) become one dropdown on a phone. */
.phone-only { display: none; }
.phone-select { width: 100%; font-weight: 600; }
@media (max-width: 800px) {
  .not-phone { display: none !important; }   /* !important: .ta-tabs sets display further down */
  .phone-only { display: block; }
}
.pp-count { display: inline-block; min-width: 1.3rem; margin-left: 0.15rem; padding: 0 0.3rem; border-radius: 999px; background: var(--sage-light); color: var(--ink); font-size: 0.8rem; text-align: center; }
.btn.active .pp-count { background: rgba(255, 255, 255, 0.25); color: #fff; }

.pp-person { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 0.5rem; background: #fff; }
.pp-person.open { border-color: var(--sage); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06); }
.pp-person.blocked { opacity: 0.6; }
.pp-row { display: grid; grid-template-columns: minmax(12rem, 1.6fr) 7.5rem 11.5rem 7.5rem; gap: 0.75rem; align-items: center; padding: 0.6rem 0.8rem; }
.pp-who { min-width: 0; }
.pp-name { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem; font-size: 1.05rem; }
.pp-sub { color: var(--muted); font-size: 0.88rem; overflow-wrap: anywhere; }
.pp-chips { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.25rem; }
/* Tags: the small rounded labels (status, "SoSO", counts of things). One look everywhere. */
.tag, .pp-chip, .to-chip, .badge {
  display: inline-block; font-size: 0.82rem; font-weight: 600; line-height: 1.4;
  padding: 0.1rem 0.6rem; border-radius: 999px;
  background: var(--sage-light); color: var(--ink);
}
.tag.ok { background: var(--ok-bg); color: var(--ok-text); }
.tag.warn { background: var(--warn-bg); color: var(--warn-text); }
.tag.bad { background: var(--danger-bg); color: var(--danger); }
.pp-chip.warn { background: var(--warn-bg); color: var(--warn-text); }
.pp-chip.bad { background: var(--danger-bg); color: var(--danger); }
.pp-field { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.82rem; color: var(--muted); min-width: 0; }
.pp-field select, .pp-field input[type="text"], .pp-field input[type="date"] { width: 100%; color: var(--ink); }
.pp-field .soso-row select { width: auto; min-width: 6rem; }
.pp-field .soso-row input[type="number"] { width: 5rem; }
.pp-field.check { flex-direction: row; align-items: center; gap: 0.4rem; color: var(--ink); font-size: 0.95rem; padding-top: 1.1rem; }
.pp-toggle { white-space: nowrap; }
.pp-details { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 0.8rem 1rem; padding: 0.8rem; border-top: 1px solid var(--line); background: var(--tint); border-radius: 0 0 var(--radius) var(--radius); }
.pp-wide { grid-column: 1 / -1; }
@media (max-width: 800px) {
  .pp-row { grid-template-columns: 1fr 1fr; }
  .pp-who { grid-column: 1 / -1; }
  .pp-toggle { grid-column: 1 / -1; }
}

.super-badge { font-size: 0.75rem; font-weight: normal; padding: 0.05rem 0.45rem; margin-left: 0.3rem; border-radius: 999px; background: var(--charcoal); color: #fff; vertical-align: middle; }
.soso-row { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.field input[type="number"].tiny { width: 5rem; }
.field input[type="text"] { width: 100%; }
.field input.tiny { width: 6rem; }
/* Messages inside a page: one banner style, four meanings (red = error, amber = careful / no signal,
   green = done, grey = information). Put .to-sent / .to-info / .to-warn / .error on a <p>. */
.error, .offline, .to-sent, .to-info, .to-warn {
  margin: 0.8rem 0 0; padding: 0.65rem 1rem; line-height: 1.35;
  border-left: 5px solid var(--sage); border-radius: var(--radius-sm);
  background: var(--sage-light); color: var(--ink);
}
.error { background: var(--danger-bg); color: var(--danger); border-left-color: var(--danger); }
.offline, .to-warn { background: var(--warn-bg); color: var(--warn-text); border-left-color: var(--warn); }
.to-sent { background: var(--ok-bg); color: var(--ok-text); border-left-color: var(--ok); }
.to-sent { cursor: pointer; }
.help-link { color: inherit; font-weight: bold; text-decoration: underline; }

/* ---- login ---- */
.login { max-width: 420px; margin: calc(3rem + env(safe-area-inset-top)) auto 3rem; padding: 1.5rem; background: var(--card); border-radius: var(--radius); text-align: center; }
.login-mark { height: 110px; margin-bottom: 0.5rem; }
.login h1 { font-size: 1.6rem; margin: 0 0 1rem; }
.login form, .login p { text-align: left; }
.login label { display: block; margin: 1rem 0 0.3rem; font-weight: bold; }
.login input { width: 100%; font-size: 1.2rem; padding: 0.7rem; }
.code-input { letter-spacing: 0.4em; text-align: center; }

/* ---- board ---- */
.board-page { padding: 1rem; }
.board-page.with-editor { margin-right: min(560px, 50vw); }
.board-bar { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.board-nav { display: contents; }   /* Prev / date / Next: same row as before on a computer */

/* Date pill: phones only (shown in the phone block below). A small floating pill at the
   bottom: an arrow, the day, an arrow. Tapping the day opens the date picker. */
.date-bar { display: none; }
.date-arrow {
  flex: none; width: 38px; height: 38px; border-radius: 50%; border: none;
  background: var(--charcoal-2); color: #fff; font-size: 1.4rem; line-height: 1; cursor: pointer;
}
.date-arrow:active { background: var(--charcoal-3); }
.date-day {
  position: relative; display: flex; align-items: baseline; justify-content: center; gap: 0.4rem;
  min-width: 8.5rem; height: 38px; padding: 0 0.8rem; align-items: center;
  border-radius: 999px; background: var(--sage); color: #fff; white-space: nowrap; cursor: pointer;
}
.date-day .word { font-weight: 700; font-size: 0.95rem; }
.date-day .rest { font-size: 0.9rem; opacity: 0.95; }
/* The real date box sits invisibly over the day, so tapping it opens the phone's date picker. */
.date-hidden { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.board-date { font-size: 1.6rem; font-weight: normal; margin: 1rem 0 0.3rem; }
.day-tag {
  display: inline-block; vertical-align: middle; margin-left: 0.5rem;
  font-size: 0.95rem; font-weight: bold; padding: 0.15rem 0.7rem; border-radius: 999px;
  background: var(--sage); color: #fff;
}
.day-tag.today { background: var(--warn); }   /* orange: you're editing today's board */

.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-top: 0.7rem; }

.card {
  font-family: var(--font-board);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  font-size: 1.05rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.card.editable { cursor: pointer; }
.card.editable:hover { border-color: var(--sage); }
.card.selected { outline: 3px solid var(--sage); }
.card-empty { color: var(--muted); }
.drag-ghost { opacity: 0.4; outline: 3px dashed var(--sage); }

/* Crew header: boxes with names; lead underlined with trucks under it */
.card-crew { display: flex; flex-wrap: wrap; align-items: center; margin-bottom: 0.6rem; }
.crew-box {
  border: 1px solid var(--line-strong);
  margin: 0 -1px -1px 0;
  padding: 0.2rem 0.6rem;
  min-width: 4.5rem;
  text-align: center;
  display: flex; flex-direction: column; justify-content: center;
}
.crew-box .name { font-size: 1.6rem; font-weight: bold; }
.crew-box.lead .name { text-decoration: underline; }
.crew-box .trucks { font-size: 0.85rem; font-weight: bold; text-decoration: underline; }
.crew-box.me { background: var(--me); }
.crew-box.empty { min-width: 8rem; }

.card-note { font-style: italic; margin: 0.3rem 0 0.6rem; }
.divider { border: none; border-top: 2px dashed var(--line-strong); margin: 0.7rem 0; }

.line { margin: 0.15rem 0; }
/* A little air between one job (with its tasks) and the next, like around the dashed divider.
   A job right under a heading ("Load in:") stays close to it. */
.crew-card .line + .line { margin-top: 0.7rem; }
.crew-card .line.heading + .line { margin-top: 0.15rem; }
.line-text { padding: 0 0.15rem; color: inherit; }
a.map-link { text-decoration: underline; text-decoration-color: var(--sage); text-underline-offset: 3px; }
.line.heading .line-text { font-weight: bold; text-decoration: underline; }
.line.important .line-text { font-weight: bold; color: var(--red); }
.line.crossed .line-text { text-decoration: line-through; color: var(--ink-soft); }

.tasks, .subtasks { margin: 0.1rem 0 0.3rem; padding-left: 1.6rem; }
.subtasks { list-style: lower-alpha; }
.tasks li.important { font-weight: bold; color: var(--red); }
.tasks li.info { font-style: italic; }
.tasks li.done { text-decoration: line-through; color: var(--muted); }

/* Off / School box */
.day-status h3 { margin: 0 0 0.5rem; font-size: 1.1rem; font-family: inherit; color: inherit; }
/* The name column is only as wide as the longest name (never wrapped); the reason gets the rest. */
.day-status table { border-collapse: collapse; width: 100%; }
.day-status td { border: 1px solid var(--line); padding: 0.3rem 0.5rem; overflow-wrap: anywhere; }
.day-status td.name { width: 1%; white-space: nowrap; font-size: 1.3rem; font-weight: bold; }
.day-status td.reason { color: var(--muted); }
.day-status td.no-print { width: 1%; text-align: center; padding: 0.3rem; }
.day-status td.reason input { width: 100%; }

/* ---- card editor (side panel; full screen on phones) ---- */
.editor {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(560px, 100vw);
  overflow-y: auto; overflow-x: hidden;
  background: #fff;
  border-left: 1px solid var(--line);
  box-shadow: -4px 0 16px rgba(0, 0, 0, 0.08);
  padding: 1rem;
  /* --kb is the phone keyboard's height (set by the editor while it is up), so there is
     room to scroll the box you are typing in above it. */
  padding-bottom: calc(max(1rem, env(safe-area-inset-bottom)) + var(--kb, 0px));
  z-index: 10;
}
/* Pinned header, same height and colour as the top bar, so Done sits level with it. */
.editor { padding-top: 0; }
.editor-head {
  position: sticky; top: 0; z-index: 2;
  display: flex; justify-content: space-between; align-items: center;
  height: calc(56px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 1rem 0;
  margin: 0 -1rem 0.5rem;
  background: var(--charcoal); color: #fff;
}
.editor-head h2 { margin: 0; font-size: 1.15rem; }
.editor-head .btn { height: 36px; padding: 0 1.1rem; background: var(--sage); border-color: var(--sage); color: #fff; font-weight: bold; }
.editor section { border-top: 1px solid var(--line); padding: 0.8rem 0; }
.editor h3 { margin: 0 0 0.5rem; font-size: 1rem; }
.editor input[type="text"] { width: 100%; }
.editor input.short { width: 10rem; }
.editor input.tiny { width: 5rem; }
.editor select { width: 100%; }
.editor-foot { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.warn { color: var(--warn); font-size: 0.85rem; margin-left: 0.4rem; }

.edit-line .crossed { text-decoration: line-through; }
.job-settings { margin-top: 0.4rem; font-size: 0.95rem; }
.job-settings summary { cursor: pointer; color: var(--muted); padding: 0.2rem 0; }
.setting-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin: 0.4rem 0; }
.setting-row > span { flex: 1 1 12rem; }
.copy-row { background: var(--sage-light); padding: 0.4rem; border-radius: var(--radius-sm); }
.copy-row select { flex: 1 1 12rem; width: auto; }
.task-row input.done { text-decoration: line-through; color: var(--muted); }
.task-row input.important { font-weight: bold; color: var(--red); }
.task-row input.info { font-style: italic; }
.divider-label { font-weight: bold; color: var(--muted); border-top: 2px dashed var(--line-strong); padding-top: 0.4rem; }
.add-line { margin-top: 0.8rem; scroll-margin-top: calc(56px + env(safe-area-inset-top) + 0.5rem); }   /* clears the pinned header */

/* ---- card editor: tags, pills, ⋯ buttons, fold-out panels ---- */
.editor { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.editor h3 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.6rem; align-items: center; }
.chip {
  display: inline-flex; align-items: center; gap: 0.35rem;
  min-height: 40px; padding: 0 0.9rem;
  border: 1px solid var(--line); border-radius: 999px;
  background: #fff; color: var(--ink); font: inherit; font-size: 1.05rem; cursor: pointer;
}
.chip.lead { font-weight: bold; }
.chip.open { background: var(--charcoal); color: #fff; border-color: var(--charcoal); }
.chip.flagged { border-color: var(--warn); }
.chip-star { color: var(--sage); }
.chip.open .chip-star { color: #fff; }
.chip-dot {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.1rem; height: 1.1rem; border-radius: 50%;
  background: var(--warn); color: #fff; font-size: 0.75rem; font-weight: bold;
}
.chip-x { border: none; background: none; color: var(--muted); font-size: 1rem; padding: 0 0 0 0.2rem; cursor: pointer; min-width: 28px; min-height: 36px; }

.pill-row { display: flex; flex-wrap: wrap; gap: 0.45rem; margin: 0.4rem 0; }
.pill {
  min-height: 40px; padding: 0 0.9rem;
  border: 1px solid var(--line); border-radius: 999px;
  background: #fff; color: var(--ink); font: inherit; font-size: 0.95rem; cursor: pointer;
}
.pill:hover { background: var(--sage-light); }
.pill.on { background: var(--sage); border-color: var(--sage); color: #fff; }
.pill.danger { color: var(--red); border-color: #f0c9c9; }
.pill:disabled { opacity: 0.6; cursor: default; }

.panel { background: var(--paper); border-radius: var(--radius); padding: 0.7rem 0.8rem; margin: 0.4rem 0 0.6rem; }
.panel-title { margin: 0 0 0.4rem; font-weight: bold; }
.panel .field { margin: 0.3rem 0; }
.add-select { margin-top: 0.2rem; }

.icon-btn {
  flex: none; width: 40px; height: 40px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: #fff; color: var(--ink); font-size: 1.3rem; line-height: 1; cursor: pointer;
}
.icon-btn.small { width: 36px; height: 36px; font-size: 1.1rem; }
.icon-btn.on { background: var(--charcoal); color: #fff; border-color: var(--charcoal); }

.edit-line { border: 1px solid var(--line); border-radius: var(--radius); padding: 0.6rem; margin-bottom: 0.7rem; background: #fff; }
.edit-line.is-open { border-color: var(--sage); }
.line-head { display: flex; align-items: flex-start; gap: 0.5rem; }
.drag-handle {
  flex: none; width: 28px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 1.3rem; cursor: grab;
  touch-action: none;   /* so a finger on the grip drags instead of scrolling */
}
.drag-handle:active { cursor: grabbing; }
/* Grip on a task or sub-point. A separate class, so it drags the task and not the job line. */
.task-grip {
  flex: none; width: 24px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 1.1rem; cursor: grab;
  touch-action: none;
}
.task-grip:active { cursor: grabbing; }
.line-title { flex: 1; min-width: 0; padding-top: 0.45rem; font-size: 1.05rem; }
.line-title.crossed .line-text { text-decoration: line-through; color: var(--ink-soft); }
.line-title.important .line-text { font-weight: bold; color: var(--red); }
.line-note { color: var(--muted); margin-left: 0.3rem; }
.line-title-input { flex: 1; min-width: 0; }
.editor input.line-title-input.heading { font-weight: bold; text-decoration: underline; }
.editor input.line-title-input.important { color: var(--red); font-weight: bold; }
.editor input.line-title-input.crossed { text-decoration: line-through; }
.badges { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.3rem; }

.edit-tasks, .edit-subtasks { list-style: none; margin: 0.5rem 0 0; padding: 0; }
.edit-subtasks { padding-left: 1.8rem; margin-top: 0.2rem; }
.task-row { display: flex; align-items: center; gap: 0.5rem; margin: 0.3rem 0; }
.task-done { flex: none; width: 22px; height: 22px; accent-color: var(--sage); }
.editor input.task-text { flex: 1; min-width: 0; width: auto; }
.task-text.done { text-decoration: line-through; color: var(--muted); }
.task-text.important { font-weight: bold; color: var(--red); }
.task-text.info { font-style: italic; }
.task-panel { margin-left: 1.9rem; }
.new-row { display: flex; gap: 0.5rem; align-items: center; margin: 0.4rem 0; }
.editor .new-row input { flex: 1; min-width: 0; width: auto; }
.add-line .check { margin: 0.2rem 0 0.4rem; }

.job-picker { margin-top: 0.5rem; }
.job-picker input { width: 100%; }
.pick-list { list-style: none; padding: 0; margin: 0.3rem 0 0; max-height: 18rem; overflow-y: auto; }
.pick-list button {
  width: 100%; text-align: left; font: inherit;
  padding: 0.55rem 0.5rem; border: none; border-bottom: 1px solid var(--line-soft);
  background: #fff; cursor: pointer;
}
.pick-list button:hover { background: var(--sage-light); }
.swatch { display: inline-block; width: 0.9rem; height: 0.9rem; border: 1px solid var(--line); vertical-align: middle; margin-right: 0.3rem; }

/* ---- crew phone view ---- */
.crew-view { max-width: 640px; margin: 0 auto; padding: 1rem; }
.day-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.crew-view .card { margin-bottom: 0.6rem; font-size: 1.15rem; }
.crew-view .line { margin: 0.4rem 0; }   /* room between address links so a thumb hits the right one */
.my-status { font-size: 1.3rem; background: var(--card); padding: 1rem; border-radius: var(--radius); border-left: 5px solid var(--sage); }
.big-hint { font-size: 1.2rem; text-align: center; padding: 1.5rem 0; }

/* ---- time off page ---- */
.time-off { max-width: 640px; margin: 0 auto; padding: 1rem; }
.to-title { margin: 0 0 0.5rem; }
.to-heading { margin: 1.5rem 0 0.5rem; }
.to-anchor { scroll-margin-top: calc(56px + env(safe-area-inset-top) + 0.5rem); }   /* clears the pinned top bar */
.to-add-end { margin-top: 0.5rem; }
.to-form { background: var(--card); border-radius: var(--radius); padding: 1rem; margin-top: 0.75rem; }
.to-form h2 { margin: 0 0 0.25rem; }
.to-form h3 { margin: 1rem 0 0.4rem; font-size: 1.05rem; }
.to-types { display: grid; grid-template-columns: 1fr; gap: 0.5rem; }
/* Time-off type buttons: one full-width row each, a chevron on the right, a tick when chosen. */
.to-type { position: relative; text-align: left; padding-right: 3rem; }
.to-type::after { content: "\203A"; position: absolute; right: 1.1rem; top: 50%; transform: translateY(-50%); font-size: 1.6rem; font-weight: 400; opacity: 0.6; }
.to-type.active::after { content: "\2713"; font-size: 1.3rem; opacity: 1; }
.to-two { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.to-field { display: flex; flex-direction: column; gap: 0.25rem; margin-top: 0.8rem; font-weight: bold; }
.to-field .hint { font-weight: normal; }
.to-field input, .to-field textarea { width: 100%; font-weight: normal; }
.to-field input[type="date"], .to-field input[type="time"] { min-height: 48px; }
.to-check { margin-top: 1rem; font-size: 1.05rem; display: flex; align-items: center; gap: 0.6rem; min-height: var(--tap); }
.to-help { margin-top: 0.75rem; }
.to-help summary { cursor: pointer; color: var(--charcoal); font-weight: bold; }
.to-help dt { font-weight: bold; margin-top: 0.6rem; }
.to-help dd { margin: 0.1rem 0 0; color: var(--muted); }
.to-more { margin-top: 0.3rem; }
.to-more summary { cursor: pointer; color: var(--charcoal); text-decoration: underline; }
.to-more p { margin: 0.4rem 0 0; color: var(--ink); }
.to-more-chosen { margin-top: 0.8rem; }
.to-preview { font-size: 1.1rem; font-weight: bold; margin: 0.8rem 0 0; }
.to-row { background: var(--card); border-radius: var(--radius); padding: 0.8rem 1rem; margin-bottom: 0.6rem; border-left: 5px solid var(--line); }
.to-row.pending { border-left-color: var(--warn); }
/* A change under the approved request it changes: indented, like a sub-request. */
.to-row.to-sub { margin-left: 1.4rem; margin-top: -0.25rem; border-left-style: dashed; background: var(--tint); position: relative; }
.to-row.to-sub::before { content: "↳"; position: absolute; left: -1.25rem; top: 0.7rem; color: var(--muted); }
.to-row.approved { border-left-color: var(--ok-text); }
.to-row.declined, .to-row.cancelled { border-left-color: var(--line); opacity: 0.85; }
.to-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.4rem; align-items: baseline; }
.to-chip.pending { background: var(--warn-bg); color: var(--warn-text); }
.to-chip.approved { background: var(--ok-bg); color: var(--ok-text); }
.to-chip.approved::before { content: "\2713  "; }
.to-chip.pending::before { content: "\2026  "; }
.to-chip.declined::before { content: "\2715  "; }
.to-row .to-chip { font-size: 0.95rem; padding: 0.15rem 0.7rem; }
.to-chip.declined { background: var(--danger-bg); color: var(--danger); }
.to-office { margin-top: 0.3rem; font-style: italic; }

/* ---- approve time off (admin) ---- */
.ta { max-width: 760px; }
.ta-tabs { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.75rem; }
/* On a phone the four tabs sit in a neat 2 x 2 grid. */
@media (max-width: 800px) {
  .ta-tabs { display: grid; grid-template-columns: 1fr 1fr; }
  .ta-tabs .btn { width: 100%; }
}
.ta-count { display: inline-block; min-width: 1.4rem; padding: 0 0.35rem; margin-left: 0.2rem; border-radius: 999px; background: var(--warn); color: #fff; font-size: 0.85rem; text-align: center; }
.ta-row .button-row { margin-top: 0.7rem; }
.ta-name { font-size: 1.15rem; }
.ta-title { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.to-chip.warn { background: var(--warn-bg); color: var(--warn-text); }
/* Was / Now for a change to approved time off */
.ta-compare { display: grid; grid-template-columns: 2.6rem 1fr; gap: 0.2rem 0.6rem; margin-top: 0.4rem; padding: 0.5rem 0.7rem; background: var(--sage-light); border-radius: var(--radius); }
.ta-compare .lbl { color: var(--muted); font-size: 0.85rem; padding-top: 0.1rem; }
/* Short labelled lines: Note, Vacation position, Also off */
.ta-facts { display: grid; gap: 0.2rem; margin-top: 0.45rem; font-size: 0.92rem; }
.ta-fact { display: flex; gap: 0.6rem; padding: 0.15rem 0.5rem; border-radius: var(--radius-sm); }
.ta-fact .lbl { flex: 0 0 5.8rem; color: var(--muted); }
.ta-fact.bad { background: var(--warn-bg); color: var(--warn-text); }
.ta-fact.bad .lbl { color: var(--warn-text); }
.ta-what { margin-top: 0.15rem; }
.ta-note { margin-top: 0.3rem; background: var(--sage-light); padding: 0.4rem 0.6rem; border-radius: var(--radius-sm); }
.ta-small { font-size: 0.92rem; margin-top: 0.4rem; padding: 0.35rem 0.6rem; }
.ta-edit { margin-top: 0.6rem; padding-top: 0.4rem; border-top: 1px solid var(--line); }
.ta:has(.th) { max-width: 1100px; }
.th-filters { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 0.5rem; }
.th-heading { margin: 1.2rem 0 0.3rem; }
.th-name { font: inherit; border: none; background: none; padding: 0; color: var(--charcoal); text-decoration: underline; cursor: pointer; text-align: left; }
/* Totals: one small card per person, the numbers in a tidy grid (no sideways scrolling) */
.th-totals { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: 0.6rem; }
.th-total.to-row { margin-bottom: 0; }
.th-total.inactive { opacity: 0.7; }
.th-total-top { flex-wrap: nowrap; align-items: center; }
.th-total-top .ta-title { flex: 1; min-width: 0; }
.th-short { color: var(--muted); white-space: nowrap; }
.th-short.neg { color: var(--red); font-weight: 600; }
.th-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.35rem 0.5rem; margin-top: 0.5rem; }
.th-stat { display: flex; flex-direction: column; gap: 0.1rem; padding: 0.3rem 0.45rem; background: var(--tint); border-radius: var(--radius-sm); min-width: 0; }
.th-stat .lbl { font-size: 0.75rem; color: var(--muted); white-space: nowrap; }
.th-stat strong { font-size: 1.05rem; }
.th-stat.neg { background: var(--warn-bg); color: var(--red); }
.th-stat.neg .lbl { color: var(--red); }
.th-soso { margin-top: 0.4rem; }
.ta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 0.5rem; }
/* History Edit panel: boxes line up, the note sits below them, the checkbox sits level with its text */
.th .ta-grid { align-items: start; }
.th .ta-grid select { min-height: 48px; }
.th .th-note { margin: 0.4rem 0 0; }
.th .ta-edit .to-check { display: flex; align-items: center; gap: 0.5rem; }
/* Admin page: the tabs sit right above the page they switch */
.admin-tabs { padding-bottom: 0; }
.admin-tabs .ta-tabs { margin-bottom: 0; }
/* Holidays: left-aligned with the tabs, and the suggested-holidays list */
.hl-page { max-width: 760px; }
.hl-page .to-field input, .hl-page .to-field select { min-height: 48px; }
.hl-page .button-row { margin-bottom: 0.8rem; }
.hl-page .to-row .button-row { margin-bottom: 0; }
.hl-sugg { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 0.8rem; padding: 0.2rem 0; border-bottom: 1px solid var(--line-soft); }
.hl-sugg:last-of-type { border-bottom: none; }
.hl-sugg.done { opacity: 0.6; }
.hl-sugg .to-check { margin-top: 0; display: flex; align-items: center; gap: 0.5rem; }
/* History: each request is a card like on "Coming up", not too wide on a big screen */
.th .ta-row { max-width: 52rem; }

/* ---- phones and small screens ---- */
@media (max-width: 800px) {
  .cards { grid-template-columns: 1fr; }
  .board-page { padding: 0.75rem; padding-bottom: calc(4.4rem + env(safe-area-inset-bottom)); }   /* room for the date pill */
  .board-page.with-editor { margin-right: 0; }

  /* Phone: the top Prev / date / Next row is hidden, and + Card sits on the left,
     away from the TV and PDF buttons. */
  .board-nav { display: none; }
  .board-bar .grow { display: none; }
  .board-bar .add-card { margin-right: auto; }

  /* The floating date pill at the bottom of the phone screen. */
  .date-bar {
    position: fixed; left: 50%; transform: translateX(-50%);
    bottom: calc(0.7rem + env(safe-area-inset-bottom)); z-index: 8;
    display: flex; align-items: center; gap: 0.25rem; padding: 0.25rem;
    background: var(--charcoal); border-radius: 999px; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
  }
  .crew-box .name { font-size: 1.35rem; }

  /* 16px text stops iPhone zooming in when you tap a box */
  input, select, textarea { font-size: 16px !important; }

  /* Editor: task text on its own line, buttons underneath */

  /* Top bar on phones: pin + short brand, current page, menu. */
  .top-bar { gap: 0.5rem; padding-left: 0.75rem; padding-right: 0.75rem; }
  .top-bar .brand { font-size: 0.9rem; }
  .top-bar .brand-light { display: none; }
  .btn.small { padding: 0.4rem 0.7rem; }
}

/* ---- error pop-up: a small window under the top bar, same look as the dialog ---- */
.toast {
  position: fixed; z-index: 40; left: 50%; transform: translateX(-50%);
  top: calc(56px + env(safe-area-inset-top) + 0.6rem);
  width: min(30rem, calc(100vw - 1.5rem));
  display: flex; align-items: flex-start; gap: var(--s3);
  padding: var(--s3); background: #fff; color: var(--ink); line-height: 1.35;
  border-left: 5px solid var(--danger); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  animation: toast-in 0.18s ease-out;
}
.toast-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.toast-title { display: block; margin-bottom: 0.2rem; color: var(--danger); font-family: var(--font-head); }
.toast .btn { flex: none; }
/* Small, quiet "Undo" pill at the bottom (above the date pill on phones). */
.undo-pill {
  position: fixed; z-index: 45; left: 50%; transform: translateX(-50%);
  bottom: calc(0.8rem + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.3rem 0.4rem 0.3rem 0.9rem; font-size: 0.9rem;
  background: var(--charcoal); color: #fff; border-radius: 999px; box-shadow: var(--shadow-lg);
  white-space: nowrap;
}
.undo-pill button {
  min-height: 32px; padding: 0 0.9rem; border: none; border-radius: 999px;
  background: rgba(255, 255, 255, 0.18); color: #fff; font: inherit; font-weight: 700; cursor: pointer;
}
@media (max-width: 800px) { .undo-pill { bottom: calc(4.6rem + env(safe-area-inset-bottom)); } }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, -8px); } }

/* ---- empty screens (nothing here yet) ---- */
.empty-state { margin-top: var(--s3); padding: var(--s5) var(--s3); text-align: center; background: var(--card); border-radius: var(--radius); }
.empty-state h2 { margin: var(--s2) 0; }
.empty-state p { margin: var(--s1) auto; max-width: 28rem; }
.empty-icon { width: 56px; height: 56px; color: var(--sage); }
.empty-actions { justify-content: center; margin-top: var(--s3); }
.empty-state.empty-small { padding: var(--s3); }

/* ---- loading placeholders: grey blocks shaped like what is coming ---- */
.skeleton {
  border-radius: var(--radius);
  background: linear-gradient(90deg, var(--sage-light) 25%, #f1f2ef 50%, var(--sage-light) 75%);
  background-size: 200% 100%; animation: shimmer 1.3s linear infinite;
}
.skeleton-card { height: 9rem; margin-bottom: var(--s2); }
.skeleton-row { height: 4.5rem; margin-bottom: var(--s2); }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } .toast { animation: none; } .spinner { animation-duration: 2.5s; } }

/* If the first screen takes a while (weak signal), say so after a few seconds. */
.splash-slow { margin: 0; max-width: 18rem; text-align: center; color: var(--muted); font-size: 0.9rem; opacity: 0; animation: fade-in 0.6s ease 8s forwards; }
@keyframes fade-in { to { opacity: 1; } }
/* ---- in-app dialog (replaces the browser's own pop-ups) ---- */
.dialog-backdrop {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  padding: var(--s3); background: rgba(30, 31, 33, 0.55);
}
.dialog {
  width: 100%; max-width: 26rem; max-height: 100%; overflow-y: auto;
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: var(--s4) var(--s4) var(--s3);
}
.dialog-title { margin: 0 0 var(--s2); font-size: var(--h2); }
.dialog-body { margin: 0 0 var(--s3); white-space: pre-line; color: var(--ink); line-height: 1.4; }
.dialog-buttons { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s3); }
.dialog-buttons .btn { flex: 1 1 8rem; }
/* Stacked choices. (The 8rem basis above is meant for side-by-side buttons; stacked it made each one 8rem tall.) */
.dialog-links { flex-direction: column; flex-wrap: nowrap; }
.dialog-links .btn { flex: none; width: 100%; }
.dialog-links a.btn { display: flex; align-items: center; justify-content: center; text-decoration: none; }

/* ---- phones and touch screens: every button, box and tick is easy to hit ---- */
@media (max-width: 800px), (pointer: coarse) {
  :root { --tap: 48px; --tap-big: 56px; }
  .btn.small { min-height: 44px; padding: 0.3rem 0.9rem; }
  .pill { min-height: 44px; }
  .icon-btn, .icon-btn.small { width: 44px; height: 44px; }
  .chip-x { min-width: 44px; min-height: 44px; }
  .date-arrow { width: 44px; height: 44px; }
  .date-day { height: 44px; }
  .editor-head .btn { min-height: 40px; }
  .menu-item { min-height: 52px; }
  input[type="checkbox"], input[type="radio"] { width: 1.5rem; height: 1.5rem; }
  .task-done { width: 26px; height: 26px; }
  .drag-handle { width: 36px; height: 44px; }
  .task-grip { width: 32px; height: 44px; }
}
/* ---- crew: the Send button stays at the bottom of the screen while the form scrolls ---- */
@media (max-width: 800px) {
  .to-send {
    position: sticky; bottom: calc(var(--s2) + env(safe-area-inset-bottom)); z-index: 5;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
  }
  .to-send:disabled, .to-send:disabled:hover { opacity: 1; background: var(--line); border-color: var(--line); color: var(--muted); box-shadow: none; }
}
/* ---- TV picture (drawn off-screen, saved as a 1920 x 1080 PNG) ---- */
.tv-offscreen { position: fixed; left: -10000px; top: 0; }
.tv-board {
  --tv-font: 19px;          /* shrunk automatically on busy days */
  width: 1920px; height: 1080px; overflow: hidden;
  padding: 22px 32px 26px;
  background: #fff;
  color: #000;
  font-family: var(--font-board);
}
.tv-head { display: flex; align-items: center; justify-content: center; gap: 18px; margin-bottom: 12px; }
.tv-head > img { height: 46px; }
.tv-head .brand { font-size: 30px; color: var(--charcoal); }
.tv-head .tv-date { font-size: 30px; margin-left: 24px; }
/* Black background + gaps = the thick black lines between boxes, like the PDF. */
.tv-grid { display: grid; gap: 4px; background: #000; max-width: 1856px; margin: 0 auto; }
.tv-grid > .card {
  border: none; border-radius: 0;
  padding: calc(var(--tv-font) * 0.75) calc(var(--tv-font) * 1);
  font-size: var(--tv-font);
}
.tv-grid .card-crew { justify-content: center; }
.tv-grid .crew-box .name { font-size: calc(var(--tv-font) * 1.55); }
.tv-grid .crew-box .trucks { font-size: calc(var(--tv-font) * 0.8); }
.tv-grid .day-status td.name { font-size: calc(var(--tv-font) * 1.2); }
.tv-grid .day-status h3 { font-size: calc(var(--tv-font) * 1.1); }
/* ---- archive PDF pages (drawn off-screen): letter size, 2 x 2 cards ---- */
.pdf-page {
  width: 816px; height: 1056px;
  padding: 30px 34px 20px;
  display: flex; flex-direction: column;
  background: #fff; color: #000;
  font-family: var(--font-board);
}
.pdf-head { display: flex; align-items: center; gap: 10px; padding-bottom: 10px; }
.pdf-head > img { height: 30px; }
.pdf-head .brand { font-size: 16px; color: var(--charcoal); }
.pdf-date { font-size: 20px; }
.pdf-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.pdf-grid > .card {
  border: none; border-radius: 0;
  padding: 12px 16px;
  font-size: 13.5px; line-height: 1.3;
  overflow: hidden;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.pdf-grid > :nth-child(odd) { border-right: 4px solid #000; }
.pdf-grid > :nth-child(-n+2) { border-bottom: 4px solid #000; }
.pdf-grid .crew-box .name { font-size: 22px; }
.pdf-grid .crew-box .trucks { font-size: 11px; }
.pdf-grid .day-status td.name { font-size: 17px; }
.pdf-foot { text-align: center; font-size: 11px; color: var(--muted); padding-top: 6px; }

/* ---- printing (Ctrl+P): 2 x 2 cards per page ---- */
@media print {
  @page { size: letter portrait; margin: 0.4in; }
  body, :root { background: #fff; }
  .no-print, .editor, .top-bar, .toast, .tv-offscreen { display: none !important; }
  .board-page { padding: 0; margin: 0 !important; }
  .board-date { font-size: 14pt; margin: 0 0 0.1in; }
  .cards { gap: 0; grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .card {
    border: none; border-radius: 0;
    border-right: 3px solid #000; border-bottom: 3px solid #000;
    height: 4.9in; overflow: hidden;
    break-inside: avoid; page-break-inside: avoid;
    font-size: 10.5pt;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
  .card:nth-child(2n) { border-right: none; }
  .crew-box .name { font-size: 18pt; }
}

/* ---------------------------------------------------------------------
   Look-ahead (projected workload). Office and admin.
   --------------------------------------------------------------------- */
.la-page { max-width: 1200px; margin: 0 auto; padding: 1rem; }
.la-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; margin-bottom: 0.75rem; }
.la-head h1 { margin: 0; }
.la-tabs { display: flex; flex-wrap: wrap; gap: 0.5rem; }
/* just the gear: no box or background */
.btn.la-gear, .btn.la-gear:hover, .btn.la-gear.active { margin-left: auto; width: 44px; height: 44px; padding: 0; display: inline-flex; align-items: center; justify-content: center; background: none; border: 0; box-shadow: none; color: var(--ink-soft); }
.btn.la-gear:hover { color: var(--ink); }
.la-gear svg { width: 28px; height: 28px; }
/* in Settings: the gear turns the brand orange with a bar under it, and the page says "Settings" */
.btn.la-gear.active { color: var(--la-in_progress); box-shadow: inset 0 -3px 0 var(--la-in_progress); border-radius: 4px 4px 0 0; }
.btn.la-gear.active svg { stroke-width: 2.4; }
.la-set-title { margin: 0.2rem 0 0.6rem; }
.la-flash { margin-left: auto; padding: 0.2rem 0.75rem; border-radius: 999px; background: var(--ok-bg); color: var(--ok-text); font-weight: 600; font-size: 0.9rem; }
.la-loading { margin-top: 1rem; }
.la-nudge { cursor: pointer; margin-top: 0; }
.la-controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.6rem 1rem; margin: 0.5rem 0 0.8rem; }
.la-toggle, .la-nav { display: flex; gap: 0.35rem; }
.la-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 0.8rem 1rem 1rem; }
.la-title { font-size: 1.15rem; text-align: center; margin: 0 0 0.4rem; }
.la-sub { font-size: 1.1rem; margin-top: 1.4rem; }
.la-updated { text-align: center; margin: 0.4rem 0 0; }

/* the chart */
.la-chart svg { width: 100%; height: auto; display: block; }
.la-l-complete    { fill: var(--la-complete);    background: var(--la-complete); }
.la-l-in_progress { fill: var(--la-in_progress); background: var(--la-in_progress); }
.la-l-scheduled   { fill: var(--la-scheduled);   background: var(--la-scheduled); }
.la-l-awarded     { fill: var(--la-awarded);     background: var(--la-awarded); }
.la-l-estimated   { fill: var(--la-estimated);   background: var(--la-estimated); }
.la-hatch-bg { fill: #fff; }
.la-hatch-line { stroke: var(--la-subbed); stroke-width: 2.4; }
.la-capacity { stroke: var(--la-capacity); stroke-width: 2.5; stroke-linejoin: round; }
.la-gridline { stroke: var(--line-soft); stroke-width: 1; }
.la-weekline { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 3; }
.la-baseline { stroke: var(--line-strong); stroke-width: 1; }
.la-axis { font-size: 11px; fill: var(--muted); font-family: var(--font-body); }
.la-holiday { fill: var(--line-soft); }
.la-holiday-text { font-size: 11px; font-weight: 700; letter-spacing: 0.2em; fill: var(--muted); font-family: var(--font-body); }
.la-holiday-dot { fill: var(--muted); }
.la-today { stroke: var(--charcoal); stroke-width: 1.2; stroke-dasharray: 4 3; }
.la-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.3rem 1rem; list-style: none; margin: 0.5rem 0 0; padding: 0; font-size: 0.85rem; color: var(--ink-soft); }
.la-legend li { display: flex; align-items: center; gap: 0.35rem; }
.la-swatch { display: inline-block; width: 0.9rem; height: 0.9rem; border-radius: 3px; }
.la-swatch.la-l-subbed { border: 1px solid var(--la-subbed); background: repeating-linear-gradient(45deg, var(--la-subbed) 0 2px, #fff 2px 5px); }
.la-swatch-line { display: inline-block; width: 1.4rem; height: 0; border-top: 3px solid var(--la-capacity); box-shadow: 0 0 0 1px #fff; }

/* week by week */
.la-weeks-head, .la-week { display: grid; grid-template-columns: minmax(8rem, 2.2fr) repeat(2, minmax(4.5rem, 1fr)) minmax(9rem, 1.5fr); gap: 0.5rem; align-items: center; }
.la-weeks-head { padding: 0 1rem; font-size: 0.8rem; color: var(--muted); }
.la-week { background: var(--card); border-radius: var(--radius-sm); border-left: 5px solid var(--line); padding: 0.45rem 1rem 0.45rem 0.9rem; margin-top: 0.3rem; }
.la-week.la-room { border-left-color: var(--ok); }
.la-week.la-near { border-left-color: var(--la-near); }
.la-week.la-over { border-left-color: var(--danger); }
.la-week small { color: var(--muted); }
.la-week-date { font-weight: 600; }
.la-load { display: flex; align-items: center; gap: 0.4rem; font-weight: 600; }
.la-meter { position: relative; flex: none; display: inline-block; width: 5rem; height: 0.55rem; border-radius: 999px; background: var(--sage-light); overflow: hidden; }
.la-meter span { position: absolute; left: 0; top: 0; height: 100%; }
.la-meter-firm { background: var(--ok); }
.la-week.la-near .la-meter-firm { background: var(--la-near); }
.la-week.la-over .la-meter-firm { background: var(--danger); }
.la-load-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.la-load-text strong { font-size: 1.05rem; }
.la-load-text small { font-weight: 400; color: var(--muted); white-space: nowrap; }
/* every week row the same height, one line per cell (two in the load cell) */
@media (min-width: 801px) {
  .la-week { height: 3.6rem; }
  .la-week > span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .la-week > .la-load { overflow: visible; }
}
.la-cell-label { display: none; font-size: 0.8rem; color: var(--muted); }

/* "Keep chart in view": the chart card stays under the top bar while the weeks below scroll */
.la-card.pinned { position: sticky; top: calc(56px + env(safe-area-inset-top) + 6px); z-index: 8; box-shadow: var(--shadow), 0 6px 10px -6px rgba(0, 0, 0, 0.25); }
.la-card.pinned .la-updated { display: none; }
.la-sub-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.8rem; margin-top: 1.4rem; }
.la-sub-row .la-sub { margin: 0; }

/* the jobs inside a week */
.la-week { cursor: pointer; }
.la-week:hover { box-shadow: var(--shadow); }
.la-chev { display: inline-block; width: 1em; color: var(--muted); }
/* the jobs in a week: a list, one row per job, same look as the Jobs tab */
.la-week-jobs { margin: 0.25rem 0 0.5rem; padding: 0.4rem 0.5rem 0.5rem; background: var(--tint); border-radius: var(--radius-sm); }
.la-week-jobs > p { margin: 0.2rem 0.3rem; }
.la-wrow { display: grid; grid-template-columns: minmax(13rem, 3fr) minmax(10rem, 2fr) minmax(6.5rem, 1fr) minmax(6rem, 1fr) minmax(9rem, 1.4fr); gap: 0.5rem; align-items: center; min-height: 3.2rem; margin-top: 0.25rem; padding: 0.3rem 0.7rem; background: var(--card); border-left: 5px solid var(--line); border-radius: var(--radius-sm); font-size: 0.92rem; cursor: pointer; }
.la-wrow:hover { box-shadow: var(--shadow); }
.la-wrow.st-in_progress { border-left-color: var(--la-in_progress); }
.la-wrow.st-scheduled { border-left-color: var(--la-scheduled); }
.la-wrow.st-awarded { border-left-color: var(--la-awarded); }
.la-wrow.st-estimated { border-left-color: var(--la-estimated); }
.la-wrow.st-complete { border-left-color: var(--la-complete); }
.la-wrow-head { min-height: 0; margin-top: 0; padding-top: 0; padding-bottom: 0.1rem; background: none; border-left-color: transparent; font-size: 0.78rem; color: var(--muted); cursor: default; }
.la-wrow-head:hover { box-shadow: none; }
.la-w-job, .la-w-work, .la-w-num { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; line-height: 1.25; }
.la-w-job strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.la-w-job small, .la-w-num small { color: var(--muted); font-size: 0.82rem; }
.la-w-work { align-items: flex-start; }
.la-w-tags { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.la-w-who, .la-w-dates { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* an older global ".warn" style adds size and a margin; keep the amber tags here the same as the others */
.la-page .tag.warn { font-size: 0.82rem; margin-left: 0; }
/* status tags (the same colours as the chart) */
.tag.la-tag-in_progress { background: var(--la-in_progress); color: #fff; }
.tag.la-tag-scheduled { background: var(--ok-bg); color: var(--ok-text); }
.tag.la-tag-awarded { background: var(--la-awarded); color: #fff; }
.tag.la-tag-estimated { background: #e4edf2; }
.tag.la-tag-lost { background: #eee; color: var(--muted); }

/* Jobs list */
.la-filters { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.la-search { width: 100%; max-width: 32rem; margin: 0.7rem 0; }
.la-row { display: grid; grid-template-columns: minmax(14rem, 3fr) minmax(9rem, 1.7fr) minmax(8rem, 1.3fr) 6rem 9.5rem; gap: 0.75rem; align-items: center; background: var(--card); border-radius: var(--radius-sm); border-left: 5px solid var(--line); padding: 0.55rem 0.9rem; margin-bottom: 0.4rem; cursor: pointer; }
.la-row:hover { box-shadow: var(--shadow); }
.la-row.st-in_progress { border-left-color: var(--la-in_progress); }
.la-row.st-scheduled { border-left-color: var(--la-scheduled); }
.la-row.st-awarded { border-left-color: var(--la-awarded); }
.la-row.st-estimated { border-left-color: var(--la-estimated); }
.la-row.st-complete { border-left-color: var(--la-complete); }
.la-row.st-lost { border-left-color: var(--line); opacity: 0.7; }
.la-job { font-weight: 700; overflow-wrap: anywhere; }
.la-cust { font-weight: 400; color: var(--muted); }
.la-what { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.2rem; }
.la-when, .la-size, .la-who { font-size: 0.95rem; }
.la-status { font: inherit; font-size: 0.88rem; font-weight: 600; min-height: 36px; padding: 0.15rem 0.6rem; border-radius: 999px; border: 1px solid var(--line); background: var(--sage-light); color: var(--ink); }
span.la-status { display: inline-flex; align-items: center; }
.la-status.st-in_progress { background: var(--la-in_progress); border-color: var(--la-in_progress); color: #fff; }
.la-status.st-scheduled { background: var(--ok-bg); border-color: var(--ok); color: var(--ok-text); }
.la-status.st-awarded { background: var(--la-awarded); border-color: var(--la-awarded); color: #fff; }
.la-status.st-estimated { background: #e4edf2; border-color: var(--la-estimated); }
.la-status.st-lost { background: #eee; color: var(--muted); }

/* Needs a look */
.la-box { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 0.9rem 1rem; margin-bottom: 1rem; }
.la-box h2 { font-size: 1.1rem; }
.la-item { padding: 0.55rem 0; border-top: 1px solid var(--line-soft); }
.la-inline { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.la-item.la-inline { justify-content: space-between; align-items: flex-start; }
.la-grow { flex: 1 1 22rem; min-width: 0; }
.la-est { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.35rem 0; font-weight: 400; }
.la-est-main { flex: 1 1 14rem; min-width: 0; }

/* Settings */
.la-set-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.5rem 1rem; padding: 0.45rem 0; border-top: 1px solid var(--line-soft); }
.la-set-label { flex: 1 1 14rem; min-width: 0; font-weight: 600; align-self: center; }
.la-set-label small { font-weight: 400; color: var(--muted); }
.la-set-row .la-mini input { width: 9rem; }
.la-set-row input[type="text"] { flex: 1 1 10rem; width: auto; }
.la-set .la-add { align-items: flex-end; }
.la-cap { display: grid; grid-template-columns: minmax(10rem, 2fr) minmax(6rem, 1fr) minmax(9rem, 2fr); gap: 0.5rem; align-items: center; }
.la-set-head { display: grid; grid-template-columns: minmax(10rem, 2fr) minmax(5.5rem, 1fr) minmax(5.5rem, 1fr) minmax(9rem, 1.3fr) minmax(9rem, 1.3fr); gap: 0.5rem; font-size: 0.8rem; color: var(--muted); border-top: none; padding-bottom: 0; }
.la-cap input { width: 100%; min-width: 0; }
@media (max-width: 800px) {
  .la-set-head { display: none; }
  .la-cap { grid-template-columns: 1fr 1fr; }
  .la-cap .la-set-label { grid-column: 1 / -1; }
}

/* the side panel */
.la-overlay { position: fixed; inset: 0; z-index: 40; display: flex; justify-content: flex-end; background: rgba(43, 44, 46, 0.45); }
.la-drawer { width: min(580px, 100%); height: 100%; overflow-y: auto; background: var(--paper); padding: 1rem 1.1rem 4rem; box-shadow: var(--shadow-lg); }
/* the job's name and summary stay put at the top while the rest of the panel scrolls */
.la-drawer-top { position: sticky; top: -1rem; z-index: 3; margin: -1rem -1.1rem 0; padding: 1rem 1.1rem 0.6rem; background: var(--paper); border-bottom: 1px solid var(--line); box-shadow: 0 3px 6px -4px rgba(0, 0, 0, 0.18); }
.la-drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.75rem; }
.la-drawer-head h2 { margin: 0 0 0.2rem; overflow-wrap: anywhere; }
.la-summary { margin: 0.5rem 0 0; padding: 0.5rem 0.8rem; border-radius: var(--radius-sm); background: var(--sage-light); }
.la-field { display: flex; flex-direction: column; gap: 0.25rem; margin-top: 0.9rem; font-weight: 600; font-size: 0.92rem; }
.la-field .hint { font-weight: 400; }
.la-field input[type="date"], .la-field input[type="number"], .la-field input[type="text"], .la-field select, .la-field textarea { width: 100%; font-weight: 400; }
.la-flabel { font-weight: 600; }
.la-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 0 0.8rem; }
/* the six status buttons: all the same size */
.la-statuses { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0.35rem; }
.la-statuses .btn { width: 100%; padding-left: 0.1rem; padding-right: 0.1rem; font-size: 0.8rem; white-space: nowrap; text-align: center; }
@media (max-width: 560px) { .la-statuses { grid-template-columns: repeat(3, minmax(0, 1fr)); } .la-statuses .btn { font-size: 0.9rem; } }
.la-line { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; padding: 0.35rem 0.6rem; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); background: #fff; font-weight: 400; }
/* a fold-away bar in the side panel (the sub's lines) */
.la-fold { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.2rem 0.5rem; width: 100%; padding: 0.35rem 0; border: 0; background: none; font: inherit; text-align: left; cursor: pointer; color: inherit; }
.la-fold:hover .la-flabel { text-decoration: underline; }
.la-fold-box { padding-bottom: 0.2rem; }
/* each part of the side panel is its own white card with a small title */
.la-sec { margin-top: 0.7rem; padding: 0.7rem 0.85rem 0.8rem; background: #fff; border: 1px solid var(--line-soft); border-radius: var(--radius); }
.la-sec > .la-flabel, .la-sec > .la-fold .la-flabel { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-soft); }
.la-sec > .la-field, .la-sec > .la-grid .la-field:first-child { margin-top: 0.5rem; }
.la-sec .la-grid { margin-top: 0.1rem; }
.la-sec.la-field { gap: 0.4rem; }
.la-sec .la-line { background: var(--paper); border-color: transparent; }
.la-sec .la-fold { padding: 0.1rem 0; }
.la-inner { margin-top: 0.6rem; padding-top: 0.5rem; border-top: 1px solid var(--line-soft); }
.la-section { color: var(--muted); font-weight: 400; }
.la-line-num { white-space: nowrap; color: var(--ink-soft); }
.la-line .check { flex: 1 1 auto; min-width: 0; }
.la-add { margin-top: 0.4rem; align-items: flex-end; }
.la-stops { margin-top: 0.9rem; }
.la-stop { margin-top: 0.4rem; align-items: flex-end; }
.la-stop input[type="text"] { flex: 1 1 10rem; width: auto; }
@media (max-width: 800px) {   /* phone: one field per row, like the Add row */
  .la-drawer .la-stop { display: grid; grid-template-columns: minmax(0, 1fr); align-items: stretch; }
  .la-drawer .la-stop .la-mini, .la-drawer .la-stop input[type="text"], .la-drawer .la-stop .btn { width: 100%; flex: none; }
}
.la-add select, .la-add input[type="text"] { flex: 1 1 10rem; width: auto; }
.la-mini { display: flex; flex-direction: column; font-size: 0.78rem; color: var(--muted); font-weight: 400; }
.la-mini input { width: auto; }
.la-history { margin-top: 0.5rem; }
.la-hline { padding: 0.4rem 0; border-top: 1px solid var(--line-soft); font-weight: 400; }

/* foreman planning chart */
.la-fill-complete { background: var(--la-complete); color: var(--ink); }
.la-fill-in_progress { background: var(--la-in_progress); color: #fff; }
.la-fill-scheduled { background: var(--la-scheduled); color: #fff; }
.la-fill-awarded { background: var(--la-awarded); color: #fff; }
.la-fill-estimated { background: var(--la-estimated); color: var(--ink); }
.lf { --lf-row: 30px; position: relative; }
.lf.picture { --lf-row: 42px; }
.lf-lane { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr); gap: 0.6rem; align-items: start; border-top: 1px solid var(--line-soft); }
.lf-axis-row { border-top: none; }
.lf-name { padding: 0.45rem 0; font-weight: 700; font-size: 0.92rem; overflow-wrap: anywhere; }
.lf-name.sub { color: var(--warn-text); }
.lf-name.none { color: var(--muted); font-weight: 600; }
.lf-track { position: relative; background-image: repeating-linear-gradient(90deg, var(--line-soft) 0, var(--line-soft) 1px, transparent 1px, transparent calc(100% / var(--lf-weeks))); }
.lf-axis { height: 1.4rem; font-size: 0.78rem; color: var(--muted); background-image: none; }
.lf-axis span { position: absolute; top: 0; padding-left: 3px; white-space: nowrap; }
.lf-holiday { position: absolute; top: 0; bottom: 0; background: var(--line-soft); opacity: 0.9; }
.lf-today { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1.5px dashed var(--charcoal); }
.lf-bar { position: absolute; height: 26px; padding: 0 6px; border: 0; border-radius: 5px; overflow: hidden; text-align: left; font: inherit; font-size: 0.8rem; font-weight: 600; line-height: 26px; cursor: pointer; white-space: nowrap; text-overflow: ellipsis; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08); }
.lf-bar span { display: block; overflow: hidden; text-overflow: ellipsis; }
.lf-bar.sub { background-image: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.35) 0 3px, transparent 3px 7px); }
.lf-bar:hover { filter: brightness(1.08); }
/* phone: one card per foreman */
.lf-cards { display: grid; gap: 0.7rem; }
.lf-person { background: var(--paper); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 0.6rem 0.7rem 0.7rem; }
.lf-person h3 { margin: 0 0 0.4rem; font-size: 1rem; }
.lf-person h3.sub { color: var(--warn-text); }
.lf-person h3.none { color: var(--muted); }
.lf-job { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 0.6rem; width: 100%; margin-top: 0.4rem; padding: 0.55rem 0.6rem; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); background: #fff; font: inherit; text-align: left; cursor: pointer; }
.lf-chip { width: 0.9rem; height: 2.4rem; border-radius: 4px; display: block; }
.lf-job-main { display: flex; flex-direction: column; min-width: 0; }
.lf-job-main strong { overflow-wrap: anywhere; }
.lf-job-main small { color: var(--ink-soft); }
.lf-job-dates { text-align: right; font-size: 0.85rem; color: var(--ink-soft); white-space: nowrap; }
.lf.picture .lf-lane { grid-template-columns: 200px minmax(0, 1fr); }
.lf.picture .lf-name { font-size: 20px; padding: 8px 0; }
.lf.picture .lf-axis { height: 30px; font-size: 18px; }
.lf.picture .lf-bar { height: 34px; line-height: 34px; font-size: 17px; }

/* the saved picture: 16:9, drawn off screen */
.la-offscreen { position: fixed; left: -10000px; top: 0; }
.la-picture { width: 1920px; height: 1080px; background: #fff; padding: 44px 64px; display: flex; flex-direction: column; gap: 14px; overflow: hidden; }
/* header like the TV picture: mark, CALIBRE DISPATCH, then what it is */
.la-pic-head { display: flex; align-items: center; justify-content: center; gap: 18px; margin-bottom: 6px; }
.la-pic-head > img { height: 46px; }
.la-pic-head .brand { font-size: 30px; color: var(--charcoal); }
.la-pic-title { font-size: 30px; margin-left: 24px; color: var(--charcoal); font-weight: 700; font-family: var(--font-head); }
.la-pic-range { font-size: 30px; margin-left: 12px; color: var(--ink-soft); }
.la-picture .la-chart { flex: 1; }
.la-picture .la-legend { font-size: 22px; gap: 8px 30px; margin-top: 14px; }
.la-picture .la-swatch { width: 22px; height: 22px; }
.la-picture .la-swatch-line { width: 36px; border-top-width: 4px; }
.la-pic-foot { text-align: right; font-size: 22px; color: var(--ink-soft); }

/* phones: read-only, one column */
@media (max-width: 800px) {
  .la-page { padding: 0.75rem; }
  .la-weeks-head { display: none; }
  .la-wrow { grid-template-columns: minmax(0, 1fr) auto; row-gap: 0.15rem; }
  .la-wrow-head { display: none; }
  .la-w-job { grid-column: 1; }
  .la-w-num { grid-column: 2; grid-row: 1; text-align: right; }
  .la-w-work { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; gap: 0.3rem; }
  .la-w-who, .la-w-dates { grid-column: 1 / -1; font-size: 0.88rem; color: var(--ink-soft); }
  .la-cell-label { display: inline; }
  .la-week { grid-template-columns: 1fr 1fr; row-gap: 0.15rem; }
  .la-week .la-week-date { grid-column: 1 / -1; }
  .la-week .la-load { grid-column: 1 / -1; }
  .la-row { grid-template-columns: 1fr auto; row-gap: 0.25rem; }
  .la-main { grid-column: 1 / -1; }
  .la-when { grid-column: 1; }
  .la-state { grid-column: 2; grid-row: 2 / span 2; justify-self: end; }
  .la-size, .la-who { grid-column: 1; }
  .la-controls .field { flex: 1 1 8rem; }
  .la-drawer { width: 100%; padding-bottom: 5rem; }
}
/* phone: every row of buttons is a grid of equal-size buttons */
@media (max-width: 800px) {
  /* title and gear on the first line, then four equal tab buttons */
  .la-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 0.5rem; }
  .la-head h1 { grid-column: 1; grid-row: 1; }
  .la-gear { grid-column: 2; grid-row: 1; margin-left: 0; }
  .la-tabs { grid-column: 1 / -1; grid-row: 2; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; width: 100%; }
  .la-tabs .btn { width: 100%; min-height: 48px; padding: 0.3rem 0.5rem; text-align: center; display: flex; align-items: center; justify-content: center; gap: 0.4rem; }
  .la-flash { grid-column: 1 / -1; grid-row: 3; margin-left: 0; justify-self: start; }
  .la-controls { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; gap: 0.6rem; }
  .la-controls .field { flex: none; margin: 0; min-width: 0; }
  /* the date box and the weeks box: same width, same height, side by side */
  .la-controls .field input, .la-controls .field select { display: block; width: 100%; min-width: 0; height: 48px; box-sizing: border-box; }
  .la-controls .field input[type="date"] { -webkit-appearance: none; appearance: none; text-align: left; }
  .la-controls .grow { display: none; }
  .la-toggle, .la-nav { grid-column: 1 / -1; display: grid; gap: 0.5rem; }
  .la-toggle { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .la-nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .la-toggle .btn, .la-nav .btn { width: 100%; padding-left: 0.2rem; padding-right: 0.2rem; white-space: nowrap; }
  .la-filter-select { width: 100%; margin-top: 0.2rem; }
  /* the chart legend: three across, tidy */
  .la-legend { display: grid; grid-template-columns: repeat(3, auto); justify-content: center; gap: 0.35rem 0.9rem; font-size: 0.8rem; }
  .la-swatch { width: 0.8rem; height: 0.8rem; }
  .la-legend li:last-child { grid-column: 1 / -1; justify-content: center; }
  /* big enough to tap in the side panel */
  .la-drawer .btn, .la-drawer input, .la-drawer select { min-height: 44px; }
  .la-drawer .check input { min-height: 0; }
  /* iPhone date boxes are wider than the card unless told otherwise */
  .la-grid > *, .la-sec .la-field { min-width: 0; }
  .la-drawer input[type="date"] { display: block; width: 100%; min-width: 0; max-width: 100%; box-sizing: border-box; -webkit-appearance: none; appearance: none; text-align: left; }
  .la-drawer .la-mini input[type="date"] { width: 100%; }
  /* the "add a foreman" and "add a stoppage" rows: one box per line, full width */
  .la-drawer .la-inline.la-add { display: grid; grid-template-columns: minmax(0, 1fr); align-items: stretch; gap: 0.5rem; }
  .la-drawer .la-add .la-mini { width: 100%; font-size: 0.85rem; }
  .la-drawer .la-add select, .la-drawer .la-add input[type="text"], .la-drawer .la-add .btn { width: 100%; flex: none; }
}
@media (prefers-reduced-motion: no-preference) { .la-overlay { animation: fade-in 0.15s ease; } }
