:root {
  --ink: #0f172a;
  --ink-soft: #475569;
  --muted: #94a3b8;
  --border: #e2e8f0;
  --bg: #f8fafc;
  --panel: #ffffff;
  --brand: #d97706;
  --brand-dark: #92400e;
  --brand-soft: #fef3c7;
  --good: #059669;
  --good-soft: #ecfdf5;
  --warn: #d97706;
  --warn-soft: #fffbeb;
  --bad: #dc2626;
  --bad-soft: #fef2f2;
  --info: #0284c7;
  --info-soft: #f0f9ff;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(15,23,42,.06), 0 1px 8px rgba(15,23,42,.04);

  /* "Command Center" shell tokens — dark navy sidebar + topbar, scoped separately from the
     light page tokens above so cards, tables and forms stay on the light palette. */
  --sidebar-bg: #0b1424;
  --sidebar-border: #1e2c47;
  --sidebar-text: #94a3b8;
  --sidebar-text-hover: #e2e8f0;
  --sidebar-hover-bg: rgba(255,255,255,.05);
  --sidebar-active-bg: rgba(245,158,11,.16);
  --sidebar-active-text: #fbbf24;
  --sidebar-section-label: #64748b;
  --sidebar-heading: #f8fafc;
  --sidebar-footer-sub: #64748b;

  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
}
a { color: var(--brand-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 4px; font-weight: 650; letter-spacing: -0.01em; color: var(--ink); font-family: var(--font-display); }
h1 { font-size: 22px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
p { margin: 0 0 12px; color: var(--ink-soft); }
table { border-collapse: collapse; width: 100%; }
.tnum { font-variant-numeric: tabular-nums; }

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; flex: none; background: var(--sidebar-bg); border-right: 1px solid var(--sidebar-border);
  display: flex; flex-direction: column; padding: 18px 12px; gap: 2px;
  position: sticky; top: 0; height: 100vh;
  /* Belt and braces: nothing inside the sidebar may ever paint outside the navy panel, whatever a
     future nav item or a very short window does. The nav below is what actually scrolls. */
  overflow: hidden;
}
.sidebar .brand { display: flex; align-items: center; gap: 8px; padding: 6px 10px 18px; }
.sidebar .brand .mark {
  width: 26px; height: 26px; border-radius: 7px; background: var(--brand);
  display: flex; align-items: center; justify-content: center; color: var(--ink); font-weight: 700; font-size: 13px;
}
.sidebar .brand .name { font-weight: 700; font-size: 15px; color: var(--sidebar-heading); font-family: var(--font-display); }
/* The mark and the wordmark are one link to the Dashboard — the thing every website does and
   this one did not. They became <span>s when the <a> went round them, so the flex layout that
   used to come from two <div>s is declared here instead. The bell stays outside the link. */
.brand-home { display: flex; align-items: center; gap: inherit; text-decoration: none; color: inherit; }
.sidebar .brand .brand-home { gap: 8px; border-radius: 8px; }
.sidebar .brand .brand-home:hover .name { color: #fff; }

/* The bell, beside the wordmark, where the carrier asked for it. margin-left:auto pushes it to
   the far edge of the brand row so it lines up with the menu below rather than crowding the name,
   and the whole thing is a link so middle-click and "open in new tab" behave. */
.sidebar .brand .bell {
  margin-left: auto; position: relative; display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 8px; color: var(--sidebar-text); flex-shrink: 0;
}
.sidebar .brand .bell:hover, .sidebar .brand .bell.active { background: var(--sidebar-active-bg); color: var(--sidebar-heading); }
/* The count sits on the bell rather than beside it, and stops counting out loud at 9+: the
   difference between 12 and 40 unread changes nothing a person does next, and a three-digit badge
   is wider than the icon it is attached to. */
.sidebar .brand .bell .count {
  position: absolute; top: -1px; right: -1px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 9px; background: var(--brand); color: #fff; font-size: 10px; font-weight: 700;
  line-height: 16px; text-align: center; box-sizing: border-box;
}

/* The phone copy of the bell, in the topbar — see the media query above for why it exists.
   display:none here, turned on only below the sidebar breakpoint. */
.topbar .bell {
  display: none; position: relative; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--border);
  background: #fff; color: var(--ink); flex: none;
}
.topbar .bell .count {
  position: absolute; top: -5px; right: -5px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 9px; background: var(--brand); color: #fff; font-size: 10px; font-weight: 700;
  line-height: 16px; text-align: center; box-sizing: border-box;
}

/* ---------- Tasks ---------- */
.task-row { display: flex; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--border); align-items: flex-start; }
.task-row:last-child { border-bottom: 0; }
/* The deadline is the only coloured thing on a row. A list where every row shouts is a list
   nobody reads twice, so overdue gets the bar and everything else stays plain. */
.task-row.overdue { box-shadow: inset 3px 0 0 var(--bad); }
.task-main { flex: 1; min-width: 0; }
.task-title { font-size: 14px; font-weight: 600; }
.task-details { color: var(--muted); font-size: 12.5px; margin-top: 3px; white-space: pre-line; }
.task-meta { color: var(--muted); font-size: 12.5px; margin-top: 6px; }
.task-due { white-space: nowrap; }
.task-due.bad { color: var(--bad); font-weight: 600; }
.task-due.warn { color: var(--brand-dark); font-weight: 600; }
.task-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.task-files { display: flex; flex-direction: column; gap: 8px; }
.task-file { display: flex; gap: 10px; align-items: center; justify-content: space-between; }
/* Below the point where a row's buttons and its text stop fitting side by side, the buttons drop
   underneath rather than squeezing the title into a column two words wide. */
@media (max-width: 700px) {
  .task-row { flex-direction: column; }
  .task-actions { width: 100%; }
}

/* ---------- Notifications page ---------- */
.notif-row { display: flex; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); align-items: flex-start; }
.notif-row:last-child { border-bottom: 0; }
/* Unread is marked with a bar on the leading edge and a weight change, not with a colour wash:
   the list is mostly unread on a first visit and a page of tinted rows reads as an error state. */
.notif-row.unread { box-shadow: inset 3px 0 0 var(--brand); }
.notif-row.unread .notif-title { font-weight: 650; }
.notif-icon { width: 30px; height: 30px; border-radius: 8px; background: var(--bg); color: var(--muted); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.notif-main { min-width: 0; flex: 1; }
.notif-title { font-size: 14px; }
.notif-body { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.notif-when { color: var(--muted); font-size: 12px; white-space: nowrap; flex-shrink: 0; }
/* min-height:0 is the important part. The sidebar is pinned to 100vh, and a flex child will not
   shrink below the height of its own content unless it is told it may — so on a short window the
   nav grew taller than the sidebar and the items past the fold (SETTINGS onward, plus the footer)
   painted OUTSIDE the navy box, on the light page background. With min-height:0 the nav yields and
   scrolls inside the sidebar, which keeps the footer pinned to the bottom of the navy panel. */
.sidebar nav {
  display: flex; flex-direction: column; gap: 2px; flex: 1;
  min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: var(--sidebar-border) transparent;
}
.sidebar nav::-webkit-scrollbar { width: 6px; }
.sidebar nav::-webkit-scrollbar-thumb { background: var(--sidebar-border); border-radius: 3px; }
.sidebar nav::-webkit-scrollbar-track { background: transparent; }
.sidebar nav a {
  color: var(--sidebar-text); text-decoration: none; padding: 8px 10px; border-radius: 8px; font-size: 13.5px; font-weight: 500;
  display: flex; align-items: center; gap: 9px;
}
.sidebar nav a svg { flex: none; }
.sidebar nav a:hover { background: var(--sidebar-hover-bg); color: var(--sidebar-text-hover); }
.sidebar nav a.active { background: var(--sidebar-active-bg); color: var(--sidebar-active-text); }
.sidebar nav .section-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--sidebar-section-label); padding: 14px 10px 4px; font-weight: 650; }
.sidebar .footer { padding: 10px; border-top: 1px solid var(--sidebar-border); margin-top: 8px; }
.sidebar .company-name { font-size: 12.5px; font-weight: 650; color: var(--sidebar-heading); }
.sidebar .role-badge { font-size: 11px; color: var(--sidebar-footer-sub); text-transform: capitalize; }
.sidebar .signout { font-size: 12px; color: var(--sidebar-footer-sub); margin-top: 6px; display: inline-block; }

.main { flex: 1; min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; padding: 14px 28px;
  border-bottom: 1px solid var(--sidebar-border); background: var(--sidebar-bg); color: var(--sidebar-heading); position: sticky; top: 0; z-index: 5;
  gap: 12px;
}
.topbar .topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar .topbar-left strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.content { padding: 24px 28px 60px; max-width: 1280px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; gap: 16px; flex-wrap: wrap; }
.page-head .titles p { margin: 2px 0 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.menu-toggle { display: none; background: #fff; border: 1px solid var(--border); border-radius: 8px; width: 34px; height: 34px; align-items: center; justify-content: center; cursor: pointer; font-size: 16px; flex: none; }
.sidebar-backdrop { display: none; }

/* 1000px, not 860: between those two widths the sidebar was still taking its full 200px out of a
   window that had under 900 to give, which left the trip tables about 620px to fit a whole trip
   into — narrower than the narrowest honest row. The menu is one tap away at these widths and the
   boards are what the window is actually for, so the space goes to them. */
@media (max-width: 1000px) {
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 50; transform: translateX(-100%);
    transition: transform .18s ease; box-shadow: none;
  }
  .sidebar.open { transform: translateX(0); box-shadow: 0 0 40px rgba(15,23,42,.3); }
  .menu-toggle { display: inline-flex; }
  /* Below this width the sidebar — and the bell in it — is behind the hamburger, so the bell
     would be invisible on a phone until somebody opened a menu to look for it. The topbar carries
     a second one here, and only here. */
  .topbar .bell { display: inline-flex; }
  .sidebar .brand .bell { display: none; }
  .content { padding: 18px 16px 48px; }
  .topbar { padding: 12px 16px; }
  .card-head { flex-wrap: wrap; gap: 8px; }
  .sidebar-backdrop.open {
    display: block; position: fixed; inset: 0; background: rgba(15,23,42,.35); z-index: 40;
  }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 8px; padding: 8px 14px; font-size: 13.5px; font-weight: 600;
  border: 1px solid transparent; cursor: pointer; text-decoration: none; line-height: 1.2;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); text-decoration: none; }
