/* Gina's Transport — Design Tokens & App Styles */
/* Fonts loaded via <link> in index.html for parallel, non-blocking fetch */

:root {
  --bg:        #FAF6F0;
  --surface:   #FFFFFF;
  --surface-2: #F4EEE5;
  --ink:       #2A1F17;
  --ink-2:     #57463A;
  --muted:     #8B7766;
  --line:      #EADFD0;
  --line-2:    #DCCDB8;

  --in:        #3D7A52;   /* green — sales / money in  */
  --in-bg:     #DDF0E5;
  --in-ink:    #1B4D31;
  --out:       #C0563A;   /* reddish — expenses / money out */
  --out-bg:    #FAE4DC;
  --out-ink:   #7A2D1A;
  --gold:      #C9A24A;

  --display: 'Bricolage Grotesque', ui-rounded, system-ui, sans-serif;
  --sans:    'Inter', system-ui, sans-serif;

  --r-sm:  10px;
  --r-md:  16px;
  --r-lg:  22px;
  --r-xl:  28px;

  --shadow-card: 0 1px 0 rgba(42,31,23,0.04), 0 8px 24px -12px rgba(42,31,23,0.12);
  --shadow-pop:  0 24px 48px -16px rgba(42,31,23,0.25);
}

*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

/* Eliminate the 300ms tap delay & double-tap zoom on interactive elements */
button, a, input, label, .driver-card-main, .driver-more-btn,
.tabbar button, .chip, .pill, .icon-btn, .settings-row, .history-row,
.numpad button, .palette-swatch, .date-chip, .toggle {
  touch-action: manipulation;
}

html, body {
  margin: 0; padding: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'ss01', 'cv11';
  height: 100%;
  overscroll-behavior: none;
}

button { font: inherit; color: inherit; cursor: pointer; border: none; background: none; padding: 0; }
input, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }

/* ── App shell ── */
#app {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

.screen {
  display: flex; flex-direction: column;
  flex: 1; overflow: hidden;
}

/* ── Status / offline bar ── */
.offline-bar {
  background: var(--ink); color: #fff;
  padding: 8px 16px;
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 500;
  flex-shrink: 0;
}
.offline-bar svg { flex-shrink: 0; }

/* ── App header ── */
.app-header {
  padding: env(safe-area-inset-top, 14px) 20px 10px;
  padding-top: max(env(safe-area-inset-top, 0px), 14px);
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 12px; flex-shrink: 0;
}
.app-header .title {
  font-family: var(--display);
  font-weight: 600; font-size: 30px;
  letter-spacing: -0.02em; line-height: 1;
}
.app-header .subtitle {
  font-size: 13px; color: var(--muted); margin-top: 4px;
}
.app-header .hdr-actions {
  display: flex; gap: 8px; align-items: center;
}
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--line);
  display: grid; place-items: center;
  color: var(--ink-2); flex-shrink: 0;
}

/* ── Scrollable content area ── */
.app-scroll {
  flex: 1; overflow-y: auto;
  padding: 4px 16px 100px;
  -webkit-overflow-scrolling: touch;
  contain: layout style;        /* isolate paint/layout from rest of app */
  overscroll-behavior: contain;
}
.app-scroll::-webkit-scrollbar { display: none; }

/* ── Tab bar ── */
.tabbar {
  position: absolute; left: 12px; right: 12px;
  bottom: max(env(safe-area-inset-bottom, 8px), 8px);
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 6px;
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  box-shadow: var(--shadow-card);
  z-index: 20;
}
.tabbar button {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 4px; border-radius: 18px;
  color: var(--muted); font-size: 10.5px; font-weight: 500;
  min-height: 52px; justify-content: center;
  transition: background 120ms, color 120ms;
}
.tabbar button.active { background: var(--ink); color: #fff; }

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 16px;
}

/* ── Driver card ── */
.driver-card {
  width: 100%;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-xl);
  text-align: left;
  position: relative;
  transition: transform 80ms ease, background 200ms, border-color 200ms;
}
.driver-card:active { transform: scale(0.98); }
.driver-card.logged {
  border-color: transparent;
}

