/* =====================================================================
   Atlas Shipping — design system
   Sidebar-driven app shell, light/neutral surface, navy + blue accents
   carried over from the printed label/invoice branding.
   ===================================================================== */

:root {
  --navy: #0b2545;
  --navy-2: #0f2f5a;
  --blue: #2563eb;
  --blue-light: #eaf1fd;
  --green: #1f8a5e;
  --red: #dc2626;

  --bg: #f4f6f9;
  --surface: #ffffff;
  --border: #e2e6ec;
  --border-strong: #cbd3dd;
  --text: #1c2733;
  --muted: #64748b;
  --muted-2: #94a3b8;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 14px rgba(15, 23, 42, 0.08);
  --sidebar-w: 240px;
}

* { box-sizing: border-box; }

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); }

h1, h2, h3 { color: var(--navy); line-height: 1.25; }
h1 { font-size: 1.5em; margin: 0 0 4px; font-weight: 700; }
h2 { font-size: 1.15em; margin: 28px 0 4px; font-weight: 650; }
h3 { font-size: 1em; margin: 22px 0 4px; font-weight: 650; }

/* ---------------------------------------------------------------------
   App shell: fixed left sidebar + scrollable content column
   --------------------------------------------------------------------- */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--navy);
  color: #dce7f7;
  display: flex;
  flex-direction: column;
  z-index: 30;
}

.sidebar-brand {
  padding: 20px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.sidebar-brand a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: white;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.02em;
  letter-spacing: 0.01em;
}
.brand-mark {
  width: 100%;
  max-width: 190px;
  height: auto;
  display: block;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 14px 10px;
}
.nav-group + .nav-group { margin-top: 18px; }
.nav-group-label {
  font-size: 0.72em;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #7d94b8;
  padding: 0 10px;
  margin-bottom: 6px;
  font-weight: 650;
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: #cfe0f5;
  text-decoration: none;
  font-size: 0.93em;
  font-weight: 500;
  margin-bottom: 2px;
  transition: background 0.12s ease, color 0.12s ease;
}
.sidebar-nav a .nav-icon { flex-shrink: 0; opacity: 0.85; }
.sidebar-nav a:hover { background: rgba(255, 255, 255, 0.07); color: white; }
.sidebar-nav a.active {
  background: var(--blue);
  color: white;
}
.sidebar-nav a.active .nav-icon { opacity: 1; }

.sidebar-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 12px 10px 14px;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: inherit;
  margin-bottom: 4px;
}
.sidebar-user:hover { background: rgba(255, 255, 255, 0.07); }
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #1a3a66;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78em;
  font-weight: 700;
  flex-shrink: 0;
}
.sidebar-user-info { display: flex; flex-direction: column; min-width: 0; }
.sidebar-user-name {
  font-size: 0.87em;
  font-weight: 600;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: 0.76em;
  color: #93aecf;
  text-transform: capitalize;
}
.sidebar-logout { margin: 2px 0 0; }
.sidebar-logout .link-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px;
  border-radius: var(--radius-sm);
  color: #b9cbe4;
  text-decoration: none;
  font-size: 0.87em;
  font-weight: 500;
}
.sidebar-logout .link-btn:hover { background: rgba(255, 255, 255, 0.07); color: white; }

.sidebar-toggle {
  display: none;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 40;
  background: var(--navy);
  color: white;
  border: none;
  width: 40px;
  height: 40px;
  padding: 0;
  margin: 0;
  border-radius: var(--radius-sm);
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  flex-shrink: 0;
}
.sidebar-overlay { display: none; }

.content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
}
.content-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px 36px 60px;
}

.bare {
  max-width: 1100px;
  margin: 24px auto;
  padding: 0 20px;
}

/* ---------------------------------------------------------------------
   Login
   --------------------------------------------------------------------- */
.login-box {
  max-width: 380px;
  margin: 10vh auto;
  background: var(--surface);
  padding: 36px 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}
.login-box h1 {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}
.login-logo {
  width: 100%;
  max-width: 260px;
  height: auto;
}
.captcha-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}
.captcha-refresh {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  padding: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--border-strong);
  border-radius: 50%;
}
.captcha-refresh:hover { background: var(--bg); color: var(--text); }
.captcha-img {
  height: 44px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
}

/* ---------------------------------------------------------------------
   Forms
   --------------------------------------------------------------------- */
.stacked-form, .login-box form {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}
.stacked-form label, .login-box label {
  font-size: 0.83em;
  font-weight: 600;
  color: var(--muted);
  margin-top: 12px;
}
.stacked-form input,
.stacked-form select,
.stacked-form textarea,
.login-box input,
.search-row input,
.search-row select,
.inline-form input,
.inline-form select {
  width: 100%;
  max-width: 480px;
  padding: 9px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font: inherit;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
/* A checkbox/radio must not inherit the text-field width:100% rule
   above — stretching its layout box to fill the container pushes the
   label text after it onto the next line (only visible once two such
   labels share a row, as in the branch form's "Can do pickups" /
   "Is the main office" pair, but the underlying sizing issue exists
   for any checkbox in a .stacked-form). Give it its native intrinsic
   size instead, and lay the label out as an inline flex row so the
   box and its text always sit on one line. */
.stacked-form input[type="checkbox"],
.stacked-form input[type="radio"] {
  width: auto;
  max-width: none;
  padding: 0;
  margin: 0;
}
.stacked-form label:has(> input[type="checkbox"]),
.stacked-form label:has(> input[type="radio"]) {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: auto;
}
/* The item table (invoice line items) needs to use the full content
   width, not the ~480px cap meant for single-line fields above — its
   own cells are already narrow, so the cap is a no-op there anyway,
   but the table itself must stay unconstrained to lay out its 13
   columns without spilling outside its flex-start-sized container. */
.stacked-form table, .stacked-form .table-scroll { width: 100%; max-width: none; }
.table-scroll { overflow-x: auto; padding-bottom: 2px; }
.stacked-form input:focus,
.stacked-form select:focus,
.stacked-form textarea:focus,
.login-box input:focus,
.search-row input:focus,
.search-row select:focus,
.inline-form input:focus,
.inline-form select:focus,
.item-table input:focus,
.item-table select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}
.stacked-form textarea { min-height: 70px; resize: vertical; }

