@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

/* ── Reset & base ─────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body { font-family: 'Inter', system-ui, sans-serif; background: #f3f4f9; color: #0f172a; line-height: 1.5; }
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ── Design tokens ────────────────────────────────── */
:root {
  --blue:    #3b82f6;  --blue-light: #eff6ff;  --blue-dark: #2563eb;
  --green:   #10b981;  --green-light: #ecfdf5;
  --amber:   #f59e0b;  --amber-light: #fffbeb;
  --red:     #ef4444;  --red-light:   #fef2f2;
  --purple:  #7c3aed;  --purple-light: #f5f3ff;
  --slate:   #64748b;
  --surface: #ffffff;
  --border:  #e8eaf0;
  --shadow:  0 1px 4px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 20px rgba(0,0,0,.09);
  --shadow-lg: 0 12px 48px rgba(0,0,0,.16);
  --radius:  14px;
  --radius-sm: 9px;

  /* Sidebar */
  --sb-bg: #1e1b4b;
  --sb-border: rgba(255,255,255,.07);
  --sb-text: rgba(255,255,255,.55);
}

/* ── App shell ────────────────────────────────────── */
#app { display: flex; min-height: 100vh; }

#sidebar {
  width: 252px; min-height: 100vh;
  background:
    linear-gradient(160deg, rgba(139,92,246,.13) 0%, transparent 40%),
    linear-gradient(180deg, #1a1640 0%, #1e1b4b 55%, #19164a 100%);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; flex-shrink: 0;
  border-right: 1px solid rgba(139,92,246,.18);
  box-shadow: 4px 0 32px rgba(0,0,0,.28), inset -1px 0 0 rgba(255,255,255,.05);
}

/* Glossy sheen — top-left light catch */
#sidebar::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 240px;
  background: linear-gradient(160deg, rgba(167,139,250,.11) 0%, rgba(139,92,246,.04) 40%, transparent 100%);
  pointer-events: none; z-index: 0;
}

/* Main area footer */
#app-footer {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 14px 28px;
  border-top: 1px solid var(--border);
  font-size: 11.5px; font-weight: 500; color: #94a3b8;
  background: var(--surface);
  letter-spacing: .01em;
}
#app-footer span { color: #94a3b8; }
#app-footer a {
  font-weight: 800;
  color: #1a56db;
  text-decoration: none;
  transition: color .2s;
}
#app-footer a:hover {
  color: #1e40af;
}

/* Topbar settings icon */
#topbar-settings {
  width: 34px; height: 34px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  color: #94a3b8; transition: all .15s;
}
#topbar-settings:hover { background: #ede9fe; color: var(--purple); }
#topbar-settings.active-page { background: #ede9fe; color: var(--purple); }

/* Sidebar scrollbar */
#sidebar::-webkit-scrollbar { width: 5px; }
#sidebar::-webkit-scrollbar-track { background: transparent; }
#sidebar::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #7c3aed 0%, #8b5cf6 50%, #a78bfa 100%);
  border-radius: 99px;
}
#sidebar::-webkit-scrollbar-thumb:hover { background: #a78bfa; }

#main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

#topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 28px;
  display: flex; align-items: center; gap: 12px;
  position: sticky; top: 0; z-index: 10;
  box-shadow: 0 1px 0 rgba(0,0,0,.05), 0 2px 12px rgba(0,0,0,.06);
  overflow: hidden;
}

/* Gradient accent line along the bottom of topbar */
#topbar::after {
  content: '';
  position: absolute; bottom: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, #6d28d9 0%, #7c3aed 25%, #a78bfa 65%, #c4b5fd 85%, transparent 100%);
  opacity: .75;
}

#page { padding: 26px 28px; flex: 1; }

