:root {
  /* "Vintage Americana" — exact tokens from the original app */
  --bg: #f7f1e5;
  --card: #fcf8f0;
  --muted: #51607a;
  --text: #0e294a;
  --line: rgba(14, 41, 74, 0.18);
  /* Aliases used by newer modules (calendar, fleet-live, driver portal). Matches
     the fallback the rest of the app already passes to var(--border, #d9d4c7). */
  --border: #d9d4c7;
  --text-muted: #51607a;
  --nav: #0b1f3b;
  --nav-2: #081832;
  --nav-text: #f2eadd;
  --red: #a13124;
  --red-dark: #7e2319;
  --green: #337344;
  --bad: #940308;
  --warning: #d28425;
  --americana-red: #c50516;
  --americana-blue: #052482;
  --shadow: 0 14px 36px rgba(14, 41, 74, 0.10);
  --sidebar-from: #0e2747;
  --font-sans: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Oswald", "IBM Plex Sans", sans-serif;
  --font-eyebrow: "Barlow", var(--font-sans);
  --font-serif: "Libre Baskerville", Georgia, serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  letter-spacing: 0;
}

h1,
h2,
h3,
.brand-copy strong {
  font-family: var(--font-display);
  letter-spacing: 0.06em;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

.app-shell {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  width: 276px;
  height: 100vh;
  overflow: hidden;
  background: var(--sidebar-bg, linear-gradient(180deg, var(--sidebar-from) 0%, var(--nav) 55%, var(--nav-2) 100%));
  color: var(--nav-text);
  border-right: 1px solid rgba(255, 255, 255, 0.09);
  transition: width 180ms ease;
}

.sidebar-stripe {
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--red), transparent);
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 16px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-platform-logo {
  display: block;
  width: 100%;
  max-width: 150px;
  height: auto;
}

.brand-tenant {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-tenant-name {
  min-width: 0;
  color: rgba(248, 250, 252, 0.92);
  font-family: var(--font-display, inherit);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.2;
  /* Long company names clip rather than push the logo or wrap the sidebar. */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-tenant img {
  max-height: 34px;
  max-width: 180px;
  width: auto;
  border-radius: 6px;
  background: #fff;
  padding: 3px 6px;
  object-fit: contain;
}

.nav-groups {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
}

/* ---- Scrollbars ----------------------------------------------------------
   Thin rounded pill scrollbars. The portal (light surfaces) gets a navy
   thumb; the dark sidebar nav gets a light translucent thumb. The transparent
   border + padding-box clip leaves breathing room so the thumb reads as a pill. */
html {
  scrollbar-width: thin;
  scrollbar-color: rgba(14, 41, 74, 0.32) transparent;
}
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}
::-webkit-scrollbar-track,
::-webkit-scrollbar-corner {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(14, 41, 74, 0.28);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(14, 41, 74, 0.46);
  background-clip: padding-box;
}

.nav-groups {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.28) transparent;
}
.nav-groups::-webkit-scrollbar {
  width: 10px;
}
.nav-groups::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.nav-groups::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.42);
  background-clip: padding-box;
}

.nav-group {
  margin: 7px 0 13px;
}

.nav-group h2 {
  margin: 0 0 7px;
  padding: 0 10px;
  color: rgba(248, 250, 252, 0.44);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.nav-group ul {
  display: grid;
  gap: 3px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 37px;
  padding: 9px 10px;
  border-radius: 8px;
  color: rgba(248, 250, 252, 0.8);
  font-size: 13px;
  line-height: 1.25;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}

.nav-item.is-active {
  background: var(--red);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 8px 20px rgba(180, 35, 47, 0.26);
}

.nav-item.is-active::before {
  position: absolute;
  left: 0;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 0 999px 999px 0;
  background: #fff;
  content: "";
}

.nav-icon {
  width: 18px;
  flex: 0 0 auto;
  font-size: 15px;
  text-align: center;
  opacity: 0.95;
}

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(248, 250, 252, 0.6);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.sidebar-footer strong {
  margin-left: auto;
  color: rgba(248, 250, 252, 0.42);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--red);
  box-shadow: 0 0 12px rgba(180, 35, 47, 0.8);
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 57px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
}

.icon-button {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #445066;
  cursor: pointer;
}

.icon-button:hover {
  background: #eef2f6;
}

.icon-button i {
  font-size: 16px;
  line-height: 1;
}

.search {
  position: relative;
  display: flex;
  width: min(100%, 430px);
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 12px;
  font-size: 13px;
  color: #738097;
  pointer-events: none;
}

.search input {
  width: 100%;
  height: 37px;
  padding: 0 12px 0 34px;
  border: 1px solid transparent;
  border-radius: 8px;
  outline: none;
  background: #eef2f6;
  color: var(--text);
  font-size: 14px;
}

.search input:focus {
  border-color: #b7c1d1;
  background: #fff;
}