/* Compact field grid — every "edit window" form (customers, invoices,
   branches, locations, users, scheduler, pricing) wraps its short
   label+input(+hint) fields in a .field, grouped inside one .field-grid
   container per section, instead of one field per full-width row. Columns
   size themselves via auto-fill/minmax, so this collapses to 1 column on
   narrow screens with no extra media query. Full-width things (headers,
   the dynamic item tables, textareas, a field whose input genuinely needs
   the full row) live either outside .field-grid entirely (as plain
   .stacked-form children, unchanged from before) or inside it marked
   .field-full to span every column. */
.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  column-gap: 20px;
  row-gap: 14px;
  width: 100%;
  align-items: start;
}
.field-grid .field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}
/* Reset the general .stacked-form label's top margin inside the grid —
   spacing between rows comes from .field-grid's own row-gap instead, so
   a field never inherits an extra 12px on top of that gap. */
.field-grid .field label { margin: 0; }
.field-grid .field input,
.field-grid .field select,
.field-grid .field textarea { max-width: none; }
.field-grid .field .hint { margin: 0; }
.field-grid .field-full { grid-column: 1 / -1; }

button, .btn {
  /* A native <button> doesn't inherit font-family/line-height from body
     the way an <a class="btn"> does — without these two lines a
     <button> renders in the browser's default UI font (e.g. Arial) at
     line-height: normal, measurably shorter and differently-styled than
     an otherwise-identical .btn anchor sitting right next to it (see the
     Customers page's Search button vs. its +New shipment link). Setting
     both explicitly keeps every button/.btn pair in the app visually
     uniform. */
  font-family: inherit;
  line-height: 1.5;
  background: var(--blue);
  color: white;
  border: none;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  font-size: 0.93em;
  font-weight: 600;
  margin-top: 14px;
  transition: background 0.12s ease, transform 0.05s ease;
}
button:hover, .btn:hover { background: var(--navy-2); }
button:active, .btn:active { transform: translateY(1px); }

/* Destructive full-size button (Delete customer, etc.) — same red family
   as .icon-btn.danger / .remove-row-btn, just filled instead of an
   outline/hover-only treatment since this one isn't sitting in a row of
   icons. */
