:root {
  --bg-body: #0f172a;
  --bg-surface: #1e293b;
  --bg-elevated: #263449;
  --border-subtle: #334155;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --accent: #10b981;
  --accent-hover: #059669;
  --amber: #f59e0b;
  --danger: #ef4444;
  --radius: 10px;
}

[data-theme="light"] {
  --bg-body: #cbd5e1;
  --bg-surface: #ffffff;
  --bg-elevated: #e2e8f0;
  --border-subtle: #94a3b8;
  --text-main: #0f172a;
  --text-muted: #475569;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --accent: #059669;
  --accent-hover: #047857;
  --amber: #d97706;
  --danger: #dc2626;
  color-scheme: light;
}

[data-theme="dark"] {
  color-scheme: dark;
}

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

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.45;
}

.hidden {
  display: none !important;
}

/* Auth Gate */
.auth-gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at top, #1e3a8a 0%, #0f172a 65%);
}

.auth-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 36px;
  max-width: 440px;
  width: 100%;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.55);
  text-align: center;
}

.auth-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 20px;
  text-align: left;
}

.brand-emblem {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  font-weight: 800;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
  flex-shrink: 0;
}

.auth-brand h1 {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.4px;
}

.auth-subtitle {
  color: var(--text-muted);
  font-size: 13px;
}

.auth-desc {
  color: #cbd5e1;
  font-size: 14px;
  margin-bottom: 24px;
  line-height: 1.6;
}

.auth-error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  padding: 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 18px;
}

.btn-google-signin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 13px 20px;
  background: #ffffff;
  color: #0f172a;
  font-weight: 700;
  font-size: 15px;
  border-radius: 10px;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-google-signin:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(255, 255, 255, 0.15);
}

.auth-footer-note {
  margin-top: 18px;
  font-size: 12px;
  color: var(--text-muted);
}

/* Topbar */
.topbar {
  background: rgba(30, 41, 59, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 40;
  flex-wrap: wrap;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-title {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.3px;
}

.brand-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.14);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
  transition: all 0.15s ease;
  user-select: none;
}

.sync-badge:hover {
  background: rgba(16, 185, 129, 0.25);
  border-color: rgba(16, 185, 129, 0.55);
}

.sync-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}

.main-tabs {
  display: flex;
  gap: 6px;
  background: #0f172a;
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tab-btn:hover {
  color: var(--text-main);
}

.tab-btn.active {
  background: var(--primary);
  color: #fff;
}

.tab-pill {
  background: rgba(255, 255, 255, 0.2);
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  justify-content: flex-end;
  flex-shrink: 0;
}

.btn-pwa-install {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  border: 1px solid rgba(96, 165, 250, 0.45);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
  transition: all 0.15s ease;
  white-space: nowrap;
  user-select: none;
}

.btn-pwa-install:hover {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.45);
}

.btn-pwa-install:active {
  transform: translateY(0);
}

/* Theme Toggle Control (Label + Lite/Dark Toggle) */
.theme-control {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  user-select: none;
}

.theme-control-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

[data-theme="light"] .theme-control-label {
  color: #334155;
}

.btn-theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: #0f172a;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  padding: 2px 3px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  line-height: 1;
}

.btn-theme-toggle:hover {
  border-color: var(--primary);
}

.btn-theme-toggle:active {
  transform: translateY(0);
}

.theme-toggle-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.15s ease;
  white-space: nowrap;
}

/* In Dark Theme (default) */
:root .btn-theme-toggle .option-dark,
[data-theme="dark"] .btn-theme-toggle .option-dark {
  background: #3b82f6;
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(59, 130, 246, 0.45);
}
:root .btn-theme-toggle .option-light,
[data-theme="dark"] .btn-theme-toggle .option-light {
  color: #94a3b8;
  background: transparent;
}

/* In Light Theme */
[data-theme="light"] .btn-theme-toggle {
  background: #cbd5e1;
  border-color: #94a3b8;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.1);
}
[data-theme="light"] .btn-theme-toggle .option-light {
  background: #2563eb;
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(37, 99, 235, 0.35);
}
[data-theme="light"] .btn-theme-toggle .option-dark {
  background: transparent;
  color: #334155;
  font-weight: 600;
  box-shadow: none;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  background: #0f172a;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  font-size: 12px;
}

.user-email {
  color: #cbd5e1;
  font-weight: 500;
}

.btn-link {
  background: none;
  border: none;
  color: #f87171;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 15px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
}

.btn-sm {
  padding: 6px 11px;
  font-size: 12px;
}

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

.btn-accent {
  background: var(--accent);
  color: #fff;
}
.btn-accent:hover {
  background: var(--accent-hover);
}

.btn-indigo {
  background: #6366f1;
  color: #fff;
  border-color: #4f46e5;
}
.btn-indigo:hover {
  background: #4f46e5;
  border-color: #4338ca;
}

.btn-purple {
  background: #7c3aed;
  color: #fff;
  border-color: #6d28d9;
}
.btn-purple:hover {
  background: #6d28d9;
  border-color: #5b21b6;
}

.btn-teal {
  background: #0d9488;
  color: #fff;
}
.btn-teal:hover {
  background: #0f766e;
}

.btn-danger {
  background: #dc2626;
  color: #fff;
}
.btn-danger:hover {
  background: #b91c1c;
}

.btn-danger-outline {
  background: rgba(239, 68, 68, 0.14);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.4);
}
.btn-danger-outline:hover {
  background: rgba(239, 68, 68, 0.28);
  color: #fecaca;
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-main);
  border-color: var(--border-subtle);
}
.btn-secondary:hover {
  background: #334155;
}

.btn-ghost {
  background: transparent;
  color: #cbd5e1;
  border-color: var(--border-subtle);
}
.btn-ghost:hover {
  background: var(--bg-elevated);
  color: #fff;
}

/* Views */
.view-container {
  padding: 20px 24px;
  max-width: 1680px;
  margin: 0 auto;
}

/* KPI Strip Header & Toggle */
.tracker-stats-header {
  margin-bottom: 10px;
}

.btn-toggle-kpis {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 9px;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.btn-toggle-kpis:hover {
  background: #1e293b;
  color: var(--text-main);
  border-color: #475569;
}

.stats-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.stats-header-left svg {
  color: var(--primary);
  flex-shrink: 0;
}

.kpis-summary-pill {
  font-size: 11px;
  font-weight: 700;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
  padding: 2px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

.stats-header-right {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
}

.stats-header-right svg {
  transition: transform 0.2s ease;
}

.tracker-stats-header.is-collapsed .stats-header-right svg {
  transform: rotate(180deg);
}

/* KPI Strip */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(125px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

@media (max-width: 1200px) {
  .kpi-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }
}

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease;
  color: var(--text-main);
}

.kpi-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
}

.kpi-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.kpi-value {
  font-size: 26px;
  font-weight: 800;
  margin: 4px 0;
}

