/* ============================================================
   TachodoTMS — Sprint 9.4 Premium Design System
   Industrial precision meets modern SaaS
   Font: Syne (headings/UI) + IBM Plex Sans (body) + IBM Plex Mono (data)
   Palette: Deep navy sidebar, crisp white surfaces, electric teal accent
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;500;600;700;800&family=IBM+Plex+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

/* ── TOKENS ─────────────────────────────────────────────────── */
:root {
  --ink:          #0A0F1E;
  --ink-2:        #1A2035;
  --ink-3:        #2D3A52;
  --muted:        #6B7A99;
  --muted-light:  #9DAABF;
  --border:       #E4E9F2;
  --border-dark:  #C8D2E4;
  --surface:      #F5F7FC;
  --surface-2:    #EDF0F8;
  --white:        #FFFFFF;
  --brand:        #00B4D8;
  --brand-dark:   #0096C7;
  --brand-light:  #CAF0F8;
  --brand-ghost:  rgba(0,180,216,.06);
  --brand-glow:   0 0 0 3px rgba(0,180,216,.18);
  --sidebar-bg:   #0A0F1E;
  --sidebar-w:    256px;
  --header-h:     60px;
  --success:      #0ACF83;
  --success-bg:   #E6FAF3;
  --warning:      #FFB547;
  --warning-bg:   #FFF6E6;
  --danger:       #F5365C;
  --danger-bg:    #FEE9EE;
  --info:         #5B6EF5;
  --info-bg:      #ECEFFE;
  --purple:       #8B5CF6;
  --purple-bg:    #EDE9FE;
  --radius-sm:    6px;
  --radius:       10px;
  --radius-lg:    14px;
  --radius-xl:    18px;
  --shadow-xs:    0 1px 2px rgba(10,15,30,.04);
  --shadow-sm:    0 1px 3px rgba(10,15,30,.07), 0 1px 2px rgba(10,15,30,.04);
  --shadow:       0 4px 8px rgba(10,15,30,.06), 0 2px 4px rgba(10,15,30,.04);
  --shadow-md:    0 10px 20px rgba(10,15,30,.08), 0 4px 6px rgba(10,15,30,.04);
  --shadow-lg:    0 20px 40px rgba(10,15,30,.12), 0 8px 16px rgba(10,15,30,.06);
  --t-fast: .12s ease;
  --t-base: .2s ease;
  /* ── Backward-compat aliases (Sprint 9.3 pages) ── */
  --card-bg:        var(--white);
  --text-primary:   var(--ink);
  --text-secondary: var(--ink-3);
  --text-muted:     var(--muted);
  --navy:           var(--ink);
  --slate:          var(--muted);
  --slate-light:    var(--muted-light);
  --blue:           var(--brand);
  --blue-light:     var(--brand-light);
  --input-bg:       var(--white);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-2);
  background: var(--surface);
  display: flex;
  min-height: 100vh;
}