.btn.danger { background: var(--red); }
.btn.danger:hover { background: #c0392b; }

.error {
  color: var(--red);
  background: #fef2f2;
  border: 1px solid #fecaca;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.92em;
}

.hint { font-size: 0.85em; color: var(--muted); }
.edit-link { font-size: 0.5em; }

/* ---------------------------------------------------------------------
   Tables
   --------------------------------------------------------------------- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.data-table th, .data-table td {
  border-bottom: 1px solid var(--border);
  padding: 11px 14px;
  text-align: left;
  font-size: 0.92em;
}
.data-table th {
  color: var(--muted);
  font-weight: 650;
  font-size: 0.8em;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: #fafbfc;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: #f8fafc; }
.data-table a { text-decoration: none; font-weight: 600; }
.data-table a:hover { text-decoration: underline; }

/* ---------------------------------------------------------------------
   Per-row quick actions (Invoice download / Labels / Info) — Invoices
   list + Home's "Incoming pickups". Popovers use position:fixed (JS
   positions them against the trigger button) so they escape the
   table's own overflow:hidden instead of getting clipped near its edges.
   --------------------------------------------------------------------- */
.actions-cell { white-space: nowrap; width: 1%; }
.icon-actions { display: flex; gap: 4px; align-items: center; }
.icon-btn {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  position: relative;
  padding: 0;
  margin: 0; /* the generic `button` rule below sets margin-top: 14px —
                without this reset, every icon-btn that's a real <button>
                (Print label, Info) sits 14px lower than the Download
                icon (a plain <a>, unaffected by that rule), which is
                what made the row look staggered instead of aligned. */
}
.icon-btn svg { width: 16.5px; height: 16.5px; }
.icon-btn:hover, .icon-btn:focus-visible, .icon-btn.active {
  background: var(--blue-light);
  color: var(--blue);
  outline: none;
}
.icon-btn .tip {
  position: absolute;
  bottom: calc(100% + 6px);
  right: -4px;
  background: var(--navy);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 5px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
  z-index: 5;
}
.icon-btn:hover .tip { opacity: 1; }

/* The Cancel-pickup-schedule action (partials/_row-actions.ejs) is a
   <button class="icon-btn"> inside its own <form> so it can POST
   independently of the other icons — display:contents drops the form
   out of layout entirely so its button sits in .icon-actions' flex row
   exactly like a bare icon-btn would. Its hover uses the same red used
   elsewhere for destructive actions (.remove-row-btn on the invoice edit
   form) instead of the icon set's usual blue, since this one undoes
   something rather than opening a view. */
.icon-action-form { display: contents; }
.icon-btn.danger:hover, .icon-btn.danger:focus-visible { background: #fdecea; color: #c0392b; }

.popover {
  position: fixed;
  z-index: 200;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  padding: 8px;
  min-width: 172px;
}
.popover[hidden] { display: none; }
.popover .opt {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  text-align: left;
  padding: 8px 9px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  font-size: 0.86rem;
  cursor: pointer;
  text-decoration: none;
}
.popover .opt:hover { background: var(--blue-light); color: var(--blue); }
.popover .opt svg { width: 26px; height: 20px; flex-shrink: 0; color: var(--muted-2); }
.popover .opt:hover svg { color: var(--blue); }

/* ---------------------------------------------------------------------
   Home's Schedule column — a date (as a link into the Scheduler) once a
   pickup exists, otherwise a labeled button that opens a small inline
   date-picker popover. Sits in the same .actions-cell popover machinery
   as Labels/Info above, so it needs no new JS.
   --------------------------------------------------------------------- */
.schedule-cell { width: auto; }
.schedule-date {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}
.schedule-date svg { width: 15px; height: 15px; color: var(--muted-2); flex-shrink: 0; }
.schedule-date:hover { text-decoration: underline; }
.schedule-btn {
  width: auto;
  height: 30px;
  padding: 0 11px 0 8px;
  gap: 6px;
  font-size: 0.84rem;
  font-weight: 650;
  color: var(--blue);
  background: var(--blue-light);
}
.schedule-btn:hover, .schedule-btn:focus-visible { background: var(--blue); color: #fff; }
.schedule-btn svg { width: 15px; height: 15px; flex-shrink: 0; }

.popover.schedule-pop { padding: 12px; }
.schedule-pop-form { display: flex; flex-direction: column; gap: 8px; }
.schedule-pop-form label { font-size: 0.76rem; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.schedule-pop-form input[type="date"] {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font: inherit;
  color: var(--text);
  background: var(--surface);
}
.schedule-pop-form input[type="date"]:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}
.schedule-pop-form button[type="submit"] { margin: 0; padding: 7px 12px; font-size: 0.86rem; }

/* ---------------------------------------------------------------------
   Driver column (Round 74) — same shape as the Schedule column above:
   a labeled button showing the assigned driver (or "Assign" if none)
   that opens a small inline driver-picker popover. Reuses the same
   .actions-cell popover machinery, no new JS.
   --------------------------------------------------------------------- */
.driver-cell { width: auto; }
.driver-btn {
  width: auto;
  height: 30px;
  padding: 0 11px 0 8px;
  gap: 6px;
  font-size: 0.84rem;
  font-weight: 650;
  color: var(--blue);
  background: var(--blue-light);
  white-space: nowrap;
}
.driver-btn:hover, .driver-btn:focus-visible { background: var(--blue); color: #fff; }
.driver-btn svg { width: 15px; height: 15px; flex-shrink: 0; }

.popover.driver-pop { padding: 12px; }
.driver-pop-form { display: flex; flex-direction: column; gap: 8px; min-width: 200px; }
.driver-pop-form label { font-size: 0.76rem; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.driver-pop-form select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font: inherit;
  color: var(--text);
  background: var(--surface);
}
.driver-pop-form select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}
.driver-pop-form button[type="submit"] { margin: 0; padding: 7px 12px; font-size: 0.86rem; }

.section-subtitle { color: var(--muted); font-size: 0.88em; margin: -6px 0 4px; }
.muted { color: var(--muted-2); }
.empty-row { text-align: center; color: var(--muted); padding: 22px 14px !important; }

.popover.info-pop { min-width: 260px; padding: 14px 16px; }
.info-pop .who { font-weight: 700; color: var(--navy); font-size: 0.92rem; }
.info-pop .when { color: var(--muted); font-size: 0.8rem; margin-top: 1px; }
.info-pop .hist-title { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted-2); font-weight: 700; margin: 12px 0 6px; }
.info-pop .hist-row { display: flex; gap: 8px; font-size: 0.82rem; padding: 3px 0; align-items: baseline; }
.info-pop .hist-row .hdot { width: 6px; height: 6px; border-radius: 50%; background: var(--border-strong); flex-shrink: 0; margin-top: 5px; }
.info-pop .hist-row .hwhat { color: var(--text); text-transform: capitalize; }
.info-pop .hist-row .hwhen { color: var(--muted-2); margin-left: auto; white-space: nowrap; font-size: 0.78em; }
.info-pop .more-link { display: block; margin-top: 10px; font-size: 0.8rem; font-weight: 650; }
.info-pop .info-loading { color: var(--muted); font-size: 0.85rem; }

.kv-table { border-collapse: collapse; margin-top: 14px; }
.kv-table th {
  text-align: left;
  color: var(--muted);
  font-weight: 600;
  padding: 6px 20px 6px 0;
  vertical-align: top;
  font-size: 0.88em;
}
.kv-table td { padding: 6px 0; }

/* ---------------------------------------------------------------------
   Search / filters
   --------------------------------------------------------------------- */
.search-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }

/* ---------------------------------------------------------------------
   Stat tiles (dashboard)
   --------------------------------------------------------------------- */
.stat-row { display: flex; gap: 16px; margin: 18px 0; flex-wrap: wrap; }
.stat-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 24px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 140px;
  box-shadow: var(--shadow-sm);
}
.stat-tile .num { font-size: 1.9em; font-weight: 750; color: var(--navy); }
.stat-tile .label,
.stat-tile span:not(.num) { font-size: 0.82em; color: var(--muted); font-weight: 600; }
a.stat-tile-link { text-decoration: none; color: inherit; transition: box-shadow 0.12s ease, transform 0.05s ease; }
a.stat-tile-link:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

/* Home's "Drop-off boxes ready for pickup" store cards — same stat-tile
   look, plus a wrapping breakdown line ("2 MACHO, 1 REGULAR") under the
   store name. */
.dropoff-store-card { min-width: 200px; }
.dropoff-store-breakdown { font-weight: 400 !important; color: var(--muted); white-space: normal; line-height: 1.3; }

/* Home's "Find a customer" search card — reuses the .wizard-step card
   look and the Drop-Off wizard's .party-results/.party-match result-row
   styling (see public/js/home-customer-search.js), capped narrower than
   a full-width wizard step since it's just a search box. */
.home-customer-search { max-width: 560px; margin: 0; }
.home-customer-search #home-customer-search-fallback { margin-top: 10px; }

/* Wraps "Find a customer" together with the compact "Boxes in warehouse"
   tile so the tile fills the empty space beside the search card instead
   of stacking full-width below it. Wraps to a stacked layout on a narrow
   viewport since the tile has nowhere left to sit next to. */
.home-search-and-stats { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; margin: 18px 0; }
.home-search-and-stats .home-customer-search { flex: 1 1 420px; }

/* Compact variant of .stat-tile — same look, tighter padding/number size
   so a single figure doesn't read as heavy as the Home page's main
   stat row above. */
.compact-stat-tile { flex: 0 1 220px; min-width: 180px; padding: 12px 18px; }
.compact-stat-tile .num { font-size: 1.5em; }

/* Home's "+ New invoice / + New customer / + Schedule pickup" quick
   links — sits above the Incoming pickups list, right under the stat
   tiles. Plain text links (not full .btn styling) to stay lightweight
   above a list that already has its own action-heavy rows. */