.btn-secondary { background: #fff; color: var(--ink); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg); text-decoration: none; }
.btn-danger { background: #fff; color: var(--bad); border-color: #fecaca; }
.btn-danger:hover { background: var(--bad-soft); text-decoration: none; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- Cards / panels ---------- */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px 20px; }
.card-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
/* Live client-side filter box above a list table (Locations, Brokers) — see filterTableRows in
   layout.js's shared shell script for the filtering behavior itself. */
.search-bar { padding: 14px 20px; border-bottom: 1px solid var(--border); }
.search-bar input[type="text"] { max-width: 360px; width: 100%; }
/* minmax(0, 1fr), not plain 1fr. A grid track's default minimum is its CONTENT's minimum, so a
   plain 1fr column refuses to shrink below the widest thing inside it and pushes the whole grid
   past its container instead — which is how the Accessorial charges pop-up ended up 63px wider
   than itself, with a horizontal scrollbar along the bottom. minmax(0, …) lets the track shrink
   and the content reflow, which is what "two equal columns" was always meant to mean. */
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 900px) { .grid-4, .grid-3, .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .grid-4, .grid-3, .grid-2 { grid-template-columns: minmax(0, 1fr); } }

/* A settlement is a WIDE document beside a NARROW total, and splitting the page 50/50 gave the
   trips table 604px of a 1536px screen to fit six columns into. It wanted 777px, so the Rate and
   Driver share columns — the two figures a driver checks — hung off the side of the card, and at
   1024px the whole page scrolled sideways. The summary column holds a label and an amount and
   never needed half the page.
   Below 1100px even the larger share is not enough for six columns of trip, so they stack and the
   table gets the full width instead. Declared after .grid-2's own media queries, which it narrows
   rather than replaces. */
.settlement-grid { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
@media (max-width: 1100px) { .settlement-grid { grid-template-columns: minmax(0, 1fr); } }

.stat-card { padding: 16px 18px; }
.stat-card .label { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat-card .value { font-size: 26px; font-weight: 700; margin-top: 6px; letter-spacing: -0.01em; font-family: var(--font-display); }
.stat-card .sub { font-size: 12px; color: var(--muted); margin-top: 4px; }

.attention-cols { display: flex; padding: 22px 20px; }
.attention-col { flex: 1; text-align: center; padding: 0 16px; }
.attention-col + .attention-col { border-left: 1px solid var(--border); }
.attention-label { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
/* The outstanding-work bell beside a tab's name. inline-flex so the bell sits on the label's own
   baseline rather than hanging below it, and a little room on the left so the count badge — which
   overhangs the bell's top-right corner — does not touch the last letter of the label. */
.attention-label { display: inline-flex; align-items: center; }
.attention-col-tasks { margin-left: 14px; }
.attention-num { font-size: 34px; font-weight: 700; color: var(--ink-soft); margin: 12px 0 0; font-family: var(--font-display); }
@media (max-width: 600px) { .attention-cols { flex-direction: column; gap: 18px; } .attention-col + .attention-col { border-left: none; border-top: 1px solid var(--border); padding-top: 18px; } }
.attention-col.active { background: var(--brand-soft); border-radius: 10px; margin: -10px 0; padding: 10px 16px; }
.attention-col.active .attention-label { color: var(--brand-dark); }
.attention-col.active .attention-num { color: var(--brand-dark); }
/* The whole card is now the click target for switching Trip Monitor's Upcoming/In transit/History
   view (there used to be a separate "View" button) — give it a pointer cursor and a hover tint so
   it still reads as clickable, and a visible focus ring for keyboard use (role="button" tabindex="0"
   in the markup). Transition keeps the hover/active swap from feeling abrupt. */
.attention-col-clickable { cursor: pointer; border-radius: 10px; transition: background-color .12s ease; }
.attention-col-clickable:hover { background: var(--brand-soft); }
.attention-col-clickable:focus-visible { outline: 2px solid var(--brand-dark); outline-offset: 2px; }
.attention-col-clickable.active:hover { background: var(--brand-soft); }

/* ---------- Trips page: Amazon-style stop table ---------- */
.link-btn {
  background: none; border: none; padding: 0; margin: 0; cursor: pointer; font: inherit;
  color: var(--brand); font-size: 12.5px; font-weight: 600;
}
.link-btn:hover { text-decoration: underline; }
.pen-btn {
  appearance: none; -webkit-appearance: none;
  background: none; border: none; outline: none; box-shadow: none; padding: 0; margin: 0; cursor: pointer; line-height: 1;
  color: var(--brand); font-size: 12px; vertical-align: middle;
}
.pen-btn:hover { opacity: .7; }
.notes-btn {
  appearance: none; -webkit-appearance: none;
  background: none; border: none; outline: none; box-shadow: none; padding: 0; margin: 0; cursor: pointer; line-height: 1;
  color: var(--muted); font-size: 18px; vertical-align: middle;
}
.notes-btn.has-notes { color: var(--brand); }
.notes-btn:hover { opacity: .7; }
.notes-btn-wrap { position: relative; display: inline-block; }
.notes-badge {
  position: absolute; top: -7px; right: -9px;
  background: var(--bad); color: #fff; font-size: 10px; font-weight: 700; letter-spacing: 0;
  min-width: 15px; height: 15px; border-radius: 999px; padding: 0 3px;
  display: flex; align-items: center; justify-content: center; line-height: 1;
  box-shadow: 0 0 0 2px #fff;
}
/* Red is reserved for notes this person has not read. A thread they have already been through
   still shows its count — "six notes on this trip" is worth knowing — in the brand's own amber,
   because it is a fact rather than an alarm, and a page where everything is red says nothing. */
.notes-badge-unread { background: var(--bad); }
.notes-badge-read { background: var(--brand); }
/* The bell is a button inside a positioned wrapper that also carries the count badge and the
   attention panel. The wrapper is what gets swapped wholesale when the server recomputes a trip's
   outstanding work (see replaceAttentionBell), so everything about the bell lives inside it. */
.attention-bell-wrap { position: relative; display: inline-block; line-height: 0; }
.attention-bell {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; line-height: 0;
  background: none; border: none; padding: 0; margin: 0; cursor: pointer;
  outline: none; box-shadow: none; -webkit-appearance: none; appearance: none;
}
.attention-bell:hover { opacity: .75; }
.attention-bell:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; border-radius: 3px; }
/* Same badge treatment as the Notes envelope's unread count, so the two columns read as one
   family rather than two different ideas of "there is something here". */
.attn-badge {
  position: absolute; top: -7px; right: -9px;
  background: var(--bad); color: #fff; font-size: 10px; font-weight: 700; letter-spacing: 0;
  min-width: 15px; height: 15px; border-radius: 999px; padding: 0 3px;
  display: flex; align-items: center; justify-content: center; line-height: 1;
  box-shadow: 0 0 0 2px #fff; pointer-events: none;
}
.attention-bell .bell-icon { display: block; transform-origin: 50% 15%; }
.attention-bell-good .bell-icon { color: var(--good); }
.attention-bell-bad .bell-icon { color: var(--bad); animation: bell-ring 1.6s ease-in-out infinite; }
/* Sound-wave marks only show (and only draw in) while the bell is actually ringing. */
.attention-bell .bell-wave { opacity: 0; transition: opacity 0.15s; }
.attention-bell-bad .bell-wave { opacity: 1; }
/* The attention panel: what this trip still needs, one line per job, each with the button that
   does it. position:fixed (placed by placeAttentionPanel from the bell's own rectangle) because
   the bell sits in the first column of a horizontally-scrolling table wrapper, which would clip
   an absolutely-positioned panel along its left edge. */
.attn-panel {
  position: fixed; z-index: 70;
  width: 340px; max-width: calc(100vw - 16px);
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 12px 32px rgba(16, 24, 40, 0.18);
  text-align: left; line-height: 1.45; cursor: default;
  /* The panel lives inside a .table td, which sets white-space: nowrap so trip rows never wrap.
     That is right for a table cell and wrong for a paragraph of prose, and it is INHERITED — so
     without this, a line like "Verify Test Delivery WH: ETA hasn't been updated in 2+ hours" runs
     off the edge of the panel instead of wrapping onto a second line. (.attn-fix sets nowrap back
     on for itself, so button labels still never break mid-word.) */
  white-space: normal;
  opacity: 0; transform: translateY(-6px) scale(0.98);
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.attn-panel.open { opacity: 1; transform: translateY(0) scale(1); }
/* Someone who has asked their system not to animate gets the panel immediately, with no movement
   — the panel still appears and disappears, it just doesn't travel to get there. */
@media (prefers-reduced-motion: reduce) {
  .attn-panel { transition: none; transform: none; }
  .attn-panel.open { transform: none; }
  .attention-bell-bad .bell-icon { animation: none; }
}
.attn-panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 10px 10px 14px; border-bottom: 1px solid var(--border);
}
.attn-panel-title { font-size: 13px; font-weight: 700; color: var(--ink); }
/* The panel usually lands on top of the row it belongs to, including that row's trip number — so
   the panel says which trip it is talking about rather than hiding the answer underneath itself. */
.attn-panel-trip { font-weight: 600; color: var(--muted); margin-left: 6px; }
.attn-panel-trip::before { content: "\00b7"; margin-right: 6px; }
.attn-panel-close {
  background: none; border: none; padding: 0 2px; cursor: pointer;
  font-size: 20px; line-height: 1; color: var(--muted);
}
.attn-panel-close:hover { color: var(--ink); }
.attn-panel-body { padding: 6px 0; max-height: 50vh; overflow-y: auto; overflow-x: hidden; }
.attn-list { list-style: none; margin: 0; padding: 0; }
/* minmax(0, 1fr), not plain 1fr: a grid track's default min-width is auto, which means it refuses
   to shrink below its longest unbreakable content — so a long stop name pushed the whole row wider
   than the panel and put a horizontal scrollbar under the list instead of wrapping the line. */
.attn-item {
  display: grid; grid-template-columns: 10px minmax(0, 1fr); gap: 0 8px;
  padding: 9px 14px; font-size: 13px; color: var(--ink);
  border-bottom: 1px solid var(--border);
}
.attn-item:last-child { border-bottom: none; }
.attn-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--bad);
  margin-top: 6px; flex: none;
}
.attn-text { min-width: 0; overflow-wrap: anywhere; }
/* Buttons sit on their own line under the text, in the text's column, so a long stop name never
   squeezes "Log arrival / departure" down to an unreadable sliver. */
.attn-fixes { grid-column: 2; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.attn-fix {
  background: var(--brand); color: #fff; border: none; border-radius: 6px;
  padding: 5px 10px; font-size: 12px; font-weight: 600; cursor: pointer;
  font-family: inherit; line-height: 1.2; white-space: nowrap;
}
.attn-fix:hover { filter: brightness(0.93); }
.attn-fix:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
/* The second fix offered for the same problem is the alternative reading of it, not the expected
   answer, so it's quieter than the first. */
.attn-fix ~ .attn-fix { background: var(--bg); color: var(--ink); border: 1px solid var(--border); }
.attn-fix ~ .attn-fix:hover { filter: none; background: var(--border); }
.attn-clear { margin: 0; padding: 12px 14px; font-size: 13px; color: var(--muted); }
.attn-clear-tick { color: var(--good); font-weight: 700; margin-right: 4px; }

@keyframes bell-ring {
  0%, 62%, 100% { transform: rotate(0deg); }
  65% { transform: rotate(16deg); }
  70% { transform: rotate(-14deg); }
  75% { transform: rotate(10deg); }
  80% { transform: rotate(-7deg); }
  85% { transform: rotate(4deg); }
  90% { transform: rotate(-2deg); }
  95% { transform: rotate(0deg); }
}

/* Broker load # + its copy-to-clipboard button (Trip Monitor and Dispatch board tables). */
.broker-load-cell { display: inline-flex; align-items: center; gap: 6px; }
.copy-icon-btn {
  appearance: none; -webkit-appearance: none;
  background: none; border: none; outline: none; box-shadow: none; padding: 2px; margin: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--muted); border-radius: 4px; line-height: 1;
}
.copy-icon-btn:hover { color: var(--brand); background: var(--brand-soft); }
.copy-icon-btn.copied { color: var(--good); }
/* The [hidden] attribute's default display:none only applies to HTML elements, not SVG (it's
   scoped to the HTML UA stylesheet) — without this, the swapped-in icon would stay invisible but
   still take up space instead of actually disappearing. */
.copy-icon-btn svg[hidden] { display: none; }
/* "Copy trip" button (copyTripButton in loads.js) — sits left of "Mark as dispatched"/etc in a
   trip's expanded action row. Its two states are plain <span>s (not SVG), so the [hidden]
   attribute's default display:none applies with no extra rule needed, unlike .copy-icon-btn above. */
.copy-trip-btn { display: inline-flex; align-items: center; }
/* :not([hidden]) keeps this more-specific rule from overriding the [hidden] attribute's own
   default display:none (a two-class selector otherwise beats that one-attribute selector) — same
   family of bug as the SVG [hidden] fix above, different cause. */
.copy-trip-btn .copy-trip-state:not([hidden]) { display: inline-flex; align-items: center; gap: 5px; }
.copy-trip-btn svg { flex: none; }
.copy-trip-btn.copied { color: var(--good); border-color: var(--good); }
.stop-table-wrap { overflow-x: auto; margin-bottom: 16px; border: 1px solid var(--border); border-radius: 8px; }
.stop-table { width: 100%; border-collapse: collapse; background: #fff; }
/* Scoped with the .stop-table-wrap ancestor (2 classes) rather than just .stop-table (1 class) so
   these rules reliably outrank the generic .table th/td rules below — the stop table is nested
   inside a .table.trip-table row's expand cell on the Dispatch/Trips pages, and since a plain
   ".table td" descendant selector matches any td anywhere under that ancestor (nesting depth is
   irrelevant to a descendant combinator), it was silently winning ties against ".stop-table td"
   (equal 1-class specificity, but declared later in the file) and zeroing out this padding. */
.stop-table-wrap .stop-table th {
  text-align: left; font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
  padding: 9px 14px; border-bottom: 1px solid var(--border); font-weight: 650; white-space: nowrap; background: var(--bg);
}
.stop-table-wrap .stop-table td { padding: 26px 14px 14px; border-bottom: 1px solid var(--border); font-size: 14.5px; vertical-align: top; }
.stop-table-wrap .stop-table tr:last-child td { border-bottom: none; }
.stop-cell { display: flex; gap: 10px; align-items: flex-start; }
.stop-num {
  flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-dark);
  font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; margin-top: 1px;
}
.stop-kind { font-weight: 650; }
.stop-instr-toggle { display: inline-flex; align-items: center; gap: 5px; }
.stop-instr-toggle .caret { display: inline-block; font-size: 10px; transition: transform .15s ease; }
.stop-instr-toggle[aria-expanded="true"] .caret { transform: rotate(90deg); }
.stop-instr-panel { max-height: 0; overflow: hidden; transition: max-height .2s ease; }
.stop-instr-panel-inner { padding: 6px 0 2px; }

/* The projected arrival, under the dispatcher's own ETA.
   .table td sets white-space: nowrap on every cell, and the stop table is NESTED inside a
   .table.trip-table row's expand cell — so a descendant combinator reaches it and every line in
   here was unbreakable. That is right for "Arrival Oct 16, 2026 · 15:00" and wrong for this line,
   which carries a time, a verdict badge and the age of the reading it came from. Measured at
   432px on one line, which widened the Arrival column to 460px, took the trip table to 1144px,
   and pushed the Departure column off the right of a 1280px screen with the whole board scrolling
   sideways to reach it.
   So this one line wraps, and the phrases inside it that must not break mid-way carry
   .keep-together — the pattern used for the same reason on the trip row itself. max-width keeps
   the auto table layout from handing the column a width it does not need: the text is secondary
   to the ETA above it and has no business setting the shape of the table. */
.stop-table-wrap .stop-table .stop-eta-proj {
  /* break-word, NOT anywhere. `anywhere` also lowers the element's MIN-CONTENT to one character,
     which is how a 390px phone ended up rendering "MANUFACTURING" one letter per line: the column
     was allowed to shrink to nothing, so it did. break-word breaks a word only when that word
     would otherwise overflow, and leaves the minimum at the longest word, which is the width this
     column should actually be asking for. */
  white-space: normal; overflow-wrap: break-word; max-width: 260px;
  color: var(--muted); font-size: 12.5px; line-height: 1.5; margin: 1px 0 3px;
}
/* The badge and the context that follows it, on their own line under the time. */
.stop-table-wrap .stop-table .stop-eta-verdict {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin-top: 2px;
}
.stop-table-wrap .stop-table .stop-eta-proj .keep-together { white-space: nowrap; }
/* Smaller than a status badge and allowed to sit on its own line when the column is tight. */
.stop-table-wrap .stop-table .stop-eta-proj .badge { font-size: 11px; padding: 2px 8px; vertical-align: 1px; }

/* A stop's name is prose, not a data value — see the note beside it in views/loads.js. */
.stop-table-wrap .stop-table .stop-place {
  font-size: 14px; font-weight: 700; white-space: normal; overflow-wrap: break-word; line-height: 1.35;
}
/* A stop type is a label, not prose: it wraps as a unit or not at all. Without this it inherits
   the wrapping above and "Live Load" comes apart down the middle of the pill. */
.stop-table-wrap .stop-table .stop-kind-badge { overflow-wrap: normal; }
.stop-table-wrap .stop-table .stop-kind-badge { font-size: 11.5px; vertical-align: 1px; }

/* Below a laptop, the trip table is a sideways scroll whatever we do — ten columns do not fit on a
   phone. What this breakpoint decides is how much of that scroll the projected line is responsible
   for, and the answer should be none: the time and the verdict travel, the age of the reading and
   the solo-basis note stay behind. */
@media (max-width: 900px) {
  .stop-table-wrap .stop-table .stop-eta-aside { display: none; }
  .stop-table-wrap .stop-table .stop-eta-proj { max-width: 190px; }
  /* And the stamp gives up being one piece. On a wide screen "Oct 11, 2026 · 18:27" breaking in
     half reads badly and there is room not to; on a phone it is the last 60 pixels standing
     between this line and costing the board nothing at all, and a date wrapped after the year is
     a thing people read every day. */
  .stop-table-wrap .stop-table .stop-eta-proj .keep-together { white-space: normal; }
}

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table-pagination { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 14px 12px 4px; }
/* A HEADER is prose — "Avg. waiting time", "Assigned driver", "Scheduled Location", "Needs
   attention" — and a header held to one line sets its column's floor exactly as firmly as a value
   does. It was the last thing holding two tables off the card once the values themselves were free
   to wrap: at 1180px, where the sidebar is still showing and the card is 902px, the Maintenance
   schedule stood 90px over and Settlements 83px, on nothing but their own column labels.
   Wrapping is unconditional rather than inside a media query because it costs nothing when there
   is room — a table whose columns all fit lays out identically, since the browser only wraps a
   cell once the column is squeezed below its content. */
.table th {
  text-align: left; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
  padding: 10px 16px; border-bottom: 1px solid var(--border); font-weight: 650;
  white-space: normal; overflow-wrap: anywhere;
}
.table td { padding: 14px 16px; border-bottom: 1px solid var(--border); font-size: 15px; vertical-align: middle; white-space: nowrap; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: #fafbfd; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
/* The empty-state row holds a SENTENCE, not a data value. The shared `white-space: nowrap` above is
   right for a trip row — a date or a dollar amount broken across two lines is unreadable — but it
   applied here too, so a one-line explanation set the width of the whole table. The Accounting
   accounts table has four short columns and would otherwise fit in about 700px; its "No bank
   accounts yet…" sentence forced it to 1,700, which is why the card had a scrollbar along its
   bottom edge and the sentence itself ran off the right side with no ellipsis to say so. The same
   sentence is what you read when the page has nothing else on it, which makes this the worst table
   in the app to have to scroll sideways to finish.
   The horizontal padding then gives the sentence a readable measure rather than one 1,130px line.
   Percentage padding in a cell resolves against the table's width, and `table { width: 100% }` above
   pins that to the card — and percentages are treated as zero while the browser works out a table's
   intrinsic width, so this padding cannot feed back into the width it is derived from. It centres
   the text in a 640px column and collapses to the normal 16px on anything narrower. */
.empty-row td {
  color: var(--muted); text-align: center; white-space: normal;
  padding: 36px max(16px, calc((100% - 640px) / 2));
}

/* A cell holding PROSE rather than a data value — a shop's street address, a line saying what was
   serviced. The shared `white-space: nowrap` above is right for a date or a dollar amount, which
   are unreadable broken across two lines, but it applied to these too: the 55-character address
   under "Boss Shop" on the Maintenance schedule held one line, which made that column 392px on its
   own and pushed the table 188px past the card. The result was a scrollbar along the bottom and
   the "Mark completed" button off the right edge — on a 1536px screen.
   Wrapping is the whole fix, and it needs no widths: `table { width: 100% }` already asks the
   table to fit the card, but with nowrap a column's MINIMUM width is its full text, so there was
   nothing the browser could give up. */
.table td.cell-prose { white-space: normal; }

/* Every list in the app turned out to have the same problem the Maintenance schedule had, because
   every one of them has at least one column holding something a person typed. Measured on a
   company whose values are as long as the real ones — "5544 PERRYTOWN DRIVE, WEST BLOOMFIELD
   TOWNSHIP, MI 48322" for an address, "CONSOLIDATED INTERMODAL TRANSPORTATION SOLUTIONS OF NORTH
   AMERICA LLC" for a broker's legal name — these were the tables hanging off the right edge of a
   1536px screen, in pixels past the card: Locations 479, Maintenance 346, Invoices 224, Brokers
   121, Trailers 106, Settlements 26, Trucks 18. Narrower screens were worse, and the one column
   that fell off first was the last one, which is the column the user screenshotted.
   So the class is now on the prose column of every list rather than just that one page's. Which
   column that is, is a judgement about CONTENT, not length: a name, an address, a description, a
   make and model — anything whose width is whatever somebody typed. Dates, amounts, unit numbers
   and statuses stay on one line, which is what the shared nowrap above is for. */

/* `anywhere` and not `break-word`: only `anywhere` lowers a cell's MINIMUM content width, which is
   the number the table-layout algorithm actually uses when it decides whether the table fits. With
   `break-word` the minimum stays the longest unbreakable word, so one 29-character company name
   ("CONSOLIDATED INTERMODAL...") still sets a floor the column cannot go under, and the table
   still overflows — at no visible benefit, since both values break at the spaces first. The
   mid-word break only ever happens when a single word is wider than the whole column, which on a
   phone is the difference between a readable table and a sideways scroll. */
.table td.cell-prose { overflow-wrap: anywhere; }

/* Inside a wrapping cell, the one run that must stay on a single line. A scheduled date followed
   by an "Overdue" or "In the shop" badge needs the badge free to drop to a second line — that is
   50px of table width — but "Oct 3, 2026" broken after "Oct" is not a date any more. */
.table td.cell-prose .keep-together { white-space: nowrap; }

/* Action buttons stay on one line while there is room for them, and wrap onto a second rather than
   taking the table off the side of the card once there is not. The breakpoint is the viewport, not
   the card, but the sidebar is a fixed 224px so the two track each other closely enough.
   1500px is measured, not guessed: the Maintenance schedule fits on one line of buttons at 1536
   and is 22px short at 1440, which is a MacBook — so the break has to sit between them.
   The labels themselves never break — "Log service" split over two lines is not a button. */
@media (max-width: 1500px) {
  .table td.cell-actions { white-space: normal; line-height: 2.4; }
  .table td.cell-actions .btn { white-space: nowrap; }
}

/* Below this, the table has given up everything the rules above can give it and is still wider
   than the phone — so the things that are allowed to stay whole at any other size stop being: a
   status pill wraps, a button label wraps, the Safety matrix drops its column floor, and the
   padding that costs 32px per column (ten columns is 320px of nothing but gutter) comes down.
   Each of these is worse than it looks on a desktop and better than a sideways scroll on a phone.
   Measured at 390px (an iPhone 15) with the long-value company: every list in the app fits, where
   before the widest of them stood 1,345px past the edge of the screen. */
@media (max-width: 760px) {
  .table th, .table td { padding: 10px 9px; font-size: 14px; }
  .table th { font-size: 12px; }
  .table td.cell-prose .keep-together,
  .table .badge { white-space: normal; overflow-wrap: anywhere; }
  .table td.cell-actions .btn { white-space: normal; overflow-wrap: break-word; }
  /* A pill's own padding, gap and status dot are ~31px before a single letter of its label, and on
     the Safety matrix there are seven of them in a row — which is 469px of chrome on a 356px card.
     The dot is the part that can go: the pill is colour-coded already, and this is the one table
     whose entire job is comparing those columns against each other. */
  .audit-matrix .badge { padding: 3px 5px; gap: 0; }
  .audit-matrix .badge::before { display: none; }
  /* Two classes, so this outranks the .audit-matrix th floor further down the file — equal
     specificity would lose on source order, and the floor is exactly what is being lifted. */
  .table.audit-matrix th { min-width: 0; }
}

/* A LIST THAT IS KEPT BUT NOT SHOWN.

   The fuel ledger is long, and it is not what anybody opens the page for — the return above is.
   But unlike the other lists that were folded away on that page, this one is not a second copy of
   anything: it holds the individual entries, their dates and their vendors, and it is the only
   place a wrong one can be removed. So it collapses rather than going. */
.ledger-fold > summary {
  list-style: none; cursor: pointer; user-select: none;
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  font-size: 12.5px; color: var(--ink-soft);
}
.ledger-fold > summary::-webkit-details-marker { display: none; }
.ledger-fold > summary:hover, .ledger-fold > summary:focus-visible { color: var(--brand); }
.ledger-fold > summary > span:last-child { font-size: 12px; white-space: nowrap; }
.ledger-fold[open] > summary > span:last-child { visibility: hidden; }
@media (max-width: 560px) {
  .ledger-fold > summary { flex-direction: column; gap: 2px; }
}

/* A "?" THAT OPENS AN EXPLANATION IN PLACE.

   Used where a field needs more than a hint line — at the moment, the one place on the app that
   sends somebody to another website to fetch a file. A <details> rather than a hover tooltip: a
   hover tooltip does not exist on a phone, cannot be read at leisure, and cannot be copied from,
   and all three matter when the content is a set of instructions with a link in it. */
.help-note { display: inline-block; vertical-align: middle; margin-left: 6px; position: relative; }
.help-note > summary {
  list-style: none; cursor: pointer; user-select: none;
  display: inline-flex; align-items: center; justify-content: center;
  width: 17px; height: 17px; border-radius: 999px;
  border: 1px solid var(--border); background: #fff;
  color: var(--muted); font-size: 11px; font-weight: 700; line-height: 1;
}
.help-note > summary::-webkit-details-marker { display: none; }
.help-note > summary:hover, .help-note > summary:focus-visible { border-color: var(--brand); color: var(--brand); }
.help-note[open] > summary { border-color: var(--brand); color: var(--brand); }
.help-note-body {
  position: absolute; z-index: 40; top: calc(100% + 8px); left: 0;
  width: 340px; max-width: calc(100vw - 48px);
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, .14);
  padding: 12px 14px; font-size: 12.5px; font-weight: 400; line-height: 1.55; color: var(--ink);
  white-space: normal; text-transform: none; letter-spacing: 0;
}
.help-note-body li { margin-bottom: 5px; }
/* On a phone it opens under the label at full width rather than hanging off the right edge. */
@media (max-width: 560px) {
  .help-note { position: static; }
  .help-note-body { position: static; width: auto; margin-top: 8px; box-shadow: none; }
}

/* A TABLE THAT STOPS BEING A TABLE ON A PHONE.

   Everything above keeps a table INSIDE the card at 390px, and on most of this app's lists that is
   enough, because the long column is prose and prose wraps gracefully. On a table of seven numeric
   columns it is not: the IFTA return fitted the screen perfectly and read "JURISDI / CTION", "MIL /
   ES", "TAXAB / LE GAL" with "1,2 / 00" under it. Nothing overflowed and nothing could be read.

   So this is the opt-in for those: below 640px the rows become records. Each cell takes its column
   heading as a label beside the value, which is the one thing a stacked row needs and the one thing
   a stacked row normally loses. Measured, not assumed — 640 is where the seven-column return stops
   fitting its headings on one line each; above it the table is still the better shape, because
   comparing a column down the page is the whole reason it is a table.

   Opt-in rather than global on purpose. A two-or-three-column table is perfectly readable at 390px
   and would only be made longer by this, and the hours-of-service table — ten columns whose job
   is comparing drivers to each other — is better scrolled than stacked. The class says which
   tables have been looked at.

   Every selector below names BOTH classes. `.table-stack td` and `.table td` carry identical
   specificity, so the plain-`.table` rules in the 560px and 390px blocks further down this file
   would win on source order alone and quietly undo the indent the labels sit in — which is the
   same trap the Safety matrix rule above spells out. */
@media (max-width: 640px) {
  /* Visually hidden, not display:none — the headings are what each cell's label is read from, and
     a screen reader should still have the real table to navigate. */
  .table.table-stack thead {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
  }
  .table.table-stack, .table.table-stack tbody, .table.table-stack tfoot, .table.table-stack tr, .table.table-stack td, .table.table-stack tfoot th {
    display: block; width: auto;
  }
  .table.table-stack tr {
    border: 1px solid var(--border); border-radius: 10px;
    padding: 8px 12px; margin-bottom: 10px; background: #fff;
  }
  /* The label sits ABSOLUTELY on the left rather than as a flex item, and this is the one decision
     in here worth explaining. Flex makes every child of the cell its own item, so a cell holding
     `<strong>OH</strong> <span>PILOT TRAVEL CENTER #412, TOLEDO OH</span>` spreads its two halves
     to opposite edges and then breaks the two-letter state code down the middle — "O" over "H" —
     to give the merchant name more room. Out of flex, the value is ordinary inline flow: one run
     that wraps as a whole and keeps the code intact. */
  .table.table-stack td, .table.table-stack tfoot th {
    display: block; border: 0; padding: 6px 0 6px 38%;
    position: relative; text-align: right;
  }
  .table.table-stack td + td { border-top: 1px dashed var(--border); }
  /* `attr()` rather than a second element in the markup, so the desktop table carries no spare DOM
     it never shows. */
  .table.table-stack td::before {
    content: attr(data-label);
    position: absolute; left: 0; top: 6px; width: 36%;
    color: var(--muted); font-size: 12px; font-weight: 600; line-height: 1.5;
    text-transform: uppercase; letter-spacing: .3px; text-align: left;
  }
  /* THE FIRST CELL IS THE RECORD'S HEADING, not one more labelled line. It is what the row IS —
     the jurisdiction, or the date of the purchase — and every other line is a fact about it. Left
     aligned and a size up, because space-between on a labelless cell pushes its two halves to
     opposite edges and reads as a value with its label missing. */
  .table.table-stack tbody td:first-child {
    display: block; font-size: 15px; padding: 2px 0 8px; text-align: left;
    border-bottom: 1px solid var(--border); margin-bottom: 4px;
  }
  .table.table-stack tbody td:first-child::before { content: none; }
  .table.table-stack tbody td:first-child + td { border-top: 0; }

  /* A cell with nothing in it is not worth a line of its own — an unassigned truck should leave no
     trace rather than print "TRUCK" against a blank. */
  .table.table-stack td:empty { display: none; }
  /* The value side, which is the part that may wrap. */
  .table.table-stack td { overflow-wrap: anywhere; }
  .table.table-stack td.num { font-variant-numeric: tabular-nums; }
  /* The total. Its label cell spans the table on a desktop; stacked, the colspan means nothing and
     the two halves simply sit together like every other labelled row. */
  .table.table-stack tfoot tr { border-width: 2px; }
  .table.table-stack tfoot th { font-size: 14px; padding-left: 0; text-align: left; }
  .table.table-stack tfoot th[colspan] { padding-bottom: 0; }
  /* The empty state keeps its single centred line rather than becoming a labelled record. */
  .table.table-stack tr.empty-row { display: block; }
  .table.table-stack tr.empty-row td { display: block; text-align: center; padding-left: 0; }
  .table.table-stack tr.empty-row td::before { content: none; }
  /* Row click targets still work — a stacked row is one tap area, which is what it looks like. */
  .table.table-stack tr[onclick] { cursor: pointer; }
  /* The audit matrix, stacked. The 760px block strips its badges down to fit seven in a row;
     stacked there is one per line and the full pill fits, so it gets its dot and padding back —
     three classes, to outrank the two-class rule above. The status detail (a date, "expired")
     sits under the pill on the value side. */
  .table.table-stack.audit-matrix .badge { padding: 4px 10px; gap: 5px; }
  .table.table-stack.audit-matrix .badge::before { display: inline-block; }
  .table.table-stack.audit-matrix .matrix-detail { text-align: right; }
  /* Three of its labels are two lines long ("ROAD TEST CERTIFICATE"), and a label is absolutely
     positioned so it does not stretch its cell — the cell is as tall as the pill, and the second
     line ran into the dashed rule below. A floor two label lines tall, on this table only; the
     other stacked tables have short labels and would only be made longer. */
  .table.table-stack.audit-matrix tbody td:not(:first-child) { min-height: 48px; box-sizing: border-box; }
}

/* A NUMERIC column is sized by its values, and its values are short — "1", "$5,300.00". So the
   header is the only thing with any width to it, and `overflow-wrap: anywhere` above let the
   browser shatter the label rather than widen the column by the twenty pixels it wanted. On the
   invoice page that produced a "Qty" column 56px wide with its header stacked Q / T / Y above a
   column of single digits, which is how the user found it.
   Breaking BETWEEN words stays allowed, so "Ledger balance" and "% of revenue" still fold onto two
   lines and cost their tables nothing; only a break inside a word is refused. Above a phone there
   is room for that, and below 560px the rule beneath this one takes everything back anyway. */
@media (min-width: 561px) {
  .table th.num { overflow-wrap: normal; }
}

/* A phone, and the last resort. Everything above this point protects the values that are nonsense
   broken over two lines — a trip number, a dollar amount, a date — and every one of them is now
   the thing holding a table off the screen: Invoices and Settlements still stood ~190px past a
   390px screen with all eight of their columns already as narrow as their headers allowed.
   So below 560px nothing is protected any more. "TG-2026-1001" may break after "TG-", which is
   bad; having to drag the table sideways to see whether a trip is invoiced, on the device a
   dispatcher actually has in their hand at a truck stop, is worse. Nothing above a phone is
   affected — this rule does not exist at 561px. */
@media (max-width: 560px) {
  .table th, .table td { white-space: normal; overflow-wrap: anywhere; }
  /* A column header is five to sixteen characters of uppercase label and there is one per column,
     so at this width the headers alone decide how much room is left for the values. Dropping them
     to 10.5px and a 6px gutter is what stops "RATING" coming out as six lines of one letter — the
     label is still perfectly legible, and the ~60px it gives back per table is the difference
     between a value column that breaks mid-word and one that breaks at its spaces. */
  .table th { font-size: 10.5px; padding: 8px 6px; letter-spacing: .02em; }
  .table td { font-size: 13px; padding: 10px 6px; }

  /* The driver audit matrix used to be excused here — a 58px floor per column and a sideways
     scroll, on the argument that a matrix is read across. It stacks now instead (table-stack,
     at the carrier's request): below 640px it is one card per driver with each document as a
     labelled line, which is what a person on a phone actually wants from it. So the floor is
     gone; the only table still excused below is the hours-of-service one. */
}

/* ---------- Payments received against an invoice ---------- */
/* One line per payment under the total: what arrived, when, and the receipt if there is one. A
   broker settling in instalments is ordinary, and this is the list that says which instalments
   have actually landed. */
.payment-list { display: flex; flex-direction: column; }
.payment-row {
  display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.payment-row:last-child { border-bottom: none; }

/* ---------- A trip's window, opened from its number ---------- */
/* Replaces the Comment column on the Reviews tables. A review's comment is a sentence somebody
   typed; a column has to reserve width for it on every row, including the ones with no comment,
   which squeezed the rest of the table and still cut the sentence off. Here it has the width of
   the window and simply wraps. */
.trip-facts { display: flex; flex-direction: column; gap: 2px; margin-bottom: 4px; }
.trip-facts-row {
  display: flex; gap: 14px; align-items: baseline;
  padding: 7px 0; border-bottom: 1px solid var(--border);
}
.trip-facts-row:last-child { border-bottom: none; }
/* A fixed label column so the values line up down the list rather than stepping in and out with
   the length of each label. */
.trip-facts-label { flex: none; width: 116px; font-size: 12.5px; color: var(--muted); }
.trip-facts-value { font-size: 14.5px; overflow-wrap: anywhere; }

.review-entry { padding: 10px 0; border-bottom: 1px solid var(--border); }
.review-entry:last-of-type { border-bottom: none; }
.review-entry-head { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; }
/* The comment itself: free to wrap, and to break a word rather than widen the window. */
.review-entry-comment { margin: 6px 0 0; font-size: 14.5px; line-height: 1.5; overflow-wrap: anywhere; }

/* Another carrier's comment, which has no trip of its own to open — their trip is their business,
   which is why that row carries no number and no reviewer. So it sits under their rating instead,
   as a line that wraps: height on the rows that have a comment, rather than width on every row. */
.review-inline-comment {
  margin: 5px 0 0; font-size: 13px; line-height: 1.45; color: var(--ink-soft);
  white-space: normal; overflow-wrap: anywhere; max-width: 420px;
}

@media (max-width: 560px) {
  /* The label stops being a column of its own once there is no room for two. */
  .trip-facts-row { flex-direction: column; gap: 2px; }
  .trip-facts-label { width: auto; }
}

/* The domains a broker is authorized to write from — read as a set, so they are chips rather than
   a comma-separated line a dispatcher has to parse with their eye while comparing one against an
   address in front of them. Monospace for the same reason: "rn" and "m" must not look alike in the
   one place on the page where telling them apart is the entire job. */
.domain-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.domain-chip {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 3px 8px; color: var(--ink);
}

/* ---------- A location's receiving hours ---------- */
/* One row per day: the day's name at a fixed width so the time boxes line up in a column down the
   week, the two times, and the Closed tick. The day column is a fixed width rather than a grid
   track because the rows are separate elements — a 9-character "Wednesday" must not push its own
   row's times further right than Monday's. */
.hours-grid { display: flex; flex-direction: column; gap: 6px; }
/* A date box and a time box side by side. Both are NATIVE pickers, and a native picker has an
   intrinsic width it will not go below — about 128px each in Chromium — so two of them set to
   `flex: 1` with the default `min-width: auto` simply refused to fit a 246px card on a phone and
   pushed Booking Tools off the side of the screen. They are given a real basis and allowed to
   wrap: side by side wherever there is room, stacked where there is not. */
.date-time-row { display: flex; gap: 6px; flex-wrap: wrap; }
.date-time-row input { flex: 1 1 112px; min-width: 112px; }

.hours-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hours-day { width: 96px; flex: none; font-size: 13px; color: var(--ink-soft); font-weight: 650; }
.hours-row input[type="time"] { width: 138px; flex: none; }
.hours-row input[type="time"]:disabled { background: var(--bg); color: var(--muted); }
.hours-dash { color: var(--muted); }
.hours-closed { margin: 0; font-size: 13px; }
.hours-readout .trip-stop-row { padding: 5px 0; font-size: 13.5px; }
@media (max-width: 560px) {
  /* The day's name takes a line of its own rather than squeezing the two times into half a phone. */
  .hours-day { width: 100%; }
  .hours-row input[type="time"] { flex: 1; width: auto; min-width: 104px; }
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px;
  font-size: 12.5px; font-weight: 650; white-space: nowrap; text-transform: capitalize;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
/* The Safety page's driver audit matrix: seven columns, three of them with long names ("Road Test
   Certificate", "Drug & Alcohol Test"). The shared table rules set white-space: nowrap on every
   cell, which is right for a trip row but here forced the table ~70px wider than a 1280px laptop
   screen — so the one table on the page you are meant to READ ACROSS, driver by document, was the
   one you had to scroll sideways to finish. Letting the headers and the status badges wrap onto a
   second line costs a little vertical space and takes roughly 250px off the width. */
.audit-matrix th, .audit-matrix td { white-space: normal; }
/* A floor, so a column of short badges ("MVR" over "On file") does not collapse to a sliver when
   a neighbouring column is long. 76px is about the width of the longest unbreakable word in any
   of these headers ("Certificate", "Application"), so it costs nothing and stops the columns
   drifting to different widths. */
.audit-matrix th { min-width: 76px; }
/* The badge itself stays on one line — a pill broken across three lines, with its status dot
   stranded in the vertical middle, is worse than the scrollbar this was fixing. The date lives
   under it instead (matrix-detail), where it is free to wrap. */
.matrix-detail { margin-top: 4px; font-size: 12px; color: var(--muted); line-height: 1.35; }
/* The driver's name wraps too, but only when the window is genuinely too narrow to hold it: with
   room it stays on one line, and on a small screen a name over two lines beats a scrollbar under
   the one table on this page you are meant to read across. */
.audit-matrix td:first-child { overflow-wrap: anywhere; }
/* Tighter gutters than a general table, because seven columns of short badges do not need 16px
   either side to be legible. */
.audit-matrix th, .audit-matrix td { padding-left: 12px; padding-right: 12px; }
.badge-booked { background: var(--info-soft); color: var(--info); }
.badge-dispatched { background: #f5f3ff; color: #7c3aed; }
.badge-in_transit { background: var(--warn-soft); color: var(--warn); }
.badge-delivered { background: var(--good-soft); color: var(--good); }
.badge-pending { background: var(--warn-soft); color: var(--warn); }
.badge-invoiced { background: #f5f3ff; color: #7c3aed; }
.badge-paid { background: var(--good-soft); color: var(--good); }
.badge-cancelled { background: var(--bad-soft); color: var(--bad); }
.badge-draft { background: #f1f5f9; color: var(--ink-soft); }
.badge-sent { background: var(--info-soft); color: var(--info); }
.badge-overdue { background: var(--bad-soft); color: var(--bad); }
.badge-available, .badge-on_duty { background: var(--good-soft); color: var(--good); }
.badge-in_use { background: var(--warn-soft); color: var(--warn); }
.badge-off_duty, .badge-maintenance { background: #f1f5f9; color: var(--ink-soft); }
.badge-retired { background: var(--bad-soft); color: var(--bad); }
.badge-owner, .badge-dispatcher, .badge-operation, .badge-fleet { background: var(--brand-soft); color: var(--brand-dark); }
.badge-tracking { background: var(--good-soft); color: var(--good); }
.badge-accountant { background: #f5f3ff; color: #7c3aed; }
.badge-safety { background: var(--bad-soft); color: var(--bad); }
.badge-driver { background: var(--warn-soft); color: var(--warn); }
.badge-customer, .badge-client { background: var(--info-soft); color: var(--info); }
.badge-fmcsa-good { background: var(--good-soft); color: var(--good); }
.badge-fmcsa-bad { background: var(--bad-soft); color: var(--bad); }
.badge-fmcsa-muted { background: #f1f5f9; color: var(--ink-soft); }

/* ---------- Forms ---------- */
/* minmax(0, 1fr) rather than plain 1fr, for the reason already written out above .attn-item: a
   grid track's default minimum is `auto`, so it refuses to shrink below its contents. Every one of
   these tracks held a text input, which has padding and a border and a min-content width of its
   own — so on a narrow phone the single column stayed 303px wide inside a 212px card and pushed
   the whole page sideways. Add a Stop on a trip and the form ran off the screen.
   The trap was known and written down here; this rule simply never got the fix. */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid.cols-1 { grid-template-columns: minmax(0, 1fr); }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid[hidden] { display: none; }
@media (max-width: 700px) { .form-grid, .form-grid.cols-3, .form-grid.cols-4 { grid-template-columns: minmax(0, 1fr); } }
@media (min-width: 701px) and (max-width: 900px) { .form-grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12.5px; font-weight: 650; color: var(--ink-soft); }
.field .hint { font-size: 11.5px; color: var(--muted); }
input, select, textarea {
  font: inherit; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: #fff; color: var(--ink);
  width: 100%;
}
/* A tick box is not a text field. The rule above is written for one — a bordered, padded box that
   fills the width it is given — and it was landing on checkboxes and radios too, which have no
   text to fill anything with. Inside a flex row (every "tick this" line in the app is one) the
   100% width made the input STRETCH, and a stretched checkbox draws its little box centred in all
   that space: the tick ended up adrift from its own words, sitting at a different place on every
   row depending on how long that row's sentence was. Complete Trip's detention requests were the
   worst of it — two boxes floating in the middle of the window, neither one next to its label.
   So they keep their native size and sit still: no stretch, no padding, no border of ours, and
   never a flex item that grows. accent-color paints the native tick in the site's amber instead
   of the browser's blue. */
input[type="checkbox"], input[type="radio"] {
  width: auto; flex: none; padding: 0; border: none; background: none; border-radius: 0;
  accent-color: var(--brand);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: var(--brand); }
textarea { resize: vertical; min-height: 70px; }
/* Fields HaulStack keeps in capitals — company names, addresses, cities. This only changes how the
   text is DRAWN; UPPERCASE_SCRIPT in views/layout.js rewrites the value so what gets posted matches
   what's on screen, and the server uppercases it again before storing. The placeholder is left in
   sentence case on purpose: "455 E EISENHOWER PKWY" shouting at an empty box reads as an error. */
/* The asterisk marking a required field. Decorative — every one of these sits next to a label whose
   input also carries the `required` attribute (or, for the two document rows and the tax ID, a
   check in the form's own submit handler), so a screen reader is told by the field itself and the
   asterisk is aria-hidden. */
/* In-page notices, in place of the browser's alert() box (hsNotice, views/layout.js). Fixed to the
   viewport and stacked above the modal overlay (z-index 60) because most of them fire from inside a
   modal or at the bottom of a long form — a notice you have to scroll to find is no notice at all. */
#hs-notices {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  z-index: 200; display: flex; flex-direction: column; gap: 8px;
  width: min(560px, calc(100vw - 32px)); pointer-events: none;
}
.hs-notice {
  pointer-events: auto; display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 12px 11px 14px; border-radius: 10px; border: 1px solid;
  font-size: 13.5px; line-height: 1.45; font-weight: 500;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .16);
}
.hs-notice-error { background: var(--bad-soft); border-color: #fecaca; color: #991b1b; }
.hs-notice-success { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.hs-notice-text { flex: 1; min-width: 0; }
.hs-notice-close {
  flex: none; background: none; border: 0; cursor: pointer; padding: 0 2px;
  font-size: 17px; line-height: 1; color: inherit; opacity: .6;
}
.hs-notice-close:hover { opacity: 1; }
.hs-notice-in { animation: hs-notice-in .16s ease-out; }
@keyframes hs-notice-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .hs-notice-in { animation: none; } }
.req { color: var(--bad); font-weight: 700; }
/* A field the trip form named in its "these still need filling in" list. Outlined so the list and
   the page agree about what is wrong — a list of twelve problems is no use if you then have to
   hunt for the boxes. Cleared as soon as the dispatcher types into it (tfMark, views/trip-form.js),
   so it never stays red while they are fixing it. */
input.field-invalid, select.field-invalid, textarea.field-invalid {
  border-color: var(--bad);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--bad) 18%, transparent);
}
/* The sentence under a field that failed validation — what the browser used to say in a grey
   balloon that vanished on the next click (see views/field-validation.js). Red, because the
   outline above is red and the two are describing the same thing; sitting in the layout rather
   than floating over it, so a form with four problems shows four messages and nothing overlaps. */
.field-error {
  margin: 5px 0 0; font-size: 12.5px; line-height: 1.4; color: var(--bad);
}
input.upper, textarea.upper { text-transform: uppercase; }
input.upper::placeholder, textarea.upper::placeholder { text-transform: none; }
/* ---------- Anchored dropdowns ---------- */
/* Three typeaheads share this panel: the Generate Invoice modal's "Invoice to" broker search (see
   generateInvoiceModal, invoices.js), the trip form's "Warehouse / location name" (tfLocationInput,
   trip-form.js), and the truck/trailer/driver picker (views/picker.js). They were three copies of
   the same six declarations; they are one rule now so a change to the panel reaches all of them.
   Each keeps its own option class because the contents differ — the location one carries an
   address, the picker carries a detail line and a flag. */
.gi-broker-dropdown, .stop-name-dropdown, .picker-list {
  position: absolute; top: 100%; left: 0; right: 0; margin-top: 4px; z-index: 20;
  background: #fff; border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow);
  max-height: 220px; overflow-y: auto;
}
.gi-broker-option, .stop-name-option { padding: 8px 12px; font-size: 13.5px; cursor: pointer; }
.gi-broker-option:hover, .gi-broker-option:focus,
.stop-name-option:hover, .stop-name-option:focus { background: var(--bg); }
.gi-broker-empty { padding: 8px 12px; font-size: 13px; color: var(--muted); }

/* ---------- Unit / driver picker (views/picker.js) ---------- */
/* Replaces a native <datalist>, whose dropdown the browser drew in its own font at its own width,
   half over the field below it — and which resolved the chosen id by string-comparing the typed
   text, so a form could submit with nothing assigned while the box still read like it was. */
.picker { position: relative; }
.picker-input { padding-right: 52px; }
/* Both sit inside the input's right-hand padding. pointer-events on the caret is off so clicking it
   reaches the input underneath and opens the list, rather than landing on a decoration. */
.picker-caret {
  position: absolute; right: 12px; top: 50%; width: 0; height: 0; margin-top: -2px;
  border-left: 4px solid transparent; border-right: 4px solid transparent;
  border-top: 5px solid var(--muted); pointer-events: none; transition: transform .15s ease;
}
.picker-open .picker-caret { transform: rotate(180deg); }
.picker-clear {
  position: absolute; right: 28px; top: 50%; transform: translateY(-50%);
  width: 20px; height: 20px; padding: 0; border: none; border-radius: 50%;
  background: transparent; color: var(--muted); font-size: 17px; line-height: 1; cursor: pointer;
}
.picker-clear:hover { background: var(--bg); color: var(--ink); }
.picker-clear[hidden] { display: none; }
.picker-option {
  display: flex; flex-direction: column; gap: 1px;
  padding: 8px 12px; font-size: 13.5px; cursor: pointer; border-bottom: 1px solid var(--border);
}
.picker-option:last-of-type { border-bottom: none; }
.picker-option[hidden] { display: none; }
/* Hover and keyboard highlight are the same colour on purpose: with a mouse and with arrow keys you
   are doing the same thing, and two different highlights visible at once is confusing. */
.picker-option:hover, .picker-option.picker-active { background: var(--brand-soft); }
.picker-option[aria-selected="true"] .picker-option-main { font-weight: 650; }
.picker-option-main { color: var(--ink); }
.picker-option-detail { font-size: 12px; color: var(--muted); }
.picker-option-flag { font-size: 11.5px; color: var(--warn); font-weight: 600; }
.picker-empty { padding: 10px 12px; font-size: 13px; color: var(--muted); }
.picker-empty[hidden] { display: none; }
/* "It is not on the list yet" — the last row, and deliberately not dressed like the records above
   it: it is an action, not one of them. The top border holds the line even when every option above
   is filtered away, which is exactly when this row is most likely to be the one being used. */
.picker-create {
  padding: 9px 12px; font-size: 13.5px; cursor: pointer; font-weight: 600;
  color: var(--brand); border-top: 1px solid var(--border);
}
.picker-create[hidden] { display: none; }
.picker-create:hover, .picker-create.picker-active { background: var(--brand-soft); }
.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row input { width: auto; }

/* ---------- Kanban / dispatch board ---------- */
.board { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 12px; }
.board-col { flex: 0 0 270px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; max-height: calc(100vh - 210px); }
.board-col-head { padding: 12px 14px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.board-col-head .count { font-size: 11.5px; color: var(--muted); background: var(--bg); padding: 1px 7px; border-radius: 999px; }
.board-col-body { padding: 10px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; }
.load-card { background: #fff; border: 1px solid var(--border); border-radius: 9px; padding: 11px 12px; display: block; color: inherit; }
.load-card:hover { border-color: var(--brand); box-shadow: var(--shadow); text-decoration: none; }
.load-card .lc-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.load-card .lc-num { font-weight: 700; font-size: 12.5px; color: var(--ink); }
.load-card .lc-rate { font-weight: 700; font-size: 12.5px; color: var(--good); }
.load-card .lc-route { font-size: 12.5px; color: var(--ink-soft); margin-bottom: 6px; }
.load-card .lc-meta { font-size: 11.5px; color: var(--muted); display: flex; justify-content: space-between; }

/* ---------- Misc ---------- */
/* WRAPS ON A PHONE. This row holds six date ranges — Last 30 days, This month, Last month, Year
   to date, All time — which comes to 376px and does not fit any phone made. It had no wrap, so
   Reports pushed its own page sideways on every handset, and the last range was off the edge where
   nobody would find it. Same fault, same fix as .tabs-underline. */
.pill-tabs { display: flex; flex-wrap: wrap; gap: 4px; background: var(--bg); border: 1px solid var(--border); border-radius: 9px; padding: 3px; width: fit-content; max-width: 100%; }
.pill-tabs a { padding: 6px 12px; border-radius: 7px; font-size: 12.5px; font-weight: 600; color: var(--ink-soft); }
.pill-tabs a.active { background: #fff; color: var(--ink); box-shadow: var(--shadow); }

/* Wraps, like .pill-tabs above and for the same reason. This used to wrap only inside the admin
   area, where a row of six tabs was pushing every page 84px off a phone; the base rule was left
   unwrapped, so the next page to use this class would have rediscovered the same bug. */
.tabs-underline { display: flex; flex-wrap: wrap; row-gap: 2px; gap: 26px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.tabs-underline a { padding: 10px 2px; font-size: 14px; font-weight: 650; color: var(--ink-soft); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs-underline a.active { color: var(--ink); border-bottom-color: var(--brand); }
.tabs-underline a:hover { text-decoration: none; color: var(--ink); }

/* A trip row carries ten columns, and the shared .table rules set white-space: nowrap on every
   cell — right for a date, a mileage or a dollar amount, which must never break across two lines.
   The effect on this table was that its narrowest possible width was the SUM of its longest
   values, so one long city pair ("LIVONIA, MI -> RANCHO CUCAMONGA, CA") or one long driver name
   pushed the row past the page and the whole board got a horizontal scrollbar. Every trip was
   then half a trip: Notes and the expand chevron sat off the right edge, and reading a row meant
   scrolling sideways and losing the trip number off the left.
   Three columns carry prose rather than values, and they are the ones allowed to give way: the
   route, the driver (with its truck/trailer line) and the dispatcher. They wrap instead of
   pushing, which drops the table's minimum width far below any laptop screen, while every column
   that must not break keeps the nowrap it had. The min-widths stop them collapsing into a column
   of single words on a wide screen — they are floors, not fixed widths, so the table still hands
   its spare room to whichever column has the most to say.
   overflow-wrap: anywhere (rather than break-word) is deliberate: only `anywhere` lowers a cell's
   MINIMUM content width, which is the number that decides whether the table fits at all. It only
   ever breaks inside a word once a cell is already narrower than its longest word.
   .table-wrap's overflow-x stays as the last resort for a screen narrower than even this. */
.trip-table { width: 100%; table-layout: auto; }
.trip-table th, .trip-table td { padding-left: 12px; padding-right: 12px; }
.trip-table th { white-space: normal; }
.trip-table td.cell-route, .trip-table td.cell-driver, .trip-table td.cell-dispatcher {
  white-space: normal; overflow-wrap: anywhere;
}
/* THE NOTES COLUMN HOLDS ONE ICON and was 36px wide, which is narrower than the word "NOTES".
   `.table th` carries overflow-wrap:anywhere, so the header did not simply overflow — it broke
   one letter per line, N / O / T / E / S down the side of the Dispatch board and the Trip
   Monitor, and dragged the whole header row to roughly a hundred pixels tall on the two pages a
   dispatcher looks at all day. Same fault as the admin Email table's "KIND", found this time
   while taking a screenshot of the board for the landing page.
   The width is measured rather than guessed: the word itself needs 47px at this header's font
   and letter-spacing, and the column carries 12px of padding each side, so 71px is the first
   width at which it COULD sit on one line — and at exactly 71 it still wrapped, because a width
   equal to the content leaves nothing for sub-pixel rounding. 78px is that measurement with
   slack. 54px was the original guess and came out as "NOT / ES". */
.trip-table th.col-notes, .trip-table td.col-notes { width: 78px; min-width: 78px; }
.trip-table td.cell-route { min-width: 168px; }
.trip-table td.cell-driver { min-width: 132px; }
.trip-table td.cell-dispatcher { min-width: 96px; }
/* "Oct 2, 2026" broken in half reads as two different things, so each VALUE on a wrapping line
   keeps its own nowrap while the line itself is free to break between them. */
.trip-table td .keep-together { white-space: nowrap; }

/* Wrapping alone only buys so much: ten columns have a floor of about 1000px however hard the
   prose is squeezed, and a 1280-wide window leaves a trip table 1002px of room. Below that, the
   row FOLDS instead of scrolling. Each folding column disappears from the table and its value
   reappears as a small line inside the cell to its left — the broker load # under the trip
   number, the dispatcher under the driver, the mileage under the route. Nothing is hidden and
   nothing moves out of reach; the same three facts are simply read down instead of across.
   They fold in the order the board can most afford to lose a column of its own: the broker load #
   and the dispatcher first (both also sit in the expanded row), then the mileage, which is the
   least used of the figures on a narrow screen. */
.trip-table .fold-in { display: none; font-size: 12px; margin-top: 3px; overflow-wrap: anywhere; }

@media (max-width: 1340px) {
  .trip-table th, .trip-table td { padding-left: 9px; padding-right: 9px; }
  .trip-table td { font-size: 14px; }
  .trip-table td.cell-route { min-width: 150px; }
  .trip-table td.cell-driver { min-width: 118px; }
  .trip-table td.cell-dispatcher { min-width: 86px; }
}

@media (max-width: 1240px) {
  .trip-table th.col-broker, .trip-table td.cell-broker,
  .trip-table th.col-dispatcher, .trip-table td.cell-dispatcher { display: none; }
  .trip-table td .fold-in.fold-broker, .trip-table td .fold-in.fold-dispatcher { display: block; }
}

@media (max-width: 1000px) {
  .trip-table th.col-miles, .trip-table td.cell-miles { display: none; }
  .trip-table td .fold-in.fold-miles { display: block; }
}

/* Small tablet / large phone: the last of the room comes out of the padding and the type. */
@media (max-width: 760px) {
  .trip-table th, .trip-table td { padding-left: 6px; padding-right: 6px; }
  .trip-table td { font-size: 13.5px; }
  .trip-table td.cell-route { min-width: 116px; }
  .trip-table td.cell-driver { min-width: 96px; }
}

/* Phone. The rate and the driver fold into the route cell as well, which leaves four columns —
   what needs doing (the bell), which trip, where it is going with everything about it underneath,
   and its notes. A trip is read DOWN at this width instead of across, which is the only way a
   nine-column row and a 390px screen can both be true. */
@media (max-width: 560px) {
  .trip-table th.col-rate, .trip-table td.cell-rate,
  .trip-table th.col-driver, .trip-table td.cell-driver { display: none; }
  .trip-table td .fold-in.fold-rate, .trip-table td .fold-in.fold-driver { display: block; }
}

/* The narrowest phones still in use (360-390pt). Four columns and no padding left to give. */
@media (max-width: 440px) {
  .trip-table th, .trip-table td { padding-left: 4px; padding-right: 4px; }
  .trip-table td { font-size: 13px; }
  .trip-table td.cell-route { min-width: 72px; }
  .trip-table .fold-in { font-size: 11.5px; }
  /* The last thing setting the floor at this width is the status pill, which is one unbreakable
     word-pair ("In Transit") in a column this narrow. It is allowed to shrink and, below about
     375px, to run onto a second line inside its own pill — the alternative is the whole board
     scrolling sideways again on the narrowest phones still in use. */
  .trip-table td .badge { font-size: 11px; padding: 3px 7px; white-space: normal; }
  .trip-table td .notes-btn { font-size: 16px; }
}
.trip-table tbody tr.trip-row { cursor: pointer; }
.trip-table tbody tr.trip-expand-row:hover > td { background: none; }
.trip-table tbody tr.trip-expand-row > td { padding: 0; border-bottom: 1px solid var(--border); }
.trip-chevron { display: inline-block; color: var(--muted); font-size: 14px; }
.trip-expand { background: var(--bg); padding: 18px 20px; }
.trip-stops { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 16px; }
@media (max-width: 700px) { .trip-stops { grid-template-columns: 1fr; } }
.trip-stop { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; }
.trip-stop-label { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; margin-bottom: 6px; }
.trip-stop-place { font-weight: 650; margin-bottom: 8px; }
.trip-stop-row { display: flex; justify-content: space-between; font-size: 12.5px; padding: 3px 0; }
.stop-card { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; margin-bottom: 12px; }
.stop-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.stop-card-head strong { font-size: 13px; }
.stop-remove { color: var(--bad); font-size: 12px; }
.trip-expand-meta { display: flex; gap: 26px; flex-wrap: wrap; font-size: 14.5px; margin-bottom: 12px; }
.trip-expand-meta .muted { margin-right: 5px; }
.rate-mismatch-warn {
  display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 650;
  color: var(--warn); background: var(--warn-soft); padding: 6px 11px; border-radius: 999px;
}
.rate-mismatch-warn .tri { font-size: 14.5px; }
.trip-notes { font-size: 14.5px; margin-bottom: 14px; }
.trip-notes .muted { margin-right: 5px; }
.trip-expand-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.alert { padding: 10px 14px; border-radius: 8px; font-size: 14.5px; margin-bottom: 16px; }
.alert-error { background: var(--bad-soft); color: var(--bad); border: 1px solid #fecaca; }
.alert-success { background: var(--good-soft); color: var(--good); border: 1px solid #a7f3d0; }
.alert-info { background: var(--info-soft); color: var(--info); border: 1px solid #bae6fd; }
/* A figure that computed and should not be trusted. Deliberately not alert-error: a carrier whose
   operation really does sit outside the expected range must still be able to file, and an error
   they are told to ignore every quarter is an error they stop reading. */
.alert-warn { background: var(--warn-soft); color: var(--warn); border: 1px solid #fde68a; }
/* The same warning, attached to the row it is about. */
.row-flag { font-size: 11px; font-weight: 650; color: var(--warn); margin-top: 2px; }
/* The two downloads of the return and their explanation, on one line. */
.export-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0 0 14px; }

/* DUE WHEN, FILED OR NOT — the one line above the return. */
.filed-line {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 8px 12px; margin: 0 0 14px; border-radius: 8px; font-size: 14px;
  background: var(--bg); border: 1px solid var(--border);
}
.filed-line-done { background: var(--good-soft); border-color: #a7f3d0; color: var(--good); }

/* A FIELD SOMETHING ELSE ON THE PAGE LINKS TO. The app has a fixed top bar, so an anchor lands
   with its target tucked underneath it — the carrier is scrolled to the right place and sees the
   control BELOW the one they came for. :target then marks it for a moment, because arriving in the
   middle of a long form with nothing highlighted is barely better than arriving at the top. */
.anchor-target { scroll-margin-top: 96px; border-radius: 8px; }
.anchor-target:target { outline: 2px solid var(--brand); outline-offset: 6px; }

/* A SURCHARGE LINE on the return. It hangs off the jurisdiction above it — a second calculation on
   the same miles, not another jurisdiction — so it is tinted and its first cell is indented, and
   the border above it is dropped so the two read as one block. Below 640px the table stacks into
   records and the indent would fight the label column, so it is removed there. */
.table tbody tr.surcharge-row > td { background: var(--bg); border-top: 0; }
.table tbody tr.surcharge-row > td:first-child { padding-left: 26px; }
@media (max-width: 640px) {
  .table.table-stack tbody tr.surcharge-row > td:first-child { padding-left: 0; }
}
.divider { height: 1px; background: var(--border); margin: 18px 0; }
.muted { color: var(--muted); }
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; margin: 22px 0 10px; }
.section-title:first-child { margin-top: 0; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--sidebar-border); color: var(--sidebar-active-text); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12.5px; flex: none; }
.note-list { max-height: 320px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; margin-top: 4px; }
.note-item { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; background: #fff; }
.note-item-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 13px; margin-bottom: 4px; }
.note-item-head .muted { font-size: 12px; }
.note-item-body { font-size: 14.5px; white-space: pre-wrap; word-break: break-word; }
.note-item-attachments { margin-top: 6px; display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; }
.doc-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 8px; }
.doc-row .doc-type { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--brand-dark); background: var(--brand-soft); padding: 2px 8px; border-radius: 6px; margin-right: 8px; }
.doc-row-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.doc-row-remove {
  width: 26px; height: 26px; border-radius: 6px; border: 1px solid var(--border); background: #fff;
  color: var(--bad); font-size: 15px; line-height: 1; display: flex; align-items: center; justify-content: center;
  padding: 0; cursor: pointer; flex: none;
}
.doc-row-remove:hover { background: var(--bad-soft); border-color: #fecaca; }
.doc-row-input { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 8px; background: #fff; }
.doc-row-input .field:first-child { flex: 1; }
.doc-row-input .field:nth-child(2) { flex: 2; }
.doc-row-input .doc-remove { flex: none; margin-bottom: 8px; }
/* The rate confirmation row: the same shape as the rows below it, but its type is fixed and it has
   no Remove button, because a trip cannot be booked without it. The type reads as text rather than
   a disabled <select>, which would look like a control that had stopped working. */
.doc-fixed-type { padding: 9px 0; font-size: 14px; font-weight: 600; color: var(--ink); }
.doc-list { max-height: 320px; overflow-y: auto; margin-top: 4px; }

/* Driver CDL/medical attach — small download-icon chips instead of a full .doc-row per file, plus
   the custom-styled "Upload file" control that replaces the browser's default file input (see
   fileUploadField / attachedDocsList, views/drivers.js). */
.attached-files { display: flex; flex-wrap: wrap; gap: 10px; }
.attached-file { position: relative; }
.attached-file-icon {
  display: flex; align-items: center; justify-content: center; width: 40px; height: 40px;
  border: 1px solid var(--border); border-radius: 8px; background: #fff; color: var(--brand-dark);
}
.attached-file-icon:hover { background: var(--brand-soft); border-color: var(--brand); text-decoration: none; }
.attached-file-remove {
  position: absolute; top: -7px; right: -7px; width: 18px; height: 18px; border-radius: 50%;
  border: 1px solid var(--border); background: #fff; color: var(--bad); font-size: 13px; line-height: 1;
  display: flex; align-items: center; justify-content: center; padding: 0; cursor: pointer;
}
.attached-file-remove:hover { background: var(--bad-soft); border-color: #fecaca; }
/* Trailer (and similar) photo gallery — a grid of clickable thumbnails instead of the small
   download-icon chips above, since a photo is worth previewing rather than naming (see
   trailerPhotoGallery, views/trailers.js). Each thumbnail links straight to the image via
   GET /app/trailer-documents/:id/view, which serves it inline (not as a forced download) so
   clicking one just opens/previews the photo. */
.photo-gallery { display: flex; flex-wrap: wrap; gap: 10px; }
.photo-gallery-item { position: relative; width: 96px; height: 96px; }
.photo-gallery-item .photo-gallery-view { display: block; width: 100%; height: 100%; }
.photo-gallery-item img {
  width: 100%; height: 100%; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); background: var(--bg);
}
.photo-gallery-remove {
  position: absolute; top: -7px; right: -7px; width: 18px; height: 18px; border-radius: 50%;
  border: 1px solid var(--border); background: #fff; color: var(--bad); font-size: 13px; line-height: 1;
  display: flex; align-items: center; justify-content: center; padding: 0; cursor: pointer;
}
.photo-gallery-remove:hover { background: var(--bad-soft); border-color: #fecaca; }
/* Small download button pinned to the thumbnail's bottom-right corner, so it coexists with the
   view-link (covers the full thumbnail) and the remove button (top-right corner) without
   overlapping either — see trailerPhotoGallery, views/trailers.js. */
.photo-gallery-download {
  position: absolute; bottom: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%;
  background: rgba(0, 0, 0, 0.55); color: #fff; display: flex; align-items: center; justify-content: center;
  cursor: pointer; text-decoration: none;
}
.photo-gallery-download:hover { background: rgba(0, 0, 0, 0.75); }
.file-upload { display: flex; align-items: center; gap: 8px; padding-top: 1px; flex-wrap: wrap; }
.file-upload-name { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 170px; }
/* The shared file picker (views/file-field.js). The real <input type="file"> is stretched across
   the button at opacity 0 rather than being hidden behind a <label for>: a REQUIRED control the
   browser cannot render blocks the form from submitting while showing the user nothing, and half
   these fields are required. Transparent-but-present keeps `required` working, keeps the control
   focusable, and lets the browser anchor its validation message to the visible button. */
.file-upload-btn { position: relative; display: inline-flex; }
.file-upload-btn .btn { display: inline-flex; align-items: center; gap: 6px; pointer-events: none; }
.file-upload-icon { flex: none; }
.file-upload-btn .file-upload-input {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; cursor: pointer; font-size: 0;
}
/* The input carries the focus, but it is invisible — so the ring has to be drawn on the button
   standing in for it, or keyboard users get no focus indicator at all. */
.file-upload-btn:focus-within .btn { outline: 2px solid var(--brand); outline-offset: 2px; }
.file-upload-btn:hover .btn { background: var(--bg); }
.file-upload-input:disabled { cursor: default; }
.file-upload-btn:has(.file-upload-input:disabled) .btn { opacity: .6; }
/* One row per document category (CDL, Medical card, Driver Application, etc.) — label on the
   left, the "Upload file" control plus any already-attached files on the right, with a dividing
   line under each row so a long list of document types reads as clearly separated items instead
   of one continuous block. See docRow, views/drivers.js (and the equivalent in trucks.js/
   trailers.js's Documents sections, which use the plain .form-grid layout instead). */
.doc-field-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.doc-field-label { font-weight: 600; font-size: 13.5px; flex: 1 1 180px; }
.doc-field-upload { display: flex; align-items: center; gap: 14px; flex: 2 1 320px; justify-content: flex-end; flex-wrap: wrap; }
@media (max-width: 700px) { .doc-field-upload { justify-content: flex-start; } }
.ct-section { padding: 14px 0; border-bottom: 1px solid var(--border); }
.ct-section:last-of-type { border-bottom: none; }
.ct-check-row { display: flex; align-items: flex-start; gap: 8px; font-size: 13.5px; margin-bottom: 8px; cursor: pointer; }
.ct-check-row input { margin-top: 3px; }
.ct-rating-row { margin-bottom: 14px; }
.ct-rating-row textarea { width: 100%; margin-top: 6px; box-sizing: border-box; font: inherit; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; resize: vertical; }
.star-input { margin-top: 4px; }
.star-input .star { cursor: pointer; font-size: 22px; color: #d1d5db; }
.star-input .star.filled { color: #f59e0b; }
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.bar-row .bar-label { width: 130px; font-size: 12.5px; color: var(--ink-soft); flex: none; }
.bar-track { flex: 1; height: 10px; background: var(--bg); border-radius: 6px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--brand); border-radius: 6px; }
.bar-row .bar-value { width: 90px; text-align: right; font-size: 12.5px; font-weight: 650; flex: none; }

/* ---------- Auth pages ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); padding: 24px; }
/* With the site's header and footer now around the sign-in card, 100vh is the wrong height: it is
   a full screen PLUS a header PLUS a footer, so the page scrolls on every laptop and the footer
   sits below the fold where nobody finds it. The card still centres in what is left. */
body.has-chrome .auth-wrap { min-height: 58vh; padding: 32px 24px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card .brand { display: flex; align-items: center; gap: 9px; justify-content: center; margin-bottom: 22px; }
.auth-card .brand .mark { width: 32px; height: 32px; border-radius: 8px; background: var(--brand); display: flex; align-items: center; justify-content: center; color: var(--ink); font-weight: 700; }
.auth-card .brand .name { font-weight: 700; font-size: 18px; }
.auth-card h1 { text-align: center; font-size: 19px; }
.auth-card > p.sub { text-align: center; margin-bottom: 20px; }
.auth-foot { text-align: center; margin-top: 16px; font-size: 13px; color: var(--ink-soft); }

/* ---------- Landing page ---------- */
.lp-nav { display: flex; align-items: center; justify-content: space-between; padding: 18px 6vw; max-width: 1280px; margin: 0 auto; }
.lp-nav .links { display: flex; gap: 26px; align-items: center; }
.lp-nav .links a { color: var(--ink-soft); font-weight: 600; font-size: 13.5px; }
.lp-hero { padding: 64px 6vw 40px; max-width: 1280px; margin: 0 auto; text-align: center; }
.lp-hero .kicker { display: inline-block; background: var(--brand-soft); color: var(--brand-dark); font-weight: 700; font-size: 12px; padding: 5px 12px; border-radius: 999px; margin-bottom: 18px; }
.lp-hero h1 { font-size: clamp(30px, 4.6vw, 50px); line-height: 1.08; max-width: 820px; margin: 0 auto 16px; }
.lp-hero p.lead { font-size: 16.5px; max-width: 600px; margin: 0 auto 28px; color: var(--ink-soft); }
.lp-hero .cta-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.lp-section { padding: 50px 6vw; max-width: 1280px; margin: 0 auto; }
.lp-section h2 { font-size: 28px; text-align: center; max-width: 640px; margin: 0 auto 10px; }
.lp-section p.center { text-align: center; max-width: 560px; margin: 0 auto 36px; }
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
@media (max-width: 850px) { .feature-grid { grid-template-columns: 1fr 1fr; } .lp-nav .links { display: none; } }
@media (max-width: 560px) { .feature-grid { grid-template-columns: 1fr; } }
/* ---------- The product screenshots on the landing page ---------- */
/* Each one is a 1440px-wide capture shown at roughly half that, which is what keeps it sharp on a
   retina screen without shipping an image twice the size. The aspect ratio is declared through
   width/height on the <img> itself so the page does not jump as they load. */
.lp-shots .shot { margin: 0 0 34px; }
.lp-shots .shot:last-of-type { margin-bottom: 26px; }
.lp-shots img {
  display: block; width: 100%; height: auto; border-radius: 12px;
  border: 1px solid var(--border); box-shadow: 0 10px 30px rgba(15, 23, 42, .10);
}
.lp-shots .shot-link { display: block; }
.lp-shots figcaption { margin-top: 11px; font-size: 13.5px; color: var(--ink-soft); text-align: center; }
.lp-shots figcaption strong { color: var(--ink); }

.demo-box {
  display: flex; gap: 18px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  border-color: var(--brand);
}
.demo-title { font-weight: 700; font-size: 15px; }
.demo-sub { margin: 3px 0 0; font-size: 13px; color: var(--ink-soft); }
.demo-creds { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 10px; }
.demo-creds span { display: flex; gap: 7px; align-items: baseline; }
.demo-label { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 650; }
.demo-creds code {
  font-size: 13px; background: var(--bg); border: 1px solid var(--border);
  border-radius: 6px; padding: 2px 7px; user-select: all;
}

.feature-card { padding: 22px; }
.feature-card .icon { width: 38px; height: 38px; border-radius: 9px; background: var(--brand-soft); color: var(--brand-dark); display: flex; align-items: center; justify-content: center; margin-bottom: 14px; font-size: 17px; }
.feature-card h3 { margin-bottom: 6px; }
.feature-card p { margin: 0; font-size: 13px; }
.pricing-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; align-items: stretch; }
@media (max-width: 850px) { .pricing-grid { grid-template-columns: 1fr; max-width: 380px; margin: 0 auto; } }
.price-card { padding: 26px 24px; display: flex; flex-direction: column; }
.price-card.featured { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.price-card .plan-name { font-weight: 700; font-size: 15px; }
.price-card .plan-price { font-size: 34px; font-weight: 750; margin: 10px 0 2px; letter-spacing: -0.02em; }
.price-card .plan-price span { font-size: 13px; font-weight: 600; color: var(--muted); }
.price-card ul { list-style: none; padding: 0; margin: 18px 0 22px; display: flex; flex-direction: column; gap: 9px; }
.price-card li { font-size: 13px; color: var(--ink-soft); padding-left: 20px; position: relative; }
.price-card li::before { content: "✓"; position: absolute; left: 0; color: var(--good); font-weight: 700; }
.lp-footer { border-top: 1px solid var(--border); padding: 26px 6vw; text-align: center; color: var(--muted); font-size: 12.5px; }
.lp-cta-banner { background: linear-gradient(135deg, var(--brand), var(--brand-dark)); border-radius: 20px; padding: 48px 6vw; text-align: center; color: #fff; margin: 0 6vw 60px; }
.lp-cta-banner h2 { color: #fff; }
.lp-cta-banner p { color: #fef3c7; margin: 0 auto 22px; max-width: 480px; }
.lp-cta-banner .btn-primary { background: #fff; color: var(--brand-dark); }
.lp-cta-banner .btn-primary:hover { background: #f4f4ff; }

/* ---------- Modal (New trip) ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 60;
  display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto;
  opacity: 1; transition: opacity .2s ease;
}
.modal-overlay[hidden] { display: none; }
/* Applied briefly (by window.closeModalOverlay in layout.js) before [hidden] actually lands, so a
   pop-up fades/slides away instead of vanishing instantly. pointer-events is turned off immediately
   so a fast double-click can't hit something mid-fade. */
.modal-overlay.modal-closing { opacity: 0; pointer-events: none; }
.modal {
  background: var(--panel); border-radius: var(--radius); box-shadow: 0 20px 50px rgba(15, 23, 42, .25);
  width: 100%; max-width: 640px; max-height: calc(100vh - 80px); display: flex; flex-direction: column;
  /* Reset text-align regardless of the ancestor it's rendered inside — the notes modal in
     particular is nested inside a centered <td> (for the envelope button's own layout) and would
     otherwise inherit centered text throughout its whole body. */
  text-align: left;
  /* And white-space, for the same reason and from the same ancestor. Most of these dialogs are
     written inside the <td> that holds the button opening them, so `.table td { white-space:
     nowrap }` is INHERITED into them — right for a date in a table cell, wrong for a sentence in
     a dialog. The Safety task window's "Record the new expiry date. Attach the replacement Medical
     Card too if you already have it." ran straight off the right edge with no wrap and no
     scrollbar to say so. Everything inside a dialog that must stay on one line (badges, button
     labels) sets its own nowrap already. */
  white-space: normal;
  opacity: 1; transform: translateY(0); transition: opacity .2s ease, transform .2s ease;
}
.modal-overlay.modal-closing .modal { opacity: 0; transform: translateY(10px); }
.modal-head {
  padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between;
}
.modal-head h2 { margin: 0; font-size: 16px; }
.modal-close {
  background: none; border: none; cursor: pointer; font-size: 22px; line-height: 1; color: var(--muted); padding: 0 4px;
}
.modal-close:hover { color: var(--ink); }
.modal-body { padding: 18px 20px; overflow-y: auto; }

/* ---------- "Are you sure?" (views/confirm-dialog.js) ---------- */
/* Replaces window.confirm, which announced itself as "haulstack-tms-production.up.railway.app
   says", ignored the app's typography and buttons, and gave "Remove this driver?" and "permanently
   delete everything" the same grey OK. It borrows the shared .modal furniture above and changes
   only what a question needs. */
/* A question is short: 640px of dialog around one sentence reads as a form with nothing in it.
   And it is centred rather than pinned near the top, since there is nothing below it to scroll. */
.hs-confirm-overlay { align-items: center; }
.hs-confirm { max-width: 460px; }
.hs-confirm-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 4px 20px 18px; }
/* Scoped to this dialog: .btn-danger elsewhere is an outline button sitting among other controls,
   where solid red would shout. Here it IS the dangerous choice and should look like it — the one
   thing window.confirm could never be told. */
.hs-confirm .btn-danger { background: var(--bad); color: #fff; border-color: var(--bad); }
.hs-confirm .btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }
@media (max-width: 480px) {
  /* Stacked, with the safe choice under the thumb rather than beside it. */
  .hs-confirm-actions { flex-direction: column-reverse; }
  .hs-confirm-actions .btn { width: 100%; text-align: center; justify-content: center; }
}

/* ---------- Stop location hover pop-up (Trip Monitor / Dispatch board stop names) ---------- */
/* Underline hint that a stop's warehouse/location name has more info behind it. One shared
   .stop-loc-tooltip div is reused for every stop on the page (see stopTableScript, views/loads.js)
   and repositioned/repopulated on hover/focus rather than rendering one pop-up per stop. */
.stop-loc-hover { border-bottom: 1px dashed var(--muted); cursor: help; }
.stop-loc-tooltip {
  position: fixed; z-index: 1000; background: var(--ink, #1e293b); color: #fff; border-radius: 8px;
  padding: 10px 12px; font-size: 12.5px; line-height: 1.5; max-width: 260px; box-shadow: 0 10px 30px rgba(15, 23, 42, .3);
  opacity: 0; transform: translateY(4px); transition: opacity .12s ease, transform .12s ease; pointer-events: none;
}
.stop-loc-tooltip[hidden] { display: none; }
.stop-loc-tooltip.stop-loc-tooltip-visible { opacity: 1; transform: translateY(0); }
.stop-loc-tooltip .stop-loc-tt-name { font-weight: 700; font-size: 13px; margin-bottom: 4px; }
.stop-loc-tooltip .stop-loc-tt-row { color: rgba(255,255,255,.85); }
.stop-loc-tooltip .stop-loc-tt-row + .stop-loc-tt-row { margin-top: 2px; }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; }

/* "View" chip in the sidebar next to a page a role can open but not change — so view-only access
   is visible before someone fills in a form and gets refused on submit. */
.sidebar nav a .nav-view-only {
  margin-left: auto; font-size: 10px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; opacity: .55; border: 1px solid currentColor;
  border-radius: 4px; padding: 1px 4px; line-height: 1.4;
}

/* ---------- Booking Tools & hours of service ---------- */

/* THE FOUR CLOCKS. A grid rather than a table because the four are read at a glance and compared
   to each other, not scanned down a column — a dispatcher wants "which of these is nearly out",
   which a row of bars answers instantly and a table of numbers does not.

   The colour comes from lib/hos.js's clockState(), which is proportional to each clock's own limit
   rather than a flat number of minutes: an hour left is nearly nothing on the 11-hour clock and
   genuinely nothing on the 70-hour one, so a shared threshold would paint the cycle red all week. */
.hos-clocks { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.hos-clock { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; background: var(--panel); }
.hos-clock .hc-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.hos-clock .hc-value { font-size: 20px; font-weight: 700; font-family: var(--font-display); margin-top: 4px; letter-spacing: -0.01em; }
.hos-clock .hc-limit { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.hos-clock .bar-track { margin-top: 9px; height: 6px; }
.hos-clock.state-out .hc-value { color: var(--bad); }
.hos-clock.state-low .hc-value { color: var(--bad); }
.hos-clock.state-warn .hc-value { color: var(--warn); }
.hos-clock.state-unknown .hc-value { color: var(--muted); }
.bar-fill.fill-ok { background: var(--good); }
.bar-fill.fill-warn { background: var(--warn); }
.bar-fill.fill-low, .bar-fill.fill-out { background: var(--bad); }
.bar-fill.fill-unknown { background: var(--border); }
@media (max-width: 760px) { .hos-clocks { grid-template-columns: repeat(2, 1fr); } }

/* THE ANSWER. Deliberately the largest thing on the page: the dispatcher came here for one
   number, and burying it in a table beside eight others is how a tool stops being used. */
.eta-hero { border: 1px solid var(--border); border-left: 3px solid var(--brand); border-radius: var(--radius); background: var(--brand-soft); padding: 18px 20px; }
.eta-hero .eta-label { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--brand-dark); }
.eta-hero .eta-value { font-size: 27px; font-weight: 700; font-family: var(--font-display); letter-spacing: -0.02em; margin-top: 3px; line-height: 1.15; }
.eta-hero .eta-sub { font-size: 13px; color: var(--ink-soft); margin-top: 6px; }
.eta-facts { display: flex; flex-wrap: wrap; gap: 20px; margin-top: 14px; }
.eta-facts div { min-width: 92px; }
.eta-facts .ef-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.eta-facts .ef-value { font-size: 15px; font-weight: 650; margin-top: 2px; }

/* THE TIMELINE. One row per segment of the driver's day, because the sum alone ("38 hours") is
   not checkable and this is: a dispatcher can see WHERE the 34-hour restart landed and decide
   whether they believe it. Rests are tinted so the shape of the trip — drive, break, drive,
   sleep — reads without having to parse the labels. */
.bk-timeline { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.bk-seg { display: flex; align-items: baseline; gap: 12px; padding: 9px 14px; font-size: 13px; border-top: 1px solid var(--border); }
.bk-seg:first-child { border-top: none; }
.bk-seg .bs-when { width: 118px; flex: none; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bk-seg .bs-what { flex: 1; min-width: 0; }
.bk-seg .bs-dur { width: 72px; flex: none; text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; }
.bk-seg .bs-kind { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); display: block; }
.bk-seg-drive { background: var(--panel); }
.bk-seg-dwell { background: var(--info-soft); }
.bk-seg-dwell .bs-kind { color: var(--info); }
.bk-seg-break { background: var(--warn-soft); }
.bk-seg-break .bs-kind { color: var(--warn); }
.bk-seg-reset, .bk-seg-split_rest { background: var(--bg); }
.bk-seg-restart { background: var(--bad-soft); }
.bk-seg-restart .bs-kind { color: var(--bad); }
@media (max-width: 620px) {
  .bk-seg { flex-wrap: wrap; gap: 4px 12px; }
  .bk-seg .bs-when { width: 100%; }
  .bk-seg .bs-dur { width: auto; }
}

/* The stop rows on the planning form. A grid rather than a table so the row reflows on a phone
   instead of scrolling sideways — a dispatcher checking a load from a truck stop is a real case. */
.bk-stops { display: flex; flex-direction: column; gap: 8px; }
.bk-stop { display: grid; grid-template-columns: 30px minmax(0, 1fr) 112px 34px; gap: 10px; align-items: center; }
/* min-width: 0 on every child, and it is the whole reason this row works on a phone.
   A grid item defaults to `min-width: auto`, which for a text input means its INTRINSIC width —
   roughly twenty characters, from the HTML `size` default — and a 1fr track will not shrink below
   that however narrow the screen gets. At 390px the row stayed about 500px wide, pushed the card
   out with it, and gave the whole page a horizontal scroll: every alert, heading and paragraph on
   it appeared cut off on the right, which looks like a dozen separate bugs and is one. */
.bk-stop > *, .bk-stop input, .bk-stop .bk-dwell-cell { min-width: 0; }
.bk-stop .bk-num { width: 26px; height: 26px; border-radius: 50%; background: var(--bg); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: var(--ink-soft); flex: none; }
.bk-stop input { margin: 0; }
.bk-stop-remove { background: none; border: none; cursor: pointer; color: var(--muted); font-size: 18px; line-height: 1; padding: 4px 6px; border-radius: 6px; }
.bk-stop-remove:hover { color: var(--bad); background: var(--bad-soft); }
.bk-resolved { font-size: 11.5px; color: var(--muted); grid-column: 2 / 4; margin-top: -4px; }
@media (max-width: 620px) {
  /* The address keeps the top line with the number and the remove button; the dwell drops under
     it, indented to line up with the address rather than with the number. Two tidy lines instead
     of three ragged ones, and the × stays on the row it removes. */
  .bk-stop { grid-template-columns: 30px minmax(0, 1fr) 34px; row-gap: 6px; }
  .bk-stop .bk-dwell-cell { grid-column: 2 / 3; }
}

/* An unmatched VIN, on the settings page. Monospace because the only thing anybody does with a
   VIN on screen is compare it character by character against another one. */
.vin-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; letter-spacing: .01em; }

/* A header that is ONE SHORT WORD, in a table of many narrow columns.

   `.table th` sets `overflow-wrap: anywhere` on purpose — a prose header like "Avg. waiting time"
   must be free to wrap so it does not set its column's floor. That rule is right for a phrase and
   wrong for a word: applied to the hours-of-service table it broke "DRIVING" into "DRIVIN / G" and
   "BREAK" into "BR / EA / K", which is not a narrower column, it is an unreadable one.
   
   So the clock columns opt out. They are four to six characters each, so holding them on one line
   costs almost nothing, and .table-wrap still scrolls if the whole table outgrows the card. */
.table th.th-tight { white-space: nowrap; overflow-wrap: normal; }
/* The clock columns themselves: narrower padding, because four numeric columns side by side do
   not need 16px of air each and the space is better spent on the location. */
.table th.th-tight, .table td.td-tight { padding-left: 10px; padding-right: 10px; }
.table td.td-tight { font-variant-numeric: tabular-nums; }

/* THE HOURS TABLE IS EXCUSED from the below-560px "nothing is protected any more" rule, on the
   same reasoning as .audit-matrix above and with the same trade accepted knowingly.

   That rule lets every cell break mid-word so a table fits a phone without a sideways drag, and it
   is right for Invoices and Settlements, where you are looking for one row and then stopping. This
   table is the opposite: ten columns, four of them numbers, and its entire purpose is reading
   ACROSS — which driver has hours, how many, how fresh. Squeezed into 375px it rendered one
   character per line, "Memphis, TN" as a vertical column of letters and "GRIGOL NOZADZE" as
   fourteen. That is not a narrow table, it is an unreadable one, and no amount of scrolling-
   avoidance is worth it.

   So the cells hold their lines and the table keeps a floor, which makes .table-wrap's overflow-x
   do its job. 820px is the natural width of the ten columns with their content on one line each.
   Nothing above a phone is affected: this does not exist at 561px, where the table already fits. */
@media (max-width: 560px) {
  .table.hos-table { min-width: 820px; }
  .table.hos-table th, .table.hos-table td { white-space: nowrap; overflow-wrap: normal; }
  .table.hos-table th { font-size: 11px; }
  /* A pill holds its line too. "On Duty, Not Driving" broken over three, with its status dot
     stranded in the vertical middle, is the exact failure the .audit-matrix note above describes,
     and the general below-560px rule reaches badges specifically. */
  .table.hos-table .badge { white-space: nowrap; overflow-wrap: normal; }
  /* The one thing that may still wrap: the muted "not linked / ELD spelling" line under a driver's
     name is explanatory rather than scanned, and holding it to one line would widen the whole
     table for the least important text on it. */
  .table.hos-table td .muted { white-space: normal; }
}

/* THE APPOINTMENT VERDICT. Placed above the ETA, and larger than it, because when a broker gives a
   "deliver by" the dispatcher is not asking what time the truck arrives — they are asking yes or
   no. The ETA is the working; this is the answer.

   Green and red rather than a neutral panel: this is the one place on the page where a glance has
   to be enough, and the slack underneath turns it from a verdict into a negotiating position —
   "misses by 40 minutes" is a phone call, "misses by 11 hours" is a decline. */
.verdict { border-radius: var(--radius); padding: 14px 18px; margin-bottom: 12px; border: 1px solid; display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.verdict .v-call { font-family: var(--font-display); font-size: 19px; font-weight: 700; letter-spacing: -0.01em; }
.verdict .v-detail { font-size: 13.5px; }
.verdict-makes { background: var(--good-soft); border-color: #a7f3d0; }
.verdict-makes .v-call { color: var(--good); }
.verdict-misses { background: var(--bad-soft); border-color: #fecaca; }
.verdict-misses .v-call { color: var(--bad); }

/* The starting location sits above the numbered stops and is deliberately NOT one of them —
   nothing loads there and nobody waits. The marker says so without needing a label. */
.bk-start { display: grid; grid-template-columns: 30px minmax(0, 1fr) 34px; gap: 10px; align-items: center; margin-bottom: 8px; }
.bk-start .bk-pin { width: 26px; height: 26px; border-radius: 50%; background: var(--bg); border: 1px dashed var(--border); display: flex; align-items: center; justify-content: center; color: var(--muted); }
.bk-start > *, .bk-start input { min-width: 0; }
.bk-eld-note { font-size: 11.5px; color: var(--muted); grid-column: 2 / 4; margin-top: -4px; }