/* ── Avatar ── */
.avatar {
  width: 48px; height: 48px; border-radius: 15px;
  display: grid; place-items: center;
  font-family: var(--display); font-weight: 600; font-size: 18px;
  letter-spacing: -0.01em; flex-shrink: 0;
}
.avatar.sm { width: 36px; height: 36px; border-radius: 11px; font-size: 14px; }
.avatar.xs { width: 26px; height: 26px; border-radius: 8px;  font-size: 11px; }
.avatar.lg { width: 56px; height: 56px; border-radius: 18px; font-size: 21px; }

/* ── Pill / chip ── */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 500;
  background: var(--surface-2); color: var(--ink-2);
  white-space: nowrap;
}
.pill.in  { background: var(--in-bg);  color: var(--in-ink); }
.pill.out { background: var(--out-bg); color: var(--out-ink); }
.pill.gold{ background: #F4E4C9; color: #7D5A1A; }

.chip-strip {
  display: flex; gap: 8px; flex-wrap: wrap; padding: 4px 0;
}
.chip {
  padding: 8px 14px; border-radius: 999px;
  background: var(--surface-2); color: var(--ink);
  font-size: 13px; font-weight: 500;
  border: 1.5px solid transparent;
  transition: background 120ms, color 120ms;
}
.chip.active {
  background: var(--ink); color: #fff;
}
.chip.filter-active {
  background: var(--ink); color: #fff; border-color: var(--ink);
}

/* ── Hero net card ── */
.hero-card {
  background: linear-gradient(160deg, #2A1F17 0%, #3A2A1E 100%);
  color: #FAF6F0;
  border-radius: 26px;
  padding: 18px 20px 20px;
  margin-bottom: 16px;
  position: relative; overflow: hidden;
}
.hero-card::before {
  content: '';
  position: absolute; right: -40px; top: -40px;
  width: 160px; height: 160px; border-radius: 50%;
  background: radial-gradient(circle, rgba(61,122,82,0.45), transparent 70%);
  pointer-events: none;
}
.hero-card .eyebrow {
  font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.55;
}
.hero-card .net-num {
  font-family: var(--display);
  font-size: 40px; font-weight: 600;
  letter-spacing: -0.03em; line-height: 1;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.hero-card .net-num .sym { opacity: 0.55; font-size: 24px; margin-right: 4px; }
.hero-card .hero-meta {
  display: flex; gap: 16px; margin-top: 10px; font-size: 12px;
}

/* ── Section header ── */
.section-hdr {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 0 2px 10px;
}
.section-hdr .label {
  font-family: var(--display); font-size: 18px; font-weight: 600; letter-spacing: -0.01em;
}
.section-hdr .hint { font-size: 12px; color: var(--muted); }

/* ── Currency display ── */
.currency { font-variant-numeric: tabular-nums; font-weight: 600; }
.currency.in  { color: var(--in-ink); }
.currency.out { color: var(--out-ink); }
.currency .sym { opacity: 0.55; font-size: 0.75em; margin-right: 2px; }

/* ── Bottom sheet ── */
.sheet-mask {
  position: absolute; inset: 0;
  background: rgba(42,31,23,0.4);
  display: flex; align-items: flex-end;
  z-index: 40;
  animation: fadein 200ms ease;
}
.sheet {
  width: 100%;
  background: var(--surface);
  border-radius: 28px 28px 0 0;
  padding: 8px 0 max(env(safe-area-inset-bottom, 20px), 20px);
  box-shadow: var(--shadow-pop);
  animation: slideup 280ms cubic-bezier(0.2, 0.9, 0.25, 1);
  max-height: 94%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  will-change: transform;       /* GPU layer for smooth slide */
  contain: layout style;
}
.sheet::-webkit-scrollbar { display: none; }
.sheet-handle {
  width: 36px; height: 4px; border-radius: 2px; background: var(--line-2);
  margin: 0 auto 6px;
}
.sheet-header {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px 14px;
}
.sheet-title {
  font-family: var(--display); font-size: 20px; font-weight: 600;
}
.sheet-body { padding: 0 20px 12px; }

@keyframes fadein  { from { opacity: 0; } }
@keyframes slideup { from { transform: translateY(100%); } }

/* ── Toast ── */
.toast {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: 90px;
  background: var(--ink); color: #fff;
  padding: 11px 16px;
  border-radius: 999px;
  font-size: 14px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 8px;
  box-shadow: var(--shadow-pop);
  animation: toastin 280ms cubic-bezier(0.2, 0.9, 0.25, 1);
  z-index: 50;
  white-space: nowrap;
  will-change: transform, opacity;
}
.toast .undo-btn {
  color: #D97757; font-weight: 700; padding: 0 4px; font-size: 13px;
}
@keyframes toastin {
  from { transform: translate(-50%, 12px); opacity: 0; }
}

/* ── Numpad ── */
.numpad {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
}
.numpad button {
  padding: 16px 0; border-radius: 14px;
  background: var(--surface-2);
  font-variant-numeric: tabular-nums; font-size: 22px; font-weight: 500;
  display: grid; place-items: center;
  transition: transform 120ms cubic-bezier(0.2, 0.9, 0.25, 1.4),
              background 120ms ease,
              box-shadow 120ms ease;
  transform: translateZ(0);   /* GPU layer for smooth scaling */
}
.numpad button:active,
.numpad button.pressed {
  background: var(--ink);
  color: #fff;
  transform: scale(0.92);
  box-shadow: 0 0 0 4px rgba(42,31,23,0.08);
}

/* ── Amount display ── */
.amount-display {
  text-align: center;
  font-family: var(--display); font-size: 52px; font-weight: 600;
  letter-spacing: -0.02em; line-height: 1;
  padding: 8px 0 12px;
  font-variant-numeric: tabular-nums;
}
.amount-display .sym { opacity: 0.5; font-size: 32px; margin-right: 4px; }

/* ── Segmented control ── */
.seg {
  display: inline-flex; padding: 4px;
  background: var(--surface-2); border-radius: 999px;
}
.seg button {
  padding: 8px 16px; border-radius: 999px;
  color: var(--muted); font-weight: 500; font-size: 13px;
}
.seg button.active {
  background: var(--surface); color: var(--ink);
  box-shadow: 0 1px 2px rgba(42,31,23,0.08);
}

/* ── Report bar ── */
.report-bar-wrap { margin-bottom: 12px; }
.report-bar-track {
  height: 6px; background: var(--surface-2); border-radius: 3px; margin-top: 4px;
}
.report-bar-fill { height: 100%; border-radius: 3px; transition: width 400ms ease; }

/* ── KPI grid ── */
.kpi-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px; margin-bottom: 18px;
}
.kpi-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 12px 14px;
  contain: layout style;
}
.kpi-card.kpi-in  { background: var(--in-bg);  border-color: transparent; }
.kpi-card.kpi-out { background: var(--out-bg); border-color: transparent; }
.kpi-card.kpi-net { background: var(--ink);    color: #FAF6F0; border-color: transparent; }
.kpi-label {
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted);
}
.kpi-card.kpi-in  .kpi-label { color: var(--in-ink); }
.kpi-card.kpi-out .kpi-label { color: var(--out-ink); }
.kpi-card.kpi-net .kpi-label { color: rgba(250,246,240,0.55); }
.kpi-value {
  font-family: var(--display);
  font-size: 24px; font-weight: 600;
  letter-spacing: -0.02em;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.kpi-card.kpi-in  .kpi-value { color: var(--in-ink); }
.kpi-card.kpi-out .kpi-value { color: var(--out-ink); }
.kpi-meta {
  font-size: 11px; margin-top: 4px; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.kpi-card.kpi-in  .kpi-meta { color: var(--in-ink);  opacity: 0.65; }
.kpi-card.kpi-out .kpi-meta { color: var(--out-ink); opacity: 0.65; }
.kpi-card.kpi-net .kpi-meta { color: rgba(250,246,240,0.6); }

/* ── Chart card ── */
.chart-card {
  padding: 14px;
  contain: layout style;
}
.chart-foot {
  font-size: 12px; color: var(--muted);
  margin-top: 8px;
}
.chart-foot b { color: var(--ink); font-weight: 600; }
.legend {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--ink-2);
  margin-top: 10px;
}
.legend-dot {
  display: inline-block;
  width: 10px; height: 10px; border-radius: 50%;
  flex-shrink: 0;
}

/* ── Driver leaderboard row ── */
.driver-rank-row {
  width: 100%;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 8px;
  text-align: left;
  border-radius: var(--r-md);
  transition: background 80ms;
}
.driver-rank-row:active { background: var(--surface-2); }
.rank-num {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--surface-2); color: var(--muted);
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700;
  flex-shrink: 0;
}
.driver-rank-row:first-child .rank-num {
  background: var(--gold); color: #fff;
}
.rank-bar {
  height: 6px; background: var(--surface-2); border-radius: 3px;
  overflow: hidden;
}
.rank-bar-in { height: 100%; border-radius: 3px; transition: width 400ms ease; }

/* ── Insight cards ── */
.insight-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.insight-card {
  padding: 14px; border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--line);
  contain: layout style;
}
.insight-card.insight-warm { background: var(--in-bg);  border-color: transparent; }
.insight-card.insight-sage { background: var(--out-bg); border-color: transparent; }
.insight-card.insight-gold { background: #F4E4C9;       border-color: transparent; }
.insight-eyebrow {
  font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted);
}
.insight-card.insight-warm .insight-eyebrow { color: var(--in-ink);  opacity: 0.7; }
.insight-card.insight-sage .insight-eyebrow { color: var(--out-ink); opacity: 0.7; }
.insight-card.insight-gold .insight-eyebrow { color: #7D5A1A;        opacity: 0.7; }
.insight-headline {
  font-family: var(--display);
  font-size: 18px; font-weight: 600;
  letter-spacing: -0.01em; line-height: 1.15;
  margin-top: 4px;
}
.insight-sub {
  font-size: 12px; color: var(--ink-2);
  margin-top: 4px; line-height: 1.4;
}

/* ── Today's entries row inside driver action sheet ── */
.todays-entry-row {
  display: flex; align-items: stretch;
}
.todays-entry-main {
  flex: 1; display: flex; align-items: center;
  padding: 12px 14px; text-align: left; min-width: 0;
}
.todays-entry-main:active { background: var(--line-2); }
.todays-entry-del {
  width: 48px; display: grid; place-items: center;
  color: var(--out-ink); flex-shrink: 0;
  border-left: 1px solid var(--line);
}
.todays-entry-del:active { background: var(--out-bg); }

/* ── Driver list row (drill into detail + edit shortcut) ── */
.driver-list-row {
  display: flex; align-items: stretch;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); overflow: hidden;
  contain: layout style;
}
.driver-list-main {
  flex: 1; display: flex; align-items: center; gap: 14px;
  padding: 14px 8px 14px 14px;
  text-align: left; min-width: 0;
}
.driver-list-main:active { opacity: 0.75; }
.driver-list-edit {
  width: 48px; display: grid; place-items: center;
  color: var(--muted); flex-shrink: 0;
  border-left: 1px solid var(--line);
}
.driver-list-edit:active { background: var(--surface-2); }

