:root {
  --bg: #eef1f4;
  --bg-accent: #e4e9ee;
  --panel: #ffffff;
  --ink: #161a1f;
  --muted: #5c6670;
  --line: #d5dce0;
  --brand: #c8102e;
  --brand-2: #a10d25;
  --good: #1f6b4a;
  --green: #2f7d4f;
  --amber: #a66b12;
  --red: #c8102e;
  --late: #7a0f1c;
  --sidebar: #0b0d10;
  --sidebar-ink: #f2f4f6;
  --shadow: 0 8px 22px rgba(16, 22, 28, 0.07);
  --radius: 12px;
  --font: "DM Sans", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --sidebar-width: 240px;
  --topbar-height: 56px;
  --bottom-nav-height: 64px;
}

* { box-sizing: border-box; }

html {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1100px 520px at 8% -12%, rgba(200, 16, 46, 0.05) 0%, transparent 55%),
    radial-gradient(900px 480px at 100% 0%, rgba(22, 26, 31, 0.035) 0%, transparent 48%),
    linear-gradient(180deg, var(--bg), var(--bg-accent));
  min-height: 100vh;
  max-width: 100%;
  overflow-x: hidden;
}

body.mobile-nav-open {
  overflow: hidden;
}

a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.icon {
  display: inline-block;
  width: 1.05em;
  height: 1.05em;
  flex-shrink: 0;
  vertical-align: -0.15em;
}

.shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

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

.sidebar {
  background: #0b0d10;
  color: var(--sidebar-ink);
  padding: 18px 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 4px 8px 8px;
}

.brand-logo {
  width: 42px;
  height: auto;
  display: block;
  flex-shrink: 0;
  background: #000;
  border-radius: 10px;
  padding: 5px;
  box-sizing: border-box;
  object-fit: contain;
}

.brand-logo-sm {
  width: 32px;
  padding: 3px;
  border-radius: 8px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #000;
  color: #f2f4f6;
  font-weight: 700;
  display: grid;
  place-items: center;
  letter-spacing: 0.02em;
}

.brand-name { font-weight: 700; font-size: 0.98rem; }
.brand-sub {
  opacity: 0.68;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-section-label {
  margin: 10px 10px 4px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(242, 244, 246, 0.42);
}

.nav a,
.nav .nav-link {
  color: var(--sidebar-ink);
  padding: 8px 10px;
  border-radius: 10px;
  text-decoration: none;
  opacity: 0.88;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.92rem;
  font-weight: 500;
  min-height: 40px;
}

.nav a .icon,
.nav .nav-link .icon {
  width: 18px;
  height: 18px;
  opacity: 0.9;
}

.nav a:hover,
.nav a.active,
.nav .nav-link:hover,
.nav .nav-link.active {
  background: rgba(200, 16, 46, 0.22);
  opacity: 1;
  text-decoration: none;
}

.nav a.active,
.nav .nav-link.active {
  background: rgba(200, 16, 46, 0.28);
  box-shadow: inset 3px 0 0 var(--brand);
  font-weight: 600;
}

.nav-link-signout {
  margin-top: 8px;
}

.sidebar-foot {
  margin-top: auto;
  font-size: 0.75rem;
  opacity: 0.58;
  line-height: 1.4;
  padding: 8px 10px;
}

/* Desktop premium top bar */
.desktop-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: var(--topbar-height);
  padding: 8px 24px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 40;
}

.desktop-search {
  position: relative;
  flex: 1 1 auto;
  max-width: 420px;
}

.desktop-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.desktop-search input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px 8px 36px;
  font: inherit;
  background: #f7f9fb;
  color: var(--ink);
}

.desktop-search input:focus {
  outline: 2px solid rgba(200, 16, 46, 0.35);
  outline-offset: 1px;
  background: #fff;
}

.desktop-topbar-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.system-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #eaf7ef;
  color: var(--good);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.system-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22a45a;
  box-shadow: 0 0 0 3px rgba(34, 164, 90, 0.18);
}

.alert-bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-decoration: none;
}

.alert-bell:hover { text-decoration: none; background: #f7f9fb; }
.alert-bell:focus-visible {
  outline: 2px solid rgba(200, 16, 46, 0.45);
  outline-offset: 2px;
}

.alert-bell-count {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.staff-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
}

.staff-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #161a1f;
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 0.7rem;
  font-weight: 700;
}

.staff-chip-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.staff-chip-name {
  font-size: 0.8rem;
  font-weight: 700;
}

