/* =====================================================================
   FleetByte -- design system
   Royal blue / white / dark navy. Mobile-first, no frameworks.
   ===================================================================== */

/* --- Tokens ---------------------------------------------------------- */
:root {
  /* Brand */
  --blue-50:  #EFF6FF;
  --blue-100: #DBEAFE;
  --blue-200: #BFDBFE;
  --blue-300: #93C5FD;
  --blue-400: #60A5FA;
  --blue-500: #3B82F6;
  --blue-600: #2563EB;
  --blue-700: #1D4ED8;   /* primary */
  --blue-800: #1E40AF;
  --blue-900: #1E3A8A;

  --navy-700: #1E293B;
  --navy-800: #0F172A;   /* dark navy */
  --navy-900: #020617;

  /* Neutrals */
  --white:    #FFFFFF;
  --grey-50:  #F8FAFC;
  --grey-100: #F1F5F9;
  --grey-200: #E2E8F0;
  --grey-300: #CBD5E1;
  --grey-400: #94A3B8;
  --grey-500: #64748B;
  --grey-600: #475569;
  --grey-700: #334155;

  /* Status */
  --success:     #059669;
  --success-bg:  #ECFDF5;
  --warning:     #D97706;
  --warning-bg:  #FFFBEB;
  --danger:      #DC2626;
  --danger-bg:   #FEF2F2;
  --info:        #1D4ED8;
  --info-bg:     #EFF6FF;

  /* Semantic */
  --bg:          var(--grey-100);
  --surface:     var(--white);
  --surface-alt: var(--grey-50);
  --border:      var(--grey-200);
  --border-strong: var(--grey-300);
  --text:        var(--navy-800);
  --text-muted:  var(--grey-500);
  --text-soft:   var(--grey-400);
  --primary:     var(--blue-700);
  --primary-dark: var(--blue-800);

  /* Shape & motion */
  --r-sm: 8px;
  --r:    12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-pill: 999px;

  --shadow-xs: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .04);
  --shadow:    0 4px 12px rgba(15, 23, 42, .08);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, .14);
  --shadow-up: 0 -4px 20px rgba(15, 23, 42, .10);

  --ease: cubic-bezier(.4, 0, .2, 1);
  --t-fast: .14s var(--ease);
  --t:      .22s var(--ease);

  /* Layout */
  --header-h: 60px;
  --nav-h:    64px;
  --safe-b:   env(safe-area-inset-bottom, 0px);
  --sidebar-w: 250px;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
          'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
}

/* --- Reset ----------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5 { margin: 0 0 .5em; line-height: 1.25; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 1.65rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.08rem; }
h4 { font-size: .96rem; }
p  { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img, svg, video { max-width: 100%; height: auto; display: block; }
ul, ol { margin: 0 0 1em; padding-left: 1.2em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
small { font-size: .82rem; }
code, pre { font-family: var(--mono); font-size: .86em; }

:focus-visible {
  outline: 2px solid var(--blue-500);
  outline-offset: 2px;
  border-radius: 4px;
}

::selection { background: var(--blue-200); color: var(--navy-800); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; top: -60px; left: 12px; z-index: 200;
  background: var(--primary); color: #fff; padding: 10px 18px;
  border-radius: 0 0 var(--r) var(--r); font-weight: 600;
}
.skip-link:focus { top: 0; }

/* --- Layout ---------------------------------------------------------- */
.container { width: 100%; max-width: 1220px; margin: 0 auto; padding: 0 16px; }
.container-narrow { max-width: 760px; }
.container-tight  { max-width: 460px; }

.stack > * + * { margin-top: 16px; }
.stack-sm > * + * { margin-top: 10px; }
.stack-lg > * + * { margin-top: 26px; }