/* Global search dropdown */
.search { position: relative; }
.search-kbd {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border: 1px solid #c9d2df;
  border-radius: 5px;
  background: #fff;
  color: #738097;
  font-size: 11px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  pointer-events: none;
}
.search.is-focus .search-kbd { display: none; }
.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 200;
  max-height: min(460px, 70vh);
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.18);
  padding: 6px;
}
.search-group-label {
  padding: 8px 10px 4px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #8a93a5;
}
.search-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
}
.search-item:hover,
.search-item.is-active {
  background: #eef2f6;
}
.search-item-ico {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(14, 41, 74, 0.08);
  color: var(--brand, #0e294a);
  font-size: 13px;
}
.search-item-main { flex: 1; min-width: 0; }
.search-item-title {
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-item-title mark { background: rgba(220, 180, 40, 0.4); color: inherit; padding: 0 1px; border-radius: 2px; }
.search-item-sub {
  font-size: 12px;
  color: var(--muted, #66707f);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-item-badge {
  flex: 0 0 auto;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef2f6;
  color: #4a5568;
  white-space: nowrap;
}
.search-empty,
.search-hint {
  padding: 18px 12px;
  text-align: center;
  color: var(--muted, #66707f);
  font-size: 13px;
}
.search-foot {
  border-top: 1px solid var(--line);
  margin: 6px -6px -6px;
  padding: 8px 14px;
  font-size: 11.5px;
  color: #8a93a5;
  display: flex;
  gap: 14px;
}
.search-foot kbd {
  border: 1px solid #d3dae5;
  border-radius: 4px;
  padding: 0 4px;
  font-size: 10.5px;
  background: #f7f9fc;
}
@media (max-width: 640px) {
  .search-kbd { display: none; }
}

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

.health-pill {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  border-radius: 999px;
  padding: 0 11px;
  font-size: 12px;
  font-weight: 800;
}

.health-pill.is-good {
  background: rgba(20, 128, 74, 0.1);
  color: var(--green);
}

.health-pill.is-bad {
  background: rgba(185, 28, 28, 0.1);
  color: var(--bad);
}

/* Topbar live digital clock (replaces the DB health pill). */
.topbar-clock {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(14, 41, 74, 0.06);
  color: var(--text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  user-select: none;
}
.topbar-clock i {
  color: var(--red);
  font-size: 13px;
}
.topbar-clock .tc-time {
  font-family: var(--font-display, inherit);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.user-email {
  color: var(--muted);
  font-size: 14px;
}

.tenant-chip {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #344054;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
}

.tenant-switcher {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #344054;
  padding: 0 6px 0 10px;
}

.tenant-switcher i {
  font-size: 12px;
  color: var(--muted);
}

.tenant-switcher select {
  border: 0;
  background: transparent;
  font-size: 12px;
  font-weight: 800;
  color: #344054;
  padding: 4px 2px;
  max-width: 160px;
  cursor: pointer;
}

.tenant-switcher select:focus {
  outline: none;
}

.impersonation-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 18px;
  background: #7a1020;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}

.impersonation-banner i {
  margin-right: 6px;
}

.impersonation-banner .button {
  background: #fff;
  color: #7a1020;
  border-color: #fff;
  padding: 6px 12px;
}

.table-action.is-danger {
  color: #b42318;
}

.table-action.is-danger:hover {
  color: #fff;
  background: #b42318;
}

.content {
  width: 100%;
  padding: 26px;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--red);
  font-family: var(--font-eyebrow);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0.06em;
}

h1 {
  font-size: 30px;
  line-height: 1.12;
}

.page-header h1 {
  font-size: calc(clamp(40px, 4.4vw, 60px) * var(--page-header-scale, 1));
  line-height: 0.96;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
}

.page-header h1 .accent {
  color: var(--americana-red);
}

/* Display titles are always uppercase (Oswald has lowercase glyphs, unlike the
   former Bebas Neue). Scoped to the app content so print sheets, the login
   screen, and the sidebar wordmark keep their natural case. */
.content h1,
.content h2,
.content h3 {
  text-transform: uppercase;
}

h2 {
  font-size: 19px;
}

.muted {
  max-width: 760px;
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

.phase-card,
.kpi,
.module-card,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.phase-card {
  min-width: 250px;
  padding: 16px;
}

.phase-card span,
.kpi span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.phase-card strong {
  display: block;
  margin-top: 7px;
  font-size: 14px;
}

.kpi-grid,
.module-grid {
  display: grid;
  gap: 14px;
}

.kpi-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 16px;
}

.kpi {
  padding: 16px;
}

.kpi strong {
  display: block;
  margin-top: 9px;
  font-size: 27px;
  line-height: 1;
}

.kpi small,
.module-card small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.module-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin-bottom: 16px;
}

.module-card {
  display: grid;
  min-height: 136px;
  align-content: start;
  gap: 10px;
  padding: 16px;
  transition: transform 150ms ease, border-color 150ms ease;
}

.module-card:hover {
  border-color: rgba(180, 35, 47, 0.45);
  transform: translateY(-1px);
}

.module-icon {
  display: inline-flex;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: rgba(180, 35, 47, 0.1);
  color: var(--red);
  font-size: 18px;
}

.check {
  color: var(--green);
  font-size: 14px;
}

.overdue-flag {
  color: var(--bad);
  font-weight: 700;
}

.reports-filters {
  grid-template-columns: 160px 160px auto;
  align-items: end;
}

.range-label {
  display: grid;
  gap: 4px;
}

.range-label span {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.reports-pnl-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 10px;
}

.reports-pnl-head h2 {
  margin: 0;
  font-size: 16px;
}

.reports-kpis {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.reports-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.reports-driver-panel {
  grid-column: 1 / -1;
}

@media (max-width: 1100px) {
  .reports-kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .reports-grid {
    grid-template-columns: 1fr;
  }
}

.module-card strong {
  font-size: 15px;
}

.panel {
  padding: 18px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--line);
}

.button {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  /* Without this a <button class="button"> keeps the user-agent border, which
     draws a hard outline over the filled style. Anchors were unaffected, which
     is why it went unnoticed. */
  border: 0;
  border-radius: 7px;
  background: var(--red);
  color: #fff;
  padding: 0 13px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.button:hover {
  background: var(--red-dark);
}

.checklist {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding-top: 16px;
  color: #344054;
  font-size: 14px;
}

.next-panel {
  margin-top: 16px;
}

.next-list {
  display: grid;
  gap: 10px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.next-list li {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  padding: 12px 12px 12px 34px;
  color: #344054;
  font-size: 14px;
}

.next-list li::before {
  position: absolute;
  left: 13px;
  top: 18px;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--red);
  content: "";
}

.checklist div {
  display: flex;
  align-items: center;
  gap: 9px;
}

.check {
  display: inline-grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 999px;
  background: rgba(20, 128, 74, 0.12);
}

.check::before {
  width: 8px;
  height: 4px;
  border-bottom: 2px solid var(--green);
  border-left: 2px solid var(--green);
  transform: rotate(-45deg);
  content: "";
}

.login-page {
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(24, 35, 61, 0.96), rgba(16, 25, 44, 0.98)),
    var(--nav);
}

.login-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 430px;
  min-height: 100vh;
}

.login-brand {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(32px, 7vw, 90px);
  color: #fff;
}

.login-brand .eyebrow {
  color: rgba(255, 255, 255, 0.72);
}

.login-brand h1 {
  max-width: 680px;
  font-size: clamp(42px, 7vw, 78px);
}

.login-brand p:not(.eyebrow) {
  max-width: 560px;
  margin: 18px 0 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 18px;
  line-height: 1.55;
}

.login-logo-wrap {
  display: grid;
  width: 82px;
  height: 82px;
  place-items: center;
  margin-bottom: 28px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 20px 60px rgba(180, 35, 47, 0.34);
}

.login-logo-wrap img {
  width: 68px;
  height: 68px;
  object-fit: contain;
}

.login-card {
  align-self: center;
  margin: 32px 44px 32px 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
  padding: 30px;
}

.login-card-header {
  margin-bottom: 22px;
}

.login-card-header h2 {
  font-size: 28px;
}

.login-card-header p:not(.eyebrow) {
  margin: 8px 0 0;
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: 15px;
}

.login-form label {
  display: grid;
  gap: 7px;
  color: #344054;
  font-size: 13px;
  font-weight: 800;
}

.login-form input {
  width: 100%;
  height: 43px;
  border: 1px solid var(--line);
  border-radius: 7px;
  outline: none;
  padding: 0 12px;
  color: var(--text);
  font-size: 15px;
}

.login-form input:focus {
  border-color: rgba(180, 35, 47, 0.55);
  box-shadow: 0 0 0 3px rgba(180, 35, 47, 0.12);
}

.login-button {
  justify-content: center;
  min-height: 43px;
  margin-top: 4px;
  border: 0;
  cursor: pointer;
}

.alert {
  margin-bottom: 16px;
  border: 1px solid rgba(20, 128, 74, 0.25);
  border-radius: 7px;
  background: rgba(20, 128, 74, 0.08);
  color: var(--green);
  padding: 11px 12px;
  font-size: 13px;
  font-weight: 700;
}

.alert.is-error {
  border-color: rgba(185, 28, 28, 0.25);
  background: rgba(185, 28, 28, 0.08);
  color: var(--bad);
}

.split-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
  align-items: start;
}

.loads-workspace {
  grid-template-columns: minmax(0, 1fr) 430px;
}

.loads-table {
  min-width: 1080px;
}

.loads-form-panel {
  max-height: calc(100vh - 94px);
  overflow: auto;
}

.driver-documents-workspace {
  grid-template-columns: minmax(0, 1fr) 390px;
}

.bols-workspace {
  grid-template-columns: minmax(0, 1fr) 410px;
}

.invoices-workspace {
  grid-template-columns: minmax(0, 1fr) 410px;
}

.contacts-kpis {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.contacts-panel,
.form-panel {
  box-shadow: none;
}

.filters-bar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 150px 130px auto;
  gap: 10px;
  margin: 16px 0;
}

.truck-filters {
  grid-template-columns: minmax(220px, 1fr) 170px auto;
}

.dispatch-filters {
  grid-template-columns: minmax(220px, 1fr) 150px 170px 150px auto;
}

.calendar-filters {
  grid-template-columns: 145px minmax(220px, 1fr) 150px 170px 150px auto;
}

.document-filters {
  grid-template-columns: minmax(220px, 1fr) 150px 190px auto;
}

.bol-filters {
  grid-template-columns: minmax(220px, 1fr) 150px auto;
}

.invoice-filters {
  grid-template-columns: minmax(220px, 1fr) 150px auto;
}

.filters-bar input,
.filters-bar select,
.stack-form input,
.stack-form select,
.stack-form textarea,
.row-select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  outline: none;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.filters-bar input,
.filters-bar select,
.stack-form input,
.stack-form select,
.row-select {
  height: 38px;
  padding: 0 10px;
}

/* Ancestor-free form control. Use this on inputs/selects/textareas that live
   outside .stack-form / .filters-bar, instead of adding another one-off
   selector per module. Mirrors the shared rule above. */
.form-control {
  width: 100%;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  outline: none;
  background: #fff;
  color: var(--text);
  font: inherit;
}

select.form-control {
  cursor: pointer;
}

textarea.form-control {
  height: auto;
  padding: 8px 10px;
}

.form-control.is-sm {
  height: 30px;
  padding: 0 8px;
  font-size: 12.5px;
  width: auto;
}

.form-control:focus {
  border-color: rgba(180, 35, 47, 0.55);
  box-shadow: 0 0 0 3px rgba(180, 35, 47, 0.1);
}

.row-select {
  display: inline-block;
  width: 128px;
  height: 29px;
  margin-inline: 4px;
  font-size: 12px;
  font-weight: 700;
}

.stack-form input[type="file"] {
  height: auto;
  padding: 9px;
}

/* Checkboxes and radios keep their native size — the broad .stack-form /
   .filters-bar input rules above are meant for text fields only, and would
   otherwise stretch them into giant boxes. */
.stack-form input[type="checkbox"],
.stack-form input[type="radio"],
.filters-bar input[type="checkbox"],
.filters-bar input[type="radio"] {
  width: auto;
  height: auto;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  flex: 0 0 auto;
  appearance: auto;
  -webkit-appearance: auto;
}

.form-hint {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}
/* API-keys field blocks: give the hint room below the input + space each field. */
.api-key-field { margin-bottom: 22px; }
.api-key-field .form-hint { margin-top: 9px; }
.api-key-field .checkbox-label { margin-top: 9px; }

.stack-form textarea {
  min-height: 78px;
  resize: vertical;
  padding: 10px;
}

.filters-bar input:focus,
.filters-bar select:focus,
.stack-form input:focus,
.stack-form select:focus,
.stack-form textarea:focus {
  border-color: rgba(180, 35, 47, 0.55);
  box-shadow: 0 0 0 3px rgba(180, 35, 47, 0.1);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.data-table {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
  background: #fff;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--line);
  padding: 12px;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

.data-table th {
  background: #f5f7fa;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.data-table td strong {
  display: block;
  font-size: 14px;
}

.data-table td small {
  display: block;
  max-width: 360px;
  margin-top: 3px;
  color: var(--muted);
  line-height: 1.35;
}

.actions-col {
  width: 170px;
  white-space: nowrap;
}

.inline-form {
  display: inline;
}

.table-action {
  display: inline-flex;
  align-items: center;
  min-height: 29px;
  border: 0;
  border-radius: 7px;
  background: #eef2f6;
  color: #344054;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.table-action:hover {
  background: #e3e8ef;
}

.type-badge,
.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 11px;
  font-weight: 900;
}

.type-badge {
  background: rgba(24, 35, 61, 0.08);
  color: var(--nav);
}

.status-badge.is-active {
  background: rgba(20, 128, 74, 0.1);
  color: var(--green);
}

.status-badge.is-muted {
  background: #eef2f6;
  color: var(--muted);
}

.status-badge.is-waiting {
  background: rgba(180, 35, 47, 0.1);
  color: var(--red);
}

.status-badge.is-moving {
  background: rgba(24, 35, 61, 0.1);
  color: var(--nav);
}

.empty-cell {
  height: 110px;
  color: var(--muted);
  text-align: center !important;
  vertical-align: middle !important;
}

.stack-form {
  display: grid;
  gap: 13px;
  margin-top: 16px;
}

.stack-form label {
  display: grid;
  gap: 6px;
  color: #344054;
  font-size: 13px;
  font-weight: 800;
}

.form-section-title {
  margin-top: 2px;
  border-top: 1px solid var(--line);
  padding-top: 13px;
  color: var(--red);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: 76px 1fr 1fr;
  gap: 10px;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.load-rate-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dispatch-panel {
  box-shadow: none;
}

.dispatch-empty {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  color: var(--muted);
  padding: 30px 16px;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
}

.dispatch-lane {
  margin-top: 18px;
}

.dispatch-lane-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.dispatch-lane-heading h3 {
  margin: 0;
  font-size: 16px;
}

.dispatch-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.dispatch-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.dispatch-card-header,
.dispatch-route,
.dispatch-meta,
.dispatch-assign {
  display: grid;
  gap: 10px;
}

.dispatch-card-header {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.dispatch-card-header strong,
.dispatch-meta strong,
.dispatch-route strong {
  display: block;
}

.dispatch-card-header small,
.dispatch-route small,
.dispatch-route span,
.dispatch-meta span,
.dispatch-assign label span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.dispatch-route {
  grid-template-columns: 1fr 1fr;
  margin-top: 12px;
}

.dispatch-route > div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  padding: 10px;
}

.dispatch-meta {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 12px;
}

.dispatch-meta > div {
  min-width: 0;
}

.dispatch-meta strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.dispatch-assign {
  grid-template-columns: 1fr 1fr 1fr auto auto;
  align-items: end;
  margin-top: 14px;
}

.dispatch-assign label {
  display: grid;
  gap: 5px;
  min-width: 0;
  font-weight: 800;
}

.dispatch-assign select {
  width: 100%;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  padding: 0 9px;
  font: inherit;
}

.calendar-panel {
  box-shadow: none;
}

.calendar-heading {
  align-items: center;
}

.calendar-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.calendar-weekdays {
  gap: 8px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.calendar-weekdays span {
  padding-inline: 2px;
}

.calendar-grid {
  gap: 8px;
  margin-top: 8px;
}

.calendar-day {
  min-height: 150px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  padding: 9px;
}

.calendar-day.has-events {
  background: #fff;
}

.calendar-day.is-empty {
  border-style: dashed;
  background: #f1f4f8;
}

.calendar-day header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.calendar-day header strong {
  font-size: 15px;
}

.calendar-day header span,
.calendar-more {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.calendar-events {
  display: grid;
  gap: 6px;
}

.calendar-event {
  display: grid;
  gap: 2px;
  border-left: 3px solid var(--red);
  border-radius: 6px;
  background: rgba(180, 35, 47, 0.07);
  padding: 7px;
  min-width: 0;
}

.calendar-event.delivery {
  border-left-color: var(--nav);
  background: rgba(24, 35, 61, 0.07);
}

.calendar-event span,
.calendar-event small {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  line-height: 1.25;
}

.calendar-event strong {
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.calendar-table {
  min-width: 900px;
}

.document-table {
  min-width: 960px;
}

.bol-table {
  min-width: 1160px;
}

.invoice-table {
  min-width: 1160px;
}

.bols-form-panel {
  max-height: calc(100vh - 94px);
  overflow: auto;
}

.invoices-form-panel {
  max-height: calc(100vh - 94px);
  overflow: auto;
}

.print-body {
  background: #eef2f6;
  padding: 24px;
}

.print-sheet {
  max-width: 980px;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 28px;
  box-shadow: var(--shadow);
}

.print-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 2px solid var(--line);
  padding-bottom: 18px;
}

.print-header p {
  margin: 8px 0 0;
  color: var(--muted);
}

.print-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.print-grid article,
.print-signatures div,
.print-notes {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.print-grid h2,
.print-notes h2 {
  margin: 0 0 10px;
  font-size: 15px;
}

.print-grid p,
.print-notes p {
  margin: 6px 0 0;
  color: #344054;
  line-height: 1.45;
}

/* N2 — multiple units listed on one BOL sheet */
.print-vehicle-sep {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed #d0d5dd;
}

/* BOL captured photos + signatures (N6 → BOL) */
.print-capture { margin-top: 18px; }
.print-capture-stage { margin-bottom: 14px; }
.print-capture-stage h2 { font-size: 14px; margin: 0 0 8px; }
.print-capture-photos { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.print-capture-photos img { width: 92px; height: 92px; object-fit: cover; border: 1px solid #d0d5dd; border-radius: 6px; }
.print-capture-sigs { display: flex; gap: 24px; font-size: 12px; color: #344054; }

.print-signatures {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.print-signatures span,
.print-signatures small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.print-signatures strong {
  display: block;
  margin: 8px 0;
}

.print-notes {
  margin-top: 18px;
}

.print-lines {
  margin-top: 18px;
}

.print-lines h2 {
  margin: 0 0 10px;
  font-size: 15px;
}

.settlement-lines {
  display: grid;
  gap: 12px;
}

.settlement-line {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  display: grid;
  gap: 10px;
  background: #fcfcfd;
}

.settlement-line-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.settlement-line-head span {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.line-remove {
  border: none;
  background: none;
  color: #b42318;
  font-size: 13px;
  cursor: pointer;
  padding: 0;
}

.line-remove:hover {
  text-decoration: underline;
}

.settlement-totals {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 4px;
}

.settlement-totals span {
  display: block;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  color: var(--muted);
}

.settlement-totals strong {
  display: block;
  font-size: 15px;
  color: var(--text);
  margin-top: 2px;
}

.is-sidebar-collapsed .sidebar {
  width: 78px;
}

.is-sidebar-collapsed .brand-copy,
.is-sidebar-collapsed .nav-group h2,
.is-sidebar-collapsed .nav-item span:last-child,
.is-sidebar-collapsed .sidebar-footer span:not(.status-dot),
.is-sidebar-collapsed .sidebar-footer strong {
  display: none;
}

.is-sidebar-collapsed .brand {
  justify-content: center;
  padding-inline: 10px;
}

.is-sidebar-collapsed .nav-item {
  justify-content: center;
}

@media (max-width: 1120px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .module-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: relative;
    width: 100%;
    height: auto;
  }

  .nav-groups {
    display: none;
  }

  .sidebar-footer {
    display: none;
  }

  .topbar {
    gap: 8px;
    padding-inline: 12px;
  }

  .search {
    width: 100%;
  }

  .topbar-actions .user-email,
  .topbar-actions .bell,
  .topbar-actions .tenant-chip {
    display: none;
  }

  .content {
    padding: 18px;
  }

  .page-header {
    display: grid;
  }

  .phase-card {
    min-width: 0;
  }

  .module-grid,
  .kpi-grid,
  .checklist,
  .split-workspace,
  .contacts-kpis {
    grid-template-columns: 1fr;
  }

  .filters-bar {
    grid-template-columns: 1fr;
  }

  .form-grid-3,
  .form-grid-2,
  .loads-workspace,
  .driver-documents-workspace,
  .bols-workspace,
  .invoices-workspace,
  .load-rate-grid,
  .dispatch-filters,
  .document-filters,
  .bol-filters,
  .invoice-filters,
  .dispatch-cards,
  .dispatch-route,
  .dispatch-meta,
  .dispatch-assign,
  .calendar-filters,
  .calendar-weekdays,
  .calendar-grid {
    grid-template-columns: 1fr;
  }

  .calendar-weekdays {
    display: none;
  }

  .print-grid,
  .print-signatures {
    grid-template-columns: 1fr;
  }

  .print-body {
    padding: 0;
  }

  .print-sheet {
    border-radius: 0;
  }

  .login-shell {
    grid-template-columns: 1fr;
  }

  .login-brand {
    min-height: 38vh;
    padding: 28px 22px;
  }

  .login-card {
    align-self: auto;
    margin: 0;
    border-radius: 0;
    padding: 24px 22px 32px;
  }
}

@media print {
  .print-body {
    background: #fff;
    padding: 0;
  }

  .print-sheet {
    max-width: none;
    border: 0;
    box-shadow: none;
    padding: 0;
  }

  .print-header .button {
    display: none;
  }
}

/* Settings module */
.settings-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 18px;
  border-bottom: 1px solid var(--border, #d9d4c7);
}

.settings-tab {
  padding: 9px 16px;
  border-radius: 6px 6px 0 0;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--muted, #6b6557);
  text-decoration: none;
  border: 1px solid transparent;
  border-bottom: none;
  margin-bottom: -1px;
}

.settings-tab:hover {
  color: var(--text, #232020);
  background: rgba(0, 0, 0, 0.03);
}

.settings-tab.is-active {
  color: var(--text, #232020);
  background: var(--surface, #fff);
  border-color: var(--border, #d9d4c7);
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  align-items: start;
}

.settings-narrow {
  max-width: 720px;
}

.settings-divider {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border, #d9d4c7);
}

.settings-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.settings-narrow input[type="color"] {
  width: 100%;
  height: 38px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.favicon-current {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 10px 0 16px;
}

.favicon-current span {
  font-family: var(--font-eyebrow);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.favicon-current img {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 4px;
  object-fit: contain;
}

.logo-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 10px 0 16px;
  padding: 18px;
  border-radius: 8px;
  background: var(--nav);
  border: 1px solid var(--line);
}

.logo-preview img {
  max-width: 240px;
  max-height: 84px;
  width: 100%;
  height: auto;
  object-fit: contain;
}

.sidebar-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 92px;
  margin: 10px 0 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #0e2747, #0b1f3b, #081832);
}

.sidebar-preview span {
  font-family: var(--font-eyebrow);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
  font-weight: 600;
  color: #f2eadd;
}

.platform-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.back-link {
  color: var(--muted);
}

.back-link:hover {
  color: var(--red);
}

.fuel-defaults {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 12px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.03);
}

.fuel-defaults span {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
  color: var(--muted);
}

.fuel-estimate {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  margin: 4px 0 6px;
}

.fuel-estimate label {
  flex: 1;
}

/* ===== Dashboard (Vintage Americana) ===== */
.dash-rule {
  height: 2px;
  border: 0;
  margin: 2px 0 20px;
  background: linear-gradient(90deg, var(--americana-red), rgba(197, 5, 22, 0.12));
}

.dash-header-date {
  font-family: var(--font-eyebrow);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.dash-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
  align-items: start;
  margin-bottom: 16px;
}

.dash-grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  margin-bottom: 16px;
}

.dash-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--card);
  padding: 18px;
}

/* N9 — closed-out orders rollup cards */
.dash-closed-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.dash-closed {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(14, 41, 74, 0.03);
}
.dash-closed-lbl { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.dash-closed-count { font-size: 30px; font-weight: 800; line-height: 1.05; color: var(--nav); }
.dash-closed-sub { font-size: 12px; color: var(--muted); }
@media (max-width: 700px) {
  .dash-closed-grid { grid-template-columns: 1fr; }
}

.dash-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.dash-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 19px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
}

.dash-card-title i {
  color: var(--red);
  font-size: 15px;
}

.dash-card-head .muted-link,
.dash-card-head .eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.dash-table {
  width: 100%;
  border-collapse: collapse;
}

.dash-table th {
  text-align: left;
  font-family: var(--font-eyebrow);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.dash-table td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.dash-table tr:last-child td {
  border-bottom: 0;
}

.dash-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.dash-table .neg {
  color: var(--bad);
  font-weight: 700;
}

.dash-table .period {
  font-weight: 700;
  color: var(--text);
}

.dash-table .total-col {
  font-weight: 800;
  color: var(--text);
}

.ar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 2px;
  border-bottom: 1px solid var(--line);
}

.ar-row:last-child {
  border-bottom: 0;
}

.ar-row span {
  color: var(--muted);
  font-size: 14px;
}

.ar-row strong {
  font-size: 20px;
  color: var(--americana-blue);
  font-variant-numeric: tabular-nums;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.quick-tile {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 130px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--card);
  padding: 16px;
  transition: border-color 150ms ease, transform 150ms ease;
}

.quick-tile:hover {
  border-color: rgba(161, 49, 36, 0.5);
  transform: translateY(-1px);
}

.quick-tile i {
  font-size: 20px;
  color: var(--red);
}

.quick-tile .qt-title {
  margin-top: auto;
  font-family: var(--font-display);
  font-size: 16px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
}

.quick-tile .qt-sub {
  font-family: var(--font-eyebrow);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.stat-row {
  display: flex;
  gap: 30px;
}

.stat-block strong {
  display: block;
  font-family: var(--font-display);
  font-size: 44px;
  line-height: 1;
  color: var(--text);
}

.stat-block span {
  font-family: var(--font-eyebrow);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.load-pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  text-transform: capitalize;
}

.load-pill.s-available { background: #8a98ad; }
.load-pill.s-assigned { background: #026fd7; }
.load-pill.s-at_pickup { background: #e08600; }
.load-pill.s-loaded { background: #c9760a; }
.load-pill.s-in_transit { background: #7e4ed7; }
.load-pill.s-at_dropoff { background: #00a4a5; }
.load-pill.s-delivered { background: #00893c; }
.load-pill.s-invoiced { background: #0074c9; }
.load-pill.s-paid { background: #009d82; }
.load-pill.s-cancelled { background: #940308; }

@media (max-width: 1100px) {
  .dash-grid,
  .dash-grid-2 {
    grid-template-columns: 1fr;
  }
  .quick-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ===== Login (split-screen: media hero + dark panel) ===== */
.login-page {
  margin: 0;
  min-height: 100vh;
  background: #0b0e14;
}

.login-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 460px;
  min-height: 100vh;
}

.login-hero {
  position: relative;
  overflow: hidden;
  background: #0b0e14;
}

.login-hero-media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.login-hero-gradient {
  background: radial-gradient(120% 120% at 20% 10%, #2b3a55 0%, #14223a 45%, #0b0e14 100%);
}

.login-hero-overlay {
  position: absolute;
  inset: 0;
}

.login-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  padding: clamp(28px, 5vw, 56px);
  background: #1f242c;
  color: #f2eadd;
}

.login-panel-logo {
  display: block;
  width: 100%;
  max-width: 232px;
  height: auto;
  margin: 0 auto 10px;
}

.login-fields {
  display: grid;
  gap: 16px;
}

.login-field {
  display: grid;
  gap: 7px;
}

.login-field span {
  font-family: var(--font-eyebrow);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-size: 12px;
  font-weight: 600;
  color: #aeb6c4;
}

.login-field input {
  width: 100%;
  height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  padding: 0 14px;
  font-size: 15px;
  outline: none;
}

.login-field input:focus {
  border-color: var(--americana-red);
  box-shadow: 0 0 0 3px rgba(197, 5, 22, 0.18);
}

.login-submit {
  height: 48px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  background: var(--americana-red);
  color: #fff;
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 17px;
  font-weight: 600;
}

.login-submit:hover {
  background: #a8030f;
}

.login-forgot {
  margin: 2px 0 0;
  text-align: center;
}

.login-forgot a {
  color: #d98a8a;
  font-size: 13px;
}

.login-forgot a:hover {
  color: #fff;
}

.login-panel .alert {
  margin: 0;
}

.login-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 12px;
  z-index: 5;
  text-align: center;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}

@media (max-width: 860px) {
  .login-split {
    grid-template-columns: 1fr;
  }
  .login-hero {
    min-height: 32vh;
  }
}

.perm-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin: 8px 0 14px;
}

.checkbox-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  font-weight: 500;
}

.checkbox-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.checkbox-row span {
  font-weight: 500;
}

/* ===== Trucks (new-app chrome, original ledger columns) ===== */
.trucks-table .actions-col {
  width: 88px;
}

.data-table td.num,
.data-table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.truck-unit {
  font-weight: 800;
  color: var(--text);
}

/* Segmented status filter (new-app accent) */
.seg-filter {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0 0 16px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.seg-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 13px;
  border-radius: 6px;
  color: var(--muted);
  font-family: var(--font-eyebrow);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: background 120ms ease, color 120ms ease;
}

.seg-pill:hover {
  color: var(--text);
  background: rgba(14, 41, 74, 0.05);
}

.seg-pill.is-active {
  background: var(--red);
  color: #fff;
  box-shadow: 0 6px 16px rgba(161, 49, 36, 0.25);
}

.seg-count {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(14, 41, 74, 0.08);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.seg-pill.is-active .seg-count {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

/* Driver cell */
.driver-cell {
  min-width: 168px;
}

.driver-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.driver-link:hover .driver-name {
  text-decoration: underline;
}

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  border-radius: 999px;
  /* Clip a child photo to the circle. Without this, and the img rule below, an
     uploaded avatar renders at its natural size and spills across the page —
     the initials fallback hid the gap because text always fit. */
  overflow: hidden;
  background: rgba(161, 49, 36, 0.12);
  color: var(--red);
  font-size: 10px;
  font-weight: 800;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  display: block;
}

.driver-name {
  color: var(--text);
  font-weight: 600;
}

.row-inline-form {
  margin: 0;
  display: block;
}

.assign-select {
  margin-top: 5px;
  max-width: 168px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  padding: 0 6px;
  cursor: pointer;
}

/* Status pill (styled <select>) */
.tpill {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 22px 0 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.02em;
  cursor: pointer;
  background-repeat: no-repeat;
  background-position: right 7px center;
  background-size: 9px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5' fill='none' stroke='%230e294a' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' opacity='.5'/%3E%3C/svg%3E");
}

.tpill.s-in_service {
  background-color: rgba(51, 115, 68, 0.12);
  color: var(--green);
  border-color: rgba(51, 115, 68, 0.28);
}

.tpill.s-out_of_service {
  background-color: rgba(148, 3, 8, 0.12);
  color: var(--bad);
  border-color: rgba(148, 3, 8, 0.26);
}

.tpill.s-archive {
  background-color: #eef2f6;
  color: var(--muted);
  border-color: var(--line);
}

/* Archived collapsible */
.archived {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.archived > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.archived > summary::-webkit-details-marker {
  display: none;
}

.archived > summary:hover {
  background: rgba(14, 41, 74, 0.02);
}

.archived > summary > i:first-child {
  color: var(--red);
}

.arch-title {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  color: var(--text);
  font-size: 15px;
}

.arch-hint {
  color: var(--muted);
  font-size: 12px;
}

.arch-chevron {
  margin-left: auto;
  color: var(--muted);
  transition: transform 150ms ease;
}

.archived[open] .arch-chevron {
  transform: rotate(180deg);
}

.arch-empty {
  padding: 22px 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.archived .table-wrap {
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
}

.archived-row {
  opacity: 0.85;
}

.row-restore {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
}

.row-restore:hover {
  background: rgba(14, 41, 74, 0.05);
}

.button .btn-ico {
  margin-right: 7px;
  font-size: 12px;
}

/* Modal dialogs */
.btn-ghost {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.btn-ghost:hover {
  background: #eef2f6;
  color: var(--text);
}

.modal {
  width: min(560px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 22px;
  background: var(--card);
  color: var(--text);
  box-shadow: 0 30px 80px rgba(14, 41, 74, 0.32);
}

.modal::backdrop {
  background: rgba(14, 41, 74, 0.45);
  backdrop-filter: blur(2px);
}

.modal-sm {
  width: min(420px, calc(100vw - 32px));
}

.modal-head {
  margin-bottom: 16px;
}

.modal-head h2 {
  margin: 0;
  font-size: 20px;
}

.modal-head p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.modal-grid .col-2 {
  grid-column: 1 / -1;
}

.modal-grid label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 800;
  color: #344054;
}

.modal-grid input,
.modal-grid select,
.modal-grid textarea {
  width: 100%;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  padding: 0 10px;
}

.modal-grid textarea {
  height: auto;
  min-height: 54px;
  padding: 8px 10px;
  resize: vertical;
}

.modal-grid input:focus,
.modal-grid select:focus,
.modal-grid textarea:focus {
  outline: none;
  border-color: rgba(180, 35, 47, 0.55);
  box-shadow: 0 0 0 3px rgba(180, 35, 47, 0.1);
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

@media (max-width: 820px) {
  .seg-filter {
    width: 100%;
    overflow-x: auto;
  }

  .arch-hint {
    display: none;
  }

  .modal-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== Truck images (thumbnail + gallery modal) ===== */
.truck-id-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.truck-thumb {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 30px;
  flex: 0 0 auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  overflow: hidden;
}

.truck-thumb.is-empty {
  background: rgba(14, 41, 74, 0.04);
  font-size: 12px;
}

.truck-thumb:hover {
  border-color: rgba(161, 49, 36, 0.55);
}

.truck-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumb-count {
  position: absolute;
  right: -5px;
  top: -6px;
  min-width: 15px;
  height: 15px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  line-height: 15px;
  text-align: center;
}

.images-modal {
  width: min(640px, calc(100vw - 32px));
}

.img-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
  max-height: 340px;
  overflow-y: auto;
}

.img-empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 22px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.img-tile {
  position: relative;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.img-tile img {
  display: block;
  width: 100%;
  height: 100px;
  object-fit: cover;
  background: #f1f4f8;
}

.img-tile figcaption {
  padding: 5px 8px;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.img-type {
  position: absolute;
  left: 6px;
  top: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(14, 41, 74, 0.72);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.img-del-form {
  position: absolute;
  right: 6px;
  top: 6px;
  margin: 0;
}

.img-del {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 999px;
  background: rgba(148, 3, 8, 0.85);
  color: #fff;
  font-size: 11px;
  cursor: pointer;
}

.img-del:hover {
  background: var(--bad);
}

.img-forms {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.img-upload-form,
.img-link-form {
  display: grid;
  gap: 8px;
  align-content: start;
}

.img-forms label {
  display: grid;
  gap: 5px;
  font-size: 12px;
  font-weight: 800;
  color: #344054;
}

.img-forms input[type="file"],
.img-forms input[type="url"],
.img-forms input[type="text"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  padding: 8px 10px;
}

.img-forms input:focus {
  outline: none;
  border-color: rgba(180, 35, 47, 0.55);
  box-shadow: 0 0 0 3px rgba(180, 35, 47, 0.1);
}

.img-forms .button {
  justify-content: center;
}

@media (max-width: 820px) {
  .img-forms {
    grid-template-columns: 1fr;
  }
}

/* ===== Truck image lightbox ===== */
.img-zoom {
  cursor: zoom-in;
}

.lightbox {
  max-width: 96vw;
  max-height: 96vh;
  margin: auto;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: visible;
}

.lightbox::backdrop {
  background: rgba(8, 16, 30, 0.86);
  backdrop-filter: blur(3px);
}

.lightbox img {
  display: block;
  max-width: 96vw;
  max-height: 88vh;
  width: auto;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
}

.lightbox-cap {
  margin: 10px 0 0;
  text-align: center;
  color: rgba(255, 255, 255, 0.92);
  font-size: 13px;
}

.lightbox-close {
  position: absolute;
  top: -14px;
  right: -14px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}

.lightbox-close:hover {
  background: #eef2f6;
}

@media (max-width: 820px) {
  .lightbox-close {
    top: 6px;
    right: 6px;
  }
}

/* ===== Driver documents (compliance + catalog) ===== */
.dd-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin: 0 0 24px;
}

.dd-filter-group {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.dd-field {
  display: grid;
  gap: 6px;
}

.dd-field > span {
  font-family: var(--font-eyebrow);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}

.dd-field select {
  height: 40px;
  min-width: 210px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  padding: 0 10px;
  cursor: pointer;
}

.dd-add .button {
  white-space: nowrap;
}

.dd-compliance {
  margin-bottom: 26px;
}

.dd-compliance .eyebrow,
.dd-documents .eyebrow {
  margin-bottom: 12px;
}

.dd-empty {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--muted);
  text-align: center;
}

.dd-driver {
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.dd-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.dd-summary::-webkit-details-marker {
  display: none;
}

.dd-summary:hover {
  background: rgba(14, 41, 74, 0.02);
}

.dd-driver-name {
  font-weight: 700;
  color: var(--text);
}

.dd-summary-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
}

.dd-progress {
  width: 120px;
  height: 5px;
  border-radius: 999px;
  background: rgba(14, 41, 74, 0.1);
  overflow: hidden;
}

.dd-progress-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--green);
}

.dd-count {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.dd-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.dd-badge.is-missing {
  background: rgba(161, 49, 36, 0.1);
  color: var(--red);
  border-color: rgba(161, 49, 36, 0.25);
}

.dd-badge.is-complete {
  background: rgba(51, 115, 68, 0.12);
  color: var(--green);
  border-color: rgba(51, 115, 68, 0.3);
}

.dd-chevron {
  color: var(--muted);
  font-size: 12px;
  transition: transform 150ms ease;
}

.dd-driver[open] .dd-chevron {
  transform: rotate(180deg);
}

.dd-driver-body {
  padding: 2px 16px 16px;
  border-top: 1px solid var(--line);
}

.dd-section-label {
  margin: 14px 0 8px;
  font-family: var(--font-eyebrow);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}

.dd-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dd-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 12px;
  font-weight: 600;
}

.dd-pill.is-missing {
  background: rgba(161, 49, 36, 0.08);
  color: var(--red);
  border-color: rgba(161, 49, 36, 0.22);
}

.dd-pill.is-done {
  background: rgba(51, 115, 68, 0.1);
  color: var(--green);
  border-color: rgba(51, 115, 68, 0.25);
}

.dd-doc {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.dd-doc > i {
  color: var(--muted);
}

.dd-nofile {
  color: var(--muted);
  font-size: 12px;
}

.modal-opt {
  font-weight: 500;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
}

@media (max-width: 820px) {
  .dd-progress {
    display: none;
  }

  .dd-filter-group,
  .dd-field,
  .dd-field select {
    width: 100%;
    min-width: 0;
  }
}

/* ===== Drivers roster ===== */
.dr-filter {
  position: relative;
  display: flex;
  align-items: center;
  max-width: 440px;
  margin: 0 0 18px;
}

.dr-filter > i {
  position: absolute;
  left: 12px;
  font-size: 13px;
  color: var(--muted);
  pointer-events: none;
}

.dr-filter input {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  padding: 0 12px 0 34px;
  outline: none;
}

.dr-filter input:focus {
  border-color: rgba(180, 35, 47, 0.55);
  box-shadow: 0 0 0 3px rgba(180, 35, 47, 0.1);
}

.dr-table .actions-col {
  width: 300px;
  white-space: nowrap;
}

.dr-truck-cell .assign-select {
  margin-top: 5px;
}

.dr-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.dr-badge.is-available {
  background: rgba(51, 115, 68, 0.14);
  color: var(--green);
}

.dr-badge.is-assigned {
  background: rgba(5, 36, 130, 0.1);
  color: var(--americana-blue);
}

/* N5 — driver auto out-of-service (expired document) */
.dr-badge.is-oos {
  background: rgba(180, 35, 24, 0.12);
  color: #b42318;
}

.dr-linked {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--green);
  font-weight: 700;
  font-size: 13px;
}

.dr-linked > i {
  font-size: 12px;
}

.dr-unlinked {
  color: var(--muted);
  font-size: 13px;
}

.dr-arrow {
  font-size: 10px;
  color: var(--muted);
  margin: 0 3px;
}

.dr-history-modal {
  width: min(680px, calc(100vw - 32px));
}

.dr-history-modal .table-wrap {
  box-shadow: none;
}

/* ===== Drivers — avatar + add-form fields ===== */
.dr-name-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dr-avatar {
  width: 34px;
  height: 34px;
  font-size: 12px;
  overflow: hidden;
}

.dr-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.dr-name-text {
  display: grid;
}

.dr-statezip {
  display: flex;
  gap: 10px;
}

.dr-statezip label {
  display: grid;
  gap: 5px;
}

.dr-state-field {
  flex: 0 0 64px;
}

.dr-zip-field {
  flex: 1;
}

.dr-state-input {
  text-transform: uppercase;
}

.modal-hint {
  margin-top: 2px;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
}

.dr-avatar-field {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.dr-avatar-label {
  display: block;
  font-size: 12px;
  font-weight: 800;
  color: #344054;
  margin-bottom: 8px;
}

.dr-avatar-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.dr-avatar-preview {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: rgba(14, 41, 74, 0.06);
  color: rgba(14, 41, 74, 0.4);
  font-size: 24px;
  overflow: hidden;
}

.dr-avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.dr-avatar-btn {
  gap: 8px;
  cursor: pointer;
}

/* ===== Driver avatar inline in loads table + dispatch cards ===== */
.ld-driver {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.dispatch-meta .dispatch-driver {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.dispatch-meta .dispatch-driver-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===== Maintenance board ===== */
.mt-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.mt-kpi {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  box-shadow: var(--shadow);
  padding: 16px 18px;
}

.mt-kpi-head {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-family: var(--font-eyebrow);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
  font-weight: 600;
}

.mt-kpi-head i {
  color: var(--red);
  font-size: 13px;
}

.mt-kpi strong {
  display: block;
  margin-top: 10px;
  font-family: var(--font-display);
  font-size: 30px;
  letter-spacing: 0.02em;
  color: var(--text);
}

.mt-kpi.is-warn .mt-kpi-head i,
.mt-kpi.is-warn strong {
  color: var(--warning);
}

.mt-reminders {
  margin-bottom: 22px;
}

.mt-reminders .eyebrow {
  margin-bottom: 10px;
}

.mt-reminder-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mt-reminder {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  font-size: 13px;
}

.mt-reminder > i {
  color: var(--warning);
}

.mt-reminder-truck {
  font-weight: 800;
  color: var(--text);
}

.mt-reminder-title {
  color: var(--muted);
}

.mt-reminder-due {
  margin-left: auto;
  font-weight: 700;
  font-size: 12px;
  color: var(--warning);
  white-space: nowrap;
}

.mt-reminder.is-overdue {
  border-color: rgba(148, 3, 8, 0.3);
}

.mt-reminder.is-overdue > i,
.mt-reminder.is-overdue .mt-reminder-due {
  color: var(--bad);
}

.mt-table {
  min-width: 1100px;
}

.mt-table .col-status {
  width: 150px;
}

.mt-table .actions-col {
  width: 112px;
}

.mt-desc {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
}

.mt-archive-cost {
  margin-left: auto;
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.mt-archive .arch-chevron {
  margin-left: 14px;
}

/* Work-order status pill (select) + archive badge */
.wo-status {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 22px 0 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  background-repeat: no-repeat;
  background-position: right 7px center;
  background-size: 9px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5' fill='none' stroke='%230e294a' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' opacity='.5'/%3E%3C/svg%3E");
}

.wo-badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.wo-status.s-open,
.wo-badge.s-open,
.wo-badge.s-cancelled {
  background-color: #eef2f6;
  color: var(--muted);
  border-color: var(--line);
}

.wo-status.s-scheduled {
  background-color: rgba(5, 36, 130, 0.1);
  color: var(--americana-blue);
  border-color: rgba(5, 36, 130, 0.22);
}

.wo-status.s-in_progress {
  background-color: rgba(210, 132, 37, 0.16);
  color: var(--warning);
  border-color: rgba(210, 132, 37, 0.32);
}

.wo-status.s-completed,
.wo-badge.s-completed {
  background-color: rgba(51, 115, 68, 0.14);
  color: var(--green);
  border-color: rgba(51, 115, 68, 0.3);
}

.wo-status.s-cancelled {
  background-color: rgba(148, 3, 8, 0.12);
  color: var(--bad);
  border-color: rgba(148, 3, 8, 0.26);
}

@media (max-width: 1120px) {
  .mt-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .mt-kpis {
    grid-template-columns: 1fr;
  }

  .mt-reminder-title {
    display: none;
  }
}

/* ===== Maintenance modal (who-pays, dropzone) + receipt chips ===== */
.wo-three {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

.wo-three label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 800;
  color: #344054;
}

.wo-pays {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.wo-pays-label {
  display: block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.wo-pays-row {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: wrap;
}

.wo-pays-seg {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.wo-pay-btn {
  border: 0;
  background: transparent;
  padding: 8px 14px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  border-right: 1px solid var(--line);
}

.wo-pay-btn:last-child {
  border-right: 0;
}

.wo-pay-btn.is-active {
  background: var(--text);
  color: #fff;
}

.wo-portion {
  display: grid;
  gap: 5px;
  flex: 1;
  min-width: 140px;
}

.wo-portion > span {
  font-size: 12px;
  font-weight: 800;
  color: #344054;
}

.wo-portion input {
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  padding: 0 10px;
  font: inherit;
  font-size: 14px;
}

.wo-portion input:disabled {
  background: #f1f4f8;
  color: var(--muted);
}

.wo-pay-summary {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.wo-receipt-field {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.wo-receipt-label {
  display: block;
  font-size: 13px;
  font-weight: 800;
  color: #344054;
  margin-bottom: 8px;
}

.wo-dropzone {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border: 1px dashed rgba(14, 41, 74, 0.3);
  border-radius: 8px;
  background: rgba(14, 41, 74, 0.02);
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}

.wo-dropzone:hover {
  border-color: rgba(161, 49, 36, 0.5);
  background: rgba(161, 49, 36, 0.03);
}

.wo-dropzone > i {
  color: var(--red);
}

.wo-file-list {
  display: block;
  margin-top: 6px;
}

.wo-receipts {
  white-space: nowrap;
}

.wo-file {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin: 2px 4px 2px 0;
  padding: 2px 4px 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  max-width: 170px;
}

.wo-file-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--text);
  font-size: 12px;
}

.wo-file-link > i {
  color: var(--muted);
  font-size: 11px;
  flex: 0 0 auto;
}

.wo-file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wo-file-link:hover .wo-file-name {
  text-decoration: underline;
}

.wo-file-x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  flex: 0 0 auto;
}

.wo-file-x:hover {
  background: rgba(148, 3, 8, 0.1);
  color: var(--bad);
}

@media (max-width: 820px) {
  .wo-three {
    grid-template-columns: 1fr;
  }

  .wo-pays-row {
    flex-direction: column;
    align-items: stretch;
  }
}


/* Load appointment-window (ETA) inputs */
.eta-window { border:1px solid var(--line); border-radius:10px; padding:11px 12px; margin-bottom:12px; background:#fbfaf6; }
.eta-window-label { display:block; font-size:12px; font-weight:700; color:var(--text); margin-bottom:8px; }
.eta-blocks { display:flex; flex-wrap:wrap; gap:6px; margin-bottom:10px; }
.eta-block { border:1px solid var(--line); background:#fff; border-radius:999px; padding:5px 11px; font-size:12px; font-weight:700; color:#344054; cursor:pointer; }
.eta-block:hover { background:#eef2f6; }
.eta-block.is-on { background:var(--brand,#0e294a); color:#fff; border-color:var(--brand,#0e294a); }


/* Radio option card (settings toggles with a description) */
.radio-card { display:flex; gap:11px; align-items:flex-start; border:1px solid var(--line); border-radius:10px;
              padding:12px 13px; margin-bottom:10px; cursor:pointer; background:#fff; }
.radio-card:hover { border-color:#b7c1d1; }
.radio-card input[type="radio"] { margin-top:3px; flex:none; }
.radio-card:has(input:checked) { border-color:var(--brand,#0e294a); box-shadow:0 0 0 2px rgba(14,41,74,.08); }
.radio-card strong { display:block; font-size:13.5px; }
.radio-card small { display:block; font-size:12.5px; color:var(--muted,#66707f); margin-top:3px; line-height:1.5; }


/* Inline "add new contact" disclosure on the load form (N1) */
.new-contact { border:1px dashed var(--line,#d9d4c7); border-radius:9px; padding:0 12px; margin:-2px 0 4px; background:#fbfaf6; }
.new-contact[open] { padding:0 12px 12px; }
.new-contact summary { cursor:pointer; list-style:none; padding:9px 0; font-size:12.5px; font-weight:700; color:var(--brand,#0e294a); }
.new-contact summary::-webkit-details-marker { display:none; }
.new-contact summary i { margin-right:6px; }
.new-contact input[type=text], .new-contact input[type=email] { width:100%; height:38px; border:1px solid var(--line,#d9d4c7); border-radius:7px; padding:0 10px; background:#fff; font:inherit; margin-bottom:8px; }
.checkbox-inline { display:flex; align-items:center; gap:8px; font-size:12.5px; color:var(--text-muted,#51607a); }
.checkbox-inline input { flex:none; }

/* N2 — repeatable vehicle/unit rows on the load form */
.vehicle-row { border:1px solid var(--line,#d9d4c7); border-radius:9px; padding:12px; margin-bottom:10px; background:#fbfaf6; }
.vehicle-row-head { display:flex; align-items:center; justify-content:space-between; margin-bottom:8px; }
.vehicle-row-title { font-size:12px; font-weight:800; letter-spacing:.03em; text-transform:uppercase; color:var(--brand,#0e294a); }
.vehicle-remove { border:0; background:transparent; color:var(--text-muted,#51607a); font-size:20px; line-height:1; cursor:pointer; padding:0 4px; border-radius:6px; }
.vehicle-remove:hover { color:#b42318; background:#fbeae8; }
.vehicle-add { margin-bottom:4px; }

/* N3 — per-load documents (releases / gate passes) on the load edit modal */
.load-docs { margin-top:18px; padding-top:16px; border-top:1px solid var(--line,#d9d4c7); }
.load-docs .form-section-title .muted { font-weight:400; }
.load-doc-list { list-style:none; margin:0 0 12px; padding:0; display:flex; flex-direction:column; gap:6px; }
.load-doc-list li { display:flex; align-items:center; gap:10px; padding:8px 10px; border:1px solid var(--line,#d9d4c7); border-radius:8px; background:#fbfaf6; }
.load-doc-open { display:flex; align-items:center; gap:8px; flex:1; min-width:0; text-decoration:none; color:var(--brand,#0e294a); font-weight:600; font-size:13px; }
.load-doc-open i { color:var(--brand,#0e294a); }
.load-doc-name { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.load-doc-size { font-size:11px; color:var(--text-muted,#51607a); white-space:nowrap; }
.load-doc-del { margin:0; }
.load-doc-remove { border:0; background:transparent; color:var(--text-muted,#51607a); font-size:18px; line-height:1; cursor:pointer; padding:0 4px; border-radius:6px; }
.load-doc-remove:hover { color:#b42318; background:#fbeae8; }
.load-doc-empty { font-size:12.5px; margin:0 0 12px; }
.load-doc-upload { border:1px dashed var(--line,#d9d4c7); border-radius:9px; padding:12px; background:#fbfaf6; }
.load-doc-upload-row { display:grid; grid-template-columns:minmax(0,160px) 1fr; gap:10px; }
.load-doc-upload input[type=file] { font:inherit; font-size:12.5px; }
@media (max-width:560px){ .load-doc-upload-row { grid-template-columns:1fr; } }

/* N4 — invoice "send to customer" panel + list indicators */
.invoice-send { margin-top:18px; padding-top:16px; border-top:1px solid var(--line,#d9d4c7); }
.invoice-sent-note { display:flex; align-items:center; gap:8px; font-size:12.5px; color:var(--green,#14804a); background:rgba(20,128,74,.08); border-radius:8px; padding:8px 10px; margin:0 0 12px; }
.invoice-emailed { display:inline-flex; align-items:center; gap:5px; margin-top:4px; color:var(--muted,#51607a); font-size:11px; }
.invoice-emailed i { font-size:10px; }

/* N6.4 — driver capture trail on the load edit modal */
.load-capture { margin-top:18px; padding-top:16px; border-top:1px solid var(--line,#d9d4c7); }
.load-cap-stage { border:1px solid var(--line,#d9d4c7); border-radius:9px; padding:10px 12px; margin-bottom:10px; background:#fbfaf6; }
.load-cap-stage-head { display:flex; justify-content:space-between; align-items:center; font-size:13px; margin-bottom:8px; }
.load-cap-stage-head span { font-size:11px; color:var(--text-muted,#51607a); }
.load-cap-thumbs { display:flex; flex-wrap:wrap; gap:6px; margin-bottom:8px; }
.load-cap-thumbs img { width:56px; height:56px; object-fit:cover; border-radius:6px; border:1px solid var(--line,#d9d4c7); display:block; }
.load-cap-sigs { display:flex; flex-wrap:wrap; gap:14px; font-size:12px; color:#344054; }
.load-cap-sig a { margin-left:4px; }
.load-cap-exc { font-size:11.5px; color:#b42318; margin:6px 0 0; }

/* F4.3 — ETA / on-time performance report tables */
.reports-eta-tables { display:grid; grid-template-columns:1fr 1fr; gap:18px; align-items:start; }
@media (max-width:900px){ .reports-eta-tables { grid-template-columns:1fr; } }