.staff-chip-role {
  font-size: 0.68rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Mobile top bar + drawer — hidden on desktop */
.mobile-topbar,
.mobile-nav-backdrop {
  display: none;
}

.mobile-bottom-nav {
  display: none;
}

.mobile-nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  min-width: 44px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.12);
  color: var(--sidebar-ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.mobile-nav-toggle-bars {
  width: 18px;
  height: 12px;
  display: inline-block;
  background:
    linear-gradient(var(--sidebar-ink), var(--sidebar-ink)) 0 0 / 100% 2px no-repeat,
    linear-gradient(var(--sidebar-ink), var(--sidebar-ink)) 0 5px / 100% 2px no-repeat,
    linear-gradient(var(--sidebar-ink), var(--sidebar-ink)) 0 10px / 100% 2px no-repeat;
}

.main {
  padding: 20px 24px 40px;
  min-width: 0;
  background: transparent;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 14px;
}

.page-kicker {
  margin: 0 0 2px;
  color: var(--brand);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.trips-page-head h1 {
  font-size: 1.65rem;
}

.trips-page-head .lede {
  max-width: 62ch;
  font-size: 0.92rem;
}

h1 {
  margin: 0 0 4px;
  font-size: 1.7rem;
  letter-spacing: -0.02em;
}

h2 {
  margin: 0 0 12px;
  font-size: 1.1rem;
}

.lede {
  margin: 0;
  color: var(--muted);
  max-width: 54ch;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 9px 12px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
}

.btn:hover { text-decoration: none; filter: brightness(0.98); }
.btn:focus-visible {
  outline: 2px solid rgba(200, 16, 46, 0.45);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

.btn-primary:hover {
  background: var(--brand-2);
  border-color: var(--brand-2);
  filter: none;
}

.btn-ghost {
  background: transparent;
  border-color: var(--line);
}

.btn-small {
  padding: 6px 10px;
  font-size: 0.85rem;
}

.btn-danger {
  background: #fff5f6;
  border-color: #e7b4ba;
  color: var(--red);
}

.alert-banner.ok {
  background: #e8f6ee;
  border-color: #a8d4b8;
  color: var(--good);
  animation: none;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.segmented,
.tabs {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.segmented a,
.tabs a {
  padding: 7px 11px;
  color: var(--ink);
  text-decoration: none;
  border-right: 1px solid var(--line);
  font-weight: 500;
  font-size: 0.88rem;
}

.segmented a:last-child,
.tabs a:last-child { border-right: 0; }

.segmented a.active,
.tabs a.active {
  background: var(--brand);
  color: #fff;
}

.tabs {
  margin-bottom: 14px;
}

.tabs em {
  font-style: normal;
  opacity: 0.75;
  margin-left: 4px;
}

.trips-filters {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.filter-group {
  align-items: center;
  gap: 10px;
  margin-bottom: 0;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
}

.filter-group-label,
.filter-inline-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  min-width: 72px;
}

.filter-inline-label {
  margin-left: 6px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.summary-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow: var(--shadow);
  min-width: 0;
}

.summary-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.summary-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #f3f5f7;
  color: var(--ink);
}

.summary-icon .icon {
  width: 15px;
  height: 15px;
}

.summary-card-alert {
  border-color: #e7b4ba;
  background: linear-gradient(180deg, #fff7f8, #ffffff);
}

.summary-card-alert .summary-icon {
  background: #fde8eb;
  color: var(--brand);
}

.summary-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.summary-value {
  margin-top: 4px;
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.summary-meta {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.74rem;
}

.ops-filter-link {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
}

.ops-filter-link .icon {
  width: 14px;
  height: 14px;
}

.source-whatsapp { color: #25d366; }
.ops-filter-link.active .source-whatsapp { color: #fff; }

.week-nav {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 12px;
  font-weight: 600;
}

.week-nav a { color: var(--brand); text-decoration: none; }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 0.9rem;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
}

.dot.good,
.dot.normal { background: #8aa3b5; }
.dot.green { background: var(--green); }
.dot.amber { background: var(--amber); }
.dot.red { background: var(--red); }
.dot.late { background: var(--late); }

.alert-banner {
  background: linear-gradient(90deg, #f8e4e6, #fff5f5);
  border: 1px solid #e7b4ba;
  color: var(--late);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
  animation: pulse-border 1.8s ease-in-out infinite;
}

.alert-banner.warn {
  background: #fff7e8;
  border-color: #e5c48a;
  color: #7a4d00;
  animation: none;
}

.alert-banner strong { margin-right: 10px; }

.alert-banner ul {
  margin: 10px 0 0;
  padding-left: 18px;
}

@keyframes pulse-border {
  0%, 100% { box-shadow: 0 0 0 0 rgba(161, 31, 44, 0.15); }
  50% { box-shadow: 0 0 0 6px rgba(161, 31, 44, 0.08); }
}

.day-block {
  margin-bottom: 28px;
}

.day-block h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
}

.table-wrap {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: auto;
  box-shadow: var(--shadow);
}

table.loads {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}

/* Desktop Trips: 9 info columns; actions sit on a full-width row below each load. */
table.loads.trips-table {
  width: 100%;
  min-width: 1040px;
  table-layout: auto;
  font-size: 13px;
}

table.loads.trips-table th,
table.loads.trips-table td {
  padding: 6px 8px;
  font-size: 12.5px;
  overflow-wrap: normal;
  word-break: normal;
}

table.loads.trips-table th {
  white-space: nowrap;
}

/* Fixed minimum widths; Route + Assignment absorb remaining space. */
table.loads.trips-table th:nth-child(1),
table.loads.trips-table tr.trip-info-row td:nth-child(1) { min-width: 110px; width: 110px; }   /* VRID */
table.loads.trips-table th:nth-child(2),
table.loads.trips-table tr.trip-info-row td:nth-child(2) { min-width: 120px; width: 120px; }   /* Company */
table.loads.trips-table th:nth-child(3),
table.loads.trips-table tr.trip-info-row td:nth-child(3) { min-width: 130px; width: 130px; }   /* Check-in */
table.loads.trips-table th:nth-child(4),
table.loads.trips-table tr.trip-info-row td:nth-child(4) { min-width: 90px; width: 90px; }     /* Time Left */
table.loads.trips-table th:nth-child(5),
table.loads.trips-table tr.trip-info-row td:nth-child(5) { min-width: 160px; width: auto; }    /* Route (flexible) */
table.loads.trips-table th:nth-child(6),
table.loads.trips-table tr.trip-info-row td:nth-child(6) { min-width: 160px; width: auto; }    /* Assignment (flexible) */
table.loads.trips-table th:nth-child(7),
table.loads.trips-table tr.trip-info-row td:nth-child(7) { min-width: 90px; width: 90px; }     /* Alert */
table.loads.trips-table th:nth-child(8),
table.loads.trips-table tr.trip-info-row td:nth-child(8) { min-width: 120px; width: 120px; }   /* Rates */
table.loads.trips-table th:nth-child(9),
table.loads.trips-table tr.trip-info-row td:nth-child(9) { min-width: 110px; width: 110px; }   /* Status */

.trips-desktop {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Info row sits tight against its action row. */
table.loads.trips-table tr.trip-info-row td {
  border-bottom: none;
  padding-bottom: 2px;
}

table.loads.trips-table tr.trip-info-row {
  background: #fff;
}

table.loads.trips-table tr.trip-info-row:nth-child(4n+1) {
  background: #fbfcfd;
}

table.loads.trips-table .trip-vrid {
  font-weight: 700;
  color: var(--brand);
  text-decoration: none;
}

table.loads.trips-table .trip-vrid:hover {
  text-decoration: underline;
}

table.loads.trips-table .route {
  font-size: 13px;
  font-weight: 700;
}

table.loads.trips-table .source-chip,
.source-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
}

.pill-icon {
  width: 12px;
  height: 12px;
  margin-right: 2px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  background: #eef2f5;
  color: var(--ink);
}

.status-badge.status-in-transit,
.status-badge.status-checked-in {
  background: #e4f5ea;
  color: var(--good);
}

.status-badge.status-upcoming {
  background: #e8eef8;
  color: #355064;
}

.status-badge.status-completed {
  background: #edf1f4;
  color: var(--muted);
}

table.loads.trips-table tr.row-urgent.trip-info-row td:first-child,
table.loads.trips-table tr.row-red.trip-info-row td:first-child,
table.loads.trips-table tr.row-late.trip-info-row td:first-child {
  box-shadow: inset 3px 0 0 var(--brand);
}

/* Full-width action strip under each load. */
table.loads.trips-table tr.trip-actions-row td {
  padding-top: 4px;
  padding-bottom: 6px;
  border-top: 1px solid rgba(15, 35, 55, 0.06);
  background: rgba(245, 247, 249, 0.95);
  vertical-align: middle;
}

table.loads.trips-table .trip-row-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  max-width: 100%;
}

table.loads.trips-table .trip-row-actions .btn,
table.loads.trips-table .trip-row-actions .btn-small,
table.loads.trips-table .trip-row-actions button {
  white-space: nowrap;
  width: auto;
  flex: 0 0 auto;
  box-sizing: border-box;
  text-align: center;
  padding: 4px 10px;
  font-size: 0.78rem;
  line-height: 1.2;
}

table.loads.trips-table .pill {
  padding: 2px 6px;
  font-size: 0.72rem;
  white-space: nowrap;
}

table.loads.trips-table .muted {
  font-size: 0.8rem;
  margin-top: 1px;
}

table.loads.trips-table .route {
  font-size: 13px;
}

table.loads.trips-table .checkin-cell,
table.loads.trips-table .rates-cell {
  white-space: nowrap;
}

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

table.loads th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: #f3f6f8;
}

.mono { font-family: var(--mono); font-size: 0.92rem; }
.muted { color: var(--muted); font-size: 0.85rem; margin-top: 2px; }
.route { font-weight: 600; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: #e8eef2;
  color: var(--ink);
}

.pill-good { background: #d9e3ea; color: #355064; }
.pill-green { background: #d7efe2; color: var(--good); }
.pill-amber { background: #f7e7c6; color: var(--amber); }
.pill-red { background: #f6d5d9; color: var(--red); }
.pill-late { background: #e8c5cc; color: var(--late); }
.pill-checked-in,
.pill-in-transit { background: #dcecf5; color: var(--brand); }
.pill-completed { background: #e5e9ed; color: #44515c; }
.pill-normal { background: #e8eef2; color: var(--muted); }

.row-urgent {
  background: #fff1f2;
}

.row-late { background: #f8e8eb; }
.row-red { background: #fff5f6; }
.row-amber { background: #fffaf0; }

.actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.actions form { margin: 0; }

.empty,
.empty-cell {
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  max-width: 860px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}

.form-grid label,
.form-stack label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 600;
  font-size: 0.92rem;
}

.form-grid .full { grid-column: 1 / -1; }
.hidden { display: none !important; }

input,
select {
  font: inherit;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
}

.form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 4px;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 420px;
}

.auth-panel {
  max-width: 460px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}

.section-title {
  margin: 28px 0 12px;
}

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

.meta-line {
  color: var(--muted);
  font-size: 0.92rem;
  margin: 0 0 18px;
}

.meta-line code,
.mono {
  font-family: var(--mono);
  font-size: 0.85em;
}

.conn-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}

.conn-panel,
.review-panel {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}

.conn-panel h2,
.review-panel h2 {
  margin: 0 0 6px;
}

.conn-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
  margin: 16px 0 18px;
}

.conn-meta dt {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.conn-meta dd {
  margin: 2px 0 0;
  font-weight: 600;
}

.review-panel {
  margin-bottom: 22px;
}

.review-head {
  margin-bottom: 12px;
}

.email-excerpt {
  background: #f0f4f7;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.45;
  margin: 0 0 16px;
}

@media (max-width: 900px) {
  .shell {
    grid-template-columns: 1fr;
    padding-top: 56px;
    padding-bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px));
  }
  .desktop-topbar {
    display: none;
  }
  .mobile-topbar {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 300;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 56px;
    padding: 8px 12px;
    padding-top: calc(8px + env(safe-area-inset-top, 0px));
    background: #0b0d10;
    color: var(--sidebar-ink);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  }
  .mobile-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
  }
  .mobile-brand .brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    font-size: 0.85rem;
  }
  .mobile-brand .brand-logo {
    width: 32px;
  }
  .mobile-brand-text .brand-name {
    font-size: 0.95rem;
    white-space: nowrap;
  }
  .mobile-page-title {
    flex: 1 1 auto;
    text-align: center;
    font-weight: 700;
    font-size: 0.95rem;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .mobile-nav-toggle-label {
    display: none;
  }
  .mobile-nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 350;
    background: rgba(15, 30, 42, 0.45);
  }
  .mobile-nav-backdrop[hidden] {
    display: none !important;
  }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(300px, 86vw);
    z-index: 400;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    overflow-y: auto;
    box-shadow: 8px 0 28px rgba(0, 0, 0, 0.45);
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  }
  .sidebar.is-open {
    transform: translateX(0);
  }
  .nav {
    flex-direction: column;
    flex-wrap: nowrap;
  }
  .nav a {
    min-height: 44px;
    display: flex;
    align-items: center;
    padding: 12px 14px;
  }
  .sidebar-foot { display: none; }
  .main { padding: 16px 14px calc(24px + var(--bottom-nav-height)); }
  .form-grid { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; }
  .conn-grid { grid-template-columns: 1fr; }
  .conn-meta { grid-template-columns: 1fr; }

  .mobile-bottom-nav {
    display: grid;
    grid-template-columns: 1fr 1fr 64px 1fr 1fr;
    align-items: end;
    gap: 2px;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 320;
    min-height: var(--bottom-nav-height);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
    background: rgba(11, 13, 16, 0.96);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
  }
  .mbnav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 44px;
    padding: 4px 2px;
    border: 0;
    background: transparent;
    color: rgba(242, 244, 246, 0.72);
    font: inherit;
    font-size: 0.68rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
  }
  .mbnav-item .icon {
    width: 20px;
    height: 20px;
  }
  .mbnav-item.active {
    color: #fff;
  }
  .mbnav-item.active .icon {
    color: var(--brand);
  }
  .mbnav-item:hover,
  .mbnav-item:focus-visible {
    text-decoration: none;
    color: #fff;
  }
  .mbnav-fab {
    width: 54px;
    height: 54px;
    margin: 0 auto 8px;
    border-radius: 50%;
    background: var(--brand);
    color: #fff;
    display: grid;
    place-items: center;
    text-decoration: none;
    box-shadow: 0 8px 20px rgba(200, 16, 46, 0.4);
    transform: translateY(-10px);
  }
  .mbnav-fab:hover,
  .mbnav-fab:focus-visible {
    text-decoration: none;
    filter: brightness(1.05);
    outline: 2px solid #fff;
    outline-offset: 2px;
  }
  .mbnav-fab-icon {
    width: 24px;
    height: 24px;
    stroke-width: 2.4;
  }
}

/* Phase 2.5 — assignment foundation */
.page-head-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.filters-bar {
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}

.inline-filters {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.inline-filters label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.8rem;
  color: var(--muted);
}

.inline-filters select {
  min-width: 140px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  font: inherit;
}

.row-unassigned {
  background: rgba(166, 107, 18, 0.08);
}

.row-unassigned td:first-child {
  box-shadow: inset 3px 0 0 var(--amber);
}

.dot.unassigned {
  background: var(--amber);
}

.pill-assign-unassigned {
  background: #f3e6c8;
  color: #7a5310;
}

.pill-assign-own-truck {
  background: #d9ebe1;
  color: var(--good);
}

.pill-assign-brokered {
  background: #dce7f2;
  color: var(--brand);
}

.form-card {
  max-width: 640px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 14px;
}

.form-card label {
  display: grid;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 600;
}

.form-card .field-hint {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted, #5b6b7c);
}

.form-card .external-trailer-fields {
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: rgba(248, 250, 252, 0.9);
}

.form-card .check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.form-card .check input {
  width: auto;
}

.form-card input,
.form-card select,
.form-card textarea {
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

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

.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.flash {
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-weight: 500;
}

.flash-ok {
  background: #d9ebe1;
  color: var(--good);
}

.flash-err {
  background: #f3d6da;
  color: var(--red);
}

.history-list {
  margin: 0;
  padding-left: 18px;
  font-size: 0.85rem;
}

.row-active-assign {
  background: rgba(31, 107, 74, 0.06);
}

.inline-admin {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 6px;
}

.inline-admin input {
  max-width: 140px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  font-size: 0.85rem;
}

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

/* Non-Amazon / multi-channel ops */
.form-card-wide { max-width: 820px; }
.ops-filters { flex-wrap: wrap; }
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.detail-card {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.detail-card h2 {
  margin: 0 0 12px;
  font-size: 1rem;
}
.detail-dl {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 8px 12px;
  margin: 0;
}
.detail-dl dt {
  color: var(--muted);
  font-size: 0.82rem;
}
.detail-dl dd { margin: 0; font-weight: 600; }
.attach-form { margin-bottom: 18px; max-width: 720px; }
@media (max-width: 900px) {
  .detail-grid { grid-template-columns: 1fr; }
  .detail-dl { grid-template-columns: 1fr; }
}

/* Master Locations */
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.loc-toolbar { gap: 10px; flex-wrap: wrap; }
.loc-search-input { min-width: 220px; flex: 1; }
.loc-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin: 0 0 28px;
  padding: 18px 20px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.loc-stats {
  display: flex;
  gap: 28px;
  margin: 12px 0 16px;
  flex-wrap: wrap;
}
.stat-n {
  display: block;
  font-size: 1.4rem;
  font-weight: 700;
  font-family: var(--mono);
  color: var(--brand);
}
.loc-history h2,
.loc-admin-actions h2 {
  margin: 0 0 12px;
  font-size: 1.1rem;
}
.unknown-card { margin-bottom: 18px; }
.unknown-head {
  display: flex;
  gap: 14px;
  align-items: baseline;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.unknown-code { font-size: 1.15rem; font-weight: 700; }
.loc-field { position: relative; }
.loc-typeahead { position: relative; }
.loc-typeahead-list {
  position: absolute;
  z-index: 40;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  max-height: 260px;
  overflow: auto;
  padding: 6px;
}
.loc-typeahead-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  color: var(--ink);
}
.loc-typeahead-item:hover,
.loc-typeahead-item:focus {
  background: #e8f1f6;
  outline: none;
}
.loc-typeahead-create {
  color: var(--brand-2);
  font-weight: 600;
  border-top: 1px solid var(--line);
  margin-top: 4px;
  border-radius: 0 0 8px 8px;
}
.loc-typeahead-selected {
  margin-top: 6px;
  font-size: 0.85rem;
}
.loc-typeahead-hint {
  padding: 6px 10px;
  font-size: 0.8rem;
  border-bottom: 1px solid var(--border, #ddd);
}
@media (max-width: 900px) {
  .loc-meta { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .loc-meta { grid-template-columns: 1fr; }
}

/* ---- Fleet Availability ---- */
.fleet-filters {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  align-items: end;
  margin: 0 0 20px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.fleet-filters label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.8rem;
  color: var(--muted);
}
.fleet-filters label.check {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding-bottom: 8px;
}
.fleet-filters input,
.fleet-filters select {
  font: inherit;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.stack-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.stack-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
  color: var(--muted);
}
.stack-form input,
.stack-form select {
  font: inherit;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.correct-pop {
  position: relative;
}
.correct-pop > summary {
  list-style: none;
  cursor: pointer;
}
.correct-pop > summary::-webkit-details-marker { display: none; }
.correct-form {
  position: absolute;
  right: 0;
  z-index: 5;
  min-width: 240px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.correct-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.8rem;
  color: var(--muted);
}
.correct-form input,
.correct-form select {
  font: inherit;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.recommend-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 12px;
}
.recommend-grid .big {
  font-size: 1.25rem;
  font-weight: 600;
  margin-top: 4px;
}
.list-tight {
  margin: 0 0 16px;
  padding-left: 18px;
}
.banner.good {
  background: #e6f4ec;
  color: var(--good);
  border: 1px solid #b7dcc6;
  padding: 10px 14px;
  border-radius: 10px;
  margin-bottom: 14px;
}
.banner.bad,
.banner.warn {
  background: #f8ecee;
  color: var(--red);
  border: 1px solid #e0b8be;
  padding: 10px 14px;
  border-radius: 10px;
  margin-bottom: 14px;
}
.banner.warn {
  background: #faf3e6;
  color: var(--amber);
  border-color: #e8d2a8;
}
@media (max-width: 800px) {
  .grid-2 { grid-template-columns: 1fr; }
  .recommend-grid { grid-template-columns: 1fr; }
}

/* Fleet board — simple operational badges */
.panel-company { border-left: 4px solid var(--brand-2); }
.panel-leased { border-left: 4px solid var(--amber); }
.panel-external { border-left: 4px solid #8a4b2a; }
.trailer-row.trailer-overdue { background: #fdf2f3; }
.pill-external,
.pill-own-carrier {
  background: #f3e6dc;
  color: #6b3a1f;
  margin-left: 4px;
  font-size: 0.72rem;
}
.pill-leased,
.pill-own-leased {
  background: #f7edd8;
  color: #7a5410;
  margin-left: 4px;
  font-size: 0.72rem;
}
.pill-own-company {
  background: #dcecf5;
  color: var(--brand);
  margin-left: 4px;
  font-size: 0.72rem;
}
.pill-own-review,
.pill-ownership-required {
  background: #f3e3c8;
  color: #8a5a12;
  margin-left: 4px;
  font-size: 0.72rem;
}
.trailer-ownership-required {
  background: rgba(243, 227, 200, 0.35);
}
.pill-return {
  background: #f7e7c6;
  color: var(--amber);
  margin-left: 6px;
  font-size: 0.72rem;
}
.pill-empty { background: #e8eef2; color: var(--muted); }
.pill-loaded { background: #dcecf5; color: var(--brand); }
.pill-fleet-available { background: #d7efe2; color: var(--good); }
.pill-fleet-assigned { background: #dcecf5; color: var(--brand); }
.pill-fleet-in-transit { background: #f7e7c6; color: var(--amber); }
.pill-fleet-maintenance,
.pill-fleet-out-of-service { background: #f6d5d9; color: var(--red); }
.pill-fleet-unknown,
.pill-fleet-off-duty,
.pill-fleet-home { background: #e8eef2; color: var(--muted); }

.pill-motive-live { background: #d7efe2; color: var(--good); }
.pill-motive-recent { background: #dcecf5; color: var(--brand); }
.pill-motive-stale { background: #f7e7c6; color: var(--amber); }
.pill-motive-not-linked { background: #e8eef2; color: var(--muted); }
.pill-motive-motive-offline,
.pill-motive-offline { background: #f6d5d9; color: var(--red); }
.pill-motive-motive-not-configured,
.pill-motive-not-configured { background: #e8eef2; color: var(--muted); }

.motive-fleet-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border, #d5dee5);
  border-radius: 6px;
  background: linear-gradient(180deg, #f7fafc 0%, #eef3f7 100%);
}
.motive-fleet-status-title {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.15rem;
}
.motive-fleet-status-message {
  font-size: 0.95rem;
  color: var(--text, #1a2430);
}
.motive-fleet-status-live {
  color: var(--brand, #1f5f8b);
  font-weight: 600;
}
.motive-fleet-status.is-failed .motive-fleet-status-message {
  color: var(--red, #a12834);
}
.motive-fleet-status.is-success .motive-fleet-status-message {
  color: var(--good, #1f6b45);
}
.motive-fleet-status-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.motive-fleet-status-actions [hidden] {
  display: none !important;
}

.flash-warn {
  background: #f7e7c6;
  color: #6a4e16;
  border: 1px solid #e6d2a8;
  padding: 0.65rem 0.85rem;
  border-radius: 6px;
  margin-bottom: 0.85rem;
}
.warn-inline {
  color: var(--amber);
  font-size: 0.75rem;
  margin-top: 4px;
}
.fleet-toolbar .inline-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
}
.fleet-toolbar .check-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--muted);
  padding-bottom: 8px;
}
.fleet-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.inline-action { display: inline; margin: 0; }
.suggest-reason {
  margin: 8px 0 16px;
  line-height: 1.45;
}
.suggest-alts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.suggest-alts li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.suggest-alts li:last-child { border-bottom: 0; }
.form-section-title {
  margin: 8px 0 4px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  grid-column: 1 / -1;
}
.field-hint {
  display: block;
  margin-top: 4px;
  font-size: 0.8rem;
  color: var(--muted);
}
.assign-card-wide {
  max-width: 860px;
}
.assign-block {
  margin: 8px 0 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.55);
}
@media (max-width: 800px) {
  .suggest-alts li { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 900px) {
  .fleet-actions {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 6px;
  }
  .fleet-actions .btn,
  .fleet-actions .inline-action .btn {
    flex: 1 1 calc(33.33% - 6px);
    min-width: 7.5rem;
    min-height: 44px;
    white-space: nowrap;
  }
  .fleet-toolbar .inline-filters {
    width: 100%;
  }
  .fleet-toolbar .inline-filters label {
    flex: 1 1 100%;
  }
  .fleet-toolbar .inline-filters input,
  .fleet-toolbar .inline-filters select {
    width: 100%;
    min-width: 0;
  }
  .fleet-toolbar .fleet-filter-apply-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
    align-items: center;
  }
  .filters-bar .segmented {
    display: flex;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .filters-bar .segmented a {
    flex: 0 0 auto;
    white-space: nowrap;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
  .page-head-actions {
    width: 100%;
  }
  .page-head-actions .btn,
  .page-head-actions .inline-action .btn {
    flex: 1 1 calc(50% - 8px);
    min-height: 44px;
    white-space: nowrap;
  }
}

/* Phase 5A — carrier assignment + mobile Trips cards */
.carrier-driver-name {
  font-weight: 700;
}
.carrier-company-name {
  margin-top: 2px;
}
.rates-cell {
  white-space: normal;
  font-size: 0.82rem;
  line-height: 1.35;
}
.carrier-inline-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: -6px 0 12px;
}
.form-inline-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.trips-mobile {
  display: none;
}

.trip-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 14px 14px 12px;
  margin-bottom: 12px;
  border-left: 4px solid transparent;
}
.trip-card.row-urgent,
.trip-card.row-red,
.trip-card.row-late {
  border-left-color: var(--brand);
}
.trip-card.row-amber {
  border-left-color: var(--amber);
}
.trip-card.row-green {
  border-left-color: var(--green);
}
.trip-card.row-unassigned {
  border-left-color: #8aa3b5;
}
.trip-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.trip-card-vrid {
  font-weight: 700;
  font-size: 1.08rem;
  text-decoration: none;
  color: var(--brand);
}
.trip-card-company {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 2px;
}
.trip-card-time {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}
.trip-card-route {
  margin: 10px 0 8px;
  padding: 10px 12px;
  background: #f5f7f9;
  border-radius: 10px;
  font-weight: 700;
}
.trip-card-assign {
  margin-bottom: 8px;
}
.trip-card-assign .pill {
  margin-bottom: 4px;
}
.trip-card-rates {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-size: 0.86rem;
  margin-bottom: 6px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.trip-card-status {
  margin-bottom: 8px;
  font-size: 0.85rem;
}
.trip-card-actions {
  gap: 6px;
}
.trip-card-actions.is-collapsible .is-secondary-action {
  display: none;
}
.trip-card-actions.is-collapsible.is-expanded .is-secondary-action {
  display: inline-flex;
}
.trip-card-more-btn {
  margin-top: 6px;
  width: 100%;
  min-height: 40px;
}

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

@media (max-width: 900px) {
  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .filter-group {
    align-items: flex-start;
    flex-direction: column;
  }
  .filter-group-label {
    min-width: 0;
  }
  .filter-inline-label {
    margin-left: 0;
  }
  .trips-desktop {
    display: none;
  }
  .trips-mobile {
    display: block;
  }
  .day-block .table-wrap.trips-desktop {
    display: none;
  }
  .page-head-actions .btn {
    min-height: 40px;
  }
}



/* WhatsApp freight inbox */
.wa-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 20px;
}
.wa-tab {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  color: inherit;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
}
.wa-tab.active {
  background: var(--ink, #16324f);
  color: #fff;
  border-color: transparent;
}
.wa-card-list {
  display: grid;
  gap: 14px;
}
.wa-card {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.wa-card-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.wa-card-title {
  font-weight: 700;
  font-size: 1.05rem;
}
.wa-card-time {
  font-size: 0.82rem;
  color: var(--muted);
  white-space: nowrap;
}
.wa-card-preview {
  margin: 10px 0 12px;
  color: var(--ink, #16324f);
  line-height: 1.45;
}
.wa-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.wa-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
@media (max-width: 900px) {
  .wa-card-top { flex-direction: column; }
  .wa-card-actions { width: 100%; }
  .wa-card-actions .btn { flex: 1 1 auto; text-align: center; }
}

.wa-map-panel {
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.55);
}
.wa-map-panel summary {
  cursor: pointer;
  font-weight: 600;
  margin-bottom: 8px;
}
.check-confirm {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 12px 0;
  font-weight: 600;
}

/* ---- Shared mobile list cards (Trips visual standard) ---- */
.desktop-only { display: block; }
.table-wrap.desktop-only { display: block; }
.mobile-only { display: none; }

.mobile-card {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 14px 12px;
  margin-bottom: 12px;
}
.mobile-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.mobile-card-title {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--ink);
  text-decoration: none;
}
.mobile-card-title:hover { text-decoration: none; }
.mobile-card-sub {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 2px;
}
.mobile-card-badge {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}
.mobile-card-fields {
  margin: 10px 0 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.9rem;
}
.mobile-card-fields .field-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  margin-right: 4px;
}
.mobile-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: stretch;
  margin-top: 4px;
}
.mobile-card-actions .btn,
.mobile-card-actions .inline-action .btn {
  flex: 1 1 calc(33.33% - 6px);
  min-width: 7.5rem;
  min-height: 44px;
  white-space: nowrap;
}
.mobile-card-actions .inline-action {
  display: contents;
}

.fleet-mobile,
.drivers-mobile,
.submissions-mobile,
.deleted-mobile,
.locations-mobile,
.staff-mobile,
.motive-mapping-mobile,
.gmail-review-mobile {
  display: none;
}

.motive-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.motive-summary-card {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
}
.motive-summary-card .label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}
.motive-summary-card .value {
  font-weight: 700;
  font-size: 1.2rem;
  margin-top: 4px;
}

.email-excerpt-details {
  margin: 0 0 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f0f4f7;
  overflow: hidden;
}
.email-excerpt-details summary {
  cursor: pointer;
  font-weight: 600;
  padding: 12px 14px;
  min-height: 44px;
  display: flex;
  align-items: center;
}
.email-excerpt-details .email-excerpt {
  margin: 0;
  border: 0;
  border-radius: 0;
  border-top: 1px solid var(--line);
  max-height: 240px;
}

.notice-card-preview {
  margin: 8px 0 10px;
  font-size: 0.9rem;
  line-height: 1.4;
  color: var(--ink);
}

.load-detail-actions-mobile {
  display: none;
}

@media (max-width: 900px) {
  .desktop-only,
  .table-wrap.desktop-only,
  .fleet-desktop,
  .drivers-desktop,
  .submissions-desktop,
  .deleted-desktop,
  .locations-desktop,
  .staff-desktop,
  .motive-mapping-desktop {
    display: none !important;
  }
  .mobile-only,
  .fleet-mobile,
  .drivers-mobile,
  .submissions-mobile,
  .deleted-mobile,
  .locations-mobile,
  .staff-mobile,
  .motive-mapping-mobile,
  .gmail-review-mobile {
    display: block;
  }

  .form-card,
  .form-card-wide,
  .form-grid,
  .assign-card-wide {
    max-width: 100%;
    width: 100%;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
  .form-card input,
  .form-card select,
  .form-card textarea,
  .form-grid input,
  .form-grid select,
  .form-grid textarea,
  .inline-filters select,
  .inline-filters input {
    max-width: 100%;
    width: 100%;
    min-width: 0;
  }
  .form-actions,
  .form-grid .form-actions,
  .form-card .form-actions {
    position: sticky;
    bottom: 0;
    z-index: 20;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px -4px 0;
    padding: 12px 4px;
    background: linear-gradient(180deg, rgba(247, 250, 252, 0) 0%, rgba(247, 250, 252, 0.96) 28%, rgba(247, 250, 252, 1) 100%);
  }
  .form-actions .btn {
    min-height: 44px;
    flex: 1 1 auto;
    white-space: nowrap;
  }

  .motive-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .page-head-actions.load-detail-actions-desktop {
    display: none;
  }
  .load-detail-actions-mobile {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 16px;
  }
  .load-detail-actions-mobile .btn {
    flex: 1 1 calc(50% - 6px);
    min-height: 44px;
    white-space: nowrap;
  }

  .review-panel {
    padding: 14px;
  }
  .review-panel .form-actions {
    width: 100%;
  }

  .timeline-table,
  .status-events-table {
    display: block;
  }

  /* Searchable select dropdowns stay within viewport */
  .loc-typeahead,
  .customer-typeahead,
  .carrier-typeahead {
    max-width: 100%;
  }
  .loc-typeahead-list,
  .typeahead-menu,
  .autocomplete-list {
    max-width: min(100vw - 32px, 100%);
    left: 0 !important;
    right: auto;
    width: 100%;
  }

  .loc-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .loc-toolbar input,
  .loc-toolbar select,
  .loc-toolbar .btn {
    width: 100%;
    min-height: 44px;
  }

  .word-safe,
  .mobile-card,
  .trip-card,
  .detail-card,
  .wa-card,
  .review-panel {
    overflow-wrap: anywhere;
    word-break: normal;
  }
  .mobile-card-actions .btn,
  .fleet-actions .btn,
  .trip-card-actions .btn {
    word-break: keep-all;
    overflow-wrap: normal;
  }
}
