/* ==========================================
   RESET
========================================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Reusable Show/Hide controls for long admin/workflow pages. */
.collapsible-card {
  position: relative;
}

.collapsible-card > .collapsible-card-header {
  padding-right: 3rem;
}

/* Small arrow in the card's top-right corner: points up while open, down while collapsed. */
.collapsible-card-toggle {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px !important;
  min-width: 32px !important;
  height: 32px !important;
  min-height: 32px !important;
  padding: 0 !important;
  border: 1px solid transparent !important;
  border-radius: 8px;
  background: transparent !important;
  color: #64748b !important;
  box-shadow: none !important;
  cursor: pointer;
}

.collapsible-card-toggle::before {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(2px) rotate(-135deg);
}

.collapsible-card.is-collapsed .collapsible-card-toggle::before {
  transform: translateY(-2px) rotate(45deg);
}

.collapsible-card-toggle:hover,
.collapsible-card-toggle:focus-visible {
  background: #f1f5f9 !important;
  border-color: #e2e8f0 !important;
  color: #0f172a !important;
}

.collapsible-card.is-collapsed {
  min-height: auto !important;
}

.collapsible-card.is-collapsed > :not(.collapsible-card-header):not(.collapsible-card-toggle) {
  display: none !important;
}

.collapsible-card.is-collapsed > .collapsible-card-toggle {
  display: inline-flex !important;
}

body.theme-dark .collapsible-card-toggle {
  color: #94a3b8 !important;
}

body.theme-dark .collapsible-card-toggle:hover,
body.theme-dark .collapsible-card-toggle:focus-visible {
  background: rgba(148, 163, 184, .14) !important;
  border-color: transparent !important;
  color: #e2e8f0 !important;
}

.dispatch-doc-group {
  border: 1px solid #dbe5ef;
  border-radius: 14px;
  padding: 14px;
  background: #ffffff;
  margin-bottom: 12px;
}

.dispatch-doc-group-header,
.dispatch-doc-meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.dispatch-doc-group-header strong,
.dispatch-doc-meta strong {
  display: block;
  color: #0f172a;
}

.dispatch-doc-group-header span,
.dispatch-doc-meta span {
  display: block;
  color: #64748b;
  font-size: 0.9rem;
}

.dispatch-doc-status {
  border-radius: 999px;
  padding: 5px 10px;
  background: #eef6ff;
  color: #0f67a8;
  font-size: 0.8rem;
  font-weight: 800;
  white-space: nowrap;
}

.dispatch-doc-group.is-ready .dispatch-doc-status {
  background: #dcfce7;
  color: #166534;
}

.dispatch-doc-group.is-missing .dispatch-doc-status {
  background: #fff1f2;
  color: #b42318;
}

.dispatch-doc-group.is-optional .dispatch-doc-status {
  background: #f8fafc;
  color: #475569;
}

.dispatch-doc-card {
  display: grid;
  gap: 10px;
  margin-top: 10px;
  padding: 12px;
  border: 1px solid #e7eef6;
  border-radius: 12px;
  background: #f8fbff;
}

.dispatch-doc-preview {
  width: 100%;
  max-height: 260px;
  min-height: 160px;
  border: 1px solid #dbe5ef;
  border-radius: 10px;
  background: #ffffff;
  object-fit: contain;
}

iframe.dispatch-doc-preview {
  height: 260px;
}

.dispatch-doc-preview-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  font-weight: 800;
}

.dispatch-doc-details {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.dispatch-doc-details div {
  padding: 8px 10px;
  border: 1px solid #e7eef6;
  border-radius: 10px;
  background: #ffffff;
}

.dispatch-doc-details dt {
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.dispatch-doc-details dd {
  margin: 3px 0 0;
  color: #0f172a;
  overflow-wrap: anywhere;
}

.dispatch-doc-notes {
  margin: 0;
  color: #475569;
}

@media (max-width: 760px) {
  .dispatch-doc-group-header,
  .dispatch-doc-meta {
    flex-direction: column;
    align-items: stretch;
  }

  .dispatch-doc-details {
    grid-template-columns: 1fr;
  }

  .dispatch-doc-preview {
    max-height: 220px;
  }

  iframe.dispatch-doc-preview {
    height: 220px;
  }
}

@media print {
  .dispatch-doc-meta button {
    display: none !important;
  }

  .dispatch-doc-preview {
    max-height: none;
  }
}

[hidden],
.is-hidden,
.field[hidden],
#truckAssignmentField[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100vh;
}

body {
  display: flex;
  background: var(--bg);
  font-family:
    Inter,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    sans-serif;
  color: var(--text);
}

/* ==========================================
   SIDEBAR
========================================== */

.sidebar {

  width: var(--sidebar-width);
  min-width: var(--sidebar-width);

  background: white;

  border-right: 1px solid var(--border);

  padding: 24px;

  position: sticky;
  top: 0;

  height: 100vh;

  overflow-y: auto;
}

.sidebar h2 {

  font-size: 30px;
  font-weight: 700;

  margin-bottom: 30px;
}

.sidebar a {

  display: flex;

  align-items: center;

  padding: 12px 14px;

  margin-bottom: 8px;

  border-radius: 10px;

  color: #475569;

  text-decoration: none;

  transition: .2s ease;
}

.sidebar a:hover {

  background: #eff6ff;

  color: var(--primary);
}

/* ==========================================
   MAIN
========================================== */

.main {

  flex: 1;

  padding: 30px;

  overflow-x: hidden;
}

main {
  max-width: 1400px;
}

/* ==========================================
   PAGE HEADER
========================================== */

.page-header {

  display: flex;

  justify-content: space-between;

  align-items: center;

  margin-bottom: 24px;
}

.page-header h1 {

  font-size: 42px;

  font-weight: 700;
}

/* ==========================================
   CARD
========================================== */

.card,
.details-card {

  background: var(--card);

  border-radius: 20px;

  padding: 30px;

  border: 1px solid var(--border);

  box-shadow: var(--shadow);
}

/* ==========================================
   FORM
========================================== */

.form {

  display: grid;

  grid-template-columns: repeat(2, minmax(0, 1fr));

  gap: 22px;
}

.form .full-width {
  grid-column: 1 / -1;
}

.form-button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  grid-column: 1 / -1;
}

.form h3.full-width {
  margin: 28px 0 2px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: .01em;
}

.form h3.full-width:first-of-type {
  margin-top: 0;
}

.form p.section-hint {
  grid-column: 1 / -1;
  margin: -14px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.branding-tile {
  grid-column: 1 / -1;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
}

.branding-tile-preview {
  flex: 0 0 110px;
  width: 110px;
  height: 70px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(148, 163, 184, .08);
  overflow: hidden;
}

.branding-tile-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.branding-tile-placeholder {
  font-size: 11px;
  line-height: 1.3;
  color: var(--muted);
  text-align: center;
  padding: 0 6px;
}

.branding-tile-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.branding-tile-body > label {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}

.branding-tile-hint {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}

.branding-tile-url-toggle {
  font-size: 12px;
}

.branding-tile-url-toggle summary {
  cursor: pointer;
  color: var(--muted);
  list-style: none;
}

.branding-tile-url-toggle summary::-webkit-details-marker {
  display: none;
}

.branding-tile-url-toggle input {
  margin-top: 6px;
}

.brand-color-row {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.brand-color-swatch {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  border: 1px solid var(--border);
  flex: 0 0 auto;
}

.brand-color-sample {
  padding: 8px 16px;
  border-radius: 8px;
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.settlement-load-list {
  border: 1px solid #dbe5f1;
  border-radius: 8px;
  background: #f8fbff;
  max-height: 320px;
  overflow: auto;
  padding: 10px;
}

.settlement-load-option {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #e5edf6;
  margin-bottom: 8px;
  cursor: pointer;
}

.settlement-load-option:last-child {
  margin-bottom: 0;
}

.settlement-load-option input {
  width: auto;
  margin-top: 4px;
}

.settlement-load-option span,
.settlement-load-option small {
  display: block;
}

.settlement-load-option small {
  color: #64748b;
  margin-top: 4px;
}

.field {

  display: flex;

  flex-direction: column;
}

.field label {

  font-size: 14px;

  font-weight: 600;

  color: var(--muted);

  margin-bottom: 8px;
}

.field input,
.field select,
.field textarea,
.branding-tile-body input,
.branding-tile-body select,
.branding-tile-body textarea {

  width: 100%;

  padding: 14px 16px;

  border: 1px solid var(--border);

  border-radius: 10px;

  background: white;

  font-size: 15px;

  transition: .2s ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.branding-tile-body input:focus,
.branding-tile-body select:focus,
.branding-tile-body textarea:focus {

  outline: none;

  border-color: var(--primary);

  box-shadow:
    0 0 0 4px rgba(37,99,235,.12);
}

/* ==========================================
   BUTTONS
========================================== */

.btn {

  grid-column: span 2;

  width: 220px;

  height: 48px;

  border: none;

  border-radius: 10px;

  background: var(--primary);

  color: white;

  font-size: 15px;

  font-weight: 600;

  cursor: pointer;

  transition: .2s ease;
}

.btn:hover {

  background: var(--primary-hover);

  transform: translateY(-1px);
}

/* ==========================================
   KPI GRID
========================================== */

.kpi-grid {

  display: grid;

  grid-template-columns:
      repeat(auto-fit,minmax(220px,1fr));

  gap: 20px;

  margin-bottom: 24px;
}

.kpi-card {

  background: white;

  padding: 24px;

  border-radius: 16px;

  border: 1px solid var(--border);

  box-shadow: var(--shadow);
}

.kpi-card h3 {

  font-size: 38px;

  margin-bottom: 4px;
}

.kpi-card p {

  color: var(--muted);
}

.kpi-card.success {
  border-top: 4px solid var(--success);
}

.kpi-card.warning {
  border-top: 4px solid var(--danger);
}

.kpi-card.caution {
  border-top: 4px solid var(--warning);
}

/* ==========================================
   TABLES
========================================== */

table {

  width: 100%;

  border-collapse: collapse;

  background: white;

  border-radius: 16px;

  overflow: hidden;

  box-shadow: var(--shadow);
}

thead {

  background: #f8fafc;
}

th {

  text-align: left;

  padding: 16px;

  font-size: 13px;

  text-transform: uppercase;

  color: var(--muted);
}

td {

  padding: 16px;

  border-top: 1px solid var(--border);
}

tbody tr:hover {

  background: #fafcff;
}

/* ==========================================
   DRIVER CARDS
========================================== */

.list {

  list-style: none;

  display: grid;

  gap: 16px;
}

.list li {

  background: white;

  padding: 20px;

  border-radius: 16px;

  border: 1px solid var(--border);

  box-shadow: var(--shadow);
}

.driver-row {

  display: flex;

  align-items: center;

  gap: 15px;
}

.avatar {

  width: 56px;

  height: 56px;

  border-radius: 50%;

  object-fit: cover;

  background: #e5e7eb;
}

/* ==========================================
   ACTION BUTTONS
========================================== */

.actions {

  margin-top: 15px;

  display: flex;

  gap: 10px;
}

.actions button,
.actions a {

  border: none;

  text-decoration: none;

  padding: 10px 14px;

  border-radius: 8px;

  cursor: pointer;
}

.details-card .actions {
  align-items: center;
  flex-wrap: wrap;
  overflow: visible;
}

.action-menu {
  position: relative;
}

.action-menu summary {
  align-items: center;
  display: inline-flex;
  list-style: none;
  min-height: 40px;
  user-select: none;
}

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

.action-menu summary::after {
  content: "";
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid currentColor;
  margin-left: 9px;
}

.action-menu[open] summary::after {
  transform: rotate(180deg);
}

.action-menu-panel {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 18px 36px rgba(15, 23, 42, .16);
  display: grid;
  gap: 4px;
  min-width: 230px;
  padding: 8px;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 30;
}

.action-menu-item {
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: #172033;
  cursor: pointer;
  display: block;
  font: inherit;
  padding: 10px 12px;
  text-align: left;
  text-decoration: none;
  width: 100%;
}

.action-menu-item:hover,
.action-menu-item:focus {
  background: #eef6ff;
  color: var(--primary);
  outline: none;
}

.load-profit-snapshot-card {
  margin-top: 18px;
}

.load-profit-snapshot {
  display: grid;
  gap: 14px;
}

.load-profit-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.load-profit-metric {
  background: #f8fbff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
}

.load-profit-metric span,
.load-profit-breakdown span {
  color: var(--muted);
  display: block;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.load-profit-metric strong {
  color: #0f172a;
  display: block;
  font-size: 22px;
  line-height: 1.15;
  margin: 7px 0 4px;
}

.load-profit-metric small {
  color: var(--muted);
  font-size: 12px;
}

.load-profit-metric.success {
  border-color: rgba(22, 163, 74, .22);
  background: #f0fdf4;
}

.load-profit-metric.caution {
  border-color: rgba(245, 158, 11, .25);
  background: #fffbeb;
}

.load-profit-metric.warning {
  border-color: rgba(220, 38, 38, .22);
  background: #fef2f2;
}

.load-profit-breakdown {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.load-profit-breakdown div {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
}

.load-profit-breakdown strong {
  color: #172033;
  display: block;
  font-size: 16px;
  margin-top: 4px;
}

.load-profit-warnings {
  display: grid;
  gap: 8px;
}

.load-profit-warnings p {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  color: #7c2d12;
  font-size: 13px;
  line-height: 1.35;
  padding: 10px 12px;
}

.load-profit-warnings .success-note {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534;
}

.trip-cost-editor {
  border-top: 1px solid var(--border);
  margin-top: 16px;
  padding-top: 14px;
}

.trip-cost-editor summary {
  align-items: center;
  color: var(--primary);
  cursor: pointer;
  display: inline-flex;
  font-size: 13px;
  font-weight: 850;
  gap: 8px;
}

.trip-cost-form {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 14px;
}

.trip-cost-form .field {
  margin: 0;
}

.trip-cost-actions {
  align-items: center;
  display: flex;
  gap: 12px;
  grid-column: 1 / -1;
}

.route-summary-card {
  margin-top: 18px;
}

.route-summary-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.route-summary-grid article {
  background: #f8fbff;
  border: 1px solid var(--border);
  border-radius: 8px;
  min-height: 96px;
  padding: 14px;
}

.route-summary-grid span {
  color: var(--muted);
  display: block;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.route-summary-grid strong {
  color: #0f172a;
  display: block;
  font-size: 17px;
  line-height: 1.25;
  margin-top: 7px;
}

.route-summary-grid small {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-top: 5px;
}

.route-quality-panel {
  align-items: flex-start;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  grid-template-columns: 220px minmax(0, 1fr);
  margin-top: 14px;
  padding: 14px;
}

.route-quality-panel h3 {
  color: #172033;
  font-size: 16px;
  margin: 4px 0 0;
}

.route-quality-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.route-quality-checks span {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: #334155;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  gap: 6px;
  min-height: 34px;
  padding: 8px 10px;
}

.route-quality-checks strong {
  align-items: center;
  border-radius: 999px;
  display: inline-flex;
  font-size: 10px;
  height: 18px;
  justify-content: center;
  min-width: 18px;
}

.route-quality-checks .ok strong {
  background: #dcfce7;
  color: #166534;
}

.route-quality-checks .warning strong {
  background: #fee2e2;
  color: #991b1b;
}

.route-quality-checks .neutral strong {
  background: #e2e8f0;
  color: #475569;
}

.route-map-preview {
  background: linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-top: 14px;
  padding: 14px;
}

.route-map-header {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 12px;
}

.route-map-header h3 {
  color: #172033;
  font-size: 16px;
  margin: 4px 0 0;
}

.route-map-canvas {
  background: #eaf4ff;
  border: 1px solid #cfe8ff;
  border-radius: 8px;
  overflow: hidden;
}

.here-map-canvas {
  height: 320px;
  min-height: 320px;
  position: relative;
  width: 100%;
}

.route-map-status {
  align-items: center;
  color: #475569;
  display: flex;
  font-size: 14px;
  font-weight: 800;
  inset: 0;
  justify-content: center;
  line-height: 1.4;
  min-height: 320px;
  padding: 24px;
  position: absolute;
  text-align: center;
}

.route-map-status.warning {
  color: #b91c1c;
}

.route-map-canvas svg {
  display: block;
  height: auto;
  width: 100%;
}

.route-map-bg {
  fill: #eaf4ff;
}

.route-map-line {
  fill: none;
  stroke: url(#routeLineGradient);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 7;
}

.route-map-pin {
  stroke: #ffffff;
  stroke-width: 4;
}

.route-map-pin.start {
  fill: var(--success);
}

.route-map-pin.end {
  fill: var(--primary);
}

.route-map-label {
  fill: #0f172a;
  font-size: 18px;
  font-weight: 850;
}

.route-map-meta {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr minmax(150px, .65fr);
  margin-top: 12px;
}

.route-map-meta article {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
}

.route-map-meta span {
  color: var(--muted);
  display: block;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.route-map-meta strong {
  color: #0f172a;
  display: block;
  font-size: 14px;
  line-height: 1.35;
  margin-top: 5px;
}

.route-planner-editor {
  border-top: 1px solid var(--border);
  margin-top: 16px;
  padding-top: 14px;
}

.route-planner-editor summary {
  color: var(--primary);
  cursor: pointer;
  display: inline-flex;
  font-size: 13px;
  font-weight: 850;
}

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

.route-planner-form .field {
  margin: 0;
}

.route-planner-actions {
  align-items: center;
  display: flex;
  gap: 12px;
  grid-column: 1 / -1;
}

.inline-message {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

@media (max-width: 700px) {
  .details-card .actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .action-menu,
  .action-menu summary {
    width: 100%;
  }

  .action-menu-panel {
    position: static;
    margin-top: 8px;
    min-width: 0;
    width: 100%;
  }

  .load-profit-grid,
  .load-profit-breakdown,
  .trip-cost-form,
  .route-summary-grid,
  .route-quality-panel,
  .route-map-meta,
  .route-planner-form {
    grid-template-columns: 1fr;
  }

  .trip-cost-actions,
  .route-planner-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .here-map-canvas,
  .route-map-status {
    height: 260px;
    min-height: 260px;
  }
}

.view {
  background: var(--primary);
  color: white;
}

.delete {
  background: var(--danger);
  color: white;
}

/* ==========================================
   MESSAGE
========================================== */

.message {

  margin-top: 20px;

  font-weight: 600;

  color: var(--success);
}

.muted-copy {
  color: var(--muted);
  line-height: 1.6;
  margin: 0;
  max-width: 900px;
}

/* Marks a form field as required when the HTML `required` attribute alone
   can't express it (e.g. "Customer OR Manual Customer" - either one
   satisfies it, so neither input can carry `required` by itself). */
.field.is-required > label::after {
  content: " *";
  color: #ef4444;
  font-weight: 700;
}

/* One-sentence "what is this page for" line, used at the top of each
   money-flow page (Invoices, Settlements, Dispatcher Commissions, Payroll)
   so it's always clear which flow applies before reading anything else. */
.page-purpose {
  color: var(--primary) !important;
  font-weight: 600;
  line-height: 1.5;
  margin: 0 0 6px;
  max-width: 900px;
}

.rate-con-upload-zone {
  align-items: center;
  background: #f8fafc;
  border: 1px dashed #9fb6cc;
  border-radius: 8px;
  display: flex;
  gap: 16px;
  margin-top: 12px;
  padding: 22px;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.rate-con-upload-zone.is-dragging {
  background: #eef7ff;
  border-color: var(--primary);
}

.rate-con-upload-zone input {
  max-width: 280px;
}

.rate-con-upload-zone strong,
.rate-con-upload-zone span {
  display: block;
}

.rate-con-upload-zone span {
  color: var(--muted);
  margin-top: 4px;
}

.rate-con-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.rate-con-attachment-notice {
  background: #f8fbff;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.45;
  margin-top: 12px;
  padding: 12px 14px;
}

.rate-con-attachment-notice.ready {
  background: #ecfdf5;
  border-color: #bbf7d0;
  color: #047857;
}

.rate-con-review-section {
  border: 1px solid var(--border);
  border-radius: 10px;
  display: grid;
  gap: 14px;
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
  padding: 18px;
}

.rate-con-review-section legend {
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .06em;
  padding: 0 8px;
  text-transform: uppercase;
}

.rate-con-review-section .wide-field,
.rate-con-review-section .carrier-notes-field {
  grid-column: 1 / -1;
}

.rate-con-checklist {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.rate-con-review-notice {
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.45;
  margin: 12px 0;
  padding: 12px 14px;
}

.rate-con-review-notice.success {
  background: #ecfdf5;
  border-color: #bbf7d0;
  color: #047857;
}

.rate-con-review-notice.warning {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

.rate-con-review-notice.danger {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
}

.rate-con-check {
  align-items: center;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  gap: 8px;
  padding: 10px;
}

.rate-con-check small {
  color: var(--muted);
  display: block;
  font-size: 11px;
  font-weight: 750;
  margin-left: auto;
}

.rate-con-check span {
  align-items: center;
  border-radius: 999px;
  display: inline-flex;
  font-size: 11px;
  font-weight: 800;
  height: 24px;
  justify-content: center;
  width: 24px;
}

.rate-con-check.pass span {
  background: #dcfce7;
  color: #047857;
}

.rate-con-check.warning span {
  background: #fee2e2;
  color: #b91c1c;
}

.rate-con-check.danger {
  border-color: #fecaca;
}

.rate-con-check.danger span {
  background: #fee2e2;
  color: #b91c1c;
}

.rate-con-quality-details {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.rate-con-quality-header,
.rate-con-quality-empty,
.rate-con-quality-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}

.rate-con-quality-header {
  align-items: center;
  background: #f8fbff;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.rate-con-quality-header strong,
.rate-con-quality-empty strong,
.rate-con-quality-item strong {
  color: #172033;
  display: block;
  font-size: 13px;
}

.rate-con-quality-header span,
.rate-con-quality-empty span,
.rate-con-quality-item span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  line-height: 1.35;
}

.rate-con-quality-list {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.rate-con-quality-item.blocker {
  background: #fef2f2;
  border-color: #fecaca;
}

.rate-con-quality-item.warning {
  background: #fffbeb;
  border-color: #fde68a;
}

.rate-con-quality-empty {
  background: #ecfdf5;
  border-color: #bbf7d0;
}

.field.needs-review input,
.field.needs-review select,
.field.needs-review textarea {
  border-color: #fca5a5;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.08);
}

.field.optional-review input,
.field.optional-review select,
.field.optional-review textarea {
  border-color: #fde68a;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.08);
}

.field.ready-review input,
.field.ready-review select,
.field.ready-review textarea {
  border-color: #bbf7d0;
}

button:disabled,
.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

/* ==========================================
   MOBILE
========================================== */

@media (max-width: 900px) {

  body {
    flex-direction: column;
  }

  .sidebar {

    width: 100%;

    min-width: 100%;

    height: auto;

    position: relative;
  }

  .main {
    padding: 20px;
  }

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

  .rate-con-review-section {
    grid-template-columns: 1fr;
  }

  .btn {
    grid-column: span 1;
    width: 100%;
  }

  .page-header h1 {
    font-size: 32px;
  }
}
/* ==========================================
   PAGE LAYOUT
========================================== */

/* body is a flex row, so the layout and content must be allowed to shrink below their
   widest child; otherwise wide tables/button rows push every page sideways. */
.layout {
  display: flex;
  flex: 1 1 auto;
  min-height: 100vh;
  min-width: 0;
}

.content {
  flex: 1;
  min-width: 0;
  padding: 40px;
}

/* Wide tables scroll inside their own box (wrapper added by companyContext.js). */
.hr-table-scroll {
  max-width: 100%;
  overflow-x: auto;
}

@media print {
  .hr-table-scroll {
    overflow: visible;
  }
}

/* ==========================================
   HEADER
========================================== */

.page-header {
  margin-bottom: 30px;
}

.page-header h1 {
  font-size: 42px;
  font-weight: 700;
  margin-bottom: 8px;
}

.page-header p {
  color: #64748b;
  font-size: 15px;
}

/* ==========================================
   FORM
========================================== */

.form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  max-width: 950px;
}

.field {
  display: flex;
  flex-direction: column;
}

.field label {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  color: #475569;
}

.field input {
  width: 100%;
  padding: 14px;
  border: 1px solid #dbe3ec;
  border-radius: 10px;
  font-size: 15px;
}

.field input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .10);
}

.btn {
  grid-column: 1 / -1;
  width: 220px;
  height: 50px;
}

/* ==========================================
   CARD
========================================== */

.card {
  background: white;
  border-radius: 18px;
  padding: 30px;
  box-shadow:
    0 2px 10px rgba(0,0,0,.04);
}

/* ==========================================
   MOBILE
========================================== */

@media (max-width: 900px) {

  .layout {
    flex-direction: column;
  }

  .content {
    padding: 20px;
  }

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

  .btn {
    width: 100%;
  }
}

/* ==========================================
   DISPATCH BOARD
========================================== */

.dispatch-toolbar {
  display: grid;
  grid-template-columns: repeat(6, minmax(140px, 1fr));
  gap: 16px;
  align-items: end;
  margin-bottom: 22px;
  padding: 18px;
}

.dispatch-toolbar .btn {
  grid-column: auto;
  min-height: 44px;
  width: 100%;
}

.dispatch-kpis {
  margin-bottom: 18px;
}

.dispatch-board {
  display: grid;
  grid-template-columns: repeat(7, minmax(260px, 1fr));
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 12px;
}

.dispatch-column {
  min-width: 260px;
  background: rgba(255, 255, 255, .72);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
}

.dispatch-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.dispatch-column-header h2 {
  font-size: 15px;
  line-height: 1.2;
}

.dispatch-column-header span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #e7f2ff;
  color: var(--primary);
  font-size: 13px;
  font-weight: 800;
}

.dispatch-card-list {
  display: grid;
  gap: 12px;
}

.dispatch-load-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 14px;
}

.dispatch-load-card.at-risk {
  border-color: rgba(220, 38, 38, .36);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 10px 24px rgba(220, 38, 38, .1);
}

.dispatch-load-top {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  margin-bottom: 10px;
}

.dispatch-load-top h3 {
  font-size: 16px;
  line-height: 1.2;
}

.dispatch-load-top p,
.empty-state {
  color: var(--muted);
  font-size: 13px;
}

.status-pill {
  align-self: flex-start;
  border-radius: 999px;
  background: #edf6ff;
  color: #075fa6;
  font-size: 12px;
  font-weight: 800;
  padding: 5px 8px;
  text-transform: capitalize;
  white-space: nowrap;
}

.dispatch-lane {
  color: #0b1220;
  font-size: 14px;
  font-weight: 750;
  line-height: 1.35;
  margin-bottom: 12px;
}

.dispatch-lane span {
  color: var(--muted);
  font-weight: 600;
}

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

.dispatch-meta dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.dispatch-meta dd {
  color: #172033;
  font-size: 13px;
  line-height: 1.25;
  margin-top: 3px;
}

.dispatch-status-control {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 12px;
  text-transform: uppercase;
}

.dispatch-status-control select {
  border: 1px solid var(--border);
  border-radius: 8px;
  color: #0b1220;
  font-size: 14px;
  padding: 10px;
  text-transform: none;
}

.dispatch-quick-assign {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
  padding: 12px 0;
}

.dispatch-quick-assign label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  min-width: 0;
  text-transform: uppercase;
}

.dispatch-quick-assign select {
  border: 1px solid var(--border);
  border-radius: 8px;
  color: #0b1220;
  font-size: 13px;
  min-height: 40px;
  min-width: 0;
  padding: 9px;
  text-transform: none;
  width: 100%;
}

.dispatch-quick-assign .view {
  align-items: center;
  display: inline-flex;
  justify-content: center;
  min-height: 40px;
  white-space: nowrap;
}

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

.dispatch-actions .view {
  border-radius: 8px;
  font-size: 13px;
  padding: 8px 10px;
}

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

@media (max-width: 700px) {
  .dispatch-toolbar {
    grid-template-columns: 1fr;
  }

  .dispatch-quick-assign {
    grid-template-columns: 1fr;
  }

  .dispatch-toolbar .btn {
    width: 100%;
  }
}

/* ==========================================
   SETTLEMENTS
========================================== */

.settlement-kpis {
  margin-bottom: 22px;
}

#netProfit[readonly] {
  background: #eef5fb;
  color: #0b1220;
  font-weight: 800;
}

.commission-kpis {
  margin-bottom: 22px;
}

.commission-form-card {
  margin-bottom: 30px;
}

.commission-form {
  margin-top: 14px;
}

.commission-wide {
  grid-column: 1 / -1;
}

.commission-form input[readonly] {
  background: #f8fafc;
  color: #334155;
  font-weight: 800;
}

/* ==========================================
   COMPANY ADMIN
========================================== */

.company-admin-kpis {
  margin-bottom: 22px;
}

.company-admin-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 16px;
  align-items: end;
  margin-bottom: 22px;
}

.company-admin-toolbar .view {
  border: 0;
  cursor: pointer;
  height: 48px;
  padding: 0 16px;
}

.company-mode-text {
  color: var(--muted);
  font-size: 14px;
  margin: 6px 0 16px;
}

#companyUsersTableBody select {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  width: 100%;
}

/* ==========================================
   DOCUMENTS
========================================== */

.document-kpis {
  margin-bottom: 22px;
}

.document-notes {
  grid-column: 1 / -1;
}

.document-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(180px, 240px) minmax(180px, 260px);
  gap: 16px;
  margin: 24px 0;
}

#documentsTableBody .view,
#documentsTableBody .delete {
  border: 0;
  cursor: pointer;
  margin-right: 8px;
  padding: 9px 11px;
}

.paperwork-queue-card {
  margin-bottom: 22px;
}

.paperwork-queue {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.paperwork-item {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--border);
  border-left: 4px solid var(--warning);
  border-radius: 8px;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 14px;
}

.paperwork-item.danger {
  border-left-color: var(--danger);
}

.paperwork-item.caution {
  border-left-color: #0ea5e9;
}

.paperwork-item h3 {
  font-size: 16px;
  line-height: 1.25;
  margin: 7px 0 3px;
}

.paperwork-item p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.paperwork-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.paperwork-actions .view {
  align-items: center;
  display: inline-flex;
  min-height: 38px;
}

.status-pill.danger {
  background: #fee2e2;
  color: #991b1b;
}

.status-pill.warning {
  background: #fef3c7;
  color: #92400e;
}

.status-pill.caution {
  background: #e0f2fe;
  color: #075985;
}

@media (max-width: 760px) {
  .paperwork-item {
    grid-template-columns: 1fr;
  }

  .paperwork-actions {
    justify-content: flex-start;
  }
}

/* ==========================================
   QUOTES
========================================== */

.quote-kpis {
  margin-bottom: 22px;
}

.quotes-list-card {
  margin-top: 30px;
}

.table-select {
  min-width: 120px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: #0f172a;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
}

button:disabled,
.view:disabled {
  cursor: not-allowed;
  opacity: .55;
}

/* ==========================================
   MAINTENANCE AUTOMATION
========================================== */

.maintenance-kpis {
  margin-bottom: 22px;
}

.status-pill.success {
  background: #dcfce7;
  color: #166534;
}

.status-pill.caution {
  background: #fef3c7;
  color: #92400e;
}

.status-pill.warning {
  background: #fee2e2;
  color: #991b1b;
}

.notification-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  margin-left: auto;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--danger);
  color: #ffffff;
  font-size: 11px;
  font-weight: 900;
}

@media (max-width: 700px) {
  .company-admin-toolbar {
    grid-template-columns: 1fr;
  }

  .document-toolbar {
    grid-template-columns: 1fr;
  }
}

/* ==========================================
   COMPANY SETTINGS / INVOICES
========================================== */

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

.invoice-company-header h2 {
  font-size: 28px;
  line-height: 1.1;
  margin-bottom: 8px;
}

.invoice-company-header p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.invoice-company-header img {
  display: none;
  max-width: 160px;
  max-height: 90px;
  object-fit: contain;
}

@media print {
  body {
    background: #ffffff;
    display: block;
  }

  .sidebar,
  .no-print,
  .invoiceUpdateForm,
  #invoiceUpdateForm,
  .back-link,
  .message {
    display: none !important;
  }

  .layout,
  .content {
    display: block;
    padding: 0;
  }

  .card,
  .details-card,
  .invoice-company-header {
    border: 0;
    box-shadow: none;
    padding: 0;
  }

  .invoice-company-header {
    border-bottom: 2px solid #0b1220;
    margin-bottom: 24px;
    padding-bottom: 18px;
  }
}

/* ==========================================
   DRIVER PORTAL
========================================== */

.driver-lookup {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 16px;
  align-items: end;
  margin-bottom: 22px;
}

.driver-company-panel {
  align-items: end;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  margin-bottom: 18px;
}

.driver-company-panel h2 {
  margin-bottom: 4px;
}

.driver-company-panel-actions {
  align-items: end;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.driver-company-panel-actions .field {
  gap: 7px;
}

.driver-company-panel-actions .field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.driver-company-panel-actions .view {
  min-height: 44px;
}

.driver-lookup .btn {
  grid-column: auto;
  width: 190px;
}

.driver-lookup.driver-my-loads-mode {
  grid-template-columns: 1fr;
}

.driver-lookup.driver-my-loads-mode .field,
.driver-lookup.driver-my-loads-mode .btn {
  display: none;
}

.driver-portal-identity {
  background: linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 12px;
  display: grid;
  gap: 4px;
  padding: 16px;
}

.driver-portal-identity strong {
  color: var(--text);
  font-size: 22px;
  line-height: 1.1;
}

.driver-portal-identity small {
  color: var(--muted);
}

.driver-portal-kpis {
  margin-bottom: 18px;
}

.driver-gps-card {
  margin-bottom: 18px;
}

.driver-location-setup-card {
  align-items: center;
  border-left: 4px solid var(--primary);
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) auto;
  margin-bottom: 18px;
}

.driver-location-setup-card h2 {
  margin-bottom: 6px;
}

.driver-location-setup-card p:last-child {
  color: var(--muted);
  margin: 0;
}

.driver-location-setup-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.driver-gps-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0;
}