.kpi-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.kpi-blue .kpi-value { color: #60a5fa; }
.kpi-emerald .kpi-value { color: #34d399; }
.kpi-amber .kpi-value { color: #fbbf24; }
.kpi-indigo .kpi-value { color: #818cf8; }
.kpi-teal .kpi-value { color: #2dd4bf; }
.kpi-slate .kpi-value { color: #94a3b8; }
.kpi-savings {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.16), rgba(30, 41, 59, 0.95));
  border-color: rgba(16, 185, 129, 0.4);
  cursor: default;
}
.kpi-savings .kpi-value { color: #34d399; }

/* Toolbar */
.toolbar-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  flex-wrap: wrap;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #0f172a;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 7px 12px;
  min-width: 310px;
  flex: 1;
  max-width: 440px;
}

.search-box input {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 13px;
  width: 100%;
  outline: none;
}

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

.pill {
  background: #0f172a;
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.pill.active {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  border-color: #3b82f6;
}

.pill-hot {
  border-color: rgba(239, 68, 68, 0.45);
  color: #fca5a5;
}

.pill-hot:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.pill-hot.active {
  background: rgba(239, 68, 68, 0.25) !important;
  color: #ef4444 !important;
  border-color: #ef4444 !important;
  font-weight: 800;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Table */
.table-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  overflow: hidden;
}

.table-responsive {
  overflow-x: auto;
}

.loads-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.loads-table th {
  background: #131c2e;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 10.5px;
  letter-spacing: 0.3px;
  padding: 8px 8px;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.loads-table td {
  padding: 8px 8px;
  border-bottom: 1px solid rgba(51, 65, 85, 0.55);
  vertical-align: middle;
}

.loads-table tr:hover td {
  background: rgba(59, 130, 246, 0.05);
}

.load-num-col {
  width: 60px;
  min-width: 55px;
  text-align: center;
  padding: 8px 4px !important;
}

.po-col {
  min-width: 80px;
  white-space: nowrap;
}

/* Status Column - Fixed Width to prevent 'Archived' from expanding table */
.status-col {
  width: 92px;
  min-width: 88px;
  max-width: 96px;
  text-align: center;
  padding: 8px 4px !important;
  white-space: nowrap;
}

.status-select,
.status-badge {
  display: block;
  width: 100%;
  max-width: 88px;
  margin: 0 auto;
  padding: 3px 4px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid transparent;
  background: #0f172a;
  color: #fff;
  text-align: center;
  text-align-last: center;
  box-sizing: border-box;
  outline: none;
  cursor: pointer;
  letter-spacing: -0.2px;
  touch-action: manipulation;
}

.status-select option {
  background: #1e293b;
  color: #f8fafc;
  font-weight: 600;
  padding: 6px 10px;
}
.status-select option.status-opt-Ready { color: #34d399; }
.status-select option.status-opt-Not-Ready { color: #fbbf24; }
.status-select option.status-opt-Assigned { color: #60a5fa; }
.status-select option.status-opt-Picked-Up { color: #c084fc; }
.status-select option.status-opt-Delivered { color: #5eead4; }
.status-select option.status-opt-Archived { color: #94a3b8; }

.loc-col {
  min-width: 115px;
  max-width: 175px;
}

.carrier-col {
  min-width: 105px;
  max-width: 160px;
}

.instr-col {
  min-width: 110px;
  max-width: 175px;
}

.date-col {
  white-space: nowrap !important;
  min-width: 84px;
  max-width: 96px;
  font-size: 12px;
  padding: 8px 6px !important;
}

.num-col {
  text-align: right !important;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  white-space: nowrap;
  padding: 8px 6px !important;
}

/* Actions Column - Compact & Locked */
.actions-col {
  width: 136px;
  min-width: 130px;
  max-width: 140px;
  padding: 6px 4px !important;
  white-space: nowrap;
}

.row-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(58px, 1fr));
  gap: 4px;
  white-space: nowrap;
  width: 100%;
}

.row-actions .btn {
  padding: 4px 5px;
  font-size: 11px;
  min-height: 25px;
  line-height: 1.2;
}

.row-actions .btn-span-2 {
  grid-column: span 2;
  width: 100%;
  padding: 4px 5px;
  font-size: 11px;
  min-height: 24px;
  text-align: center;
}

.product-tag {
  font-size: 11.5px;
  font-weight: 700;
  color: #93c5fd;
  margin-top: 3px;
  line-height: 1.35;
}

.po-badge {
  font-weight: 700;
  color: #93c5fd;
  background: rgba(59, 130, 246, 0.14);
  padding: 3px 8px;
  border-radius: 6px;
  display: inline-block;
}

.row-num-chip {
  font-family: monospace;
  font-size: 12px;
  color: var(--text-muted);
  background: #0f172a;
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-block;
  transition: all 0.15s ease;
}

.row-num-hot {
  color: #ef4444 !important;
  background: rgba(239, 68, 68, 0.16) !important;
  border: 1px solid rgba(239, 68, 68, 0.5) !important;
  font-weight: 800;
}

.hot-badge-tracker {
  font-size: 10px;
  font-weight: 900;
  color: #ef4444;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  margin-top: 2px;
  text-align: center;
}

.loc-primary {
  font-weight: 600;
  color: #f1f5f9;
}

.loc-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.status-badge {
  display: inline-block;
  white-space: nowrap;
}

.status-Ready { background: rgba(16, 185, 129, 0.18); color: #34d399; border-color: rgba(16, 185, 129, 0.4); }
.status-Not-Ready { background: rgba(245, 158, 11, 0.18); color: #fbbf24; border-color: rgba(245, 158, 11, 0.4); }
.status-Assigned { background: rgba(59, 130, 246, 0.22); color: #60a5fa; border-color: rgba(59, 130, 246, 0.45); }
.status-Picked-Up { background: rgba(168, 85, 247, 0.22); color: #c084fc; border-color: rgba(168, 85, 247, 0.5); }
.status-Delivered { background: rgba(45, 212, 191, 0.18); color: #5eead4; border-color: rgba(45, 212, 191, 0.4); }
.status-Archived { background: rgba(148, 163, 184, 0.15); color: #94a3b8; border-color: rgba(148, 163, 184, 0.3); }

.tarp-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  margin-bottom: 3px;
}

.tarp-must {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.tarp-no {
  background: rgba(148, 163, 184, 0.2);
  color: #cbd5e1;
}

.carrier-emailed-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.16);
  border: 1px solid rgba(56, 189, 248, 0.35);
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 11.5px;
}

.rate-booked-col { color: #fbbf24; font-weight: 700; }
.savings-pos { color: #34d399; font-weight: 700; }
.savings-neg { color: #f87171; font-weight: 700; }

.rate-booked-pill {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  padding: 3px 8px;
  background: rgba(245, 158, 11, 0.16);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 6px;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.2px;
}

.savings-badge {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.2px;
}

.savings-badge.savings-pos {
  background: rgba(16, 185, 129, 0.16);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.savings-badge.savings-neg {
  background: rgba(239, 68, 68, 0.16);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

/* ==========================================================================
   FINANCIAL DATA VISIBILITY RESTRICTIONS
   ========================================================================== */
body.hide-financials .col-financial,
body.hide-financials .kpi-savings,
body.hide-financials #builder-savings-preview,
body.hide-financials .conf-rate-row {
  display: none !important;
}

/* Builder Split View */
.builder-layout {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 22px;
  align-items: start;
}

@media (max-width: 1220px) {
  .builder-layout {
    grid-template-columns: 1fr;
  }
}

.builder-form-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 20px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.panel-header h2 {
  font-size: 17px;
  font-weight: 800;
}

.panel-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.recall-bar {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  background: #0f172a;
  border: 1px solid var(--border-subtle);
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 16px;
}

.recall-badges {
  display: flex;
  gap: 8px;
  align-items: center;
  padding-bottom: 4px;
}

.mode-badge {
  font-size: 11px;
  font-weight: 800;
  padding: 4px 9px;
  border-radius: 6px;
}

.mode-new {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.mode-recall {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
}

.row-info-badge {
  font-size: 12px;
  font-family: monospace;
  color: var(--text-muted);
}

.form-section {
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 14px;
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.section-title {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #93c5fd;
  margin-bottom: 10px;
}

.section-title-row .section-title {
  margin-bottom: 0;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 10px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.grid-product { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 10px; margin-top: 10px; }

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group label {
  font-size: 11px;
  font-weight: 600;
  color: #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.form-group input,
.form-group select,
.form-group textarea {
  background: #0f172a;
  border: 1px solid var(--border-subtle);
  border-radius: 7px;
  padding: 8px 10px;
  color: var(--text-main);
  font-size: 13px;
  font-family: inherit;
  outline: none;
}

.form-group textarea {
  resize: vertical;
  min-height: 58px;
  line-height: 1.4;
}

.form-group input[type="date"] {
  color-scheme: dark;
  cursor: pointer;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
}

.form-group input:disabled,
.form-group input[disabled],
.form-group select:disabled,
.form-group select[disabled],
.form-group textarea:disabled,
.form-group textarea[disabled] {
  background: rgba(15, 23, 42, 0.45) !important;
  color: #64748b !important;
  border-color: rgba(51, 65, 85, 0.4) !important;
  cursor: not-allowed !important;
  opacity: 0.75;
}

.form-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.form-label-row label {
  font-size: 11px;
  font-weight: 600;
  color: #cbd5e1;
}

.checkbox-same-po {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 500;
  color: #94a3b8;
  cursor: pointer;
  user-select: none;
}

.checkbox-same-po input[type="checkbox"] {
  cursor: pointer;
  accent-color: var(--primary);
  width: 13px;
  height: 13px;
  margin: 0;
}

.checkbox-same-po:hover {
  color: #e2e8f0;
}

.inline-chip {
  background: rgba(59, 130, 246, 0.16);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.35);
  border-radius: 5px;
  padding: 1px 7px;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
}
.inline-chip:hover {
  background: rgba(59, 130, 246, 0.3);
}

.hub-label {
  font-size: 11px;
  color: var(--text-muted);
}

.quick-hubs, .quick-chips {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: #e2e8f0;
  cursor: pointer;
}

.custom-delivery-banner {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 10px;
}

.savings-pill {
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #34d399;
  font-weight: 800;
  font-size: 14px;
  padding: 7px 10px;
  border-radius: 7px;
  text-align: center;
}

.form-actions-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}

/* Right Side: 1-Page Confirmation Sheet Preview */
.builder-preview-panel {
  position: sticky;
  top: 76px;
}

.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding: 8px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
}

.preview-label {
  font-size: 12px;
  font-weight: 700;
  color: #cbd5e1;
}

.sheet-paper-wrapper {
  background: #334155;
  padding: 16px;
  border-radius: 12px;
  overflow-x: auto;
  display: flex;
  justify-content: center;
}

.preview-collapsed-banner {
  background: var(--bg-surface);
  border: 1px dashed var(--border-subtle);
  border-radius: 10px;
  padding: 24px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 4px;
}

.preview-collapsed-banner button {
  color: #38bdf8;
  font-weight: 700;
  text-decoration: underline;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 4px;
  font-size: inherit;
}

.preview-collapsed-banner button:hover {
  color: #7dd3fc;
}

/* Printable 1-Page Confirmation Document (Matches Testing!A1:G44) */
.confirmation-sheet,
.confirmation-sheet * {
  -webkit-print-color-adjust: exact !important;
  print-color-adjust: exact !important;
}

.confirmation-sheet {
  width: 760px;
  min-height: 0;
  background: #ffffff;
  color: #111827;
  padding: 20px 28px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 12px;
  line-height: 1.3;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.conf-tarp-banners {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.conf-tarp-banner {
  background: #fef2f2;
  color: #b91c1c;
  border: 2px solid #dc2626;
  font-weight: 800;
  font-size: 13px;
  padding: 3px 14px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.conf-title-block {
  text-align: center;
  margin-bottom: 6px;
}

.conf-company-name {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #0f172a;
}

.conf-doc-type {
  font-size: 14px;
  font-weight: 700;
  color: #334155;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.conf-load-num {
  font-size: 13px;
  font-weight: 800;
  color: #1d4ed8;
  margin-top: 2px;
  letter-spacing: 0.4px;
}

.conf-return-email {
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  padding: 5px 10px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}

.conf-email-link {
  font-weight: 800;
  color: #1d4ed8;
  font-size: 13px;
}

.conf-info-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 4px;
}

.conf-info-table td {
  padding: 2.5px 6px;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: top;
}

.conf-lbl {
  width: 175px;
  font-weight: 700;
  color: #334155;
  white-space: nowrap;
}

.conf-lbl-inline {
  width: 45px;
  font-weight: 700;
  color: #334155;
  text-align: right;
}

.conf-val-zip {
  width: 90px;
  font-weight: 600;
}

.conf-val {
  color: #0f172a;
}

.conf-bold {
  font-weight: 700;
}

.conf-po-highlight {
  font-weight: 800;
  font-size: 13.5px;
}

.conf-rate-highlight {
  font-weight: 800;
  font-size: 13.5px;
  color: #047857;
}

.conf-instructions-highlight {
  font-weight: 700;
  background: #fef9c3;
  padding: 3px 6px !important;
}

.conf-spacer-row td {
  height: 3px;
  border-bottom: none;
}

.conf-location-section {
  margin-top: 6px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  overflow: hidden;
}

.conf-section-header {
  background: #1e293b;
  color: #ffffff;
  font-weight: 800;
  font-size: 10.5px;
  letter-spacing: 0.8px;
  padding: 3px 10px;
}

.conf-billing-block {
  margin-top: 8px;
  padding: 7px 12px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  display: flex;
  gap: 24px;
  font-size: 11.5px;
  line-height: 1.28;
}

.conf-billing-left {
  font-weight: 800;
  color: #334155;
}

.conf-disclaimers {
  margin-top: 8px;
  font-size: 11px;
  color: #1e293b;
  line-height: 1.32;
}

.conf-note {
  margin-bottom: 3px;
}

.conf-signature-row {
  margin-top: 14px;
  padding-top: 6px;
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  font-size: 12.5px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #0f172a;
  color: #fff;
  border: 1px solid #3b82f6;
  padding: 12px 18px;
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
  z-index: 100;
  font-size: 13px;
  font-weight: 600;
}

/* Modal Backdrop & Card */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 16px;
  box-sizing: border-box;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.modal-backdrop.hidden {
  display: none !important;
}

.modal-card {
  background: #1e293b;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  margin: auto;
  flex-shrink: 0;
  animation: modalScaleIn 0.15s ease-out;
}

@keyframes modalScaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(51, 65, 85, 0.55);
  background: rgba(15, 23, 42, 0.5);
  flex-shrink: 0;
}

.modal-icon.warning-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(245, 158, 11, 0.18);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #fbbf24;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.modal-title {
  font-size: 15px;
  font-weight: 800;
  color: #f1f5f9;
  margin: 0;
}

.modal-subtitle {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.modal-body {
  padding: 18px 20px;
  font-size: 13px;
  line-height: 1.5;
  color: #cbd5e1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1 1 auto;
  min-height: 0;
}

.duplicate-details-card {
  background: #0f172a;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 10px 14px;
  margin: 12px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dup-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
}

.dup-label {
  color: var(--text-muted);
  font-weight: 600;
}

.dup-val {
  color: #93c5fd;
  font-weight: 700;
}

.modal-question {
  margin-top: 12px;
  font-size: 13px;
  color: #e2e8f0;
  font-weight: 600;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  background: rgba(15, 23, 42, 0.5);
  border-top: 1px solid rgba(51, 65, 85, 0.55);
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .modal-backdrop {
    padding: 0 !important;
    align-items: stretch !important;
    justify-content: stretch !important;
    overflow: hidden !important;
  }
  .modal-card,
  .modal-card-lg,
  .modal-card-address-book {
    max-height: 100dvh !important;
    height: 100% !important;
    height: 100dvh !important;
    height: -webkit-fill-available !important;
    max-height: -webkit-fill-available !important;
    width: 100vw !important;
    max-width: 100vw !important;
    border-radius: 0 !important;
    border: none !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }
  .modal-header {
    flex-shrink: 0 !important;
    padding: 12px 14px !important;
    gap: 8px !important;
  }
  .modal-body {
    padding: 12px 12px 24px 12px !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }
  .modal-footer {
    flex-shrink: 0 !important;
    padding: 12px 14px !important;
    padding-bottom: max(12px, env(safe-area-inset-bottom)) !important;
    display: flex !important;
    flex-direction: row !important;
    gap: 8px !important;
    background: #1e293b !important;
    border-top: 1px solid rgba(51, 65, 85, 0.7) !important;
    box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.35) !important;
    z-index: 10 !important;
  }
  .modal-footer .btn {
    flex: 1 !important;
    min-height: 44px !important;
    justify-content: center !important;
    font-size: 13px !important;
    padding: 8px 10px !important;
  }
  [data-theme="light"] .modal-footer {
    background: #e2e8f0 !important;
    border-top-color: #cbd5e1 !important;
    box-shadow: 0 -4px 14px rgba(15, 23, 42, 0.1) !important;
  }
}

.modal-card-lg {
  max-width: 680px;
  width: 95%;
}

.modal-card-address-book {
  max-width: 860px;
  width: 96%;
}

.modal-close-btn {
  margin-left: auto;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 8px;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.modal-close-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.08);
}

.modal-icon.email-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(56, 189, 248, 0.16);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #38bdf8;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.modal-icon.address-book-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(99, 102, 241, 0.16);
  border: 1px solid rgba(99, 102, 241, 0.4);
  color: #818cf8;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.email-sender-callout {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  background: rgba(37, 99, 235, 0.12);
  border: 1px solid rgba(37, 99, 235, 0.28);
  border-radius: 8px;
  font-size: 12px;
  color: #93c5fd;
  margin-bottom: 12px;
}

.email-load-preview {
  background: #0f172a;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 14px;
}

.preview-load-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-subtle);
  gap: 8px;
  flex-wrap: wrap;
}

.preview-load-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-main);
}

.preview-secure-badge {
  font-size: 10.5px;
  font-weight: 700;
  color: #34d399;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.35);
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.preview-load-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 14px;
  font-size: 12px;
}

@media (max-width: 540px) {
  .preview-load-grid {
    grid-template-columns: 1fr;
  }
}

.preview-item {
  display: flex;
  gap: 6px;
  min-width: 0;
}

.preview-lbl {
  color: var(--text-muted);
  font-weight: 600;
  min-width: 72px;
  flex-shrink: 0;
}

.preview-val {
  color: var(--text-main);
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contacts-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.contacts-table-wrapper {
  overflow-x: auto;
  overflow-y: auto;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

.contacts-table {
  table-layout: auto;
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
}

.contacts-table th,
.contacts-table td {
  padding: 11px 14px;
  vertical-align: middle;
}

.contacts-col-company {
  min-width: 150px;
}

.contacts-col-contact {
  min-width: 100px;
  white-space: nowrap;
}

.contacts-col-email {
  max-width: 230px;
  min-width: 170px;
}

.contacts-col-email a {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

.contacts-col-email a:hover {
  text-decoration: underline;
}

.contacts-col-phone {
  white-space: nowrap !important;
  min-width: 125px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.2px;
}

.contacts-col-actions {
  width: 130px;
  min-width: 130px;
  text-align: right;
  white-space: nowrap !important;
}

.contacts-col-actions .row-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  width: auto;
}

.contacts-col-actions .btn {
  min-width: 54px;
  padding: 5px 10px;
  font-size: 11.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 27px;
}

.contacts-empty {
  padding: 36px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
}

/* ==========================================================================
   Responsive & Mobile Experience Optimizations
   ========================================================================== */

/* Base helper classes for responsive elements */
.brand-title-mobile,
.tab-label-mobile {
  display: none;
}

.table-scroll-hint,
.sheet-scroll-hint {
  display: none;
}

.lbl-hint {
  font-weight: 400;
  font-size: 10.5px;
  color: #94a3b8;
  margin-left: 4px;
}

/* PO input group (PO input + Option select side-by-side) */
.po-input-group {
  display: flex;
  gap: 6px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.po-input-group input {
  flex: 1 1 auto;
  min-width: 0;
  box-sizing: border-box;
}

.po-input-group select {
  width: 70px;
  flex: 0 0 70px;
  box-sizing: border-box;
}

/* 2-Column responsive paired row */
.grid-mobile-2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  margin-bottom: 8px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.grid-mobile-2 > .form-group {
  min-width: 0;
  max-width: 100%;
}

.status-salesman-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin-bottom: 8px;
  width: 100%;
}
.status-salesman-row .status-group {
  flex: 1;
  min-width: 0;
  margin-bottom: 0;
}
.status-salesman-row .salesman-group {
  flex: 1;
  min-width: 0;
  margin-bottom: 0;
}
.status-salesman-row .hot-load-group {
  flex-shrink: 0;
  margin-bottom: 0;
}
.hot-load-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #f87171;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
  white-space: nowrap;
  height: 38px;
  box-sizing: border-box;
}
.hot-load-checkbox-label:hover {
  background: rgba(239, 68, 68, 0.22);
  border-color: rgba(239, 68, 68, 0.6);
}
.hot-load-checkbox-label:has(input:checked) {
  background: #ef4444;
  border-color: #dc2626;
  color: #ffffff;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
}
.hot-load-checkbox-label input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: #ef4444;
  cursor: pointer;
  margin: 0;
}

@media (max-width: 640px) {
  .status-salesman-row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .status-salesman-row .status-group,
  .status-salesman-row .salesman-group,
  .status-salesman-row .hot-load-group {
    width: 100%;
    flex: 1 1 100%;
  }
  .hot-load-checkbox-label {
    width: 100%;
    justify-content: center;
  }
}

.action-btn-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
}

/* Compact Recall Bar */
.recall-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #0f172a;
  border: 1px solid var(--border-subtle);
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 12px;
  width: 100%;
  box-sizing: border-box;
}

.recall-left {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 100%;
}

.recall-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
}

.recall-label {
  font-size: 11px;
  font-weight: 700;
  color: #cbd5e1;
}

.recall-select-row {
  display: flex;
  gap: 6px;
  width: 100%;
}

.recall-select-row select,
#select-recall-load {
  flex: 1 1 auto;
  min-width: 0;
  background: #0f172a;
  border: 1px solid var(--border-subtle);
  border-radius: 7px;
  padding: 8px 10px;
  color: var(--text-main);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.recall-select-row select:focus,
#select-recall-load:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.recall-select-row select option,
#select-recall-load option {
  background: #0f172a;
  color: var(--text-main);
}

.recall-select-row select option[value="__view_more__"],
#select-recall-load option[value="__view_more__"] {
  background: #1e293b;
  color: #60a5fa;
  font-weight: 700;
}

.btn-mobile-new,
#btn-duplicate-load-top {
  flex-shrink: 0;
  white-space: nowrap;
  padding: 7px 13px;
  font-size: 12.5px;
  font-weight: 700;
}

/* Strict Viewport Containment — Prevents any element from blowing out the page width */
html {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  box-sizing: border-box;
}

body {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

#app-shell {
  width: 100%;
  max-width: 100vw;
  overflow-x: clip;
  box-sizing: border-box;
}

.view-container {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.builder-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  gap: 14px;
}

@media (min-width: 1221px) {
  .builder-layout {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    gap: 22px;
  }
}

.builder-form-panel {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.builder-preview-panel {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  overflow: hidden;
}

.sheet-paper-wrapper {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-card {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  overflow: hidden;
}

.table-responsive {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: auto;
}

/* Confirmation Sheet Fit Screen Mode */
.sheet-paper-wrapper.fit-screen:not(.hidden) {
  overflow: hidden !important;
  display: flex !important;
  justify-content: center !important;
  padding: 8px 0 !important;
}

.sheet-paper-wrapper.hidden,
#sheet-paper-wrapper.hidden {
  display: none !important;
}

.sheet-paper-wrapper.fit-screen .confirmation-sheet {
  transform: scale(calc((100vw - 28px) / 760));
  transform-origin: top center;
  margin-bottom: calc(760px * (1 - (100vw - 28px) / 760) * -1.25);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

/* Mid-size Screens / Laptops (<= 1180px) */
@media (max-width: 1180px) {
  .topbar {
    padding: 10px 16px;
    gap: 10px;
  }
  .topbar-left {
    order: 1;
  }
  .topbar-right {
    order: 2;
    margin-left: auto;
  }
  .main-tabs {
    order: 3;
    width: 100%;
    margin-top: 4px;
    justify-content: center;
  }
}

/* Tablet screens (<= 1024px) */
@media (max-width: 1024px) {
  .topbar {
    padding: 10px 16px;
  }
  .view-container {
    padding: 14px 16px;
  }
  .kpi-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
  }
}

/* Mobile Phones and Portrait Tablets (<= 768px) */
@media (max-width: 768px) {
  .view-container {
    padding: 8px 8px;
  }

  /* Responsive Brand & Tab Labels */
  .brand-title-full {
    display: none !important;
  }
  .brand-title-mobile {
    display: inline !important;
  }
  .tab-label-full {
    display: none !important;
  }
  .tab-label-mobile {
    display: inline !important;
  }

  /* Topbar Navigation */
  .topbar {
    padding: 6px 10px;
    gap: 6px;
    flex-wrap: wrap;
    position: sticky;
    top: 0;
  }

  .topbar-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
  }

  .brand-emblem {
    width: 32px;
    height: 32px;
    font-size: 13px;
    border-radius: 7px;
    flex-shrink: 0;
  }

  .brand-title-row {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
  }

  .brand-title {
    font-size: 14px;
    font-weight: 800;
    white-space: nowrap;
  }

  .brand-sub {
    display: none !important;
  }

  .sync-badge {
    font-size: 9.5px;
    padding: 2px 5px;
    gap: 4px;
    flex-shrink: 0;
  }

  .sync-dot {
    width: 5px;
    height: 5px;
  }

  .topbar-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    margin-left: auto;
  }

  .user-chip {
    padding: 2px 7px;
    font-size: 11px;
    gap: 5px;
    max-width: 150px;
  }

  .user-email {
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 11px;
  }

  .btn-link {
    font-size: 11px;
    padding: 2px 4px;
  }

  .main-tabs {
    width: 100%;
    order: 3;
    margin-top: 2px;
    padding: 2px;
    gap: 3px;
    display: flex;
  }

  .tab-btn {
    flex: 1;
    justify-content: center;
    padding: 7px 6px;
    font-size: 12px;
    min-height: 36px;
    gap: 5px;
  }

  .tab-pill {
    font-size: 10px;
    padding: 1px 5px;
  }

  /* KPI Summary Grid (Compact 2-Column Dashboard on Phones) */
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 6px;
    margin-bottom: 10px;
  }

  .kpi-card {
    padding: 8px 10px;
    border-radius: 7px;
    min-height: 0;
  }

  .kpi-label {
    font-size: 9.5px;
    letter-spacing: 0.2px;
  }

  .kpi-value {
    font-size: 18px;
    margin: 1px 0;
  }

  .kpi-sub {
    font-size: 9.5px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  /* Toolbar, Search & Filter Pills */
  .toolbar-card {
    padding: 8px 10px;
    gap: 8px;
    flex-direction: column;
    align-items: stretch;
    margin-bottom: 10px;
  }

  .toolbar-left {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    width: 100%;
  }

  .search-box {
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 7px 10px;
  }

  .search-box input {
    font-size: 14px;
  }

  .filter-pills {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 5px;
    padding: 2px 0 4px 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .filter-pills::-webkit-scrollbar {
    display: none;
  }

  .pill {
    flex-shrink: 0;
    padding: 5px 10px;
    font-size: 11.5px;
    min-height: 30px;
    display: inline-flex;
    align-items: center;
  }

  .toolbar-right {
    width: 100%;
    display: flex;
    gap: 8px;
    align-items: center;
  }

  #btn-toggle-kpis-toolbar {
    flex-shrink: 0;
    padding: 10px 12px;
    font-size: 13px;
    justify-content: center;
  }

  #btn-new-load-top {
    flex: 1;
    width: auto;
    padding: 10px 14px;
    font-size: 13px;
    justify-content: center;
  }

  /* Scroll Hints */
  .table-scroll-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 10.5px;
    color: var(--text-muted);
    background: rgba(15, 23, 42, 0.7);
    padding: 5px 8px;
    border-bottom: 1px solid var(--border-subtle);
    text-align: center;
  }

  .sheet-scroll-hint {
    display: block;
    font-size: 10.5px;
    color: var(--text-muted);
    text-align: center;
    padding: 5px 6px;
    background: rgba(15, 23, 42, 0.5);
    border-radius: 6px;
    margin-bottom: 6px;
  }

  /* Table Horizontal Scrolling & Sticky Load # Column */
  .table-card {
    border-radius: 8px;
  }

  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .loads-table th:first-child,
  .loads-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 3;
    background: #131c2e;
    box-shadow: 2px 0 6px rgba(0, 0, 0, 0.45);
  }

  .loads-table th:first-child {
    z-index: 4;
  }

  .loads-table tr:hover td:first-child {
    background: #1a253a;
  }

  .loads-table th {
    padding: 8px 7px;
    font-size: 10px;
    white-space: nowrap;
  }

  .loads-table td {
    padding: 8px 7px;
    font-size: 11.5px;
  }

  .row-actions {
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    min-width: 122px;
  }

  .row-actions .btn {
    padding: 4px 5px;
    font-size: 10.5px;
    min-height: 25px;
  }

  /* Form Inputs (font-size 16px to prevent iOS Safari auto-zoom) */
  .form-group input,
  .form-group select,
  .form-group textarea,
  .search-box input,
  #auth-email-input {
    font-size: 16px !important;
    padding: 8px 10px;
  }

  /* Builder Form Panel */
  .builder-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .builder-form-panel {
    padding: 10px 8px;
    border-radius: 8px;
  }

  /* Hide redundant desktop header on phones */
  .panel-header {
    display: none !important;
  }

  .recall-bar {
    padding: 8px 10px;
    margin-bottom: 10px;
  }

  .form-section {
    padding: 10px 8px;
    margin-bottom: 10px;
    border-radius: 8px;
  }

  .section-title {
    font-size: 11px;
    margin-bottom: 6px;
  }

  .section-title-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
    margin-bottom: 6px;
  }

  .form-group label {
    font-size: 10.5px;
    flex-wrap: wrap;
    gap: 4px;
  }

  .grid-2,
  .grid-3,
  .grid-4,
  .grid-product {
    grid-template-columns: 1fr !important;
    gap: 6px;
    margin-bottom: 6px;
  }

  .quick-hubs,
  .quick-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
  }

  .inline-chip {
    padding: 3px 7px;
    font-size: 10.5px;
    min-height: 26px;
  }

  .savings-pill {
    font-size: 15px;
    padding: 7px;
  }

  .form-actions-bar {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 10px;
  }

  .form-actions-bar .btn {
    width: 100%;
    padding: 11px 12px;
    font-size: 13.5px;
    font-weight: 700;
    min-height: 42px;
    justify-content: center;
  }

  .btn-lg {
    min-height: 46px;
    font-size: 14.5px !important;
  }

  /* Confirmation Sheet Preview */
  .builder-preview-panel {
    position: static;
    margin-top: 10px;
  }

  .preview-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 8px 10px;
    text-align: center;
  }

  .preview-actions {
    display: flex;
    gap: 6px;
    width: 100%;
  }

  .preview-actions .btn {
    flex: 1;
    justify-content: center;
    padding: 7px 10px;
    font-size: 12px;
  }

  .sheet-paper-wrapper {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 8px 4px;
    border-radius: 8px;
    background: #1e293b;
  }

  .confirmation-sheet {
    margin: 0 auto;
    min-width: 760px;
  }

  /* Toast notification */
  .toast {
    left: 10px;
    right: 10px;
    bottom: 14px;
    text-align: center;
    font-size: 12px;
    padding: 10px 12px;
  }

  /* Auth Gate Card */
  .auth-gate {
    padding: 12px;
    align-items: flex-start;
    padding-top: 28px;
  }

  .auth-card {
    padding: 20px 14px;
    border-radius: 12px;
  }

  .auth-brand h1 {
    font-size: 17px;
  }

  .auth-desc {
    font-size: 12.5px;
    margin-bottom: 16px;
  }

  /* ========================================================================
     USER MANAGEMENT MOBILE RESPONSIVE CARDS & FORM
     ======================================================================== */
  .users-view-layout {
    padding: 8px 6px;
    gap: 12px;
  }

  .users-header-card {
    padding: 12px 14px;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    border-radius: 8px;
  }

  .users-header-info h2 {
    font-size: 17px;
    margin-bottom: 3px;
  }

  .users-header-info .panel-sub {
    font-size: 12px;
    line-height: 1.4;
  }

  #btn-show-add-user {
    width: 100%;
    min-height: 42px;
    font-size: 13.5px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
  }

  /* User Edit Form Card on Phones */
  .user-edit-card {
    padding: 14px 12px;
    border-radius: 8px;
  }

  .user-card-header {
    margin-bottom: 12px;
    padding-bottom: 10px;
  }

  .user-card-header h3 {
    font-size: 15px;
  }

  .user-form-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 14px;
  }

  .permissions-card {
    padding: 12px 10px;
    margin-bottom: 14px;
  }

  .perm-title {
    font-size: 12px;
    margin-bottom: 10px;
  }

  .permissions-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .perm-col {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    padding: 10px;
    gap: 6px;
  }

  .perm-check-label {
    font-size: 12.5px;
    padding: 6px 4px;
  }

  .user-form-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 14px;
  }

  .user-form-actions .btn {
    width: 100%;
    min-height: 44px;
    font-size: 13.5px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
  }

  /* Users Table Transformation to Mobile Cards */
  .users-table-card {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .users-table-responsive {
    overflow-x: visible !important;
    padding: 0 !important;
    width: 100% !important;
  }

  .users-table {
    display: block !important;
    width: 100% !important;
    border: none !important;
    background: transparent !important;
  }

  .users-table thead {
    display: none !important;
  }

  .users-table tbody {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    width: 100% !important;
  }

  .users-table tr.user-row-card {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    grid-template-areas:
      "header header"
      "perm1 perm2"
      "perm3 perm4"
      "actions actions" !important;
    gap: 8px 8px !important;
    background: #1e293b !important;
    border: 1px solid #334155 !important;
    border-radius: 10px !important;
    padding: 14px !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25) !important;
    box-sizing: border-box !important;
    width: 100% !important;
  }

  .users-table td {
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
  }

  .user-col-identity {
    grid-area: header !important;
    display: block !important;
    padding-bottom: 10px !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  }

  .user-identity-cell {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 10px !important;
    width: 100% !important;
  }

  .user-avatar-badge {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 36px !important;
    height: 36px !important;
    border-radius: 8px !important;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8) !important;
    color: #ffffff !important;
    font-weight: 800 !important;
    font-size: 14px !important;
    flex-shrink: 0 !important;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.35) !important;
  }

  .user-info-text {
    display: flex !important;
    flex-direction: column !important;
    min-width: 0 !important;
    flex: 1 !important;
  }

  .user-display-name {
    font-size: 15px !important;
    font-weight: 700 !important;
    color: #f8fafc !important;
    line-height: 1.25 !important;
  }

  .user-email-mobile {
    display: block !important;
    font-size: 12px !important;
    color: #94a3b8 !important;
    word-break: break-all !important;
    margin-top: 2px !important;
    background: transparent !important;
    padding: 0 !important;
    border: none !important;
  }

  .user-role-mobile {
    display: block !important;
    flex-shrink: 0 !important;
  }

  /* Desktop columns hidden on mobile */
  .user-col-email-desktop,
  .user-col-role-desktop {
    display: none !important;
  }

  /* Permission Cards on Mobile */
  .user-col-perm {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 4px !important;
    padding: 7px 9px !important;
    background: rgba(15, 23, 42, 0.5) !important;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
    border-radius: 7px !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  .user-col-perm[data-perm="tracker"] {
    grid-area: perm1 !important;
  }

  .user-col-perm[data-perm="builder"] {
    grid-area: perm2 !important;
  }

  .user-col-perm[data-perm="financials"] {
    grid-area: perm3 !important;
  }

  .user-col-perm[data-perm="dispatch"] {
    grid-area: perm4 !important;
  }

  .user-perm-label-mobile {
    display: inline-block !important;
    font-size: 10px !important;
    font-weight: 700 !important;
    color: #94a3b8 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.4px !important;
  }

  .user-col-perm .perm-pill {
    font-size: 11px !important;
    padding: 2px 6px !important;
    white-space: normal !important;
    line-height: 1.25 !important;
  }

  /* Action Buttons Column on Mobile */
  .user-col-actions {
    grid-area: actions !important;
    display: block !important;
    padding-top: 10px !important;
    border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
  }

  .user-action-buttons {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
    width: 100% !important;
  }

  .user-action-buttons .btn {
    min-height: 42px !important;
    font-size: 13.5px !important;
    font-weight: 700 !important;
    border-radius: 8px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 8px 12px !important;
    width: 100% !important;
    line-height: 1.2 !important;
  }

  .badge-protected-user {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 42px !important;
    font-size: 12.5px !important;
    font-weight: 700 !important;
    color: #94a3b8 !important;
    background: rgba(148, 163, 184, 0.12) !important;
    border: 1px solid rgba(148, 163, 184, 0.25) !important;
    border-radius: 8px !important;
    width: 100% !important;
    grid-column: span 1 !important;
  }

  /* Empty state cell */
  .users-table td.empty-cell {
    grid-column: 1 / -1 !important;
    display: block !important;
    width: 100% !important;
    text-align: center !important;
    padding: 28px 14px !important;
  }
}