/* ── SIDEBAR ─────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0;
  height: 100vh; z-index: 100;
  transition: transform .28s cubic-bezier(.4,0,.2,1);
  background-image:
    radial-gradient(ellipse at 80% 0%, rgba(0,180,216,.07) 0%, transparent 60%),
    radial-gradient(ellipse at 10% 100%, rgba(91,110,245,.05) 0%, transparent 50%);
}
.sidebar-logo {
  height: var(--header-h);
  display: flex; align-items: center; gap: 11px;
  padding: 0 20px;
  border-bottom: 1px solid rgba(255,255,255,.05);
  text-decoration: none; flex-shrink: 0;
}
.sidebar-logo-icon {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,180,216,.4);
}
.sidebar-logo-text {
  color: #fff;
  font-family: 'Syne', sans-serif;
  font-weight: 700; font-size: 15.5px; letter-spacing: -.2px;
}
.sidebar-logo-text span { color: var(--brand); }
.sidebar-nav {
  flex: 1; overflow-y: auto;
  padding: 12px 0 8px; scrollbar-width: none;
}
.sidebar-nav::-webkit-scrollbar { display: none; }
.nav-section-label {
  font-family: 'Syne', sans-serif;
  font-size: 9.5px; font-weight: 700;
  letter-spacing: 1.4px; text-transform: uppercase;
  color: rgba(255,255,255,.2); padding: 16px 20px 6px;
}
.nav-link {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; margin: 1px 10px;
  color: rgba(255,255,255,.48);
  text-decoration: none; border-radius: var(--radius-sm);
  transition: background var(--t-fast), color var(--t-fast);
  font-size: 13.5px; font-weight: 500; position: relative;
}
.nav-link:hover { background: rgba(255,255,255,.05); color: rgba(255,255,255,.82); }
.nav-link.active { background: rgba(0,180,216,.13); color: var(--brand); font-weight: 600; }
.nav-link.active::after {
  content: ''; position: absolute; right: 0; top: 20%;
  width: 3px; height: 60%;
  background: var(--brand); border-radius: 2px 0 0 2px;
}
.nav-icon {
  width: 22px; height: 22px; display: flex; align-items: center;
  justify-content: center; font-size: 15px; flex-shrink: 0; opacity: .75;
}
.nav-link.active .nav-icon { opacity: 1; }
.lang-btn {
  width: 100%; padding: 6px; background: transparent;
  border: 1px solid rgba(255,255,255,.07);
  color: rgba(255,255,255,.3); border-radius: var(--radius-sm);
  cursor: pointer; font-size: 15px; transition: all var(--t-fast);
}
.lang-btn:hover { background: rgba(255,255,255,.06); color: rgba(255,255,255,.65); border-color: rgba(255,255,255,.14); }
.lang-btn.lang-active { background: rgba(0,180,216,.15); border-color: rgba(0,180,216,.4); color: var(--brand); }
.sidebar-footer {
  padding: 12px 14px; border-top: 1px solid rgba(255,255,255,.05);
  display: flex; align-items: center; gap: 10px; flex-shrink: 0;
}
.sidebar-avatar {
  width: 33px; height: 33px;
  background: linear-gradient(135deg, #2D3A52 0%, #1A2035 100%);
  border: 1px solid rgba(255,255,255,.12); border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,.7); font-family: 'Syne', sans-serif;
  font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.sidebar-user-name { color: rgba(255,255,255,.7); font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { color: rgba(255,255,255,.25); font-size: 11px; }
.btn-logout {
  margin-left: auto; background: transparent;
  border: 1px solid rgba(255,255,255,.08);
  color: rgba(255,255,255,.25); cursor: pointer; font-size: 14px;
  width: 30px; height: 30px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  transition: all var(--t-fast); flex-shrink: 0;
}
.btn-logout:hover { border-color: var(--danger); color: var(--danger); background: rgba(245,54,92,.1); }

/* ── MAIN WRAPPER ────────────────────────────────────────────── */
.main-wrapper { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; min-width: 0; }