/* ── Form rows ── */
.form-row { margin-bottom: 14px; }
.form-label {
  font-size: 11px; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 6px;
}
.form-input {
  width: 100%; padding: 13px 14px;
  background: var(--surface-2); border: none; border-radius: var(--r-md);
  font-size: 15px; color: var(--ink);
  -webkit-appearance: none; appearance: none;
}
.form-input:focus { outline: 2px solid var(--in); outline-offset: -1px; }

/* ── Palette picker ── */
.palette-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
}
.palette-swatch {
  height: 44px; border-radius: 12px;
  display: grid; place-items: center;
  font-weight: 700; font-size: 15px;
  border: 3px solid transparent;
  transition: border-color 100ms, transform 80ms;
}
.palette-swatch.selected {
  border-color: var(--ink);
  transform: scale(1.08);
}

/* ── Login / PIN screen ── */
.pin-screen {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  flex: 1; padding: 24px 32px;
  background: linear-gradient(168deg, #FAF6F0 0%, #F4E4C9 60%, #FBE7DD 100%);
}
.pin-logo {
  width: 72px; height: 72px; border-radius: 20px;
  background: var(--ink); color: #FAF6F0;
  display: grid; place-items: center;
  margin-bottom: 20px;
}
.pin-title {
  font-family: var(--display); font-size: 26px; font-weight: 600;
  letter-spacing: -0.015em; text-align: center; margin-bottom: 6px;
}
.pin-sub { font-size: 14px; color: var(--muted); text-align: center; margin-bottom: 32px; }
.pin-dots {
  display: flex; gap: 14px; margin-bottom: 18px;
}
.pin-dot {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--line-2);
  transition: background 120ms, border-color 120ms, transform 120ms;
  transform: translateZ(0);
}
.pin-dot.filled { background: var(--ink); border-color: var(--ink); }
.pin-dot.error  { background: #C0563A; border-color: #C0563A; }
.pin-dot.pop    { animation: dot-pop 220ms cubic-bezier(0.2, 0.9, 0.25, 1.4); }
@keyframes dot-pop {
  0%   { transform: scale(0.4); }
  60%  { transform: scale(1.35); }
  100% { transform: scale(1); }
}

.pin-numpad { width: 100%; }
.pin-numpad .numpad button {
  background: rgba(255,255,255,0.75);
  border: 1px solid var(--line);
  font-size: 26px;
  padding: 18px 0;
  color: var(--ink);
}
.pin-numpad .numpad button:active,
.pin-numpad .numpad button.pressed {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
  box-shadow: 0 0 0 6px rgba(42,31,23,0.10);
}

/* Prominent error banner — clearly visible, dismissible */
.pin-error {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  background: #FAE4DC; color: #7A2D1A;
  border: 1px solid #E9B6A4;
  border-radius: 999px;
  font-size: 13px; font-weight: 600;
  margin-bottom: 18px;
  box-shadow: 0 2px 6px rgba(192,86,58,0.10);
}
.pin-error[hidden] { display: none; }

.pin-error.shake,
.pin-dots.shake { animation: shake 380ms cubic-bezier(0.36, 0.07, 0.19, 0.97); }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-7px); }
  20%, 40%, 60%, 80% { transform: translateX(7px); }
}

