/* ── Reset & Base ────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #eef2f7;
  --surface:   #ffffff;
  --surface2:  #f8fafc;
  --border:    #e2e8f0;
  --text:      #0f172a;
  --text2:     #64748b;
  --primary:   #2563eb;
  --primary-h: #1d4ed8;
  --success:   #16a34a;
  --warning:   #d97706;
  --danger:    #dc2626;
  --navy:      #0c1f40;
  --r:         14px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.14), 0 4px 8px rgba(0,0,0,0.06);
}

body {
  font-family: -apple-system, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  min-height: 100vh;
}

/* ── Navigation ──────────────────────────────────────────────────────────── */
.nav {
  background: linear-gradient(135deg, #0c1f40 0%, #1a2f50 60%, #1e293b 100%);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 0 rgba(255,255,255,0.05), 0 4px 20px rgba(0,0,0,0.35);
}
.nav-left   { display: flex; align-items: center; gap: 12px; }
.nav-icon   { font-size: 24px; }
.nav-title  { font-size: 16px; font-weight: 800; color: #f1f5f9; letter-spacing: -0.3px; }
.nav-badge  {
  font-size: 9px; font-weight: 700; color: #94a3b8;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.1);
  padding: 3px 10px; border-radius: 20px;
  letter-spacing: 0.6px; text-transform: uppercase;
}
.nav-link {
  font-size: 12px; font-weight: 600; color: #94a3b8; text-decoration: none;
  padding: 7px 16px; border: 1px solid rgba(255,255,255,0.1); border-radius: 8px;
  transition: all 0.15s; background: rgba(255,255,255,0.05);
}
.nav-link:hover { color: #f1f5f9; border-color: rgba(255,255,255,0.22); background: rgba(255,255,255,0.12); }

/* ── Hero ────────────────────────────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, #0c1f40 0%, #1a3461 40%, #0f172a 100%);
  padding: 32px 24px;
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: '';
  position: absolute;
  top: -60%; right: -5%;
  width: 520px; height: 520px;
  background: radial-gradient(circle, rgba(37,99,235,0.14) 0%, transparent 70%);
  pointer-events: none;
}
.hero-inner {
  max-width: 1160px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}
.hero-text h1  { font-size: 24px; font-weight: 900; color: #f1f5f9; margin-bottom: 5px; letter-spacing: -0.5px; }
.hero-text p   { font-size: 13px; color: #94a3b8; line-height: 1.6; }
.hero-text strong { color: #93c5fd; }

.stats-row  { display: flex; gap: 12px; flex-wrap: wrap; }
.stat-card  {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  padding: 14px 22px;
  min-width: 94px;
  text-align: center;
  transition: background 0.2s, transform 0.15s;
}
.stat-card:hover {
  background: rgba(255,255,255,0.11);
  transform: translateY(-2px);
}
.stat-num { font-size: 28px; font-weight: 900; color: #f1f5f9; line-height: 1; letter-spacing: -0.5px; }
.stat-lbl { font-size: 10px; color: #64748b; margin-top: 5px; text-transform: uppercase; letter-spacing: 0.6px; font-weight: 700; }

/* ── Layout ──────────────────────────────────────────────────────────────── */
.portal-layout {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 20px;
  padding: 24px;
  max-width: 1160px;
  margin: 0 auto;
}
@media (max-width: 860px) { .portal-layout { grid-template-columns: 1fr; } }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.left-panel { display: flex; flex-direction: column; gap: 16px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s;
}
.card:hover { box-shadow: var(--shadow-md); }

.card-head {
  font-size: 11px; font-weight: 800; color: var(--text2);
  text-transform: uppercase; letter-spacing: 0.6px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

/* ── Add-item form ───────────────────────────────────────────────────────── */
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.dims-row  { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; align-items: end; }

.field { display: flex; flex-direction: column; gap: 4px; }
.field label {
  font-size: 10px; font-weight: 700; color: var(--text2);
  text-transform: uppercase; letter-spacing: 0.4px;
}
.field input, .field select {
  border: 1.5px solid var(--border); border-radius: 8px;
  padding: 8px 10px; font-size: 13px; color: var(--text);
  background: var(--surface2); outline: none;
  transition: border-color 0.15s, box-shadow 0.15s; width: 100%;
}
.field input:focus, .field select:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.btn-add {
  width: 100%; padding: 9px 4px;
  background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
  color: #fff;
  border: none; border-radius: 8px;
  font-size: 13px; font-weight: 700;
  cursor: pointer; transition: opacity 0.15s, transform 0.1s; white-space: nowrap;
  box-shadow: 0 2px 10px rgba(37,99,235,0.35);
}
.btn-add:hover  { opacity: 0.9; }
.btn-add:active { transform: scale(0.98); }

/* ── Item list ───────────────────────────────────────────────────────────── */
.item-list { display: flex; flex-direction: column; gap: 7px; max-height: 300px; overflow-y: auto; }
.item-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 10px;
  transition: border-color 0.15s;
}
.item-row:hover { border-color: #cbd5e1; }
.item-row-info { flex: 1; min-width: 0; }
.item-row-name { font-size: 13px; font-weight: 700; color: var(--text); }
.item-row-meta { font-size: 10px; color: var(--text2); margin-top: 2px; }
.item-row-cust { font-size: 10px; font-weight: 700; margin-top: 3px; }
.btn-remove {
  background: transparent; border: 1px solid #fecaca;
  color: var(--danger); border-radius: 6px;
  padding: 4px 10px; font-size: 11px; cursor: pointer;
  transition: background 0.15s; flex-shrink: 0; margin-left: 10px;
}
.btn-remove:hover { background: #fee2e2; }

/* ── Context lists ───────────────────────────────────────────────────────── */
.ctx-list { display: flex; flex-direction: column; gap: 7px; }
.ctx-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 10px;
  transition: border-color 0.15s;
}
.ctx-row:hover { border-color: #cbd5e1; }
.ctx-dot { width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0; box-shadow: 0 0 0 2px rgba(0,0,0,0.06); }
.ctx-name { font-size: 13px; font-weight: 700; }
.ctx-meta { font-size: 10px; color: var(--text2); margin-top: 2px; }
.ctx-right { margin-left: auto; font-size: 10px; color: var(--text2); white-space: nowrap; }

.adv-link {
  display: block; margin-top: 12px;
  font-size: 11px; font-weight: 600; color: var(--primary); text-decoration: none;
  padding: 7px 12px;
  background: rgba(37,99,235,0.04);
  border: 1px solid rgba(37,99,235,0.12);
  border-radius: 8px;
  transition: background 0.15s;
  text-align: center;
}
.adv-link:hover { background: rgba(37,99,235,0.09); }

/* ── Payment badges & controls ───────────────────────────────────────────── */
.pay-badge   { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 10px; font-weight: 700; white-space: nowrap; }
.pay-paid    { background: #dcfce7; color: #15803d; }
.pay-pending { background: #fef9c3; color: #a16207; }
.pay-overdue { background: #fee2e2; color: var(--danger); }

.pay-info { font-size: 10px; color: var(--text2); margin-top: 3px; }
.pay-amount { font-weight: 700; color: var(--text); }

.pay-status-sel {
  font-size: 11px; padding: 3px 8px;
  border: 1.5px solid var(--border); border-radius: 7px;
  background: var(--surface2); color: var(--text);
  cursor: pointer; outline: none;
  transition: border-color 0.15s;
}
.pay-status-sel:focus { border-color: var(--primary); }

/* ── Right panel ─────────────────────────────────────────────────────────── */
.right-panel { display: flex; flex-direction: column; gap: 16px; }

.optimize-zone {
  background: linear-gradient(135deg, #0c1f40 0%, #1a2f50 60%, #1e293b 100%);
  border: 1px solid rgba(37,99,235,0.2);
  border-radius: var(--r);
  padding: 24px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}
.optimize-zone::before {
  content: '';
  position: absolute;
  top: -50%; left: -15%;
  width: 320px; height: 320px;
  background: radial-gradient(circle, rgba(37,99,235,0.15) 0%, transparent 70%);
  pointer-events: none;
}
.save-status { font-size: 11px; color: #94a3b8; min-height: 16px; margin-bottom: 10px; position: relative; z-index: 1; }
.save-status.ok  { color: #4ade80; }
.save-status.err { color: #f87171; }

.btn-optimize {
  width: 100%; padding: 18px 24px;
  background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
  color: #fff; border: none; border-radius: 12px;
  font-size: 20px; font-weight: 900; cursor: pointer;
  letter-spacing: 0.1px;
  transition: opacity 0.15s, transform 0.1s, box-shadow 0.15s;
  box-shadow: 0 4px 24px rgba(37,99,235,0.55), 0 0 0 1px rgba(37,99,235,0.25);
  position: relative; z-index: 1;
}
.btn-optimize:hover   { opacity: 0.92; box-shadow: 0 6px 32px rgba(37,99,235,0.65); }
.btn-optimize:active  { transform: scale(0.98); }
.btn-optimize:disabled{ opacity: 0.4; cursor: not-allowed; box-shadow: none; }

.opt-hint { font-size: 11px; color: #64748b; margin-top: 12px; position: relative; z-index: 1; line-height: 1.6; }

/* ── Empty state ─────────────────────────────────────────────────────────── */
.empty-state {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 70px 20px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.empty-icon { font-size: 54px; margin-bottom: 14px; }
.empty-text { font-size: 14px; color: var(--text2); }

/* ── Summary strip ───────────────────────────────────────────────────────── */
.summary-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 4px;
}
.sum-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 14px 16px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.sum-num { font-size: 24px; font-weight: 900; letter-spacing: -0.4px; }
.sum-lbl { font-size: 10px; color: var(--text2); text-transform: uppercase; margin-top: 3px; font-weight: 700; letter-spacing: 0.5px; }

/* ── Savings banner ──────────────────────────────────────────────────────── */
.savings-banner {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border: 1px solid #86efac;
  border-radius: var(--r);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.savings-icon   { font-size: 24px; }
.savings-title  { font-size: 13px; font-weight: 800; color: #15803d; }
.savings-sub    { font-size: 11px; color: #166534; margin-top: 3px; }
.savings-amount { margin-left: auto; font-size: 22px; font-weight: 900; color: #15803d; white-space: nowrap; letter-spacing: -0.4px; }

/* ── Warn / unplaced ─────────────────────────────────────────────────────── */
.warn-box {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: var(--r);
  padding: 13px 16px;
}
.warn-title { font-size: 12px; font-weight: 800; color: #c2410c; margin-bottom: 6px; }
.warn-item  { font-size: 11px; color: #9a3412; margin-top: 4px; }

.unplaced-box {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--r);
  padding: 13px 16px;
}
.unplaced-title { font-size: 12px; font-weight: 800; color: var(--danger); margin-bottom: 6px; }
.unplaced-item  { font-size: 11px; color: #991b1b; margin-top: 4px; }

/* ── Truck result card ───────────────────────────────────────────────────── */
.truck-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.truck-card-head {
  background: linear-gradient(135deg, #0c1f40 0%, #1a2f50 60%, #1e293b 100%);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.truck-card-name { font-size: 15px; font-weight: 900; color: #f1f5f9; letter-spacing: -0.2px; }
.truck-card-sub  { font-size: 11px; color: #64748b; margin-top: 3px; }
.truck-pills     { display: flex; gap: 6px; flex-shrink: 0; }
.pill { padding: 4px 11px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.pill-blue   { background: rgba(59,130,246,0.25);  color: #93c5fd; }
.pill-green  { background: rgba(34,197,94,0.25);   color: #86efac; }
.pill-yellow { background: rgba(245,158,11,0.25);  color: #fcd34d; }
.pill-red    { background: rgba(239,68,68,0.25);   color: #fca5a5; }

.truck-card-body { padding: 16px 18px; }

/* Progress bars */
.prog { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.prog-label { font-size: 11px; color: var(--text2); width: 65px; flex-shrink: 0; font-weight: 600; }
.prog-track { flex: 1; height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.prog-fill  { height: 100%; border-radius: 4px; transition: width 0.6s cubic-bezier(0.4,0,0.2,1); }
.prog-pct   { font-size: 12px; font-weight: 800; width: 36px; text-align: right; }

/* Zone delivery rows */
.zones-section { margin-top: 14px; }
.zones-label {
  font-size: 10px; font-weight: 800; color: var(--text2);
  text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px;
}
.zone-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 10px; margin-bottom: 6px;
  transition: border-color 0.15s;
}
.zone-row:hover { border-color: #cbd5e1; }
.zone-row-icon { font-size: 14px; }
.zone-row-name { font-size: 12px; font-weight: 800; color: var(--text); }
.zone-row-custs { font-size: 11px; color: var(--text2); margin-top: 2px; }
.zone-row-dist  {
  font-size: 10px; font-weight: 700; color: var(--primary); margin-left: auto; white-space: nowrap;
  background: rgba(37,99,235,0.07); border: 1px solid rgba(37,99,235,0.14);
  padding: 2px 9px; border-radius: 12px;
}

/* Trip cost footer inside truck card */
.trip-cost {
  margin-top: 12px;
  padding: 12px 15px;
  background: linear-gradient(135deg, rgba(37,99,235,0.04) 0%, rgba(124,58,237,0.04) 100%);
  border: 1px solid rgba(37,99,235,0.15);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: space-between;
}
.trip-cost-label   { font-size: 11px; color: var(--text2); font-weight: 600; }
.trip-cost-savings { font-size: 11px; font-weight: 700; color: var(--success); margin-top: 3px; }
.trip-cost-value   { font-size: 20px; font-weight: 900; color: var(--primary); letter-spacing: -0.3px; }

/* ── Fleet total footer ──────────────────────────────────────────────────── */
.fleet-total {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px 20px;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: var(--shadow-sm);
}
.fleet-total-label { font-size: 13px; font-weight: 800; color: var(--text2); }
.fleet-total-sub   { font-size: 11px; color: var(--text2); margin-top: 3px; }
.fleet-total-value { font-size: 26px; font-weight: 900; color: var(--text); letter-spacing: -0.5px; }

/* ── Pay Now button ──────────────────────────────────────────────────────── */
.btn-pay-now {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 13px;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #111;
  border: none; border-radius: 7px;
  font-size: 11px; font-weight: 800;
  cursor: pointer; white-space: nowrap;
  transition: opacity 0.15s, transform 0.1s;
  box-shadow: 0 2px 8px rgba(245,158,11,0.3);
}
.btn-pay-now:hover  { opacity: 0.9; }
.btn-pay-now:active { transform: scale(0.97); }

/* ── Payment Modal ───────────────────────────────────────────────────────── */
.pay-modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 999;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(5px);
}
.pay-modal-overlay.open { display: flex; }

.pay-modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  width: 100%; max-width: 440px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.32);
  overflow: hidden;
  animation: modalIn 0.22s cubic-bezier(0.4,0,0.2,1);
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(-20px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.pay-modal-head {
  background: linear-gradient(135deg, #0c1f40 0%, #1e293b 100%);
  padding: 20px 22px;
  display: flex; align-items: flex-start; justify-content: space-between;
}
.pay-modal-title { font-size: 17px; font-weight: 900; color: #f1f5f9; }
.pay-modal-cust  { font-size: 12px; color: #94a3b8; margin-top: 4px; }
.pay-modal-close {
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.1); color: #94a3b8;
  font-size: 16px; cursor: pointer; padding: 4px 8px; line-height: 1; border-radius: 6px;
  transition: all 0.15s;
}
.pay-modal-close:hover { color: #f1f5f9; background: rgba(255,255,255,0.16); }

.pay-modal-body { padding: 24px 22px; }

.pay-modal-amount-row {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 20px;
}
.pay-modal-amount-label { font-size: 11px; color: var(--text2); font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.pay-modal-terms-line   { font-size: 11px; color: var(--text2); margin-top: 4px; }
.pay-modal-amount-value { font-size: 30px; font-weight: 900; color: var(--primary); letter-spacing: -0.5px; }

#paypal-button-container { min-height: 48px; margin-bottom: 12px; }
.pay-modal-msg { min-height: 20px; text-align: center; }

.pay-success {
  text-align: center;
  padding: 22px 12px;
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border: 1px solid #86efac;
  border-radius: 12px;
  margin-bottom: 12px;
}
.pay-success-icon  { font-size: 40px; margin-bottom: 10px; }
.pay-success-title { font-size: 17px; font-weight: 900; color: #15803d; }
.pay-success-sub   { font-size: 11px; color: #166534; margin-top: 5px; }

.pay-modal-secure {
  text-align: center;
  font-size: 10px; color: var(--text2);
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

/* ── Scrollbar ───────────────────────────────────────────────────────────── */
::-webkit-scrollbar       { width: 5px; }
::-webkit-scrollbar-track { background: var(--surface2); }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ── Category picker wizard ──────────────────────────────────────────────── */
.cat-pick-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 4px; }
.cat-pick-btn {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 18px 12px; border-radius: 12px; border: 1.5px solid var(--border);
  background: var(--surface2); cursor: pointer; transition: all 0.15s;
  font-size: 13px; width: 100%;
}
.cat-pick-btn:hover {
  border-color: var(--primary); background: #eff6ff;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.cat-pick-icon { font-size: 28px; line-height: 1; }
.cat-pick-btn > span { font-size: 14px; font-weight: 800; color: var(--text); text-align: center; }
.cat-pick-btn small  { font-size: 10px; color: var(--text2); text-align: center; line-height: 1.4; }

.cat-back-btn {
  width: 100%; padding: 9px; border-radius: 8px; border: 1.5px solid var(--border);
  background: var(--surface2); color: var(--text2); font-size: 12px; font-weight: 700;
  cursor: pointer; transition: background 0.15s; height: 38px;
}
.cat-back-btn:hover { background: var(--border); }

.custom-item-hint {
  font-size: 12px; color: var(--text2); margin-bottom: 10px;
  display: flex; align-items: center; gap: 8px;
}
.custom-item-btn {
  background: none; border: 1.5px dashed var(--accent); color: var(--accent);
  border-radius: 6px; padding: 3px 10px; font-size: 12px; font-weight: 700;
  cursor: pointer; transition: background 0.15s;
}
.custom-item-btn:hover { background: rgba(99,102,241,0.08); }

/* ── Photo Scan button ───────────────────────────────────────────────────── */
.scan-photo-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; margin-top: 10px; padding: 11px 16px;
  border-radius: 10px; border: 1.5px dashed #2563eb;
  background: #eff6ff; color: #2563eb;
  font-size: 13px; font-weight: 700; cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.scan-photo-btn:hover { background: #dbeafe; border-color: #1d4ed8; }

/* ── Photo Scan Modal ────────────────────────────────────────────────────── */
.scan-modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.55); z-index: 500;
  align-items: center; justify-content: center; padding: 16px;
}
.scan-modal-overlay.open { display: flex; }
.scan-modal-card {
  background: var(--surface); border-radius: 18px;
  width: 100%; max-width: 520px; max-height: 90vh;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.22s cubic-bezier(0.4,0,0.2,1);
}
.scan-modal-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 20px 22px 16px; border-bottom: 1px solid var(--border);
}
.scan-modal-title { font-size: 17px; font-weight: 900; color: var(--text); }
.scan-modal-sub   { font-size: 12px; color: var(--text2); margin-top: 3px; }
.scan-modal-close {
  background: none; border: none; font-size: 18px; color: var(--text2);
  cursor: pointer; padding: 4px 8px; border-radius: 6px; line-height: 1;
}
.scan-modal-close:hover { background: var(--border); color: var(--text); }
.scan-modal-body  { flex: 1; overflow-y: auto; padding: 18px 22px; }
.scan-modal-footer {
  display: flex; gap: 10px; padding: 14px 22px;
  border-top: 1px solid var(--border);
}

.scan-preview-wrap { margin-bottom: 14px; border-radius: 10px; overflow: hidden; background: #f1f5f9; }
.scan-preview-img  { width: 100%; max-height: 220px; object-fit: contain; display: block; }

.scan-loading {
  display: flex; flex-direction: column; align-items: center;
  padding: 32px 16px; gap: 14px; color: var(--text2);
  font-size: 13px; text-align: center;
}
.scan-spinner {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--primary);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.scan-loading-text { line-height: 1.6; }
.scan-loading-text small { font-size: 11px; color: var(--text2); }

.scan-no-results {
  display: flex; flex-direction: column; align-items: center;
  padding: 28px 16px; text-align: center;
}

.scan-results-header {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; font-weight: 700; color: var(--text2);
  text-transform: uppercase; letter-spacing: 0.4px;
  margin-bottom: 10px;
}
.scan-select-all-label { display: flex; align-items: center; gap: 6px; font-weight: 600; cursor: pointer; }

.scan-items-list { display: flex; flex-direction: column; gap: 8px; }
.scan-item-card {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; border-radius: 10px;
  border: 1.5px solid var(--border); background: var(--surface2);
  transition: border-color 0.15s;
}
.scan-item-card:has(.scan-item-cb:checked) { border-color: var(--primary); background: #eff6ff; }
.scan-item-check-wrap { padding-top: 2px; }
.scan-item-check-wrap input { width: 16px; height: 16px; cursor: pointer; accent-color: var(--primary); }
.scan-item-body  { flex: 1; min-width: 0; }
.scan-item-name  { font-size: 14px; font-weight: 800; color: var(--text); margin-bottom: 4px; }
.scan-item-dims  { font-size: 12px; color: var(--text2); line-height: 1.5; }
.scan-item-pkg   { font-size: 11px; color: var(--text2); margin-top: 4px; font-style: italic; }
.scan-tag        { display: inline-block; background: #e2e8f0; color: #475569; border-radius: 4px; padding: 1px 6px; font-size: 10px; font-weight: 700; }
.scan-tag-warn   { background: #fef3c7; color: #92400e; }

.scan-retake-btn {
  flex: 1; padding: 10px; border-radius: 8px; border: 1.5px solid var(--border);
  background: var(--surface2); color: var(--text); font-size: 13px; font-weight: 700;
  cursor: pointer; transition: background 0.15s;
}
.scan-retake-btn:hover { background: var(--border); }
.scan-add-btn {
  flex: 2; padding: 10px 18px; border-radius: 8px; border: none;
  background: var(--primary); color: #fff; font-size: 13px; font-weight: 800;
  cursor: pointer; transition: opacity 0.15s;
}
.scan-add-btn:hover    { opacity: 0.9; }
.scan-add-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Nav right (auth) ────────────────────────────────────────────────────── */
.nav-right { display: flex; align-items: center; gap: 10px; }
.nav-auth-btn {
  font-size: 13px; font-weight: 700; color: #fff; cursor: pointer;
  padding: 7px 18px; border-radius: 8px; border: none;
  background: var(--primary); transition: background 0.15s;
}
.nav-auth-btn:hover { background: var(--primary-h); }
.nav-user-row  { display: flex; align-items: center; gap: 10px; }
.nav-user-email { font-size: 12px; font-weight: 700; color: #f1f5f9; }
.nav-logout-btn {
  font-size: 12px; font-weight: 600; color: #94a3b8; cursor: pointer;
  padding: 6px 14px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.07); transition: all 0.15s;
}
.nav-logout-btn:hover { color: #f1f5f9; background: rgba(255,255,255,0.14); }

/* ── Portal two-column layout ────────────────────────────────────────────── */
.portal-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  max-width: 1100px;
  margin: 28px auto;
  padding: 0 20px;
  position: relative;
}
@media (max-width: 720px) {
  .portal-two-col { grid-template-columns: 1fr; }
}
.portal-col-left, .portal-col-right { min-width: 0; }

/* Right panel cargo list card */
.cargo-list-card { display: flex; flex-direction: column; }

/* Summary strip at top of right panel */
.list-summary-strip {
  display: flex; align-items: center;
  background: var(--navy); border-radius: 10px;
  padding: 12px 16px; margin-bottom: 14px; gap: 0;
}
.lss-cell {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.lss-cell span { font-size: 18px; font-weight: 900; color: #f1f5f9; line-height: 1; }
.lss-cell small { font-size: 9px; color: #64748b; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 700; }
.lss-sep { width: 1px; height: 28px; background: #1e3a5f; flex-shrink: 0; }

/* Empty state message in right panel */
.list-empty-msg {
  font-size: 12px; color: var(--text2);
  text-align: center; padding: 40px 16px;
  border: 1.5px dashed var(--border); border-radius: 10px;
  margin: 4px 0;
}

/* Item list max-height so it scrolls */
.item-list { display: flex; flex-direction: column; gap: 7px; max-height: 420px; overflow-y: auto; }

/* Proceed bar */
.proceed-bar { margin-top: 14px; }
.btn-proceed {
  width: 100%; padding: 13px;
  background: linear-gradient(135deg, var(--primary) 0%, #1d4ed8 100%);
  color: #fff; border: none; border-radius: 10px;
  font-size: 14px; font-weight: 800; cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  box-shadow: 0 2px 12px rgba(37,99,235,0.35);
}
.btn-proceed:hover  { opacity: 0.9; }
.btn-proceed:active { transform: scale(0.98); }

/* ── Booking wizard modal ─────────────────────────────────────────────────── */
.booking-modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.6); z-index: 999;
  align-items: center; justify-content: center;
  padding: 20px; backdrop-filter: blur(5px);
}
.booking-modal-overlay.open { display: flex; }

.booking-modal-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; width: 100%; max-width: 500px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.28);
  overflow: hidden;
  animation: modalIn 0.22s cubic-bezier(0.4,0,0.2,1);
}

.bm-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 20px 22px 16px;
  background: linear-gradient(135deg, #0c1f40 0%, #1e293b 100%);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.bm-title { font-size: 18px; font-weight: 900; color: #f1f5f9; }
.bm-sub   { font-size: 12px; color: #64748b; margin-top: 3px; }
.bm-close {
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.1);
  color: #94a3b8; font-size: 16px; cursor: pointer;
  padding: 4px 10px; line-height: 1; border-radius: 6px; transition: all 0.15s;
}
.bm-close:hover { color: #f1f5f9; background: rgba(255,255,255,0.16); }

.bm-body { padding: 20px 22px; }

/* Ship option cards */
.ship-options { display: flex; flex-direction: column; gap: 12px; margin-bottom: 18px; }
.ship-opt {
  width: 100%; text-align: left; padding: 16px 18px; border-radius: 14px;
  border: 2px solid var(--border); background: var(--surface2); cursor: pointer;
  transition: all 0.15s;
}
.ship-opt:hover { border-color: var(--primary); background: #eff6ff; }
.ship-opt.selected { border-color: var(--primary); background: #eff6ff; box-shadow: 0 0 0 3px rgba(37,99,235,0.12); }

.ship-opt-top {
  display: flex; align-items: center; gap: 12px; margin-bottom: 8px;
}
.ship-opt-icon  { font-size: 28px; line-height: 1; flex-shrink: 0; }
.ship-opt-title { font-size: 15px; font-weight: 900; color: var(--text); }
.ship-opt-sub   { font-size: 11px; color: var(--text2); margin-top: 1px; }
.ship-opt-desc  { font-size: 12px; color: var(--text2); line-height: 1.6; }
.ship-opt-tag {
  margin-left: auto; flex-shrink: 0;
  font-size: 10px; font-weight: 800; padding: 3px 10px; border-radius: 20px;
}
.tag-green { background: #dcfce7; color: #16a34a; }
.tag-blue  { background: #dbeafe; color: #1d4ed8; }

.btn-bm-next {
  width: 100%; padding: 13px;
  background: linear-gradient(135deg, var(--primary) 0%, #1d4ed8 100%);
  color: #fff; border: none; border-radius: 10px;
  font-size: 14px; font-weight: 800; cursor: pointer;
  transition: opacity 0.15s; box-shadow: 0 2px 12px rgba(37,99,235,0.3);
}
.btn-bm-next:hover    { opacity: 0.9; }
.btn-bm-next:disabled { opacity: 0.35; cursor: not-allowed; box-shadow: none; }

/* Charges breakdown */
.charges-card {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 12px; padding: 16px 18px; margin-bottom: 14px;
}
.charges-section-lbl {
  font-size: 12px; font-weight: 800; color: var(--text);
  margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.charges-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 5px 0; font-size: 13px; color: var(--text2);
  border-bottom: 1px solid var(--border);
}
.charges-row:last-child { border-bottom: 0; }
.charges-row span:last-child { font-weight: 700; color: var(--text); }
.charges-total {
  margin-top: 8px; padding-top: 10px;
  border-top: 2px solid var(--border) !important;
  font-size: 14px !important; font-weight: 900 !important; color: var(--text) !important;
}

.btn-bm-confirm {
  width: 100%; padding: 14px;
  background: linear-gradient(135deg, var(--success) 0%, #15803d 100%);
  color: #fff; border: none; border-radius: 10px;
  font-size: 15px; font-weight: 900; cursor: pointer;
  transition: opacity 0.15s; box-shadow: 0 2px 12px rgba(22,163,74,0.3);
}
.btn-bm-confirm:hover    { opacity: 0.9; }
.btn-bm-confirm:disabled { opacity: 0.4; cursor: not-allowed; }

/* Success step */
.bm-success-body { text-align: center; padding: 36px 24px; }
.bm-success-icon { font-size: 56px; margin-bottom: 16px; }

.bm-confirm-summary { margin: 20px 0; }
.bm-confirm-grid {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 12px; overflow: hidden;
}
.bcg-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px; font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.bcg-row:last-child { border-bottom: 0; }
.bcg-row span:first-child { color: var(--text2); }
.bcg-row span:last-child  { font-weight: 700; color: var(--text); }

.btn-bm-new {
  width: 100%; padding: 13px;
  background: linear-gradient(135deg, var(--primary) 0%, #1d4ed8 100%);
  color: #fff; border: none; border-radius: 10px;
  font-size: 14px; font-weight: 800; cursor: pointer;
  transition: opacity 0.15s; box-shadow: 0 2px 12px rgba(37,99,235,0.3);
}
.btn-bm-new:hover { opacity: 0.9; }

/* ── Cargo lock overlay ──────────────────────────────────────────────────── */
.cargo-lock {
  position: absolute; inset: 0; z-index: 10;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; background: rgba(255,255,255,0.88); backdrop-filter: blur(4px);
  border-radius: var(--r); border: 1.5px dashed var(--border);
}
.cargo-lock-icon  { font-size: 36px; line-height: 1; }
.cargo-lock-title { font-size: 15px; font-weight: 800; color: var(--text); }
.cargo-lock-sub   { font-size: 12px; color: var(--text2); text-align: center; padding: 0 20px; }
.cargo-lock-btn {
  margin-top: 4px; padding: 9px 22px; border-radius: 8px; border: none;
  background: var(--primary); color: #fff; font-size: 13px; font-weight: 700;
  cursor: pointer; transition: background 0.15s;
}
.cargo-lock-btn:hover { background: var(--primary-h); }

/* ── Auth modal ──────────────────────────────────────────────────────────── */
.auth-modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.auth-modal-overlay.open { opacity: 1; pointer-events: auto; }
.auth-modal-card {
  background: var(--surface); border-radius: 18px; width: 100%; max-width: 420px;
  margin: 16px; box-shadow: var(--shadow-lg); overflow: hidden;
}
.auth-modal-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 22px 22px 16px; border-bottom: 1px solid var(--border);
}
.auth-modal-title { font-size: 18px; font-weight: 900; color: var(--text); }
.auth-modal-sub   { font-size: 12px; color: var(--text2); margin-top: 3px; }
.auth-modal-close {
  background: none; border: none; font-size: 18px; color: var(--text2);
  cursor: pointer; line-height: 1; padding: 2px 6px;
}
.auth-modal-close:hover { color: var(--text); }

.auth-choose-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 20px; }
.auth-choose-btn {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 20px 12px; border-radius: 12px; border: 1.5px solid var(--border);
  background: var(--surface2); cursor: pointer; transition: all 0.15s; text-align: center;
}
.auth-choose-btn:hover {
  border-color: var(--primary); background: #eff6ff;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.auth-choose-icon  { font-size: 28px; line-height: 1; }
.auth-choose-label { font-size: 14px; font-weight: 800; color: var(--text); }
.auth-choose-sub   { font-size: 10px; color: var(--text2); }

.auth-form { padding: 20px; display: flex; flex-direction: column; gap: 4px; }
.auth-lbl  { font-size: 11px; font-weight: 700; color: var(--text2); text-transform: uppercase;
              letter-spacing: 0.4px; margin-top: 8px; margin-bottom: 2px; }
.auth-lbl:first-child { margin-top: 0; }
.auth-input {
  width: 100%; padding: 9px 12px; border-radius: 8px; border: 1.5px solid var(--border);
  background: var(--surface); font-size: 13px; color: var(--text);
  transition: border-color 0.15s; font-family: inherit;
}
.auth-input:focus { outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12); }
.auth-textarea { resize: vertical; min-height: 72px; }
.auth-err { font-size: 12px; color: var(--danger); min-height: 18px; margin-top: 4px; }
.auth-submit-btn {
  margin-top: 10px; padding: 11px; border-radius: 8px; border: none;
  background: linear-gradient(135deg, var(--primary) 0%, #1d4ed8 100%);
  color: #fff; font-size: 14px; font-weight: 800; cursor: pointer;
  transition: opacity 0.15s; width: 100%;
}
.auth-submit-btn:hover { opacity: 0.9; }
.auth-switch { font-size: 12px; color: var(--text2); text-align: center; margin-top: 10px; }
.auth-switch a { color: var(--primary); text-decoration: none; font-weight: 600; }
.auth-switch a:hover { text-decoration: underline; }

/* ── Stackable option ────────────────────────────────────────────────────── */
.stackable-row { margin-top: 8px; margin-bottom: 2px; }
.stackable-label {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; user-select: none;
  padding: 7px 10px; border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--surface2);
  transition: border-color 0.15s;
  font-size: 12px; font-weight: 600; color: var(--text);
}
.stackable-label:hover { border-color: var(--primary); background: #eff6ff; }
.stackable-label input[type="checkbox"] { accent-color: var(--primary); width: 14px; height: 14px; cursor: pointer; }
.stackable-icon { font-size: 14px; }
.stackable-text { font-size: 12px; }

/* ── Dangerous Goods (DG) section ───────────────────────────────────────── */
.dg-section {
  margin-top: 12px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.dg-toggle-label {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; user-select: none;
  padding: 8px 10px; border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--surface2);
  transition: border-color 0.15s, background 0.15s;
}
.dg-toggle-label:hover { border-color: #f97316; background: #fff7ed; }
.dg-toggle-label input[type="checkbox"] { accent-color: #ea580c; width: 15px; height: 15px; cursor: pointer; }

.dg-toggle-icon { font-size: 16px; }
.dg-toggle-text { font-size: 13px; font-weight: 700; color: var(--text); }

.dg-fields {
  margin-top: 10px;
  padding: 12px 14px;
  background: #fff7ed;
  border: 1.5px solid #fed7aa;
  border-radius: 10px;
}

.dg-truck-note {
  margin-top: 10px;
  font-size: 11px; font-weight: 700; color: #c2410c;
  background: #ffedd5; border: 1px solid #fdba74;
  border-radius: 7px; padding: 7px 10px; line-height: 1.5;
}

/* DG badge shown on cargo list items */
.dg-badge {
  display: inline-block;
  font-size: 9px; font-weight: 800;
  color: #9a3412; background: #ffedd5;
  border: 1px solid #fed7aa;
  border-radius: 4px; padding: 1px 6px;
  margin-left: 6px; vertical-align: middle;
  text-transform: uppercase; letter-spacing: 0.4px;
}

/* DG surcharge row highlight */
.charges-row-dg {
  display: flex; justify-content: space-between; align-items: center;
  padding: 5px 0; font-size: 13px;
  color: #c2410c;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
}

/* DG warning banner in booking modal */
.dg-warning-banner {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 14px; margin-bottom: 14px;
  background: #fff7ed; border: 1.5px solid #fed7aa;
  border-radius: 10px;
}
.dg-warning-banner-icon { font-size: 18px; line-height: 1; flex-shrink: 0; margin-top: 1px; }
.dg-warning-banner-text { font-size: 12px; color: #9a3412; line-height: 1.6; }
.dg-warning-banner-title { font-weight: 800; }

/* ── Route & Location wizard steps ─────────────────────────────────────────── */

/* Location step */
.location-field-wrap { position: relative; margin-bottom: 8px; }
.loc-label { display: block; font-size: 11px; font-weight: 700; color: var(--text2); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.loc-input-row { display: flex; gap: 8px; }
.loc-input { flex: 1; background: var(--surface); border: 1.5px solid var(--border); border-radius: 10px; padding: 10px 14px; font-size: 13px; color: var(--text); outline: none; }
.loc-input:focus { border-color: var(--primary); }
.loc-search-btn { background: var(--primary); color: #fff; border: none; border-radius: 10px; width: 42px; cursor: pointer; font-size: 16px; display: flex; align-items: center; justify-content: center; }
.loc-search-btn:hover { background: var(--primary-dark, #1d4ed8); }
.location-suggestions {
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  max-height: 180px; overflow-y: auto; z-index: 200;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12); margin-top: 4px;
}
.location-suggestion-item {
  padding: 10px 14px; cursor: pointer; font-size: 12px; color: var(--text);
  line-height: 1.5; border-bottom: 1px solid var(--surface2); min-height: 40px;
}
.location-suggestion-item:last-child { border-bottom: none; }
.location-suggestion-item:hover { background: var(--surface2); }
.loc-confirmed {
  background: #dcfce7; border: 1px solid #86efac; border-radius: 8px;
  padding: 6px 12px; font-size: 12px; color: #166534; font-weight: 700;
  margin-bottom: 14px; line-height: 1.5; word-break: break-word;
}

.loc-section-label {
  font-size: 13px; font-weight: 800; color: var(--text); margin-bottom: 10px;
}

/* Route step */
.route-card {
  border: 2px solid var(--border); border-radius: 12px; padding: 14px 16px;
  margin-bottom: 10px; cursor: pointer; display: flex; justify-content: space-between;
  align-items: center; background: var(--surface); transition: border-color 0.15s;
}
.route-card:hover { border-color: var(--primary); }
.route-card.selected { border-color: var(--primary); background: rgba(37,99,235,0.05); }
.route-card-left { flex: 1; }
.route-card-label { font-size: 14px; font-weight: 800; color: var(--text); }
.route-card.selected .route-card-label { color: var(--primary); }
.route-card-right { text-align: right; }
.route-card-dist { font-size: 18px; font-weight: 900; color: var(--text); }
.route-card.selected .route-card-dist { color: var(--primary); }
.route-card-dur { font-size: 12px; color: var(--text2); margin-top: 2px; }

/* Map container */
#bm-map { height: 300px; width: 100%; border-radius: 12px; margin: 12px 0; border: 1px solid var(--border); }

/* Leaflet z-index fix inside modal */
.booking-modal-card .leaflet-pane,
.booking-modal-card .leaflet-top,
.booking-modal-card .leaflet-bottom { z-index: auto; }

/* Toll info */
.bm-toll-info {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 14px; font-size: 13px; color: var(--text2); margin-bottom: 12px;
}

/* Confirm route button */
#btn-confirm-route { margin-top: 8px; }

/* Make bm-body scrollable for taller modal content */
.bm-body { overflow-y: auto; max-height: 70vh; }

/* ── Fragile + Customer badges ────────────────────────────────────────────── */
.fragile-badge {
  display: inline-flex; align-items: center;
  background: #d1fae5; color: #065f46; font-size: 10px; font-weight: 700;
  border: 1px solid #6ee7b7; border-radius: 4px;
  padding: 1px 5px; margin-left: 4px; white-space: nowrap;
}
.customer-badge {
  display: inline-flex; align-items: center;
  background: #eff6ff; color: #1d4ed8; font-size: 10px; font-weight: 700;
  border: 1px solid #bfdbfe; border-radius: 4px;
  padding: 1px 5px; margin-left: 4px; white-space: nowrap;
}

/* ── Wizard Customer step ─────────────────────────────────────────────────── */
.wc-form { background: var(--surface); border-radius: 12px; padding: 14px; border: 1px solid var(--border); }
.wc-card {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px; margin-bottom: 6px;
}
.wc-name { font-size: 13px; font-weight: 700; color: var(--text); }
.wc-meta { font-size: 10px; color: var(--text2); margin-top: 1px; }
.wc-value-badge {
  display: inline-block; margin-top: 4px;
  background: #eff6ff; color: #1d4ed8; font-size: 10px; font-weight: 700;
  border: 1px solid #bfdbfe; border-radius: 4px; padding: 1px 6px;
}
.btn-bm-skip {
  flex: 0 0 auto; padding: 12px 20px; border-radius: 10px;
  border: 1.5px solid var(--border); background: var(--surface);
  color: var(--text2); font-size: 13px; font-weight: 700; cursor: pointer;
}
.btn-bm-skip:hover { border-color: var(--primary); color: var(--primary); }

/* ── 3D Load button ───────────────────────────────────────────────────────── */
.btn-viz3d {
  display: block; padding: 12px; border-radius: 10px;
  background: #0f172a; border: 1.5px solid #3b82f6;
  color: #60a5fa; font-size: 14px; font-weight: 700; cursor: pointer;
  text-align: center;
}
.btn-viz3d:hover { background: #1e293b; }

/* ── 3D Viz modal ─────────────────────────────────────────────────────────── */
.viz3d-modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.85); z-index: 2000;
  align-items: center; justify-content: center; padding: 8px;
}
.viz3d-modal-overlay.open { display: flex; }
.viz3d-modal-card {
  width: 100%; max-width: 1200px; height: 94vh;
  background: #0f172a; border-radius: 14px;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.viz3d-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px; border-bottom: 1px solid #1e3a5f; flex-shrink: 0;
}

/* ── Admin Panel ────────────────────────────────────────────────────────────── */
.admin-panel {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(0,0,0,0.55);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 20px 16px; overflow-y: auto;
}
.admin-panel-inner {
  background: var(--surface); border-radius: var(--r);
  border: 1px solid var(--border); box-shadow: var(--shadow-md);
  width: 100%; max-width: 1100px;
}
.admin-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; background: var(--navy); flex-wrap: wrap; gap: 8px;
  border-radius: var(--r) var(--r) 0 0;
}
.admin-title { font-size: 15px; font-weight: 800; color: #f1f5f9; }
.admin-stats { display: flex; gap: 16px; }
.admin-stat  { font-size: 12px; color: #94a3b8; }
.admin-stat span { font-weight: 800; color: #f1f5f9; margin-right: 2px; }

.admin-tabs {
  display: flex; flex-wrap: wrap; border-bottom: 1px solid var(--border);
  background: var(--surface2);
}
.admin-tab-btn {
  padding: 10px 14px; font-size: 12px; font-weight: 700;
  color: var(--text2); background: none; border: none; cursor: pointer;
  border-bottom: 2px solid transparent; transition: all 0.15s; white-space: nowrap;
}
.admin-tab-btn:hover { color: var(--primary); }
.admin-tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); background: var(--surface); }

.admin-tab-pane { padding: 16px 18px; }
.admin-list { margin-top: 12px; }

/* Truck form */
.admin-form-card {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px 16px; margin-bottom: 12px;
}
.admin-form-title { font-size: 13px; font-weight: 800; color: var(--text); margin-bottom: 10px; }
.form-row { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.form-row label { font-size: 10px; font-weight: 700; color: var(--text2); text-transform: uppercase; letter-spacing: 0.4px; }
.form-row input { border: 1.5px solid var(--border); border-radius: 8px; padding: 7px 10px; font-size: 13px; color: var(--text); background: var(--surface); }
.form-row input:focus { outline: none; border-color: var(--primary); }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
@media(max-width:600px) { .form-grid-3 { grid-template-columns: 1fr 1fr; } }

.btn-save-truck {
  background: var(--primary); color: #fff; border: none; border-radius: 8px;
  padding: 8px 18px; font-size: 13px; font-weight: 800; cursor: pointer;
}
.btn-save-truck:hover { background: var(--primary-h); }
.btn-cancel-truck {
  background: none; border: 1.5px solid var(--border); border-radius: 8px;
  padding: 8px 14px; font-size: 13px; font-weight: 700; color: var(--text2); cursor: pointer;
}
.btn-fleet-edit, .btn-fleet-del {
  border: none; border-radius: 6px; padding: 4px 9px; font-size: 13px; cursor: pointer;
}
.btn-fleet-edit { background: var(--surface2); color: var(--primary); }
.btn-fleet-del  { background: #fef2f2; color: var(--danger); }

/* License plate badge */
.plate-badge {
  display: inline-block; font-size: 10px; font-weight: 800; letter-spacing: 0.5px;
  background: #f1f5f9; color: #475569; border: 1px solid #cbd5e1;
  border-radius: 4px; padding: 1px 6px; margin-left: 4px; vertical-align: middle;
}

/* Consolidation card */
.consolidation-card {
  background: #f0fdf4; border: 1.5px solid #86efac;
  border-radius: 10px; padding: 12px 14px; margin-bottom: 12px;
}
.consolidation-header { font-size: 13px; font-weight: 800; color: #15803d; margin-bottom: 6px; }
.consolidation-body   { font-size: 12px; color: #166534; margin-bottom: 8px; }
.btn-join-shipment {
  background: #16a34a; color: #fff; border: none; border-radius: 7px;
  padding: 7px 14px; font-size: 12px; font-weight: 800; cursor: pointer;
}
.btn-join-shipment:hover { background: #15803d; }

/* Truck swap card */
.truck-swap-card {
  background: #fffbeb; border: 1.5px solid #fcd34d;
  border-radius: 10px; padding: 12px 14px; margin-bottom: 12px;
}
.truck-swap-header { font-size: 13px; font-weight: 800; color: #92400e; margin-bottom: 6px; }
.truck-swap-body   { font-size: 12px; color: #78350f; margin-bottom: 8px; }
.btn-use-truck {
  background: #d97706; color: #fff; border: none; border-radius: 7px;
  padding: 7px 14px; font-size: 12px; font-weight: 800; cursor: pointer;
}
.btn-use-truck:hover { background: #b45309; }

/* Booking cards */
.booking-card {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px; margin-bottom: 10px;
}
.booking-card-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 6px; gap: 8px;
}
.booking-truck-name { font-size: 13px; font-weight: 800; color: var(--text); }
.booking-date  { font-size: 11px; color: var(--text2); flex-shrink: 0; }
.booking-route { font-size: 12px; color: var(--text2); margin-bottom: 8px; }
.booking-status {
  display: inline-block; font-size: 9px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.4px; border-radius: 4px; padding: 1px 6px; margin-left: 5px;
}
.status-active    { background: #dcfce7; color: #166534; }
.status-completed { background: #eff6ff; color: #1d4ed8; }
.status-cancelled { background: #f1f5f9; color: #64748b; }

.booking-load-row {
  display: flex; align-items: center; gap: 8px; margin-bottom: 5px;
}
.booking-load-label { font-size: 11px; color: var(--text2); min-width: 180px; }
.load-bar-wrap { flex: 1; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.load-bar { height: 100%; border-radius: 3px; transition: width 0.3s; }

.booking-card-foot { margin-top: 8px; text-align: right; }
.btn-cancel-booking {
  background: none; border: 1px solid var(--border); border-radius: 6px;
  padding: 4px 12px; font-size: 11px; font-weight: 700; color: var(--text2); cursor: pointer;
}
.btn-cancel-booking:hover { background: #fef2f2; color: var(--danger); border-color: var(--danger); }

/* ── Excel Import ────────────────────────────────────────────────────────────── */
.import-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 16px;
}
.import-section-head {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px;
}
.import-section-title { font-size: 14px; font-weight: 900; color: var(--text); }
.import-section-sub   { font-size: 11px; color: var(--text2); margin: 0 0 12px; line-height: 1.6; }

.btn-dl-template {
  background: none; border: 1px solid var(--border); border-radius: 6px;
  padding: 4px 12px; font-size: 11px; font-weight: 700; color: var(--text2); cursor: pointer;
  white-space: nowrap;
}
.btn-dl-template:hover { background: var(--bg); border-color: var(--primary); color: var(--primary); }

.import-drop {
  border: 2px dashed var(--border); border-radius: 10px;
  padding: 28px 20px; text-align: center; cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.import-drop:hover, .import-drop-hover {
  border-color: var(--primary); background: #eff6ff;
}
.import-drop-icon { font-size: 28px; margin-bottom: 6px; }
.import-drop-txt  { font-size: 13px; font-weight: 700; color: var(--text2); }

.import-preview { margin-top: 14px; }
.import-preview-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.import-count { font-size: 13px; font-weight: 700; }

.btn-import-confirm {
  background: var(--primary); color: #fff; border: none; border-radius: 7px;
  padding: 6px 16px; font-size: 12px; font-weight: 800; cursor: pointer;
}
.btn-import-confirm:hover   { opacity: 0.88; }
.btn-import-confirm:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-import-cancel {
  background: none; border: 1px solid var(--border); border-radius: 7px;
  padding: 6px 12px; font-size: 12px; font-weight: 700; color: var(--text2); cursor: pointer;
}
.btn-import-cancel:hover { background: var(--bg); }

.import-table-wrap {
  overflow-x: auto; border: 1px solid var(--border); border-radius: 8px;
}
.import-table {
  width: 100%; border-collapse: collapse; font-size: 12px;
}
.import-table thead tr { background: var(--bg); }
.import-table th {
  text-align: left; padding: 7px 10px; font-size: 10px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.4px; color: var(--text2);
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.import-table td {
  padding: 6px 10px; border-bottom: 1px solid var(--border); color: var(--text);
  white-space: nowrap;
}
.import-table tbody tr:last-child td { border-bottom: none; }
.import-table tbody tr:hover { background: var(--bg); }
.import-more-row {
  text-align: center; color: var(--text2); font-style: italic; padding: 8px;
}

/* ── AI Chat Widget ──────────────────────────────────────────────────────────── */
.ai-fab {
  position: fixed; bottom: 24px; right: 24px; z-index: 800;
  display: flex; align-items: center; gap: 8px;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #fff; border: none; border-radius: 50px; cursor: pointer;
  padding: 12px 18px; box-shadow: 0 4px 20px rgba(99,102,241,0.45);
  font-size: 14px; font-weight: 700; transition: transform 0.15s, box-shadow 0.15s;
}
.ai-fab:hover { transform: translateY(-2px); box-shadow: 0 6px 24px rgba(99,102,241,0.55); }
.ai-fab-icon { font-size: 18px; }

.ai-chat-panel {
  position: fixed; bottom: 84px; right: 24px; z-index: 800;
  width: 360px; max-height: 520px; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: 0 8px 40px rgba(0,0,0,0.18);
  overflow: hidden;
}
.ai-chat-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; background: linear-gradient(135deg, #6366f1, #4f46e5);
}
.ai-chat-title { font-size: 13px; font-weight: 800; color: #fff; }
.ai-chat-close {
  background: rgba(255,255,255,0.2); border: none; color: #fff;
  border-radius: 50%; width: 24px; height: 24px; cursor: pointer;
  font-size: 13px; display: flex; align-items: center; justify-content: center;
}
.ai-advise-btn {
  background: rgba(255,255,255,0.2); border: none; color: #fff;
  border-radius: 20px; padding: 3px 10px; font-size: 11px; font-weight: 700;
  cursor: pointer; white-space: nowrap;
}
.ai-advise-btn:hover { background: rgba(255,255,255,0.35); }

.ai-chat-messages {
  flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px;
}
.ai-msg { max-width: 85%; padding: 8px 12px; border-radius: 12px; font-size: 12px; line-height: 1.5; }
.ai-msg-bot { background: var(--surface2); color: var(--text1); align-self: flex-start; border-bottom-left-radius: 4px; }
.ai-msg-user { background: #6366f1; color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.ai-msg-thinking { color: var(--text2); font-style: italic; font-size: 11px; align-self: flex-start; }

.ai-chat-input-row {
  display: flex; gap: 8px; padding: 10px 12px;
  border-top: 1px solid var(--border);
}
.ai-chat-input {
  flex: 1; border: 1px solid var(--border); border-radius: 8px;
  padding: 7px 10px; font-size: 12px; background: var(--bg); color: var(--text1);
}
.ai-chat-input:focus { outline: none; border-color: #6366f1; }
.ai-chat-send {
  background: #6366f1; color: #fff; border: none; border-radius: 8px;
  padding: 7px 14px; font-size: 12px; font-weight: 700; cursor: pointer;
}
.ai-chat-send:hover { background: #4f46e5; }
.ai-chat-send:disabled { opacity: 0.5; cursor: default; }

.ai-autofill-btn {
  background: linear-gradient(135deg, #6366f1, #4f46e5) !important;
  color: #fff !important; border: none !important;
}
.ai-autofill-btn:hover { opacity: 0.9; }