/* Extra small mobile screens (<= 480px, e.g. iPhone SE / Pixel Pro XL portrait) */
@media (max-width: 480px) {
  .view-container {
    padding: 6px 6px;
  }

  .topbar {
    padding: 5px 8px;
  }

  .brand-title {
    font-size: 13px;
  }

  .user-chip {
    max-width: 135px;
    padding: 2px 5px;
  }

  .user-email {
    max-width: 65px;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 5px;
  }

  .kpi-card {
    padding: 7px 8px;
  }

  .kpi-value {
    font-size: 17px;
  }

  .kpi-label {
    font-size: 9px;
  }
}

@page {
  size: letter portrait;
  margin: 0.25in;
}

body.pdf-capture-mode {
  background: #ffffff !important;
  color: #111827 !important;
  margin: 0 !important;
  padding: 0 !important;
}

body.pdf-capture-mode .no-print,
body.pdf-capture-mode #view-tracker,
body.pdf-capture-mode .builder-form-panel,
body.pdf-capture-mode .preview-toolbar,
body.pdf-capture-mode .topbar,
body.pdf-capture-mode .toast {
  display: none !important;
}

body.pdf-capture-mode #app-shell,
body.pdf-capture-mode #view-builder,
body.pdf-capture-mode #view-builder.hidden,
body.pdf-capture-mode .builder-layout,
body.pdf-capture-mode .builder-preview-panel,
body.pdf-capture-mode .sheet-paper-wrapper {
  display: block !important;
  position: static !important;
  padding: 0 !important;
  margin: 0 !important;
  background: #ffffff !important;
  box-shadow: none !important;
  border: none !important;
  overflow: visible !important;
}