/* ── TOPBAR ──────────────────────────────────────────────────── */
.topbar {
  height: var(--header-h); background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 28px; gap: 16px;
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 1px 0 var(--border), var(--shadow-xs);
}
.topbar-title { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 14.5px; color: var(--ink); flex: 1; letter-spacing: -.1px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.page-subtitle { font-size: 13px; color: var(--muted); font-weight: 400; font-family: 'IBM Plex Sans', sans-serif; margin-left: 8px; }

/* ── PAGE CONTENT ─────────────────────────────────────────────── */
.page-content { flex: 1; padding: 26px 28px; }
.main-content  { padding: 26px 28px; flex: 1; }

/* ── PAGE HEADER ─────────────────────────────────────────────── */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; gap: 16px; }
.page-title { font-family: 'Syne', sans-serif; font-size: 20px; font-weight: 700; color: var(--ink); letter-spacing: -.4px; }
.page-desc { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* ── KPI GRID ────────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(192px, 1fr));
  gap: 14px; margin-bottom: 24px;
}
.kpi-card {
  background: var(--white); border-radius: var(--radius-lg);
  padding: 18px 20px; box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  display: flex; align-items: flex-start; gap: 14px;
  transition: box-shadow var(--t-base), transform var(--t-base), border-color var(--t-base);
  position: relative; overflow: hidden;
}
.kpi-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); border-color: var(--border-dark); }
.kpi-card.danger  { border-top: 3px solid var(--danger); }
.kpi-card.warning { border-top: 3px solid var(--warning); }
.kpi-card.success { border-top: 3px solid var(--success); }
.kpi-card.brand   { border-top: 3px solid var(--brand); }
.kpi-icon-wrap { width: 44px; height: 44px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.kpi-icon-wrap.blue   { background: #E0F8FF; }
.kpi-icon-wrap.green  { background: var(--success-bg); }
.kpi-icon-wrap.yellow { background: var(--warning-bg); }
.kpi-icon-wrap.red    { background: var(--danger-bg); }
.kpi-icon-wrap.purple { background: var(--purple-bg); }
.kpi-icon-wrap.teal   { background: rgba(0,180,216,.1); }
.kpi-body  { flex: 1; min-width: 0; }
.kpi-value { font-family: 'IBM Plex Mono', monospace; font-size: 28px; font-weight: 600; color: var(--ink); line-height: 1; letter-spacing: -1px; }
.kpi-label { font-size: 12px; color: var(--muted); margin-top: 5px; font-weight: 500; }
/* legacy */
.kpi-icon { font-size: 20px; }

/* ── CARDS ───────────────────────────────────────────────────── */
.card { background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); border: 1px solid var(--border); }
.card-header { padding: 15px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-title { font-family: 'Syne', sans-serif; font-weight: 600; font-size: 13.5px; color: var(--ink); letter-spacing: -.1px; }
.card-body   { padding: 20px; }
.card-footer { padding: 12px 20px; border-top: 1px solid var(--border); background: var(--surface); border-radius: 0 0 var(--radius-lg) var(--radius-lg); display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* ── DATA TABLES ─────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; }
table.data-table thead tr { background: var(--surface); border-bottom: 2px solid var(--border); }
table.data-table th { font-family: 'Syne', sans-serif; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; padding: 11px 18px; text-align: left; color: var(--muted); white-space: nowrap; }
table.data-table td { padding: 13px 18px; border-bottom: 1px solid var(--border); color: var(--ink-3); font-size: 13.5px; vertical-align: middle; }
table.data-table tbody tr:last-child td { border-bottom: none; }
table.data-table tbody tr { transition: background var(--t-fast); }
table.data-table tbody tr:hover td { background: var(--brand-ghost); }
table.data-table tr.overdue-row td { background: #FFF0F3; }
.cell-primary   { font-weight: 600; color: var(--ink); }
.cell-secondary { color: var(--muted); font-size: 12px; margin-top: 1px; }
.cell-mono      { font-family: 'IBM Plex Mono', monospace; font-size: 12.5px; }
.overdue-text   { color: var(--danger); font-weight: 600; }

/* ── BADGES / STATUS ─────────────────────────────────────────── */
.badge, .status-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 20px;
  font-family: 'Syne', sans-serif;
  font-size: 11px; font-weight: 700; letter-spacing: .2px; white-space: nowrap;
}
.badge-pending, .status-pending       { background: #FEF3C7; color: #92400E; }
.badge-assigned, .status-assigned     { background: #DBEAFE; color: #1E40AF; }
.badge-intransit, .status-intransit   { background: #EDE9FE; color: #5B21B6; }
.badge-arrived, .status-arrived       { background: #CCFBF1; color: #065F46; }
.badge-delivered, .status-delivered   { background: #DCFCE7; color: #14532D; }
.badge-cancelled, .status-cancelled   { background: #FFE4E6; color: #9F1239; }
.badge-available, .status-available   { background: #DCFCE7; color: #14532D; }
.badge-onduty, .status-onduty         { background: #DBEAFE; color: #1E40AF; }
.badge-onroute, .status-onroute       { background: #EDE9FE; color: #5B21B6; }
.badge-maintenance, .status-maintenance { background: #FEF3C7; color: #92400E; }
.badge-active  { background: #DCFCE7; color: #14532D; }
.badge-inactive{ background: var(--surface-2); color: var(--muted); }
.badge-synced  { background: rgba(0,180,216,.1); color: var(--brand-dark); }

/* ── BUTTONS ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8.5px 17px; border-radius: var(--radius-sm);
  font-family: 'Syne', sans-serif;
  font-size: 13px; font-weight: 600; cursor: pointer;
  border: none; text-decoration: none;
  transition: all var(--t-fast);
  line-height: 1.4; letter-spacing: .1px; white-space: nowrap;
}
.btn:hover  { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active { transform: scale(.98); }
.btn-primary { background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%); color: #fff; box-shadow: 0 2px 8px rgba(0,180,216,.3); }
.btn-primary:hover { box-shadow: 0 4px 14px rgba(0,180,216,.4); }
.btn-secondary { background: var(--white); color: var(--ink-3); border: 1.5px solid var(--border); }
.btn-secondary:hover { background: var(--surface); border-color: var(--brand); color: var(--brand-dark); }
.btn-danger { background: linear-gradient(135deg, #F5365C 0%, #D61F4B 100%); color: #fff; }
.btn-success { background: linear-gradient(135deg, var(--success) 0%, #08A569 100%); color: #fff; }
.btn-ghost { background: transparent; color: var(--muted); border: 1.5px solid transparent; }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink-3); border-color: var(--border); }
.btn-sm    { padding: 5.5px 12px; font-size: 12px; }
.btn-xs    { padding: 3px 9px; font-size: 11px; }
.btn-icon  { padding: 7px; border-radius: var(--radius-sm); }

/* ── FORMS ───────────────────────────────────────────────────── */
.form-group  { margin-bottom: 18px; }
.form-label { display: block; font-family: 'Syne', sans-serif; font-size: 11.5px; font-weight: 700; letter-spacing: .4px; color: var(--ink-3); margin-bottom: 6px; text-transform: uppercase; }
.form-control, .form-input, select.form-control {
  width: 100%; padding: 9px 13px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13.5px; background: var(--white); color: var(--ink-2);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  font-family: 'IBM Plex Sans', sans-serif; appearance: none;
}
.form-control:focus, .form-input:focus { outline: none; border-color: var(--brand); box-shadow: var(--brand-glow); }
.form-control::placeholder, .form-input::placeholder { color: var(--muted-light); }
.form-row  { display: grid; grid-template-columns: 1fr 1fr;     gap: 14px; }
.form-row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.form-hint { font-size: 11.5px; color: var(--muted); margin-top: 4px; }

/* ── MODAL ───────────────────────────────────────────────────── */
.modal-backdrop, .modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(10,15,30,.55); z-index: 200;
  align-items: center; justify-content: center;
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.modal-backdrop.open, .modal-overlay.open { display: flex; }
.modal {
  background: var(--white); border-radius: var(--radius-xl);
  width: 540px; max-width: 95vw; max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn .22s cubic-bezier(.34,1.56,.64,1);
  border: 1px solid var(--border);
}
.modal-lg { width: 720px; } .modal-sm { width: 380px; }
@keyframes modalIn {
  from { opacity: 0; transform: scale(.94) translateY(12px); }
  to   { opacity: 1; transform: scale(1)   translateY(0); }
}
.modal-header { padding: 20px 24px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-family: 'Syne', sans-serif; font-size: 15.5px; font-weight: 700; color: var(--ink); letter-spacing: -.2px; }
.modal-close { background: none; border: none; cursor: pointer; color: var(--muted-light); width: 30px; height: 30px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 20px; transition: all var(--t-fast); }
.modal-close:hover { color: var(--danger); background: var(--danger-bg); }
.modal-body   { padding: 24px; }
.modal-footer { padding: 14px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; background: var(--surface); border-radius: 0 0 var(--radius-xl) var(--radius-xl); }

/* ── SEARCH BAR ──────────────────────────────────────────────── */
.search-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 7.5px 13px; background: var(--surface);
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  width: 270px; transition: all var(--t-fast);
}
.search-bar:focus-within { border-color: var(--brand); box-shadow: var(--brand-glow); background: var(--white); }
.search-bar input { border: none; background: transparent; outline: none; font-size: 13px; width: 100%; color: var(--ink-2); font-family: 'IBM Plex Sans', sans-serif; }
.search-bar input::placeholder { color: var(--muted-light); }
.search-icon { color: var(--muted-light); font-size: 14px; flex-shrink: 0; }

/* ── FILTER STRIP ────────────────────────────────────────────── */
.filter-strip { display: flex; gap: 6px; padding: 11px 20px; background: var(--white); border-bottom: 1px solid var(--border); flex-wrap: wrap; align-items: center; }

/* ── ALERTS ──────────────────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: 13px; display: flex; align-items: flex-start; gap: 10px; border: 1px solid; }
.alert-danger  { background: var(--danger-bg);  color: #7F1D1D; border-color: #FECDD3; }
.alert-success { background: var(--success-bg); color: #065F46; border-color: #A7F3D0; }
.alert-warning { background: var(--warning-bg); color: #78350F; border-color: #FDE68A; }
.alert-info    { background: var(--info-bg);    color: #3730A3; border-color: #C7D2FE; }

/* ── TOAST ───────────────────────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 8px; z-index: 999;
}
.toast {
  padding: 13px 18px; border-radius: var(--radius); font-size: 13.5px;
  font-weight: 500; box-shadow: var(--shadow-lg);
  animation: toastIn .3s cubic-bezier(.34,1.56,.64,1);
  min-width: 260px; max-width: 360px;
  display: flex; align-items: center; gap: 10px;
}
.toast-info    { background: var(--ink-2); color: #fff; }
.toast-success { background: var(--success); color: #fff; }
.toast-warning { background: var(--warning); color: #fff; }
.toast-danger  { background: var(--danger);  color: #fff; }
@keyframes toastIn {
  from { transform: translateX(110%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ── PAGINATION ──────────────────────────────────────────────── */
.pagination { display: flex; align-items: center; gap: 4px; }
.page-btn { padding: 5.5px 12px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); background: var(--white); cursor: pointer; font-family: 'IBM Plex Mono', monospace; font-size: 12.5px; font-weight: 500; color: var(--muted); text-decoration: none; transition: all var(--t-fast); }
.page-btn:hover  { background: var(--brand-light); border-color: var(--brand); color: var(--brand-dark); }
.page-btn.active { background: var(--brand); color: #fff; border-color: var(--brand); box-shadow: 0 2px 6px rgba(0,180,216,.3); }

/* ── MAP ─────────────────────────────────────────────────────── */
.map-section { margin-bottom: 22px; }
.map-section .card-body { padding: 0; overflow: hidden; border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
#map { height: 460px; width: 100%; }

/* ── CONNECTION BADGE ────────────────────────────────────────── */
.conn-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 20px; font-family: 'Syne', sans-serif; font-size: 11px; font-weight: 700; letter-spacing: .3px; }
.conn-live         { background: var(--success-bg); color: #065F46; }
.conn-reconnecting { background: var(--warning-bg); color: #78350F; }
.conn-offline      { background: var(--surface-2);  color: var(--muted); }

/* ── VEHICLE MARKER ──────────────────────────────────────────── */
.vehicle-marker-icon { background: var(--brand); color: #fff; border-radius: 50%; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; font-size: 14px; box-shadow: 0 2px 8px rgba(0,0,0,.3); border: 2px solid #fff; }
.vehicle-marker-icon.moving { background: var(--success); }

/* ── EMPTY STATE ─────────────────────────────────────────────── */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 60px 24px; color: var(--muted); text-align: center; }
.empty-state-icon  { font-size: 44px; margin-bottom: 16px; opacity: .35; }
.empty-state-title { font-family: 'Syne', sans-serif; font-size: 15px; font-weight: 700; color: var(--ink-3); margin-bottom: 7px; }
.empty-state-desc  { font-size: 13px; color: var(--muted); max-width: 320px; line-height: 1.6; }

/* ── ROLE CHIPS ──────────────────────────────────────────────── */
.role-chip { display: inline-block; padding: 2px 9px; border-radius: 99px; font-family: 'Syne', sans-serif; font-size: 10.5px; font-weight: 700; letter-spacing: .3px; }
.role-Admin       { background: rgba(245,54,92,.12);  color: var(--danger); }
.role-Manager     { background: rgba(139,92,246,.12); color: var(--purple); }
.role-Dispatcher  { background: rgba(0,180,216,.12);  color: var(--brand-dark); }
.role-Driver      { background: rgba(10,207,131,.12); color: #068457; }
.role-Accounting  { background: rgba(255,181,71,.12); color: #C47E00; }
.locked-badge { background: rgba(245,54,92,.12); color: var(--danger); padding: 2px 7px; border-radius: 4px; font-size: 11px; font-weight: 600; }

/* ── CLIENT CARDS ────────────────────────────────────────────── */
.client-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin-bottom: 22px; }
.client-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px 20px;
  display: flex; flex-direction: column; gap: 10px;
  transition: box-shadow var(--t-base), border-color var(--t-base), transform var(--t-base);
  box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.client-card::before {
  content: ''; position: absolute; top: 0; left: 0;
  width: 4px; height: 100%;
  background: linear-gradient(to bottom, var(--brand), var(--brand-dark));
  opacity: 0; transition: opacity var(--t-base);
}
.client-card:hover { box-shadow: var(--shadow-md); border-color: var(--border-dark); transform: translateY(-2px); }
.client-card:hover::before { opacity: 1; }
.client-card.inactive { opacity: .55; }
.client-name { font-family: 'Syne', sans-serif; font-size: 14.5px; font-weight: 700; color: var(--ink); letter-spacing: -.1px; }
.client-meta { font-size: 12px; color: var(--muted); display: flex; gap: 12px; flex-wrap: wrap; }
.client-meta span { display: flex; align-items: center; gap: 4px; }
.client-actions { display: flex; gap: 7px; margin-top: 4px; }
.badge-active-client   { background: var(--success-bg); color: #065F46; padding: 2px 9px; border-radius: 99px; font-size: 10.5px; font-weight: 700; font-family: 'Syne', sans-serif; }
.badge-inactive-client { background: var(--surface-2); color: var(--muted); padding: 2px 9px; border-radius: 99px; font-size: 10.5px; font-weight: 700; font-family: 'Syne', sans-serif; }

/* ── STATS ROW ───────────────────────────────────────────────── */
.stats-row { display: flex; gap: 1px; background: var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 20px; border: 1px solid var(--border); }
.stat-item { flex: 1; padding: 14px 20px; background: var(--white); text-align: center; }
.stat-item:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.stat-item:last-child  { border-radius: 0 var(--radius) var(--radius) 0; }
.stat-value { font-family: 'IBM Plex Mono', monospace; font-size: 22px; font-weight: 600; color: var(--ink); line-height: 1; }
.stat-label { font-size: 11px; color: var(--muted); margin-top: 4px; font-weight: 500; }

/* ── SECTION DIVIDER ─────────────────────────────────────────── */
.section-divider { display: flex; align-items: center; gap: 12px; margin: 22px 0 16px; }
.section-divider-line { flex: 1; height: 1px; background: var(--border); }
.section-divider-text { font-family: 'Syne', sans-serif; font-size: 10px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted-light); white-space: nowrap; }

/* ── TABS ────────────────────────────────────────────────────── */
.tab-bar { display: flex; gap: 2px; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.tab-btn { padding: 9px 16px; font-family: 'Syne', sans-serif; font-size: 13px; font-weight: 600; color: var(--muted); background: transparent; border: none; cursor: pointer; position: relative; transition: color var(--t-fast); letter-spacing: .1px; }
.tab-btn::after { content: ''; position: absolute; bottom: -2px; left: 0; width: 0; height: 2px; background: var(--brand); border-radius: 2px 2px 0 0; transition: width var(--t-base); }
.tab-btn:hover { color: var(--ink-3); }
.tab-btn.active { color: var(--brand-dark); }
.tab-btn.active::after { width: 100%; }

/* ── DETAIL ITEMS ────────────────────────────────────────────── */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.detail-label { font-family: 'Syne', sans-serif; font-size: 10px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--muted-light); margin-bottom: 3px; }
.detail-value { font-size: 13.5px; font-weight: 500; color: var(--ink-2); }

/* ── HAMBURGER ───────────────────────────────────────────────── */
.hamburger { display: none; flex-direction: column; gap: 5px; background: none; border: none; cursor: pointer; padding: 6px; border-radius: var(--radius-sm); transition: background var(--t-fast); }
.hamburger:hover { background: var(--surface); }
.hamburger-line { width: 20px; height: 2px; background: var(--ink-3); border-radius: 2px; }

/* ── RESPONSIVE ──────────────────────────────────────────────── */
@media (max-width: 1280px) { .kpi-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 1024px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: 8px 0 32px rgba(10,15,30,.4); }
  .main-wrapper { margin-left: 0; }
  .form-row, .form-row3 { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .page-content, .main-content { padding: 16px; }
  .topbar { padding: 0 16px; }
  .hamburger { display: flex; }
  .search-bar { width: 200px; }
}
@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .client-grid { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; }
}

/* ── UTILITY ─────────────────────────────────────────────────── */
.text-muted   { color: var(--muted); }
.text-danger  { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-brand   { color: var(--brand); }
.text-sm      { font-size: 12px; }
.text-xs      { font-size: 11px; }
.font-mono    { font-family: 'IBM Plex Mono', monospace; }
.font-display { font-family: 'Syne', sans-serif; }
.fw-600       { font-weight: 600; }
.fw-700       { font-weight: 700; }
.mt-1 { margin-top: 4px; }   .mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }  .mt-4 { margin-top: 16px; }
.mt-5 { margin-top: 24px; }  .mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.flex-1 { flex: 1; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