/* ── Sidebar logo ─────────────────────────────────── */
.sidebar-logo {
  padding: 16px 16px 14px;
  display: flex; align-items: center; gap: 11px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  position: relative; z-index: 1;
}
.sidebar-logo-icon {
  width: 40px; height: 40px; border-radius: 12px;
  background: linear-gradient(135deg, #6d28d9 0%, #a78bfa 100%);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(109,40,217,.5), inset 0 1px 0 rgba(255,255,255,.25);
}
.sidebar-logo-icon svg { color: #fff; }
.sidebar-logo-title { font-size: 15px; font-weight: 900; color: #fff; line-height: 1.2; letter-spacing: -.01em; }
.sidebar-logo-sub   { font-size: 9.5px; font-weight: 700; color: rgba(255,255,255,.35); letter-spacing: .08em; text-transform: uppercase; margin-top: 1px; }

/* ── Sidebar nav ──────────────────────────────────── */
.sidebar-nav { flex: 1; padding: 10px 10px; display: flex; flex-direction: column; gap: 12px; position: relative; z-index: 1; }

.nav-section-label {
  font-size: 9px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase;
  color: #fff; padding: 0 10px; margin-bottom: 3px;
  text-shadow: 0 0 8px rgba(196,181,253,.9), 0 0 18px rgba(167,139,250,.5);
}

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

.nav-link {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px;
  border-radius: 10px; font-size: 13px; font-weight: 500;
  color: var(--sb-text); transition: all .18s ease;
  position: relative;
}
.nav-link:hover {
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.9);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
}
.nav-link:hover .nav-icon { filter: brightness(1.15); }

.nav-link.active {
  background: linear-gradient(135deg, #6d28d9 0%, #8b5cf6 100%);
  color: #fff; font-weight: 700;
  box-shadow:
    0 4px 18px rgba(109,40,217,.45),
    0 0 0 1px rgba(109,40,217,.35),
    inset 0 1px 0 rgba(255,255,255,.2),
    inset 0 -1px 0 rgba(0,0,0,.15);
}
.nav-link.active .nav-icon {
  background: rgba(255,255,255,.2) !important;
  filter: brightness(10);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.3);
}

.nav-icon {
  width: 30px; height: 30px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  transition: all .18s;
}
.nav-icon svg { width: 15px !important; height: 15px !important; }

/* ── Topbar ───────────────────────────────────────── */
#topbar h1 { font-size: 17px; font-weight: 800; color: #0f172a; flex: 1; letter-spacing: -.02em; }
.topbar-date {
  display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500;
  color: var(--slate); background: #f8fafc; border: 1px solid var(--border);
  padding: 6px 13px; border-radius: 8px;
}
.topbar-actions { display: flex; align-items: center; gap: 8px; }

/* Topbar user */
.topbar-user {
  display: flex; align-items: center; gap: 10px;
  padding-left: 16px; border-left: 1px solid var(--border); margin-left: 4px;
}
.topbar-user-info { text-align: right; }
.topbar-user-name { display: block; font-size: 13px; font-weight: 700; color: #0f172a; line-height: 1.2; }
.user-role-chip {
  display: inline-block; font-size: 10px; font-weight: 700; text-transform: capitalize;
  padding: 1px 8px; border-radius: 20px; margin-top: 1px;
}
.user-role-chip.role-admin    { background: #ede9fe; color: #4c1d95; }
.user-role-chip.role-manager  { background: #dbeafe; color: #1d4ed8; }
.user-role-chip.role-salesman { background: #d1fae5; color: #065f46; }
.user-role-chip.role-driver   { background: #fef3c7; color: #92400e; }
.user-role-chip.role-helper   { background: #f1f5f9; color: #64748b; }
.topbar-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, #6d28d9, #8b5cf6);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800; color: #fff; flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(109,40,217,.35);
}
.btn-signout {
  padding: 7px; border-radius: 8px; color: #94a3b8;
  transition: all .18s; display: flex;
}
.btn-signout:hover { color: var(--red); background: var(--red-light); }

/* ── Buttons ──────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px;
  border-radius: var(--radius-sm); font-size: 13px; font-weight: 700;
  transition: all .2s cubic-bezier(.4,0,.2,1); cursor: pointer;
}
.btn:active { transform: scale(.97); }

.btn-primary {
  background: linear-gradient(135deg, #6d28d9 0%, #8b5cf6 100%);
  color: #fff; box-shadow: 0 2px 10px rgba(109,40,217,.4);
}
.btn-primary:hover { box-shadow: 0 6px 22px rgba(109,40,217,.55); transform: translateY(-1px); }

.btn-outline { background: var(--surface); color: #374151; border: 1.5px solid var(--border); }
.btn-outline:hover { background: #f8fafc; border-color: #cbd5e1; }

.btn-danger {
  background: linear-gradient(135deg, #b91c1c, #ef4444);
  color: #fff; box-shadow: 0 2px 10px rgba(239,68,68,.35);
}
.btn-danger:hover { box-shadow: 0 6px 22px rgba(239,68,68,.5); transform: translateY(-1px); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-icon { padding: 7px; border-radius: var(--radius-sm); }

/* ── Cards ────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-pad { padding: 22px; }

/* ── Alert strip ──────────────────────────────────── */
.alert-strip {
  display: flex; flex-wrap: wrap; gap: 10px;
  margin-bottom: 20px;
}
.alert-item {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: 10px;
  font-size: 13px; font-weight: 600; flex: 1; min-width: 200px;
}
.alert-item svg { flex-shrink: 0; }
.alert-red    { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.alert-amber  { background: #fffbeb; color: #d97706; border: 1px solid #fde68a; }
.alert-blue   { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }

/* ── KPI cards ────────────────────────────────────── */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }

.kpi-card {
  border-radius: var(--radius); padding: 22px 20px;
  display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,.15);
  transition: box-shadow .2s, transform .2s;
  min-height: 148px;
}
.kpi-card:hover { box-shadow: 0 8px 32px rgba(0,0,0,.22); transform: translateY(-3px); }

/* decorative circle in card bg */
.kpi-card::before {
  content: ''; position: absolute;
  width: 130px; height: 130px; border-radius: 50%;
  background: rgba(255,255,255,.08);
  right: -28px; top: -28px; pointer-events: none;
}
.kpi-card::after {
  content: ''; position: absolute;
  width: 80px; height: 80px; border-radius: 50%;
  background: rgba(255,255,255,.06);
  right: 28px; bottom: -30px; pointer-events: none;
}

.kpi-icon-wrap {
  width: 48px; height: 48px; border-radius: 14px;
  background: rgba(255,255,255,.2);
  display: flex; align-items: center; justify-content: center;
  position: absolute; bottom: 14px; right: 14px; z-index: 1;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.3);
}
.kpi-icon-wrap svg { width: 24px !important; height: 24px !important; }

.kpi-body { position: relative; z-index: 1; padding-right: 64px; }

.kpi-label {
  font-size: 10px; font-weight: 800; letter-spacing: .12em;
  text-transform: uppercase; color: rgba(255,255,255,.75); margin-bottom: 5px;
  white-space: nowrap;
}
.kpi-value {
  font-size: 30px; font-weight: 900;
  font-family: 'Inter', system-ui, sans-serif;
  font-variant-numeric: normal;
  letter-spacing: -.04em; line-height: 1.1; color: #fff;
}
.kpi-sub { font-size: 11.5px; color: rgba(255,255,255,.65); margin-top: 4px; font-weight: 500; }

.kpi-trend {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 700; padding: 3px 9px;
  border-radius: 20px; margin-top: 6px;
  background: rgba(255,255,255,.2); color: #fff;
}

/* 5-card grid */
.kpi-grid-5 { grid-template-columns: repeat(5, 1fr); }

/* card gradients */
.kpi-blue   { background: linear-gradient(135deg, #2563eb 0%, #3b82f6 60%, #60a5fa 100%); }
.kpi-green  { background: linear-gradient(135deg, #059669 0%, #10b981 60%, #34d399 100%); }
.kpi-amber  { background: linear-gradient(135deg, #d97706 0%, #f59e0b 60%, #fbbf24 100%); }
.kpi-red    { background: linear-gradient(135deg, #dc2626 0%, #ef4444 60%, #f87171 100%); }
.kpi-purple { background: linear-gradient(135deg, #6d28d9 0%, #7c3aed 60%, #a78bfa 100%); }
.kpi-teal   { background: linear-gradient(135deg, #0e7490 0%, #0891b2 60%, #22d3ee 100%); }

/* icon bg — white-tinted */
.kpi-icon-blue,.kpi-icon-green,.kpi-icon-amber,.kpi-icon-red,.kpi-icon-purple,.kpi-icon-teal { background: rgba(255,255,255,.2); }

/* ── Tables ───────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead tr { background: #f8fafc; }
th {
  padding: 11px 16px; font-size: 10.5px; font-weight: 800; letter-spacing: .07em;
  text-transform: uppercase; color: #94a3b8; text-align: left; white-space: nowrap;
}
th.r, td.r { text-align: right; }
td { padding: 13px 16px; font-size: 13.5px; color: #374151; border-top: 1px solid #f1f5f9; }
tbody tr { transition: background .1s; }
tbody tr:hover { background: #fafbff; }
.td-primary { font-weight: 700; color: #0f172a; }
.td-mono { font-family: 'JetBrains Mono', monospace; font-size: 13px; }
.table-empty { padding: 60px 0; text-align: center; color: #94a3b8; font-size: 14px; }
.table-empty svg { display: block; margin: 0 auto 12px; opacity: .2; }

/* ── Badges ───────────────────────────────────────── */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 700; text-transform: capitalize; white-space: nowrap;
}
.badge-blue   { background: #dbeafe; color: #1d4ed8; }
.badge-green  { background: #d1fae5; color: #065f46; }
.badge-amber  { background: #fef3c7; color: #92400e; }
.badge-red    { background: #fee2e2; color: #991b1b; }
.badge-purple { background: #ede9fe; color: #4c1d95; }
.badge-slate  { background: #f1f5f9; color: var(--slate); }

/* ── Progress bar ─────────────────────────────────── */
.progress-wrap { display: flex; align-items: center; gap: 8px; }
.progress-bar  { flex: 1; height: 6px; background: #e8eaf0; border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 99px; transition: width .4s ease; }
.pf-green  { background: linear-gradient(90deg, #059669, #10b981); }
.pf-amber  { background: linear-gradient(90deg, #d97706, #f59e0b); }
.pf-red    { background: linear-gradient(90deg, #b91c1c, #ef4444); }
.progress-pct { font-size: 11px; font-family: 'JetBrains Mono', monospace; color: #94a3b8; width: 32px; text-align: right; }

/* ── Forms ────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-label { font-size: 12px; font-weight: 700; color: #374151; }
.form-input, .form-select {
  padding: 9px 13px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13.5px; font-family: inherit; color: #0f172a; background: var(--surface);
  transition: border-color .15s, box-shadow .15s; outline: none; width: 100%;
}
.form-input:focus, .form-select:focus {
  border-color: var(--purple); box-shadow: 0 0 0 3px rgba(124,58,237,.12);
}
.form-input::placeholder { color: #cbd5e1; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.qty-wrap { display: flex; }
.qty-wrap .qty-input { flex: 1; border-radius: var(--radius-sm) 0 0 var(--radius-sm); border-right: none; min-width: 60px; }
.qty-wrap .qty-unit { width: 62px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; background: #f1f5f9; font-size: 12px; font-weight: 700; color: #64748b; cursor: pointer; flex-shrink: 0; padding: 0 6px; }

/* ── Modal ────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(10,8,30,.55);
  display: flex; align-items: center; justify-content: center; z-index: 100;
  padding: 16px; animation: fadeIn .15s ease; backdrop-filter: blur(5px);
}
.modal {
  background: var(--surface); border-radius: 18px;
  box-shadow: 0 24px 80px rgba(0,0,0,.22), 0 0 0 1px rgba(0,0,0,.05);
  width: 100%; max-width: 520px; max-height: 90vh;
  display: flex; flex-direction: column; animation: slideUp .22s cubic-bezier(.4,0,.2,1);
}
.modal-lg { max-width: 680px; }
.modal-header {
  padding: 22px 26px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 16px; font-weight: 800; color: #0f172a; }
.modal-close {
  width: 30px; height: 30px; border-radius: 7px; display: flex;
  align-items: center; justify-content: center; color: #94a3b8; transition: all .15s;
}
.modal-close:hover { background: #f1f5f9; color: #374151; }
.modal-body { padding: 24px 26px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 16px; }
.modal-footer { padding: 16px 26px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* ── Section header ───────────────────────────────── */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--border);
}
.section-title { font-size: 14px; font-weight: 800; color: #0f172a; }
.section-sub   { font-size: 12px; color: #94a3b8; margin-top: 2px; }

/* ── Search bar ───────────────────────────────────── */
.search-bar { display: flex; align-items: center; gap: 12px; padding: 14px 22px; border-bottom: 1px solid var(--border); }
.search-input-wrap { position: relative; flex: 1; max-width: 340px; }
.search-icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: #94a3b8; pointer-events: none; }
.search-input {
  width: 100%; padding: 8px 13px 8px 36px; border: 1.5px solid var(--border);
  border-radius: 8px; font-size: 13.5px; font-family: inherit;
  background: #f8fafc; outline: none; transition: all .18s;
}
.search-input:focus { border-color: var(--purple); background: var(--surface); box-shadow: 0 0 0 3px rgba(124,58,237,.1); }

/* ── Toast ────────────────────────────────────────── */
#toast-container { position: fixed; bottom: 26px; right: 26px; z-index: 999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 13px 18px;
  border-radius: var(--radius-sm); background: #1e1b4b; color: #fff;
  font-size: 13px; font-weight: 600; box-shadow: var(--shadow-lg);
  animation: slideLeft .25s cubic-bezier(.4,0,.2,1); min-width: 240px;
  border: 1px solid rgba(255,255,255,.08);
}
.toast.success { background: linear-gradient(135deg, #065f46, #059669); }
.toast.error   { background: linear-gradient(135deg, #991b1b, #ef4444); }

/* ── Login page ───────────────────────────────────── */
#login-page {
  min-height: 100vh; display: flex;
  background: linear-gradient(135deg, #0f0c29 0%, #1e1b4b 50%, #302b63 100%);
  align-items: center; justify-content: center; padding: 24px;
}
.login-container {
  display: flex; width: 100%; max-width: 980px;
  min-height: 600px; border-radius: 24px; overflow: hidden;
  box-shadow: 0 32px 100px rgba(0,0,0,.5), 0 0 0 1px rgba(255,255,255,.06);
}
.login-left {
  flex: 1;
  background: linear-gradient(145deg, #1e1b4b 0%, #2d1b69 50%, #4c1d95 100%);
  padding: 52px 44px; display: flex; flex-direction: column; color: #fff;
  position: relative; overflow: hidden;
}
.login-left::before {
  content: ''; position: absolute; top: -80px; right: -80px;
  width: 300px; height: 300px; border-radius: 50%;
  background: radial-gradient(circle, rgba(139,92,246,.35) 0%, transparent 70%);
}
.login-left::after {
  content: ''; position: absolute; bottom: -60px; left: -40px;
  width: 220px; height: 220px; border-radius: 50%;
  background: radial-gradient(circle, rgba(109,40,217,.25) 0%, transparent 70%);
}
.login-brand { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; margin-bottom: auto; position: relative; z-index: 1; }
.login-brand-icon {
  width: 58px; height: 58px;
  background: linear-gradient(135deg, #6d28d9, #a78bfa);
  border-radius: 16px; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 28px rgba(109,40,217,.5);
}
.login-brand-name { font-size: 26px; font-weight: 900; letter-spacing: -.02em; line-height: 1.2; color: #fff; }
.login-brand-name span { display: block; font-size: 15px; font-weight: 600; letter-spacing: .08em; color: rgba(255,255,255,.55); margin-top: 2px; }
.login-hero { margin-bottom: 44px; position: relative; z-index: 1; }
.login-hero h2 {
  font-size: 30px; font-weight: 900; line-height: 1.2; margin-bottom: 14px;
  letter-spacing: -.03em; text-shadow: 0 0 40px rgba(167,139,250,.4);
}
.login-hero p { font-size: 14px; opacity: .65; line-height: 1.7; }
.login-features { display: flex; flex-direction: column; gap: 13px; position: relative; z-index: 1; }
.login-feature { display: flex; align-items: center; gap: 11px; font-size: 13px; font-weight: 500; opacity: .78; }
.login-feature-dot {
  width: 22px; height: 22px; border-radius: 6px; flex-shrink: 0;
  background: rgba(139,92,246,.3); border: 1px solid rgba(139,92,246,.5);
  display: flex; align-items: center; justify-content: center;
}
.login-feature-dot::after { content: '✓'; font-size: 11px; font-weight: 800; color: #c4b5fd; }

.login-right {
  flex: 1; background: #fff;
  padding: 52px 48px; display: flex; flex-direction: column; justify-content: center;
}
.login-right h1 { font-size: 28px; font-weight: 900; color: #0f172a; margin-bottom: 6px; letter-spacing: -.03em; }
.login-right p  { font-size: 14px; color: var(--slate); margin-bottom: 24px; }
.login-form { display: flex; flex-direction: column; gap: 18px; }
.login-error {
  display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--red-light); border: 1px solid #fecaca; color: #991b1b;
  font-size: 13px; font-weight: 500;
}
.login-btn {
  padding: 14px; border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #6d28d9 0%, #8b5cf6 100%);
  color: #fff; font-size: 15px; font-weight: 700;
  transition: all .2s; box-shadow: 0 4px 18px rgba(109,40,217,.45); margin-top: 4px;
}
.login-btn:hover { box-shadow: 0 8px 32px rgba(109,40,217,.6); transform: translateY(-2px); }
.login-btn:disabled { opacity: .65; cursor: not-allowed; transform: none; }

/* Login role tabs */
.login-role-tabs {
  display: flex; gap: 8px; margin-bottom: 16px;
  background: #f1f5f9; border-radius: 10px; padding: 4px;
}
.login-role-tab {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 12px; border-radius: 8px; font-size: 13px; font-weight: 600;
  color: #64748b; transition: all .2s; cursor: pointer;
}
.login-role-tab.active { background: #fff; color: #0f172a; box-shadow: 0 1px 4px rgba(0,0,0,.1); }
.login-role-hint {
  font-size: 12px; font-weight: 500; padding: 8px 12px; border-radius: 8px;
  margin-bottom: 20px; line-height: 1.5;
}
.admin-hint { background: #ede9fe; color: #4c1d95; border: 1px solid #ddd6fe; }
.staff-hint { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }

/* ── Workflow pipeline ─────────────────────────────── */
.workflow-page { padding: 4px 0; }
.workflow-pipeline-strip {
  display: flex; align-items: center;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 24px;
  margin-bottom: 24px; overflow-x: auto;
  box-shadow: var(--shadow);
}
.pipeline-node { display: flex; flex-direction: column; align-items: center; gap: 8px; flex-shrink: 0; min-width: 88px; }
.pipeline-bubble {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800;
  background: #f1f5f9; color: #94a3b8; border: 2px solid #e2e8f0;
}
.pipeline-node span { font-size: 10.5px; font-weight: 600; color: #94a3b8; text-align: center; line-height: 1.3; white-space: nowrap; }
.pipeline-node.done .pipeline-bubble { background: linear-gradient(135deg, #065f46, #10b981); border-color: #10b981; color: white; box-shadow: 0 4px 12px rgba(16,185,129,.4); }
.pipeline-node.done span { color: #059669; }
.pipeline-node.active .pipeline-bubble { background: linear-gradient(135deg, #6d28d9, #8b5cf6); border-color: #8b5cf6; color: white; box-shadow: 0 4px 16px rgba(109,40,217,.5); transform: scale(1.15); }
.pipeline-node.active span { color: #7c3aed; font-weight: 800; }
.pipeline-connector { flex: 1; height: 2px; min-width: 24px; max-width: 48px; background: #e2e8f0; margin-bottom: 20px; }

.workflow-center { display: grid; grid-template-columns: 1fr 320px; gap: 20px; align-items: start; }
.workflow-main-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 36px;
  display: flex; flex-direction: column; gap: 16px; box-shadow: var(--shadow);
}
.workflow-icon-wrap { width: 72px; height: 72px; border-radius: 18px; display: flex; align-items: center; justify-content: center; }
.workflow-main-card h2 { font-size: 26px; font-weight: 900; color: #0f172a; letter-spacing: -.02em; }
.workflow-main-card > p { font-size: 14px; color: var(--slate); line-height: 1.7; max-width: 420px; }
.workflow-meta { display: flex; gap: 10px; flex-wrap: wrap; }
.workflow-tag { display: flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 8px; font-size: 12px; font-weight: 600; border: 1.5px solid; }
.workflow-tag.prev { background: #ecfdf5; border-color: #6ee7b7; color: #065f46; }
.workflow-tag.next { background: #ede9fe; border-color: #c4b5fd; color: #4c1d95; }
.workflow-dev-badge {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px;
  border-radius: 8px; background: #fffbeb; border: 1.5px solid #fcd34d;
  color: #92400e; font-size: 12px; font-weight: 700;
}
.workflow-dev-badge .dev-dot { width: 8px; height: 8px; border-radius: 50%; background: #f59e0b; box-shadow: 0 0 8px rgba(245,158,11,.8); animation: pulse 1.6s ease-in-out infinite; }
.workflow-side { display: flex; flex-direction: column; gap: 16px; }
.workflow-info-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.workflow-info-card h4 { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: #94a3b8; margin-bottom: 12px; }
.workflow-step-list { display: flex; flex-direction: column; gap: 10px; }
.workflow-step-item { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; color: #374151; font-weight: 500; }
.wsi-num { width: 22px; height: 22px; border-radius: 6px; background: #f5f3ff; color: #7c3aed; font-size: 10px; font-weight: 800; display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 1px; }

/* ── Coming soon ──────────────────────────────────── */
.coming-soon { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 320px; gap: 12px; color: #94a3b8; }
.coming-soon svg { opacity: .2; }
.coming-soon h3 { font-size: 18px; font-weight: 700; color: #64748b; }
.coming-soon p { font-size: 13px; }
.coming-badge { background: #fffbeb; color: #92400e; font-size: 11px; font-weight: 700; padding: 4px 13px; border-radius: 20px; border: 1.5px solid #fcd34d; }

/* ── Spinner ──────────────────────────────────────── */
.spinner { width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.spinner-blue { border-color: rgba(124,58,237,.18); border-top-color: var(--purple); }
.page-loading { display: flex; align-items: center; justify-content: center; padding: 72px; }

/* ── Global thin scrollbar ────────────────────────── */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: #f1f5f9; border-radius: 99px; }
::-webkit-scrollbar-thumb { background: #c4b5fd; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #a78bfa; }

/* ── Animations ───────────────────────────────────── */
@keyframes fadeIn    { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp   { from { transform: translateY(24px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes slideLeft { from { transform: translateX(48px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes spin      { to { transform: rotate(360deg); } }
@keyframes pulse     { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: .6; transform: scale(.85); } }

/* ── Utility ──────────────────────────────────────── */
.hidden { display: none !important; }
.mono { font-family: 'JetBrains Mono', monospace; }
.text-slate { color: var(--slate); }
.text-sm { font-size: 12px; }
.fw-700 { font-weight: 700; }
.color-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.link-btn { color: var(--purple); font-size: 12px; font-weight: 600; padding: 4px 9px; border-radius: 6px; transition: all .15s; }
.link-btn:hover { background: var(--purple-light); }
.link-btn.danger { color: var(--red); }
.link-btn.danger:hover { background: var(--red-light); }
.flex-gap { display: flex; align-items: center; gap: 8px; }
.ml-auto { margin-left: auto; }

/* ── Settings page ────────────────────────────────── */
.settings-wrap { padding: 0; }
.settings-tabs { display: flex; gap: 4px; padding: 0 0 20px; }
.stab {
  display: flex; align-items: center; gap: 7px; padding: 9px 18px;
  border-radius: 10px; font-size: 13px; font-weight: 600; color: var(--slate);
  background: transparent; transition: all .15s;
}
.stab:hover { background: #ede9fe; color: var(--purple); }
.stab.active { background: var(--purple); color: #fff; box-shadow: 0 2px 10px rgba(124,58,237,.35); }
.stab-panel.hidden { display: none; }
.settings-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 28px; box-shadow: var(--shadow); margin-bottom: 20px;
}
.settings-card-hdr { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.settings-card-title { font-size: 16px; font-weight: 700; color: #0f172a; margin-bottom: 4px; }
.settings-card-sub { font-size: 13px; color: var(--slate); }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0 20px; }
.settings-logo-row { display: flex; align-items: center; gap: 20px; padding: 16px; border-radius: 10px; background: #f8fafc; border: 1px solid var(--border); margin-bottom: 24px; }
.settings-logo-preview {
  width: 120px; height: 52px; border-radius: 8px; border: 1.5px dashed #cbd5e1;
  display: flex; align-items: center; justify-content: center; background: #fff;
  font-size: 11px; color: #94a3b8; font-weight: 500; overflow: hidden; flex-shrink: 0;
}
.settings-logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.req { color: var(--red); }

/* role badges in users table */
.role-badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.role-badge.role-admin    { background: #ede9fe; color: #5b21b6; }
.role-badge.role-manager  { background: #dbeafe; color: #1d4ed8; }
.role-badge.role-salesman { background: #d1fae5; color: #065f46; }
.role-badge.role-driver   { background: #fef3c7; color: #92400e; }
.role-badge.role-helper   { background: #f1f5f9; color: #475569; }

/* lookups grid + rows */
.lookups-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 900px) { .lookups-grid { grid-template-columns: 1fr; } }
.lookup-row { display: flex; align-items: center; justify-content: space-between; padding: 9px 12px; border-radius: 8px; border: 1px solid var(--border); margin-bottom: 6px; background: #fafbfc; }
.lookup-row:hover { background: #f5f3ff; border-color: #ddd6fe; }
.lookup-name { font-size: 13px; font-weight: 500; color: #1e293b; display: flex; align-items: center; gap: 8px; }
.lookup-actions { display: flex; gap: 4px; }
.color-swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; border: 1px solid rgba(0,0,0,.1); flex-shrink: 0; }
.btn-icon-sm {
  width: 28px; height: 28px; border-radius: 6px; display: flex; align-items: center; justify-content: center;
  color: var(--slate); background: transparent; transition: all .12s;
}
.btn-icon-sm:hover { background: #ede9fe; color: var(--purple); }
.btn-icon-sm.danger:hover { background: #fef2f2; color: var(--red); }

/* ── Hamburger button ─────────────────────────────── */
#btn-menu {
  display: none; width: 38px; height: 38px; border-radius: 10px;
  align-items: center; justify-content: center; flex-shrink: 0;
  color: #475569; background: transparent; transition: all .15s;
}
#btn-menu:hover { background: #ede9fe; color: var(--purple); }

/* Sidebar overlay backdrop */
#sidebar-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45);
  z-index: 39; backdrop-filter: blur(2px);
}
#sidebar-backdrop.open { display: block; }

/* ── Responsive ───────────────────────────────────── */

/* ── Tablet: ≤ 1024px ─────────────────────────────── */
@media (max-width: 1024px) {

  /* Sidebar: slide-in overlay */
  #sidebar {
    position: fixed; left: 0; top: 0; height: 100vh; z-index: 40;
    transform: translateX(-100%);
    transition: transform .26s cubic-bezier(.4,0,.2,1);
  }
  #sidebar.open { transform: translateX(0); }
  #btn-menu { display: flex; }
  #main { width: 100%; }

  /* Topbar */
  #topbar { padding: 10px 16px; gap: 10px; }
  #topbar h1 { font-size: 15px; }
  .topbar-date { display: none; }

  /* Page */
  #page { padding: 16px; }

  /* Touch targets — all inputs and buttons at least 44px tall */
  .form-input, .form-input select, select.form-input {
    min-height: 44px; font-size: 15px;
  }
  .btn { min-height: 44px; font-size: 14px; padding: 10px 18px; }
  .btn-sm { min-height: 38px; }
  .link-btn { min-height: 36px; display: inline-flex; align-items: center; font-size: 13px; }
  .btn-icon-sm { width: 36px; height: 36px; }
  .btn-signout { width: 40px; height: 40px; }

  /* KPI grid */
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .kpi-grid-5 { grid-template-columns: repeat(3, 1fr); }

  /* Dashboard chart + pending row */
  .dash-row-2 { grid-template-columns: 1fr !important; }

  /* Dashboard mid section */
  #mid-grid { grid-template-columns: 1fr !important; }

  /* Toolbar rows — stack vertically */
  .page-toolbar {
    flex-direction: column; align-items: stretch; gap: 10px;
  }
  .page-toolbar .form-group { margin: 0; }
  .page-toolbar .search-input-wrap { max-width: 100% !important; }
  .page-toolbar .ml-auto { margin-left: 0; }

  /* Tables — always scrollable */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 560px; }
  th, td { white-space: nowrap; }

  /* Modals — full-width, slide up from bottom on tablet */
  .modal-backdrop {
    align-items: flex-end; padding: 0;
  }
  .modal {
    max-width: 100% !important; width: 100%;
    border-radius: 20px 20px 0 0;
    max-height: 92vh;
    animation: slideUp .25s cubic-bezier(.4,0,.2,1);
  }
  .modal-body { padding: 20px 18px; }
  .modal-header { padding: 18px 18px 14px; }
  .modal-footer {
    padding: 14px 18px;
    flex-direction: column-reverse; gap: 8px;
  }
  .modal-footer .btn { width: 100%; justify-content: center; }
  .modal-footer .btn-ghost { background: #f1f5f9; }

  /* Order lines table inside modal */
  .order-lines-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .order-lines-wrap table { min-width: 480px; }

  /* Settings */
  .settings-grid { grid-template-columns: 1fr 1fr; }
  .lookups-grid  { grid-template-columns: 1fr; }

  /* Section header */
  .section-header { flex-wrap: wrap; gap: 8px; padding: 14px 16px; }
}

/* ── Mobile / small tablet: ≤ 640px ──────────────── */
@media (max-width: 640px) {
  #topbar { padding: 8px 12px; gap: 8px; }
  #topbar h1 { font-size: 14px; }
  .topbar-user-info { display: none; }

  #page { padding: 10px; }

  /* KPI cards */
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi-grid-5 { grid-template-columns: repeat(2, 1fr); }
  .kpi-value { font-size: 20px; }
  .kpi-card  { padding: 14px 12px; gap: 10px; }
  .kpi-icon-wrap { width: 42px; height: 42px; border-radius: 12px; }
  .kpi-label { font-size: 9px; }
  .kpi-sub   { font-size: 10.5px; }

  .card { border-radius: 12px; }

  /* Tables */
  table { font-size: 12px; min-width: 480px; }
  th, td { padding: 9px 10px; }

  /* Modal full screen on small mobile */
  .modal { max-height: 96vh; }

  /* Settings */
  .settings-grid { grid-template-columns: 1fr; }
  .settings-tabs { flex-wrap: wrap; gap: 6px; }
  .stab { padding: 8px 12px; font-size: 12px; flex: 1; justify-content: center; }
  .settings-logo-row { flex-direction: column; align-items: flex-start; }

  /* Section header action button full width */
  .section-header .btn { width: 100%; justify-content: center; }

  /* Footer */
  #app-footer { font-size: 10.5px; padding: 12px 16px; }

  /* Topbar action button full-width on tiny screens */
  #topbar-actions .btn { font-size: 13px; padding: 8px 14px; }
}