.home-quick-actions { margin: 4px 0 18px; }

/* Right-aligned numeric column (e.g. a box-count) inside a .data-table,
   matching how dollar/quantity figures read more naturally right-aligned
   than left. */
.num-cell { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------------
   Customers list (Round 67) — search-result cards, replacing the old
   always-on data-table listing. Each card pairs the found customer with
   their most recent receiver (see routes/customers.js) so the two most
   relevant "who am I shipping, and for whom" facts sit side by side,
   plus the same Info/Edit/Delete icon actions the table used to carry.
   --------------------------------------------------------------------- */
.customer-result-list { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.customer-result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
}
.customer-result-info { display: flex; flex-direction: column; gap: 2px; flex: 1 1 220px; min-width: 180px; }
.customer-result-name { font-weight: 700; color: var(--navy); text-decoration: none; }
.customer-result-name:hover { text-decoration: underline; }
.customer-result-info span { color: var(--muted); font-size: 0.88em; }
.customer-result-prev {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1 1 320px;
  padding-left: 18px;
  border-left: 1px solid var(--border);
}
.customer-result-prev-label { width: 100%; color: var(--muted); font-size: 0.78em; font-weight: 650; text-transform: uppercase; letter-spacing: 0.03em; }
.customer-result-prev strong { color: var(--navy); }
.customer-result-prev span { color: var(--muted); font-size: 0.88em; }
.customer-result-prev .btn, .customer-result-prev .btn-ghost { margin-top: 0; margin-left: auto; }
.customer-result-card .actions-cell { flex-shrink: 0; }

/* ---------------------------------------------------------------------
   Badges
   --------------------------------------------------------------------- */
.badge {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.78em;
  font-weight: 650;
  background: #e2e8f0;
  color: var(--text);
  display: inline-block;
  letter-spacing: 0.01em;
}
.status-delivered { background: #d1fae5; color: #065f46; }
.status-in_transit, .status-customs, .status-out_for_delivery { background: #dbeafe; color: #1e40af; }
.status-staged { background: #e0f2fe; color: #075985; }
.status-ph_warehouse { background: #ffedd5; color: #9a3412; }
.status-pending, .status-received_at_warehouse { background: #fef3c7; color: #92400e; }
.status-picked_up { background: #ede9fe; color: #5b21b6; }
.status-cancelled { background: #fee2e2; color: #991b1b; }
/* pickup-scheduler statuses — reuse the same visual vocabulary as invoice statuses */
.status-requested { background: #fef3c7; color: #92400e; }
.status-confirmed { background: #dbeafe; color: #1e40af; }
.status-completed { background: #d1fae5; color: #065f46; }
.status-no_show { background: #f1f5f9; color: #475569; }
.role-superuser { background: #ede9fe; color: #5b21b6; }
.role-admin { background: #dbeafe; color: #1e40af; }
.role-manager { background: #d1fae5; color: #065f46; }
.role-staff { background: #e2e8f0; color: #334155; }
.role-warehouse { background: #ffedd5; color: #9a3412; }
.role-ph_staff { background: #cffafe; color: #155e75; }
.role-agent { background: #fce7f3; color: #9d174d; }
.role-driver { background: #ccfbf1; color: #115e59; }
/* container statuses — reuse the same visual vocabulary as invoice statuses */
.status-loading { background: #fef3c7; color: #92400e; }
.status-departed { background: #dbeafe; color: #1e40af; }
.status-arrived_port { background: #dbeafe; color: #1e40af; }
.status-released { background: #d1fae5; color: #065f46; }
/* booking_requests statuses (Web Bookings queue, Round 66) — same visual vocabulary again */
.status-new { background: #fef3c7; color: #92400e; }
.status-contacted { background: #dbeafe; color: #1e40af; }
.status-converted { background: #d1fae5; color: #065f46; }
.status-declined { background: #fee2e2; color: #991b1b; }

/* ---------------------------------------------------------------------
   Misc layout helpers
   --------------------------------------------------------------------- */
.two-col { display: flex; gap: 40px; margin-top: 12px; flex-wrap: wrap; }

.item-table { width: 100%; min-width: 1080px; border-collapse: collapse; margin-top: 10px; }
.item-table th {
  text-align: left;
  font-size: 0.78em;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0 4px 6px;
}
.item-table td { padding: 4px; }
.item-table input, .item-table select {
  width: 100%;
  padding: 7px 8px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font: inherit;
}
.dim-cell { text-align: center; }
.dim-na { color: var(--muted-2); font-size: 0.9em; }
.item-status-cell { white-space: nowrap; }
.item-status-cell .hint { margin: 0; font-size: 0.78em; }
.remove-row-btn {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--muted);
  font-size: 1.1em;
  line-height: 1;
  cursor: pointer;
}
.remove-row-btn:hover { background: #fdecea; border-color: #e6a3a3; color: #c0392b; }

.inline-form { display: flex; gap: 8px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.inline-form button { margin-top: 0; }

.link-btn {
  background: none;
  border: none;
  color: var(--blue);
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
  margin: 0;
  font: inherit;
}

table code, .kv-table code { font-size: 0.95em; }

/* Scheduler "new pickup" form (scheduler/form.ejs) — a lightweight
   two-step intake wrapping the existing .stacked-form fields (deliberately
   NOT reusing .wizard-step/.dropoff-wizard from the Drop-Off wizard: that
   class only sets width/margin on text/tel/email/number inputs, not the
   date/time fields this form also needs, and would have silently dropped
   their border/padding/focus styling). Both steps stay plain .stacked-form
   descendants for identical field styling; this just adds the card
   grouping and step-number badge on top, toggled via [hidden] from
   public/js/pickup-wizard.js. Edit mode renders both steps unhidden with
   no badges/Continue/Change controls — same fields, no step gating. */
.pickup-wizard-step { width: 100%; max-width: 480px; }
.pickup-wizard-step + .pickup-wizard-step { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); }
.pickup-wizard-step h2 { margin: 0 0 4px; }
.pickup-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-size: 0.8em;
  font-weight: 700;
  margin-right: 4px;
}

/* ---------------------------------------------------------------------
   Scheduler page — From/To range filter + "+ New customer" toolbar
   --------------------------------------------------------------------- */
.btn-ghost {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  font-size: 0.88em;
  font-weight: 600;
  line-height: 1;
}
.btn-ghost:hover { background: #f1f5f9; }

.scheduler-toolbar { margin: 16px 0; }

/* ---------------------------------------------------------------------
   Invoice detail — toolbar + summary card. Replaces the old flat
   one-field-per-row .kv-table (still used elsewhere — customers,
   container detail, the public tracking page) with a single bordered
   card grouping sender/receiver, shipping details (in a wrapping grid
   instead of a tall single column), and the financial snapshot, so the
   page reads as one glanceable unit instead of a long scroll of loosely
   related text.
   --------------------------------------------------------------------- */
.detail-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 14px 0 18px; }
.detail-toolbar .btn { margin-top: 0; }
.detail-toolbar-secondary { display: flex; gap: 8px; flex-wrap: wrap; }
.detail-toolbar-secondary .btn-ghost { margin-top: 0; }

.invoice-summary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px 24px 22px;
  margin-top: 4px;
}

.summary-parties { display: flex; gap: 40px; flex-wrap: wrap; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.party-role { font-size: 0.74em; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted-2); margin-bottom: 3px; }
.party-name { font-weight: 650; font-size: 1.04em; }
.party-phone { color: var(--muted); font-size: 0.88em; margin-top: 1px; }

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px 24px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.summary-field { min-width: 0; }
.sf-label {
  display: block;
  font-size: 0.74em;
  font-weight: 650;
  color: var(--muted-2);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 2px;
}
.sf-value { font-size: 0.94em; color: var(--text); }

.summary-financials { display: flex; align-items: baseline; gap: 32px; flex-wrap: wrap; padding-top: 16px; }
.fin-stat { display: flex; flex-direction: column; }
.fin-num { font-size: 1.3em; font-weight: 750; color: var(--navy); font-variant-numeric: tabular-nums; }
.fin-label { font-size: 0.74em; font-weight: 650; color: var(--muted-2); text-transform: uppercase; letter-spacing: 0.03em; margin-top: 1px; }
.fin-stat.balance-due .fin-num { color: var(--red); }
.fin-stat.balance-clear .fin-num { color: var(--green); }
.summary-notes { margin: 14px 0 0; padding-top: 14px; border-top: 1px solid var(--border); font-size: 0.92em; }
.summary-notes strong { color: var(--muted); font-weight: 650; }

/* ---------------------------------------------------------------------
   Tracking bar — horizontal stepper for the invoice-facing 8 stages,
   shown on the staff invoice detail page and the public tracking page.
   --------------------------------------------------------------------- */
.tracking-bar { display: flex; align-items: flex-start; margin: 18px 0 24px; overflow-x: auto; }
.tracking-step { display: flex; flex-direction: column; align-items: center; flex: 1; min-width: 84px; position: relative; }
.tracking-step .dot {
  width: 34px; height: 34px; border-radius: 50%;
  background: #e2e8f0; color: #94a3b8;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #e2e8f0;
  z-index: 1;
}
.tracking-step .dot svg { width: 19px; height: 19px; display: block; }
.tracking-step .line {
  position: absolute; top: 16px; left: 50%; width: 100%; height: 2px;
  background: #e2e8f0; z-index: 0;
}
.tracking-step:first-child .line { display: none; }
.tracking-step .label { margin-top: 6px; font-size: 0.76em; color: var(--muted); text-align: center; line-height: 1.25; }
.tracking-step.done .dot { background: var(--navy); border-color: var(--navy); color: #fff; }
.tracking-step.done .line { background: var(--navy); }
.tracking-step.done .label { color: var(--text); }
.tracking-step.current .dot { background: #fff; border-color: var(--blue); color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,0.15); }
.tracking-step.current .label { color: var(--text); font-weight: 650; }
.tracking-bar.cancelled .dot { background: #fee2e2; border-color: #fee2e2; color: #991b1b; }
.tracking-bar-cancelled-note { color: #991b1b; font-weight: 600; margin: 18px 0 24px; }

/* Time-based progress fill for the "in transit" leg — rendered inside the
   Customs step's .line (the connector FROM "in transit" TO "customs" —
   see tracking-bar.ejs), and only while the shipment is actually sitting
   at "in transit". Position/width come from lib/tracking.js's
   computeTransitProgress, set as an inline style per-render; this just
   styles the fill and its pulsing leading edge. */
.line-fill {
  position: absolute; top: 0; left: 0; height: 100%;
  background: var(--blue);
  transition: width 0.3s ease;
}
.line-fill-marker {
  position: absolute; top: 50%; right: -4px;
  width: 10px; height: 10px; margin-top: -5px;
  border-radius: 50%; background: var(--blue);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.2);
  animation: tracking-pulse 1.6s ease-in-out infinite;
}
@keyframes tracking-pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.2); }
  50% { box-shadow: 0 0 0 8px rgba(37, 99, 235, 0.04); }
}
@media (prefers-reduced-motion: reduce) {
  .line-fill-marker { animation: none; }
}

/* ---------------------------------------------------------------------
   Warehouse — scan/receive screen, container list & detail
   --------------------------------------------------------------------- */
.wh-search { display: flex; gap: 8px; max-width: 480px; margin: 10px 0 20px; }
.wh-search input { flex: 1; }
.wh-queue-item, .wh-item-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 8px; flex-wrap: wrap; }
.wh-item-row.is-received { background: #f0fdf4; }
.wh-item-main { display: flex; flex-direction: column; gap: 2px; }
.wh-item-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.wh-item-actions form { display: flex; align-items: center; gap: 6px; margin: 0; }
.wh-item-actions input, .wh-item-actions select { padding: 6px 8px; font-size: 0.85em; }
.wh-container-card { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; margin-bottom: 10px; }
.wh-container-card h3 { margin: 0 0 6px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Reference-name / scan quick-entry bar on the invoice receive screen. */
.wh-batch-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; padding: 10px 12px; background: var(--blue-light); border-radius: var(--radius-sm); }
.wh-batch-bar label { font-weight: 650; font-size: 0.85em; white-space: nowrap; }
.wh-batch-bar input { flex: 1; min-width: 200px; }
.wh-batch-bar .hint { flex-basis: 100%; }
.wh-batch-bar .error { flex-basis: 100%; color: var(--red); font-weight: 600; }

/* Container transit-progress bar on the Warehouse overview page — a
   standalone version of the tracking-bar's time-based fill (same
   computeTransitProgress source, same pulsing leading edge via
   .line-fill-marker, see tracking-bar.ejs / lib/tracking.js). */
.wh-progress-track { position: relative; height: 6px; border-radius: 3px; background: #e2e8f0; margin: 10px 0 4px; }
.wh-progress-fill { position: relative; height: 100%; border-radius: 3px; background: var(--blue); transition: width 0.3s ease; }

.wh-total-boxes { font-weight: 650; margin: 8px 0 4px; }
.wh-breakdown { display: flex; flex-wrap: wrap; gap: 6px; }
.wh-breakdown-chip { background: var(--bg); border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; font-size: 0.8em; color: var(--muted); }

/* Overview's "Ref collected" cards — boxes received under a reference
   name, not yet in a container. Same shape as .wh-container-card so the
   two card types read as one system; a plain white card with no accent
   border, since the amber "awaiting container" badge already carries
   the state signal. */
.wh-ref-card-name { font-family: 'Courier New', Courier, monospace; font-weight: 650; }
.wh-ref-card-none .wh-ref-card-name { font-family: inherit; font-weight: 650; color: var(--muted); }

/* Guided scan session (Receiving tab) — steps 1 (name the batch) and 2
   (scan loop) share .wh-batch-bar's existing tinted-bar look; the
   session header bar additionally pushes "End session" to the far side. */
.wh-scan-session-bar { justify-content: space-between; }
.wh-scan-invoice-input { width: 100%; box-sizing: border-box; padding: 12px 14px; font-size: 1.05em; margin-bottom: 10px; }
.wh-scan-size-cell select { padding: 4px 6px; font-size: 0.9em; }

/* ---------------------------------------------------------------------
   Reports tab — date-range/branch filter bar + the dense report table
   --------------------------------------------------------------------- */
.report-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 6px 0 4px; }
.report-tab { padding: 8px 14px; font-size: 0.85em; font-weight: 650; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; }
.report-tab.active { color: var(--navy); border-bottom-color: var(--blue); }
.report-tab:not(.active):hover { color: var(--text); }

.report-filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px 16px;
  align-items: end;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-top: 14px;
  box-shadow: var(--shadow-sm);
}
.report-filter-grid .field label { display: block; font-size: 0.78em; font-weight: 650; color: var(--muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.03em; }
.report-filter-grid .field select, .report-filter-grid .field input { width: 100%; }
.report-filter-grid .btn-row { grid-column: 1 / -1; display: flex; gap: 10px; margin-top: 2px; flex-wrap: wrap; }

.report-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; margin: 18px 0 10px; }
.report-header .branch-name { font-size: 1.15em; font-weight: 700; color: var(--navy); }
.report-header .period { font-size: 0.95em; color: var(--muted); font-weight: 650; }

.report-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
table.report-table { border-collapse: collapse; width: 100%; font-size: 0.82em; background: var(--surface); }
table.report-table th, table.report-table td { border: 1px solid var(--border); padding: 6px 8px; text-align: right; white-space: nowrap; }
table.report-table th { background: #fafbfc; color: var(--muted); text-align: center; font-size: 0.85em; text-transform: uppercase; letter-spacing: 0.02em; }
table.report-table td.text-left, table.report-table th.text-left { text-align: left; }
table.report-table td.center { text-align: center; }
table.report-table tbody tr:nth-child(odd) { background: #fbfcfe; }
table.report-table tfoot td { background: var(--blue-light); font-weight: 700; }
.type-pill { padding: 1px 8px; border-radius: 10px; font-size: 0.85em; font-weight: 700; }
.type-pill.pickup { background: #fdecec; color: #a33; }
.type-pill.dropoff { background: #e6f4ea; color: #2a7a3f; }

/* ---------------------------------------------------------------------
   Reports overview — Round 48. A small dashboard (total boxes/month,
   each agent's prev-vs-current-month volume) shown above the
   Pick-up/Drop-off report's filter form. Plain CSS horizontal bars —
   width driven by an inline style set server-side, no chart library.
   --------------------------------------------------------------------- */
.overview-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 16px 18px;
  margin-bottom: 16px;
}
.overview-card h3 { margin: 0 0 2px; font-size: 1em; color: var(--navy); }
.overview-card .hint { margin: 0 0 10px; }

.bar-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.bar-row:first-of-type { margin-top: 4px; }
.bar-row .bar-label { width: 130px; flex-shrink: 0; font-size: 0.82em; color: var(--muted); font-weight: 650; }
.bar-row .bar-track { flex: 1; background: #eef2f7; border-radius: 4px; height: 24px; position: relative; }
.bar-row .bar-fill {
  height: 100%; min-width: 2px; background: var(--blue); border-radius: 4px;
  display: flex; align-items: center; justify-content: flex-end; padding-right: 8px;
  transition: width 0.3s ease; box-sizing: border-box;
}
.bar-row .bar-fill .bar-value { color: #fff; font-size: 0.78em; font-weight: 700; white-space: nowrap; }
.bar-row .bar-fill.bar-fill-empty { background: transparent; }
.bar-row .bar-fill.bar-fill-empty .bar-value { color: var(--muted); }
.bar-row .bar-fill-prev { background: var(--muted-2); }

.agent-chart-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; margin-top: 14px; }
.agent-chart { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; background: #fbfcfe; }
.agent-chart h4 { margin: 0 0 6px; font-size: 0.88em; color: var(--navy); }
.agent-chart .bar-row { margin-top: 6px; }
.agent-chart .bar-row .bar-label { width: 76px; font-size: 0.76em; }
.agent-chart .bar-row .bar-track { height: 20px; }

/* Finance report */
.finance-owed { font-weight: 700; }
.finance-owed.negative { color: var(--red); }
table.report-table td.finance-agent { text-align: left; font-weight: 650; }

/* Drop-Off tab (Round 49) — one card per agent store on the inventory
   section, each its own small form. */
.dropoff-inventory-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; margin-top: 14px; }
.dropoff-inventory-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.dropoff-inventory-card h3 { margin: 0; font-size: 1em; color: var(--navy); }
.dropoff-inventory-card .hint { margin: 0 0 6px; }
.dropoff-inventory-fields { display: flex; flex-direction: column; gap: 8px; }
.dropoff-inventory-fields label { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 0.83em; font-weight: 600; color: var(--muted); margin-top: 0; }
.dropoff-inventory-fields input { width: 70px; max-width: 70px; padding: 6px 8px; }
.dropoff-inventory-card button { margin-top: 10px; align-self: flex-start; }

/* ---------------------------------------------------------------------
   PH Operations home — one card per container (Round 71), replacing the
   old arrived-only table. Whole-card link, same clickable-tile pattern as
   a.stat-tile-link.
   --------------------------------------------------------------------- */
.container-card-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin-top: 14px; }
.container-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.12s ease, transform 0.05s ease;
}
.container-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.container-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.container-card-number { font-weight: 750; color: var(--navy); font-size: 1.05em; }
.container-card-ref { color: var(--muted); font-size: 0.85em; }
.container-card-date { display: flex; flex-direction: column; gap: 1px; font-size: 0.88em; }
.container-card-date-label { color: var(--muted); font-size: 0.8em; font-weight: 650; text-transform: uppercase; letter-spacing: 0.03em; }
.container-card-counts { display: flex; gap: 16px; margin-top: 4px; padding-top: 10px; border-top: 1px solid var(--border); font-size: 0.86em; color: var(--muted); }
.container-card-counts strong { color: var(--navy); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------------
   Hero action buttons — a small set of large, centered buttons that ARE
   the page (Drop-Off's "Start Here"/"Track", Agent Operation's
   Pickup/Drop-off/Tracking), rather than one action among many in a
   toolbar. Round 71.
   --------------------------------------------------------------------- */
.hero-actions { display: flex; justify-content: center; align-items: stretch; flex-wrap: wrap; gap: 20px; margin: 40px 0; }
.hero-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 200px;
  padding: 28px 30px;
  border-radius: var(--radius);
  background: var(--blue);
  color: white;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.1em;
  box-shadow: var(--shadow-sm);
  transition: background 0.12s ease, transform 0.05s ease, box-shadow 0.12s ease;
}
.hero-btn:hover { background: var(--navy-2); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.hero-btn:active { transform: translateY(1px); }
.hero-btn-sub { font-size: 0.7em; font-weight: 500; opacity: 0.85; }
/* Secondary hero action (Track) — same size/shape, quieter fill so the
   primary action (Start Here / Pickup / Drop-off) still reads as the
   main event. */
.hero-btn-ghost { background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); }
.hero-btn-ghost:hover { background: #f1f5f9; }

@media print {
  .sidebar, .sidebar-toggle, .report-filter-grid, .report-actions, .overview-card { display: none !important; }
  .content { margin-left: 0 !important; }
  main.content, .content-inner { padding: 0 !important; }
}

/* ---------------------------------------------------------------------
   Responsive: collapse the sidebar behind a toggle below ~880px
   --------------------------------------------------------------------- */
@media (max-width: 880px) {
  .sidebar-toggle { display: flex; }
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.18s ease;
    box-shadow: var(--shadow-md);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.visible {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    z-index: 20;
  }
  .content { margin-left: 0; }
  .content-inner { padding: 68px 20px 40px; }
}

@media (max-width: 600px) {
  .stat-row { flex-direction: column; }
  .two-col { flex-direction: column; gap: 16px; }
  .calendar-cell { min-height: 56px; font-size: 0.9em; }
  .pickup-chip { display: none; }
  .cal-daynum { margin: 0 auto; }
}

/* ---------------------------------------------------------------------
   Drop-Off wizard (Round 51) — guided step-by-step flow replacing the
   old dropoff-mode invoice form. Each step is a card; only one is
   visible at a time (toggled by dropoff-wizard.js via [hidden]).
   --------------------------------------------------------------------- */
.wizard-summary {
  background: var(--blue-light);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 16px;
  margin-bottom: 16px;
  font-size: 0.85em;
  color: var(--navy);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
}
.wizard-summary .ws-item { white-space: nowrap; }
.wizard-summary .ws-item strong { color: var(--navy-2); }
.wizard-summary[hidden] { display: none; }

.dropoff-wizard { max-width: 640px; }

.wizard-step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 22px 24px;
  margin-bottom: 18px;
}
.wizard-step h2 {
  margin: 0 0 14px;
  font-size: 1.05em;
  color: var(--navy);
}
.wizard-step .step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-size: 0.8em;
  font-weight: 700;
  margin-right: 4px;
}
.wizard-step label { display: block; margin-top: 12px; font-size: 0.85em; font-weight: 650; color: var(--muted); }
.wizard-step label:first-of-type { margin-top: 0; }
.wizard-step input[type="text"],
.wizard-step input[type="tel"],
.wizard-step input[type="email"],
.wizard-step input[type="number"],
.wizard-step select,
.wizard-step textarea {
  width: 100%;
  margin-top: 4px;
}
.wizard-step textarea { min-height: 70px; resize: vertical; }
.wizard-step > button,
.wizard-step > .wizard-box-grid + div > button {
  margin-top: 16px;
}

.wizard-search-row { display: flex; gap: 8px; }
.wizard-search-row input { flex: 1; margin-top: 0; }
.wizard-search-row button { margin-top: 0; flex-shrink: 0; }

.party-results { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.party-match {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}
.party-match .party-match-info { font-size: 0.9em; }
.party-match .party-match-info strong { display: block; color: var(--navy); }
.party-match .party-match-info span { color: var(--muted); font-size: 0.85em; }
.party-match button { margin-top: 0; flex-shrink: 0; }

.party-new-form {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--border-strong);
}

/* "Previous receivers" reuse panel — New Invoice form (sender/receiver
   picker) and the Drop-Off wizard's receiver step both use this same
   .party-previous/.party-results/.party-match shape for visual
   consistency between the two entry points. */
.party-previous {
  margin: 10px 0 16px;
  padding-bottom: 16px;
  border-bottom: 1px dashed var(--border-strong);
}

.party-confirmed {
  margin-top: 4px;
  background: #eaf7ef;
  border: 1px solid #bfe6cc;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.party-confirmed .pc-info strong { display: block; color: var(--green); }
.party-confirmed .pc-info span { color: var(--muted); font-size: 0.85em; }
.party-confirmed button { margin-top: 0; }
.party-confirmed[hidden] { display: none; }

.geocode-candidate {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-top: 10px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.geocode-candidate:hover { border-color: var(--blue); background: var(--blue-light); }
.geocode-candidate .gc-text { font-size: 0.88em; }
.geocode-candidate button { margin-top: 0; flex-shrink: 0; }

#zone-result { font-size: 0.95em; }
.zone-match {
  background: #eaf7ef;
  border: 1px solid #bfe6cc;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--green);
  font-weight: 650;
}
.zone-special {
  background: #fff7e6;
  border: 1px solid #f3d998;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: #92650f;
  font-weight: 650;
}

.wizard-box-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.wizard-box-btn {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 12px;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.wizard-box-btn:hover { border-color: var(--blue); background: var(--blue-light); }
.wizard-box-btn strong { color: var(--navy); font-size: 0.95em; }
.wizard-box-btn span { color: var(--muted); font-size: 0.8em; }
.wizard-box-btn.selected { border-color: var(--blue); background: var(--blue-light); box-shadow: 0 0 0 1px var(--blue) inset; }
.wizard-box-btn.wizard-box-irregular strong { color: #92650f; }
.wizard-box-btn.wizard-box-irregular { border-style: dashed; }
.wizard-box-btn.wizard-box-irregular.selected { border-color: #d99a1c; background: #fff7e6; box-shadow: 0 0 0 1px #d99a1c inset; }
.wizard-box-note { color: var(--muted-2) !important; font-style: italic; }
.wizard-box-btn:disabled, .wizard-box-btn.locked {
  cursor: not-allowed;
  opacity: 0.55;
  background: #f8fafc;
}
.wizard-box-btn:disabled:hover, .wizard-box-btn.locked:hover { border-color: var(--border); background: #f8fafc; }

#irregular-fields { margin-top: 16px; }
#irregular-fields .error { margin-top: 0; }

#box-price-row { margin-top: 16px; }
#box-price-auto-note { font-weight: 500; color: var(--muted-2); margin-left: 6px; }

#box-list { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.wizard-box-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.88em;
}
.wizard-box-row .wbr-info strong { display: block; color: var(--navy); }
.wizard-box-row .wbr-info span { color: var(--muted); }
.wizard-box-row button { margin-top: 0; }

.wizard-total-amount { font-size: 1.6em; font-weight: 750; color: var(--navy); margin: 4px 0 0; }
#total-breakdown { font-size: 0.9em; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }

/* Payment-gate page (dropoff/complete.ejs) */
.dropoff-pay-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px 24px;
  max-width: 640px;
  margin-top: 18px;
}
.dropoff-pay-card h3 { margin: 0 0 4px; color: var(--navy); }
.dropoff-pay-card-done { border-color: #bfe6cc; background: #f5fbf7; }
.dropoff-pay-card-done h3 { color: var(--green); }

@media (max-width: 600px) {
  .dropoff-wizard, .dropoff-pay-card { max-width: 100%; }
  .wizard-box-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
}

/* ---------------------------------------------------------------------
   Customer picker (partials/_customer-picker.ejs + js/customer-picker.js)
   Type-to-search replacement for a plain customer <select> — the real
   form field is a hidden <select>; this styles the visible text input
   and its results dropdown.
   --------------------------------------------------------------------- */
.customer-picker { position: relative; width: 100%; max-width: 480px; }
.customer-picker-select { display: none; }
.customer-picker-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 50;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  max-height: 260px;
  overflow-y: auto;
}
.customer-picker-result {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 8px 12px;
  cursor: pointer;
}
.customer-picker-result:not(:last-child) { border-bottom: 1px solid var(--border); }
.customer-picker-result:hover, .customer-picker-result.active { background: var(--blue-light); }
.customer-picker-result-name { font-weight: 600; color: var(--text); font-size: 0.92rem; }
.customer-picker-result-detail { color: var(--muted); font-size: 0.8rem; }
.customer-picker-empty { padding: 10px 12px; color: var(--muted); font-size: 0.86rem; }

/* ---------------------------------------------------------------------
   Driver Operation route list (Round 74) — a card-per-stop layout
   (rather than a table) since this tab is used from a driver's phone.
   Cards are drag-reorderable (public/js/driver-route.js, native HTML5
   drag/drop — no library) to let a driver "move the list around to
   suit their route"; a completed stop drops its drag handle and scan
   input and just shows a "Picked up" badge.
   --------------------------------------------------------------------- */
.route-list { display: flex; flex-direction: column; gap: 12px; max-width: 640px; }
.route-card {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}
.route-card[draggable="true"] { cursor: grab; }
.route-card.route-drag-over { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14); }
.route-card.route-dragging { opacity: 0.5; }
.route-card-done { opacity: 0.7; }
.route-drag-handle { color: var(--muted-2); flex-shrink: 0; margin-top: 3px; }
.route-card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.route-card-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.route-card-name { font-weight: 700; color: var(--navy); font-size: 1.02rem; }
.route-card-meta { color: var(--muted); font-size: 0.84rem; }
.route-card-address { color: var(--text); font-size: 0.92rem; }
.route-card-actions { display: flex; gap: 8px; margin-top: 2px; }
.route-card-actions .btn-ghost { padding: 6px 12px; font-size: 0.82rem; margin: 0; }
.route-scan-row { margin-top: 6px; }
.route-scan-input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font: inherit;
  color: var(--text);
  background: var(--surface);
}
.route-scan-input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}
.route-scan-feedback { display: block; margin-top: 4px; }
.route-scan-feedback.error { color: var(--red, #991b1b); }
.route-scan-feedback.success { color: #065f46; }