.driver-gps-grid > div,
.dispatch-gps-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  background: #f8fafc;
}

.driver-gps-grid strong {
  display: block;
  font-size: 15px;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.driver-gps-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.driver-gps-actions .view {
  min-height: 42px;
}

.driver-gps-dispatch-card {
  margin-bottom: 18px;
}

.dispatch-gps-list {
  display: grid;
  gap: 10px;
}

.dispatch-gps-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
}

.assignment-planner-card {
  margin-bottom: 18px;
}

.assignment-planner-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(220px, 1.2fr) minmax(220px, 1fr) minmax(230px, .9fr);
}

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

.assignment-planner-heading strong {
  color: #172033;
  font-size: 14px;
}

.assignment-planner-heading span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.assignment-load-list,
.assignment-resource-list,
.assignment-save-panel {
  background: #f8fbff;
  border: 1px solid var(--border);
  border-radius: 12px;
  display: grid;
  gap: 10px;
  min-height: 140px;
  padding: 12px;
}

.assignment-load-chip,
.assignment-driver-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: #172033;
  cursor: grab;
  display: grid;
  gap: 4px;
  padding: 12px;
  text-align: left;
  transition: .18s ease;
  width: 100%;
}

.assignment-load-chip strong,
.assignment-driver-card strong {
  font-size: 14px;
}

.assignment-load-chip span,
.assignment-driver-card span,
.assignment-load-chip small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.assignment-load-chip:hover,
.assignment-driver-card:hover,
.assignment-load-chip.selected,
.assignment-driver-card.selected,
.assignment-driver-card.drop-ready {
  border-color: var(--primary);
  box-shadow: 0 10px 24px rgba(7, 136, 232, .14);
  transform: translateY(-1px);
}

.assignment-driver-card.drop-ready {
  background: #eef7ff;
}

.assignment-save-panel {
  align-content: start;
}

.assignment-save-panel .field {
  gap: 7px;
}

.assignment-save-panel .field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.assignment-save-panel input,
.assignment-save-panel select {
  border: 1px solid var(--border);
  border-radius: 10px;
  min-height: 42px;
}

.assignment-save-panel .view {
  width: 100%;
}

.driver-loads-list {
  display: grid;
  gap: 18px;
}

.driver-load-card.at-risk {
  border-color: rgba(220, 38, 38, .36);
}

.driver-load-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.driver-load-header h2 {
  font-size: 22px;
  line-height: 1.15;
}

.driver-load-header p {
  color: var(--muted);
  margin-top: 4px;
}

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

.driver-status-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.driver-packet-actions {
  display: flex;
  margin: 14px 0;
}

.driver-packet-link {
  align-items: center;
  display: inline-flex;
  justify-content: center;
  min-height: 46px;
  text-decoration: none;
  width: 100%;
}

.driver-status-actions button {
  border: 0;
  cursor: pointer;
  min-height: 46px;
  padding: 10px 12px;
  width: 100%;
}

.driver-checkcall-form,
.driver-pod-form,
.driver-issue-form,
.driver-expense-form {
  border-top: 1px solid var(--border);
  margin-top: 16px;
  padding-top: 16px;
}

.driver-portal-wide {
  grid-column: 1 / -1;
}

.driver-expense-header {
  display: grid;
  gap: 4px;
}

.driver-expense-header strong {
  color: #0f172a;
  font-size: 15px;
}

.driver-expense-header span {
  color: var(--muted);
  font-size: 13px;
}

.driver-expense-types {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.driver-expense-type {
  min-height: 46px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
  color: #0f172a;
  cursor: pointer;
  font-weight: 850;
}

.driver-expense-type:hover,
.driver-expense-type.active {
  border-color: rgba(7, 136, 232, .55);
  background: rgba(7, 136, 232, .10);
  color: #075f9f;
}

.driver-expense-money-fields,
.driver-expense-mile-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.driver-expense-money-fields[hidden],
.driver-expense-mile-fields[hidden] {
  display: none;
}

@media (max-width: 800px) {
  .driver-lookup {
    grid-template-columns: 1fr;
  }

  .driver-company-panel,
  .driver-company-panel-actions,
  .driver-location-setup-card,
  .assignment-planner-grid {
    grid-template-columns: 1fr;
  }

  .driver-company-panel-actions .view,
  .driver-location-setup-actions .view,
  .driver-location-setup-actions .status-pill {
    justify-content: center;
    width: 100%;
  }

  .driver-lookup .btn {
    width: 100%;
  }

  .driver-load-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .driver-load-meta {
    grid-template-columns: 1fr;
  }

  .driver-expense-types,
  .driver-expense-money-fields,
  .driver-expense-mile-fields,
  .driver-status-actions {
    grid-template-columns: 1fr;
  }
}

/* ==========================================
   REPORTS
========================================== */

.reports-toolbar {
  display: grid;
  grid-template-columns: minmax(160px, 220px) repeat(3, minmax(140px, 180px)) minmax(220px, 1fr) auto;
  gap: 16px;
  align-items: end;
  margin-bottom: 22px;
  padding: 18px;
}

.reports-toolbar .btn {
  grid-column: auto;
  width: 120px;
}

.reports-kpis {
  margin-bottom: 18px;
}

.audit-center-card {
  display: grid;
  gap: 18px;
  margin-bottom: 18px;
}

.audit-center-header {
  align-items: flex-start;
  display: flex;
  gap: 18px;
  justify-content: space-between;
}

.audit-center-header h2 {
  font-size: 24px;
  line-height: 1.1;
  margin: 0 0 6px;
}

.audit-center-header p {
  color: var(--muted);
  margin: 0;
}

.audit-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.audit-period-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.audit-period-tabs .view,
#runAuditBtn {
  min-height: 42px;
  min-width: 88px;
}

.audit-summary-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
}

.audit-summary-card {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 12px;
  display: grid;
  gap: 4px;
  padding: 14px;
}

.audit-summary-card span,
.audit-finding-meta small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.audit-summary-card strong {
  color: var(--text);
  font-size: 24px;
  line-height: 1.1;
}

.audit-summary-card small {
  color: var(--muted);
  font-size: 12px;
}

.audit-summary-card.success {
  border-top: 4px solid var(--success);
}

.audit-summary-card.warning {
  border-top: 4px solid var(--warning);
}

.audit-summary-card.critical {
  border-top: 4px solid var(--danger);
}

.audit-findings-list {
  display: grid;
  gap: 10px;
}

.audit-finding {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--border);
  border-left: 5px solid #94a3b8;
  border-radius: 12px;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 14px 16px;
}

.audit-finding strong {
  color: var(--text);
  display: block;
  font-size: 15px;
  margin-bottom: 4px;
}

.audit-finding p {
  color: var(--muted);
  margin: 0;
}

.audit-finding.warning {
  border-left-color: var(--warning);
}

.audit-finding.critical {
  border-left-color: var(--danger);
}

.audit-finding.success {
  border-left-color: var(--success);
}

.audit-finding-meta {
  align-items: flex-end;
  display: grid;
  gap: 2px;
  min-width: 130px;
  text-align: right;
}

.audit-finding-meta span {
  color: var(--text);
  font-size: 24px;
  font-weight: 900;
}

.report-table-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.report-table-header h2 {
  font-size: 24px;
  line-height: 1.1;
}

.report-table-header p {
  color: var(--muted);
  font-size: 14px;
}

.table-footer-actions {
  align-items: center;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 14px;
}

.table-footer-actions .view[hidden] {
  display: none;
}

.platform-usage-watch {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.platform-usage-card {
  border: 1px solid var(--border);
  border-left: 4px solid #16a34a;
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, .05);
  display: grid;
  gap: 8px;
  padding: 14px;
}

.platform-usage-card.near {
  border-left-color: var(--warning);
}

.platform-usage-card.over {
  border-left-color: var(--danger);
}

.platform-usage-card strong {
  color: #0b1220;
  display: block;
  font-size: 15px;
}

.platform-usage-card span,
.platform-usage-card small {
  color: var(--muted);
  display: block;
  font-size: 12px;
  line-height: 1.35;
}

.platform-usage-card p {
  color: #0f172a;
  font-size: 14px;
  font-weight: 800;
  margin: 0;
}

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

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

  .reports-toolbar .btn {
    width: 100%;
  }

  .audit-center-header,
  .audit-finding {
    align-items: stretch;
    flex-direction: column;
  }

  .audit-actions,
  .audit-period-tabs {
    justify-content: stretch;
  }

  .audit-period-tabs .view,
  #runAuditBtn {
    flex: 1 1 calc(50% - 8px);
    width: auto;
  }

  .audit-summary-grid {
    grid-template-columns: 1fr;
  }

  .audit-finding-meta {
    align-items: flex-start;
    min-width: 0;
    text-align: left;
  }

  .support-toolbar {
    grid-template-columns: 1fr;
  }

  .notification-toolbar {
    grid-template-columns: 1fr;
  }

  .support-toolbar .btn,
  .notification-toolbar .btn {
    width: 100%;
  }

  .notification-item,
  .notification-main {
    flex-direction: column;
  }

  .notification-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .report-table-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .table-footer-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .table-footer-actions .view {
    width: 100%;
  }
}

@media print {
  .reports-toolbar,
  .quick-actions.no-print {
    display: none !important;
  }

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

  .report-table-header {
    border-bottom: 1px solid #d8e1ee;
    padding-bottom: 12px;
  }

  .data-table {
    font-size: 12px;
  }
}

/* ==========================================
   HYPERROUTE BRAND REFRESH
========================================== */

:root {
  --bg: #f4f7fb;
  --card: #ffffff;
  --text: #0b1220;
  --muted: #66758a;
  --primary: #0788e8;
  --primary-hover: #036fbe;
  --brand-color: var(--primary);
  --company-background-image: none;
  --success: #12a36d;
  --warning: #d98a00;
  --danger: #dc2626;
  --border: #dbe6f2;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 12px 28px rgba(15, 23, 42, .07);
  --sidebar-width: 248px;
}

body {
  background:
    linear-gradient(180deg, rgba(7, 136, 232, .06), rgba(7, 136, 232, 0) 180px),
    var(--bg);
  color: var(--text);
}

body.theme-dark {
  --bg: #0f172a;
  --card: #111827;
  --text: #f8fafc;
  --muted: #cbd5e1;
  --border: #334155;
  background:
    linear-gradient(180deg, rgba(37, 99, 235, .12), rgba(15, 23, 42, 0) 220px),
    var(--bg);
}

body.has-company-background {
  background:
    linear-gradient(180deg, rgba(248, 250, 252, .45), rgba(248, 250, 252, .6)),
    var(--company-background-image) center / cover fixed,
    var(--bg);
}

body.theme-dark.has-company-background {
  background:
    linear-gradient(180deg, rgba(15, 23, 42, .55), rgba(15, 23, 42, .7)),
    var(--company-background-image) center / cover fixed,
    var(--bg);
}

.sidebar {
  background:
    linear-gradient(180deg, #020713 0%, #061426 58%, #07101f 100%);
  border-right: 1px solid #112a45;
  box-shadow: 18px 0 38px rgba(2, 8, 23, .14);
  color: #f8fbff;
  padding: 22px 18px;
}

.sidebar .logo,
.sidebar h2.logo {
  display: block;
  margin: 0 0 24px;
  width: 100%;
  height: 92px;
  overflow: hidden;
  color: transparent;
  font-size: 0;
  line-height: 0;
}

.sidebar .logo::before,
.sidebar h2.logo::before {
  content: "";
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
  background: url("assets/hyperroute-tms-logo.png") center / contain no-repeat;
  box-shadow: none;
}

.sidebar .logo.company-logo-applied::before,
.sidebar h2.logo.company-logo-applied::before {
  background: var(--company-logo-url) center / contain no-repeat;
}

.sidebar a {
  border: 1px solid transparent;
  border-radius: 8px;
  color: #b8c6da;
  font-size: 14px;
  font-weight: 650;
  margin-bottom: 6px;
  padding: 11px 12px;
}

.sidebar a:hover,
.sidebar a.active {
  background: rgba(7, 136, 232, .13);
  border-color: rgba(98, 185, 255, .18);
  color: #ffffff;
}

.company-switcher {
  margin: 0 0 18px;
  padding: 12px;
  border: 1px solid rgba(98, 185, 255, .18);
  border-radius: 8px;
  background: rgba(255, 255, 255, .045);
}

.company-switcher label {
  display: block;
  margin-bottom: 7px;
  color: #8fa7c4;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.company-switcher select {
  width: 100%;
  min-height: 38px;
  border: 1px solid rgba(148, 163, 184, .28);
  border-radius: 8px;
  background: #07101f;
  color: #f8fbff;
  font-size: 13px;
  font-weight: 650;
  padding: 8px 10px;
}

.company-switcher-empty {
  color: #cbd5e1;
  font-size: 13px;
}

.role-hidden {
  display: none !important;
}

.logout-btn {
  width: 100%;
  min-height: 42px;
  margin-top: 18px;
  border: 0;
  border-radius: 8px;
  background: var(--danger);
  color: #ffffff;
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
  padding: 10px 12px;
}

.logout-btn:hover {
  background: #b91c1c;
}

.muted-line {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.platform-users-table {
  margin-top: 22px;
}

.readiness-grid {
  display: grid;
  grid-template-columns: minmax(260px, .8fr) minmax(320px, 1.2fr);
  gap: 18px;
  margin: 22px 0;
}

.readiness-score-card h2 {
  margin: 8px 0 12px;
  font-size: 54px;
  line-height: 1;
}

.readiness-actions-card {
  display: grid;
  align-content: center;
  gap: 18px;
}

.readiness-mini-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.readiness-mini-grid div {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
}

.readiness-mini-grid strong,
.readiness-mini-grid span {
  display: block;
}

.readiness-mini-grid strong {
  color: #0f172a;
  font-size: 24px;
}

.readiness-mini-grid span,
.readiness-next span {
  color: var(--muted);
  font-size: 13px;
}

.readiness-next {
  padding: 14px;
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  background: #f8fbff;
}

.readiness-next strong,
.readiness-next span {
  display: block;
}

.readiness-section {
  margin-top: 22px;
}

.readiness-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 900;
}

.readiness-dot.pass {
  background: #dcfce7;
  color: #166534;
}

.readiness-dot.warning {
  background: #fef3c7;
  color: #92400e;
}

.readiness-dot.blocker,
.warning-count {
  background: #fee2e2;
  color: #991b1b;
}

.launch-revenue-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.launch-revenue-card {
  display: grid;
  gap: 5px;
  min-height: 118px;
  align-content: start;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
}

.launch-revenue-card strong {
  color: #0b1220;
  font-size: 26px;
  line-height: 1.1;
}

.launch-revenue-card span {
  color: #1f2a3d;
  font-weight: 800;
}

.launch-revenue-card small {
  color: var(--muted);
  line-height: 1.4;
}

.compact-input {
  width: min(260px, 100%);
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  padding: 8px 10px;
}

.subscription-stack {
  display: grid;
  gap: 8px;
  min-width: 190px;
}

/* Stripe payment links are long (https://buy.stripe.com/... plus a session
   id) and would otherwise push this column wide or just scroll out of
   view while editing. Truncate the idle display with an ellipsis; the
   full URL is still in `value` (so Save still sends it) and in the
   `title` attribute (hover to see the whole link, or focus + Ctrl/Cmd+A
   to select all of it for copying). */
.payment-link-input {
  text-overflow: ellipsis;
}

.support-kpis {
  margin-bottom: 22px;
}

.notification-kpis {
  margin-bottom: 22px;
}

.support-toolbar,
.notification-toolbar {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(180px, 240px) auto;
  gap: 16px;
  align-items: end;
  margin-top: 24px;
}

.support-toolbar .btn,
.notification-toolbar .btn {
  grid-column: auto;
  width: 130px;
}

.alerts-toolbar {
  display: grid;
  grid-template-columns: minmax(160px, 220px) minmax(180px, 240px) minmax(220px, 1fr);
  gap: 16px;
  align-items: end;
  margin-top: 24px;
}

.action-center-list {
  display: grid;
  gap: 12px;
}

.action-center-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 16px;
  border: 1px solid var(--border);
  border-left: 4px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
}

.action-center-item.critical {
  border-left-color: var(--danger);
  background: #fff8f8;
}

.action-center-item.warning {
  border-left-color: var(--warning);
  background: #fffbeb;
}

.action-center-item h3 {
  margin: 8px 0 4px;
  font-size: 16px;
}

.action-center-item p {
  margin: 0 0 6px;
  color: var(--muted);
  line-height: 1.45;
}

.action-center-item small {
  color: #64748b;
  font-size: 12px;
}

.legal-page {
  max-width: 920px;
}

.legal-page h2 {
  margin: 22px 0 8px;
  font-size: 18px;
}

.legal-page p {
  color: var(--muted);
  line-height: 1.65;
}

.sidebar nav a.utility-link {
  font-size: 12px;
  opacity: .78;
}

.sidebar nav {
  display: grid;
  gap: 8px;
}

.sidebar-section {
  display: grid;
  gap: 6px;
  padding-bottom: 10px;
}

.sidebar-section + .sidebar-section {
  border-top: 1px solid rgba(148, 163, 184, .14);
  padding-top: 12px;
}

.sidebar-section-label {
  color: #7fa3c7;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  padding: 0 14px 2px;
  text-transform: uppercase;
}

.sidebar-more {
  border-top: 1px solid rgba(148, 163, 184, .16);
  margin-top: 10px;
  padding-top: 10px;
}

.sidebar-more summary {
  border: 1px solid rgba(98, 185, 255, .18);
  border-radius: 8px;
  color: #c8d7e8;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  list-style: none;
  margin-bottom: 8px;
  padding: 12px 14px;
}

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

.sidebar-more summary::after {
  content: "+";
  float: right;
}

.sidebar-more[open] summary::after {
  content: "-";
}

.sidebar-more:not([open]) a {
  display: none !important;
}

.sidebar-more a {
  margin-left: 8px;
}

.sidebar-more.sidebar-section {
  border-top: 1px solid rgba(148, 163, 184, .14);
  margin-top: 0;
  padding-top: 12px;
}

.sidebar-more.sidebar-section a {
  margin-left: 0;
}

.qa-checklist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.qa-checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

.qa-checklist-item input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
}

.qa-checklist-item strong,
.qa-checklist-item small {
  display: block;
}

.qa-checklist-item small {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.4;
}

.role-test-controls {
  margin-top: 12px;
}

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

.role-access-grid article {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  padding: 14px;
}

.role-access-grid h3 {
  margin: 0 0 10px;
  font-size: 15px;
  color: #0f172a;
}

.role-access-list {
  display: grid;
  gap: 8px;
}

.role-access-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
}

.role-access-item strong {
  font-size: 13px;
  line-height: 1.35;
  color: #334155;
}

.demo-readiness-list {
  grid-column: 1 / -1;
  margin-top: 18px;
}

.rate-confirmation-document {
  max-width: 980px;
}

.rate-confirmation-header,
.rate-confirmation-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 18px;
  margin-bottom: 18px;
}

.rate-confirmation-header h2,
.rate-confirmation-grid h3,
.rate-confirmation-terms h3 {
  margin-top: 0;
}

.rate-confirmation-terms {
  line-height: 1.6;
}

.signature-grid {
  display: grid;
  grid-template-columns: 1fr 180px;
  gap: 20px;
  margin-top: 34px;
}

.signature-grid span {
  border-top: 1px solid #111827;
  padding-top: 8px;
}

@media print {
  .no-print,
  .sidebar {
    display: none !important;
  }

  .layout,
  .content {
    display: block;
    margin: 0;
    padding: 0;
  }

  .card {
    box-shadow: none;
    border: 0;
  }
}

.notification-list {
  display: grid;
  gap: 12px;
}

.notification-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 16px;
  border: 1px solid var(--border);
  border-left: 4px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
}

.notification-item.unread {
  border-left-color: var(--primary);
  background: #f8fbff;
}

.notification-main {
  display: flex;
  gap: 14px;
  min-width: 0;
}

.notification-main h2 {
  margin: 0 0 4px;
  font-size: 16px;
}

.notification-main p {
  margin: 0 0 6px;
  color: var(--muted);
  line-height: 1.45;
}

.notification-main small {
  color: #64748b;
  font-size: 12px;
}

.notification-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  color: #64748b;
  font-size: 12px;
}

.notification-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.support-conversation-panel {
  margin-top: 22px;
  border-top: 1px solid var(--border);
  padding-top: 22px;
}

.support-message-list {
  display: grid;
  gap: 12px;
  margin: 18px 0;
}

.support-message {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  background: #f8fafc;
}

.support-message.internal {
  border-left-color: var(--warning);
  background: #fffbeb;
}

.support-message div {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.support-message strong {
  color: #0b1220;
}

.support-message small,
.support-message p {
  color: var(--muted);
}

.support-message p {
  margin: 0;
  line-height: 1.5;
}

.support-reply-form {
  display: grid;
  gap: 14px;
}

.hidden {
  display: none !important;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

.platform-company-list {
  display: grid;
  gap: 14px;
  width: 100%;
  min-width: 0;
}

.lifecycle-pipeline-grid {
  margin: 14px 0 18px;
}

.platform-company-card {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: stretch;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(15, 23, 42, .05);
  min-width: 0;
}

.platform-company-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.platform-company-main strong {
  color: #0b1220;
  font-size: 15px;
  overflow-wrap: anywhere;
}

.platform-company-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.platform-company-field {
  display: grid;
  gap: 5px;
}

.platform-company-field span,
.platform-company-stat span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.platform-company-field select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: #0f172a;
  font-size: 13px;
}

.platform-company-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(95px, 1fr));
  gap: 8px;
}

.platform-company-stat {
  display: grid;
  gap: 4px;
  padding: 9px;
  border: 1px solid #eef2f7;
  border-radius: 8px;
  background: #f8fafc;
}

.platform-company-stat strong {
  color: #0b1220;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.platform-company-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: flex-start;
}

.platform-company-actions .view,
.platform-company-actions .delete {
  min-width: 92px;
  white-space: nowrap;
}

.auth-page {
  display: block;
  background: #f8fafc;
}

.signup-page {
  display: block;
  min-height: 100vh;
  background:
    linear-gradient(108deg, #020617 0%, #07111f 42%, #f8fafc 42%, #eef4fb 100%);
}

.login-page {
  display: block;
  min-height: 100vh;
  background:
    linear-gradient(108deg, #020617 0%, #07111f 58%, #f8fafc 58%, #eef4fb 100%);
}

.login-shell {
  display: grid;
  grid-template-columns: minmax(500px, 1fr) minmax(360px, .76fr);
  gap: 32px;
  align-items: center;
  width: min(1180px, calc(100% - 40px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 36px 0;
}

.login-brand-panel {
  display: grid;
  align-content: center;
  gap: 26px;
  color: #ffffff;
  max-width: 720px;
  padding-right: 80px;
}

.login-logo {
  width: min(340px, 78vw);
  border-radius: 14px;
  height: auto;
  object-fit: contain;
}

.login-brand-panel h1 {
  max-width: 620px;
  margin: 8px 0 12px;
  color: #ffffff;
  font-size: 48px;
  line-height: 1.04;
}

.login-brand-panel p {
  max-width: 580px;
  color: #cbd5e1;
  font-size: 17px;
  line-height: 1.6;
}

.login-proof-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  max-width: 560px;
}

.login-proof-grid span {
  display: grid;
  place-items: center;
  min-height: 42px;
  padding: 9px 10px;
  border: 1px solid rgba(148, 163, 184, .42);
  border-radius: 8px;
  background: rgba(2, 6, 23, .86);
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  line-height: 1.25;
}

.login-card {
  display: grid;
  gap: 22px;
  width: 100%;
  padding: 34px;
  border: 1px solid rgba(226, 232, 240, .9);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, .18);
}

.login-heading h2 {
  margin: 5px 0 8px;
  color: #0b1220;
  font-size: 32px;
}

.login-heading p {
  color: var(--muted);
}

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

.login-form[hidden],
[hidden] {
  display: none !important;
}

.login-form .btn {
  width: 100%;
  margin-top: 4px;
}

.login-form .btn:disabled {
  cursor: not-allowed;
  opacity: .68;
}

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

.auth-actions .btn {
  width: 100%;
  margin: 0;
  text-align: center;
  text-decoration: none;
}

.auth-actions .secondary-action {
  border: 1px solid var(--border);
}

.signup-shell {
  display: grid;
  grid-template-columns: minmax(320px, .62fr) minmax(560px, 1fr);
  gap: 32px;
  align-items: center;
  width: min(1280px, calc(100% - 40px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 36px 0;
}

.signup-brand-panel {
  display: grid;
  align-content: center;
  gap: 26px;
  color: #ffffff;
  max-width: 520px;
  padding-right: 28px;
}

.signup-brand-panel h1 {
  margin: 8px 0 12px;
  color: #ffffff;
  font-size: 42px;
  line-height: 1.06;
}

.signup-brand-panel p {
  color: #cbd5e1;
  font-size: 16px;
  line-height: 1.6;
}

.signup-panel {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 28px;
}

.signup-heading {
  margin-bottom: 22px;
}

.signup-heading h1 {
  font-size: 34px;
  line-height: 1.1;
  margin: 6px 0 8px;
}

.signup-heading p,
.auth-switch {
  color: var(--muted);
}

.signup-confirmation {
  padding: 20px;
  border: 1px solid #a7f3d0;
  border-radius: 8px;
  background: #ecfdf5;
}

.signup-confirmation[hidden] {
  display: none;
}

.signup-confirmation h2 {
  margin: 0 0 12px;
  color: #065f46;
}

.signup-confirmation p {
  line-height: 1.5;
}

.signup-confirmation .btn {
  display: inline-block;
  margin-top: 8px;
}

.auth-switch {
  margin-top: 18px;
  font-size: 14px;
}

.auth-switch a {
  color: var(--primary);
  font-weight: 800;
  text-decoration: none;
}

.driver-portal-entry {
  display: grid;
  margin-top: -4px;
}

.driver-portal-entry a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid rgba(14, 165, 233, .24);
  border-radius: 8px;
  background: rgba(14, 165, 233, .08);
  color: #075985;
  font-weight: 900;
  text-decoration: none;
}

.public-portal {
  display: block;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.12), transparent 34rem),
    var(--bg);
}

.public-portal-shell {
  width: min(1040px, calc(100% - 32px));
  margin: 0 auto;
  padding: 44px 0;
}

.public-portal-hero {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 22px;
}

.public-portal-hero h1 {
  font-size: clamp(32px, 5vw, 52px);
  line-height: 1;
  margin-bottom: 10px;
}

.public-portal-hero p {
  max-width: 720px;
  color: var(--muted);
}

.full-span {
  grid-column: 1 / -1;
}

.driver-auth-shell {
  grid-template-columns: minmax(360px, .92fr) minmax(420px, 600px);
}

.driver-auth-card {
  align-content: start;
}

.driver-auth-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
}

.driver-auth-toggle button {
  min-height: 40px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #475569;
  cursor: pointer;
  font-weight: 900;
}

.driver-auth-toggle button.active {
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 8px 20px rgba(15, 23, 42, .08);
}

.simple-app-shell {
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(14, 165, 233, .11), transparent 34%),
    #f1f5f9;
  padding: 32px 18px;
}

.simple-app-content {
  width: min(1040px, 100%);
  margin: 0 auto;
}

.narrow-content {
  width: min(860px, 100%);
}

.driver-confirmation-card {
  display: grid;
  gap: 18px;
}

.driver-confirmation-steps {
  display: grid;
  gap: 12px;
}

.driver-confirmation-steps div {
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
}

.driver-confirmation-steps span {
  color: var(--muted);
}

.disabled-link {
  opacity: .65;
}

.driver-connection-card {
  margin-bottom: 18px;
}

.driver-connect-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.driver-company-list {
  display: grid;
  gap: 12px;
}

.driver-request-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

.driver-request-card h3 {
  margin: 0 0 4px;
  color: #0f172a;
  font-size: 16px;
}

.driver-request-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.message-thread {
  display: grid;
  gap: 14px;
  max-height: 540px;
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background:
    radial-gradient(circle at top left, rgba(14, 165, 233, .08), transparent 32%),
    linear-gradient(180deg, #f8fafc, #eef4fb);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .75);
}

.message-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.message-row.outgoing {
  flex-direction: row-reverse;
}

.message-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(148, 163, 184, .28);
  border-radius: 999px;
  background: #ffffff;
  color: #0f172a;
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(15, 23, 42, .08);
}

.message-row.outgoing .message-avatar {
  background: #0284c7;
  color: #ffffff;
  border-color: rgba(2, 132, 199, .32);
}

.message-bubble {
  position: relative;
  width: min(76%, 680px);
  padding: 12px 14px;
  border: 1px solid rgba(226, 232, 240, .86);
  border-radius: 18px;
  background: #f8fafc;
  box-shadow: 0 8px 22px rgba(15, 23, 42, .07);
}

.message-bubble.driver {
  background: #ffffff;
  border-color: rgba(226, 232, 240, .9);
}

.message-bubble.company {
  background: linear-gradient(135deg, #0284c7, #0ea5e9);
  border-color: rgba(2, 132, 199, .3);
  color: #ffffff;
}

.message-row.incoming .message-bubble::before,
.message-row.outgoing .message-bubble::before {
  content: "";
  position: absolute;
  bottom: 9px;
  width: 10px;
  height: 10px;
  transform: rotate(45deg);
}

.message-row.incoming .message-bubble::before {
  left: -4px;
  background: inherit;
  border-left: 1px solid rgba(226, 232, 240, .64);
  border-bottom: 1px solid rgba(226, 232, 240, .64);
}

.message-row.outgoing .message-bubble::before {
  right: -4px;
  background: inherit;
  border-top: 1px solid rgba(226, 232, 240, .64);
  border-right: 1px solid rgba(226, 232, 240, .64);
}

.message-bubble-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.message-bubble strong {
  color: #0f172a;
}

.message-bubble.company strong,
.message-bubble.company p,
.message-bubble.company span {
  color: #ffffff;
}

.message-bubble.company span {
  opacity: .82;
}

.message-bubble em,
.chat-unread-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 3px 9px;
  border-radius: 999px;
  background: #fee2e2;
  color: #991b1b;
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
  text-transform: uppercase;
}

.message-bubble p {
  margin: 0 0 8px;
  color: #334155;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.message-bubble span {
  color: var(--muted);
  font-size: 12px;
}

.message-compose {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  margin-top: 18px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 12px 30px rgba(15, 23, 42, .08);
}

.message-compose textarea {
  min-height: 72px;
  border-radius: 14px;
  background: #f8fafc;
  resize: vertical;
}

.message-compose .btn {
  min-width: 140px;
  min-height: 46px;
  border-radius: 14px;
  margin: 0;
}

.driver-chat-card,
.driver-admin-message-card {
  display: grid;
  gap: 16px;
}

.driver-chat-header,
.driver-chat-toolbar-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.driver-chat-header h2 {
  margin: 4px 0 0;
}

.driver-chat-header {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.admin-message-thread {
  max-height: 420px;
}

.driver-management-kpis {
  margin-bottom: 18px;
}

.table-actions.compact {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.table-actions.compact .view,
.table-actions.compact .delete {
  min-height: 34px;
  padding: 8px 12px;
}

.driver-admin-message-card {
  margin-bottom: 32px;
}

.employee-permissions-form {
  display: grid;
  gap: 18px;
}

.permission-toggle-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.permission-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: #334155;
  font-size: 13px;
  font-weight: 800;
}

.permission-toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

@media (max-width: 760px) {
  .driver-auth-shell {
    grid-template-columns: 1fr;
  }

  .driver-connect-toolbar {
    grid-template-columns: 1fr;
  }

  .driver-request-card {
    align-items: stretch;
    flex-direction: column;
  }

  .driver-request-card .btn,
  .driver-request-card .view {
    width: 100%;
  }

  .message-bubble {
    width: min(88%, 100%);
  }

  .message-avatar {
    width: 30px;
    height: 30px;
    flex-basis: 30px;
    font-size: 11px;
  }

  .driver-chat-header,
  .driver-chat-toolbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .message-compose {
    grid-template-columns: 1fr;
  }

  .message-compose .btn {
    width: 100%;
  }

  .permission-toggle-grid {
    grid-template-columns: 1fr;
  }

  .role-access-grid {
    grid-template-columns: 1fr;
  }
}

.signup-form .field:first-child {
  grid-column: 1 / -1;
}

.signup-form .btn {
  grid-column: 1 / -1;
  width: 100%;
  max-width: 100%;
  margin-top: 4px;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.25;
}

.signup-form .btn:disabled {
  cursor: not-allowed;
  opacity: .68;
}

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

.plan-option {
  display: grid;
  gap: 6px;
  min-height: 92px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  padding: 14px;
}

.plan-option input {
  width: auto;
}

.plan-option span {
  color: #334155;
  font-weight: 800;
}

.plan-option strong {
  color: #0b1220;
  font-size: 18px;
}

.plan-limit {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.plan-option.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(7, 136, 232, .12);
}

@media (max-width: 900px) {
  .login-page {
    background: #f8fafc;
  }

  .signup-page {
    background: #f8fafc;
  }

  .login-shell {
    grid-template-columns: 1fr;
    align-content: start;
    min-height: auto;
    padding: 24px 0;
  }

  .login-brand-panel {
    padding: 24px;
    border-radius: 8px;
    background: #020617;
  }

  .login-brand-panel h1 {
    font-size: 34px;
  }

  .login-proof-grid {
    grid-template-columns: 1fr;
    max-width: none;
  }

  .login-card {
    padding: 24px;
  }

  .signup-shell {
    grid-template-columns: 1fr;
    align-content: start;
    min-height: auto;
    padding: 24px 0;
  }

  .signup-brand-panel {
    max-width: none;
    padding: 24px;
    border-radius: 8px;
    background: #020617;
  }

  .signup-brand-panel h1 {
    font-size: 32px;
  }

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

  .signup-form {
    grid-template-columns: 1fr;
  }
}

.onboarding-summary {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(220px, .8fr);
  gap: 18px;
  align-items: center;
}

.onboarding-focus {
  margin-top: 22px;
}

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

.launch-phase-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 12px;
  align-items: center;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, .06);
}