.row { display: flex; gap: 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.row-center  { display: flex; align-items: center; gap: 10px; }
.row-wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

/* Utilities */
.text-muted { color: var(--text-muted); }
.text-soft  { color: var(--text-soft); }
.text-sm { font-size: .86rem; }
.text-xs { font-size: .78rem; }
.text-lg { font-size: 1.12rem; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.mt-1 { margin-top: 4px; }
.mb-1 { margin-bottom: 4px; }
.mt-0 { margin-top: 0 !important; }
.mb-0 { margin-bottom: 0 !important; }
.mt-2 { margin-top: 8px; }  .mt-3 { margin-top: 14px; } .mt-4 { margin-top: 22px; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 14px; } .mb-4 { margin-bottom: 22px; }
.hidden { display: none !important; }
.full-width { width: 100%; }

/* --- Cards ----------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.card-body { padding: 18px; }
.card-body-tight { padding: 14px; }
.card-header {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-header h2, .card-header h3 { margin: 0; }
.card-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  background: var(--surface-alt);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}
.card-flat { box-shadow: none; }
.card-link { display: block; color: inherit; transition: box-shadow var(--t), transform var(--t); }
.card-link:hover { text-decoration: none; box-shadow: var(--shadow); transform: translateY(-1px); }

/* --- Buttons --------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px;
  min-height: 46px;
  font: inherit; font-weight: 600; font-size: .95rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r);
  cursor: pointer;
  text-decoration: none;
  transition: background var(--t-fast), border-color var(--t-fast),
              box-shadow var(--t-fast), transform var(--t-fast), opacity var(--t-fast);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.btn:hover { text-decoration: none; background: var(--grey-50); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.is-disabled { opacity: .55; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--primary); border-color: var(--primary); color: #fff;
  box-shadow: 0 1px 2px rgba(29, 78, 216, .3);
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }

.btn-dark { background: var(--navy-800); border-color: var(--navy-800); color: #fff; }
.btn-dark:hover { background: var(--navy-700); border-color: var(--navy-700); }

.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { background: #047857; border-color: #047857; }

.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #B91C1C; border-color: #B91C1C; }

.btn-ghost { background: transparent; border-color: transparent; color: var(--primary); }
.btn-ghost:hover { background: var(--blue-50); }

.btn-outline { background: transparent; border-color: var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--blue-50); }

.btn-sm { padding: 8px 14px; min-height: 36px; font-size: .86rem; border-radius: var(--r-sm); }
.btn-lg { padding: 15px 26px; min-height: 54px; font-size: 1.02rem; border-radius: var(--r-lg); }
.btn-block { display: flex; width: 100%; }
.btn-icon { padding: 10px; min-height: 42px; width: 42px; }

.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* Loading state driven by JS */
.btn.is-loading { color: transparent !important; pointer-events: none; position: relative; }
.btn.is-loading::after {
  content: ''; position: absolute; width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,.4); border-top-color: #fff;
  border-radius: 50%; animation: spin .7s linear infinite;
}
.btn:not(.btn-primary):not(.btn-dark):not(.btn-success):not(.btn-danger).is-loading::after {
  border-color: rgba(29,78,216,.25); border-top-color: var(--primary);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Floating action button */
.fab {
  position: fixed; right: 16px; bottom: calc(var(--nav-h) + var(--safe-b) + 16px);
  z-index: 40;
  width: 56px; height: 56px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--primary); color: #fff; border: none;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  transition: transform var(--t), background var(--t);
}
.fab:hover { transform: scale(1.05); background: var(--primary-dark); }
.fab-danger { background: var(--danger); }
.fab-danger:hover { background: #B91C1C; }

/* --- Forms ----------------------------------------------------------- */
.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }

.label {
  display: block; margin-bottom: 6px;
  font-size: .86rem; font-weight: 600; color: var(--grey-700);
}
.label .req { color: var(--danger); }

.input, .select, .textarea {
  width: 100%;
  padding: 12px 14px;
  min-height: 46px;
  font: inherit; font-size: 16px; /* 16px stops iOS zooming on focus */
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  appearance: none;
}
.input::placeholder, .textarea::placeholder { color: var(--text-soft); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .16);
}
.input:disabled, .select:disabled, .textarea:disabled {
  background: var(--grey-100); color: var(--text-muted); cursor: not-allowed;
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.5; }

.select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

.input.has-error, .select.has-error, .textarea.has-error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, .12);
}
.field-error { display: block; margin-top: 5px; font-size: .82rem; color: var(--danger); font-weight: 500; }
.field-hint  { display: block; margin-top: 5px; font-size: .82rem; color: var(--text-muted); }

/* Input with a leading affix (phone prefix) */
.input-group { display: flex; }
.input-group .affix {
  display: flex; align-items: center; padding: 0 12px;
  background: var(--grey-100); border: 1px solid var(--border-strong); border-right: none;
  border-radius: var(--r) 0 0 var(--r);
  font-weight: 600; color: var(--grey-600); white-space: nowrap;
}
.input-group .input { border-radius: 0 var(--r) var(--r) 0; }

/* Checkbox / radio */
.check {
  display: flex; align-items: flex-start; gap: 10px;
  cursor: pointer; font-size: .92rem; line-height: 1.45;
}
.check input[type=checkbox], .check input[type=radio] {
  width: 20px; height: 20px; margin: 1px 0 0; flex-shrink: 0;
  accent-color: var(--primary); cursor: pointer;
}

/* Segmented control */
.segments {
  display: flex; gap: 4px; padding: 4px;
  background: var(--grey-100); border-radius: var(--r); border: 1px solid var(--border);
}
.segments button {
  flex: 1; padding: 9px 12px; min-height: 38px;
  font: inherit; font-size: .88rem; font-weight: 600;
  color: var(--text-muted); background: transparent;
  border: none; border-radius: var(--r-sm); cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}
.segments button.is-active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-xs); }

/* PIN entry */
.pin-input {
  display: flex; gap: 10px; justify-content: center;
}
.pin-input input {
  width: 52px; height: 60px; padding: 0;
  font-size: 1.6rem; font-weight: 700; text-align: center;
  font-family: var(--mono);
  border: 2px solid var(--border-strong); border-radius: var(--r);
  background: var(--surface); color: var(--text);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.pin-input input:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .16);
}
.pin-input input.is-filled { border-color: var(--primary); background: var(--blue-50); }

/* PIN display (shown to the rider) */
.pin-display {
  display: inline-flex; gap: 8px;
}
.pin-display span {
  width: 44px; height: 54px; display: grid; place-items: center;
  font-size: 1.5rem; font-weight: 700; font-family: var(--mono);
  background: var(--navy-800); color: #fff; border-radius: var(--r);
  letter-spacing: 0;
}