body.pdf-capture-mode .confirmation-sheet {
  width: 760px !important;
  max-width: 760px !important;
  min-height: 0 !important;
  height: auto !important;
  margin: 0 !important;
  box-shadow: none !important;
  padding: 10px 16px !important;
  border: none !important;
}

/* ==========================================================================
   READ-ONLY BANNER
   ========================================================================== */
.readonly-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 14px;
  color: #fcd34d;
  font-size: 13px;
  line-height: 1.4;
}

.readonly-banner svg {
  flex-shrink: 0;
  stroke: #f59e0b;
}

/* ==========================================================================
   USER MANAGEMENT VIEW
   ========================================================================== */
.users-view-layout {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
  width: 100%;
}

.users-header-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 18px 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.users-header-info h2 {
  font-size: 18px;
  font-weight: 700;
  color: #f1f5f9;
  margin: 0 0 4px 0;
}

.users-header-info .panel-sub {
  font-size: 13px;
  color: #94a3b8;
  margin: 0;
}

.user-edit-card {
  background: #1e293b;
  border: 1px solid #3b82f6;
  border-radius: 10px;
  padding: 20px 24px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.user-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  border-bottom: 1px solid #334155;
  padding-bottom: 12px;
}

.user-card-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: #f8fafc;
  margin: 0;
}