.launch-phase-card span {
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: #e0f2fe;
  color: #0369a1;
  font-weight: 900;
}

.launch-phase-card strong {
  color: #0b1220;
  font-size: 15px;
}

.launch-phase-card small {
  color: var(--muted);
  font-weight: 750;
}

.launch-phase-card.complete {
  border-left: 4px solid var(--success);
}

.launch-phase-card.attention {
  border-left: 4px solid var(--warning);
}

.onboarding-progress-track {
  width: 100%;
  height: 12px;
  overflow: hidden;
  border-radius: 8px;
  background: #e2e8f0;
}

.onboarding-progress-bar {
  width: 0;
  height: 100%;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--primary), var(--success));
  transition: width .25s ease;
}

.onboarding-next {
  display: inline-flex;
  width: fit-content;
  margin: 10px 0 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: #eef6ff;
  color: #075985;
  font-size: 13px;
  font-weight: 800;
}

.onboarding-list {
  display: grid;
  gap: 12px;
  margin-top: 24px;
}

.onboarding-item {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) 150px;
  gap: 18px;
  align-items: center;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, .06);
}

.onboarding-item.complete {
  border-left: 4px solid var(--success);
}

.onboarding-item.attention {
  border-left: 4px solid var(--warning);
}

.onboarding-status {
  width: fit-content;
  border-radius: 8px;
  background: #f1f5f9;
  color: #334155;
  font-size: 13px;
  font-weight: 800;
  padding: 8px 10px;
}

.onboarding-item.complete .onboarding-status {
  background: #dcfce7;
  color: #166534;
}

.onboarding-item.attention .onboarding-status {
  background: #fef3c7;
  color: #92400e;
}

.onboarding-phase {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.onboarding-copy h2 {
  margin: 0 0 4px;
  font-size: 18px;
}

.onboarding-copy p {
  margin: 0 0 6px;
  color: var(--muted);
}

.onboarding-copy span {
  color: #334155;
  font-size: 13px;
  font-weight: 650;
}

.onboarding-action {
  justify-content: center;
  text-align: center;
}

.quick-start-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.quick-start-card {
  display: grid;
  gap: 7px;
  min-height: 132px;
  align-content: start;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
  color: inherit;
  text-decoration: none;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.quick-start-card:hover {
  transform: translateY(-1px);
  border-color: rgba(7, 136, 232, .45);
  box-shadow: 0 12px 22px rgba(15, 23, 42, .08);
}

.quick-start-card strong {
  color: #0b1220;
  font-size: 15px;
}

.quick-start-card span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.quick-start-card small {
  width: fit-content;
  margin-top: auto;
  padding: 6px 9px;
  border-radius: 8px;
  background: rgba(7, 136, 232, .10);
  color: #075f9f;
  font-size: 12px;
  font-weight: 850;
}

.customer-account-profile {
  display: grid;
  gap: 18px;
}

.customer-account-hero {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: stretch;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
}

.customer-account-hero h3 {
  margin: 4px 0 6px;
  color: #0b1220;
  font-size: 24px;
}

.customer-account-hero p {
  color: var(--muted);
}

.customer-launch-score {
  display: grid;
  min-width: 170px;
  align-content: center;
  justify-items: center;
  padding: 16px;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid var(--border);
}

.customer-launch-score strong {
  color: #0b1220;
  font-size: 36px;
  line-height: 1;
}

.customer-launch-score span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.customer-launch-score.complete {
  border-left: 4px solid var(--success);
}

.customer-launch-score.attention {
  border-left: 4px solid var(--warning);
}

.customer-account-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}

.customer-account-stat {
  display: grid;
  gap: 5px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

.customer-account-stat span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.customer-account-stat strong {
  color: #0b1220;
  font-size: 16px;
}

.customer-account-columns {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(260px, .8fr);
  gap: 18px;
}

.customer-account-columns article {
  display: grid;
  align-content: start;
  gap: 12px;
}

.customer-account-columns h3 {
  margin: 0;
  font-size: 18px;
}

.handoff-note-box {
  display: grid;
  gap: 10px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
}

.handoff-form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.handoff-note-box p {
  color: var(--muted);
}

.readiness-status {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 900;
}

.readiness-status.pass {
  background: #dcfce7;
  color: #166534;
}

.readiness-status.warning {
  background: #fef3c7;
  color: #92400e;
}

.readiness-status.blocker {
  background: #fee2e2;
  color: #991b1b;
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.dashboard-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(118px, 1fr));
  gap: 10px;
  align-items: stretch;
  min-width: min(620px, 100%);
}

.dashboard-actions .view {
  width: 100%;
  min-width: 0;
}

.demo-mode-banner,
.demo-admin-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
  border-left: 4px solid var(--primary);
  background:
    linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.demo-mode-banner[hidden] {
  display: none;
}

.demo-mode-banner h2,
.demo-admin-panel h2 {
  margin: 4px 0 6px;
}

.demo-mode-banner p,
.demo-admin-panel p {
  color: var(--muted);
}

.demo-script-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.secondary-action {
  background: #f8fafc;
  color: #0f172a;
  border: 1px solid var(--border);
}

.dashboard-command-grid {
  display: grid;
  grid-template-columns: minmax(260px, .8fr) minmax(320px, 1.2fr);
  gap: 18px;
  margin-bottom: 20px;
}

.command-score-card h2 {
  margin: 8px 0 12px;
  font-size: 54px;
  line-height: 1;
}

.command-score-card p,
.command-panel p {
  color: var(--muted);
}

.health-meter {
  width: 100%;
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e8f0;
}

.health-meter span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--danger), var(--warning), var(--success));
  transition: width .25s ease;
}

.command-panel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.command-panel h2 {
  margin: 8px 0;
  font-size: 30px;
}

.mini-stat-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.mini-stat-row span {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 13px;
}

.mini-stat-row strong {
  display: block;
  color: #0f172a;
  font-size: 20px;
}

.dashboard-kpis {
  margin-bottom: 20px;
}

.owner-command-center {
  margin: 20px 0;
}

.owner-command-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.owner-command-metric {
  display: grid;
  gap: 6px;
  min-height: 116px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
}

.owner-command-metric span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.owner-command-metric strong {
  color: #0b1220;
  font-size: 26px;
  line-height: 1;
}

.owner-command-metric small {
  color: var(--muted);
  font-size: 13px;
}

.owner-command-lists {
  margin-top: 18px;
}

.owner-command-lists h3 {
  margin: 0 0 12px;
  font-size: 16px;
}

.profit-leak-panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  margin-top: 16px;
  padding: 16px;
}

.profit-leak-list {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.profit-leak-item {
  align-items: flex-start;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-left: 4px solid #94a3b8;
  border-radius: 8px;
  color: inherit;
  display: grid;
  gap: 10px;
  min-height: 116px;
  padding: 13px;
  text-decoration: none;
}

.profit-leak-item:hover {
  background: #f8fbff;
  border-color: #93c5fd;
}

.profit-leak-item.warning {
  border-left-color: var(--danger);
}

.profit-leak-item.caution {
  border-left-color: var(--warning);
}

.profit-leak-impact {
  color: #0f172a;
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
}

.profit-leak-item strong,
.profit-leak-item small {
  display: block;
}

.profit-leak-item strong {
  color: #172033;
  font-size: 14px;
}

.profit-leak-item small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  margin-top: 4px;
}

.rate-intelligence-panel {
  grid-column: 1 / -1;
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  background: #f8fafc;
}

.rate-intelligence-panel h2 {
  margin: 4px 0;
  font-size: 18px;
}

.rate-intelligence-panel p {
  margin: 0;
  color: var(--muted);
}

.rate-intelligence-panel.rate-good {
  border-left-color: var(--success);
  background: #f0fdf4;
}

.rate-intelligence-panel.rate-watch {
  border-left-color: var(--warning);
  background: #fffbeb;
}

.rate-intelligence-panel.rate-danger {
  border-left-color: var(--danger);
  background: #fef2f2;
}

.rate-intelligence-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.rate-intelligence-grid span {
  display: grid;
  gap: 4px;
  min-height: 72px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--muted);
  font-size: 12px;
}

.rate-intelligence-grid strong {
  color: #0f172a;
  font-size: 18px;
}

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

.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.section-header h2 {
  margin: 4px 0 0;
}

.section-eyebrow {
  margin: 0;
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.dashboard-list {
  display: grid;
  gap: 10px;
}

.dashboard-list-item {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 58px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: inherit;
  text-decoration: none;
}

.dashboard-list-item:hover {
  border-color: #93c5fd;
  background: #f8fbff;
}

.dashboard-list-item strong,
.dashboard-list-item small {
  display: block;
}

.dashboard-list-item small {
  margin-top: 3px;
  color: var(--muted);
}

/* Company Setup Warnings groups every warning for a company under one row
   now (was one flat row per warning), so that row can hold several lines -
   top-align instead of vertically centering so the count badge doesn't look
   stranded next to a tall list. */
.quality-warning-item {
  align-items: start;
  min-height: 0;
}

.quality-warning-item .status-count {
  margin-top: 2px;
}

.status-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: #fee2e2;
  color: #991b1b;
  font-weight: 900;
}

.quote-count {
  width: auto;
  min-width: 48px;
  padding: 0 8px;
  white-space: nowrap;
}

.activity-dot {
  justify-self: center;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--primary);
  box-shadow: 0 0 0 6px #e0f2fe;
}

.empty-state {
  padding: 18px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--muted);
  background: #f8fafc;
}

@media (max-width: 900px) {
  .onboarding-summary,
  .onboarding-item {
    grid-template-columns: 1fr;
  }

  .onboarding-launch-grid {
    grid-template-columns: 1fr;
  }

  .customer-account-hero,
  .customer-account-columns {
    grid-template-columns: 1fr;
    display: grid;
  }

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

  .platform-company-card {
    grid-template-columns: 1fr;
  }

  .platform-company-controls {
    grid-template-columns: 1fr;
  }

  .platform-company-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .platform-company-actions {
    justify-content: flex-start;
  }

  .handoff-form-grid {
    grid-template-columns: 1fr;
  }

  .onboarding-action {
    width: 100%;
  }

  .dashboard-command-grid,
  .dashboard-two-column,
  .owner-command-grid,
  .profit-leak-list,
  .rate-intelligence-grid,
  .readiness-grid,
  .readiness-mini-grid,
  .launch-revenue-grid,
  .quick-start-grid,
  .mini-stat-row {
    grid-template-columns: 1fr;
  }

  .quick-actions {
    justify-content: flex-start;
  }

  .demo-mode-banner,
  .demo-admin-panel {
    align-items: flex-start;
    flex-direction: column;
  }

  .demo-script-actions {
    justify-content: flex-start;
  }
}

.main,
.content {
  padding: 32px;
}

main {
  width: 100%;
}

.page-header {
  gap: 16px;
}

.page-header h1 {
  color: #0b1220;
  font-size: clamp(28px, 3vw, 40px);
  line-height: 1.05;
}

.page-header p {
  color: var(--muted);
}

.card,
.details-card,
.kpi-card,
.list li {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card,
.details-card {
  padding: 24px;
}

.kpi-card {
  background:
    linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  padding: 20px;
}

.kpi-card h3 {
  color: #0b1220;
  font-size: 34px;
}

.kpi-card.success,
.kpi-card.warning,
.kpi-card.caution {
  border-top-width: 3px;
}

table {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

thead {
  background: #eef5fb;
}

th {
  color: #536276;
  letter-spacing: .04em;
}

td {
  color: #172033;
}

tbody tr:hover {
  background: #f4f9ff;
}

.field label {
  color: #536276;
}

.field input,
.field select,
.field textarea {
  border-color: var(--border);
  border-radius: 8px;
  color: #0b1220;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(7, 136, 232, .12);
}

.btn,
button,
.actions a,
.actions button {
  border-radius: 8px;
}

.btn,
.view,
.delete,
.secondary-action,
.actions a,
.actions button,
.quick-actions a,
.quick-actions button,
.table-actions a,
.table-actions button {
  align-items: center;
  display: inline-flex;
  justify-content: center;
  line-height: 1.15;
  min-height: 38px;
  white-space: nowrap;
}

.actions,
.quick-actions,
.table-actions,
.dispatch-actions,
.paperwork-actions,
.platform-company-actions {
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  overflow: visible;
}

.btn,
.view {
  background: linear-gradient(180deg, #109cf4 0%, var(--primary) 100%);
  color: #ffffff;
  box-shadow: 0 10px 18px rgba(7, 136, 232, .18);
}

.btn:hover,
.view:hover {
  background: var(--primary-hover);
}

.view,
.delete,
a.view,
button.view,
button.delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border: 0;
  border-radius: 8px;
  color: #ffffff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  padding: 9px 12px;
  text-decoration: none;
  white-space: nowrap;
}

a.view:visited,
a.view:active,
a.view:focus,
a.view:hover {
  color: #ffffff;
  text-decoration: none;
}

.delete:hover,
button.delete:hover {
  background: #b91c1c;
}

td .view,
td .delete {
  margin: 2px 4px 2px 0;
  vertical-align: middle;
}

.load-row-actions {
  align-items: stretch;
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(78px, 1fr));
  max-width: 190px;
}

.load-row-actions .view,
.load-row-actions .delete {
  margin: 0;
  min-height: 38px;
  padding: 9px 10px;
  width: 100%;
}

.load-row-actions .delete {
  grid-column: 2;
}

.load-row-actions .view,
.load-row-actions .delete {
  font-size: 12px;
}

@media (max-width: 900px) {
  .load-row-actions {
    grid-template-columns: 1fr;
    max-width: none;
    min-width: 130px;
  }

  .load-row-actions .delete {
    grid-column: auto;
  }
}

/* ==========================================
   CUSTOMER LOAD TRACKING
========================================== */

.tracking-page {
  display: block;
  min-height: 100vh;
  background:
    linear-gradient(180deg, #07111f 0, #07111f 280px, #f4f7fb 280px, #eef4fb 100%);
}

.tracking-shell {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 56px;
}

.tracking-header {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 24px;
  align-items: center;
  margin-bottom: 26px;
  color: #ffffff;
}

.tracking-brand-wrap {
  display: grid;
  gap: 10px;
}

.tracking-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(14, 165, 233, .20), rgba(2, 6, 23, .95)),
    #020713;
  border: 1px solid rgba(148, 163, 184, .24);
  box-shadow: 0 18px 44px rgba(2, 6, 23, .24);
}

.company-first-brand {
  color: #ffffff;
  font-size: 42px;
  font-weight: 900;
  letter-spacing: .02em;
}

.tracking-powered-pill {
  display: inline-flex;
  justify-content: center;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid rgba(148, 163, 184, .28);
  border-radius: 8px;
  background: rgba(15, 23, 42, .62);
  color: #e2e8f0;
  font-size: 12px;
  font-weight: 850;
}

.tracking-brand img {
  max-width: 150px;
  max-height: 88px;
  object-fit: contain;
}

.tracking-kicker {
  margin: 0 0 8px;
  color: #38bdf8;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.tracking-header h1 {
  max-width: 760px;
  color: #ffffff;
  font-size: clamp(34px, 5vw, 56px);
  line-height: 1;
}

.tracking-header p {
  max-width: 680px;
  color: #cbd5e1;
  font-size: 16px;
  line-height: 1.55;
}

.tracking-panel span,
.tracking-company {
  color: var(--muted);
}

.tracking-card,
.tracking-summary,
.tracking-panel {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.tracking-card {
  padding: 24px;
  margin-bottom: 22px;
}

.tracking-card-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 18px;
}

.tracking-card-heading h2 {
  color: #0b1220;
  font-size: 22px;
}

.tracking-card-heading > span {
  width: fit-content;
  padding: 7px 10px;
  border-radius: 8px;
  background: #eef6ff;
  color: #075fa6;
  font-size: 12px;
  font-weight: 850;
}

.tracking-form {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto;
  gap: 16px;
  align-items: end;
}

.tracking-form .btn {
  grid-column: auto;
  width: 160px;
}

.tracking-result {
  display: grid;
  gap: 22px;
}

.tracking-summary {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 24px;
  border-left: 4px solid var(--primary);
}

.tracking-summary h2 {
  font-size: 30px;
  line-height: 1.1;
  margin: 4px 0 6px;
}

.tracking-code {
  display: inline-flex;
  width: fit-content;
  margin-top: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  background: #f1f5f9;
  color: #334155;
  font-size: 13px;
  font-weight: 800;
}

.tracking-status {
  display: inline-flex;
  justify-content: center;
  border-radius: 999px;
  background: #edf6ff;
  color: #075fa6;
  font-size: 14px;
  font-weight: 900;
  padding: 9px 12px;
  text-transform: capitalize;
  white-space: nowrap;
}

.tracking-status-block {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.tracking-status-block small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.tracking-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.tracking-grid-secondary {
  margin-top: -6px;
}

.tracking-panel {
  padding: 18px;
  min-height: 126px;
}

.tracking-panel h3 {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .04em;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.tracking-panel p {
  color: #0b1220;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 6px;
}

.tracking-timeline {
  display: grid;
  gap: 12px;
  list-style: none;
  margin-top: 16px;
}

.tracking-timeline li {
  position: relative;
  border-left: 3px solid #cbd5e1;
  padding: 4px 0 18px 18px;
}

.tracking-timeline li.complete {
  border-left-color: var(--primary);
}

.tracking-timeline li::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 6px;
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: #cbd5e1;
}

.tracking-timeline li.complete::before {
  background: var(--primary);
}

.tracking-timeline strong {
  display: block;
  color: #0b1220;
  font-size: 15px;
  text-transform: capitalize;
}

.tracking-timeline span,
.tracking-timeline p {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 3px;
}

.tracking-footer {
  display: grid;
  gap: 4px;
  justify-items: center;
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.tracking-footer strong {
  color: #0f172a;
}

.tracking-footer span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
}

/* ==========================================
   CUSTOMER-FACING PRINT DOCUMENTS
========================================== */

.print-document {
  max-width: 980px;
  margin: 0 auto;
  border: 1px solid #d8e3f0;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 16px 40px rgba(15, 23, 42, .08);
}

.document-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  padding-bottom: 22px;
  margin-bottom: 22px;
  border-bottom: 3px solid #07111f;
}

.document-header h2 {
  margin: 5px 0 8px;
  color: #07111f;
  font-size: 30px;
  line-height: 1.05;
}

.document-header p {
  color: #536276;
  font-size: 13px;
  line-height: 1.45;
}

.document-title-block,
.document-logo-box {
  display: grid;
  justify-items: end;
  gap: 7px;
  min-width: 190px;
}

.document-title-block strong {
  color: #07111f;
  font-size: 25px;
}

.document-title-block span,
.document-title-block small,
.document-logo-box span {
  width: fit-content;
  padding: 7px 9px;
  border-radius: 8px;
  background: #eef6ff;
  color: #075fa6;
  font-size: 12px;
  font-weight: 850;
  text-transform: capitalize;
}

.document-title-block img {
  display: none;
  max-width: 160px;
  max-height: 90px;
  object-fit: contain;
}

.document-logo-box img {
  display: none;
  max-width: 160px;
  max-height: 90px;
  object-fit: contain;
}

.invoice-document {
  display: grid;
  gap: 20px;
}

.invoice-hero {
  display: flex;
  justify-content: space-between;
  gap: 22px;
  align-items: stretch;
  padding: 22px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid var(--border);
}

.invoice-hero h2 {
  margin: 0 0 12px;
  color: #07111f;
  font-size: 34px;
}

.invoice-hero p {
  margin: 5px 0;
  color: #536276;
}

.invoice-total-box {
  display: grid;
  align-content: center;
  justify-items: end;
  min-width: 210px;
  padding: 18px;
  border-radius: 8px;
  background: #07111f;
  color: #ffffff;
}

.invoice-total-box span {
  color: #9dd7ff;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.invoice-total-box strong {
  margin: 8px 0;
  font-size: 34px;
}

.invoice-total-box small {
  color: #dbeafe;
  font-weight: 850;
  text-transform: capitalize;
}

.document-info-grid,
.invoice-line-items {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.document-info-grid div,
.invoice-line-items div {
  display: grid;
  gap: 5px;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

.document-info-grid span,
.invoice-line-items span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.document-info-grid strong,
.invoice-line-items strong {
  color: #07111f;
  font-size: 18px;
}

.invoice-line-total {
  border-color: rgba(7, 136, 232, .35) !important;
  background: #eef6ff !important;
}

.document-notes {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

.document-notes h3 {
  margin: 0 0 8px;
}

.document-notes p {
  color: #536276;
  line-height: 1.55;
}

.rate-confirmation-document {
  display: grid;
  gap: 18px;
}

.rate-confirmation-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 18px;
}

.rate-confirmation-grid > div,
.rate-confirmation-terms {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

.rate-confirmation-grid h3,
.rate-confirmation-terms h3 {
  margin: 0 0 10px;
  color: #07111f;
}

.rate-confirmation-grid p,
.rate-confirmation-terms p {
  margin: 6px 0;
  color: #536276;
  line-height: 1.45;
}

.document-footer {
  display: grid;
  gap: 4px;
  justify-items: center;
  margin-top: 4px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.document-footer span {
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.document-footer strong {
  color: #07111f;
}

/* ==========================================
   DEMO CENTER
========================================== */

.demo-center-hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  margin-bottom: 22px;
  border-left: 4px solid var(--primary);
  background:
    linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.demo-center-hero h2 {
  margin: 5px 0 8px;
  color: #07111f;
  font-size: 30px;
}

.demo-center-hero p {
  color: var(--muted);
  line-height: 1.55;
}

.demo-center-score {
  display: grid;
  justify-items: center;
  min-width: 150px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

.demo-center-score strong {
  color: #07111f;
  font-size: 42px;
  line-height: 1;
}

.demo-center-score span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

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

.demo-center-card {
  display: grid;
  gap: 16px;
  align-content: start;
}

.demo-center-card-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.demo-center-card-header h2 {
  margin: 4px 0 6px;
  color: #07111f;
}

.demo-center-card-header p {
  color: var(--muted);
}

.demo-center-card-header > span {
  width: fit-content;
  padding: 7px 10px;
  border-radius: 8px;
  background: #eef6ff;
  color: #075fa6;
  font-size: 12px;
  font-weight: 850;
  text-transform: capitalize;
}

.demo-page-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.demo-page-actions .view {
  width: 100%;
}

.demo-script-box {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
}

.demo-script-box p {
  margin: 0;
  color: #536276;
  line-height: 1.45;
}

.demo-script-box strong {
  color: #07111f;
}

.demo-meeting-card {
  display: grid;
  gap: 18px;
}

.demo-focus-card {
  display: grid;
  gap: 16px;
  margin-bottom: 22px;
  border-left: 4px solid var(--success);
}

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

.demo-meeting-step {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
}

.demo-meeting-step strong,
.demo-meeting-step span {
  display: block;
}

.demo-meeting-step strong {
  margin-bottom: 5px;
  color: #07111f;
  font-size: 14px;
}

.demo-meeting-step span {
  color: #536276;
  font-size: 13px;
  line-height: 1.45;
}

.demo-meeting-step .view {
  flex: 0 0 auto;
  min-width: 76px;
}

.demo-runbook-board {
  display: grid;
  gap: 14px;
}

.demo-readiness-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.demo-readiness-grid div {
  display: grid;
  gap: 8px;
  align-content: start;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fbff;
}

.demo-readiness-grid strong {
  color: #07111f;
  font-size: 14px;
}

.demo-readiness-grid span {
  color: #536276;
  font-size: 13px;
  line-height: 1.45;
}

.demo-runbook-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

.demo-runbook-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.demo-runbook-card-header .section-eyebrow {
  margin: 0;
}

.demo-runbook-card-header .view {
  min-width: 72px;
}

.demo-runbook-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.demo-runbook-grid div {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 150px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fbff;
}

.demo-runbook-grid strong {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--primary);
  color: #ffffff;
  font-size: 13px;
}

.demo-runbook-grid span {
  color: #536276;
  font-size: 13px;
  line-height: 1.45;
}

@media (max-width: 760px) {
  .demo-center-hero,
  .demo-center-card-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .demo-center-grid,
  .demo-page-actions,
  .demo-readiness-grid,
  .demo-meeting-flow,
  .demo-runbook-grid {
    grid-template-columns: 1fr;
  }

  .demo-meeting-step {
    align-items: stretch;
    flex-direction: column;
  }

  .document-header,
  .invoice-hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .document-title-block,
  .document-logo-box,
  .invoice-total-box {
    justify-items: start;
    width: 100%;
  }

  .document-info-grid,
  .invoice-line-items,
  .rate-confirmation-grid {
    grid-template-columns: 1fr;
  }
}

@media print {
  @page {
    margin: .55in;
  }

  body {
    background: #ffffff !important;
  }

  .sidebar,
  .no-print,
  #invoiceUpdateForm,
  #invoiceDetailsMessage,
  #rateConfirmationMessage,
  .back-link {
    display: none !important;
  }

  .layout,
  .content {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    max-width: none !important;
  }

  .print-document,
  .card,
  .details-card {
    box-shadow: none !important;
  }

  .print-document {
    border: 0 !important;
    padding: 0 !important;
  }

  .document-header {
    border-bottom-color: #07111f !important;
  }
}

/* Sidebar controls */
.sidebar-controls {
  display: grid;
  gap: 10px;
  margin: 0 0 18px;
}

.sidebar-control-btn {
  width: 100%;
  min-height: 42px;
  border: 1px solid rgba(148, 163, 184, .22);
  border-radius: 8px;
  background: rgba(7, 136, 232, .16);
  color: #f8fbff;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.1;
  padding: 11px 14px;
  text-align: left;
  transition: background .18s ease, border-color .18s ease, color .18s ease;
}

.sidebar-control-btn:hover {
  background: rgba(7, 136, 232, .28);
  border-color: rgba(98, 185, 255, .42);
}

.sidebar-back-btn {
  background: rgba(15, 23, 42, .72);
  color: #e5eef8;
}

.sidebar-back-btn:hover {
  background: rgba(7, 136, 232, .18);
  border-color: rgba(7, 136, 232, .45);
}

body.sidebar-collapsed .sidebar {
  width: 86px;
  min-width: 86px;
  padding: 18px 10px;
  overflow: hidden;
}

body.sidebar-collapsed .sidebar-controls {
  margin: 0;
}

body.sidebar-collapsed .sidebar-control-btn {
  min-height: 42px;
  padding: 8px 4px;
  text-align: center;
  font-size: 11px;
  line-height: 1.15;
  white-space: normal;
  word-break: break-word;
  overflow: hidden;
}

body.sidebar-collapsed .sidebar .logo,
body.sidebar-collapsed .sidebar h2.logo,
body.sidebar-collapsed .company-switcher,
body.sidebar-collapsed .sidebar-back-btn,
body.sidebar-collapsed .sidebar nav,
body.sidebar-collapsed .logout-btn {
  display: none !important;
}

body.sidebar-collapsed .content,
body.sidebar-collapsed .main {
  max-width: none;
}

@media (max-width: 900px) {
  body.sidebar-collapsed .sidebar {
    width: 100%;
    min-width: 100%;
    padding: 12px 18px;
  }
}

/* ==========================================
   SUBSCRIPTION
========================================== */

.subscription-kpis {
  margin-bottom: 22px;
}

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

.subscription-plan {
  display: grid;
  gap: 16px;
  align-content: space-between;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 20px;
}

.subscription-plan.active {
  border-color: rgba(7, 136, 232, .55);
  box-shadow: 0 0 0 4px rgba(7, 136, 232, .10), var(--shadow);
}

.subscription-plan h2 {
  font-size: 22px;
  margin: 10px 0 6px;
}

.subscription-plan p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.subscription-plan strong {
  color: #0b1220;
  font-size: 34px;
}

.subscription-plan strong span {
  color: var(--muted);
  font-size: 14px;
  margin-left: 2px;
}

.subscription-plan ul {
  display: grid;
  gap: 8px;
  list-style: none;
}

.subscription-plan li {
  color: #334155;
  font-size: 13px;
}

.plan-badge {
  display: inline-flex;
  width: fit-content;
  border-radius: 999px;
  background: #edf6ff;
  color: #075fa6;
  font-size: 11px;
  font-weight: 900;
  padding: 6px 8px;
  text-transform: uppercase;
}

.subscription-plan button[disabled] {
  cursor: default;
  opacity: .72;
}

.subscription-details {
  margin-top: 24px;
}

.section-heading-row {
  align-items: flex-start;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-heading-row h2 {
  margin: 2px 0 0;
}

.eyebrow {
  color: var(--primary);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.helper-text {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  margin-top: 14px;
}

.usage-limit-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.usage-limit-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, .06);
  display: grid;
  gap: 14px;
  padding: 16px;
}

.usage-limit-topline {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.usage-limit-topline h3 {
  color: #0b1220;
  font-size: 15px;
  margin: 0 0 4px;
}

.usage-limit-topline p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  margin: 0;
}

.usage-limit-status {
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  padding: 5px 8px;
  white-space: nowrap;
}

.usage-limit-card.is-healthy .usage-limit-status,
.usage-limit-card.is-unlimited .usage-limit-status {
  background: #dcfce7;
  color: #166534;
}

.usage-limit-card.is-warning .usage-limit-status {
  background: #fef3c7;
  color: #92400e;
}

.usage-limit-card.is-over .usage-limit-status {
  background: #fee2e2;
  color: #991b1b;
}

.usage-limit-metrics {
  align-items: baseline;
  display: flex;
  gap: 8px;
}

.usage-limit-metrics strong {
  color: #0b1220;
  font-size: 28px;
  line-height: 1;
}

.usage-limit-metrics span {
  color: var(--muted);
  font-size: 13px;
}

.usage-limit-track {
  background: #e5edf6;
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
}

.usage-limit-track span {
  background: linear-gradient(90deg, var(--primary), #16a34a);
  border-radius: inherit;
  display: block;
  height: 100%;
}

.usage-limit-card.is-warning .usage-limit-track span {
  background: var(--warning);
}

.usage-limit-card.is-over .usage-limit-track span {
  background: var(--danger);
}

.demo-mode-banner {
  align-items: center;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-left: 4px solid var(--accent, #0788e8);
  border-radius: 8px;
  box-shadow: var(--shadow);
  color: #075985;
  display: grid;
  gap: 6px 14px;
  grid-template-columns: auto 1fr auto auto;
  margin: 16px 0 20px;
  padding: 12px 16px;
}

.demo-mode-banner strong {
  font-size: 14px;
}

.demo-mode-banner span {
  font-size: 13px;
  line-height: 1.4;
}

.demo-mode-banner a {
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 12px;
  text-decoration: none;
  white-space: nowrap;
}

.demo-mode-banner a.demo-banner-primary {
  background: #0788e8;
  color: #ffffff;
}

.demo-mode-banner a.demo-banner-secondary {
  background: #ffffff;
  border: 1px solid rgba(55, 48, 163, .25);
  color: #075985;
}

@media (max-width: 720px) {
  .demo-mode-banner {
    grid-template-columns: 1fr;
    text-align: left;
  }
}

.plan-limit-warning {
  align-items: center;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-left: 4px solid var(--warning);
  border-radius: 8px;
  box-shadow: var(--shadow);
  color: #78350f;
  display: grid;
  gap: 6px 14px;
  grid-template-columns: auto 1fr auto;
  margin: 16px 0 20px;
  padding: 14px 16px;
}

.plan-limit-warning.is-over {
  background: #fef2f2;
  border-color: #fecaca;
  border-left-color: var(--danger);
  color: #7f1d1d;
}

.plan-limit-warning strong {
  font-size: 14px;
}

.plan-limit-warning span {
  font-size: 13px;
  line-height: 1.4;
}

.plan-limit-warning a {
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, .12);
  border-radius: 8px;
  color: #0b1220;
  font-size: 13px;
  font-weight: 800;
  padding: 8px 10px;
  text-decoration: none;
  white-space: nowrap;
}

.plan-limit-form-note {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  color: #991b1b;
  font-size: 13px;
  font-weight: 750;
  grid-column: 1 / -1;
  line-height: 1.45;
  margin: 4px 0 0;
  padding: 10px 12px;
}

.content button.is-disabled-by-plan,
.content input.is-disabled-by-plan {
  cursor: not-allowed;
  opacity: .55;
}

@media (max-width: 760px) {
  .plan-limit-warning {
    grid-template-columns: 1fr;
  }

  .plan-limit-warning a {
    justify-self: start;
  }
}

@media (max-width: 760px) {
  .tracking-page {
    background:
      linear-gradient(180deg, #07111f 0, #07111f 500px, #f4f7fb 500px, #eef4fb 100%);
  }

  .tracking-shell {
    width: min(100% - 24px, 1080px);
    padding-top: 22px;
  }

  .tracking-header {
    gap: 14px;
    margin-bottom: 18px;
  }

  .tracking-brand-wrap {
    gap: 8px;
  }

  .tracking-brand {
    min-height: 88px;
  }

  .tracking-powered-pill {
    width: fit-content;
    max-width: 100%;
  }

  .tracking-header h1 {
    font-size: 32px;
    line-height: 1.08;
  }

  .tracking-header p {
    max-width: 100%;
    font-size: 14px;
    line-height: 1.45;
  }

  .tracking-header,
  .tracking-form,
  .tracking-grid {
    grid-template-columns: 1fr;
  }

  .tracking-card-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .tracking-form .btn {
    width: 100%;
  }

  .tracking-summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .tracking-status-block {
    justify-items: start;
  }
}

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

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

.message {
  color: var(--success);
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 4px;
}

/* ==========================================
   MODERN BUTTON NORMALIZATION
   Keeps action controls consistent across pages.
========================================== */

.content .btn,
.content .view,
.content .delete,
.content .secondary-action,
.content button:not(.sidebar-toggle),
.content input[type="submit"],
.card .btn,
.card .view,
.card .delete,
.card .secondary-action,
.card button,
.table-actions a,
.table-actions button,
.quick-actions a,
.quick-actions button,
.actions a,
.actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  min-width: 96px;
  width: auto;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 850;
  line-height: 1.1;
  padding: 10px 14px;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color .16s ease, border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.content .btn,
.content .view:not(.secondary-action),
.content button.view:not(.secondary-action),
.card .btn,
.card .view:not(.secondary-action),
.quick-actions a:not(.secondary-action),
.quick-actions button:not(.secondary-action),
.actions a:not(.secondary-action),
.actions button:not(.secondary-action):not(.delete) {
  background: linear-gradient(180deg, var(--brand-color) 0%, var(--primary-hover) 100%);
  border-color: rgba(37, 99, 235, .28);
  color: #ffffff;
  box-shadow: 0 8px 16px rgba(37, 99, 235, .18);
}

.content .btn:hover,
.content .view:not(.secondary-action):hover,
.content button.view:not(.secondary-action):hover,
.card .btn:hover,
.card .view:not(.secondary-action):hover,
.quick-actions a:not(.secondary-action):hover,
.quick-actions button:not(.secondary-action):hover,
.actions a:not(.secondary-action):hover,
.actions button:not(.secondary-action):not(.delete):hover {
  background: var(--primary-hover);
  color: #ffffff;
  transform: translateY(-1px);
}

.content .secondary-action,
.content .view.secondary-action,
.content button.secondary-action,
.card .secondary-action,
.card .view.secondary-action,
.table-actions .secondary-action,
.quick-actions .secondary-action,
.actions .secondary-action,
td .secondary-action,
td .view.secondary-action {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #172033;
  box-shadow: none;
}

.content .secondary-action:hover,
.content .view.secondary-action:hover,
.content button.secondary-action:hover,
.card .secondary-action:hover,
.card .view.secondary-action:hover,
.table-actions .secondary-action:hover,
.quick-actions .secondary-action:hover,
.actions .secondary-action:hover,
td .secondary-action:hover,
td .view.secondary-action:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #07111f;
  transform: translateY(-1px);
}

.content .delete,
.content button.delete,
.card .delete,
.card button.delete,
.table-actions .delete,
.actions .delete,
td .delete,
td button.delete {
  background: var(--danger);
  border-color: var(--danger);
  color: #ffffff;
  box-shadow: 0 10px 18px rgba(220, 38, 38, .14);
}

.content .delete:hover,
.content button.delete:hover,
.card .delete:hover,
.card button.delete:hover,
.table-actions .delete:hover,
.actions .delete:hover {
  background: #b91c1c;
  border-color: #b91c1c;
  color: #ffffff;
  transform: translateY(-1px);
}

.content .btn:disabled,
.content .view:disabled,
.content .delete:disabled,
.content button:disabled,
.card .btn:disabled,
.card .view:disabled,
.card .delete:disabled,
.card button:disabled {
  cursor: not-allowed;
  opacity: .58;
  transform: none;
}

.load-row-actions {
  display: grid;
  grid-template-columns: minmax(108px, 1fr) minmax(86px, auto);
  gap: 8px;
  max-width: 244px;
  min-width: 210px;
  align-items: start;
}

.load-row-actions .view,
.load-row-actions .delete,
.load-row-actions .secondary-action {
  min-width: 0;
  width: 100%;
  margin: 0;
}

.load-row-actions .delete {
  width: 100%;
}

.load-actions-menu {
  position: relative;
}

.load-actions-menu summary {
  min-height: 38px;
  padding: 10px 14px;
  border: 1px solid rgba(148, 163, 184, 0.32);
  border-radius: 8px;
  background: #ffffff;
  color: #0f172a;
  font-weight: 800;
  text-align: center;
  cursor: pointer;
  list-style: none;
}

.load-actions-menu summary::-webkit-details-marker {
  display: none;
}

.load-actions-menu[open] > div {
  position: absolute;
  z-index: 20;
  right: 0;
  top: calc(100% + 6px);
  display: grid;
  gap: 6px;
  width: 172px;
  padding: 8px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.16);
}

@media (max-width: 900px) {
  .load-row-actions {
    grid-template-columns: 1fr;
    max-width: none;
    min-width: 130px;
  }

  .compact-form {
    grid-template-columns: 1fr;
  }

  .public-portal-hero {
    display: grid;
  }

  .driver-gps-grid,
  .dispatch-gps-item {
    grid-template-columns: 1fr;
  }

  .driver-gps-actions .view {
    width: 100%;
  }
}

.carrier-kpis {
  margin-bottom: 22px;
}

.loads-command-card {
  align-items: end;
  border-bottom: 1px solid var(--border);
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr) minmax(190px, 260px);
  margin: -4px 0 18px;
  padding-bottom: 16px;
}

.loads-command-card h2 {
  margin-bottom: 4px;
}

.loads-command-card p {
  color: var(--muted);
  margin: 0;
}

.loads-saved-filter {
  display: grid;
  gap: 8px;
}

.loads-saved-filter label,
.loads-filter-grid .field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.loads-saved-filter select,
.loads-filter-grid input,
.loads-filter-grid select {
  border: 1px solid var(--border);
  border-radius: 10px;
  min-height: 44px;
}

.loads-filter-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(240px, 1.6fr) repeat(3, minmax(150px, 1fr));
  margin-bottom: 16px;
}

.loads-filter-grid .field {
  gap: 7px;
}

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

.loads-result-count {
  color: #334155;
  font-size: 13px;
  font-weight: 850;
}

.loads-table-wrap {
  border: 1px solid var(--border);
  border-radius: 10px;
}

.visibility-table-wrap {
  padding-bottom: 150px;
}

.loads-table-wrap .data-table {
  margin: 0;
}

.loads-table-wrap .data-table th:nth-child(10),
.loads-table-wrap .data-table td:nth-child(10) {
  text-align: center;
  width: 132px;
}

.loads-table-wrap .data-table th:nth-child(11),
.loads-table-wrap .data-table td:nth-child(11) {
  width: 220px;
}

.customer-link-action {
  font-size: 13px;
  min-height: 38px;
  min-width: 108px;
  padding: 9px 12px;
  white-space: nowrap;
}

.loads-pagination {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 14px;
}

.loads-pagination span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.list-filter-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(220px, 1.6fr) repeat(2, minmax(150px, 1fr));
  margin-bottom: 16px;
}

.list-filter-grid .field {
  gap: 7px;
}

.list-filter-grid .field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.list-filter-grid input,
.list-filter-grid select {
  border: 1px solid var(--border);
  border-radius: 10px;
  min-height: 44px;
}

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

.list-result-count {
  color: #334155;
  font-size: 13px;
  font-weight: 850;
}

.list-pagination {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 14px;
}

.list-pagination span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

@media (max-width: 720px) {
  .list-filter-grid {
    grid-template-columns: 1fr;
  }

  .list-toolbar,
  .list-pagination {
    flex-wrap: wrap;
  }
}

.carriers-list-card {
  margin-top: 30px;
}

.carrier-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(160px, 220px) minmax(170px, 230px);
  gap: 16px;
  margin-bottom: 20px;
}

.carrier-onboarding-admin {
  margin-bottom: 22px;
}

.compact-form {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
}

.compact-form .btn {
  min-height: 48px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.button-cluster {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.button-cluster.compact .view,
.button-cluster.compact .delete,
.button-cluster.compact .btn {
  min-height: 36px;
  padding: 9px 12px;
  font-size: 13px;
}

.carrier-notes-field {
  grid-column: 1 / -1;
}

.carrier-form-fieldset {
  border: 1px solid var(--border);
  border-radius: 12px;
  display: grid;
  gap: 16px;
  grid-column: 1 / -1;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin: 4px 0;
  padding: 18px 20px 20px;
}

.carrier-form-fieldset legend {
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 0 6px;
  text-transform: uppercase;
}

.carrier-form-fieldset .full-width {
  grid-column: 1 / -1;
}

.tender-wide {
  grid-column: 1 / -1;
}

.tender-history-card {
  margin-top: 30px;
}

.communication-card {
  margin-top: 30px;
}

.communication-wide {
  grid-column: 1 / -1;
}

.issue-card {
  margin-top: 30px;
}

.issue-wide {
  grid-column: 1 / -1;
}

.muted-line {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

td .secondary-action {
  color: #0f172a;
  box-shadow: none;
}

td .secondary-action:hover {
  background: #eef5fb;
  color: #0f172a;
}

.table-link {
  color: var(--primary);
  font-weight: 850;
  text-decoration: none;
}

.table-link:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

.profit-risk-chip {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 999px;
  color: #9a3412;
  display: inline-flex;
  font-size: 11px;
  font-weight: 850;
  margin: 2px 4px 2px 0;
  padding: 5px 8px;
  white-space: nowrap;
}

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

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

.form-grid label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.form-grid .full-width {
  grid-column: 1 / -1;
}

.stack-list {
  display: grid;
  gap: 12px;
}

.status-row {
  align-items: flex-start;
  background: #f8fbff;
  border: 1px solid var(--border);
  border-radius: 8px;
  display: grid;
  gap: 4px;
  padding: 12px;
}

.status-row span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.status-row strong {
  color: #172033;
  font-size: 13px;
  line-height: 1.35;
}

.danger-text {
  color: var(--danger);
  font-weight: 700;
}

.status-pill.danger {
  background: #fee2e2;
  color: #991b1b;
}

.status-pill.neutral {
  background: #eef2f7;
  color: #334155;
}

/* ==========================================
   INTEGRATION HUB
========================================== */

.integration-overview-card,
.integration-grid,
.content > .card {
  margin-top: 24px;
}

.integration-provider-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.integration-provider-card {
  display: flex;
  min-height: 180px;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  border: 1px solid #e5edf6;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
}

.integration-provider-card h3 {
  margin: 12px 0 8px;
  color: #0f172a;
  font-size: 1rem;
}

.integration-provider-card p {
  margin: 0;
  color: #64748b;
  font-size: 0.9rem;
  line-height: 1.45;
}

.integration-provider-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #64748b;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.integration-provider-meta .secondary-action {
  min-width: 76px;
  text-align: center;
}

.workflow-quick-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  white-space: nowrap;
}

.integration-admin-notice {
  margin-top: 16px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
  color: #1e3a8a;
  padding: 16px;
}

.integration-admin-notice strong {
  display: block;
  color: #0f172a;
  margin-bottom: 6px;
}

.integration-admin-notice p {
  margin: 0;
  color: #475569;
  line-height: 1.45;
}

.global-error-boundary {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9999;
  max-width: min(420px, calc(100vw - 32px));
}

.global-error-card {
  border: 1px solid #fecaca;
  border-left: 4px solid var(--danger);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.18);
  color: #0f172a;
  padding: 16px;
}

.global-error-card strong {
  display: block;
  margin-bottom: 6px;
  font-size: 0.98rem;
}

.global-error-card p {
  margin: 0 0 12px;
  color: #475569;
  line-height: 1.45;
}

.global-error-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.global-error-actions button,
.global-error-actions a {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 7px;
  background: #0ea5e9;
  color: #ffffff;
  cursor: pointer;
  font-weight: 700;
  padding: 9px 12px;
  text-decoration: none;
}

.global-error-actions a {
  background: #f1f5f9;
  color: #0f172a;
}

.hr-session-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.54);
  backdrop-filter: blur(4px);
}