/* --- Badges & pills -------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px;
  font-size: .76rem; font-weight: 700; letter-spacing: .01em;
  border-radius: var(--r-pill);
  background: var(--grey-100); color: var(--grey-600);
  white-space: nowrap;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger); }
.badge-info    { background: var(--info-bg);    color: var(--info); }
.badge-muted   { background: var(--grey-100);   color: var(--grey-500); }
.badge-dark    { background: var(--navy-800);   color: #fff; }

.badge-dot::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; flex-shrink: 0;
}

.pulse-dot { position: relative; }
.pulse-dot::after {
  content: ''; position: absolute; inset: -3px;
  border-radius: 50%; border: 2px solid currentColor;
  animation: pulse 1.8s ease-out infinite; opacity: 0;
}
@keyframes pulse {
  0%   { transform: scale(.7); opacity: .8; }
  100% { transform: scale(1.9); opacity: 0; }
}

/* --- Alerts ---------------------------------------------------------- */
.alert {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 16px;
  border-radius: var(--r);
  border: 1px solid transparent;
  font-size: .92rem; line-height: 1.5;
}
.alert-icon { flex-shrink: 0; width: 20px; height: 20px; margin-top: 1px; }
.alert-success { background: var(--success-bg); border-color: #A7F3D0; color: #065F46; }
.alert-warning { background: var(--warning-bg); border-color: #FDE68A; color: #92400E; }
.alert-error, .alert-danger { background: var(--danger-bg); border-color: #FECACA; color: #991B1B; }
.alert-info    { background: var(--info-bg);    border-color: var(--blue-200); color: #1E40AF; }

/* Toasts */
#toast-host {
  position: fixed; left: 50%; transform: translateX(-50%);
  top: calc(var(--header-h) + 10px);
  z-index: 300; width: min(440px, calc(100vw - 24px));
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  padding: 13px 16px; border-radius: var(--r);
  background: var(--navy-800); color: #fff;
  box-shadow: var(--shadow-lg);
  font-size: .92rem; font-weight: 500;
  display: flex; align-items: center; gap: 10px;
  animation: toast-in .25s var(--ease);
}
.toast.is-out { animation: toast-out .2s var(--ease) forwards; }
.toast-success { background: var(--success); }
.toast-error   { background: var(--danger); }
.toast-warning { background: var(--warning); }
@keyframes toast-in  { from { opacity: 0; transform: translateY(-12px); } }
@keyframes toast-out { to   { opacity: 0; transform: translateY(-12px); } }

/* --- Avatars --------------------------------------------------------- */
.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  object-fit: cover; flex-shrink: 0;
  background: var(--grey-200);
  display: grid; place-items: center;
  font-weight: 700; font-size: .86rem; color: #fff;
  overflow: hidden;
}
.avatar-sm { width: 32px; height: 32px; font-size: .74rem; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.05rem; }
.avatar-xl { width: 80px; height: 80px; font-size: 1.5rem; }

/* --- Lists ----------------------------------------------------------- */
.list { list-style: none; margin: 0; padding: 0; }
.list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: none; }
.list-item-link { color: inherit; transition: background var(--t-fast); }
.list-item-link:hover { text-decoration: none; background: var(--grey-50); }

/* Definition rows (receipts, breakdowns) */
.dl { display: flex; flex-direction: column; gap: 9px; }
.dl-row { display: flex; justify-content: space-between; gap: 16px; font-size: .92rem; }
.dl-row dt { color: var(--text-muted); }
.dl-row dd { margin: 0; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.dl-row.is-total {
  padding-top: 11px; margin-top: 3px; border-top: 1px solid var(--border);
  font-size: 1.06rem; font-weight: 700;
}
.dl-row.is-total dt { color: var(--text); font-weight: 700; }
.dl-row.is-credit dd { color: var(--success); }

/* --- Tables ---------------------------------------------------------- */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  background: var(--surface);
}
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { padding: 12px 14px; text-align: left; white-space: nowrap; }
.table th {
  background: var(--surface-alt);
  font-size: .76rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--grey-500);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 1;
}
.table tbody tr { border-bottom: 1px solid var(--border); }
.table tbody tr:last-child { border-bottom: none; }
.table tbody tr:hover { background: var(--grey-50); }
.table td.wrap { white-space: normal; min-width: 200px; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* --- Stat tiles ------------------------------------------------------ */
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-xs);
}
.stat-label {
  font-size: .78rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .04em; color: var(--text-muted); margin-bottom: 6px;
}
.stat-value {
  font-size: 1.55rem; font-weight: 700; line-height: 1.15;
  font-variant-numeric: tabular-nums; color: var(--text);
}
.stat-meta { margin-top: 5px; font-size: .82rem; color: var(--text-muted); }
.stat-up   { color: var(--success); font-weight: 600; }
.stat-down { color: var(--danger);  font-weight: 600; }
.stat-accent { border-left: 3px solid var(--primary); }

/* --- Progress -------------------------------------------------------- */
.progress {
  height: 8px; border-radius: var(--r-pill);
  background: var(--grey-200); overflow: hidden;
}
.progress-bar {
  height: 100%; border-radius: var(--r-pill);
  background: var(--primary);
  transition: width .4s var(--ease);
}
.progress-bar.is-success { background: var(--success); }
.progress-bar.is-warning { background: var(--warning); }

/* --- Empty / loading / error states ---------------------------------- */
.state {
  text-align: center;
  padding: 44px 20px;
  color: var(--text-muted);
}
.state-icon {
  width: 60px; height: 60px; margin: 0 auto 16px;
  display: grid; place-items: center;
  border-radius: 50%; background: var(--grey-100); color: var(--grey-400);
}
.state h3 { color: var(--text); margin-bottom: 6px; font-size: 1.05rem; }
.state p { max-width: 380px; margin: 0 auto 18px; font-size: .92rem; }