/* ── Onboarding ── */
.onboard-screen {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  flex: 1; padding: 36px 28px;
  text-align: center;
  background: linear-gradient(168deg, #FAF6F0 0%, #F4E4C9 60%, #FBE7DD 100%);
}
.onboard-icon {
  width: 80px; height: 80px; border-radius: 22px;
  background: var(--ink); color: #FAF6F0;
  display: grid; place-items: center; margin-bottom: 24px;
}
.onboard-headline {
  font-family: var(--display); font-size: 30px; font-weight: 600;
  letter-spacing: -0.02em; line-height: 1.1; margin-bottom: 12px;
}
.onboard-sub { font-size: 15px; line-height: 1.5; color: var(--ink-2); margin-bottom: 36px; max-width: 300px; }
.btn-primary {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 16px;
  background: var(--ink); color: #fff;
  border-radius: var(--r-md); font-weight: 600; font-size: 16px;
  margin-bottom: 12px;
}
.btn-secondary {
  display: flex; align-items: center; justify-content: center;
  width: 100%; padding: 14px;
  background: transparent; color: var(--muted);
  font-size: 15px;
}
.btn-in {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 15px;
  background: var(--in); color: #fff;
  border-radius: var(--r-md); font-weight: 600; font-size: 15px;
}
.btn-out {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 15px;
  background: var(--out); color: #fff;
  border-radius: var(--r-md); font-weight: 600; font-size: 15px;
}
.btn-ghost {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px; border-radius: var(--r-md);
  background: var(--surface-2); color: var(--ink);
  font-weight: 500; font-size: 15px;
}
button:disabled, .btn-primary:disabled, .btn-in:disabled {
  opacity: 0.4; pointer-events: none;
}

/* ── History filter rows (kind + period stack as two independent dimensions) ── */
.hist-filter-row {
  display: flex; gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 8px;
  scrollbar-width: none;
}
.hist-filter-row::-webkit-scrollbar { display: none; }
.hist-filter-row .chip { flex-shrink: 0; }

/* ── History row ── */
.history-group { margin-bottom: 18px; }
.history-group-hdr {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 0 4px 8px;
}
.history-group-hdr .day {
  font-family: var(--display); font-size: 16px; font-weight: 600;
}
.history-rows {
  background: var(--surface); border-radius: 18px;
  border: 1px solid var(--line); overflow: hidden;
  contain: layout style;
}
.history-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  cursor: pointer; transition: background 80ms;
}
.history-row:not(:first-child) { border-top: 1px solid var(--line); }
.history-row:active { background: var(--surface-2); }