.hr-session-card {
  width: min(460px, 100%);
  border: 1px solid #dbeafe;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 28px 65px rgba(15, 23, 42, 0.26);
  color: #0f172a;
  padding: 22px;
}

.hr-session-card h2 {
  margin: 4px 0 8px;
  font-size: 1.35rem;
}

.hr-session-card p {
  margin: 0 0 12px;
  color: #475569;
  line-height: 1.5;
}

.hr-session-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.hr-session-actions .btn {
  min-height: 42px;
}

.hr-session-actions .secondary {
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  box-shadow: none;
  color: #0f172a;
}

.hr-submit-saving {
  cursor: wait !important;
  opacity: 0.72;
}

[data-hr-error-boundary="true"] {
  min-width: 0;
}

body.theme-dark .hr-session-card {
  border-color: #334155;
  background: #111827;
  color: #f8fafc;
}

body.theme-dark .hr-session-card p {
  color: #cbd5e1;
}

body.theme-dark .hr-session-actions .secondary {
  border-color: #334155;
  background: #0f172a;
  color: #f8fafc;
}

.onboarding-walkthrough {
  margin-bottom: 18px;
}

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

.walkthrough-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: 96px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
  color: #0f172a;
  padding: 14px;
  text-decoration: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.walkthrough-step:hover {
  border-color: #38bdf8;
  box-shadow: 0 12px 28px rgba(14, 165, 233, 0.12);
  transform: translateY(-1px);
}

.walkthrough-step > span {
  display: inline-flex;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #e0f2fe;
  color: #075985;
  font-weight: 800;
}

.walkthrough-step.complete > span {
  background: #dcfce7;
  color: #166534;
}

.walkthrough-step.attention > span {
  background: #fef3c7;
  color: #92400e;
}

.walkthrough-step strong {
  display: block;
  margin-bottom: 4px;
}

.walkthrough-step small {
  color: #64748b;
  line-height: 1.4;
}

.help-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.help-card {
  display: flex;
  min-height: 250px;
  flex-direction: column;
  gap: 10px;
}

.help-card h2 {
  margin: 0;
  color: #0f172a;
}

.help-card p,
.help-card li {
  color: #475569;
  line-height: 1.5;
}

.help-card ol {
  margin: 0 0 8px 18px;
  padding: 0;
}

.help-card .view {
  margin-top: auto;
  align-self: flex-start;
}

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

.empty-state {
  padding: 18px;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  color: #64748b;
  background: #f8fafc;
}

.dashboard-primary-action {
  font-size: 15px;
  min-height: 46px;
  padding: 13px 18px;
}

.dispatcher-workspace {
  margin: 22px 0;
  padding: 24px;
}

.dispatcher-workspace-top {
  align-items: start;
  display: grid;
  grid-template-columns: minmax(220px, .6fr) minmax(320px, 1.4fr);
  gap: 20px;
  margin-bottom: 20px;
}

.dispatcher-workspace-top h2 {
  font-size: 24px;
  margin: 0;
}

.dispatcher-search {
  position: relative;
}

.dispatcher-search input {
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
  font-size: 15px;
  min-height: 50px;
  padding: 0 16px;
  width: 100%;
}

.dispatch-search-results {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 18px 44px rgba(15, 23, 42, .16);
  left: 0;
  overflow: hidden;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 20;
}

.dispatch-search-results a,
.dispatch-search-empty {
  display: grid;
  gap: 3px;
  padding: 12px 14px;
  text-decoration: none;
}

.dispatch-search-results a:hover {
  background: #f1f7ff;
}

.dispatch-search-results span {
  color: var(--primary);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.dispatch-search-results strong {
  color: #0f172a;
  font-size: 14px;
}

.dispatch-search-results small,
.dispatch-search-empty {
  color: var(--muted);
  font-size: 12px;
}

.dispatcher-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.dispatcher-summary-card {
  background: #f8fbff;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: #172033;
  display: grid;
  gap: 8px;
  min-height: 94px;
  padding: 16px;
  text-decoration: none;
}

.dispatcher-summary-card:hover {
  border-color: #93c5fd;
  transform: translateY(-1px);
}

.dispatcher-summary-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.dispatcher-summary-card strong {
  color: #0b1220;
  font-size: 32px;
  line-height: 1;
}

.dispatcher-summary-card.warning {
  background: #fff8ed;
  border-color: rgba(245, 158, 11, .3);
}

.dispatcher-load-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.section-header.compact {
  margin-bottom: 12px;
}

.section-header.compact h2 {
  font-size: 18px;
}

.dispatcher-load-list {
  display: grid;
  gap: 10px;
}

.dispatcher-load-item {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: #172033;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 72px;
  padding: 14px;
  text-decoration: none;
}

.dispatcher-load-item:hover {
  background: #f8fbff;
  border-color: #93c5fd;
}

.dispatcher-load-main,
.dispatcher-load-meta {
  display: grid;
  gap: 5px;
}

.dispatcher-load-main strong {
  font-size: 15px;
}

.dispatcher-load-main small,
.dispatcher-load-meta small {
  color: var(--muted);
  font-size: 12px;
}

.dispatcher-load-meta {
  justify-items: end;
  text-align: right;
}

.document-dropzone {
  align-items: center;
  background: #f8fbff;
  border: 2px dashed #b8d7f5;
  border-radius: 10px;
  color: #172033;
  cursor: pointer;
  display: grid;
  gap: 6px;
  min-height: 112px;
  padding: 18px;
  text-align: center;
}

.document-dropzone.drag-over {
  background: #eef7ff;
  border-color: var(--primary);
}

.document-dropzone input {
  height: 1px;
  opacity: 0;
  overflow: hidden;
  position: absolute;
  width: 1px;
}

.document-dropzone span {
  font-size: 15px;
  font-weight: 850;
}

.document-dropzone small {
  color: var(--muted);
  font-size: 12px;
}

.load-documents-hub .section-header p {
  color: var(--muted);
  margin: 4px 0 0;
}

.load-document-checklist {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  margin: 14px 0 18px;
}

.load-document-check {
  align-items: center;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  display: grid;
  gap: 2px 8px;
  grid-template-columns: 28px 1fr;
  padding: 10px;
}

.load-document-check span {
  align-items: center;
  border-radius: 999px;
  display: inline-flex;
  font-size: 11px;
  font-weight: 850;
  grid-row: span 2;
  height: 26px;
  justify-content: center;
  width: 26px;
}

.load-document-check strong {
  color: #172033;
  font-size: 13px;
}

.load-document-check small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.load-document-check.complete {
  border-color: #bbf7d0;
}

.load-document-check.complete span {
  background: #dcfce7;
  color: #047857;
}

.load-document-check.missing {
  border-color: #fecaca;
}

.load-document-check.missing span {
  background: #fee2e2;
  color: #b91c1c;
}

.load-document-check.optional span {
  background: #fffbeb;
  color: #92400e;
}

.load-closeout-card .section-header p {
  color: var(--muted);
  margin: 4px 0 0;
}

.load-closeout-checklist {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-top: 14px;
}

.load-closeout-step {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  display: grid;
  gap: 3px 10px;
  grid-template-columns: 28px 1fr;
  min-height: 74px;
  padding: 12px;
}

.load-closeout-step span {
  align-items: center;
  border-radius: 999px;
  display: inline-flex;
  font-size: 11px;
  font-weight: 850;
  grid-row: span 2;
  height: 26px;
  justify-content: center;
  width: 26px;
}

.load-closeout-step strong {
  color: #172033;
  font-size: 13px;
}

.load-closeout-step small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.35;
}

.load-closeout-step.complete {
  border-color: #bbf7d0;
}

.load-closeout-step.complete span {
  background: #dcfce7;
  color: #047857;
}

.load-closeout-step.open span {
  background: #fffbeb;
  color: #92400e;
}

.load-workflow-panel {
  background: #f8fbff;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin: 18px 0;
  padding: 16px;
}

.load-workflow-bar {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(8, minmax(0, 1fr));
}

.load-workflow-step {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
  display: grid;
  gap: 6px;
  justify-items: center;
  min-height: 72px;
  padding: 10px 6px;
  text-align: center;
}

.load-workflow-step span {
  align-items: center;
  background: #eef2f7;
  border-radius: 999px;
  color: var(--muted);
  display: inline-flex;
  font-size: 10px;
  font-weight: 900;
  height: 24px;
  justify-content: center;
  width: 24px;
}

.load-workflow-step strong {
  color: #172033;
  font-size: 12px;
  line-height: 1.2;
}

.load-workflow-step.complete {
  border-color: #bbf7d0;
}

.load-workflow-step.complete span {
  background: #dcfce7;
  color: #047857;
}

.load-workflow-step.active {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(7, 136, 232, .08);
}

.load-next-action {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 10px;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1fr) auto;
  margin-top: 14px;
  padding: 14px;
}

.load-next-action span {
  color: var(--primary);
  display: block;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .05em;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.load-next-action strong {
  color: #172033;
  display: block;
  font-size: 17px;
}

.load-next-action p {
  color: var(--muted);
  margin: 4px 0 0;
}

.load-next-action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.dispatch-packet-page .page-header p {
  color: var(--muted);
  margin: 4px 0 0;
}

.dispatch-packet-hero {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.dispatch-packet-hero h2 {
  font-size: 26px;
  margin: 0 0 6px;
}

.dispatch-packet-hero p:last-child {
  color: var(--muted);
  margin: 0;
}

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

.dispatch-packet-card {
  margin-top: 18px;
}

.dispatch-packet-card h2 {
  font-size: 18px;
  line-height: 1.35;
  margin: 0;
}

.dispatch-packet-summary {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin: 0;
}

.dispatch-packet-summary div,
.dispatch-meta div {
  background: #f8fbff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
}

.dispatch-packet-summary dt,
.dispatch-meta dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.dispatch-packet-summary dd,
.dispatch-meta dd {
  color: #172033;
  font-size: 14px;
  font-weight: 750;
  margin: 4px 0 0;
}

.dispatch-action-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.dispatch-action-grid .view {
  min-height: 42px;
}

.dispatch-instruction-list,
.dispatch-doc-list {
  display: grid;
  gap: 10px;
}

.dispatch-instruction-item,
.dispatch-doc-item {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  display: grid;
  gap: 4px;
  padding: 12px;
}

.dispatch-instruction-item strong,
.dispatch-doc-item strong {
  color: #172033;
  font-size: 13px;
}

.dispatch-instruction-item span,
.dispatch-doc-item span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.dispatch-doc-item {
  align-items: center;
  grid-template-columns: minmax(0, 1fr) auto;
}

.dispatch-document-checklist {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 0;
}

@media print {
  .dispatch-packet-page {
    color: #111827;
  }

  .dispatch-packet-page .card {
    break-inside: avoid;
    box-shadow: none;
  }

  .dispatch-packet-page .message,
  .dispatch-packet-page form,
  .dispatch-action-grid {
    display: none !important;
  }
}

@media (max-width: 900px) {
  .sidebar {
    padding: 18px;
  }

  .sidebar .logo,
  .sidebar h2.logo {
    height: 76px;
    margin-bottom: 18px;
  }

  .main,
  .content {
    padding: 18px;
  }

  .page-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .carrier-toolbar {
    grid-template-columns: 1fr;
  }

  .grid-2,
  .form-grid,
  .dispatcher-workspace-top,
  .dispatcher-summary-grid,
  .dispatcher-load-grid,
  .dispatcher-load-item,
  .dispatch-packet-grid {
    grid-template-columns: 1fr;
  }

  .dispatch-packet-hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .load-workflow-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .load-next-action {
    grid-template-columns: 1fr;
  }

  .load-next-action-buttons {
    justify-content: stretch;
  }

  .load-next-action-buttons .view {
    width: 100%;
  }

  .dispatch-document-checklist {
    grid-template-columns: 1fr;
  }

  .driver-status-actions,
  .driver-packet-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .driver-status-actions button,
  .dispatch-action-grid .view,
  .driver-packet-link {
    min-height: 48px;
    width: 100%;
  }

  .dispatcher-load-meta {
    justify-items: start;
    text-align: left;
  }
}

/* Final button color guard: keeps late table/page rules from reverting buttons. */
.actions,
.quick-actions,
.table-actions,
.dispatch-actions,
.paperwork-actions,
.platform-company-actions,
.demo-page-actions,
.demo-script-actions,
.route-planner-actions,
.trip-cost-actions,
.notification-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.page-header .quick-actions,
.section-header .quick-actions,
.demo-script-actions {
  justify-content: flex-end;
}

.table-actions {
  justify-content: flex-start;
}

.content .btn,
.content .view,
.content .delete,
.content .secondary-action,
.content button:not(.sidebar-toggle),
.card .btn,
.card .view,
.card .delete,
.card .secondary-action,
.card button,
td .view,
td .delete,
td .secondary-action {
  min-height: 40px;
  min-width: 96px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 850;
  padding: 10px 14px;
}



.load-row-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(104px, 1fr));
  gap: 8px;
  max-width: 244px;
  min-width: 220px;
}

.load-row-actions .view,
.load-row-actions .delete,
.load-row-actions .secondary-action {
  width: 100%;
  min-width: 0;
  margin: 0;
}

.load-row-actions .delete {
  grid-column: 1 / -1;
}

.quick-actions.dashboard-actions {
  display: grid;
  grid-template-columns: repeat(5, minmax(112px, 1fr));
  gap: 10px;
  align-items: stretch;
  justify-content: stretch;
  width: 100%;
  min-width: 0;
}

.quick-actions.dashboard-actions .view {
  width: 100%;
  min-width: 0;
}

.daily-command-center {
  margin-bottom: 18px;
}

.command-action-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.command-action-card {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 10px;
  color: #172033;
  display: grid;
  gap: 12px;
  grid-template-columns: auto minmax(0, 1fr);
  min-height: 82px;
  padding: 14px;
  text-decoration: none;
  transition: .18s ease;
}

.command-action-card:hover {
  border-color: rgba(7, 136, 232, .36);
  box-shadow: 0 12px 26px rgba(15, 23, 42, .10);
  transform: translateY(-1px);
}

.command-action-card.warning {
  border-left-color: var(--danger);
}

.command-action-card.caution {
  border-left-color: var(--warning);
}

.command-action-card.success {
  border-left-color: var(--success);
}

.command-action-count {
  align-items: center;
  background: #eef6ff;
  border-radius: 10px;
  color: #075985;
  display: inline-flex;
  font-size: 15px;
  font-weight: 900;
  justify-content: center;
  min-height: 42px;
  min-width: 54px;
  padding: 8px 10px;
}

.command-action-card.warning .command-action-count {
  background: #fff1f2;
  color: #be123c;
}

.command-action-card.caution .command-action-count {
  background: #fffbeb;
  color: #92400e;
}

.command-action-card.success .command-action-count {
  background: #ecfdf5;
  color: #047857;
}

.command-action-card strong,
.command-action-card small {
  display: block;
}

.command-action-card small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  margin-top: 3px;
}

.dashboard-page-header {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: start;
}

.dashboard-page-header .dashboard-actions {
  justify-self: stretch;
  width: 100%;
  max-width: 100%;
}

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

  .page-header .quick-actions,
  .section-header .quick-actions,
  .demo-script-actions {
    justify-content: flex-start;
  }

  .quick-actions.dashboard-actions {
    grid-template-columns: repeat(2, minmax(130px, 1fr));
    min-width: 100%;
  }

  .load-row-actions {
    grid-template-columns: 1fr;
    max-width: none;
    min-width: 130px;
  }
}

/* ==========================================
   MOBILE FIT AND CLEANUP ONLY
   Keeps desktop layouts untouched.
========================================== */

@media (max-width: 760px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  body,
  .layout {
    display: block;
  }

  .sidebar {
    position: relative;
    width: 100%;
    min-width: 0;
    max-width: none;
    max-height: 44vh;
    overflow-y: auto;
    padding: 14px;
    border-right: 0;
    box-shadow: 0 16px 34px rgba(15, 23, 42, .16);
  }

  .sidebar .logo,
  .sidebar h2.logo {
    height: 76px;
    margin-bottom: 12px;
    background-size: contain;
  }

  .sidebar-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 10px;
  }

  .sidebar-control-btn,
  .sidebar-back-btn {
    min-height: 42px;
    text-align: center;
  }

  .company-switcher {
    margin: 10px 0 12px;
    padding: 12px;
  }

  .sidebar nav {
    gap: 8px;
  }

  .sidebar-section {
    gap: 6px;
  }

  .sidebar a,
  .sidebar-more summary {
    min-height: 40px;
    padding: 10px 12px;
  }

  body.sidebar-collapsed .sidebar {
    width: 100%;
    min-width: 0;
    padding: 12px 14px;
  }

  body.sidebar-collapsed .sidebar-controls {
    display: grid;
    grid-template-columns: 1fr;
    max-width: 220px;
    margin: 0 auto;
  }

  body.sidebar-collapsed .sidebar-control-btn {
    width: 100%;
  }

  .content,
  .main {
    width: 100%;
    max-width: 100%;
    padding: 14px;
    overflow-x: hidden;
  }

  .page-header,
  .dashboard-page-header,
  .section-header,
  .demo-mode-banner,
  .demo-admin-panel,
  .dispatch-packet-hero,
  .document-header,
  .invoice-hero {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    align-items: start;
  }

  .page-header h1,
  .dashboard-page-header h1 {
    font-size: 28px;
    line-height: 1.08;
  }

  .page-header p,
  .dashboard-page-header p {
    font-size: 13px;
    line-height: 1.4;
  }

  .quick-actions,
  .quick-actions.dashboard-actions,
  .actions,
  .table-actions,
  .demo-script-actions,
  .demo-page-actions,
  .dispatch-actions,
  .paperwork-actions,
  .platform-company-actions,
  .route-planner-actions,
  .trip-cost-actions,
  .notification-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    min-width: 0;
    gap: 8px;
    justify-content: stretch;
  }

  .quick-actions a,
  .quick-actions button,
  .actions a,
  .actions button,
  .table-actions a,
  .table-actions button,
  .demo-script-actions a,
  .demo-script-actions button,
  .demo-page-actions a,
  .demo-page-actions button {
    width: 100%;
    min-width: 0;
    min-height: 44px;
  }

  .card,
  .details-card,
  .content > .card {
    width: 100%;
    max-width: 100%;
    padding: 16px;
    border-radius: 10px;
    overflow-x: auto;
  }

  .kpi-grid,
  .dashboard-two-column,
  .readiness-grid,
  .dashboard-command-grid,
  .dashboard-ops-grid,
  .dashboard-stats-grid,
  .dashboard-summary-grid,
  .form-grid,
  .grid-2,
  .loads-command-card,
  .loads-filter-grid,
  .dispatcher-workspace-top,
  .dispatcher-summary-grid,
  .dispatcher-load-grid,
  .dispatch-packet-grid,
  .subscription-grid,
  .demo-center-grid,
  .demo-readiness-grid,
  .demo-runbook-grid {
    grid-template-columns: 1fr;
  }

  table,
  .data-table {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 640px;
    overflow-x: auto;
  }

  thead,
  tbody,
  tr {
    width: 100%;
  }

  th,
  td {
    padding: 12px 10px;
    white-space: normal;
  }

  .load-row-actions {
    grid-template-columns: 1fr;
    min-width: 0;
    max-width: none;
    width: 100%;
  }

  .load-row-actions .view,
  .load-row-actions .delete,
  .load-row-actions .secondary-action {
    min-height: 42px;
  }

  .loads-toolbar,
  .loads-pagination {
    align-items: stretch;
    flex-direction: column;
  }

  .loads-pagination .view,
  .loads-toolbar .view {
    width: 100%;
  }

  .field input,
  .field select,
  .field textarea,
  input,
  select,
  textarea {
    max-width: 100%;
    min-height: 44px;
    font-size: 16px;
  }

  .btn,
  .view,
  .delete,
  .secondary-action,
  button {
    min-height: 44px;
  }
}

@media (max-width: 430px) {
  .quick-actions,
  .quick-actions.dashboard-actions,
  .actions,
  .table-actions,
  .demo-script-actions,
  .demo-page-actions,
  .dispatch-actions,
  .paperwork-actions,
  .platform-company-actions,
  .route-planner-actions,
  .trip-cost-actions,
  .notification-actions {
    grid-template-columns: 1fr;
  }

  .content,
  .main {
    padding: 12px;
  }

  .card,
  .details-card,
  .content > .card {
    padding: 14px;
  }
}

.visibility-attention-card {
  border-left: 4px solid #0ea5e9;
}

.visibility-route-card {
  border-left: 4px solid #16a34a;
}

.visibility-readiness-card {
  border-left: 4px solid var(--primary);
}

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

.visibility-readiness-item {
  align-content: start;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: #172033;
  display: grid;
  gap: 5px;
  min-height: 78px;
  min-width: 0;
  padding: 12px;
  text-align: left;
  width: 100%;
}

.visibility-readiness-item strong {
  color: #0f172a;
  font-size: 20px;
  line-height: 1;
  overflow-wrap: anywhere;
}

.visibility-readiness-item span {
  color: #334155;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.visibility-readiness-item small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.visibility-attention-list {
  display: grid;
  gap: 10px;
}

.visibility-alert-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 10px;
  margin: 14px 0 16px;
}