.user-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.permissions-card {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 18px;
}

.perm-title {
  font-size: 13px;
  font-weight: 700;
  color: #e2e8f0;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.permissions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.perm-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.perm-col-header {
  margin-bottom: 4px;
}

.perm-col-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 4px;
  padding: 2px 8px;
  text-transform: uppercase;
}

.perm-check-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: #cbd5e1;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 6px;
  transition: background 0.15s ease;
}

.perm-check-label:hover {
  background: rgba(255, 255, 255, 0.04);
}

.perm-check-label input[type="checkbox"] {
  margin-top: 3px;
  cursor: pointer;
  accent-color: #2563eb;
  width: 16px;
  height: 16px;
}

.user-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

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

.users-table th,
.users-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid #334155;
  font-size: 13px;
}

.users-table th {
  background: #1e293b;
  color: #94a3b8;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Responsive Desktop / Mobile User Table Elements */
.user-avatar-badge {
  display: none;
}
.user-email-mobile {
  display: none;
}
.user-role-mobile {
  display: none;
}
.user-perm-label-mobile {
  display: none;
}
.badge-protected-user {
  font-size: 11px;
  color: #94a3b8;
  font-weight: 600;
  padding: 4px 6px;
  text-align: center;
}

.badge-role {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.badge-admin {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-full {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.badge-tracker-rw {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge-tracker-ro {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-both-ro {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.badge-custom {
  background: rgba(148, 163, 184, 0.15);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.perm-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  padding: 2px 7px;
  border-radius: 4px;
}

.perm-pill-active {
  background: rgba(34, 197, 94, 0.12);
  color: #4ade80;
}

.perm-pill-readonly {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
}

.perm-pill-none {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
}

.required-star {
  color: #f87171;
}

/* ==========================================================================
   LIGHT THEME OVERRIDES (Executive Slate-Blue & Cool Gray)
   ========================================================================== */
[data-theme="light"] body {
  background-color: var(--bg-body);
  color: var(--text-main);
}

/* Topbar & Header */
[data-theme="light"] .topbar {
  background: #ffffff;
  border-bottom: 1px solid #94a3b8;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

[data-theme="light"] .brand-title {
  color: #0f172a;
}

[data-theme="light"] .brand-sub {
  color: #2563eb;
  font-weight: 600;
}

[data-theme="light"] .main-tabs {
  background: #e2e8f0;
  border-color: #cbd5e1;
}

[data-theme="light"] .tab-btn {
  color: #334155;
  font-weight: 600;
}

[data-theme="light"] .tab-btn:hover {
  color: #1d4ed8;
  background: rgba(255, 255, 255, 0.7);
}

[data-theme="light"] .tab-btn.active {
  background: #2563eb;
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

[data-theme="light"] .tab-pill {
  background: rgba(255, 255, 255, 0.28);
  color: #ffffff;
}

[data-theme="light"] .user-chip {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

[data-theme="light"] .user-email {
  color: #0f172a;
  font-weight: 600;
}

[data-theme="light"] .sync-badge {
  background: #dcfce7;
  color: #15803d;
  border-color: #86efac;
  font-weight: 700;
}

/* Stats / KPI Strip */
[data-theme="light"] .btn-toggle-kpis {
  background: #ffffff;
  border-color: #94a3b8;
  color: #1e293b;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}

[data-theme="light"] .btn-toggle-kpis:hover {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #2563eb;
}

[data-theme="light"] .kpis-summary-pill {
  color: #1d4ed8;
  background: #eff6ff;
  border-color: #93c5fd;
  font-weight: 700;
}

[data-theme="light"] .kpi-card {
  background: #ffffff;
  border: 1px solid #94a3b8;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.05);
}

[data-theme="light"] .kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.1);
}

[data-theme="light"] .kpi-blue {
  background: linear-gradient(135deg, #ffffff 0%, #eff6ff 100%);
  border-color: #93c5fd;
}
[data-theme="light"] .kpi-blue .kpi-label { color: #1d4ed8; }
[data-theme="light"] .kpi-blue .kpi-value { color: #1e40af; }
[data-theme="light"] .kpi-blue .kpi-sub { color: #3b82f6; }

[data-theme="light"] .kpi-emerald {
  background: linear-gradient(135deg, #ffffff 0%, #f0fdf4 100%);
  border-color: #86efac;
}
[data-theme="light"] .kpi-emerald .kpi-label { color: #15803d; }
[data-theme="light"] .kpi-emerald .kpi-value { color: #166534; }
[data-theme="light"] .kpi-emerald .kpi-sub { color: #16a34a; }

[data-theme="light"] .kpi-amber {
  background: linear-gradient(135deg, #ffffff 0%, #fffbeb 100%);
  border-color: #fcd34d;
}
[data-theme="light"] .kpi-amber .kpi-label { color: #b45309; }
[data-theme="light"] .kpi-amber .kpi-value { color: #92400e; }
[data-theme="light"] .kpi-amber .kpi-sub { color: #d97706; }

[data-theme="light"] .kpi-indigo {
  background: linear-gradient(135deg, #ffffff 0%, #eef2ff 100%);
  border-color: #a5b4fc;
}
[data-theme="light"] .kpi-indigo .kpi-label { color: #4338ca; }
[data-theme="light"] .kpi-indigo .kpi-value { color: #3730a3; }
[data-theme="light"] .kpi-indigo .kpi-sub { color: #6366f1; }

[data-theme="light"] .kpi-teal {
  background: linear-gradient(135deg, #ffffff 0%, #f0fdfa 100%);
  border-color: #5eead4;
}
[data-theme="light"] .kpi-teal .kpi-label { color: #0f766e; }
[data-theme="light"] .kpi-teal .kpi-value { color: #115e59; }
[data-theme="light"] .kpi-teal .kpi-sub { color: #0d9488; }

[data-theme="light"] .kpi-slate {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border-color: #94a3b8;
}
[data-theme="light"] .kpi-slate .kpi-label { color: #475569; }
[data-theme="light"] .kpi-slate .kpi-value { color: #1e293b; }
[data-theme="light"] .kpi-slate .kpi-sub { color: #64748b; }

[data-theme="light"] .kpi-savings {
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  border: 1.5px solid #10b981;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
}
[data-theme="light"] .kpi-savings .kpi-label { color: #065f46; font-weight: 800; }
[data-theme="light"] .kpi-savings .kpi-value { color: #047857; font-weight: 800; }
[data-theme="light"] .kpi-savings .kpi-sub { color: #059669; font-weight: 600; }

/* Tracker Toolbar & Filters */
[data-theme="light"] .toolbar-card {
  background: #ffffff;
  border-color: #94a3b8;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
}

[data-theme="light"] .search-box {
  background: #f8fafc;
  border-color: #94a3b8;
}

[data-theme="light"] .search-box:focus-within {
  background: #ffffff;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

[data-theme="light"] .search-box input {
  color: #0f172a;
}

[data-theme="light"] .search-box input::placeholder {
  color: #64748b;
}

[data-theme="light"] .pill {
  background: #ffffff;
  color: #334155;
  border-color: #94a3b8;
  font-weight: 600;
}

[data-theme="light"] .pill:hover {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #2563eb;
}

[data-theme="light"] .pill.active {
  background: #2563eb;
  color: #ffffff;
  border-color: #1d4ed8;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.35);
  font-weight: 700;
}

[data-theme="light"] .pill-hot {
  border-color: #f87171;
  color: #b91c1c;
  background: #fee2e2;
  font-weight: 700;
}

[data-theme="light"] .pill-hot:hover {
  background: #fecaca;
  color: #991b1b;
}

[data-theme="light"] .pill-hot.active {
  background: #dc2626 !important;
  color: #ffffff !important;
  border-color: #b91c1c !important;
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.35);
}

/* Tracker Loads Table */
[data-theme="light"] .table-card {
  background: #ffffff;
  border-color: #94a3b8;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

[data-theme="light"] .loads-table th {
  background: #e2e8f0;
  color: #0f172a;
  font-weight: 700;
  border-bottom: 2px solid #94a3b8;
}

[data-theme="light"] .loads-table td {
  background: #ffffff;
  border-bottom: 1px solid #cbd5e1;
  color: #0f172a;
}

[data-theme="light"] .loads-table tr:nth-child(even) td {
  background: #f8fafc;
}

[data-theme="light"] .loads-table tr:hover td {
  background: #e0f2fe;
}

[data-theme="light"] .row-num-chip {
  background: #f1f5f9;
  color: #1e293b;
  border: 1px solid #cbd5e1;
  font-weight: 700;
}

[data-theme="light"] .row-num-hot {
  background: #fee2e2 !important;
  color: #b91c1c !important;
  border-color: #fca5a5 !important;
}

[data-theme="light"] .po-badge {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(29, 78, 216, 0.08);
}

[data-theme="light"] .product-tag {
  color: #2563eb;
  font-weight: 600;
}

[data-theme="light"] .loc-primary {
  color: #0f172a;
  font-weight: 600;
}

[data-theme="light"] .loc-sub {
  color: #475569;
}

[data-theme="light"] .status-select,
[data-theme="light"] .status-badge {
  background: #ffffff;
  color: #0f172a;
  border-color: #cbd5e1;
}

[data-theme="light"] .status-Ready {
  background: #dcfce7;
  color: #15803d;
  border-color: #86efac;
  font-weight: 700;
}
[data-theme="light"] .status-Not-Ready {
  background: #fef3c7;
  color: #b45309;
  border-color: #fde68a;
  font-weight: 700;
}
[data-theme="light"] .status-Assigned {
  background: #dbeafe;
  color: #1d4ed8;
  border-color: #93c5fd;
  font-weight: 700;
}
[data-theme="light"] .status-Picked-Up {
  background: #f3e8ff;
  color: #7e22ce;
  border-color: #d8b4fe;
  font-weight: 700;
}
[data-theme="light"] .status-Delivered {
  background: #ccfbf1;
  color: #0f766e;
  border-color: #99f6e4;
  font-weight: 700;
}
[data-theme="light"] .status-Archived {
  background: #f1f5f9;
  color: #475569;
  border-color: #cbd5e1;
  font-weight: 700;
}

[data-theme="light"] .status-select option {
  background: #ffffff;
  color: #0f172a;
}
[data-theme="light"] .status-select option.status-opt-Ready { color: #15803d; font-weight: 700; }
[data-theme="light"] .status-select option.status-opt-Not-Ready { color: #b45309; font-weight: 700; }
[data-theme="light"] .status-select option.status-opt-Assigned { color: #1d4ed8; font-weight: 700; }
[data-theme="light"] .status-select option.status-opt-Picked-Up { color: #7e22ce; font-weight: 700; }
[data-theme="light"] .status-select option.status-opt-Delivered { color: #0f766e; font-weight: 700; }
[data-theme="light"] .status-select option.status-opt-Archived { color: #475569; font-weight: 700; }

/* Rate Booked & Savings in Light Theme */
[data-theme="light"] .rate-booked-col {
  color: #92400e;
  font-weight: 700;
}

[data-theme="light"] .rate-booked-pill {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  padding: 3px 9px;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
  border-radius: 6px;
  font-weight: 800;
  font-size: 13px;
  box-shadow: 0 1px 2px rgba(180, 83, 9, 0.08);
  letter-spacing: 0.2px;
}

[data-theme="light"] .savings-pos {
  color: #15803d;
  font-weight: 700;
}

[data-theme="light"] .savings-neg {
  color: #b91c1c;
  font-weight: 700;
}

[data-theme="light"] .savings-badge {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  padding: 3px 9px;
  border-radius: 6px;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.2px;
}

[data-theme="light"] .savings-badge.savings-pos {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
  box-shadow: 0 1px 2px rgba(22, 163, 74, 0.08);
}

[data-theme="light"] .savings-badge.savings-neg {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
  box-shadow: 0 1px 2px rgba(220, 38, 38, 0.08);
}

[data-theme="light"] .carrier-emailed-badge {
  color: #0284c7;
  background: #e0f2fe;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid #7dd3fc;
  font-weight: 700;
}

[data-theme="light"] .tarp-must {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fca5a5;
  font-weight: 700;
}

[data-theme="light"] .tarp-no {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
  font-weight: 600;
}

/* Secondary & Ghost Buttons */
[data-theme="light"] .btn-secondary {
  background: #ffffff;
  color: #1e293b;
  border-color: #94a3b8;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

[data-theme="light"] .btn-secondary:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #64748b;
}

[data-theme="light"] .btn-ghost {
  color: #334155;
  border-color: #94a3b8;
  background: #ffffff;
}

[data-theme="light"] .btn-ghost:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #64748b;
}

[data-theme="light"] .btn-danger-outline {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #f87171;
}

[data-theme="light"] .btn-danger-outline:hover {
  background: #fecaca;
  color: #991b1b;
}

/* Builder Form Panel */
[data-theme="light"] .builder-form-panel {
  background: #ffffff;
  border-color: #94a3b8;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

[data-theme="light"] .builder-paper-pane,
[data-theme="light"] .sheet-preview-pane,
[data-theme="light"] .sheet-paper-wrapper {
  background: #94a3b8;
}

[data-theme="light"] .preview-toolbar {
  background: #e2e8f0;
  border-color: #94a3b8;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

[data-theme="light"] .preview-collapsed-banner {
  background: #ffffff;
  border-color: #94a3b8;
}

[data-theme="light"] .preview-collapsed-banner button {
  color: #1d4ed8;
  font-weight: 600;
}

[data-theme="light"] .preview-collapsed-banner button:hover {
  color: #1e40af;
}

[data-theme="light"] .recall-bar {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

[data-theme="light"] .recall-label {
  color: #1e293b;
  font-weight: 600;
}

[data-theme="light"] .recall-select-row select,
[data-theme="light"] #select-recall-load {
  background: #ffffff;
  color: #0f172a;
  border-color: #cbd5e1;
}

[data-theme="light"] .recall-select-row select option,
[data-theme="light"] #select-recall-load option {
  background: #ffffff;
  color: #0f172a;
}

[data-theme="light"] .recall-select-row select option[value="__view_more__"],
[data-theme="light"] #select-recall-load option[value="__view_more__"] {
  background: #dbeafe;
  color: #1e40af;
}

[data-theme="light"] .mode-new {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
  font-weight: 700;
}

[data-theme="light"] .mode-recall {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  font-weight: 700;
}

[data-theme="light"] .row-info-badge {
  color: #475569;
}

[data-theme="light"] .form-section {
  background: #f8fafc;
  border-color: #e2e8f0;
}

[data-theme="light"] .section-title {
  color: #1d4ed8;
  font-weight: 700;
}

[data-theme="light"] .savings-pill {
  background: #dcfce7;
  border: 1px solid #86efac;
  color: #15803d;
  font-weight: 800;
  box-shadow: 0 1px 3px rgba(22, 163, 74, 0.08);
}

[data-theme="light"] .savings-pill.savings-neg {
  background: #fee2e2;
  border: 1px solid #fca5a5;
  color: #b91c1c;
  box-shadow: 0 1px 3px rgba(220, 38, 38, 0.08);
}

[data-theme="light"] #preview-rate-booked-val {
  color: #059669 !important;
  font-weight: 800;
}

[data-theme="light"] .form-group label,
[data-theme="light"] .form-label-row label {
  color: #1e293b;
}

[data-theme="light"] .lbl-hint {
  color: #64748b;
}

[data-theme="light"] .form-group input,
[data-theme="light"] .form-group select,
[data-theme="light"] .form-group textarea {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #0f172a;
}

[data-theme="light"] .form-group input[type="date"] {
  color-scheme: light;
}

[data-theme="light"] .form-group input:focus,
[data-theme="light"] .form-group select:focus,
[data-theme="light"] .form-group textarea:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

[data-theme="light"] .form-group input:disabled,
[data-theme="light"] .form-group input[disabled],
[data-theme="light"] .form-group select:disabled,
[data-theme="light"] .form-group select[disabled],
[data-theme="light"] .form-group textarea:disabled,
[data-theme="light"] .form-group textarea[disabled] {
  background: #e2e8f0 !important;
  color: #94a3b8 !important;
  border-color: #cbd5e1 !important;
}

[data-theme="light"] .quick-chips .chip {
  background: #dbe4ee;
  color: #1e293b;
  border-color: #cbd5e1;
}

[data-theme="light"] .quick-chips .chip:hover {
  background: #cbd5e1;
  color: #0f172a;
}

[data-theme="light"] .quick-chips .chip.active {
  background: #2563eb;
  color: #ffffff;
  border-color: #1d4ed8;
}

/* Modals */
[data-theme="light"] .modal-backdrop {
  background: rgba(15, 23, 42, 0.5);
}

[data-theme="light"] .modal-card {
  background: #f1f5f9;
  border-color: #cbd5e1;
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.25);
}

[data-theme="light"] .modal-header {
  background: #e2e8f0;
  border-bottom: 1px solid #cbd5e1;
}

[data-theme="light"] .modal-title {
  color: #0f172a;
}

[data-theme="light"] .modal-subtitle {
  color: #475569;
}

[data-theme="light"] .modal-body {
  color: #1e293b;
}

[data-theme="light"] .duplicate-details-card {
  background: #e2e8f0;
  border-color: #cbd5e1;
}

[data-theme="light"] .email-sender-callout {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1e40af;
}

[data-theme="light"] .email-load-preview {
  background: #e2e8f0;
  border-color: #cbd5e1;
}

[data-theme="light"] .preview-secure-badge {
  background: #dcfce7;
  color: #15803d;
  border-color: #86efac;
}

[data-theme="light"] .modal-close-btn:hover {
  background: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .dup-label {
  color: #475569;
}

[data-theme="light"] .dup-val {
  color: #1e40af;
}

[data-theme="light"] .modal-question {
  color: #0f172a;
}

[data-theme="light"] .modal-footer {
  background: #e2e8f0;
  border-top: 1px solid #cbd5e1;
}

/* User Management */
[data-theme="light"] .users-header-card {
  background: #ffffff;
  border-color: #94a3b8;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
}

[data-theme="light"] .users-header-info h2 {
  color: #0f172a;
}

[data-theme="light"] .users-header-info .panel-sub {
  color: #475569;
}

[data-theme="light"] .user-edit-card {
  background: #ffffff;
  border-color: #2563eb;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

[data-theme="light"] .permissions-card {
  background: #e2e8f0;
  border-color: #94a3b8;
}

[data-theme="light"] .perm-title {
  color: #0f172a;
}

[data-theme="light"] .users-table {
  background: #ffffff;
}

[data-theme="light"] .users-table th {
  background: #e2e8f0;
  color: #0f172a;
  border-bottom: 2px solid #94a3b8;
}

[data-theme="light"] .users-table td {
  background: #ffffff;
  border-bottom: 1px solid #cbd5e1;
  color: #0f172a;
}

@media (max-width: 768px) {
  [data-theme="light"] .users-header-card {
    background: #f8fafc;
    border-color: #cbd5e1;
  }

  [data-theme="light"] .users-table tr.user-row-card {
    background: #ffffff !important;
    border-color: #cbd5e1 !important;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08) !important;
  }

  [data-theme="light"] .user-col-identity {
    border-bottom-color: #e2e8f0 !important;
  }

  [data-theme="light"] .user-display-name {
    color: #0f172a !important;
  }

  [data-theme="light"] .user-email-mobile {
    color: #64748b !important;
  }

  [data-theme="light"] .user-col-perm {
    background: #f8fafc !important;
    border-color: #e2e8f0 !important;
  }

  [data-theme="light"] .user-perm-label-mobile {
    color: #64748b !important;
  }

  [data-theme="light"] .user-col-actions {
    border-top-color: #e2e8f0 !important;
  }

  [data-theme="light"] .perm-col {
    background: #ffffff;
    border-color: #cbd5e1;
  }

  [data-theme="light"] .badge-protected-user {
    background: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
    color: #475569 !important;
  }
}

/* Confirmation Sheet Strict Isolation */
[data-theme="light"] .confirmation-sheet {
  background: #ffffff !important;
  color: #111827 !important;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.18) !important;
}

/* Toast Notification in Light Theme */
[data-theme="light"] .toast {
  background: #0f172a;
  color: #ffffff;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.35);
}

/* Mobile Theme Toggle Adjustments */
@media (max-width: 640px) {
  .theme-control-label {
    display: none;
  }
  .btn-theme-toggle {
    padding: 1px 2px;
  }
  .theme-toggle-option {
    padding: 3px 6px;
    font-size: 10.5px;
  }
}

@media print {
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  html,
  body {
    background: #ffffff !important;
    color: #111827 !important;
    margin: 0 !important;
    padding: 0 !important;
    height: auto !important;
  }
  .no-print,
  #view-tracker,
  .builder-form-panel,
  .preview-toolbar,
  .topbar,
  .toast {
    display: none !important;
  }
  #app-shell,
  #view-builder,
  #view-builder.hidden,
  .builder-layout,
  .builder-preview-panel,
  .sheet-paper-wrapper {
    display: block !important;
    position: static !important;
    padding: 0 !important;
    margin: 0 auto !important;
    background: #ffffff !important;
    box-shadow: none !important;
    border: none !important;
    overflow: visible !important;
  }
  .confirmation-sheet {
    width: 100% !important;
    max-width: 760px !important;
    min-height: 0 !important;
    height: auto !important;
    margin: 0 auto !important;
    box-shadow: none !important;
    padding: 10px 16px !important;
    border: none !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    page-break-after: avoid !important;
  }
}
