:root {
  /* FleetDesk emblem: jet black, polished chrome, electric cyan, royal ribbon blue */
  --ink: #000000;
  --ink-2: #0a0a0c;
  --chrome: #cfd5e0;
  --chrome-bright: #f4f6f9;
  --carolina: #00c2ff;
  --carolina-deep: #0086cc;
  --carolina-soft: #e2f7ff;
  --carolina-glow: rgb(0 194 255 / 35%);
  --accent-wash: rgb(0 194 255 / 10%);
  --royal: #0d4ea8;
  --royal-deep: #08367a;
  --bg: #e3e6ed;
  --bg-elevated: #f2f4f8;
  --card: #ffffff;
  --text: #0a0a0c;
  --muted: #5a6170;
  --line: #aeb6c4;
  --blue: var(--carolina-deep);
  --green: #147a3a;
  --red: #c81e1e;
  --amber: #c2410c;
  --amber-text: #9a3412;
  --navy: var(--ink);
  --navy-2: var(--ink-2);
  --radius: 0;
  --shadow: 0 0 0 1px rgb(0 0 0 / 8%), 0 12px 32px rgb(0 0 0 / 8%);
  --font: 'Barlow', 'Segoe UI', sans-serif;
  --font-display: 'Barlow Semi Condensed', 'Barlow', sans-serif;
  --chrome-grad: linear-gradient(115deg, #fff 0%, #c9d0db 22%, #f6f7fa 46%, #8e97a8 70%, #e8ecf2 100%);
  --royal-grad: linear-gradient(180deg, #1a6fd4 0%, var(--royal) 45%, var(--royal-deep) 100%);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
html:has(.shell.driver) { scroll-padding: 70px 0 100px; }
body {
  font: 15px/1.4 var(--font);
  font-weight: 500;
  letter-spacing: .01em;
  color: var(--text);
  background:
    radial-gradient(ellipse 90% 35% at 50% -5%, var(--accent-wash, rgb(0 194 255 / 10%)), transparent 55%),
    linear-gradient(180deg, #d5dae4 0%, var(--bg) 34%, #eaecf2 100%);
  -webkit-text-size-adjust: 100%;
}
a { color: var(--carolina-deep); text-decoration: none; }
a:hover { text-decoration: underline; color: var(--ink); }
h1, h2, h3 { margin: 0; line-height: 1.1; font-family: var(--font-display); letter-spacing: .04em; text-transform: uppercase; font-style: italic; }
h1 { font-size: 1.7rem; font-weight: 800; }
h2 { font-size: 1.05rem; display: flex; align-items: center; gap: .5rem; font-weight: 700; font-style: italic; }
h3.sub { font-size: .78rem; margin: 1.1rem 0 .5rem; color: var(--muted); text-transform: uppercase; letter-spacing: .12em; font-family: var(--font-display); font-weight: 700; font-style: normal; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1rem 0; }
.ic { width: 20px; height: 20px; flex: none; }
.logo {
  display: block;
  height: 48px;
  width: auto;
  max-width: 160px;
  object-fit: contain;
  object-position: center;
  flex: none;
  background: transparent;
  border: 0;
}
.muted { color: var(--muted); }
.small, small { font-size: .82rem; }
.mono { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: .9em; letter-spacing: .02em; }
.nowrap { white-space: nowrap; }
.red-text, .danger-text { color: var(--red) !important; }
.boot { padding: 3rem; text-align: center; color: var(--muted); }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.row-gap { display: inline-flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.wrap { flex-wrap: wrap; }
.notes { white-space: pre-wrap; background: var(--bg-elevated); border-left: 2px solid var(--carolina); padding: .55rem .75rem; margin: .75rem 0 0; border-radius: 0; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 40px; padding: .5rem 1rem; border-radius: var(--radius); border: 1px solid var(--line); background: #fff; color: var(--text); font: inherit; font-family: var(--font-display); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; font-size: .82rem; cursor: pointer; text-decoration: none !important; transition: background .12s, border-color .12s, color .12s; }
.btn:hover { background: var(--bg-elevated); border-color: #8e97a6; }
.btn:disabled { opacity: .6; cursor: progress; }
.btn.primary {
  background: linear-gradient(180deg, #1a1a1e 0%, #000 100%);
  border-color: #2a2a30;
  color: #fff;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 12%), 0 0 0 1px color-mix(in srgb, var(--carolina) 28%, transparent), 0 0 18px color-mix(in srgb, var(--carolina) 12%, transparent);
}
.btn.primary:hover { background: linear-gradient(180deg, #222228 0%, #0a0a0c 100%); border-color: var(--carolina); box-shadow: inset 0 1px 0 rgb(255 255 255 / 12%), 0 0 0 1px var(--carolina), 0 0 22px var(--carolina-glow); }
.brand-color-row { display: flex; gap: .5rem; align-items: center; }
.brand-color-row input[type="color"] { width: 3rem; height: 2.5rem; padding: 0; border: 1px solid var(--line); background: #fff; cursor: pointer; }
.brand-color-row input[type="text"] { flex: 1; min-width: 0; }
.brand-preview {
  display: flex; flex-wrap: wrap; align-items: center; gap: .75rem;
  padding: .75rem 1rem; border: 1px solid var(--line); background: var(--bg-elevated);
}
.brand-preview-swatch {
  width: 2rem; height: 2rem; border-radius: 0; background: var(--preview-accent, var(--carolina));
  box-shadow: 0 0 0 1px rgb(0 0 0 / 12%), 0 0 16px color-mix(in srgb, var(--preview-accent, var(--carolina)) 35%, transparent);
}
.brand-preview-btn {
  display: inline-flex; align-items: center; min-height: 2rem; padding: .35rem .75rem;
  background: #000; color: #fff; font-family: var(--font-display); font-size: .74rem; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--preview-accent, var(--carolina)) 40%, transparent);
}
.brand-preview-link { color: var(--preview-accent, var(--carolina-deep)); font-weight: 600; font-size: .9rem; }
.brand-logo-current { margin-top: .5rem; padding: .5rem; background: #0a0a0c; display: inline-block; }
.brand-logo-current .logo { height: 48px; max-width: 160px; }
.banner-internal {
  margin: 0 0 1rem;
  padding: .75rem 1rem;
  border: 1px solid color-mix(in srgb, var(--amber) 35%, var(--line));
  background: color-mix(in srgb, var(--amber) 8%, var(--card));
  color: var(--text);
  font-size: .92rem;
  line-height: 1.35;
}
.banner-internal strong { color: var(--amber-text); letter-spacing: .04em; text-transform: uppercase; font-family: var(--font-display); font-size: .78rem; margin-right: .35rem; }
/* Ticket copies printed after the customer invoice: several per page, captioned, not invoice lines */
.invoice-tickets { margin-top: 1.75rem; border-top: 2px solid #0a0a0c; padding-top: .6rem; }
.invoice-tickets > summary {
  display: flex;
  align-items: baseline;
  gap: .6rem;
  cursor: pointer;
  list-style: none;
  padding: .45rem .1rem;
  user-select: none;
}
.invoice-tickets > summary::-webkit-details-marker { display: none; }
.invoice-tickets > summary::before {
  content: '▶';
  font-size: .8rem;
  color: #5a6170;
  transition: transform .15s ease;
}
.invoice-tickets[open] > summary::before { transform: rotate(90deg); }
.invoice-tickets-title {
  font-size: 1.15rem;
  letter-spacing: .04em;
  font-family: var(--font-display);
  font-weight: 700;
}
.invoice-tickets-hint { margin-left: auto; font-size: .8rem; color: #00779a; font-weight: 600; }
.invoice-tickets[open] .invoice-tickets-hint { display: none; }
.invoice-print-option { margin: 0 0 .5rem; font-size: .9rem; }
/* Customer orders (hand-entered loads) */
.order-section { grid-column: 1 / -1; margin: .9rem 0 .1rem; padding-top: .6rem; border-top: 1px solid var(--line); font-size: .95rem; letter-spacing: .06em; text-transform: uppercase; }
.order-section:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
.order-sheet-cols, .portal-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem 1.5rem; margin: .5rem 0; }
.order-sheet-cols p, .portal-parties p { margin: .25rem 0; line-height: 1.45; }
.order-hazmat { margin: .5rem 0 .75rem; border-left: 4px solid #c4262e; }
.portal-order { padding: .75rem 1rem; margin: .75rem 0; }
@media (max-width: 560px) { .order-sheet-cols, .portal-parties { grid-template-columns: 1fr; } }
.loss { color: #b3261e; }
.payout-customers { display: grid; gap: .35rem; margin-bottom: .75rem; }
.payout-summary { margin: 0 0 1rem; max-height: 16rem; overflow: auto; }
.payout-summary .row-active { background: rgba(0, 0, 0, .05); }
.payout-customer { margin: .15rem 0; font-size: .9rem; }
.exec-card { max-width: 30rem; }
.exec-gate { display: grid; gap: .75rem; }
.fee-rows { display: grid; gap: .5rem; margin: .4rem 0 .6rem; }
.fee-row { display: grid; grid-template-columns: 1.3fr .9fr .8fr 1.5fr 1.6fr auto; gap: .4rem; align-items: center; }
.fee-row select, .fee-row input { min-width: 0; }
@media (max-width: 900px) { .fee-row { grid-template-columns: 1fr 1fr; } }
.invoice-fee-row td { font-size: .86em; color: #3f4652; border-top: 0; padding-top: .1rem; }
.portal-fees { border: 1px solid var(--line); padding: .75rem; background: #fafbfc; }
.portal-fee { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin: .35rem 0; }
.portal-fee input[type="number"] { width: 6.5rem; }
.portal-extras { display: grid; gap: .5rem; margin: .5rem 0; }
.portal-extra { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; }
.portal-extra[hidden] { display: none; }
.portal-extra [data-extra-note] { grid-column: 1 / -1; }
.payout-mill { margin: 0 0 1rem; }
.payout-mill-head { margin: 1rem 0 .4rem; font-size: 1.05rem; letter-spacing: .04em; font-family: var(--font-display); }
.payout-mill .invoice-tickets { margin-top: .6rem; }
.invoice-ticket-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .55rem .7rem;
  margin-top: .75rem;
}
.invoice-ticket {
  margin: 0;
  border: 1px solid #d8dde6;
  padding: .4rem .45rem .5rem;
  break-inside: avoid;
  page-break-inside: avoid;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.invoice-ticket-file {
  height: 3.35in;
  background: #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: #5a6170;
  font-size: .85rem;
}
.invoice-ticket-photo, .invoice-ticket-pdf {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border: 0;
  background: #fff;
}
.invoice-ticket figcaption {
  display: flex;
  flex-wrap: wrap;
  gap: .2rem .75rem;
  margin-top: .35rem;
  padding-top: .3rem;
  border-top: 1px solid #d8dde6;
  font-size: .82rem;
  color: #0a0a0c;
}
.invoice-ticket figcaption .k {
  color: #5a6170;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-size: .68rem;
  font-weight: 700;
}
@media (max-width: 800px) {
  .invoice-ticket-grid { grid-template-columns: 1fr; }
}
/* ---------- branded customer invoice ---------- */
.invoice-doc {
  background: #fff;
  color: #0a0a0c;
  border: 1px solid var(--line);
  padding: 1.35rem 1.4rem 1.6rem;
  margin-bottom: 1.25rem;
}
.invoice-meta {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  align-items: flex-start;
  margin: 0 0 1.35rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #d8dde6;
}
.invoice-kicker {
  margin: 0 0 .2rem;
  font-size: .72rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #5a6170;
  font-family: var(--font-display);
  font-weight: 700;
}
.invoice-title-block h2 {
  margin: 0 0 .35rem;
  font-size: 1.75rem;
  letter-spacing: .06em;
  font-style: italic;
}
.invoice-title-block p { margin: .15rem 0; }
.invoice-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .55rem 1.25rem;
  min-width: min(18rem, 100%);
}
.invoice-meta-grid span {
  display: block;
  font-size: .68rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #5a6170;
  font-family: var(--font-display);
  font-weight: 700;
  margin-bottom: .1rem;
}
.invoice-meta-grid strong { font-size: .95rem; }
.invoice-meta-grid small { display: block; font-size: .72rem; margin-top: .1rem; }
.invoice-billto { margin-top: .75rem; font-size: .88rem; line-height: 1.35; }
.invoice-billto span {
  display: block;
  font-size: .68rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #5a6170;
  font-family: var(--font-display);
  font-weight: 700;
  margin-bottom: .1rem;
}
.invoice-billto strong { font-size: 1rem; }
.invoice-dest {
  margin: 0 0 1.25rem;
  padding: 0 0 1rem;
  border-bottom: 1px dashed #c5cad3;
}
.invoice-dest:last-of-type { border-bottom: 0; }
.invoice-dest-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
  margin-bottom: .65rem;
}
.invoice-dest-head h3 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: .04em;
}
.invoice-dest-head span { font-size: .86rem; color: #5a6170; }
.invoice-table { font-size: .9rem; }
.invoice-table th {
  font-size: .72rem;
  letter-spacing: .04em;
  white-space: nowrap;
}
.invoice-totals {
  margin-top: .5rem;
  padding-top: 1rem;
  border-top: 2px solid #0a0a0c;
}
.invoice-totals-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .75rem 1rem;
  margin-bottom: 1rem;
}
.invoice-totals-grid span {
  display: block;
  font-size: .68rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #5a6170;
  font-family: var(--font-display);
  font-weight: 700;
  margin-bottom: .2rem;
}
.invoice-totals-grid strong { font-size: 1.05rem; }
.invoice-due {
  text-align: right;
  padding: .55rem .75rem;
  background: #f3f4f7;
  border: 1px solid #c5cad3;
}
.invoice-due strong {
  font-size: 1.45rem;
  font-family: var(--font-display);
  letter-spacing: .02em;
}
.invoice-thanks { margin: 0 0 .35rem; font-size: .9rem; }
.invoice-foot { margin: 0; font-size: .82rem; }
.invoice-print-host {
  position: absolute;
  left: -9999px;
  top: 0;
  width: 8.5in;
  pointer-events: none;
}
@media (max-width: 720px) {
  .invoice-meta { flex-direction: column; }
  .invoice-meta-grid { grid-template-columns: 1fr 1fr; width: 100%; }
  .invoice-totals-grid { grid-template-columns: 1fr 1fr; }
  .invoice-due { text-align: left; grid-column: 1 / -1; }
}
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.ghost { background: transparent; }
.btn.on-dark { color: var(--chrome-bright); border-color: rgb(197 202 211 / 45%); }
.btn.on-dark:hover { background: rgb(255 255 255 / 8%); border-color: var(--chrome); }
.btn.sm { min-height: 30px; padding: .25rem .65rem; font-size: .74rem; }
.btn.link { border: 0; background: none; color: var(--carolina-deep); padding: .2rem .35rem; min-height: 0; text-transform: none; letter-spacing: .01em; font-family: var(--font); font-weight: 600; font-size: .9rem; }
.btn.link:hover { color: var(--ink); background: none; }
.btn.block { width: 100%; min-height: 48px; font-size: .9rem; margin-top: 1rem; }

/* ---------- badges ---------- */
.badge { display: inline-block; padding: .12rem .45rem; border-radius: 0; font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; background: #dfe2e8; color: #3f4652; border: 1px solid rgb(5 5 6 / 6%); }
.badge.green { background: #dcfce7; color: var(--green); }
.badge.amber { background: #ffedd5; color: var(--amber-text); }
.badge.red { background: #fee2e2; color: #b91c1c; }
.badge.blue { background: var(--carolina-soft); color: #0077a8; border-color: rgb(0 194 255 / 30%); }

/* ---------- cards & layout ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line); padding: 1.1rem 1.15rem; margin-bottom: 1rem; }
.card > h2 { margin-bottom: .8rem; }
.card.flush { padding: 0; overflow: hidden; }
.card.empty { color: var(--muted); text-align: center; padding: 2rem; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: .8rem; }
.card-head p { margin: .2rem 0 0; }
.alert-card { border-left: 5px solid var(--red); }
.alert-soft { border-top: 3px solid #fca5a5; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 0 1rem; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 0 1rem; }
.page-head { margin-bottom: 1.1rem; }
.page-head p { margin: .3rem 0 0; color: var(--muted); }
.page-head .actions { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: flex-end; }
.kv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .75rem 1.2rem; }
.kv-grid.one { grid-template-columns: 1fr; gap: .55rem; }
.kv { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.kv > span { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.kv strong { font-weight: 600; overflow-wrap: anywhere; }
.kv-grid.one .kv { flex-direction: row; justify-content: space-between; gap: 1rem; border-bottom: 1px dashed var(--line); padding-bottom: .4rem; }
.kv-grid.one .kv strong { text-align: right; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: .65rem 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.clickable { cursor: pointer; }
.clickable:hover { background: var(--carolina-soft); }
details.more { margin-top: 1rem; border-top: 1px solid var(--line); padding-top: .6rem; }
details.more summary { cursor: pointer; font-weight: 600; padding: .3rem 0; }
.banner { padding: .85rem 1rem; border-radius: 0; margin-bottom: 1rem; border: 1px solid transparent; }
.banner.warn { background: #fef3c7; color: #78350f; }
.banner.bad { background: #fee2e2; color: #7f1d1d; border: 1px solid #fca5a5; }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .8rem; margin-bottom: 1rem; }
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* Section heading above a table (e.g. Company trucks vs Contract carriers) */
.carrier-section { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .25rem 1rem; margin: 1.5rem 0 .5rem; padding-bottom: .35rem; border-bottom: 2px solid var(--carolina); }
.carrier-section h2 { margin: 0; font-size: 1.15rem; font-family: var(--font-display); letter-spacing: .02em; }
.carrier-section small { color: var(--muted); }
/* Three summary cards (e.g. carrier payouts): fill the row instead of sitting in six narrow slots */
.kpis.kpis-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 640px) {
  .kpis.kpis-3 { grid-template-columns: 1fr; }
}
.kpi { background: #fff; border-radius: 0; box-shadow: none; border: 1px solid var(--line); padding: .85rem 1rem; display: flex; flex-direction: column; gap: .15rem; border-top: 2px solid var(--carolina); }
.kpi span { font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; font-weight: 700; font-family: var(--font-display); }
.kpi strong { font-size: 1.55rem; font-family: var(--font-display); letter-spacing: .01em; font-weight: 800; }
.kpi small { color: var(--muted); }
.kpi.warn { border-top-color: var(--amber); }
.kpi.bad { border-top-color: var(--red); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: var(--bg-elevated); padding: .6rem .75rem; border-bottom: 1px solid var(--line); white-space: nowrap; font-weight: 600; }
.table td { padding: .6rem .75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table.compact td, .table.compact th { padding: .45rem .55rem; }
.table .num { text-align: right; white-space: nowrap; }
/* Cancelled loads: grey-rose fill plus a red edge so they stand out at first look */
.table tr.row-cancelled td { background: #f1dede; color: #6b4a4a; }
.table tr.row-overdue td { background: #fdeaea; }
.table tr.row-overdue td:first-child { box-shadow: inset 5px 0 0 #c4262e; }
.table tr.row-done td { background: #f4f8f5; color: #4d5a52; }
.table tr.row-done td:first-child { box-shadow: inset 4px 0 0 #2f8f5b; }
.table tr.row-cancelled td:first-child { box-shadow: inset 4px 0 0 #b03a3a; }
.table tr:last-child td { border-bottom: 0; }
.total-row td { font-weight: 700; background: var(--bg-elevated); }
.row-warn td { background: #fff7ed; }
.empty-cell { text-align: center; color: var(--muted); padding: 1.5rem !important; }

/* ---------- filters & tabs ---------- */
.filters { display: flex; gap: .6rem; align-items: center; margin-bottom: .9rem; flex-wrap: wrap; }
.filters input, .filters select { min-height: 38px; padding: .4rem .6rem; border: 1px solid var(--line); border-radius: 0; font: inherit; background: #fff; }
.filters input[type='search'] { min-width: 240px; flex: 1 1 240px; max-width: 380px; }
.filters label.inline { display: inline-flex; align-items: center; gap: .35rem; font-size: .85rem; color: var(--muted); }
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; overflow-x: auto; }
.tabs a { padding: .6rem .9rem; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; text-decoration: none; }
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--ink); border-bottom-color: var(--carolina); }

/* ---------- forms ---------- */
.form .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .85rem 1rem; }
.field { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.field[hidden] { display: none; }
.field.full, .form .full { grid-column: 1 / -1; }
.field > label { font-weight: 600; font-size: .88rem; }
.field small { color: var(--muted); }
.req { color: var(--red); }
.field input:not([type='checkbox']):not([type='file']), .field select, .field textarea {
  width: 100%; min-height: 44px; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 0; font: inherit; font-size: 16px; background: #fff; color: var(--text);
}
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 1px solid var(--carolina); outline-offset: 0; border-color: var(--carolina); box-shadow: 0 0 0 3px rgb(0 194 255 / 22%); }
.field input:user-invalid { border-color: var(--red); }
.field.check label { display: flex; align-items: flex-start; gap: .6rem; font-weight: 500; cursor: pointer; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 0; background: var(--bg-elevated); }
.field.check input { width: 20px; height: 20px; margin: 1px 0 0; flex: none; accent-color: var(--carolina); }
.form-section { font-size: .9rem; margin: .6rem 0 -.2rem; padding-top: .8rem; border-top: 1px solid var(--line); color: var(--ink); font-family: var(--font-display); letter-spacing: .06em; }
.form-section:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.form-section small { font-weight: 500; color: var(--muted); font-family: var(--font); letter-spacing: .01em; text-transform: none; }
.rate-grid { display: flex; flex-direction: column; gap: .45rem; margin-bottom: .65rem; }
.rate-row { display: grid; grid-template-columns: minmax(0, 1fr) 7.5rem auto; gap: .45rem; align-items: center; }
.rate-row.billing-rate-row { grid-template-columns: minmax(0, 1.2fr) 5.5rem 7.5rem 7.5rem auto; }
.rate-row.billing-rate-head {
  padding: 0 .05rem;
  min-height: 0;
  pointer-events: none;
}
.rate-row.billing-rate-head span { font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.rate-row input[type="text"],
.rate-row input[type="number"],
.rate-row select { width: 100%; min-width: 0; }
.rate-row input[data-billing-abbrev] {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: .04em;
  text-align: center;
}
@media (max-width: 720px) {
  .rate-row { grid-template-columns: 1fr 6.5rem; }
  .rate-row.billing-rate-row { grid-template-columns: 1fr 5rem 1fr; }
  .rate-row.billing-rate-head { display: none; }
  .rate-row.billing-rate-row > [data-billing-rate] { grid-column: 1 / -1; }
  .rate-row > :last-child { grid-column: 1 / -1; justify-self: start; }
}
.file-drop { display: flex !important; align-items: center; justify-content: center; gap: .6rem; min-height: 64px; border: 1px dashed #8e97a6; border-radius: 0; background: var(--bg-elevated); cursor: pointer; color: var(--ink); font-weight: 700; font-family: var(--font-display); letter-spacing: .06em; text-transform: uppercase; font-size: .82rem; padding: .6rem; text-align: center; position: relative; }
.file-drop:hover { border-color: var(--carolina); border-style: solid; background: var(--carolina-soft); }
.file-drop .ic { width: 26px; height: 26px; }
.file-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.file-list { font-size: .85rem; color: var(--green); font-weight: 600; }
.miles-preview { padding: .6rem .8rem; background: var(--carolina-soft); border-radius: 0; border: 1px solid rgb(0 194 255 / 35%); font-weight: 700; color: var(--carolina-deep); }
.miles-preview.bad { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }
fieldset.party { border: 1px solid var(--line); border-radius: 0; padding: .8rem 1rem 1rem; margin: 0 0 .8rem; background: #fcfcfd; }
fieldset.party legend { font-weight: 800; padding: 0 .4rem; display: flex; align-items: center; gap: .5rem; font-family: var(--font-display); letter-spacing: .05em; text-transform: uppercase; }
fieldset.party .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .7rem 1rem; }
.party-card { border: 1px solid var(--line); border-radius: 0; padding: .8rem 1rem; margin-bottom: .8rem; }

/* ---------- attachments ---------- */
.thumbs { display: flex; flex-wrap: wrap; gap: .4rem; }
.thumb { width: 52px; height: 52px; padding: 0; border: 1px solid var(--line); border-radius: 0; overflow: hidden; background: #eceef2; cursor: zoom-in; display: grid; place-items: center; }
.card > .thumbs .thumb, .policy .thumb { width: 96px; height: 96px; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-doc { font-size: .72rem; font-weight: 700; color: var(--muted); }
.viewer { text-align: center; background: #050506; border-radius: 0; }
.viewer img { max-width: 100%; max-height: 70vh; display: block; margin: 0 auto; }

/* ---------- modal & toast ---------- */
.modal { border: 1px solid var(--chrome); border-radius: 0; padding: 0; width: min(640px, calc(100vw - 1.5rem)); max-height: calc(100vh - 2rem); box-shadow: 0 24px 64px rgb(0 0 0 / 45%); }
.modal.wide { width: min(960px, calc(100vw - 1.5rem)); }
.modal::backdrop { background: rgb(5 5 6 / 72%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: .85rem 1.15rem; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: linear-gradient(180deg, #fff, #f3f4f7); z-index: 1; }
.modal-body { padding: 1.1rem 1.15rem 1.3rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1.1rem; }
#toast { position: fixed; left: 50%; bottom: 90px; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: .7rem 1.1rem; border-radius: 0; font-weight: 700; font-family: var(--font-display); letter-spacing: .05em; text-transform: uppercase; font-size: .85rem; opacity: 0; pointer-events: none; transition: .25s; z-index: 1000; max-width: calc(100vw - 2rem); box-shadow: 0 12px 32px rgb(0 0 0 / 35%); border-top: 2px solid var(--carolina); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.error { background: var(--red); border-top-color: #fff; }

/* ---------- login ---------- */
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.2rem;
  background:
    radial-gradient(ellipse 70% 50% at 50% 0%, rgb(0 194 255 / 28%), transparent 58%),
    radial-gradient(ellipse 50% 40% at 50% 100%, rgb(13 78 168 / 22%), transparent 55%),
    linear-gradient(180deg, #0a0a0c 0%, #000 55%, #000 100%);
}
.login-card {
  position: relative;
  background: #0a0a0c;
  border-radius: 0;
  padding: 1.5rem 1.5rem 1.6rem;
  width: min(440px, 100%);
  box-shadow: 0 30px 80px rgb(0 0 0 / 65%), 0 0 48px rgb(0 194 255 / 16%);
  border: 1px solid #2a2a30;
  color: #e8eaee;
}
.login-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--chrome-grad);
}
.login-card::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--carolina), transparent);
}
.login-brand { text-align: center; margin-bottom: 1.2rem; }
.login-brand .logo {
  height: auto;
  width: min(100%, 280px);
  max-width: 100%;
  margin: 0 auto;
  background: transparent;
  border: 0;
  box-shadow: none;
  filter: drop-shadow(0 0 18px rgb(0 194 255 / 28%));
}
.login-company {
  color: var(--chrome);
  margin: .75rem 0 0;
  font-size: .78rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  font-family: var(--font-display);
  font-weight: 700;
  font-style: italic;
}
.login .form { display: flex; flex-direction: column; gap: .9rem; }
.login .field > label { color: #d7dce5; }
.login .field small { color: #9aa3b2; }
.login .field input:not([type='checkbox']):not([type='file']),
.login .field select,
.login .field textarea {
  background: #1a1b20;
  border-color: #3a3d48;
  color: #f4f6f9;
  color-scheme: dark;
}
.login .field input::placeholder,
.login .field textarea::placeholder {
  color: #9aa3b2;
  opacity: 1;
}
.login .field input:focus, .login .field select:focus, .login .field textarea:focus {
  border-color: var(--carolina);
  box-shadow: 0 0 0 3px rgb(0 194 255 / 28%);
}
/* Locked (read-only) values such as our internal load # on the carrier portal */
.field input.locked[readonly], .login .field input.locked[readonly] {
  background: #0d0e11;
  border-style: dashed;
  border-color: #3a3d48;
  color: #00c2ff;
  font-weight: 700;
  cursor: not-allowed;
  user-select: all;
  box-shadow: none;
}
.field input.locked[readonly]:focus, .login .field input.locked[readonly]:focus { border-color: #3a3d48; box-shadow: none; outline: none; }
/* Browser autofill often forces a pale box — keep text readable on dark login/portal */
.login .field input:-webkit-autofill,
.login .field input:-webkit-autofill:hover,
.login .field input:-webkit-autofill:focus,
.login .field textarea:-webkit-autofill {
  -webkit-text-fill-color: #f4f6f9;
  caret-color: #f4f6f9;
  box-shadow: 0 0 0 1000px #1a1b20 inset;
  transition: background-color 99999s ease-out;
}
.login .hint { color: #9aa3b2; }
.login-error { color: #ff8a8a !important; margin-top: .75rem; text-transform: none; letter-spacing: 0; font-weight: 600; }
.login .btn.primary {
  background: linear-gradient(180deg, #33d0ff 0%, var(--carolina) 40%, var(--carolina-deep) 100%);
  border-color: var(--carolina);
  color: #000;
  text-shadow: none;
  box-shadow: 0 0 24px rgb(0 194 255 / 40%);
}
.login .btn.primary:hover { background: linear-gradient(180deg, #66dcff 0%, #1ac8ff 50%, var(--carolina) 100%); border-color: #9ae8ff; }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: #111114; border-radius: 0; padding: 3px; margin-bottom: 1.2rem; border: 1px solid #2a2a30; }
.seg button { border: 0; background: none; padding: .65rem; border-radius: 0; font: inherit; font-family: var(--font-display); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; font-size: .8rem; color: #8b929e; cursor: pointer; font-style: italic; }
.seg button.active { background: linear-gradient(180deg, #1a1a1e, #000); color: #fff; box-shadow: inset 0 -2px 0 var(--carolina); }
.hint { text-align: center; font-size: .8rem; color: var(--muted); margin: 1rem 0 0; }
.login-card.wide { max-width: 560px; background: #0a0a0c; }
.portal .login-card { color: #e8eaee; }
.portal .muted, .portal .hint { color: #9aa3b2; }
.portal .portal-summary { background: #15161a; border: 1px solid #3a3d48; color: #e8eaee; }
.portal .kv span { color: #9aa3b2; }
.portal .kv strong { color: #fff; }
.portal .notes,
.portal .portal-notes {
  background: #1a1b20 !important;
  border: 1px solid #3a3d48;
  border-left: 3px solid var(--carolina);
  color: #f4f6f9 !important;
  padding: .65rem .75rem;
  margin: .75rem 0 0;
  white-space: pre-wrap;
  font-size: .9rem;
  line-height: 1.4;
}
.portal .file-drop {
  background: #1a1b20;
  border-color: #4a4e5c;
  color: #f4f6f9;
}
.portal .file-drop:hover {
  background: #22242c;
  border-color: var(--carolina);
  color: #fff;
}
.portal .file-list { color: #d7dce5; }
.portal .req { color: #ffb4b4; }

/* ---------- shells ---------- */
.topbar, .sidebar .brand { display: flex; align-items: center; gap: .65rem; }
.brand { flex-direction: column; align-items: flex-start; gap: .25rem; }
.brand-co {
  font-weight: 700;
  letter-spacing: .1em;
  font-family: var(--font-display);
  text-transform: uppercase;
  font-size: .65rem;
  color: var(--chrome);
  font-style: italic;
}
.shell.driver .topbar {
  position: sticky; top: 0; z-index: 10;
  background: #000;
  color: #fff;
  padding: .4rem .85rem;
  padding-top: max(.4rem, env(safe-area-inset-top));
  justify-content: space-between;
  border-bottom: 2px solid transparent;
  border-image: linear-gradient(90deg, var(--chrome), var(--carolina), var(--chrome)) 1;
}
.shell.driver .topbar .brand { flex-direction: row; }
.shell.driver .topbar .logo { height: 52px; max-width: 120px; background: transparent; border-color: transparent; }
.topbar .brand { display: flex; align-items: center; gap: .65rem; }
.topbar-right { display: flex; align-items: center; gap: .6rem; }
.who { font-size: .85rem; color: var(--chrome); font-family: var(--font-display); letter-spacing: .06em; text-transform: uppercase; font-weight: 600; }
.shell.driver .main { max-width: 860px; margin: 0 auto; padding: 1.1rem 1rem calc(90px + env(safe-area-inset-bottom)); }
.tabbar { position: fixed; bottom: 0; left: 0; right: 0; display: grid; grid-template-columns: repeat(6, 1fr); background: #fff; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 10; box-shadow: 0 -6px 20px rgb(0 0 0 / 8%); }
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: .15rem; padding: .55rem 0 .4rem; font-size: .62rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; font-family: var(--font-display); color: var(--muted); text-decoration: none; }
.tabbar a .ic { width: 22px; height: 22px; }
.tabbar a.active { color: var(--ink); box-shadow: inset 0 2px 0 var(--carolina); }
.tabbar a.danger { color: var(--red); }
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: .55rem; margin-bottom: 1rem; }
.quick.five { grid-template-columns: repeat(5, 1fr); }
.quick-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4rem;
  background: linear-gradient(180deg, #1c1c20, #050506);
  color: #fff; border-radius: 0; padding: 1rem .45rem; font-weight: 800; text-align: center; min-height: 92px;
  text-decoration: none !important; border: 1px solid #2a2a30;
  font-family: var(--font-display); letter-spacing: .06em; text-transform: uppercase; font-size: .78rem;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 10%);
}
.quick-btn .ic { width: 28px; height: 28px; color: var(--carolina); filter: drop-shadow(0 0 6px rgb(0 194 255 / 55%)); }
.quick-btn.danger { background: linear-gradient(180deg, #e11d1d, #9f1212); border-color: #7f1010; }
.quick-btn.danger .ic { color: #fff; }
.call-row { display: flex; gap: .6rem; margin-top: 1rem; flex-wrap: wrap; }
.checklist { margin: 0; padding-left: 1.3rem; display: grid; gap: .5rem; }

.portal-summary { margin: 0 0 1rem; padding: 1rem; }
.portal .file-drop { min-height: 88px; }

.insp-item { border: 1px solid var(--line); border-radius: 0; padding: .65rem .75rem; background: #fff; }
.insp-item + .insp-item { margin-top: .4rem; }
.insp-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .55rem; }
.insp-label { font-weight: 700; color: var(--ink); flex: 1 1 140px; font-family: var(--font-display); letter-spacing: .03em; }
.insp-results { display: flex; gap: .3rem; flex-wrap: wrap; }
.insp-opt { display: inline-flex; align-items: center; gap: .3rem; padding: .3rem .5rem; border: 1px solid var(--line); border-radius: 0; font-size: .78rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; cursor: pointer; background: var(--bg-elevated); font-family: var(--font-display); }
.insp-opt input { accent-color: var(--carolina); }
.insp-opt.pass:has(input:checked) { background: #ecfdf5; border-color: #6ee7b7; color: #047857; }
.insp-opt.fail:has(input:checked) { background: #fef2f2; border-color: #fca5a5; color: #b91c1c; }
.insp-opt.na:has(input:checked) { background: #f1f5f9; border-color: #cbd5e1; color: #475569; }
.insp-fail { margin-top: .65rem; display: grid; gap: .55rem; padding-top: .55rem; border-top: 1px dashed var(--line); }
.insp-fail .field { margin: 0; }
.file-drop.sm { padding: .7rem; font-size: .85rem; }
.file-drop.sm .ic { width: 22px; height: 22px; }
tr.fail-row td { background: #fff7f7; }

.shell.office { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
.sidebar {
  background:
    radial-gradient(ellipse 120% 42% at 50% 0%, rgb(0 194 255 / 18%), transparent 55%),
    radial-gradient(ellipse 80% 30% at 50% 100%, rgb(13 78 168 / 14%), transparent 50%),
    linear-gradient(195deg, #0e0e10 0%, #000 65%);
  color: #d7dae0;
  padding: .85rem .65rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  position: sticky;
  top: 0;
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
  border-right: 1px solid #1c1c20;
}
.sidebar .brand {
  flex: none;
  padding: .15rem .25rem .65rem;
  border-bottom: 1px solid #1c1c20;
  color: #fff;
  width: 100%;
  align-items: center;
  min-width: 0;
}
.sidebar-tag {
  flex: none;
  margin: -.35rem 0 .35rem;
  padding: 0 .25rem;
  font-size: .72rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #7a828e;
}
.shell.platform .sidebar { border-right-color: #123040; }
.shell.platform .sidebar .brand-co { color: #9ae8ff; }
.toast-inline.bad { color: #ff8e8e; margin: 0 0 1rem; }
/* Cap tall logo photos so nav items stay reachable. */
.sidebar .brand .logo {
  height: auto;
  width: auto;
  max-width: 190px;
  max-height: 72px;
  object-fit: contain;
  object-position: center;
  background: transparent;
  border: 0;
  box-shadow: none;
  filter: drop-shadow(0 0 14px var(--carolina-glow));
}
.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #3a3a42 transparent;
}
.sidebar nav a {
  display: flex; align-items: center; gap: .65rem; padding: .6rem .7rem; border-radius: 0;
  color: #9aa1ac; font-weight: 700; text-decoration: none;
  font-family: var(--font-display); letter-spacing: .06em; text-transform: uppercase; font-size: .78rem;
  flex: none;
}
.sidebar nav a:hover { background: rgb(255 255 255 / 6%); color: #fff; }
.sidebar nav a.active { background: rgb(0 194 255 / 14%); color: #fff; box-shadow: inset 2px 0 0 var(--carolina); }
.sidebar .count { margin-left: auto; background: var(--red); color: #fff; font-size: .68rem; padding: .05rem .4rem; border-radius: 0; font-family: var(--font-display); }
.sidebar-foot {
  flex: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .55rem .35rem 0;
  border-top: 1px solid #2a2a30;
  font-size: .8rem;
  letter-spacing: .05em;
  text-transform: uppercase;
  font-family: var(--font-display);
  font-weight: 600;
}
.shell.office .main { padding: 1.4rem 1.7rem 3rem; min-width: 0; }
.print-only { display: none; }

@media (max-width: 900px) {
  .shell.office { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    height: auto;
    max-height: none;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    padding: .45rem .5rem;
    gap: .35rem;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
  }
  .sidebar .brand {
    border: 0;
    padding: 0 .25rem;
    flex: none;
    width: auto;
  }
  .sidebar .brand-co { display: none; }
  .sidebar .brand .logo {
    height: 40px;
    width: auto;
    max-width: 88px;
    max-height: 40px;
  }
  .sidebar nav {
    flex: 1 1 auto;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: .1rem;
    min-width: 0;
    min-height: 0;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
  }
  .sidebar nav a {
    padding: .5rem .55rem;
    white-space: nowrap;
    font-size: .8rem;
    flex: none;
  }
  .sidebar nav a .ic { display: none; }
  .sidebar-foot {
    border: 0;
    padding: 0;
    flex: none;
    margin-left: auto;
  }
  .sidebar-foot span { display: none; }
  .sidebar-foot .btn { white-space: nowrap; }
  .shell.office .main { padding: 1rem; }
  .page-head.row-between { flex-direction: column; align-items: flex-start; }
  .page-head .actions { justify-content: flex-start; }
}
@media (max-width: 560px) {
  h1 { font-size: 1.35rem; }
  .quick, .quick.five { grid-template-columns: repeat(2, 1fr); }
  .who { display: none; }
  .card { padding: 1rem; }
  .filters input[type='search'] { min-width: 0; max-width: none; }
  .modal { width: 100vw; max-width: 100vw; max-height: 100vh; height: 100vh; border-radius: 0; margin: 0; border: 0; }
}

/* ---------- office wall display (TV) ---------- */
.wall { min-height: 100vh; background: #050506; color: #e8eaee; display: flex; flex-direction: column; font-size: clamp(14px, 1vw, 20px); font-family: var(--font); }
.wall-head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .55rem 1.4rem;
  background: #000;
  border-bottom: 2px solid transparent;
  border-image: linear-gradient(90deg, var(--chrome), var(--carolina), var(--chrome)) 1;
}
.wall-head .brand { display: flex; align-items: center; gap: .7rem; flex-direction: row; }
.wall-head .logo { height: 64px; max-width: 140px; background: transparent; border-color: transparent; }
.wall-clock { font-size: 1.15em; font-weight: 800; color: #fff; font-family: var(--font-display); letter-spacing: .06em; }
.live-dot { display: inline-flex; align-items: center; gap: .4rem; font-weight: 800; color: #86efac; font-family: var(--font-display); letter-spacing: .08em; text-transform: uppercase; }
.live-dot::before { content: ''; width: .55em; height: .55em; border-radius: 0; background: #22c55e; box-shadow: 0 0 0 0 rgb(34 197 94 / 60%); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 .5em rgb(34 197 94 / 0%); } 100% { box-shadow: 0 0 0 0 rgb(34 197 94 / 0%); } }
.wall-main { flex: 1; padding: 1rem 1.4rem 1.1rem; display: flex; flex-direction: column; gap: .95rem; }
.wall-loads { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2.3fr); gap: .9rem; align-items: stretch; }
.wall-load-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; align-content: start; }
.wall-load-tiles .wall-tile.wide { grid-column: 1 / -1; }
.wall-load-tiles .wall-tile.wide strong { font-size: 2.3em; }
.wall-card.wall-mills { display: flex; flex-direction: column; }
.wall-card.wall-mills h2 { justify-content: space-between; }
.wall-card.wall-mills h2 small { color: #c4cad4; font-size: .78em; font-weight: 400; letter-spacing: .02em; text-transform: none; }
.wall-mills .wall-table td.mill { font-weight: 700; color: #fff; }
/* The global .total-row style is light (for paper pages); the wall needs its own dark total row. */
.wall .wall-table tr.total-row td { background: #17171d; border-top: 1px solid #3a3a42; border-bottom: 0; font-weight: 800; color: #fff; }
.wall-mills .wall-table td.zero { color: #6b7280; }
.wall-tiles { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .7rem; }
.wall-tile { background: #0e0e10; border-radius: 0; padding: .85em .9em; display: flex; flex-direction: column; gap: .15em; border: 1px solid #1c1c20; border-left: 3px solid var(--carolina); box-shadow: inset 0 0 24px rgb(0 194 255 / 6%); min-width: 0; }
.wall-tile span { text-transform: uppercase; letter-spacing: .08em; font-size: .62em; color: #9aa1ac; font-family: var(--font-display); font-weight: 700; }
.wall-tile strong { font-size: 1.7em; line-height: 1.05; color: #fff; font-family: var(--font-display); font-weight: 800; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.wall-tile small { color: #9aa1ac; font-size: .74em; line-height: 1.25; }
.wall-tile.ok { border-left-color: #22c55e; }
.wall-tile.warn { border-left-color: var(--amber); }
.wall-tile.bad { border-left-color: #ef4444; }
.wall-tile.bad strong { color: #fca5a5; }
/* Fleet on the left; side panels stack evenly on the right — no orphan full-width row */
.wall-grid {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  grid-template-rows: auto auto;
  gap: .9rem;
  align-items: stretch;
  flex: 1;
}
.wall-grid .wall-fleet { grid-column: 1; grid-row: 1 / -1; display: flex; flex-direction: column; }
.wall-grid.has-accidents { grid-template-rows: auto auto auto; }
.wall-card { background: #121214; border-radius: 0; padding: .9em 1.05em; min-width: 0; border: 1px solid #2a2a30; }
.wall-card.alert { border: 2px solid #ef4444; }
/* Colour-coded wall sections: a tinted header band + coloured top rule, so each block reads as its own section. */
.wall-card.tone { --tone: #00c2ff; --tone-bg: rgb(0 194 255 / 26%); border-top: 4px solid var(--tone); }
.wall-card.tone > h2 {
  background: linear-gradient(90deg, var(--tone-bg), rgb(0 0 0 / 0%) 85%);
  margin: -.9em -1.05em .7em;
  padding: .5em 1.05em;
  border-bottom: 1px solid var(--tone);
  color: #fff;
  font-size: 1em;
  text-transform: uppercase;
}
.wall-card.tone > h2 small { text-transform: none; }
.wall-card.tone-loads { --tone: #22d3ee; --tone-bg: rgb(34 211 238 / 24%); }
.wall-card.tone-today { --tone: #a78bfa; --tone-bg: rgb(167 139 250 / 26%); }
.wall-card.tone-fleet { --tone: #3b82f6; --tone-bg: rgb(59 130 246 / 30%); }
.wall-card.tone-attention { --tone: #f59e0b; --tone-bg: rgb(245 158 11 / 28%); }
.wall-card.tone-latest { --tone: #22c55e; --tone-bg: rgb(34 197 94 / 26%); }
.wall-card.tone-accident { --tone: #ef4444; --tone-bg: rgb(239 68 68 / 34%); }
.wall-card h2 { font-size: .95em; color: #fff; margin-bottom: .5em; font-family: var(--font-display); letter-spacing: .08em; display: flex; align-items: center; gap: .4em; }
.wall-table { width: 100%; border-collapse: collapse; }
.wall-table th { text-align: left; font-size: .68em; text-transform: uppercase; letter-spacing: .1em; color: #9aa1ac; padding: .35em .5em; border-bottom: 1px solid #2a2a30; font-family: var(--font-display); }
.wall-table td { padding: .45em .5em; border-bottom: 1px solid #1c1c20; }
.wall-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.wall-list { list-style: none; margin: 0; padding: 0; }
.wall-list li { display: flex; justify-content: space-between; align-items: center; gap: 1em; padding: .45em 0; border-bottom: 1px solid #1c1c20; }
.wall-list li:last-child { border-bottom: 0; }
.wall-list small { display: block; color: #9aa1ac; font-size: .82em; }
.wall-list .when { color: var(--chrome); white-space: nowrap; font-size: .85em; }
.wall .badge { font-size: .72em; }
.wall .muted { color: #9aa1ac; }
.wall-foot { padding: .35rem 1.4rem .7rem; color: #6b7280; font-size: .72em; text-align: right; letter-spacing: .08em; text-transform: uppercase; font-family: var(--font-display); }
@media (max-width: 1400px) {
  /* 12-col grid: 4 tiles on top (3 cols each), 3 tiles on bottom (4 cols each) */
  .wall-tiles { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .wall-tiles > * { grid-column: span 3; }
  .wall-tiles > :nth-child(n + 5) { grid-column: span 4; }
}
@media (max-width: 1100px) {
  .wall-loads { grid-template-columns: 1fr; }
  .wall-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wall-tiles > * { grid-column: auto; }
  .wall-grid, .wall-grid.has-accidents { grid-template-columns: 1fr; grid-template-rows: none; }
  .wall-grid .wall-fleet { grid-column: auto; grid-row: auto; }
}
@media (max-width: 900px) { .wall-clock { display: none; } }

/* ---------- formal carrier payout packets ---------- */
.payout-controls { margin-bottom: 1rem; padding-bottom: .75rem; border-bottom: 1px solid var(--line); }
.payout-doc {
  background: #fff;
  color: #0a0a0c;
  border: 1px solid var(--line);
  padding: 1.25rem 1.35rem 1.5rem;
}
.payout-letterhead {
  display: flex;
  gap: 1.1rem;
  align-items: center;
  padding-bottom: .9rem;
  margin-bottom: 1rem;
  border-bottom: 2px solid #0a0a0c;
}
.payout-logo .logo {
  height: 64px;
  max-width: 160px;
  width: auto;
  object-fit: contain;
  filter: none;
}
.payout-co h1 {
  margin: 0 0 .25rem;
  font-size: 1.35rem;
  font-style: italic;
  letter-spacing: .04em;
}
.payout-co p { margin: 0.1rem 0; font-size: .88rem; color: #3f4652; }
.payout-doc-title { margin-bottom: 1.15rem; }
.payout-doc-title h2 {
  margin: 0 0 .35rem;
  font-size: 1.05rem;
  letter-spacing: .08em;
}
.payout-doc-title p { margin: .15rem 0; font-size: .9rem; }
.payout-carrier {
  border: 1px solid #c5cad3;
  padding: 1rem 1.05rem 1.15rem;
  margin: 0 0 1.25rem;
  break-inside: avoid;
  page-break-inside: avoid;
}
.payout-carrier-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: .75rem;
  padding-bottom: .65rem;
  border-bottom: 1px solid #d8dde6;
}
.payout-carrier-head h2 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: .05em;
}
.payout-carrier-due {
  text-align: right;
  min-width: 8rem;
}
.payout-carrier-due span {
  display: block;
  font-size: .72rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #5a6170;
  font-family: var(--font-display);
  font-weight: 700;
}
.payout-carrier-due strong {
  font-size: 1.35rem;
  font-family: var(--font-display);
  letter-spacing: .02em;
}
.payout-table { font-size: .9rem; }
.payout-verify {
  margin-top: 1rem;
  padding-top: .75rem;
  border-top: 1px dashed #b8bfc9;
}
.payout-verify > p { margin: 0 0 .75rem; font-size: .86rem; color: #3f4652; }
.payout-sign-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .85rem 1.25rem;
}
.payout-sign span {
  display: block;
  font-size: .72rem;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: #5a6170;
  margin-bottom: .35rem;
  font-family: var(--font-display);
  font-weight: 700;
}
.payout-line {
  min-height: 2rem;
  border-bottom: 1px solid #0a0a0c;
}
.payout-line-amt {
  font-weight: 700;
  font-size: 1.05rem;
  display: flex;
  align-items: flex-end;
  padding-bottom: .15rem;
}
.payout-doc-foot {
  margin-top: .5rem;
  padding-top: .75rem;
  border-top: 2px solid #0a0a0c;
  font-size: .88rem;
}
.payout-doc-foot p { margin: .2rem 0; }
@media (max-width: 560px) {
  .payout-letterhead { flex-direction: column; align-items: flex-start; }
  .payout-carrier-head { flex-direction: column; }
  .payout-carrier-due { text-align: left; }
  .payout-sign-grid { grid-template-columns: 1fr; }
}

/* Off-screen clone used so packets print outside the modal dialog */
.payout-print-host {
  position: absolute;
  left: -9999px;
  top: 0;
  width: 8.5in;
  pointer-events: none;
}

@page { size: letter portrait; margin: .5in; }
@media print {
  .sidebar, .topbar, .tabbar, .no-print, .page-head .actions, #toast, .btn { display: none !important; }
  .shell.office { display: block; }
  .shell.office .main { padding: 0; }
  body { background: #fff; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  .print-only { display: block; }
  .thumb { width: 160px !important; height: 160px !important; }
  /* Payout packets: print the body clone, not the open <dialog> */
  /* Print ONLY the cloned sheet. Everything else in <body> is removed from layout (not just hidden) and the
     clone flows normally in the page, so Chrome paginates it like a real document instead of a clipped overlay. */
  html:has(body.printing-payouts), html:has(body.printing-invoice) { height: auto !important; overflow: visible !important; background: #fff; }
  body.printing-payouts, body.printing-invoice { display: block !important; height: auto !important; min-height: 0 !important; overflow: visible !important; background: #fff !important; }
  body.printing-payouts > *:not(.payout-print-host),
  body.printing-invoice > *:not(.invoice-print-host) { display: none !important; }
  body.printing-payouts .payout-print-host,
  body.printing-invoice .invoice-print-host {
    position: static !important;
    left: auto !important;
    width: auto !important;
    pointer-events: auto;
  }
  body.printing-payouts .payout-print-host .payout-doc,
  body.printing-invoice .invoice-print-host .invoice-doc {
    border: 0;
    padding: 0;
    margin: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  body.printing-payouts .payout-print-host .table-wrap,
  body.printing-invoice .invoice-print-host .table-wrap { overflow: visible !important; }
  body.printing-payouts .payout-print-host ::-webkit-scrollbar { display: none; }

  /* Payout packets: one payee per page run, no box border (a bordered box repeats its edges on every page). */
  .payout-carrier { border: 0; padding: 0; margin: 0; break-inside: auto; page-break-inside: auto; break-before: page; page-break-before: always; }
  .payout-carrier:first-of-type { break-before: auto; page-break-before: auto; }
  .payout-carrier-head, .payout-verify, .payout-mill-head, .payout-total-wrap { break-inside: avoid; page-break-inside: avoid; }
  .payout-mill-head { break-after: avoid; page-break-after: avoid; }
  .payout-mill { margin: 0 0 .9rem; }
  /* Mill with printed tickets: the next mill starts on a fresh page. Otherwise mills simply flow. */
  .payout-mill:has(details.invoice-tickets[open]) + .payout-mill { break-before: page; page-break-before: always; }
  body.printing-payouts .payout-print-host .payout-table { table-layout: fixed; width: 100%; font-size: 8.5pt; }
  body.printing-payouts .payout-print-host .payout-table th { font-size: 6.5pt; letter-spacing: .02em; padding: .3rem .25rem; white-space: normal; }
  body.printing-payouts .payout-print-host .payout-table td { padding: .3rem .25rem; overflow-wrap: anywhere; }
  body.printing-payouts .payout-print-host .payout-table td.mono { white-space: nowrap; overflow-wrap: normal; }
  body.printing-payouts .payout-print-host .payout-table tr { break-inside: avoid; page-break-inside: avoid; }
  body.printing-payouts .payout-print-host .payout-table th:nth-child(1) { width: 17%; }
  body.printing-payouts .payout-print-host .payout-table th:nth-child(2) { width: 11%; }
  body.printing-payouts .payout-print-host .payout-table th:nth-child(3) { width: 20%; }
  body.printing-payouts .payout-print-host .payout-table th:nth-child(4) { width: 8%; }
  body.printing-payouts .payout-print-host .payout-table th:nth-child(5) { width: 11%; }
  body.printing-payouts .payout-print-host .payout-table th:nth-child(6) { width: 8%; }
  body.printing-payouts .payout-print-host .payout-table th:nth-child(7) { width: 10%; }
  body.printing-payouts .payout-print-host .payout-table th:nth-child(8) { width: 15%; }

  /* Branded customer invoice */
  /* Lines may run across pages (header row repeats); only whole rows are kept together. */
  .invoice-dest { break-inside: auto; page-break-inside: auto; }
  .invoice-dest-head { break-after: avoid; page-break-after: avoid; }
  .invoice-totals { break-inside: avoid; page-break-inside: avoid; }
  /* A mill's tickets follow its lines right away (no forced blank space); the NEXT mill starts a new page. */
  .invoice-tickets { border-top: 0; margin-top: .75rem; padding-top: 0; }
  .invoice-tickets > summary { break-after: avoid; page-break-after: avoid; }
  .invoice-tickets > summary::before { display: none; }
  .invoice-tickets + .invoice-dest { break-before: page; page-break-before: always; }
  .invoice-ticket { break-inside: avoid; page-break-inside: avoid; }

  /* Invoice printing: fit the letter page width, no scroll bars (page size comes from the @page rule above) */
  body.printing-invoice .invoice-print-host { width: 100%; }
  body.printing-invoice .invoice-print-host .invoice-doc { width: 100%; max-width: 100%; box-sizing: border-box; }
  body.printing-invoice .invoice-print-host .table-wrap { overflow: visible !important; }
  body.printing-invoice .invoice-print-host .invoice-table {
    width: 100%;
    table-layout: fixed;
    font-size: 8pt;
  }
  body.printing-invoice .invoice-print-host .invoice-table th,
  body.printing-invoice .invoice-print-host .invoice-table td {
    padding: .3rem .2rem;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  body.printing-invoice .invoice-print-host .invoice-table th { font-size: 6.5pt; letter-spacing: .02em; }
  body.printing-invoice .invoice-print-host .invoice-table .num { white-space: nowrap; overflow-wrap: normal; }
  body.printing-invoice .invoice-print-host .invoice-table tr { break-inside: avoid; page-break-inside: avoid; }
  /* Delivered, Ticket #, Product, Destination, Net tons, Base, FSC, Rate w/ FSC, Unit, Billed $, Load # */
  body.printing-invoice .invoice-print-host .invoice-table th:nth-child(1) { width: 9.5%; }
  body.printing-invoice .invoice-print-host .invoice-table th:nth-child(2) { width: 9%; }
  body.printing-invoice .invoice-print-host .invoice-table th:nth-child(3) { width: 7%; }
  body.printing-invoice .invoice-print-host .invoice-table th:nth-child(4) { width: 9%; }
  body.printing-invoice .invoice-print-host .invoice-table th:nth-child(5) { width: 8%; }
  body.printing-invoice .invoice-print-host .invoice-table th:nth-child(6) { width: 8%; }
  body.printing-invoice .invoice-print-host .invoice-table th:nth-child(7) { width: 7%; }
  body.printing-invoice .invoice-print-host .invoice-table th:nth-child(8) { width: 8.5%; }
  body.printing-invoice .invoice-print-host .invoice-table th:nth-child(9) { width: 6.5%; }
  body.printing-invoice .invoice-print-host .invoice-table th:nth-child(10) { width: 10%; }
  body.printing-invoice .invoice-print-host .invoice-table th:nth-child(11) { width: 17.5%; }
  body.printing-invoice .invoice-print-host .invoice-meta { gap: 1rem; }
  body.printing-invoice .invoice-print-host .invoice-ticket-grid { grid-template-columns: 1fr 1fr; }
  body.printing-invoice .invoice-print-host ::-webkit-scrollbar { display: none; }
}