.skeleton {
  background: linear-gradient(90deg, var(--grey-200) 25%, var(--grey-100) 50%, var(--grey-200) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite;
  border-radius: var(--r-sm);
}
@keyframes shimmer { to { background-position: -200% 0; } }
.skeleton-line { height: 12px; margin-bottom: 8px; }
.skeleton-line.short { width: 55%; }

.spinner {
  width: 22px; height: 22px;
  border: 2.5px solid var(--grey-200); border-top-color: var(--primary);
  border-radius: 50%; animation: spin .7s linear infinite;
}
.spinner-lg { width: 38px; height: 38px; border-width: 3px; }
.spinner-center { margin: 32px auto; }

/* Offline banner */
.offline-banner {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 250;
  padding: 11px 16px calc(11px + var(--safe-b));
  background: var(--navy-800); color: #fff;
  font-size: .88rem; font-weight: 600; text-align: center;
  transform: translateY(100%); transition: transform var(--t);
}
.offline-banner.is-visible { transform: translateY(0); }

/* --- App shell (customer / driver) ----------------------------------- */
.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex; flex-direction: column;
  padding-bottom: calc(var(--nav-h) + var(--safe-b));
}
.app-shell.no-nav { padding-bottom: 0; }

.app-header {
  position: sticky; top: 0; z-index: 50;
  height: var(--header-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.app-header.is-dark { background: var(--navy-800); border-color: var(--navy-700); color: #fff; }
.app-header.is-dark a, .app-header.is-dark .text-muted { color: rgba(255,255,255,.8); }
.app-header h1 { font-size: 1.05rem; margin: 0; }

.app-main { flex: 1; padding: 16px 0 24px; }
.app-main.flush { padding: 0; }

/* Bottom navigation */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  height: calc(var(--nav-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: var(--shadow-up);
}
.bottom-nav a {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px;
  font-size: .68rem; font-weight: 600;
  color: var(--text-soft);
  text-decoration: none;
  position: relative;
  transition: color var(--t-fast);
  -webkit-tap-highlight-color: transparent;
}
.bottom-nav a:hover { text-decoration: none; color: var(--text-muted); }
.bottom-nav a.is-active { color: var(--primary); }
.bottom-nav a.is-active::before {
  content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 26px; height: 3px; border-radius: 0 0 3px 3px; background: var(--primary);
}
.bottom-nav svg { width: 22px; height: 22px; }
.nav-badge {
  position: absolute; top: 6px; left: 50%; margin-left: 4px;
  min-width: 17px; height: 17px; padding: 0 4px;
  display: grid; place-items: center;
  font-size: .62rem; font-weight: 700; line-height: 1;
  background: var(--danger); color: #fff; border-radius: var(--r-pill);
  border: 2px solid var(--surface);
}

/* --- Maps ------------------------------------------------------------ */
.map {
  width: 100%; height: 320px;
  background: var(--grey-200);
  position: relative; overflow: hidden;
}
.map-full { height: calc(100vh - var(--header-h) - var(--nav-h) - var(--safe-b)); }
.map-rounded { border-radius: var(--r-lg); }
.map-sm { height: 180px; }

.map-placeholder {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  background: var(--grey-100);
  color: var(--text-muted); text-align: center; padding: 20px;
  font-size: .9rem;
}

/* Leaflet marker styling */
.fb-marker {
  display: grid; place-items: center;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(15,23,42,.3);
  border: 2.5px solid #fff;
  font-size: 15px;
}
.fb-marker-driver  { background: var(--navy-800); color: #fff; }
.fb-marker-pickup  { background: var(--success);  color: #fff; }
.fb-marker-dropoff { background: var(--danger);   color: #fff; }
.fb-marker-user    { background: var(--primary);  color: #fff; }
.fb-marker-incident{ background: var(--danger);   color: #fff; animation: pulse-marker 1.4s infinite; }
@keyframes pulse-marker { 50% { transform: scale(1.15); } }

/* Sheet that sits over the map */
.map-sheet {
  position: relative; z-index: 20;
  margin-top: -22px;
  background: var(--surface);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  box-shadow: var(--shadow-up);
  padding: 18px 16px 20px;
}
.map-sheet::before {
  content: ''; display: block;
  width: 38px; height: 4px; border-radius: 2px;
  background: var(--border-strong);
  margin: -6px auto 14px;
}

/* --- Service picker (booking) ---------------------------------------- */
.service-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 10px;
}
.service-tile {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 14px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--text);
  font-size: .8rem; font-weight: 600; text-align: center;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
  cursor: pointer;
}
.service-tile:hover { text-decoration: none; border-color: var(--blue-300); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.service-tile svg { width: 26px; height: 26px; color: var(--primary); }
.service-tile.is-disabled { opacity: .45; pointer-events: none; }

/* Vehicle category option */
.category-option {
  display: flex; align-items: center; gap: 13px;
  width: 100%; padding: 13px 14px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  cursor: pointer; text-align: left;
  font: inherit; color: inherit;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.category-option:hover { border-color: var(--blue-300); }
.category-option.is-selected { border-color: var(--primary); background: var(--blue-50); }
.category-option .cat-icon {
  width: 42px; height: 42px; flex-shrink: 0;
  display: grid; place-items: center;
  background: var(--grey-100); border-radius: var(--r-sm); color: var(--primary);
}
.category-option.is-selected .cat-icon { background: var(--blue-100); }
.category-option .cat-name { font-weight: 700; font-size: .95rem; }
.category-option .cat-meta { font-size: .78rem; color: var(--text-muted); margin-top: 1px; }
.category-option .cat-price { margin-left: auto; text-align: right; }
.category-option .cat-price strong { font-size: 1.02rem; font-variant-numeric: tabular-nums; }
.category-option .cat-eta { font-size: .74rem; color: var(--text-muted); display: block; }
.category-option.is-unavailable { opacity: .55; }

/* Surge notice */
.surge-notice {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 13px; border-radius: var(--r-sm);
  background: var(--warning-bg); color: #92400E;
  font-size: .85rem; font-weight: 600;
}

/* --- Trip status timeline -------------------------------------------- */
.timeline { position: relative; padding-left: 26px; }
.timeline::before {
  content: ''; position: absolute; left: 7px; top: 6px; bottom: 6px;
  width: 2px; background: var(--border);
}
.timeline-item { position: relative; padding-bottom: 18px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
  content: ''; position: absolute; left: -24px; top: 4px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--border-strong);
}
.timeline-item.is-done::before { background: var(--success); border-color: var(--success); }
.timeline-item.is-active::before { background: var(--primary); border-color: var(--primary); }
.timeline-title { font-weight: 600; font-size: .92rem; }
.timeline-meta { font-size: .8rem; color: var(--text-muted); }

/* Route summary (pickup -> dropoff) */
.route {
  display: grid; grid-template-columns: 18px 1fr; gap: 0 12px;
  font-size: .92rem;
}
.route-marker { display: grid; place-items: center; padding-top: 4px; }
.route-dot { width: 10px; height: 10px; border-radius: 50%; }
.route-dot.is-pickup  { background: var(--success); }
.route-dot.is-dropoff { background: var(--danger); }
.route-line { width: 2px; flex: 1; background: var(--border-strong); min-height: 22px; margin: 3px 0; }
.route-text { padding-bottom: 14px; min-width: 0; }
.route-text:last-child { padding-bottom: 0; }
.route-label { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-soft); }
.route-value { line-height: 1.4; word-break: break-word; }

/* --- Chat ------------------------------------------------------------ */
.chat-thread { display: flex; flex-direction: column; gap: 10px; padding: 4px 0; }
.chat-msg { max-width: 78%; padding: 10px 14px; border-radius: var(--r-lg); font-size: .92rem; line-height: 1.45; }
.chat-msg.is-mine { align-self: flex-end; background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.chat-msg.is-theirs { align-self: flex-start; background: var(--grey-100); color: var(--text); border-bottom-left-radius: 4px; }
.chat-time { display: block; margin-top: 3px; font-size: .7rem; opacity: .7; }
.quick-replies { display: flex; gap: 7px; overflow-x: auto; padding: 4px 0 8px; -webkit-overflow-scrolling: touch; }
.quick-replies button {
  flex-shrink: 0; padding: 7px 13px;
  font: inherit; font-size: .82rem; font-weight: 500;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--r-pill); cursor: pointer; color: var(--text);
  transition: background var(--t-fast);
}
.quick-replies button:hover { background: var(--blue-50); border-color: var(--blue-300); }

/* --- Modal ----------------------------------------------------------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(15, 23, 42, .55);
  display: grid; place-items: end center;
  padding: 0;
  animation: fade-in .2s var(--ease);
  overscroll-behavior: contain;
}
@media (min-width: 640px) {
  .modal-backdrop { place-items: center; padding: 20px; }
}
@keyframes fade-in { from { opacity: 0; } }

.modal {
  width: 100%; max-width: 480px;
  max-height: 90vh; overflow-y: auto;
  background: var(--surface);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  box-shadow: var(--shadow-lg);
  animation: sheet-up .26s var(--ease);
}
@media (min-width: 640px) {
  .modal { border-radius: var(--r-xl); animation: fade-in .2s var(--ease); }
}
@keyframes sheet-up { from { transform: translateY(100%); } }

.modal-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px 20px 0;
}
.modal-header h3 { margin: 0; }
.modal-body { padding: 16px 20px 20px; }
.modal-footer { padding: 0 20px 20px; display: flex; gap: 10px; }
.modal-footer .btn { flex: 1; }
.modal-close {
  width: 34px; height: 34px; display: grid; place-items: center;
  background: var(--grey-100); border: none; border-radius: 50%;
  cursor: pointer; color: var(--text-muted); flex-shrink: 0;
}
.modal-close:hover { background: var(--grey-200); }

/* --- Admin shell ----------------------------------------------------- */
.admin-layout { display: flex; min-height: 100vh; background: var(--bg); }

.admin-sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--navy-800); color: #fff;
  display: flex; flex-direction: column;
  position: fixed; inset: 0 auto 0 0; z-index: 90;
  transform: translateX(-100%);
  transition: transform var(--t);
  overflow-y: auto;
}
.admin-sidebar.is-open { transform: translateX(0); }

.admin-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,.09);
  font-weight: 700; font-size: 1.05rem; color: #fff;
}
.admin-brand:hover { text-decoration: none; }

.admin-nav { padding: 12px 10px 24px; flex: 1; }
.admin-nav-section {
  padding: 16px 10px 6px;
  font-size: .68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: rgba(255,255,255,.4);
}
.admin-nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; margin-bottom: 2px;
  border-radius: var(--r-sm);
  color: rgba(255,255,255,.78);
  font-size: .89rem; font-weight: 500;
  transition: background var(--t-fast), color var(--t-fast);
}
.admin-nav a:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.admin-nav a.is-active { background: var(--primary); color: #fff; font-weight: 600; }
.admin-nav svg { width: 18px; height: 18px; flex-shrink: 0; }
.admin-nav .count {
  margin-left: auto; padding: 1px 7px;
  font-size: .7rem; font-weight: 700;
  background: var(--danger); color: #fff; border-radius: var(--r-pill);
}

.admin-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.admin-topbar {
  position: sticky; top: 0; z-index: 45;
  height: 58px; display: flex; align-items: center; gap: 12px;
  padding: 0 16px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.admin-content { flex: 1; padding: 20px 16px 40px; }

.admin-backdrop {
  position: fixed; inset: 0; z-index: 85;
  background: rgba(15,23,42,.5);
}

.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; margin-bottom: 20px;
}
.page-head h1 { margin: 0 0 3px; font-size: 1.4rem; }
.page-head p { margin: 0; color: var(--text-muted); font-size: .9rem; }

/* Filter bar */
.filters {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end;
  padding: 14px; margin-bottom: 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
}
.filters .field { margin: 0; flex: 1 1 160px; min-width: 140px; }
.filters .label { font-size: .76rem; margin-bottom: 4px; }
.filters .input, .filters .select { min-height: 40px; padding: 8px 12px; font-size: .88rem; }
.filters .select { padding-right: 34px; }

/* Pagination */
.pagination {
  display: flex; gap: 6px; align-items: center; justify-content: center;
  margin-top: 20px; flex-wrap: wrap;
}
.pagination a, .pagination span {
  min-width: 38px; height: 38px; padding: 0 11px;
  display: grid; place-items: center;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text);
  font-size: .88rem; font-weight: 600;
}
.pagination a:hover { background: var(--grey-50); text-decoration: none; border-color: var(--border-strong); }
.pagination .is-current { background: var(--primary); border-color: var(--primary); color: #fff; }
.pagination .is-disabled { opacity: .4; pointer-events: none; }

/* Chart container */
.chart-wrap { position: relative; height: 280px; }
.chart-wrap.is-short { height: 210px; }

/* --- Landing page ---------------------------------------------------- */
.landing { background: var(--white); }

.landing-nav {
  position: sticky; top: 0; z-index: 70;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.landing-nav .container { display: flex; align-items: center; gap: 20px; height: 66px; }
.landing-nav .brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 1.12rem; color: var(--navy-800); }
.landing-nav .brand:hover { text-decoration: none; }
.landing-nav .links { display: none; gap: 24px; margin-left: auto; }
.landing-nav .links a { color: var(--grey-600); font-weight: 500; font-size: .92rem; }
.landing-nav .links a:hover { color: var(--primary); text-decoration: none; }
.landing-nav .actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
@media (min-width: 900px) {
  .landing-nav .links { display: flex; }
  .landing-nav .actions { margin-left: 0; }
}

.hero {
  background: linear-gradient(170deg, var(--navy-800) 0%, var(--blue-900) 58%, var(--blue-800) 100%);
  color: #fff;
  padding: 56px 0 64px;
  position: relative; overflow: hidden;
}
.hero::after {
  content: ''; position: absolute; right: -140px; top: -110px;
  width: 460px; height: 460px; border-radius: 50%;
  background: radial-gradient(circle, rgba(59,130,246,.28), transparent 68%);
  pointer-events: none;
}
.hero-inner { position: relative; z-index: 1; max-width: 660px; }
.hero h1 {
  font-size: clamp(2rem, 6.5vw, 3.3rem);
  line-height: 1.1; margin-bottom: 16px; letter-spacing: -.025em;
}
.hero p { font-size: 1.08rem; color: rgba(255,255,255,.82); margin-bottom: 28px; max-width: 520px; }
.hero .btn-group { gap: 12px; }
.hero-stats {
  display: flex; gap: 30px; margin-top: 44px; flex-wrap: wrap;
  padding-top: 26px; border-top: 1px solid rgba(255,255,255,.15);
}
.hero-stat strong { display: block; font-size: 1.65rem; font-weight: 800; }
.hero-stat span { font-size: .84rem; color: rgba(255,255,255,.7); }

.section { padding: 56px 0; }
.section-alt { background: var(--grey-50); }
.section-head { text-align: center; max-width: 620px; margin: 0 auto 38px; }
.section-head h2 { font-size: clamp(1.5rem, 4vw, 2.05rem); margin-bottom: 10px; }
.section-head p { color: var(--text-muted); font-size: 1.02rem; }

.eyebrow {
  display: inline-block; margin-bottom: 12px;
  padding: 5px 13px; border-radius: var(--r-pill);
  background: var(--blue-50); color: var(--primary);
  font-size: .76rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
}
.hero .eyebrow { background: rgba(255,255,255,.13); color: #fff; }

.feature {
  padding: 26px 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  transition: box-shadow var(--t), transform var(--t);
}
.feature:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.feature-icon {
  width: 46px; height: 46px; margin-bottom: 15px;
  display: grid; place-items: center;
  background: var(--blue-50); color: var(--primary);
  border-radius: var(--r);
}
.feature h3 { font-size: 1.04rem; margin-bottom: 7px; }
.feature p { color: var(--text-muted); font-size: .92rem; margin: 0; }

.split { display: grid; gap: 34px; align-items: center; }
@media (min-width: 860px) { .split { grid-template-columns: 1fr 1fr; gap: 56px; } }

.checklist { list-style: none; padding: 0; margin: 20px 0 0; }
.checklist li {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 9px 0; font-size: .96rem;
}
.checklist svg { flex-shrink: 0; width: 20px; height: 20px; color: var(--success); margin-top: 2px; }

.cta-band {
  background: linear-gradient(120deg, var(--blue-700), var(--blue-900));
  color: #fff; border-radius: var(--r-xl);
  padding: 40px 30px; text-align: center;
}
.cta-band h2 { color: #fff; margin-bottom: 10px; }
.cta-band p { color: rgba(255,255,255,.82); margin-bottom: 24px; }

.landing-footer {
  background: var(--navy-800); color: rgba(255,255,255,.68);
  padding: 46px 0 26px; font-size: .9rem;
}
.landing-footer h4 { color: #fff; font-size: .84rem; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 13px; }
.landing-footer a { color: rgba(255,255,255,.68); display: block; padding: 4px 0; }
.landing-footer a:hover { color: #fff; text-decoration: none; }
.footer-bottom {
  margin-top: 34px; padding-top: 20px;
  border-top: 1px solid rgba(255,255,255,.1);
  display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  font-size: .84rem;
}

/* --- Auth pages ------------------------------------------------------ */
.auth-page {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column;
  background: var(--grey-50);
}
.auth-head { padding: 26px 16px 8px; text-align: center; }
.auth-brand {
  display: inline-flex; align-items: center; gap: 9px;
  font-weight: 800; font-size: 1.2rem; color: var(--navy-800); margin-bottom: 6px;
}
.auth-brand:hover { text-decoration: none; }
.auth-body { flex: 1; display: flex; align-items: flex-start; justify-content: center; padding: 12px 16px 40px; }
.auth-card { width: 100%; max-width: 430px; }
.auth-switch { text-align: center; margin-top: 18px; font-size: .92rem; color: var(--text-muted); }

.demo-box {
  margin-top: 18px; padding: 14px;
  border: 1px dashed var(--border-strong); border-radius: var(--r);
  background: var(--warning-bg);
  font-size: .84rem;
}
.demo-box h4 { margin: 0 0 8px; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: #92400E; }
.demo-box table { width: 100%; border-collapse: collapse; }
.demo-box td { padding: 3px 0; color: #78350F; }
.demo-box td:last-child { text-align: right; font-family: var(--mono); font-size: .8rem; }

/* --- Driver online toggle -------------------------------------------- */
.online-toggle {
  width: 100%; padding: 20px;
  border: none; border-radius: var(--r-lg);
  font: inherit; font-size: 1.12rem; font-weight: 700;
  cursor: pointer; color: #fff;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  transition: background var(--t), box-shadow var(--t);
  box-shadow: var(--shadow);
}
.online-toggle.is-offline { background: var(--navy-800); }
.online-toggle.is-offline:hover { background: var(--navy-700); }
.online-toggle.is-online { background: var(--success); }
.online-toggle.is-online:hover { background: #047857; }
.online-toggle .status-dot {
  width: 12px; height: 12px; border-radius: 50%; background: currentColor;
}

/* Incoming ride offer card */
.offer-card {
  border: 2px solid var(--primary);
  border-radius: var(--r-lg);
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  animation: offer-in .3s var(--ease);
}
@keyframes offer-in { from { opacity: 0; transform: scale(.96); } }
.offer-timer {
  height: 5px; background: var(--blue-100);
}
.offer-timer-bar {
  height: 100%; background: var(--primary);
  transition: width 1s linear;
}
.offer-fare { font-size: 1.5rem; font-weight: 800; font-variant-numeric: tabular-nums; }

/* --- Receipt --------------------------------------------------------- */
.receipt { max-width: 460px; margin: 0 auto; }
.receipt-head { text-align: center; padding-bottom: 18px; border-bottom: 1px dashed var(--border-strong); }
.receipt-total {
  padding: 16px; margin: 16px 0;
  background: var(--navy-800); color: #fff; border-radius: var(--r);
  display: flex; align-items: center; justify-content: space-between;
}
.receipt-total strong { font-size: 1.4rem; font-variant-numeric: tabular-nums; }

/* --- Star rating ----------------------------------------------------- */
.star-rating { display: flex; gap: 8px; justify-content: center; }
.star-rating button {
  background: none; border: none; padding: 4px; cursor: pointer;
  color: var(--grey-300); transition: color var(--t-fast), transform var(--t-fast);
}
.star-rating button:hover { transform: scale(1.12); }
.star-rating button.is-on { color: #F59E0B; }
.star-rating svg { width: 40px; height: 40px; }

.rating-inline { display: inline-flex; align-items: center; gap: 3px; color: #F59E0B; font-weight: 600; font-size: .88rem; }
.rating-inline svg { width: 14px; height: 14px; }

/* --- Language switcher ----------------------------------------------- */
.lang-menu { position: relative; }

.lang-trigger {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 11px; min-height: 38px;
  font: inherit; font-size: .84rem; font-weight: 600;
  color: var(--text); background: transparent;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast);
}
.lang-trigger:hover { background: var(--grey-50); border-color: var(--border-strong); }
.app-header.is-dark .lang-trigger,
.landing-nav .lang-trigger { border-color: transparent; }
.app-header.is-dark .lang-trigger { color: #fff; }
.app-header.is-dark .lang-trigger:hover { background: rgba(255,255,255,.1); }

.lang-dropdown {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 80;
  min-width: 170px; padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r);
  box-shadow: var(--shadow-lg);
}
.lang-dropdown[hidden] { display: none; }

/* Pages without a header still get a switcher, parked out of the way. */
.lang-floating {
  position: fixed;
  right: 14px;
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  z-index: 60;
}
.lang-floating .lang-trigger {
  background: var(--surface);
  box-shadow: var(--shadow-md, 0 4px 14px rgba(0,0,0,.14));
}
/* Opens upward so it is never cut off by the bottom of the screen. */
.lang-floating .lang-dropdown { top: auto; bottom: calc(100% + 6px); }
body.has-bottom-nav .lang-floating { bottom: calc(74px + env(safe-area-inset-bottom, 0px)); }

/* In the admin topbar it sits flush with the other controls. */
.admin-topbar .lang-trigger { border-color: transparent; padding: 6px 8px; }
.admin-topbar .lang-dropdown { right: 0; left: auto; }
.lang-dropdown a {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 11px; border-radius: var(--r-sm);
  color: var(--text); font-size: .9rem; font-weight: 500;
}
.lang-dropdown a:hover { background: var(--grey-100); text-decoration: none; }
.lang-dropdown a.is-active { color: var(--primary); font-weight: 600; background: var(--blue-50); }

.lang-inline { display: flex; flex-direction: column; gap: 8px; }
.lang-option {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 14px;
  background: var(--surface);
  border: 1.5px solid var(--border); border-radius: var(--r);
  color: var(--text);
  transition: border-color var(--t-fast), background var(--t-fast);
}
.lang-option:hover { text-decoration: none; border-color: var(--blue-300); }
.lang-option.is-active { border-color: var(--primary); background: var(--blue-50); color: var(--primary); }
.lang-code {
  width: 38px; height: 38px; flex-shrink: 0;
  display: grid; place-items: center;
  background: var(--grey-100); border-radius: var(--r-sm);
  font-size: .78rem; font-weight: 800; letter-spacing: .03em;
  color: var(--grey-600);
}
.lang-option.is-active .lang-code { background: var(--blue-100); color: var(--primary); }
.lang-native  { display: block; font-weight: 600; font-size: .95rem; }
.lang-english { display: block; font-size: .78rem; color: var(--text-muted); }

/* --- Print ----------------------------------------------------------- */
@media print {
  .app-header, .bottom-nav, .admin-sidebar, .admin-topbar,
  .btn, .fab, .filters, .pagination, .no-print { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
  .admin-content, .app-main { padding: 0; }
}

/* --- Responsive ------------------------------------------------------ */
@media (min-width: 640px) {
  .container { padding: 0 24px; }
  .card-body { padding: 22px; }
  .app-main { padding: 22px 0 30px; }
}

@media (min-width: 1024px) {
  .admin-sidebar { position: sticky; height: 100vh; transform: none; }
  .admin-backdrop, .admin-menu-btn { display: none; }
  .admin-content { padding: 26px 28px 48px; }
  .admin-topbar { padding: 0 28px; }
  .app-shell { padding-bottom: 0; }
  .bottom-nav {
    position: sticky; top: 0; bottom: auto;
    height: auto; box-shadow: none;
    border-top: none; border-bottom: 1px solid var(--border);
    max-width: 1220px; margin: 0 auto;
  }
  .bottom-nav a { flex-direction: row; gap: 8px; padding: 14px 18px; font-size: .88rem; }
  .bottom-nav a.is-active::before { top: auto; bottom: 0; border-radius: 3px 3px 0 0; width: 100%; }
  .fab { bottom: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}


/* --- Partner portals (corporate, fleet, support) ---------------------
   Partners are not staff, so they get a top bar rather than the admin
   console's sidebar: fewer sections, and it reads well on a laptop or a
   phone without a second layout. */
.portal-body { background: var(--grey-50); }
.portal-layout { min-height: 100vh; display: flex; flex-direction: column; }

.portal-topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 18px;
  padding: 10px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.portal-brand {
  display: flex; align-items: center; gap: 10px;
  color: var(--text); text-decoration: none; white-space: nowrap;
}
.portal-brand:hover { text-decoration: none; }
.portal-brand strong { display: block; font-size: .95rem; line-height: 1.15; }
.portal-brand-sub { display: block; font-size: .72rem; color: var(--text-muted); }

.portal-nav { display: flex; align-items: center; gap: 2px; flex: 1; overflow-x: auto; }
.portal-nav a {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 12px; border-radius: var(--r);
  font-size: .86rem; font-weight: 500;
  color: var(--text-muted); text-decoration: none; white-space: nowrap;
}
.portal-nav a:hover { background: var(--grey-100); color: var(--text); text-decoration: none; }
.portal-nav a.is-active { background: var(--blue-50); color: var(--primary); font-weight: 600; }
.portal-nav .count {
  min-width: 18px; padding: 1px 5px; border-radius: 9px;
  background: var(--danger); color: #fff;
  font-size: .66rem; font-weight: 700; text-align: center;
}

.portal-topbar-end { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.portal-main { flex: 1; padding: 22px 0 60px; }

/* On a phone the nav wraps under the brand instead of squeezing. */
@media (max-width: 860px) {
  .portal-topbar { flex-wrap: wrap; padding: 10px 14px; gap: 10px; }
  .portal-nav { order: 3; width: 100%; padding-bottom: 2px; }
  .portal-topbar-end { order: 2; }
  .portal-me { display: none; }
}