.visibility-alert-card {
  display: grid;
  gap: 3px;
  min-height: 72px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: #0f172a;
  cursor: pointer;
  text-align: left;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

.visibility-alert-card:hover {
  border-color: #93c5fd;
  box-shadow: 0 10px 26px rgba(15, 23, 42, .10);
  transform: translateY(-1px);
}

.visibility-alert-card strong {
  display: block;
  font-size: 24px;
  line-height: 1;
}

.visibility-alert-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.visibility-alert-card.danger {
  border-top: 3px solid var(--danger);
}

.visibility-alert-card.caution {
  border-top: 3px solid var(--warning);
}

.visibility-alert-card.warning {
  border-top: 3px solid #eab308;
}

.visibility-alert-card.neutral {
  border-top: 3px solid #0ea5e9;
}

.visibility-route-summary {
  display: grid;
  gap: 14px;
}

.visibility-route-toolbar {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.visibility-route-toolbar > div {
  display: grid;
  gap: 3px;
}

.visibility-route-toolbar strong,
.visibility-route-toolbar small {
  display: block;
}

.visibility-route-toolbar small {
  color: var(--muted);
  font-size: 12px;
}

.visibility-route-toolbar .view {
  min-width: 170px;
  white-space: nowrap;
}

.visibility-route-map-panel {
  margin-top: 12px;
}

.visibility-route-map-panel .route-map-meta {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.visibility-route-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

.visibility-route-stat,
.visibility-route-load {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

.visibility-route-stat {
  display: grid;
  gap: 4px;
  min-height: 92px;
  padding: 13px;
}

.visibility-route-stat strong {
  color: #0f172a;
  font-size: 26px;
  line-height: 1;
}

.visibility-route-stat span {
  color: #0f172a;
  font-size: 13px;
  font-weight: 900;
}

.visibility-route-stat small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.visibility-route-stat.success {
  border-top: 3px solid #16a34a;
}

.visibility-route-stat.warning {
  border-top: 3px solid #eab308;
}

.visibility-route-stat.neutral {
  border-top: 3px solid #0ea5e9;
}

.visibility-route-list {
  display: grid;
  gap: 10px;
}

.visibility-route-load {
  display: grid;
  grid-template-columns: 1fr;
  align-items: start;
  gap: 12px;
  padding: 12px;
  background: #f8fafc;
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease, background 0.18s ease;
}

.visibility-route-load:hover,
.visibility-route-load:focus {
  border-color: #38bdf8;
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.1);
  outline: none;
  transform: translateY(-1px);
}

.visibility-route-load.selected {
  background: #eff6ff;
  border-color: #0ea5e9;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.14);
}

.visibility-route-load strong,
.visibility-route-load span {
  display: block;
}

.visibility-route-points {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.visibility-route-points > span {
  padding: 9px;
  border: 1px solid #e5edf6;
  border-radius: 8px;
  background: #ffffff;
  color: var(--muted);
  font-size: 12px;
}

.visibility-route-points strong {
  margin-bottom: 3px;
  color: #0f172a;
  font-size: 11px;
  text-transform: uppercase;
}

.visibility-attention-item {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8fafc;
}

.visibility-attention-item strong,
.visibility-attention-item span {
  display: block;
}

.visibility-attention-item small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.visibility-attention-tags,
.visibility-filter-strip,
.table-actions.compact {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.visibility-filter-strip {
  margin: 14px 0 16px;
}

.visibility-filter-strip .view.active {
  background: #0f172a;
  border-color: #0f172a;
  color: #fff;
}

.visibility-filter-grid {
  margin-bottom: 12px;
}

.visibility-table td {
  vertical-align: top;
}

.visibility-table .status-pill {
  margin: 2px 4px 2px 0;
}

.visibility-action-cell {
  align-items: stretch;
  display: grid;
  gap: 8px;
  min-width: 118px;
}

.visibility-action-cell > .view,
.visibility-action-cell .action-menu summary {
  min-width: 118px;
  width: 100%;
}

.visibility-action-menu {
  position: relative;
}

.visibility-action-menu summary {
  align-items: center;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  color: #172033;
  cursor: pointer;
  display: inline-flex;
  font-size: 13px;
  font-weight: 850;
  justify-content: center;
  min-height: 40px;
  padding: 10px 14px;
  white-space: nowrap;
}

.visibility-action-menu[open] summary {
  border-color: var(--primary);
}

.visibility-action-menu .action-menu-panel {
  bottom: calc(100% + 8px);
  right: 0;
  top: auto;
  width: 190px;
}

.visibility-action-menu .action-menu-item {
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: #172033;
  cursor: pointer;
  display: block;
  font: inherit;
  font-size: 13px;
  font-weight: 750;
  padding: 9px 10px;
  text-align: left;
  text-decoration: none;
  width: 100%;
}

.visibility-action-menu .action-menu-item:hover,
.visibility-action-menu .action-menu-item:focus {
  background: #eef6ff;
  color: #07111f;
}

.visibility-table th:nth-child(3),
.visibility-table td:nth-child(3),
.visibility-table th:nth-child(5),
.visibility-table td:nth-child(5) {
  max-width: 150px;
}

.visibility-table th:nth-child(4),
.visibility-table td:nth-child(4) {
  max-width: 220px;
}

.visibility-signal-stack {
  display: grid;
  gap: 5px;
  min-width: 150px;
}

.visibility-signal-stack small {
  color: var(--muted);
  display: block;
  font-size: 12px;
  line-height: 1.35;
  max-width: 220px;
}

.visibility-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, .55);
}

.visibility-modal {
  width: min(760px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  box-shadow: 0 24px 80px rgba(15, 23, 42, .28);
}

.visibility-modal .button-cluster {
  margin-top: 12px;
}

@media (max-width: 760px) {
  .visibility-alert-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .visibility-route-cards,
  .visibility-route-load,
  .visibility-route-points {
    grid-template-columns: 1fr;
  }

  .visibility-route-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .visibility-route-toolbar .view {
    width: 100%;
  }

  .visibility-route-map-panel .route-map-meta {
    grid-template-columns: 1fr;
  }

  .visibility-attention-item {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .visibility-attention-item .view,
  .visibility-filter-strip .view,
  .table-actions.compact .view {
    width: 100%;
  }

  .visibility-modal-backdrop {
    align-items: end;
    padding: 10px;
  }

  .visibility-modal {
    max-height: 92vh;
  }
}

@media (max-width: 520px) {
  .visibility-readiness-summary {
    grid-template-columns: 1fr;
  }
}

/* Company settings visual overrides */
body.theme-dark .content,
body.theme-dark .main {
  color: var(--text);
}

body.theme-dark .card,
body.theme-dark .stat-card,
body.theme-dark .dashboard-card,
body.theme-dark .settings-card,
body.theme-dark .data-table,
body.theme-dark .table-wrap,
body.theme-dark form {
  background: var(--card);
  border-color: var(--border);
  color: var(--text);
}

body.theme-dark input,
body.theme-dark select,
body.theme-dark textarea {
  background: #0b1220;
  border-color: #334155;
  color: #f8fafc;
}

body.theme-dark input::placeholder,
body.theme-dark textarea::placeholder {
  color: #94a3b8;
}

body.theme-dark th,
body.theme-dark thead,
body.theme-dark .data-table th {
  background: #1e293b;
  color: #e2e8f0;
}

body.theme-dark td,
body.theme-dark .muted-line,
body.theme-dark .empty-state {
  color: #cbd5e1;
}

body.theme-dark .secondary-action,
body.theme-dark .view.secondary-action,
body.theme-dark button.secondary-action {
  background: #111827;
  border-color: #334155;
  color: #f8fafc;
}

body.theme-dark .secondary-action:hover,
body.theme-dark .view.secondary-action:hover,
body.theme-dark button.secondary-action:hover {
  background: #1e293b;
  border-color: #475569;
}

/* Dark mode readability guard */
body.theme-dark {
  color-scheme: dark;
}

body.theme-dark .page-header h1,
body.theme-dark .dashboard-page-header h1,
body.theme-dark h1,
body.theme-dark h2,
body.theme-dark h3,
body.theme-dark h4,
body.theme-dark strong,
body.theme-dark .card-title,
body.theme-dark .metric-value,
body.theme-dark .stat-value {
  color: #f8fafc;
}

body.theme-dark .page-header p,
body.theme-dark .dashboard-page-header p,
body.theme-dark p,
body.theme-dark small,
body.theme-dark label,
body.theme-dark .field label,
body.theme-dark .form-grid label,
body.theme-dark .muted-copy,
body.theme-dark .muted-line,
body.theme-dark .section-kicker,
body.theme-dark .sidebar-section-label,
body.theme-dark .visibility-signal-stack small,
body.theme-dark .visibility-attention-item small {
  color: #cbd5e1;
}

body.theme-dark .card,
body.theme-dark .settings-card,
body.theme-dark .dashboard-card,
body.theme-dark .stat-card,
body.theme-dark .table-wrap,
body.theme-dark .loads-table-wrap,
body.theme-dark .visibility-attention-item,
body.theme-dark .visibility-route-load,
body.theme-dark .visibility-route-points,
body.theme-dark .visibility-modal,
body.theme-dark .empty-state,
body.theme-dark .kpi-card {
  background: #111827;
  border-color: #334155;
  color: #f8fafc;
}

/* Restore the colored top accent on KPI tiles - the generic dark-mode
   border-color override above (higher specificity than the base
   .kpi-card.success/.warning/.caution rules) would otherwise flatten
   it to the same gray as every other border in dark mode. */
body.theme-dark .kpi-card.success {
  border-top-color: var(--success);
}
body.theme-dark .kpi-card.warning {
  border-top-color: var(--danger);
}
body.theme-dark .kpi-card.caution {
  border-top-color: var(--warning);
}

/* .secondary-action buttons (Board View, Collapse, the map's 30 min/60
   min/2 hr/4 hr range toggles, etc.) were rendering white text on a
   white background in dark mode - an existing light-vs-dark override
   pair for this class loses to a differently-specific pair elsewhere
   in the cascade, so pin it down directly with !important instead of
   relying on selector specificity to sort it out. */
body.theme-dark .secondary-action,
body.theme-dark .view.secondary-action,
body.theme-dark button.secondary-action {
  background: #111827 !important;
  border-color: #334155 !important;
  color: #f8fafc !important;
}

body.theme-dark .secondary-action:hover,
body.theme-dark .view.secondary-action:hover,
body.theme-dark button.secondary-action:hover {
  background: #1e293b !important;
}

/* GPS/driver ping rows under the live map - hardcoded near-white
   background with no dark-mode override at all. */
body.theme-dark .driver-gps-grid > div,
body.theme-dark .dispatch-gps-item {
  background: #111827 !important;
  border-color: #334155 !important;
  color: #f8fafc !important;
}

/* Status pills (Delivered, Dispatched, etc.) - the base .status-pill
   dark-mode rule already flips the text to a light color, but none of
   the success/warning/caution/danger backgrounds were overridden, so
   the result was light text on a light pastel background. */
body.theme-dark .status-pill {
  background: rgba(7, 136, 232, .18) !important;
  color: #93c5fd !important;
}

body.theme-dark .status-pill.success {
  background: rgba(18, 163, 109, .2) !important;
  color: #86efac !important;
}

body.theme-dark .status-pill.caution {
  background: rgba(217, 138, 0, .2) !important;
  color: #fde68a !important;
}

body.theme-dark .status-pill.warning,
body.theme-dark .status-pill.danger {
  background: rgba(220, 38, 38, .2) !important;
  color: #fecaca !important;
}

body.theme-dark .card *,
body.theme-dark .dashboard-card *,
body.theme-dark .settings-card *,
body.theme-dark .stat-card * {
  border-color: rgba(51, 65, 85, .78);
}

body.theme-dark table,
body.theme-dark .data-table {
  background: #111827;
  color: #f8fafc;
}

body.theme-dark tbody tr,
body.theme-dark .data-table tbody tr {
  background: #111827;
  border-color: #334155;
}

body.theme-dark tbody tr:nth-child(even),
body.theme-dark .data-table tbody tr:nth-child(even) {
  background: #0f172a;
}

body.theme-dark td,
body.theme-dark .data-table td,
body.theme-dark .table-link {
  color: #e2e8f0;
}

body.theme-dark a:not(.view):not(.btn),
body.theme-dark .table-link {
  color: #93c5fd;
}

body.theme-dark .status-pill,
body.theme-dark .plan-badge,
body.theme-dark .notification-badge,
body.theme-dark .chat-unread-badge {
  color: #f8fafc;
  border-color: rgba(148, 163, 184, .35);
}

body.theme-dark .status-pill.warning,
body.theme-dark .status-pill.caution {
  background: rgba(245, 158, 11, .18);
  color: #fde68a;
}

body.theme-dark .status-pill.danger {
  background: rgba(239, 68, 68, .18);
  color: #fecaca;
}

body.theme-dark .status-pill.success {
  background: rgba(16, 185, 129, .18);
  color: #a7f3d0;
}

body.theme-dark hr,
body.theme-dark .divider {
  border-color: #334155;
}

/* Dark mode page-component cleanup */
body.theme-dark .load-profit-metric,
body.theme-dark .route-summary-grid article,
body.theme-dark .action-menu-panel,
body.theme-dark .action-center-item,
body.theme-dark .owner-command-metric,
body.theme-dark .dashboard-list-item,
body.theme-dark .tracking-summary,
body.theme-dark .onboarding-summary,
body.theme-dark .onboarding-action,
body.theme-dark .usage-limit-metrics,
body.theme-dark .integration-provider-card,
body.theme-dark .global-error-panel,
body.theme-dark .dispatcher-summary-card,
body.theme-dark .load-next-action,
body.theme-dark .dispatch-packet-summary div,
body.theme-dark .dispatch-action-grid article,
body.theme-dark .visibility-readiness-summary article,
body.theme-dark .visibility-alert-summary article,
body.theme-dark .visibility-route-summary,
body.theme-dark .visibility-route-summary article,
body.theme-dark .visibility-table,
body.theme-dark .visibility-map-card {
  background: #111827;
  border-color: #334155;
  color: #f8fafc;
}

body.theme-dark .load-profit-metric.caution,
body.theme-dark .load-profit-metric.warning,
body.theme-dark .action-center-item.warning,
body.theme-dark .dispatcher-summary-card.warning,
body.theme-dark .load-next-action.warning,
body.theme-dark .visibility-alert-summary article.warning {
  background: rgba(245, 158, 11, .14);
  border-color: rgba(245, 158, 11, .34);
}

body.theme-dark .action-center-item.critical,
body.theme-dark .load-profit-metric.danger,
body.theme-dark .visibility-alert-summary article.danger {
  background: rgba(239, 68, 68, .14);
  border-color: rgba(239, 68, 68, .34);
}

body.theme-dark .load-profit-metric.success,
body.theme-dark .visibility-alert-summary article.success {
  background: rgba(16, 185, 129, .14);
  border-color: rgba(16, 185, 129, .34);
}

body.theme-dark .load-profit-metric span,
body.theme-dark .load-profit-metric small,
body.theme-dark .route-summary-grid span,
body.theme-dark .route-summary-grid small,
body.theme-dark .owner-command-metric span,
body.theme-dark .owner-command-metric small,
body.theme-dark .dashboard-list-item small,
body.theme-dark .dispatcher-summary-card span,
body.theme-dark .load-next-action span,
body.theme-dark .load-next-action p,
body.theme-dark .dispatch-packet-summary dt,
body.theme-dark .visibility-readiness-summary span,
body.theme-dark .visibility-alert-summary span,
body.theme-dark .visibility-route-summary span {
  color: #cbd5e1;
}

body.theme-dark .load-profit-metric strong,
body.theme-dark .route-summary-grid strong,
body.theme-dark .owner-command-metric strong,
body.theme-dark .dashboard-list-item strong,
body.theme-dark .dispatcher-summary-card strong,
body.theme-dark .load-next-action strong,
body.theme-dark .dispatch-packet-summary dd,
body.theme-dark .visibility-readiness-summary strong,
body.theme-dark .visibility-alert-summary strong,
body.theme-dark .visibility-route-summary strong {
  color: #f8fafc;
}

body.theme-dark .dashboard-list-item:hover,
body.theme-dark .action-menu-item:hover,
body.theme-dark .action-menu-item:focus {
  background: #1e293b;
}

body.theme-dark .action-menu-item {
  color: #e2e8f0;
}

/* Final dark mode contrast override for dashboard-style nested panels */
body.theme-dark .content .card,
body.theme-dark .content .dashboard-card,
body.theme-dark .content .stat-card,
body.theme-dark .content .mini-stat,
body.theme-dark .content .mini-stat-row,
body.theme-dark .content .owner-command-metric,
body.theme-dark .content .profit-leak-panel,
body.theme-dark .content .profit-leak-item,
body.theme-dark .content .rate-intelligence-panel,
body.theme-dark .content .rate-intelligence-grid span,
body.theme-dark .content .dashboard-list-item,
body.theme-dark .content .action-center-item,
body.theme-dark .content .dispatcher-summary-card,
body.theme-dark .content .load-next-action,
body.theme-dark .content .tracking-summary,
body.theme-dark .content .visibility-readiness-summary article,
body.theme-dark .content .visibility-alert-summary article,
body.theme-dark .content .visibility-route-summary,
body.theme-dark .content .visibility-route-summary article,
body.theme-dark .content .visibility-attention-item,
body.theme-dark .content .visibility-route-load,
body.theme-dark .content .visibility-route-points,
body.theme-dark .content .mini-stat-row span,
body.theme-dark .content .dispatcher-load-item,
body.theme-dark .content .command-action-card {
  background: #111827 !important;
  border-color: #334155 !important;
  color: #f8fafc !important;
  opacity: 1 !important;
}

body.theme-dark .content .mini-stat-row strong {
  color: #f8fafc !important;
}

body.theme-dark .content .command-action-card.warning {
  border-left-color: var(--danger) !important;
}

body.theme-dark .content .command-action-card.caution {
  border-left-color: var(--warning) !important;
}

body.theme-dark .content .command-action-card.success {
  border-left-color: var(--success) !important;
}

body.theme-dark .content .command-action-count {
  background: rgba(7, 136, 232, .18) !important;
  color: #93c5fd !important;
}

body.theme-dark .content .command-action-card.warning .command-action-count {
  background: rgba(220, 38, 38, .2) !important;
  color: #fecaca !important;
}

body.theme-dark .content .command-action-card.caution .command-action-count {
  background: rgba(217, 138, 0, .2) !important;
  color: #fde68a !important;
}

body.theme-dark .content .command-action-card.success .command-action-count {
  background: rgba(18, 163, 109, .2) !important;
  color: #86efac !important;
}

body.theme-dark .content .rate-intelligence-panel.rate-good,
body.theme-dark .content .profit-leak-item.success,
body.theme-dark .content .dispatcher-summary-card.success,
body.theme-dark .content .visibility-alert-summary article.success {
  background: #0f2f25 !important;
  border-color: #047857 !important;
}

body.theme-dark .content .rate-intelligence-panel.rate-watch,
body.theme-dark .content .profit-leak-item.caution,
body.theme-dark .content .profit-leak-item.warning,
body.theme-dark .content .action-center-item.warning,
body.theme-dark .content .dispatcher-summary-card.warning,
body.theme-dark .content .load-next-action.warning,
body.theme-dark .content .visibility-alert-summary article.warning {
  background: #2f2613 !important;
  border-color: #b45309 !important;
}

body.theme-dark .content .rate-intelligence-panel.rate-danger,
body.theme-dark .content .action-center-item.critical,
body.theme-dark .content .profit-leak-item.danger,
body.theme-dark .content .visibility-alert-summary article.danger {
  background: #321a1a !important;
  border-color: var(--danger) !important;
}

body.theme-dark .content .card h1,
body.theme-dark .content .card h2,
body.theme-dark .content .card h3,
body.theme-dark .content .card h4,
body.theme-dark .content .card strong,
body.theme-dark .content .card b,
body.theme-dark .content .card .metric-value,
body.theme-dark .content .card .stat-value,
body.theme-dark .content .card .profit-leak-impact,
body.theme-dark .content .dashboard-card h1,
body.theme-dark .content .dashboard-card h2,
body.theme-dark .content .dashboard-card h3,
body.theme-dark .content .dashboard-card h4,
body.theme-dark .content .dashboard-card strong,
body.theme-dark .content .dashboard-card b,
body.theme-dark .content .dashboard-card .metric-value,
body.theme-dark .content .dashboard-card .stat-value,
body.theme-dark .content .stat-card h1,
body.theme-dark .content .stat-card h2,
body.theme-dark .content .stat-card h3,
body.theme-dark .content .stat-card h4,
body.theme-dark .content .stat-card strong,
body.theme-dark .content .stat-card b,
body.theme-dark .content .stat-card .metric-value,
body.theme-dark .content .stat-card .stat-value,
body.theme-dark .content .owner-command-metric strong,
body.theme-dark .content .rate-intelligence-grid strong,
body.theme-dark .content .dashboard-list-item strong,
body.theme-dark .content .dispatcher-summary-card strong,
body.theme-dark .content .load-next-action strong,
body.theme-dark .content .visibility-route-summary strong,
body.theme-dark .content .visibility-alert-summary strong,
body.theme-dark .content .visibility-readiness-summary strong {
  color: #ffffff !important;
  opacity: 1 !important;
}

body.theme-dark .content .card p,
body.theme-dark .content .card span,
body.theme-dark .content .card small,
body.theme-dark .content .card label,
body.theme-dark .content .card .muted-line,
body.theme-dark .content .card .muted-copy,
body.theme-dark .content .dashboard-card p,
body.theme-dark .content .dashboard-card span,
body.theme-dark .content .dashboard-card small,
body.theme-dark .content .dashboard-card label,
body.theme-dark .content .dashboard-card .muted-line,
body.theme-dark .content .dashboard-card .muted-copy,
body.theme-dark .content .stat-card p,
body.theme-dark .content .stat-card span,
body.theme-dark .content .stat-card small,
body.theme-dark .content .stat-card label,
body.theme-dark .content .stat-card .muted-line,
body.theme-dark .content .stat-card .muted-copy,
body.theme-dark .content .owner-command-metric span,
body.theme-dark .content .owner-command-metric small,
body.theme-dark .content .rate-intelligence-grid span,
body.theme-dark .content .rate-intelligence-panel p,
body.theme-dark .content .dashboard-list-item small,
body.theme-dark .content .dispatcher-summary-card span,
body.theme-dark .content .load-next-action span,
body.theme-dark .content .load-next-action p,
body.theme-dark .content .visibility-route-summary span,
body.theme-dark .content .visibility-alert-summary span,
body.theme-dark .content .visibility-readiness-summary span {
  color: #dbeafe !important;
  opacity: 1 !important;
}

body.theme-dark .content .section-eyebrow,
body.theme-dark .content .section-kicker {
  color: #93c5fd !important;
}

body.theme-dark .content .status-count {
  background: rgba(239, 68, 68, .22) !important;
  color: #fecaca !important;
}

body.theme-dark .visibility-action-menu summary {
  background: #111827;
  border-color: #334155;
  color: #f8fafc;
}

body.theme-dark .visibility-action-menu[open] summary {
  border-color: #60a5fa;
}

body.theme-dark .visibility-action-menu .action-menu-panel {
  background: #111827;
  border-color: #334155;
}

body.theme-dark .visibility-action-menu .action-menu-item {
  color: #e2e8f0;
}

body.theme-dark .visibility-action-menu .action-menu-item:hover,
body.theme-dark .visibility-action-menu .action-menu-item:focus {
  background: #1e293b;
  color: #ffffff;
}

/* Dispatch board cleanup: keep actions aligned and card text contained. */
.dispatch-page-header {
  align-items: flex-start;
  display: flex;
  gap: 18px;
}

.dispatch-page-header > div:first-child {
  flex: 1 1 auto;
  min-width: 0;
}

.dispatch-page-header .quick-actions {
  flex: 0 0 auto;
  justify-content: flex-end;
  margin-left: auto;
  max-width: 100%;
}

.dispatch-page-header .quick-actions a,
.dispatch-page-header .quick-actions button {
  min-width: 116px;
}

.dispatch-live-map {
  background: #eaf4ff;
  border: 1px solid #d8e7f8;
  border-radius: 8px;
  height: 320px;
  margin-bottom: 14px;
  min-height: 320px;
  overflow: hidden;
  position: relative;
  width: 100%;
}

.dispatch-map-empty {
  align-items: center;
  color: #475569;
  display: flex;
  flex-direction: column;
  gap: 6px;
  height: 100%;
  justify-content: center;
  padding: 22px;
  text-align: center;
}

.dispatch-map-empty strong {
  color: #0f172a;
  font-size: 15px;
}

.dispatch-map-empty span {
  font-size: 13px;
  line-height: 1.4;
  max-width: 520px;
}

.dispatch-gps-list {
  display: grid;
  gap: 8px;
}

.dispatch-isoline-controls {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 10px;
}

.dispatch-isoline-controls .view {
  min-height: 36px;
  min-width: 76px;
  padding: 8px 12px;
}

.dispatch-gps-item {
  align-items: center;
  grid-template-columns: minmax(0, 1fr) auto;
}

.dispatch-board {
  grid-template-columns: repeat(7, minmax(220px, 1fr));
  gap: 12px;
}

.dispatch-column {
  min-width: 220px;
  overflow: hidden;
}

.dispatch-load-card,
.assignment-load-chip,
.assignment-driver-card,
.dispatch-gps-item {
  overflow: hidden;
}

.dispatch-load-card *,
.assignment-load-chip *,
.assignment-driver-card *,
.dispatch-gps-item *,
.assignment-save-panel * {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: normal;
}

.dispatch-load-top {
  align-items: flex-start;
}

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

.dispatch-load-top h3,
.dispatch-load-top p,
.dispatch-lane,
.dispatch-meta dd,
.assignment-load-chip strong,
.assignment-load-chip span,
.assignment-load-chip small,
.assignment-driver-card strong,
.assignment-driver-card span,
.dispatch-gps-item strong,
.dispatch-gps-item span {
  max-width: 100%;
  overflow-wrap: anywhere;
}

.assignment-load-chip {
  align-items: flex-start !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 5px;
  justify-content: flex-start !important;
  min-height: 76px;
}

.assignment-load-chip strong,
.assignment-load-chip span,
.assignment-load-chip small {
  display: block !important;
  line-height: 1.2;
  width: 100%;
}

.assignment-load-chip strong {
  color: #0f172a;
  font-size: 15px;
  font-weight: 900;
}

.assignment-load-chip span {
  color: #475569;
  font-size: 12px;
  font-weight: 800;
}

.assignment-load-chip small {
  color: #64748b;
  font-size: 11px;
  line-height: 1.25;
}

.dispatch-quick-assign {
  grid-template-columns: minmax(0, 1fr);
}

.dispatch-quick-assign .view {
  width: 100%;
}

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

.dispatch-actions .view {
  min-width: 0;
  width: 100%;
}

.assignment-planner-grid {
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(260px, .8fr);
}

.assignment-load-list,
.assignment-resource-list,
.assignment-save-panel {
  min-width: 0;
}

@media (max-width: 1200px) {
  .dispatch-board {
    grid-template-columns: repeat(4, minmax(230px, 1fr));
    overflow-x: visible;
  }

  .assignment-planner-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .dispatch-page-header {
    align-items: stretch;
    flex-direction: column;
  }

  .dispatch-page-header .quick-actions {
    justify-content: stretch;
    width: 100%;
  }

  .dispatch-page-header .quick-actions a,
  .dispatch-page-header .quick-actions button {
    flex: 1 1 100%;
    width: 100%;
  }

  .dispatch-board {
    grid-template-columns: 1fr;
  }

  .dispatch-live-map {
    height: 260px;
    min-height: 260px;
  }

  .dispatch-gps-item {
    grid-template-columns: 1fr;
  }
}
/* Launch hardening: dispatch board scanability and no-overlap layout. */
.dispatch-board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(220px, 1fr);
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 12px;
  scrollbar-gutter: stable;
}

.dispatch-column {
  min-width: 220px;
}

.dispatch-load-card,
.assignment-load-chip,
.assignment-driver-card {
  max-width: 100%;
  overflow: hidden;
}

.dispatch-load-card *,
.assignment-load-chip *,
.assignment-driver-card * {
  min-width: 0;
}

.assignment-load-chip {
  display: grid;
  grid-template-columns: minmax(86px, max-content) minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  text-align: left;
}

.assignment-load-chip strong,
.assignment-load-chip span,
.assignment-load-chip small,
.assignment-driver-card strong,
.assignment-driver-card span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .assignment-load-chip {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

/* Dispatch board readability: keep load cards usable instead of squeezing every column. */
.dispatch-board {
  grid-template-columns: repeat(7, minmax(340px, 1fr)) !important;
  grid-auto-columns: minmax(340px, 1fr) !important;
  gap: 18px !important;
  overflow-x: auto !important;
  overflow-y: visible;
  padding: 4px 4px 16px;
  scrollbar-gutter: stable;
}

.dispatch-column {
  min-width: 340px !important;
  padding: 14px !important;
}

.dispatch-card-list {
  display: grid;
  gap: 14px;
}

.dispatch-load-card {
  padding: 16px !important;
  min-width: 0;
}

.dispatch-load-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.dispatch-load-top h3,
.dispatch-load-top p,
.dispatch-lane {
  overflow-wrap: anywhere;
  white-space: normal;
}

.dispatch-lane {
  line-height: 1.45;
}

.dispatch-meta {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 10px !important;
}

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

.dispatch-meta dd {
  overflow-wrap: anywhere;
  white-space: normal;
}

.dispatch-quick-assign {
  grid-template-columns: 1fr !important;
  gap: 10px !important;
}

.dispatch-actions {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px !important;
}

.dispatch-actions .view,
.dispatch-quick-assign .view,
.dispatch-status-control select {
  width: 100%;
}

/* Dispatch board premium polish: readable cards, aligned controls, no text collisions. */
.dispatch-page-header {
  align-items: flex-start;
  gap: 18px;
}

.dispatch-page-header .quick-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.dispatch-page-header .quick-actions .view {
  min-width: 132px;
}

.dispatch-board {
  align-items: stretch;
  display: grid !important;
  gap: 18px !important;
  grid-auto-flow: column;
  grid-auto-columns: minmax(300px, 1fr) !important;
  grid-template-columns: repeat(7, minmax(300px, 1fr)) !important;
  overflow-x: auto !important;
  overflow-y: visible;
  padding: 4px 6px 18px;
  scrollbar-gutter: stable;
}

.dispatch-column {
  background: rgba(255, 255, 255, .82);
  border-radius: 14px;
  min-width: 300px !important;
  padding: 14px !important;
}

.dispatch-column-header {
  gap: 10px;
}

.dispatch-column-header h2 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dispatch-card-list {
  gap: 14px;
}

.dispatch-load-card {
  border-radius: 14px !important;
  box-shadow: 0 12px 30px rgba(15, 23, 42, .08);
  display: grid;
  gap: 12px;
  padding: 16px !important;
}

.dispatch-load-top {
  align-items: flex-start;
  display: grid !important;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
  margin-bottom: 0;
}

.dispatch-load-top h3,
.dispatch-load-top p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dispatch-lane {
  background: #f8fbff;
  border: 1px solid #e6eef7;
  border-radius: 12px;
  color: #172033;
  display: -webkit-box;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
  margin: 0;
  min-height: 42px;
  overflow: hidden;
  padding: 10px 12px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.dispatch-meta {
  display: grid !important;
  gap: 8px !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  margin: 0;
}

.dispatch-meta div {
  background: #f9fbfd;
  border: 1px solid #edf2f7;
  border-radius: 10px;
  min-width: 0;
  padding: 9px;
}

.dispatch-meta dt {
  font-size: 10px;
  letter-spacing: .04em;
}

.dispatch-meta dd {
  color: #172033;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dispatch-status-control {
  display: grid;
  gap: 6px;
  margin: 0;
}

.dispatch-status-control select {
  min-height: 40px;
}

.dispatch-quick-assign {
  background: #f8fbff;
  border: 1px solid #e6eef7;
  border-radius: 12px;
  display: grid !important;
  gap: 8px !important;
  grid-template-columns: 1fr !important;
  padding: 10px;
}

.dispatch-actions {
  display: grid !important;
  gap: 9px !important;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dispatch-actions .view,
.dispatch-quick-assign .view {
  align-items: center;
  display: inline-flex;
  justify-content: center;
  min-height: 38px;
  min-width: 0;
  padding-inline: 10px;
  width: 100%;
}

.assignment-planner-grid {
  align-items: stretch;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(280px, 1.05fr) minmax(260px, .95fr) minmax(280px, .85fr) !important;
}

.assignment-load-list,
.assignment-resource-list,
.assignment-save-panel {
  min-width: 0;
}

.assignment-load-chip,
.assignment-driver-card {
  border-radius: 14px;
  min-width: 0;
  padding: 14px;
}

.assignment-load-chip {
  align-items: flex-start !important;
  display: grid !important;
  gap: 5px !important;
  grid-template-columns: 1fr !important;
  min-height: 90px;
}

.assignment-load-chip strong,
.assignment-load-chip span,
.assignment-load-chip small,
.assignment-driver-card strong,
.assignment-driver-card span {
  display: block;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.assignment-load-chip strong {
  color: #0f172a;
  font-size: 16px;
}

.assignment-load-chip span {
  color: #334155;
  font-size: 13px;
}

.assignment-load-chip small {
  color: #64748b;
  font-size: 12px;
}

@media (max-width: 1180px) {
  .assignment-planner-grid {
    grid-template-columns: 1fr !important;
  }

  .dispatch-page-header .quick-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 760px) {
  .dispatch-page-header .quick-actions .view {
    min-width: 0;
    width: 100%;
  }

  .dispatch-board {
    grid-auto-flow: row;
    grid-auto-columns: auto !important;
    grid-template-columns: 1fr !important;
    overflow-x: visible !important;
  }

  .dispatch-column {
    min-width: 0 !important;
  }

  .dispatch-actions {
    grid-template-columns: 1fr;
  }
}

/* Invoice Intelligence Center */
.invoice-command-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 18px 0;
}

.invoice-command-grid .metric-card {
  background: #fff;
  border: 1px solid #e5eef7;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.06);
  justify-content: center;
  min-height: 108px;
  padding: 18px;
}

.invoice-command-grid .metric-card.warning {
  border-top: 3px solid var(--warning);
}

.invoice-command-grid .metric-card.success {
  border-top: 3px solid var(--success);
}

.invoice-command-grid .metric-card.danger {
  border-top: 3px solid var(--danger);
}

.invoice-command-grid .metric-card.neutral {
  border-top: 3px solid #38bdf8;
}

.metric-label {
  color: #64748b;
  display: block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.metric-value {
  color: #0f172a;
  display: block;
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
  margin-top: 10px;
  overflow-wrap: anywhere;
}

.metric-note {
  color: #64748b;
  display: block;
  font-size: 12px;
  margin-top: 8px;
}

.invoice-command-grid .metric-card > span:not(.metric-label) {
  color: #64748b;
  display: block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.invoice-command-grid .metric-card > strong:not(.metric-value) {
  color: #0f172a;
  display: block;
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
  margin-top: 10px;
}

.invoice-command-grid .metric-card > small:not(.metric-note) {
  color: #64748b;
  display: block;
  font-size: 12px;
  margin-top: 8px;
}

.invoice-toolbar-card,
.invoice-center-card {
  background: #fff;
  border: 1px solid #e5eef7;
  border-radius: 8px;
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.06);
  margin-bottom: 18px;
  padding: 22px;
}

.invoice-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.invoice-tabs button,
.invoice-center-actions button,
.invoice-action-stack button,
.hyper-modal button,
.invoice-center-card .view {
  align-items: center;
  border-radius: 7px;
  display: inline-flex;
  font-size: 13px;
  font-weight: 800;
  justify-content: center;
  min-height: 40px;
  padding: 0 16px;
  text-decoration: none;
  white-space: nowrap;
}

.invoice-tabs button {
  background: #fff;
  border: 1px solid #dbe7f3;
  color: #334155;
}

.invoice-tabs button.active {
  background: linear-gradient(180deg, #109cf4 0%, var(--primary) 100%);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 10px 20px rgba(14, 116, 220, 0.18);
}

.invoice-filters {
  display: grid;
  gap: 12px;
  grid-template-columns: 1.5fr 1fr 1fr;
}

.invoice-filters input,
.invoice-filters select,
.hyper-modal input,
.hyper-modal select,
.hyper-modal textarea {
  background: #fff;
  border: 1px solid #dbe7f3;
  border-radius: 7px;
  color: #0f172a;
  min-height: 42px;
  padding: 0 12px;
  width: 100%;
}

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

.section-heading-row h2 {
  color: #0f172a;
  font-size: 22px;
  margin: 0;
}

.section-heading-row p {
  color: #64748b;
  margin: 4px 0 0;
}

.invoice-bulk-preview {
  color: #64748b;
  font-size: 13px;
  font-weight: 700;
}

.table-scroll {
  max-width: 100%;
  overflow-x: auto;
}

.invoice-center-table {
  border-collapse: collapse;
  min-width: 960px;
  width: 100%;
}

.invoice-center-table th {
  background: #edf5fc;
  color: #475569;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 14px;
  text-align: left;
  text-transform: uppercase;
}

.invoice-center-table td {
  border-bottom: 1px solid #eef3f8;
  color: #1f2937;
  padding: 14px;
  vertical-align: top;
}

.invoice-center-table tr:hover td {
  background: #f8fbff;
}

.invoice-load-cell strong,
.invoice-load-cell small {
  display: block;
}

.invoice-load-cell small {
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
  margin-top: 4px;
}

.invoice-missing-list {
  color: #b45309;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  margin-top: 4px;
}

.invoice-status-pill,
.invoice-readiness-pill {
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  padding: 6px 10px;
}

.invoice-status-pill {
  background: #e0f2fe;
  color: #075985;
}

.invoice-status-pill.paid {
  background: #dcfce7;
  color: #166534;
}

.invoice-status-pill.overdue,
.invoice-readiness-pill.blocked {
  background: #fee2e2;
  color: #991b1b;
}

.invoice-readiness-pill.ready {
  background: #dcfce7;
  color: #166534;
}

.invoice-readiness-pill.review {
  background: #fef3c7;
  color: #92400e;
}

.invoice-action-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.invoice-action-stack button,
.invoice-center-actions button,
.hyper-modal button[type="submit"] {
  background: linear-gradient(180deg, #109cf4 0%, var(--primary) 100%);
  border: 0;
  color: #fff;
  cursor: pointer;
}

.invoice-action-stack button.secondary,
.invoice-center-actions button.secondary,
.hyper-modal button.secondary {
  background: #fff;
  border: 1px solid #dbe7f3;
  color: #0f172a;
}

.invoice-action-stack button.danger {
  background: var(--danger);
}

.invoice-action-stack button:disabled,
.invoice-center-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.hyper-modal {
  border: 0;
  border-radius: 10px;
  box-shadow: 0 30px 70px rgba(15, 23, 42, 0.28);
  max-width: 560px;
  padding: 0;
  width: min(92vw, 560px);
}

.hyper-modal::backdrop {
  background: rgba(15, 23, 42, 0.45);
}

.onboarding-wizard-dialog {
  max-width: 480px;
  width: min(92vw, 480px);
}

.onboarding-wizard {
  padding: 28px;
}

.onboarding-wizard-eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .04em;
  margin: 0 0 6px;
  text-transform: uppercase;
}

.onboarding-wizard h2 {
  margin: 0 0 12px;
}

.onboarding-wizard-body {
  color: #334155;
  line-height: 1.5;
  margin: 0 0 20px;
}

.onboarding-wizard-dots {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-bottom: 22px;
}

.onboarding-wizard-dots span {
  background: #dbe7f3;
  border-radius: 999px;
  height: 8px;
  width: 8px;
}

.onboarding-wizard-dots span.active {
  background: var(--primary);
  width: 20px;
}

.onboarding-wizard-actions {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.onboarding-wizard-actions-right {
  display: flex;
  gap: 10px;
}

@media (max-width: 520px) {
  .onboarding-wizard-actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .onboarding-wizard-actions-right {
    flex-direction: column;
  }
}

.onboarding-wizard-pill {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 60;
  display: none;
  align-items: center;
  gap: 10px;
  max-width: calc(100vw - 40px);
  padding: 10px 12px 10px 16px;
  border-radius: 999px;
  background: #0f172a;
  color: #f8fafc;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.25);
}

.onboarding-wizard-pill.visible {
  display: flex;
}

.onboarding-wizard-pill span[data-pill-text] {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}

.onboarding-wizard-pill [data-pill-continue] {
  margin: 0;
  white-space: nowrap;
}

.onboarding-wizard-pill-close {
  background: transparent;
  border: none;
  color: #cbd5e1;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 0 2px;
}

.onboarding-wizard-pill-close:hover {
  color: #f8fafc;
}

@media (max-width: 520px) {
  .onboarding-wizard-pill {
    left: 20px;
    right: 20px;
  }

  .onboarding-wizard-pill span[data-pill-text] {
    max-width: none;
    flex: 1;
  }
}

.hyper-modal form {
  padding: 24px;
}

.modal-header {
  align-items: flex-start;
  display: flex;
  justify-content: space-between;
  margin-bottom: 18px;
}

/* Simplified 3PL/dispatch load workflow */
.load-workflow-panel,
.workflow-fieldset,
.workflow-advanced,
.workflow-submit-row {
  grid-column: 1 / -1;
}

.load-workflow-panel {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 4px;
}

.workflow-fieldset {
  border: 1px solid #dbe7f3;
  border-radius: 14px;
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 22px;
}

.workflow-fieldset legend {
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 0 8px;
  text-transform: uppercase;
}

.workflow-advanced {
  border: 1px solid #dbe7f3;
  border-radius: 14px;
  padding: 0;
}

.workflow-advanced summary {
  color: #0f172a;
  cursor: pointer;
  font-weight: 800;
  padding: 18px 22px;
}

.workflow-advanced-grid {
  border-top: 1px solid #eef3f8;
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 22px;
}

.assignment-estimate-panel {
  background: #f8fbff;
  border: 1px solid #dbeafe;
  border-radius: 12px;
  display: grid;
  gap: 12px;
  grid-column: 1 / -1;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 16px;
}

.assignment-estimate-panel span {
  color: #64748b;
  display: block;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.assignment-estimate-panel strong {
  color: #0f172a;
  display: block;
  font-size: 22px;
  margin-top: 4px;
}

.workflow-inline-actions,
.workflow-submit-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.workflow-submit-row .btn,
.workflow-submit-row .view {
  align-items: center;
  display: inline-flex;
  justify-content: center;
  min-width: 180px;
  width: auto;
}

@media (max-width: 900px) {
  .load-workflow-panel,
  .workflow-fieldset,
  .workflow-advanced-grid,
  .assignment-estimate-panel {
    grid-template-columns: 1fr;
  }
}

.modal-header h2 {
  color: #0f172a;
  margin: 0;
}

.modal-header p {
  color: #64748b;
  margin: 4px 0 0;
}

.hyper-modal label {
  color: #475569;
  display: grid;
  font-size: 12px;
  font-weight: 800;
  gap: 6px;
  letter-spacing: 0.04em;
  margin-bottom: 14px;
  text-transform: uppercase;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 18px;
}

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

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

@media (max-width: 700px) {
  .invoice-command-grid {
    grid-template-columns: 1fr;
  }

  .section-heading-row {
    flex-direction: column;
  }

  .invoice-center-actions,
  .invoice-action-stack,
  .modal-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }
}

/* Carrier-first assignment picker */
.carrier-picker-field {
  grid-column: 1 / -1;
}

.carrier-picker-field input[type="search"] {
  margin-bottom: 10px;
}

.carrier-picker-list {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 132px;
  max-height: 280px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f8fafc;
}

.carrier-picker-list::-webkit-scrollbar {
  width: 8px;
}

.carrier-picker-list::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
}

.carrier-picker-option {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 62px;
  padding: 10px 14px;
  border: 1px solid #dbeafe;
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  box-shadow: none;
}

.carrier-picker-option:hover,
.carrier-picker-option.selected {
  border-color: var(--primary);
  background: #eff6ff;
}

.carrier-picker-option.warning {
  border-color: #fde68a;
}

.carrier-picker-option span {
  min-width: 0;
}

.carrier-picker-option strong,
.carrier-picker-option small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.carrier-picker-option small,
.carrier-picker-summary,
.carrier-picker-empty {
  color: var(--muted);
  font-size: 13px;
}

.carrier-picker-option em {
  flex: 0 0 auto;
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
  color: var(--primary);
}

.carrier-picker-summary {
  margin-top: 8px;
}

.carrier-picker-empty {
  padding: 12px;
  text-align: center;
}

/* Load details workflow: page-specific override for a clean progress panel. */
.load-details-page .details-card .load-workflow-panel {
  background: #f8fbff;
  border: 1px solid #dbe7f3;
  border-radius: 12px;
  display: block;
  grid-column: 1 / -1;
  margin: 18px 0;
  padding: 16px;
}

.load-details-page .load-workflow-panel .section-header {
  margin-bottom: 12px;
}

.load-details-page .load-workflow-panel .section-header h2 {
  font-size: 18px;
  margin: 0;
}

.load-details-page .load-workflow-bar {
  align-items: stretch;
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(8, minmax(80px, 1fr));
  margin: 8px 0 12px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.load-details-page .load-workflow-step {
  align-items: center;
  background: #fff;
  border: 1px solid #dbe7f3;
  border-radius: 9px;
  display: flex;
  gap: 8px;
  justify-content: flex-start;
  min-height: 48px;
  min-width: 80px;
  padding: 8px 10px;
  text-align: left;
}

.load-details-page .load-workflow-step span {
  background: #eef2f7;
  border-radius: 999px;
  color: #64748b;
  flex: 0 0 22px;
  font-size: 9px;
  font-weight: 900;
  height: 22px;
  line-height: 22px;
  text-align: center;
  width: 22px;
}

.load-details-page .load-workflow-step strong {
  color: #172033;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.load-details-page .load-workflow-step.complete {
  border-color: #bbf7d0;
}

.load-details-page .load-workflow-step.complete span {
  background: #dcfce7;
  color: #047857;
}

.load-details-page .load-workflow-step.active {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(7, 136, 232, .08);
}

.load-details-page .load-next-action {
  align-items: center;
  background: #fff;
  border: 1px solid #dbe7f3;
  border-radius: 10px;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) auto;
  margin-top: 10px;
  padding: 12px;
}

.load-details-page .load-next-action span {
  color: var(--primary);
  display: block;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .05em;
  margin-bottom: 3px;
  text-transform: uppercase;
}

.load-details-page .load-next-action strong {
  color: #172033;
  display: block;
  font-size: 16px;
}

.load-details-page .load-next-action p {
  color: #64748b;
  font-size: 13px;
  line-height: 1.4;
  margin: 3px 0 0;
  max-width: 640px;
}

.load-details-page .load-next-action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.load-details-page .load-next-action-buttons .view {
  min-height: 38px;
  padding: 0 14px;
}

@media (max-width: 900px) {
  .load-details-page .load-next-action {
    grid-template-columns: 1fr;
  }

  .load-details-page .load-next-action-buttons,
  .load-details-page .load-next-action-buttons .view {
    justify-content: center;
    width: 100%;
  }
}

.load-details-page .load-next-action.has-quick-assignment,
.load-details-page .load-next-action:has(.quick-load-assignment) {
  align-items: stretch;
  grid-template-columns: minmax(180px, .7fr) minmax(360px, 1.35fr) auto;
}

.quick-load-assignment {
  background: #f8fafc;
  border: 1px solid #dbe7f3;
  border-radius: 10px;
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 12px;
}

.quick-assignment-header {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.quick-assignment-header strong {
  color: #0f172a;
  font-size: 14px;
}

.quick-assignment-header span {
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
  max-width: 52%;
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-assignment-search {
  background: #fff;
  border: 1px solid #dbe7f3;
  border-radius: 8px;
  color: #0f172a;
  min-height: 38px;
  padding: 0 12px;
  width: 100%;
}

.quick-carrier-list {
  display: grid;
  gap: 8px;
  max-height: 180px;
  overflow-y: auto;
  padding-right: 4px;
}

.quick-carrier-option {
  align-items: center;
  background: #fff;
  border: 1px solid #e5eef7;
  border-radius: 9px;
  color: #0f172a;
  cursor: pointer;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  min-height: 54px;
  padding: 10px 12px;
  text-align: left;
  width: 100%;
}

.quick-carrier-option:hover,
.quick-carrier-option.selected {
  background: #eff6ff;
  border-color: #93c5fd;
}

.quick-carrier-option.warning {
  border-left: 3px solid var(--warning);
}

.quick-carrier-option span {
  min-width: 0;
}

.quick-carrier-option strong,
.quick-carrier-option small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-carrier-option strong {
  color: #0f172a;
  font-size: 13px;
  font-weight: 900;
}

.quick-carrier-option small {
  color: #64748b;
  font-size: 11px;
  margin-top: 2px;
}

.quick-carrier-option em {
  color: var(--primary);
  flex: 0 0 auto;
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
}

.quick-driver-row {
  display: grid;
  gap: 6px;
}

.quick-driver-row label {
  color: #475569;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.quick-driver-row select {
  background: #fff;
  border: 1px solid #dbe7f3;
  border-radius: 8px;
  color: #0f172a;
  min-height: 40px;
  padding: 0 12px;
  width: 100%;
}

.quick-driver-row small,
.quick-assignment-empty,
.assignment-loading,
.assignment-error {
  color: #64748b;
  font-size: 12px;
  line-height: 1.35;
}

.assignment-error {
  color: var(--danger);
}

#saveQuickAssignment {
  width: 100%;
}

@media (max-width: 1180px) {
  .load-details-page .load-next-action.has-quick-assignment,
  .load-details-page .load-next-action:has(.quick-load-assignment) {
    grid-template-columns: 1fr;
  }

  .quick-assignment-header span {
    max-width: none;
  }
}

/* Load details simplification */
.details-card {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 18px;
}

.details-card h2,
.details-card .load-workflow-panel,
.details-card .actions,
.details-card .message {
  grid-column: 1 / -1;
}

.details-card > p {
  margin: 0;
  padding: 8px 10px;
  border: 1px solid #edf2f7;
  border-radius: 10px;
  background: #f8fafc;
}

.details-card > p strong {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.details-card > p span {
  display: block;
  overflow-wrap: anywhere;
  font-weight: 700;
}

.load-detail-workspace {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.load-detail-group {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.load-detail-group summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 22px;
  cursor: pointer;
  list-style: none;
}

.load-detail-group summary::-webkit-details-marker {
  display: none;
}

.load-detail-group summary strong,
.load-detail-group summary small {
  display: block;
}

.load-detail-group summary strong {
  color: var(--text);
  font-size: 18px;
}

.load-detail-group summary small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.load-detail-group summary em {
  flex: 0 0 auto;
  min-width: 64px;
  padding: 8px 12px;
  border-radius: 999px;
  background: #eff6ff;
  color: var(--primary);
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
  text-align: center;
}

.load-detail-group-body {
  display: grid;
  gap: 14px;
  padding: 0 18px 18px;
}

.load-detail-nested-card {
  margin-top: 0 !important;
  box-shadow: none !important;
  border-color: #eef2f7;
}

details.load-detail-group:not([open]) {
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.04);
}

@media (max-width: 800px) {
  .details-card {
    grid-template-columns: 1fr;
  }

  .load-detail-group summary {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* Dispatch assignment planner: compact carrier -> driver flow, no truck selector. */
.assignment-planner-grid-simple {
  align-items: stretch !important;
  display: grid !important;
  grid-template-columns: minmax(220px, 1fr) minmax(240px, 1fr) minmax(240px, 1fr) minmax(220px, .8fr) !important;
  gap: 16px !important;
}

.assignment-search {
  background: #fff;
  border: 1px solid #dbe4ef;
  border-radius: 8px;
  color: #0f172a;
  font: inherit;
  margin: 0 0 8px;
  min-height: 42px;
  padding: 10px 12px;
  width: 100%;
}

.assignment-load-list,
.assignment-carrier-list,
.assignment-driver-list {
  max-height: 320px !important;
  min-height: 120px;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding: 8px !important;
}

.assignment-carrier-card,
.assignment-driver-card,
.assignment-load-chip {
  align-items: flex-start !important;
  background: #fff !important;
  border: 1px solid #e4edf7 !important;
  border-radius: 8px !important;
  box-shadow: none !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 3px !important;
  justify-content: center !important;
  min-height: 56px !important;
  padding: 10px 12px !important;
  text-align: left !important;
  width: 100% !important;
}

.assignment-carrier-card + .assignment-carrier-card,
.assignment-driver-card + .assignment-driver-card,
.assignment-load-chip + .assignment-load-chip {
  margin-top: 8px;
}

.assignment-carrier-card strong,
.assignment-driver-card strong,
.assignment-load-chip strong {
  color: #0f172a !important;
  font-size: 14px !important;
  font-weight: 800 !important;
  line-height: 1.2 !important;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.assignment-carrier-card span,
.assignment-driver-card span,
.assignment-load-chip span,
.assignment-load-chip small,
.assignment-carrier-card small {
  color: #64748b !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  line-height: 1.25 !important;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.assignment-carrier-card.selected,
.assignment-driver-card.selected,
.assignment-load-chip.selected {
  background: #eef6ff !important;
  border-color: #159be8 !important;
}

.assignment-carrier-card.warning {
  border-color: #f8caca !important;
}

.assignment-suggestions {
  min-height: 0 !important;
}

.assignment-suggestions:empty {
  border: none !important;
  padding: 0 !important;
}

.assignment-suggestion-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.assignment-save-panel-compact {
  align-self: stretch;
  display: grid !important;
  gap: 10px !important;
  min-width: 0 !important;
}

.assignment-save-panel-compact .field {
  margin: 0 !important;
}

.assignment-save-panel-compact input {
  min-height: 40px !important;
}

.assignment-save-panel-compact .view {
  margin-top: 2px;
  min-height: 44px;
  width: 100%;
}

@media (max-width: 1200px) {
  .assignment-planner-grid-simple {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 760px) {
  .assignment-planner-grid-simple {
    grid-template-columns: 1fr !important;
  }
}

/* Final loads action cleanup: one clear action plus a compact overflow menu. */
.load-row-actions {
  display: grid !important;
  grid-template-columns: minmax(108px, 1fr) minmax(86px, auto) !important;
  gap: 8px !important;
  align-items: start !important;
  min-width: 210px !important;
  max-width: 244px !important;
}

.load-row-actions .view,
.load-row-actions .delete,
.load-row-actions .secondary-action {
  width: 100% !important;
  min-width: 0 !important;
  margin: 0 !important;
}

.load-actions-menu {
  position: relative !important;
}

.load-actions-menu summary {
  min-height: 38px !important;
  padding: 10px 14px !important;
  border: 1px solid rgba(148, 163, 184, 0.32) !important;
  border-radius: 8px !important;
  background: #ffffff !important;
  color: #0f172a !important;
  font-weight: 800 !important;
  text-align: center !important;
  cursor: pointer !important;
  list-style: none !important;
}

.load-actions-menu summary::-webkit-details-marker {
  display: none !important;
}

.load-actions-menu[open] > div {
  position: absolute !important;
  z-index: 20 !important;
  right: 0 !important;
  top: calc(100% + 6px) !important;
  display: grid !important;
  gap: 6px !important;
  width: 172px !important;
  padding: 8px !important;
  border: 1px solid rgba(148, 163, 184, 0.24) !important;
  border-radius: 10px !important;
  background: #ffffff !important;
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.16) !important;
}

/* Dispatch board scalable layout */
.dispatch-view-toggle {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin: 0 0 14px;
}

.dispatch-toolbar {
  grid-template-columns: repeat(6, minmax(0, 1fr)) auto !important;
  align-items: end !important;
}

.dispatch-map-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dispatch-table-card,
.dispatch-table-wrap {
  min-width: 0;
  overflow-x: auto;
}

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

.dispatch-table th,
.dispatch-table td {
  padding: 14px 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  text-align: left;
  vertical-align: top;
}

.dispatch-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eef6ff;
  color: #475569;
  font-size: 12px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.dispatch-table th button {
  width: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  box-shadow: none;
  text-transform: inherit;
  letter-spacing: inherit;
}

.dispatch-table small {
  display: block;
  margin-top: 4px;
  color: #64748b;
  line-height: 1.3;
}

.dispatch-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-top: 14px;
}

.dispatch-pagination > div {
  display: flex;
  gap: 8px;
}

.dispatch-board-hidden {
  display: none !important;
}

.dispatch-board {
  max-width: 100%;
  overflow-x: auto;
}

.dispatch-column {
  max-height: 620px;
  overflow: hidden;
}

.dispatch-card-list {
  max-height: 548px;
  overflow-y: auto;
  padding-right: 4px;
}

.dispatch-load-card .dispatch-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.dispatch-assignment-modal {
  max-width: 720px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.42);
}

.modal.hidden {
  display: none !important;
}

.modal-content {
  width: min(100%, 720px);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
}

.assignment-load-summary {
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 10px;
  background: #f8fbff;
}

.assignment-load-summary span,
.assignment-load-summary small {
  color: #64748b;
}

.assignment-carrier-list {
  max-height: 336px;
  overflow-y: auto;
}

.assignment-carrier-card {
  display: block;
  width: 100%;
  min-height: 46px;
  padding: 12px 14px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 8px;
  background: #ffffff;
  color: #0f172a;
  text-align: left;
}

.assignment-carrier-card.selected {
  border-color: #159be8;
  background: #eef6ff;
}

@media (max-width: 900px) {
  .dispatch-toolbar {
    grid-template-columns: 1fr 1fr !important;
  }

  .dispatch-table th:nth-child(4),
  .dispatch-table td:nth-child(4),
  .dispatch-table th:nth-child(8),
  .dispatch-table td:nth-child(8),
  .dispatch-table th:nth-child(9),
  .dispatch-table td:nth-child(9) {
    display: none;
  }

  .dispatch-table {
    min-width: 720px;
  }
}

@media (max-width: 640px) {
  .dispatch-view-toggle,
  .dispatch-map-actions,
  .dispatch-pagination {
    align-items: stretch;
    flex-direction: column;
  }

  .dispatch-toolbar {
    grid-template-columns: 1fr !important;
  }
}

/* Loads page: keep More actions usable inside the card without clipping. */
.loads-table-wrap {
  max-height: 68vh !important;
  min-height: 260px !important;
  overflow: auto !important;
  padding-bottom: 160px !important;
  position: relative !important;
  scrollbar-gutter: stable both-edges;
}

.loads-table-wrap .data-table {
  margin-bottom: 0 !important;
}

.loads-table-wrap .load-actions-menu {
  position: relative !important;
  z-index: 5 !important;
}

.loads-table-wrap .load-actions-menu[open] {
  z-index: 100 !important;
}

.loads-table-wrap .load-actions-menu[open] > div {
  min-width: 180px !important;
  position: absolute !important;
  right: 0 !important;
  top: calc(100% + 8px) !important;
  z-index: 110 !important;
}

.loads-table-wrap .load-actions-menu[open] > div .view,
.loads-table-wrap .load-actions-menu[open] > div .delete {
  width: 100% !important;
}

/* Final loads action-menu override: open inside the card with its own scroll. */
.loads-table-wrap {
  max-height: 72vh !important;
  overflow: auto !important;
  padding-bottom: 24px !important;
}

.loads-table-wrap .data-table td:last-child {
  min-width: 220px !important;
  vertical-align: top !important;
}

.loads-table-wrap .load-row-actions {
  align-items: stretch !important;
  display: grid !important;
  gap: 8px !important;
  grid-template-columns: 1fr !important;
  min-width: 180px !important;
}

.loads-table-wrap .load-actions-menu {
  display: block !important;
  position: static !important;
  width: 100% !important;
  z-index: auto !important;
}

.loads-table-wrap .load-actions-menu summary {
  width: 100% !important;
}

.loads-table-wrap .load-actions-menu[open] > div {
  background: #ffffff !important;
  border: 1px solid rgba(148, 163, 184, 0.28) !important;
  border-radius: 10px !important;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.02) !important;
  display: grid !important;
  gap: 8px !important;
  margin-top: 8px !important;
  max-height: 180px !important;
  min-width: 0 !important;
  overflow-y: auto !important;
  padding: 8px !important;
  position: static !important;
  width: 100% !important;
}

.loads-table-wrap .load-actions-menu[open] > div .view,
.loads-table-wrap .load-actions-menu[open] > div .delete {
  min-height: 38px !important;
  width: 100% !important;
}

/* Loads and Dispatch Board: keep More actions visible outside table/card scroll areas. */
.loads-table-wrap .load-actions-menu[open] > div,
.dispatch-table-wrap .load-actions-menu[open] > div,
.dispatch-load-card .load-actions-menu[open] > div {
  display: none !important;
}

.load-actions-portal {
  background: #ffffff !important;
  border: 1px solid rgba(148, 163, 184, 0.28) !important;
  border-radius: 10px !important;
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.18) !important;
  display: grid !important;
  gap: 8px !important;
  max-height: min(280px, calc(100vh - 24px)) !important;
  min-width: 180px !important;
  overflow-y: auto !important;
  padding: 8px !important;
  position: fixed !important;
  right: auto !important;
  width: 190px !important;
  z-index: 9999 !important;
}

.load-actions-portal[hidden] {
  display: none !important;
}

.load-actions-portal .view,
.load-actions-portal .delete,
.load-actions-portal button {
  min-height: 40px !important;
  width: 100% !important;
}

/* Loads page final polish: keep 10-row pages tidy and the More menu easy to use. */
.loads-table-wrap {
  max-height: none !important;
  min-height: 0 !important;
  overflow-x: auto !important;
  overflow-y: visible !important;
  padding-bottom: 28px !important;
}

.loads-table-wrap .data-table th:last-child,
.loads-table-wrap .data-table td:last-child {
  min-width: 220px !important;
  overflow: visible !important;
}

.loads-table-wrap .load-row-actions {
  display: grid !important;
  gap: 10px !important;
  grid-template-columns: minmax(108px, 1fr) minmax(88px, auto) !important;
  min-width: 220px !important;
}

.loads-table-wrap .load-actions-menu summary {
  align-items: center !important;
  cursor: pointer !important;
  display: flex !important;
  justify-content: center !important;
  min-height: 44px !important;
  width: 100% !important;
}

.load-actions-portal {
  max-height: min(320px, calc(100vh - 24px)) !important;
  min-width: 200px !important;
  width: 200px !important;
}

/* Shared usability polish: small behavior helpers without changing layouts. */
.field-needs-attention {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12) !important;
}

.hyperroute-toast-region {
  bottom: 18px;
  display: grid;
  gap: 10px;
  max-width: min(360px, calc(100vw - 32px));
  position: fixed;
  right: 18px;
  z-index: 10000;
}

.hyperroute-toast {
  background: #0f172a;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 10px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.22);
  color: #ffffff;
  font-weight: 700;
  padding: 12px 14px;
}

.hyperroute-toast.success {
  background: #047857;
}

.hyperroute-toast.warning {
  background: #92400e;
}

.hyperroute-toast.error {
  background: #b91c1c;
}

body.theme-dark .hyperroute-toast {
  border-color: rgba(255, 255, 255, 0.14);
}

.hyperroute-dialog-overlay {
  align-items: center;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 16px;
  position: fixed;
  z-index: 10001;
}

.hyperroute-dialog {
  background: #ffffff;
  border-radius: 12px;
  border-top: 5px solid #0788e8;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.3);
  color: #0f172a;
  max-width: 480px;
  padding: 20px 22px;
  width: 100%;
}

.hyperroute-dialog.error { border-top-color: #b91c1c; }
.hyperroute-dialog.success { border-top-color: #047857; }
.hyperroute-dialog.warning { border-top-color: #92400e; }

.hyperroute-dialog-body {
  line-height: 1.5;
  margin: 0 0 18px;
  white-space: pre-line;
}

.hyperroute-dialog-ok {
  background: #0788e8;
  border: 0;
  border-radius: 8px;
  color: #ffffff;
  cursor: pointer;
  font-weight: 700;
  padding: 10px 22px;
}

body.theme-dark .hyperroute-dialog {
  background: #1e293b;
  color: #f1f5f9;
}

.hyperroute-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.hyperroute-dialog-cancel {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  color: #0f172a;
  cursor: pointer;
  font-weight: 700;
  padding: 10px 22px;
}

.hyperroute-dialog-ok.danger {
  background: #b91c1c;
}

.hyperroute-dialog-ok:focus-visible,
.hyperroute-dialog-cancel:focus-visible {
  outline: 3px solid rgba(7, 136, 232, 0.45);
  outline-offset: 2px;
}

body.theme-dark .hyperroute-dialog-cancel {
  background: #334155;
  border-color: #475569;
  color: #f1f5f9;
}

.hr-scroll-highlight {
  animation: hr-scroll-flash 2.2s ease-out 1;
}

@keyframes hr-scroll-flash {
  0%, 35% { box-shadow: 0 0 0 4px rgba(7, 136, 232, 0.55); }
  100% { box-shadow: 0 0 0 4px rgba(7, 136, 232, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .hr-scroll-highlight { animation: none; box-shadow: 0 0 0 3px rgba(7, 136, 232, 0.55); }
}
@media print {
  @page {
    margin: 0.45in;
  }

  body {
    background: #fff !important;
    color: #111827 !important;
  }

  body * {
    visibility: hidden !important;
  }

  .print-document,
  .print-document * {
    visibility: visible !important;
  }

  .print-document {
    position: absolute !important;
    inset: 0 auto auto 0 !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
    background: #fff !important;
  }

  .layout,
  .content,
  .main-content {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .sidebar,
  .no-print,
  .page-header,
  .quick-actions,
  #invoiceUpdateForm,
  #invoiceDetailsMessage {
    display: none !important;
  }

  .print-document table {
    width: 100% !important;
    border-collapse: collapse !important;
    page-break-inside: auto;
  }

  .print-document thead {
    display: table-header-group;
  }

  .print-document tr,
  .print-document .document-info-grid > div,
  .print-document .invoice-line-items > div,
  .print-document footer {
    page-break-inside: avoid;
    break-inside: avoid;
  }
}

/* Final invoice print override: PDF output should contain only the invoice. */
@media print {
  body.invoice-print-mode,
  body:has(.invoice-document.print-document) {
    background: #fff !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  body.invoice-print-mode .sidebar,
  body.invoice-print-mode .sidebar-controls,
  body.invoice-print-mode .sidebar-toggle,
  body.invoice-print-mode .page-header,
  body.invoice-print-mode .top-actions,
  body.invoice-print-mode .quick-actions,
  body.invoice-print-mode #invoiceUpdateForm,
  body.invoice-print-mode #invoiceDetailsMessage,
  body.invoice-print-mode .card:not(.print-document),
  body:has(.invoice-document.print-document) .sidebar,
  body:has(.invoice-document.print-document) .sidebar-controls,
  body:has(.invoice-document.print-document) .sidebar-toggle,
  body:has(.invoice-document.print-document) .page-header,
  body:has(.invoice-document.print-document) .top-actions,
  body:has(.invoice-document.print-document) .quick-actions,
  body:has(.invoice-document.print-document) #invoiceUpdateForm,
  body:has(.invoice-document.print-document) #invoiceDetailsMessage,
  body:has(.invoice-document.print-document) .card:not(.print-document) {
    display: none !important;
    visibility: hidden !important;
  }

  body.invoice-print-mode .layout,
  body.invoice-print-mode .content,
  body.invoice-print-mode .main,
  body.invoice-print-mode .main-content,
  body.invoice-print-mode main,
  body:has(.invoice-document.print-document) .layout,
  body:has(.invoice-document.print-document) .content,
  body:has(.invoice-document.print-document) .main,
  body:has(.invoice-document.print-document) .main-content,
  body:has(.invoice-document.print-document) main {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  body.invoice-print-mode .invoice-document.print-document,
  body:has(.invoice-document.print-document) .invoice-document.print-document {
    display: block !important;
    visibility: visible !important;
    position: static !important;
    width: 100% !important;
    max-width: 7.5in !important;
    margin: 0 auto !important;
    padding: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
    background: #fff !important;
  }

  body.invoice-print-mode .invoice-document.print-document *,
  body:has(.invoice-document.print-document) .invoice-document.print-document * {
    visibility: visible !important;
  }
}

/* Final print safety net: invoice and driver packet pages must never print blank. */
@media print {
  @page {
    margin: 0.45in;
  }

  body:has(.invoice-document.print-document),
  body:has(.dispatch-packet-page) {
    background: #fff !important;
    color: #111827 !important;
    display: block !important;
    margin: 0 !important;
    overflow: visible !important;
    padding: 0 !important;
  }

  body:has(.invoice-document.print-document) *,
  body:has(.dispatch-packet-page) * {
    color: inherit !important;
    filter: none !important;
    text-shadow: none !important;
    visibility: visible !important;
  }

  body:has(.invoice-document.print-document) .sidebar,
  body:has(.invoice-document.print-document) .sidebar-controls,
  body:has(.invoice-document.print-document) .sidebar-toggle,
  body:has(.invoice-document.print-document) .page-header,
  body:has(.invoice-document.print-document) .quick-actions,
  body:has(.invoice-document.print-document) .no-print,
  body:has(.invoice-document.print-document) #invoiceUpdateForm,
  body:has(.invoice-document.print-document) #invoiceDetailsMessage,
  body:has(.dispatch-packet-page) .sidebar,
  body:has(.dispatch-packet-page) .sidebar-controls,
  body:has(.dispatch-packet-page) .sidebar-toggle,
  body:has(.dispatch-packet-page) .quick-actions,
  body:has(.dispatch-packet-page) .no-print,
  body:has(.dispatch-packet-page) .message,
  body:has(.dispatch-packet-page) form {
    display: none !important;
    visibility: hidden !important;
  }

  body:has(.invoice-document.print-document) .layout,
  body:has(.invoice-document.print-document) .content,
  body:has(.invoice-document.print-document) .main,
  body:has(.invoice-document.print-document) .main-content,
  body:has(.invoice-document.print-document) main,
  body:has(.dispatch-packet-page) .layout,
  body:has(.dispatch-packet-page) .content,
  body:has(.dispatch-packet-page) .main,
  body:has(.dispatch-packet-page) .main-content,
  body:has(.dispatch-packet-page) main {
    display: block !important;
    height: auto !important;
    margin: 0 !important;
    max-width: none !important;
    min-height: 0 !important;
    overflow: visible !important;
    padding: 0 !important;
    transform: none !important;
    width: 100% !important;
  }

  body:has(.invoice-document.print-document) .invoice-document.print-document,
  body:has(.dispatch-packet-page) .dispatch-packet-page {
    background: #fff !important;
    border: 0 !important;
    box-shadow: none !important;
    display: block !important;
    height: auto !important;
    margin: 0 auto !important;
    max-width: 7.5in !important;
    min-height: 0 !important;
    overflow: visible !important;
    padding: 0 !important;
    position: static !important;
    transform: none !important;
    width: 100% !important;
  }

  body:has(.invoice-document.print-document) .card,
  body:has(.dispatch-packet-page) .card,
  body:has(.dispatch-packet-page) .dispatch-packet-card,
  body:has(.dispatch-packet-page) .dispatch-doc-card {
    background: #fff !important;
    box-shadow: none !important;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  body:has(.dispatch-packet-page) .dispatch-doc-preview {
    max-height: none !important;
    overflow: visible !important;
  }
}

/* Explicit print mode used by dispatch-packet.js before opening the print dialog. */
@media print {
  body.driver-packet-print-mode,
  body.driver-packet-print-mode * {
    color: #111827 !important;
    filter: none !important;
    text-shadow: none !important;
    visibility: visible !important;
  }

  body.driver-packet-print-mode {
    background: #fff !important;
    display: block !important;
    margin: 0 !important;
    overflow: visible !important;
    padding: 0 !important;
  }

  body.driver-packet-print-mode .sidebar,
  body.driver-packet-print-mode .sidebar-controls,
  body.driver-packet-print-mode .sidebar-toggle,
  body.driver-packet-print-mode .quick-actions,
  body.driver-packet-print-mode .no-print,
  body.driver-packet-print-mode .message,
  body.driver-packet-print-mode form {
    display: none !important;
    visibility: hidden !important;
  }

  body.driver-packet-print-mode .layout,
  body.driver-packet-print-mode .content,
  body.driver-packet-print-mode .main,
  body.driver-packet-print-mode .main-content,
  body.driver-packet-print-mode main {
    display: block !important;
    height: auto !important;
    margin: 0 !important;
    max-width: none !important;
    min-height: 0 !important;
    overflow: visible !important;
    padding: 0 !important;
    transform: none !important;
    width: 100% !important;
  }

  body.driver-packet-print-mode .dispatch-packet-page {
    background: #fff !important;
    border: 0 !important;
    box-shadow: none !important;
    display: block !important;
    height: auto !important;
    margin: 0 auto !important;
    max-width: 7.5in !important;
    min-height: 0 !important;
    overflow: visible !important;
    padding: 0 !important;
    position: static !important;
    transform: none !important;
    width: 100% !important;
  }

  body.driver-packet-print-mode .card,
  body.driver-packet-print-mode .dispatch-packet-card,
  body.driver-packet-print-mode .dispatch-doc-card {
    background: #fff !important;
    box-shadow: none !important;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  body.driver-packet-print-mode .dispatch-doc-preview {
    max-height: none !important;
    overflow: visible !important;
  }
}
.billing-actions{display:flex;gap:12px;flex-wrap:wrap;margin-top:18px}.danger-action{background:#b91c1c!important;color:#fff!important}.billing-dialog{width:min(560px,calc(100% - 32px));border:0;border-radius:16px;padding:24px;box-shadow:0 24px 70px rgba(15,23,42,.3)}.billing-dialog::backdrop{background:rgba(15,23,42,.62)}.billing-dialog textarea{width:100%;resize:vertical}

/* Samsara ELD panel (integrations.html) */
.code-block {
  max-height: 360px;
  overflow: auto;
  padding: 12px;
  border-radius: 8px;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
}
.text-danger {
  color: #dc2626;
}
#samsaraPanel h3 {
  margin-top: 18px;
}

/* ==========================================
   SMALL-SCREEN NAVIGATION DRAWER (companyContext.js renderMobileNavBar)
   Tablets/phones: the sidebar slides in over the page instead of stacking above it,
   opened from the Menu button. Desktop is unchanged.
========================================== */

.hr-mobile-nav,
.hr-nav-backdrop {
  display: none;
}

@media (max-width: 900px) {
  .hr-mobile-nav {
    display: flex;
    gap: 8px;
    margin: 0 0 14px;
  }

  .hr-mobile-nav-btn {
    align-items: center;
    background: var(--card) !important;
    border: 1px solid var(--border) !important;
    border-radius: 10px;
    box-shadow: none !important;
    color: var(--text) !important;
    display: inline-flex;
    font-size: 14px;
    font-weight: 700;
    gap: 8px;
    min-height: 42px;
    padding: 8px 14px;
    width: auto !important;
  }

  .hr-menu-icon {
    display: inline-grid;
    gap: 3px;
  }

  .hr-menu-icon span {
    background: currentColor;
    border-radius: 2px;
    display: block;
    height: 2px;
    width: 16px;
  }

  .layout > .sidebar {
    bottom: 0;
    box-shadow: 0 0 40px rgba(15, 23, 42, .35) !important;
    height: 100vh !important;
    left: 0;
    max-height: none !important;
    max-width: none !important;
    min-width: 0 !important;
    overflow-y: auto !important;
    position: fixed !important;
    top: 0;
    transform: translateX(-105%);
    transition: transform .2s ease;
    visibility: hidden;
    width: min(300px, 86vw) !important;
    z-index: 1100;
  }

  body.hr-nav-open .layout > .sidebar {
    transform: none;
    visibility: visible;
  }

  /* Menu and Back live in the bar above; keep them out of the drawer. */
  .layout > .sidebar .sidebar-controls {
    display: none !important;
  }

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

  body.hr-nav-open .hr-nav-backdrop {
    background: rgba(15, 23, 42, .45);
    display: block;
    inset: 0;
    position: fixed;
    z-index: 1050;
  }
}

@media (max-width: 900px) and (prefers-reduced-motion: reduce) {
  .layout > .sidebar {
    transition: none;
  }
}

@media print {
  .hr-mobile-nav,
  .hr-nav-backdrop {
    display: none !important;
  }
}

/* ==========================================
   LOAD DETAILS: header + tabs (lib/loadDetailsLayout.js)
========================================== */

.load-details-page .ld-hero {
  display: grid;
  gap: 16px;
  margin-bottom: 0;
}

.load-details-page .ld-header {
  align-items: flex-start;
  display: flex;
  flex-wrap: wrap;
  gap: 16px 24px;
  justify-content: space-between;
  margin: 0;
}

.load-details-page .ld-header-main {
  display: grid;
  flex: 1 1 360px;
  gap: 6px;
  min-width: 0;
}

.load-details-page .ld-breadcrumb {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  margin: 0;
}

.load-details-page .ld-breadcrumb a {
  text-decoration: none;
}

.load-details-page .ld-title-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.load-details-page .ld-title-row h1 {
  font-size: 28px;
  line-height: 1.15;
  margin: 0;
}

.load-details-page .ld-status-pill {
  background: #e0edff;
  border-radius: 999px;
  color: #0b4a8a;
  font-size: 13px;
  font-weight: 700;
  padding: 4px 12px;
  text-transform: capitalize;
}

.load-details-page .ld-status-pill:empty {
  display: none;
}

.load-details-page .ld-status-pill[data-stage="done"] {
  background: #dcfce7;
  color: #166534;
}

.load-details-page .ld-status-pill[data-stage="cancelled"] {
  background: #fee2e2;
  color: #991b1b;
}

.load-details-page .ld-lane {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
}

.load-details-page .ld-meta {
  color: #475569;
  display: flex;
  flex-wrap: wrap;
  font-size: 14px;
  gap: 6px 20px;
  margin: 0;
}

.load-details-page .ld-meta strong {
  color: var(--text);
  margin-right: 4px;
}

.load-details-page .ld-header-actions {
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.load-details-page .ld-menu-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  margin: 6px 8px 2px;
  text-transform: uppercase;
}

.load-details-page .ld-hero .load-workflow-panel {
  border-top: 1px solid var(--border);
  display: grid !important;
  gap: 14px;
  grid-template-columns: minmax(0, 1fr) !important;
  margin: 0;
  padding-top: 14px;
}

@media (min-width: 761px) {
  .load-details-page .ld-hero .load-workflow-bar {
    grid-template-columns: repeat(8, minmax(0, 1fr)) !important;
    overflow: visible !important;
    padding-bottom: 0 !important;
    width: 100%;
  }
}

.load-details-page .ld-hero .load-next-action {
  width: 100%;
}

/* Each step: check circle above its name, so names never break mid-word. */
.load-details-page .ld-hero .load-workflow-step {
  align-items: center;
  flex-direction: column;
  gap: 6px;
  justify-content: flex-start;
  padding: 10px 4px;
  text-align: center;
}

.load-details-page .ld-hero .load-workflow-step strong {
  font-size: 12px;
  line-height: 1.2;
  overflow-wrap: normal;
  word-break: normal;
}

/* Menu entries are plain rows, not the header's button style. */
.load-details-page .ld-more-actions .action-menu-item {
  background: transparent !important;
  border: 0 !important;
  border-radius: 8px !important;
  box-shadow: none !important;
  color: #172033 !important;
  font-size: 14px;
  font-weight: 600;
  justify-content: flex-start !important;
  min-height: 38px;
  min-width: 0 !important;
  padding: 8px 10px !important;
  text-align: left;
  width: 100% !important;
}

.load-details-page .ld-more-actions .action-menu-item:hover,
.load-details-page .ld-more-actions .action-menu-item:focus-visible {
  background: #f1f5fb !important;
}

body.theme-dark.load-details-page .ld-more-actions .action-menu-item {
  color: #e2e8f0 !important;
}

body.theme-dark.load-details-page .ld-more-actions .action-menu-item:hover,
body.theme-dark.load-details-page .ld-more-actions .action-menu-item:focus-visible {
  background: rgba(148, 163, 184, .14) !important;
}

.load-details-page .ld-hero #trackingLinkMessage:empty {
  display: none;
}

.load-details-page .ld-tab-count {
  background: #e8eef5;
  border-radius: 999px;
  color: #475569;
  font-size: 12px;
  min-width: 20px;
  padding: 1px 7px;
  text-align: center;
}

.load-details-page .ld-tab-panel {
  display: grid;
  gap: 18px;
}

.load-details-page .ld-tab-panel[hidden],
.load-details-page .ld-tab-panel [hidden] {
  display: none !important;
}

.load-details-page .ld-tab-panel > .card {
  margin: 0 !important;
}

.load-details-page .ld-activity-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.load-details-page .ld-activity-actions .is-active {
  border-color: var(--primary) !important;
  color: #0467b8 !important;
}

.load-details-page .ld-gate {
  align-items: center;
  background: #f1f7ff;
  border: 1px solid #cfe3fb;
  border-radius: 12px;
  color: #0b3b66;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  padding: 14px 16px;
}

.load-details-page .ld-gate p {
  margin: 0;
}

body.theme-dark.load-details-page .ld-gate {
  background: rgba(59, 130, 246, .12);
  border-color: rgba(96, 165, 250, .35);
  color: #dbeafe;
}

body.theme-dark.load-details-page .ld-tab-count {
  background: rgba(148, 163, 184, .18);
  color: #cbd5e1;
}

@media (max-width: 760px) {
  .load-details-page .ld-title-row h1 {
    font-size: 24px;
  }

  /* Edit, More Actions and Messages share one row. */
  .load-details-page .ld-header-actions {
    display: grid !important;
    gap: 8px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
  }

  .load-details-page .ld-header-actions > .view,
  .load-details-page .ld-header-actions > .action-menu,
  .load-details-page .ld-header-actions > .action-menu > summary {
    font-size: 13px;
    justify-content: center;
    min-width: 0 !important;
    padding-left: 6px !important;
    padding-right: 6px !important;
    white-space: nowrap;
    width: 100% !important;
  }

  .load-details-page .ld-header-actions > .action-menu > summary::after {
    display: none;
  }

  .load-details-page .ld-hero .load-workflow-bar {
    grid-template-columns: repeat(8, minmax(92px, 1fr)) !important;
  }

  .load-details-page .ld-hero .load-workflow-step strong {
    overflow-wrap: normal;
    word-break: normal;
  }
}

@media print {
  .load-details-page .ld-sticky-strip,
  .load-details-page .ld-header-actions,
  .load-details-page .ld-activity-actions,
  .load-details-page .ld-gate {
    display: none !important;
  }
}

/* ==========================================
   PAGE QUICK NAV
   Sticky in-page jump links for long admin/ops
   dashboards (Platform Admin, Launch Readiness).
========================================== */

.page-quicknav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
  position: sticky;
  top: 12px;
  z-index: 5;
}

.page-quicknav a {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 7px 16px;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}

.page-quicknav a:hover,
.page-quicknav a:focus-visible {
  border-color: var(--primary);
  color: var(--primary);
}

body.theme-dark .page-quicknav a {
  background: var(--card);
  color: var(--muted);
}

body.theme-dark .page-quicknav a:hover,
body.theme-dark .page-quicknav a:focus-visible {
  color: var(--primary);
}

@media (max-width: 720px) {
  .page-quicknav {
    position: static;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
  }
}

/* ==========================================
   PLATFORM ADMIN — TABBED LAYOUT
   Scoped to platform-admin.html: splits the
   page into Companies / Billing / Support /
   Users tabs instead of one long scroll.
========================================== */

.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 24px;
  padding: 6px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 12px;
  z-index: 5;
}

.admin-tab-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}

.admin-tab-btn:hover {
  color: var(--primary);
}

.admin-tab-btn.active {
  background: var(--primary);
  color: #fff;
}

.admin-tab-panel[hidden] {
  display: none;
}

.admin-stack {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

@media (max-width: 720px) {
  .admin-tabs {
    position: static;
    overflow-x: auto;
    flex-wrap: nowrap;
  }
}

body.theme-dark .admin-tab-btn {
  color: var(--muted);
}

body.theme-dark .admin-tab-btn.active {
  color: #fff;
}

/* ==========================================
   SUBSCRIPTIONS TABLE — sticky Actions column
   The Billing table has 10 columns and needs
   horizontal scroll on most screens; keep the
   Save button reachable without scrolling.
========================================== */

.table-scroll-hint {
  color: var(--muted);
  font-size: 0.85rem;
  margin: -4px 0 12px;
}

.table-scroll {
  overflow-x: auto;
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.subscriptions-table {
  min-width: 1080px;
  /* The shared `table` rule sets overflow: hidden for rounded corners,
     but that makes the table itself (not .table-scroll) the sticky
     containing block, breaking the sticky Actions column below. Move
     the rounding/shadow to the wrapper instead and let the table
     overflow normally so sticky resolves against .table-scroll. */
  overflow: visible;
  border-radius: 0;
  box-shadow: none;
}

.subscriptions-table th:last-child,
.subscriptions-table td:last-child {
  position: sticky;
  right: 0;
  /* Needs a genuinely opaque background, not `inherit`: table rows here
     have no default background-color in light mode (only :hover sets
     one), so `inherit` resolved to transparent and the Billing column's
     content showed through underneath the Save button while scrolling. */
  background: #fff;
  box-shadow: -8px 0 12px -8px rgba(15, 23, 42, 0.18);
}

.subscriptions-table thead th:last-child {
  background: #f8fafc;
}

body.theme-dark .subscriptions-table td:last-child {
  background: #111827;
}

body.theme-dark .subscriptions-table thead th:last-child {
  background: #1e293b;
}

@media (min-width: 1300px) {
  .table-scroll-hint {
    display: none;
  }
}

/* Load details, simple-mode dispatchers: stacked action card with normal-sized buttons. */
.load-details-page .load-next-action.calm-action {
  display: block;
}
.load-details-page .calm-action .quick-load-assignment {
  margin-top: 12px;
  max-width: 560px;
}
.load-details-page .calm-action .load-next-action-buttons {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-start;
  margin-top: 14px;
}
.load-details-page .calm-action .load-next-action-buttons .view {
  align-self: auto;
  flex: 0 0 auto;
  height: auto;
  min-height: 40px;
  width: auto;
}
.load-details-page .calm-action .load-next-action-buttons .view:disabled {
  cursor: not-allowed;
  opacity: .5;
}
.load-details-page .calm-action .calm-dispatch-hint {
  margin: 8px 0 0;
}
.load-details-page .calm-action [data-readiness-note][data-warn] {
  background: #fffbeb;
  border-radius: 8px;
  color: #92400e;
  font-size: 13px;
  margin: 6px 0 0;
  padding: 8px 10px;
}

/* Load details, simple-mode brokers: agreed carrier rate sits with the carrier picker. */
.load-details-page .calm-action .quick-driver-row input[type="number"] {
  max-width: 220px;
}

/* Dispo mark: sits beside every Dispo suggestion. */
.dispo-label {
  align-items: center;
  display: flex;
  gap: 6px;
}
.dispo-mark {
  color: #0b61c4;
  flex: 0 0 auto;
}

/* Dispo carrier suggestions on the Cover it card. */
.dispo-suggest {
  margin: 4px 0 12px;
}
.dispo-suggest-title {
  align-items: center;
  color: #0b61c4;
  display: flex;
  font-size: 13px;
  font-weight: 700;
  gap: 6px;
  margin: 0 0 8px;
}
.dispo-suggest-list {
  display: grid;
  gap: 8px;
}
.dispo-chip {
  background: #f4f8ff;
  border: 1px solid #c9dcf7;
  border-radius: 10px;
  color: #0b2a4a;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  font: inherit;
  gap: 2px;
  padding: 10px 12px;
  text-align: left;
}
.dispo-chip:hover {
  border-color: #0b61c4;
}
.dispo-chip:focus-visible {
  outline: 3px solid #0b2a4a;
  outline-offset: 2px;
}
.dispo-chip.selected {
  background: #e3efff;
  border-color: #0b61c4;
  box-shadow: inset 0 0 0 1px #0b61c4;
}
.dispo-chip span {
  font-size: 13px;
  opacity: .85;
}
.dispo-chip .dispo-warn {
  color: #92400e;
  opacity: 1;
}

/* Sidebar top: logo, company chip, small Hide/Back row, quiet Dispo row, then the menu. */
.sidebar { display: flex; flex-direction: column; }
.sidebar > * { order: 10; flex-shrink: 0; }
.sidebar > .logo, .sidebar > h2.logo { order: 0; }
.sidebar > .company-switcher { order: 1; }
.sidebar > .sidebar-controls { order: 2; }
.sidebar > .dispo-badge { order: 3; }

.company-switcher { margin: 0 0 12px; padding: 0; border: 0; background: none; }
.company-switcher label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.company-switcher select {
  min-height: 40px; border-radius: 8px; border: 1px solid rgba(98, 185, 255, .22);
  background: rgba(255, 255, 255, .05); font-size: 14px; font-weight: 700; padding: 8px 10px;
}

.sidebar-controls { grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 12px; }
.sidebar-control-btn {
  min-height: 32px; padding: 6px 10px; font-size: 12px; font-weight: 700; text-align: center;
  background: transparent; border-color: rgba(148, 163, 184, .22); color: #c9d8ea;
}
.sidebar-back-btn { background: transparent; }
.sidebar-control-btn:hover, .sidebar-back-btn:hover { background: rgba(7, 136, 232, .18); color: #fff; }

.dispo-badge {
  margin: 0 0 14px; padding: 8px 10px; border-radius: 8px; background: none;
  border-bottom: 1px solid rgba(148, 163, 184, .14); border-radius: 0; padding-left: 4px;
  color: #7fb8f5; font-size: 13px; font-weight: 700;
}
.dispo-badge small { display: none; }
body.sidebar-collapsed .dispo-badge { display: none; }
body.sidebar-collapsed .sidebar-controls { grid-template-columns: 1fr; }

/* Company picker: readable list (the open list uses the select's own background), grouped, searchable. */
.company-switcher select, .company-switcher select option, .company-switcher select optgroup {
  background-color: #07101f; color: #f8fbff;
}
.company-switcher select optgroup { color: #8fa7c4; font-style: normal; font-weight: 800; }
.company-switcher select option { color: #f8fbff; font-weight: 600; }
.company-switcher-search {
  width: 100%; min-height: 34px; margin: 0 0 8px; padding: 6px 10px; box-sizing: border-box;
  border: 1px solid rgba(98, 185, 255, .22); border-radius: 8px;
  background: #07101f; color: #f8fbff; font-size: 13px;
}
.company-switcher-search::placeholder { color: #8fa7c4; }

/* Dashboard top: name of the person, then company with its type and role. */
.content #accountNameLink {
  display: inline-flex !important; align-items: center; gap: 8px;
  margin: 0 0 10px !important; padding: 5px 12px 5px 6px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--card);
  color: var(--muted) !important; font-size: 12.5px !important; font-weight: 600 !important;
  text-decoration: none; box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}
.content #accountNameLink::before {
  content: ""; width: 18px; height: 18px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #62b9ff);
}
.content #accountNameLink:hover { border-color: var(--primary); color: var(--text) !important; }
.content .page-header h1 { margin: 0 0 6px; letter-spacing: -.01em; }
.dash-company { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; }
.dash-company-name { font-size: 17px; font-weight: 700; color: var(--text); }
.dash-chip {
  display: inline-flex; align-items: center; min-height: 24px; padding: 2px 10px;
  border-radius: 999px; background: rgba(7, 136, 232, .12); color: #046bb8;
  border: 1px solid rgba(7, 136, 232, .28); font-size: 12px; font-weight: 700;
}
.dash-chip.subtle { background: transparent; color: var(--muted); border-color: var(--border); font-weight: 600; }
.owner-header-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.margin-period { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.margin-period select { min-height: 34px; padding: 4px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--card); color: var(--text); font-weight: 600; }


/* Dashboard: signed-in chip sits top right; the page title carries the brand colour. */
.content { position: relative; }
.content:has(#accountNameLink) { padding-top: 52px; }
.content #accountNameLink {
  position: absolute; top: 12px; right: 28px; margin: 0 !important; z-index: 2;
}
.content .page-header h1 {
  font-size: clamp(26px, 2.6vw, 34px); font-weight: 800; letter-spacing: -.02em;
  background: linear-gradient(90deg, var(--text) 0%, var(--primary) 70%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  padding-bottom: 8px; position: relative; display: inline-block;
}
.content .page-header h1::after {
  content: ""; position: absolute; left: 0; bottom: 0; width: 56px; height: 4px;
  border-radius: 4px; background: var(--primary);
}
@media (max-width: 900px) {
  .content #accountNameLink { position: static; margin: 0 0 10px !important; }
  .content:has(#accountNameLink) { padding-top: 32px; }
}

/* Dashboard title: one solid colour, the same navy as the sidebar. */
.content .page-header h1 {
  background: none; -webkit-background-clip: border-box; background-clip: border-box;
  -webkit-text-fill-color: #061426; color: #061426;
}
body.theme-dark .content .page-header h1 { -webkit-text-fill-color: var(--text); color: var(--text); }
.content .page-header h1 { margin-bottom: 10px; }

/* Load progress: one bar per stage, grey = not started, navy = completed. */
.load-details-page .load-progress-bars {
  display: grid; gap: 10px; grid-template-columns: repeat(8, minmax(0, 1fr)); width: 100%;
}
.lp-step { display: grid; gap: 8px; min-width: 0; }
.lp-bar { display: block; height: 8px; border-radius: 999px; background: #d3dae3; transition: background-color .2s ease; }
.lp-step.done .lp-bar { background: var(--primary, #0788e8); }
.lp-step strong { font-size: 12px; line-height: 1.2; font-weight: 600; color: var(--muted); }
.lp-step.done strong { color: #061426; font-weight: 700; }
.lp-step.current strong { color: #061426; font-weight: 700; text-decoration: underline; text-decoration-color: var(--primary, #0788e8); text-underline-offset: 4px; }
body.theme-dark .lp-bar { background: #3b4a5e; }
body.theme-dark .lp-step.done .lp-bar { background: #62b9ff; }
body.theme-dark .lp-step.done strong, body.theme-dark .lp-step.current strong { color: var(--text); }
@media (max-width: 760px) {
  .load-details-page .load-progress-bars { grid-template-columns: repeat(4, minmax(0, 1fr)); row-gap: 14px; }
}
/* Carrier row actions: Edit plus a tidy More menu. */
.carrier-actions { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; }
.carrier-menu { position: relative; display: inline-block; }
.carrier-menu > summary { list-style: none; cursor: pointer; }
.carrier-menu > summary::-webkit-details-marker { display: none; }
.carrier-menu > summary::after { content: ""; display: inline-block; margin-left: 8px; width: 6px; height: 6px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-2px) rotate(45deg); }
.carrier-menu[open] > summary::after { transform: translateY(1px) rotate(-135deg); }
.carrier-menu-panel {
  position: fixed; z-index: 400; width: 290px; padding: 8px;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow);
  text-align: left; white-space: normal;
}
.carrier-menu-label { margin: 6px 8px 4px; font-size: 11px; font-weight: 700; letter-spacing: .04em; color: var(--muted); text-transform: uppercase; }
.carrier-menu-panel hr { border: 0; border-top: 1px solid var(--border); margin: 8px 0; }
.carrier-menu-panel .carrier-menu-item {
  display: grid !important; gap: 2px; justify-items: start; align-content: start; height: auto; min-height: 0; width: 100%; margin: 0; padding: 9px 10px; text-align: left;
  background: transparent; border: 0; border-radius: 8px; color: var(--text); font: inherit; cursor: pointer;
}
.carrier-menu-item:hover:not(:disabled), .carrier-menu-item:focus-visible { background: rgba(7, 136, 232, .09); outline: none; }
.carrier-menu-item:disabled { opacity: .55; cursor: progress; }
.carrier-menu-item strong { display: block; font-size: 14px; font-weight: 700; }
.carrier-menu-item small { display: block; font-size: 12px; line-height: 1.35; color: var(--muted); font-weight: 500; }
.carrier-menu-item.is-note { cursor: default; opacity: .8; }
.carrier-menu-item.is-danger strong { color: #b42318; }
.carrier-menu-item.is-danger:hover:not(:disabled), .carrier-menu-item.is-danger:focus-visible { background: rgba(220, 38, 38, .08); }
.carrier-menu-panel .carrier-menu-item, .carrier-menu-panel .carrier-menu-item strong, .carrier-menu-panel .carrier-menu-item small { white-space: normal; overflow-wrap: anywhere; text-align: left; }
.carrier-menu-panel .carrier-menu-item small { max-width: 100%; }
/* Carrier pay: readiness summary and per-carrier warnings. */
.pay-readiness { margin: 4px 0 14px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: #f8fbff; }
.pay-readiness-summary { margin: 0; }
.pay-readiness-list { margin: 8px 0 0; padding-left: 18px; display: grid; gap: 4px; }
.pay-warning { margin: 6px 0; padding: 8px 10px; border-radius: 8px; background: rgba(220, 38, 38, .08); color: #991b1b; font-weight: 600; }
.pay-warning a { color: inherit; text-decoration: underline; }
/* Preferred lanes: chips, open-load fits, and the lane finder. */
.lane-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.lane-chip { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; background: #eef3f9; border: 1px solid var(--border); color: #061426; font-size: 12px; font-weight: 600; white-space: nowrap; }
.lane-chip.lane-more { background: transparent; color: var(--muted); }
.carrier-lanes-cell { margin-top: 4px; }
.lane-fits { margin-top: 6px; font-size: 12px; }
.lane-fits > summary { cursor: pointer; color: var(--primary-hover); font-weight: 700; list-style: none; }
.lane-fits > summary::-webkit-details-marker { display: none; }
.lane-fits > summary::before { content: "\25B8\00a0"; }
.lane-fits[open] > summary::before { content: "\25BE\00a0"; }
.lane-fits ul { margin: 6px 0 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.lane-fits li { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.lane-fits li em { color: var(--muted); font-style: normal; }
.lane-finder { margin-bottom: 18px; }
.lane-finder-inputs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; max-width: 640px; margin: 8px 0 12px; }
.lane-results { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-width: 760px; }
.lane-results li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--card); }
.lane-results strong { display: block; }
@media (max-width: 640px) { .lane-finder-inputs { grid-template-columns: 1fr; } }

/* Links never turn browser-purple after a visit. Zero specificity, so any styled link keeps its own color. */
:where(a:link, a:visited) { color: var(--primary, #0788e8); }

.cost-period { height: 40px; padding: 0 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--card, #fff); color: var(--text); font-weight: 600; }
#costSummaryCard .section-header .actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* Loads table: compact customer and lane cells */
.cell-clamp { display: block; width: 150px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-clamp.cell-review { color: var(--muted); font-style: italic; }
.lane-cell { display: grid; gap: 1px; width: 170px; max-width: 220px; line-height: 1.3; }
.lane-cell > span:not(.lane-arrow) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.lane-cell .lane-arrow { color: var(--muted); font-size: 12px; }

/* Shared loads */
.card[hidden], dialog[hidden] { display: none !important; }
.shared-list { display: grid; gap: 10px; margin-top: 12px; }
.shared-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding: 12px 14px; border: 1px solid var(--border); border-left: 4px solid var(--primary); border-radius: 12px; background: var(--card, #fff); }
.shared-row > div:first-child { display: grid; gap: 2px; min-width: 0; }
.shared-row small { color: var(--muted); }
.shared-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.shared-toggle { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; color: var(--text); }
.shared-detail { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 16px; }
.shared-detail dt { color: var(--muted); font-weight: 600; }
.shared-detail dd { margin: 0; }
.shared-timeline { list-style: none; margin: 8px 0 16px; padding: 0; display: grid; gap: 8px; }
.shared-timeline li { display: grid; gap: 1px; padding-left: 12px; border-left: 3px solid var(--primary); }
.shared-timeline span { color: var(--muted); font-size: 13px; }
.shared-dialog { margin: auto; width: min(34rem, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); overflow: auto; padding: 20px 22px; border: 0; border-radius: 14px; background: var(--card, #fff); color: var(--text); box-shadow: 0 24px 60px rgba(6, 20, 38, .35); }
.shared-dialog::backdrop { background: rgba(6, 20, 38, .55); }
.shared-dialog-title { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.shared-dialog-title h2 { margin: 0; }
.shared-dialog-title button { font-size: 1.5rem; line-height: 1; background: transparent; border: 0; color: var(--muted); cursor: pointer; }
/* Network: the carrier's sharing choices and the actions it can take on a shared load */
.shared-choice { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; }
.shared-choice input { margin-top: 3px; }
.shared-choice span { display: grid; gap: 2px; }
.shared-choice small { color: var(--muted); font-size: 13px; }
.shared-settings { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.shared-panel { margin: 0 0 16px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; display: grid; gap: 10px; }
.shared-panel h3 { margin: 0; font-size: 15px; }
.shared-panel .field-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.shared-panel select, .shared-panel input[type="file"] { min-width: 12rem; }
.shared-offer { border-left-color: #f59e0b; }

/* Rate con review: a value the importer is not sure about */
.field.check-review input,
.field.check-review select,
.field.check-review textarea {
  border-color: #f59e0b;
  background: #fffbeb;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.14);
}
.field-check-note {
  display: block;
  margin-top: 4px;
  color: #92400e;
  font-size: 12px;
  line-height: 1.35;
}
.field-check-ok {
  margin-left: 4px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--blue, #0b6bcb);
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}

/* Launch Readiness: billing health */
.billing-health { margin-bottom: 20px; }
.billing-health-summary { margin: 0 0 12px; font-weight: 600; }
.billing-health-summary.fail { color: #b91c1c; }
.billing-health-summary.warn { color: #92400e; }
.billing-health-summary.pass { color: #047857; }
.billing-health-group h3 { margin: 14px 0 6px; font-size: 14px; }
.billing-health-row { display: grid; grid-template-columns: 64px 1fr; gap: 10px; align-items: start; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line, #e2e8f0); margin-bottom: 6px; }
.billing-health-row small { display: block; color: var(--muted, #64748b); margin-top: 2px; line-height: 1.4; }
.billing-health-mark { font-size: 12px; font-weight: 700; text-align: center; padding: 2px 6px; border-radius: 999px; }
.billing-health-row.pass .billing-health-mark { background: #dcfce7; color: #166534; }
.billing-health-row.warn .billing-health-mark { background: #fef3c7; color: #92400e; }
.billing-health-row.fail .billing-health-mark { background: #fee2e2; color: #991b1b; }
.billing-health-row.fail { border-color: #fecaca; }

/* Multi-stop loads: "+2 stops" tag, and the split Picked Up / Delivered bars. */
.lane-cell > span.stops-tag, .stops-tag { justify-self: start; display: inline-block; margin-top: 2px; padding: 1px 7px; border-radius: 999px; background: rgba(7, 136, 232, .1); color: #0b5fa5; font-size: 11px; font-weight: 700; white-space: nowrap; }
body.theme-dark .stops-tag { background: rgba(98, 185, 255, .16); color: #9fd2ff; }
.lp-step.lp-multi { align-content: end; }
.lp-step .lp-nums, .lp-step .lp-segs { display: grid; gap: 3px; }
.lp-step .lp-nums span { font-size: 10px; font-weight: 700; line-height: 1; color: var(--muted); text-align: center; }
.lp-step .lp-nums span.done { color: var(--primary, #0788e8); }
.lp-step .lp-seg { display: block; height: 8px; border-radius: 999px; background: #d3dae3; transition: background-color .2s ease; }
.lp-step .lp-seg.done { background: var(--primary, #0788e8); }
.lp-step .lp-seg.arrived { box-shadow: inset 0 0 0 2px var(--primary, #0788e8); }
body.theme-dark .lp-step .lp-seg { background: #3b4a5e; }
body.theme-dark .lp-step .lp-seg.done { background: #62b9ff; }
/* Load details: the stops card. */
.load-stops-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.load-stop { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--card); }
.load-stop-badge { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: #e8eef5; color: #334155; font-size: 12px; font-weight: 800; }
.load-stop.is-arrived .load-stop-badge { background: #fff; box-shadow: inset 0 0 0 2px var(--primary, #0788e8); color: var(--primary, #0788e8); }
.load-stop.is-done .load-stop-badge { background: var(--primary, #0788e8); color: #fff; }
.load-stop-main { min-width: 0; }
.load-stop-main strong { display: block; font-size: 14px; }
.load-stop-main span { display: block; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.load-stop-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.load-stop-actions .view { min-height: 32px; padding: 6px 10px; font-size: 12px; }
.load-stop-state { font-size: 12px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.load-stop.is-done .load-stop-state { color: #047857; }
@media (max-width: 640px) { .load-stop { grid-template-columns: 30px minmax(0, 1fr); } .load-stop-actions { grid-column: 2; justify-content: flex-start; } }

/* Dispatch board More menu: Remove from board / Delete load sit under a thin line. */
.load-actions-divider {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2px 0;
  width: 100%;
}

/* Load Details is one scrolling page (no tabs): a title per section and a thin strip that
   sticks to the top once the page header scrolls away. */
.load-details-page .ld-section {
  margin-top: 26px;
}

.load-details-page .ld-sticky-strip + .ld-section {
  margin-top: 18px;
}

.load-details-page .ld-section-title {
  align-items: center;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  display: flex;
  font-size: 18px;
  gap: 8px;
  margin: 0;
  padding-bottom: 8px;
}

.load-details-page .ld-sticky-strip {
  align-items: center;
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  gap: 12px;
  min-height: 46px;
  opacity: 0;
  padding: 8px 14px;
  pointer-events: none;
  position: fixed;
  top: 8px;
  transform: translateY(-6px);
  transition: opacity .15s ease, transform .15s ease;
  visibility: hidden;
  z-index: 40;
}

.load-details-page .ld-sticky-strip.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: none;
  visibility: visible;
}

/* Jumping to a section (#documents, #invoiceForm) leaves room for the strip. */
.load-details-page .ld-section,
.load-details-page .ld-section [id] {
  scroll-margin-top: 72px;
}

.load-details-page .ld-sticky-strip strong,
.load-details-page .ld-sticky-strip .ld-status-pill {
  flex-shrink: 0;
  white-space: nowrap;
}

.load-details-page .ld-sticky-strip strong {
  color: var(--text);
}

.load-details-page .ld-strip-lane {
  color: var(--muted);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  .load-details-page .ld-sticky-strip { transition: none; }
}

/* Rename a document in place (owners and admins). */
.doc-rename-form {
  align-items: center;
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 100%;
}

.doc-rename-form input {
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  font: inherit;
  min-width: 0;
  padding: 6px 10px;
  width: min(320px, 100%);
}

.doc-rename-form .view {
  min-height: 34px;
  padding: 6px 12px;
}

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

/* Dispo's morning brief on the dashboard (lib/morningBrief.js). */
.dispo-brief-card { border-left: 4px solid var(--primary); }
/* Dispo Today replaces these while it is showing (lib/morningBrief.js adds the class). */
body.has-dispo-brief .daily-command-center { display: none !important; }
body.has-dispo-brief .dashboard-command-grid { grid-template-columns: 1fr; }
body.has-dispo-brief .next-step-bar.is-steady { display: none; }
.dispatch-brief-card { margin-bottom: 16px; }
.dispo-brief-head { align-items: center; display: flex; gap: 12px; justify-content: space-between; }
.dispo-brief-head h2 { margin: 2px 0 0; }
.dispo-brief-list { display: grid; gap: 0; list-style: none; margin: 12px 0 0; padding: 0; }
.dispo-brief-list li { align-items: center; border-top: 1px solid var(--border); display: flex; gap: 14px; justify-content: space-between; padding: 12px 0; }
.dispo-brief-list li:first-child { border-top: 0; }
.dispo-brief-list strong { color: var(--text); display: block; }
.dispo-brief-list li.is-first strong::after {
  background: #eef6ff;
  border-radius: 999px;
  color: var(--primary);
  content: "Start here";
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .03em;
  margin-left: 8px;
  padding: 2px 8px;
  text-transform: uppercase;
  vertical-align: 2px;
}
body.theme-dark .dispo-brief-list li.is-first strong::after { background: rgba(7, 136, 232, .18); color: #7cc4ff; }
.dispo-brief-list small { color: var(--muted); }
.dispo-brief-list .view { flex-shrink: 0; white-space: nowrap; }
.dispo-brief-card.is-clear .dispo-brief-list { display: none; }
@media (max-width: 640px) {
  .dispo-brief-list li { align-items: flex-start; flex-direction: column; gap: 8px; }
}

/* Load Details: automatic updates to the customer (lib/customerUpdates.js). */
.customer-updates-card .stack-list { margin-top: 10px; }


/* Operational Health: matches the white dashboard cards, with HyperRoute accents
   (blue top stripe, navy "road" meter, blue route fill, glowing marker).
   Selectors are specific so the dark theme's card overrides don't flatten it. */
.content .card.command-score-card.hr-health-card {
  container-type: inline-size;
  overflow: hidden;
  position: relative;
  background:
    radial-gradient(90% 120% at 100% 0%, rgba(7, 136, 232, .07) 0%, rgba(7, 136, 232, 0) 60%),
    #fff;
}
.hr-health-card::before {
  background: linear-gradient(90deg, #0788e8, #38bdf8 60%, rgba(56, 189, 248, 0));
  content: "";
  height: 3px;
  inset: 0 0 auto 0;
  position: absolute;
}
/* Room on the right for the card's collapse arrow. */
.hr-health-head { align-items: center; display: flex; gap: 12px; justify-content: space-between; padding-right: 30px; }
.hr-health-card .section-eyebrow { margin: 0; }
.hr-health-card { --hr-band: #0788e8; --hr-band-bg: #eef6ff; }
.hr-health-card[data-band="on-track"] { --hr-band: #0f9f6a; --hr-band-bg: #e9f8f1; }
.hr-health-card[data-band="watch"] { --hr-band: #c27800; --hr-band-bg: #fff6e3; }
.hr-health-card[data-band="at-risk"] { --hr-band: #d92d2d; --hr-band-bg: #fdeeee; }
.hr-health-band {
  background: var(--hr-band-bg);
  border-radius: 999px;
  color: var(--hr-band);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  padding: 4px 10px 4px 22px;
  position: relative;
  text-transform: uppercase;
  white-space: nowrap;
}
.hr-health-band::before {
  background: currentColor;
  border-radius: 50%;
  content: "";
  height: 7px;
  left: 9px;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 7px;
}
.hr-health-body { align-items: center; display: grid; gap: 22px; grid-template-columns: auto minmax(0, 1fr); margin: 10px 0 8px; }
.content .hr-health-card h2#healthScore {
  color: #061426;
  font-size: 48px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
  line-height: 1;
  margin: 0;
}
/* The meter is a road: navy asphalt, dashed lane line, blue route fill, glowing marker at the front. */
.hr-health-card .health-meter {
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .35) 0 12px, transparent 12px 22px) center / 100% 2px no-repeat,
    #0b1d33;
  height: 12px;
  overflow: visible;
  position: relative;
}
.hr-health-card .health-meter span {
  background: linear-gradient(90deg, #045fa8 0%, #0788e8 55%, #38bdf8 100%);
  box-shadow: 0 0 10px rgba(7, 136, 232, .35);
  min-width: 14px;
  position: relative;
  transition: width .6s cubic-bezier(.2, .8, .2, 1);
}
.hr-health-card .health-meter span::after {
  background: #fff;
  border: 3px solid var(--hr-band);
  border-radius: 50%;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--hr-band) 18%, transparent), 0 0 10px color-mix(in srgb, var(--hr-band) 55%, transparent);
  content: "";
  height: 12px;
  position: absolute;
  right: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
}
.hr-health-scale { color: #8193a8; display: grid; font-size: 11px; font-weight: 600; grid-template-columns: 60fr 20fr 20fr; letter-spacing: .03em; margin-top: 7px; text-transform: uppercase; }
.hr-health-scale span { border-left: 1px solid var(--border, #e2e8f0); padding-left: 6px; white-space: nowrap; }
.hr-health-scale span:first-child { border-left: 0; padding-left: 0; }
.hr-health-card[data-band="at-risk"] .hr-health-scale span:nth-child(1),
.hr-health-card[data-band="watch"] .hr-health-scale span:nth-child(2),
.hr-health-card[data-band="on-track"] .hr-health-scale span:nth-child(3) { color: var(--hr-band); }
.hr-health-card p#healthSummary { margin: 0; }
.hr-health-items { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 12px 0 0; padding: 0; }
.hr-health-items li > * {
  background: #f4f8fc;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 999px;
  color: #0b2a4a;
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  text-decoration: none;
}
.hr-health-items li > a::after { color: var(--primary); content: " \2192"; }
.hr-health-items li > a:hover { border-color: var(--primary); }
.hr-health-items li.is-serious > * { background: #fff8eb; border-color: #f3d9a4; }
body.theme-dark .hr-health-items li > * { background: rgba(255, 255, 255, .04); border-color: #334155; color: #e2e8f0; }
body.theme-dark .hr-health-items li.is-serious > * { background: rgba(251, 191, 36, .08); border-color: rgba(251, 191, 36, .35); }
.hr-health-card .mini-stat-row { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-top: 14px; }
/* Narrow card (side by side with the Today panel, or on a phone): score above the meter. */
@container (max-width: 560px) {
  .hr-health-body { gap: 12px; grid-template-columns: 1fr; }
  .content .hr-health-card h2#healthScore { font-size: 42px; }
  .hr-health-scale { font-size: 10px; }
}
/* Very narrow (phones): the status pill already names the band, so drop the scale. */
@container (max-width: 420px) {
  .hr-health-scale { display: none; }
}
@media (prefers-reduced-motion: reduce) { .hr-health-card .health-meter span { transition: none; } }
/* Dark theme: same card colors as the rest of the dashboard. */
body.theme-dark .content .card.command-score-card.hr-health-card {
  background: radial-gradient(90% 120% at 100% 0%, rgba(7, 136, 232, .14) 0%, rgba(7, 136, 232, 0) 60%), #111827 !important;
}
body.theme-dark .content .hr-health-card h2#healthScore { color: #f8fafc; }
body.theme-dark .hr-health-card .health-meter { box-shadow: inset 0 0 0 1px #1d3b5f; }
body.theme-dark .hr-health-card .hr-health-scale span { border-left-color: #334155; }
body.theme-dark .hr-health-card .hr-health-scale span:first-child { border-left: 0; }
body.theme-dark .hr-health-card .hr-health-band { background: color-mix(in srgb, var(--hr-band) 16%, transparent); }
body.theme-dark .content .hr-health-card .hr-health-band { color: color-mix(in srgb, var(--hr-band) 70%, #fff) !important; }
body.theme-dark .content .hr-health-card[data-band="at-risk"] .hr-health-scale span:nth-child(1),
body.theme-dark .content .hr-health-card[data-band="watch"] .hr-health-scale span:nth-child(2),
body.theme-dark .content .hr-health-card[data-band="on-track"] .hr-health-scale span:nth-child(3) { color: color-mix(in srgb, var(--hr-band) 70%, #fff) !important; }

/* Setup mode (a company with no loads yet): blue "Getting started" band, no score scale, and the
   "What Needs Action Next" list is hidden (nothing is running yet). See renderHealthSetup. */
.hr-health-card[data-band="start"] { --hr-band: #0788e8; --hr-band-bg: #eef6ff; }
.hr-health-card[data-band="start"] .hr-health-scale { display: none; }
body.theme-dark .content .hr-health-card[data-band="start"] .hr-health-band { color: #7cc4ff !important; }
body.hr-setup-mode .daily-command-center { display: none !important; }
/* The Today panel would repeat the same next step; the health card is the setup checklist. */
body.hr-setup-mode .dashboard-command-grid .command-panel { display: none; }
body.hr-setup-mode .dashboard-command-grid { grid-template-columns: 1fr; }

/* Load Details: actual miles from Samsara (renderEldMiles). */
.eld-miles-box { background: var(--card); border: 1px solid var(--border); border-left: 4px solid var(--primary); border-radius: 10px; margin: 12px 0; padding: 12px 14px; }
.eld-miles-box p { margin: 6px 0 0; }
.eld-miles-head { align-items: center; display: flex; gap: 10px; justify-content: space-between; }
.eld-miles-box .view { margin-top: 10px; }
.eld-miles-message:empty { display: none; }
.compliance-ifta-eld-note { background: var(--bg); border-radius: 8px; padding: 8px 10px; }
.compliance-ifta-not-counted { color: var(--muted, #64748b); }
.fmcsa-row-actions { white-space: nowrap; }
.fmcsa-row-actions .view + .view { margin-left: 6px; }

/* Import Data page */
.import-type-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-top: 12px; }
.import-type-card { border: 1px solid var(--border); border-radius: 10px; cursor: pointer; display: grid; gap: 4px; padding: 14px 16px; position: relative; }
.import-type-card input { position: absolute; opacity: 0; pointer-events: none; }
.import-type-card span { color: var(--muted); font-size: 14px; }
.import-type-card:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(7, 136, 232, .18); }
.import-type-card:has(input:focus-visible) { outline: 3px solid var(--primary); outline-offset: 2px; }
.import-file-row { align-items: center; display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.import-file-button { cursor: pointer; }
.import-paste-label { display: block; font-weight: 600; margin: 8px 0 6px; }
#importPaste { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; width: 100%; }
.import-match-grid { display: grid; gap: 10px 18px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); margin-top: 12px; }
.import-match-row { display: grid; gap: 4px; }
.import-match-field { font-weight: 600; }
.import-required { color: var(--danger); font-size: 12px; font-weight: 700; margin-left: 4px; text-transform: uppercase; }
.import-summary p { margin: 4px 0; }
.import-preview-wrap { max-height: 420px; overflow: auto; margin-top: 12px; }
.import-preview td { vertical-align: top; }
.import-result { border: 1px solid var(--border); border-left: 4px solid var(--success); border-radius: 10px; margin-top: 14px; padding: 12px 14px; }
.import-skipped { margin: 10px 0 0; padding-left: 18px; }
.import-match-tip { background: var(--bg); border-radius: 8px; padding: 8px 10px; }
.import-faq details { border-top: 1px solid var(--border); padding: 10px 0; }
.import-faq details:first-of-type { border-top: 0; }
.import-faq summary { cursor: pointer; font-weight: 600; }
.import-faq details p { margin: 8px 0 0; }


/* Loads list: fit the whole row on screen (no sideways scrolling on laptops). On phones the row
   scrolls sideways and Open Load / More stay pinned on the right. */
.loads-list-table th, .loads-list-table td { padding-left: 10px !important; padding-right: 10px !important; }
@media (max-width: 1400px) { .loads-list-table th, .loads-list-table td { padding-left: 7px !important; padding-right: 7px !important; } }
.loads-list-table .loads-dates { display: grid; gap: 2px; white-space: nowrap; }
.loads-list-table .loads-dates-del { color: var(--muted, #64748b); font-size: 0.92em; }
.loads-list-table .lane-cell { width: 140px; max-width: 140px; }
.loads-table-wrap .loads-list-table th:nth-child(3), .loads-table-wrap .loads-list-table td:nth-child(3) { min-width: 0 !important; width: 140px !important; max-width: 150px; }
/* Long load numbers wrap instead of widening the table. */
.loads-table-wrap .loads-list-table td:first-child { min-width: 92px; max-width: 130px; white-space: normal; overflow-wrap: normal; word-break: normal; }
.loads-table-wrap .loads-list-table td:nth-child(2) { max-width: 130px; }
.loads-table-wrap .loads-list-table td { vertical-align: middle; }
.loads-table-wrap .loads-list-table th:last-child,
.loads-table-wrap .loads-list-table td:last-child { min-width: 168px !important; width: 168px !important; text-align: left; }
.loads-table-wrap .loads-list-table .load-row-actions {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important; gap: 6px !important; min-width: 0 !important;
}
.loads-table-wrap .loads-list-table .load-row-actions > .view,
.loads-table-wrap .loads-list-table .load-actions-menu summary {
  min-height: 40px !important; padding: 8px 6px !important; font-size: 13px !important; white-space: nowrap;
}
.loads-list-table .customer-link-action { min-width: 0 !important; padding: 8px 10px !important; white-space: nowrap; }
.loads-table-wrap .loads-list-table { overflow: visible !important; }
@media (max-width: 900px) {
  .loads-table-wrap .loads-list-table { display: table !important; width: max-content !important; min-width: 100% !important; max-width: none !important; }
}
@media (max-width: 1400px) {
  .loads-table-wrap .loads-list-table th:last-child,
  .loads-table-wrap .loads-list-table td:last-child {
    position: sticky; right: 0; z-index: 2; background: var(--card, #ffffff);
    box-shadow: -8px 0 12px -10px rgba(15, 23, 42, 0.35);
  }
  body.theme-dark .loads-table-wrap .loads-list-table td:last-child,
  body.theme-dark .loads-table-wrap .loads-list-table th:last-child { background: var(--card, #111827); }
  .loads-table-wrap .loads-list-table thead th:last-child { z-index: 3; }
}
.loads-list-table td:nth-child(2) .cell-clamp { width: auto; max-width: 115px; }
.loads-list-table td:nth-child(6) .cell-clamp { width: auto; max-width: 80px; }

/* Invoice email: "Attach to the PDF" checklist. The generic .field input rule made each checkbox
   full width on its own line above its label. */
#packetDocumentList label { display: flex; align-items: center; gap: 10px; margin: 0; padding: 6px 0; font-weight: 500; color: #0b1220; cursor: pointer; }
#packetDocumentList input[type="checkbox"] { width: 18px; height: 18px; padding: 0; margin: 0; flex: 0 0 auto; accent-color: #0a84ff; }
fieldset.field:has(#packetDocumentList) { border: 1px solid var(--border); border-radius: 10px; padding: 10px 16px 8px; }
fieldset.field:has(#packetDocumentList) legend { padding: 0 6px; font-size: 14px; font-weight: 600; color: #475569; }

/* ==========================================
   READABLE TEXT EVERYWHERE (contrast check of every page, Nov 24 2026)
   Every line of text should stand out from what is behind it, in light and dark mode.
========================================== */

/* Disabled buttons: grey with dark text instead of a faded blue that white letters disappear into. */
:is(.btn, .view, .delete, #flSearch):disabled {
  opacity: 1 !important;
  background: #e2e8f0 !important;
  background-image: none !important;
  border-color: #cbd5e1 !important;
  color: #475569 !important;
  box-shadow: none !important;
}
body.theme-dark :is(.btn, .view, .delete, #flSearch):disabled {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #94a3b8 !important;
}

/* Light mode: two light colours on white. */
.message { color: #047857; }
.tracking-card .tracking-kicker { color: #0369a1; }

/* Dark mode: secondary buttons stayed white while their text turned white. */
body.theme-dark :is(.secondary-action, .view.secondary-action, summary.view.secondary-action, .training-tabs button, .tour-type-switch button) {
  background: #1e293b;
  background-image: none;
  border-color: #475569;
  color: #f8fafc;
}
body.theme-dark :is(.secondary-action, .view.secondary-action, .training-tabs button, .tour-type-switch button):hover {
  background: #273449;
  color: #ffffff;
}
body.theme-dark :is(.training-tabs button, .tour-type-switch button):is(.active, [aria-pressed="true"], [aria-selected="true"]) {
  background: #0788e8;
  border-color: #0788e8;
  color: #ffffff;
}

/* Dark mode: cards and panels that kept a white or near-white background. */
body.theme-dark :is(
  .onboarding-item, .quick-start-card, .walkthrough-step, .launch-phase-card, .metric-card,
  .usage-limit-card, .subscription-plan, .status-row, .launch-revenue-card, .demo-meeting-step,
  .demo-runbook-card, .demo-script-box, .demo-center-score, .rate-con-check, .role-access-item,
  .role-access-grid article, .audit-summary-card, .audit-finding, .invoice-hero, .load-workflow-step,
  .assignment-estimate-panel, .document-dropzone, .visibility-alert-card, .qa-checklist-item,
  .rate-confirmation-terms, .rate-confirmation-grid div, .login-card, .command-action-card,
  .document-notes, .document-info-grid div, .invoice-line-items div, .readiness-next,
  .readiness-mini-grid div, .demo-readiness-grid div, .demo-runbook-grid div, .dispatch-meta div,
  .settlement-load-list, .rate-con-attachment-notice, .rate-con-upload-zone, .tour-topbar,
  .details-card p, #truckSummaryRow, .onboarding-next, .invoice-line-total
) {
  background: #111827;
  background-image: none;
  color: #e2e8f0;
}
body.theme-dark :is(.document-logo-box span, .document-title-block small, .load-workflow-step span) {
  background: #1e293b;
  color: #e2e8f0;
}

/* Dark mode: small status pills keep their colour as a tint with light text. */
body.theme-dark :is(.readiness-dot.pass, .readiness-status.pass, .usage-limit-status, .walkthrough-step.complete span) {
  background: rgba(34, 197, 94, .2);
  color: #bbf7d0;
}
body.theme-dark :is(.readiness-dot.warning, .readiness-status.warning, .walkthrough-step.attention span, .rate-con-check.warning span) {
  background: rgba(245, 158, 11, .22);
  color: #fde68a;
}
body.theme-dark :is(.readiness-dot.blocker, .readiness-status.blocker, .rate-con-check.danger span) {
  background: rgba(239, 68, 68, .22);
  color: #fecaca;
}
body.theme-dark .plan-badge {
  background: rgba(59, 130, 246, .22);
  color: #bfdbfe;
}

/* Dark mode: dark grey text on dark cards. */
body.theme-dark :is(.help-card li, .help-card p, .help-card ol, #invoiceSendForm legend, #invoiceSendForm label, .collapsible-card-header summary, form summary) {
  color: #e2e8f0;
}
body.theme-dark .button-tour-primary { color: #ffffff; }

/* Dark mode: status messages that pages colour in code. */
body.theme-dark .message[style*="rgb(185, 28, 28)"],
body.theme-dark .message[style*="rgb(220, 38, 38)"] { color: #fca5a5 !important; }
body.theme-dark .message[style*="rgb(4, 120, 87)"],
body.theme-dark .message[style*="rgb(6, 95, 70)"] { color: #6ee7b7 !important; }
body.theme-dark .message[style*="rgb(51, 65, 85)"],
body.theme-dark .message[style*="rgb(71, 85, 105)"] { color: #cbd5e1 !important; }
body.theme-dark .message[style*="rgb(180, 83, 9)"] { color: #fcd34d !important; }
body.theme-dark .message { color: #6ee7b7; }
body.theme-dark .invoice-line-items .invoice-line-total { background: #1e293b !important; color: #f8fafc; }
body.theme-dark :is(.subscription-plan li, .onboarding-item span:not([class]), .dispatch-meta dd, .dispatch-meta dt) { color: #e2e8f0; }
body.theme-dark :is(.message-thread, .admin-message-thread) { background: #0f172a; }
body.theme-dark a.button-tour-primary, body.theme-dark #tourSignupLink { color: #ffffff !important; }

/* ---- Page buttons (lib/pageActions.js) and Drivers "Add a driver" (Nov 25 2026) ---- */
.page-header .hr-more-actions { position: relative; }
.page-header .hr-more-actions[hidden] { display: none; }
.page-header .action-menu-panel .action-menu-item.view,
.page-header .action-menu-panel a.action-menu-item,
.page-header .action-menu-panel button.action-menu-item {
  min-height: 0; box-shadow: none; transform: none; background: transparent; color: #172033;
  border: 0; font-weight: 600; justify-content: flex-start; white-space: normal;
}
.page-header .action-menu-panel .action-menu-item:hover,
.page-header .action-menu-panel .action-menu-item:focus-visible { background: #eef4fb; color: #0b4f8a; outline: none; }
.page-header .action-menu-panel .action-menu-item[hidden] { display: none; }
.hr-add-driver { position: relative; }
.hr-add-driver > summary.view { list-style: none; }
.hr-add-driver-panel { min-width: 300px; }
.hr-add-driver-panel .action-menu-item { display: grid !important; gap: 2px; justify-items: start; text-align: left !important; }
.hr-add-driver-panel .action-menu-item strong { font-size: 14.5px; color: #0b1220; }
.hr-add-driver-panel .action-menu-item span { font-size: 13px; font-weight: 500; color: #475569; line-height: 1.4; }
.page-header .hr-waiting { background: #fff7e6 !important; color: #8a4b00 !important; border: 1px solid #f5c26b !important; box-shadow: none !important; }
.page-header .hr-waiting:hover { background: #ffefcc !important; }
.hr-join-steps ol { margin: 0 0 14px; padding-left: 22px; display: grid; gap: 8px; color: #1e293b; line-height: 1.5; }
.hr-join-steps .hr-join-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.hr-join-steps .section-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
body.theme-dark .page-header .action-menu-panel .action-menu-item { color: #e2e8f0; }
body.theme-dark .page-header .action-menu-panel .action-menu-item:hover { background: #1e293b; color: #fff; }
body.theme-dark .hr-add-driver-panel .action-menu-item strong { color: #f8fafc; }
body.theme-dark .hr-add-driver-panel .action-menu-item span { color: #cbd5e1; }
body.theme-dark .hr-join-steps ol { color: #e2e8f0; }
@media (max-width: 640px) { .hr-add-driver-panel { min-width: 0; width: calc(100vw - 40px); left: 0; right: auto; } }

/* Plan limits (Nov 25 2026): calm, never alarming. Near a limit is a blue heads-up; at the limit
   is amber with the next plan and one Upgrade button. Nothing already added stops working. */
.plan-limit-warning.is-near { background: #f5faff; border-color: #cfe0f1; border-left-color: #0788e8; color: #0b3b66; }
.plan-limit-warning.is-over { background: #fff8eb; border-color: #f5d08a; border-left-color: #d97706; color: #5b3a06; }
.plan-limit-warning { grid-template-columns: 1fr auto; }
.plan-limit-warning strong { grid-column: 1; }
.plan-limit-warning span { grid-column: 1; font-size: 13.5px; }
.plan-limit-warning a { grid-column: 2; grid-row: 1 / span 2; align-self: center; background: #0b61c4; border-color: #0b61c4; color: #fff; }
.plan-limit-warning a:hover { background: #0a4fa0; }
@media (max-width: 640px) { .plan-limit-warning { grid-template-columns: 1fr; } .plan-limit-warning a { grid-column: 1; grid-row: auto; justify-self: start; } }
body.theme-dark .plan-limit-warning.is-near { background: rgba(7,136,232,.12); color: #dbeafe; border-color: #1e3a5f; }
body.theme-dark .plan-limit-warning.is-over { background: rgba(217,119,6,.14); color: #fde7c2; border-color: #7c4a03; }
.subscription-plan.is-suggested { border-color: #0788e8 !important; box-shadow: 0 0 0 4px rgba(7,136,232,.15) !important; }
.plan-limit-form-note { background: #fff8eb !important; border-color: #f5d08a !important; color: #5b3a06 !important; font-weight: 600; }

/* Payment boxes (Record Payment, Apply One Payment): centered, title row across the whole box. */
dialog.hyper-modal {
  margin: auto;
  width: min(620px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  border: 0;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
}
dialog.hyper-modal::backdrop { background: rgba(15, 23, 42, 0.45); }
dialog.hyper-modal .section-heading-row,
dialog.hyper-modal button[type="submit"],
dialog.hyper-modal .message { grid-column: 1 / -1; }

/* Invoice page summary: what's still owed and the next step, above everything else. */
.invoice-summary-top { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; justify-content: space-between; }
.invoice-summary-balance { font-size: 30px; margin: 4px 0; }
.invoice-summary-balance small { font-size: 14px; font-weight: 600; color: var(--muted, #64748b); }
.invoice-summary-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.invoice-summary-warning { background: #fffbeb; border: 1px solid #fcd34d; border-radius: 8px; color: #92400e; margin: 14px 0 0; padding: 10px 12px; }
#paymentsBox { margin-top: 16px; }
#paymentsBox h3 { font-size: 15px; margin: 0 0 8px; }
#invoiceSendCard { margin-top: 30px; }
/* Row "More" menus near the bottom of a list open upward so they aren't cut off. */
.invoice-center-table tbody tr:nth-last-child(-n+2) .action-menu-panel { top: auto; bottom: calc(100% + 8px); }
.invoice-row-more .action-menu-panel { min-width: 190px; }
.invoice-center-table .invoice-action-stack .action-menu-panel .action-menu-item {
  background: transparent; border: 0; box-shadow: none; color: #172033; display: flex; align-items: center;
  font-size: 14px; font-weight: 600; justify-content: flex-start; min-height: 0; padding: 10px 12px; text-align: left; width: 100%;
}
.invoice-center-table .invoice-action-stack .action-menu-panel .action-menu-item:hover,
.invoice-center-table .invoice-action-stack .action-menu-panel .action-menu-item:focus { background: #eef6ff; color: var(--primary); }
.invoice-center-table .invoice-action-stack .action-menu-panel .action-menu-item[data-void] { color: #b91c1c; }

/* Invoices page: pick a list (Your invoices / Loads to bill), then filter it. */
.invoice-view-switch { display: flex; flex-wrap: wrap; gap: 0; margin-bottom: 14px; border-bottom: 2px solid #e5eef7; }
.invoice-view-switch button {
  background: transparent; border: 0; border-bottom: 3px solid transparent; margin-bottom: -2px;
  color: #475569; cursor: pointer; font: inherit; font-size: 16px; font-weight: 700; padding: 10px 18px;
}
.invoice-view-switch button.active { border-bottom-color: var(--primary); color: #0f172a; }
.invoice-view-switch .view-count { background: #eef2f7; border-radius: 999px; color: #334155; font-size: 12px; margin-left: 6px; padding: 2px 8px; }
.invoice-view-switch button.active .view-count { background: #e0f2fe; color: #075985; }
.invoice-tabs .chip-count { background: rgba(15, 23, 42, .08); border-radius: 999px; font-size: 11px; margin-left: 6px; padding: 1px 7px; }
.invoice-tabs button.active .chip-count { background: rgba(255, 255, 255, .25); }
.invoice-tabs .chip-count.danger { background: #fee2e2; color: #b91c1c; }
.invoice-tabs .chip-count.success { background: #dcfce7; color: #166534; }
.invoice-tabs button.active .chip-count.danger, .invoice-tabs button.active .chip-count.success { background: rgba(255, 255, 255, .25); color: inherit; }
@media (max-width: 760px) {
  .invoice-money-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .invoice-view-switch button { flex: 1; font-size: 15px; padding: 10px 8px; }
}
.invoice-center-table.hide-carrier-col th:nth-child(5),
.invoice-center-table.hide-carrier-col td:nth-child(5) { display: none; }

/* Invoices: online payments that couldn't be applied on their own. */
/* A setting opened from a link (e.g. settings.html#stripeConnectCard) glows briefly */
#stripeConnectCard { border-radius: 10px; padding: 4px 10px 10px; margin: 0 -10px; transition: box-shadow .4s ease, background-color .4s ease; }
.setting-spotlight { background-color: #eef6ff; box-shadow: 0 0 0 3px #60a5fa, 0 0 0 8px rgba(96, 165, 250, .25); }

/* Invoices: online payments not turned on yet (invoices.js loadOnlinePaymentsNote) */
.online-payments-note { align-items: center; background: #eef6ff; border: 1px solid #b6d4fe; border-radius: 10px; color: #0b2a4a; display: flex; flex-wrap: wrap; gap: 10px 16px; justify-content: space-between; margin: 0 0 16px; padding: 12px 16px; }
.online-payments-note[hidden] { display: none; }
.online-payments-note p { flex: 1 1 320px; margin: 0; }
.online-payments-note .quick-actions { margin: 0; }
.payment-exceptions-card { border-left: 4px solid #f59e0b; margin-bottom: 18px; }
.payment-exceptions-card li { align-items: center; display: flex; gap: 12px; justify-content: space-between; }

/* Load page: detention HyperRoute found at delivery, waiting for a person's choice. */
.detention-review { background: #fffbeb; border: 1px solid #fcd34d; border-radius: 8px; padding: 12px 14px; margin: 0 0 12px; }
.detention-review p { margin: 0 0 8px; }

/* Platform Admin > Applications: messaging applicants (platform-admin.js openApplicantMessage) */
.applicant-contact, .applicant-decide { display: flex; flex-wrap: wrap; gap: 6px; }
.applicant-contact { margin-bottom: 8px; }
.applicant-messages { margin-top: 6px; font-size: 13px; }
.applicant-messages summary { cursor: pointer; color: #0b61c4; font-weight: 600; }
.applicant-message { border-left: 3px solid #b6d4fe; margin: 8px 0 0; padding: 4px 0 4px 10px; }
.applicant-message p { white-space: pre-wrap; margin: 6px 0 0; color: #334155; }
dialog.applicant-message-dialog { width: min(640px, calc(100vw - 32px)); }
dialog.applicant-message-dialog form { display: grid; gap: 8px; }
dialog.applicant-message-dialog h2 { margin: 0; font-size: 20px; }
dialog.applicant-message-dialog label { font-weight: 600; font-size: 14px; margin-top: 4px; }
dialog.applicant-message-dialog input, dialog.applicant-message-dialog textarea { width: 100%; box-sizing: border-box; font: inherit; font-size: 15px; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 8px; }
dialog.applicant-message-dialog textarea { resize: vertical; line-height: 1.5; }