/* ── Empty state ── */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  padding: 48px 24px; text-align: center; color: var(--muted);
}
.empty-state svg { opacity: 0.4; margin-bottom: 12px; }
.empty-state p { font-size: 14px; margin: 0; }

/* ── Settings rows ── */
.settings-section { margin-bottom: 24px; }
.settings-section-title {
  font-size: 11px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted);
  padding: 0 4px 8px;
}
.settings-list {
  background: var(--surface); border-radius: var(--r-lg); border: 1px solid var(--line);
  overflow: hidden;
}
.settings-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; cursor: pointer;
}
.settings-row:not(:first-child) { border-top: 1px solid var(--line); }
.settings-row:active { background: var(--surface-2); }
.settings-row .row-label { font-size: 15px; font-weight: 500; }
.settings-row .row-value { font-size: 14px; color: var(--muted); }

/* ── Toggle switch ── */
.toggle {
  position: relative; width: 44px; height: 26px;
  background: var(--line-2); border-radius: 13px;
  transition: background 200ms; flex-shrink: 0;
}
.toggle.on { background: var(--in); }
.toggle::after {
  content: '';
  position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: transform 200ms cubic-bezier(0.4, 0, 0.2, 1);
}
.toggle.on::after { transform: translateX(18px); }

/* ── Backfill / date picker ── */
.date-chip-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px;
}
.date-chip {
  padding: 14px; border-radius: var(--r-md);
  background: var(--surface-2); text-align: center;
  font-weight: 500; font-size: 14px; border: 2px solid transparent;
  transition: border-color 100ms, background 100ms;
}
.date-chip.selected {
  background: var(--in-bg); color: var(--in-ink); border-color: var(--in);
}

/* ── Logged progress dots ── */
.progress-dots {
  display: flex; gap: 4px; margin-bottom: 16px;
}
.progress-dot {
  flex: 1; height: 5px; border-radius: 3px;
  background: var(--line); transition: background 200ms;
}

/* ── Driver card — split layout ── */
.driver-card-wrap {
  display: flex; align-items: stretch;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-xl); overflow: hidden;
  transition: border-color 200ms, background 200ms;
  contain: layout style;        /* isolate; rerendering one card won't reflow others */
}
.driver-card-main {
  flex: 1; display: flex; align-items: center; gap: 14px;
  padding: 14px 10px 14px 16px;
  text-align: left; min-width: 0;
}
.driver-card-main:active { opacity: 0.75; }
.driver-card-divider {
  width: 1px; background: var(--line); flex-shrink: 0; margin: 10px 0;
}
.driver-more-btn {
  width: 52px; display: grid; place-items: center;
  color: var(--muted); flex-shrink: 0;
  border-radius: 0 var(--r-xl) var(--r-xl) 0;
}
.driver-more-btn:active { background: var(--surface-2); }

/* ── Safe area bottom padding for scrollable content ── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .app-scroll { padding-bottom: calc(100px + env(safe-area-inset-bottom)); }
}
