:root {
  --navy: #1e1b4b;
  --navy-2: #312e81;
  --teal: #4f46e5;
  --mint: #e0e7ff;
  --amber: #f59e0b;
  --coral: #4f46e5;
  --violet: #6366f1;
  --sky: #2563eb;
  --ink: #111111;
  --muted: #607086;
  --page: #f5f7fb;
  --card: #ffffff;
  --soft: #eef1f8;
  --border: #dce2ee;
  --success: #22c55e;
  --warning: #f59e0b;
  --error: #dc2626;
  --shadow: 0 14px 34px rgba(30, 27, 75, 0.08);
  --deep-shadow: 0 20px 48px rgba(30, 27, 75, 0.14);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

body.dark {
  --navy: #071426;
  --navy-2: #10233a;
  --ink: #f8fafc;
  --muted: #b9c8d6;
  --page: #0b1320;
  --card: #121f31;
  --soft: #16283d;
  --border: #273a52;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
  --deep-shadow: 0 20px 54px rgba(0, 0, 0, 0.38);
}

body.driver-mode {
  --coral: #10b981;
  --amber: #34d399;
  --teal: #10b981;
  --sky: #059669;
  --mint: #d1fae5;
  --navy: #0f172a;
  --navy-2: #1e293b;
}
body.driver-mode.dark {
  --navy: #020617;
  --navy-2: #0f172a;
}
/* Smooth theme transition when toggling mode */
.topbar, .button, .bottom-nav, .pill, .card, .metric { transition: background 0.35s ease, color 0.35s ease, box-shadow 0.35s ease, border-color 0.35s ease; }

.mode-segment {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 10px 14px 4px;
  padding: 4px;
  border-radius: 999px;
  background: var(--soft);
  border: 1px solid var(--border);
  overflow: hidden;
}

.mode-segment-thumb {
  position: absolute;
  top: 4px;
  left: 4px;
  width: calc(50% - 4px);
  height: calc(100% - 8px);
  border-radius: 999px;
  background: linear-gradient(135deg, var(--sky), #0b7fd1);
  box-shadow: 0 6px 16px rgba(0, 166, 251, 0.35);
  transition: transform 0.32s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.32s ease, box-shadow 0.32s ease;
  z-index: 0;
}

body.driver-mode .mode-segment-thumb {
  transform: translateX(100%);
  background: linear-gradient(135deg, #10b981, #059669);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}

.mode-segment-btn {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 12px;
  border: none;
  background: transparent;
  border-radius: 999px;
  font-weight: 700;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.25s ease;
}

.mode-segment-btn .icon {
  width: 18px;
  height: 18px;
}

.mode-segment-btn.active {
  color: #ffffff;
}

.mode-segment-btn:not(.active):hover {
  color: var(--ink);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 6%, rgba(79, 70, 229, 0.07), transparent 28%),
    radial-gradient(circle at 86% 14%, rgba(37, 99, 235, 0.06), transparent 26%),
    linear-gradient(160deg, #f7f8fc 0%, #eef1f8 100%);
  font-family: Avenir Next, SF Pro Display, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

body.driver-mode {
  background:
    radial-gradient(circle at 12% 6%, rgba(16, 185, 129, 0.08), transparent 28%),
    radial-gradient(circle at 86% 14%, rgba(5, 150, 105, 0.06), transparent 26%),
    linear-gradient(160deg, #f3f6f5 0%, #e9efed 100%);
}

body.dark {
  background:
    radial-gradient(circle at 14% 8%, rgba(0, 191, 166, 0.2), transparent 28%),
    radial-gradient(circle at 85% 12%, rgba(255, 90, 95, 0.13), transparent 26%),
    linear-gradient(140deg, #08111f 0%, #0b1828 44%, #111927 100%);
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  width: min(100%, 480px);
  min-height: 100vh;
  margin: 0 auto;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.68), rgba(255, 255, 255, 0) 180px),
    var(--page);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  position: relative;
  padding-bottom: 82px;
}

body.dark .app-shell {
  background:
    linear-gradient(180deg, rgba(18, 31, 49, 0.72), rgba(18, 31, 49, 0) 180px),
    var(--page);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: 46px 1fr auto 42px;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  color: white;
  background:
    linear-gradient(135deg, var(--navy), var(--navy-2));
  box-shadow: 0 12px 30px rgba(8, 35, 63, 0.2);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background:
    linear-gradient(145deg, var(--teal), var(--sky));
  box-shadow: inset 0 -8px 18px rgba(8, 35, 63, 0.14);
  font-weight: 800;
}

.brand {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0;
}

.tagline {
  margin-top: 2px;
  color: #cdeeed;
  font-size: 12px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  color: white;
  background: transparent;
}

.star-row {
  display: flex;
  gap: 8px;
}

.star-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  transition: transform 140ms ease, border-color 140ms ease, color 140ms ease;
}

.star-button:hover {
  transform: translateY(-1px);
}

.icon {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.screen {
  padding: 18px 16px 24px;
  animation: screenIn 260ms ease-out both;
}

.hero {
  position: relative;
  overflow: hidden;
  padding: 24px;
  color: white;
  background:
    radial-gradient(circle at 84% 30%, rgba(255, 183, 3, 0.36), transparent 22%),
    radial-gradient(circle at 18% 80%, rgba(0, 191, 166, 0.28), transparent 24%),
    linear-gradient(135deg, rgba(9, 38, 74, 0.97), rgba(22, 75, 121, 0.94)),
    repeating-linear-gradient(110deg, rgba(255, 255, 255, 0.08) 0 2px, transparent 2px 18px);
  border-radius: 0;
  box-shadow: var(--deep-shadow);
}

.hero::after {
  content: "";
  position: absolute;
  right: -42px;
  bottom: -42px;
  width: 156px;
  height: 156px;
  border: 24px solid rgba(0, 191, 166, 0.34);
  border-radius: 999px;
}

.hero h1,
.screen h1 {
  margin: 0 0 8px;
  font-size: 31px;
  line-height: 1.05;
  letter-spacing: 0;
}

.screen h2 {
  margin: 18px 0 10px;
  font-size: 22px;
  line-height: 1.15;
}

.screen p {
  margin: 0 0 14px;
  color: var(--muted);
  line-height: 1.45;
}

.hero p {
  color: #d8f4f1;
}

.card {
  margin: 0 0 12px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
  animation: cardRise 320ms ease-out both;
  transition: transform var(--transition), box-shadow var(--transition);
}

.card:hover {
  transform: translateY(-1px);
  box-shadow: var(--deep-shadow);
}

.card.feature {
  border-color: rgba(0, 191, 166, 0.26);
  background:
    linear-gradient(135deg, rgba(0, 191, 166, 0.12), rgba(255, 183, 3, 0.12), rgba(255, 90, 95, 0.08)),
    var(--card);
}

.fare-breakdown {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
}

.fare-breakdown td {
  padding: 6px 0;
  font-size: 14px;
  color: var(--muted);
}

.fare-breakdown td:last-child {
  text-align: right;
  font-weight: 600;
  color: var(--ink);
}

.fare-breakdown .total-row td {
  font-size: 16px;
  font-weight: 800;
  color: var(--ink);
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.card h3 {
  margin: 0 0 8px;
  font-size: 17px;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.title-row {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin-bottom: 8px;
}

.title-icon,
.mini-icon {
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--navy);
  background: var(--mint);
}

.title-icon {
  width: 42px;
  height: 42px;
}

.mini-icon {
  width: 34px;
  height: 34px;
}

body.dark .title-icon,
body.dark .mini-icon {
  color: #79f2e5;
  background: rgba(22, 184, 166, 0.15);
}

.stack {
  display: grid;
  gap: 10px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.field input,
.field select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 11px;
  color: var(--ink);
  background: var(--card);
}

.field select {
  appearance: none;
  background:
    linear-gradient(45deg, transparent 50%, var(--teal) 50%) calc(100% - 18px) 18px / 7px 7px no-repeat,
    linear-gradient(135deg, var(--card), var(--soft));
  padding-right: 34px;
}

.mode-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 0 0 12px;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.mode-toggle button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  border: 0;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
  font-weight: 900;
}

.mode-toggle button.active:first-child {
  color: white;
  background: linear-gradient(135deg, var(--sky), var(--teal));
  box-shadow: 0 9px 18px rgba(0, 166, 251, 0.24);
}

.mode-toggle button.active:last-child {
  color: white;
  background: linear-gradient(135deg, var(--coral), var(--amber));
  box-shadow: 0 9px 18px rgba(255, 90, 95, 0.24);
}

.trips-toggle {
  grid-template-columns: repeat(3, 1fr);
}

.trips-toggle button.active {
  color: white;
  background: linear-gradient(135deg, var(--teal), var(--sky));
  box-shadow: 0 9px 18px rgba(0, 191, 166, 0.24);
}

.passenger-card {
  border-color: rgba(0, 166, 251, 0.24);
  background:
    linear-gradient(135deg, rgba(0, 166, 251, 0.11), rgba(0, 191, 166, 0.08)),
    var(--card);
}

.driver-card {
  border-color: rgba(255, 90, 95, 0.24);
  background:
    linear-gradient(135deg, rgba(255, 90, 95, 0.12), rgba(255, 183, 3, 0.1)),
    var(--card);
}

.inline-note {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  background: var(--soft);
  font-size: 13px;
  line-height: 1.35;
}

.date-button {
  display: grid;
  grid-template-columns: 38px 1fr;
  grid-template-areas:
    "icon date"
    "icon hint";
  align-items: center;
  column-gap: 10px;
  width: 100%;
  min-height: 58px;
  border: 1px solid rgba(0, 191, 166, 0.32);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(0, 191, 166, 0.12), rgba(0, 166, 251, 0.08)),
    var(--card);
  text-align: left;
}

.date-button span {
  grid-area: icon;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  color: white;
  background: linear-gradient(135deg, var(--teal), var(--sky));
}

.date-button strong {
  grid-area: date;
}

.date-button small {
  grid-area: hint;
  color: var(--muted);
  font-weight: 700;
}

.date-dialog {
  width: min(92vw, 380px);
  border: 0;
  border-radius: 8px;
  padding: 0;
  color: var(--ink);
  background: var(--card);
  box-shadow: var(--deep-shadow);
}

.date-dialog::backdrop {
  background: rgba(9, 38, 74, 0.54);
}

.date-panel {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.date-panel input {
  min-height: 48px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 11px;
  color: var(--ink);
  background: var(--soft);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: var(--radius);
  padding: 12px 16px;
  color: white;
  background: linear-gradient(135deg, var(--teal), var(--sky));
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0, 191, 166, 0.25);
  transition: transform var(--transition), box-shadow var(--transition), filter var(--transition);
  text-decoration: none;
}

.button:active,
.bottom-nav button:active,
.mode-toggle button:active,
.date-button:active {
  transform: scale(0.98);
}

.button:hover {
  filter: saturate(1.08);
  box-shadow: 0 10px 22px rgba(0, 191, 166, 0.32);
}

.button.secondary {
  color: var(--navy);
  border: 1px solid var(--navy);
  background: var(--card);
  box-shadow: none;
}

body.dark .button.secondary {
  color: white;
  border-color: var(--border);
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 4px 9px;
  color: var(--navy);
  background: var(--mint);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.pill.warn {
  background: #fef3c7;
}

.pill.danger {
  color: white;
  background: var(--error);
}

.meta {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.price {
  color: var(--teal);
  font-size: 22px;
  font-weight: 900;
}

.route-line {
  display: grid;
  grid-template-columns: 12px 1fr;
  gap: 9px;
  margin: 10px 0;
}

.route-rail {
  position: relative;
  width: 12px;
}

.route-rail::before {
  content: "";
  position: absolute;
  top: 7px;
  bottom: 7px;
  left: 5px;
  width: 2px;
  background: linear-gradient(var(--teal), var(--amber));
  animation: routeGlow 1.8s ease-in-out infinite;
}

.dot {
  position: absolute;
  left: 1px;
  width: 10px;
  height: 10px;
  border-radius: 99px;
  background: var(--teal);
}

.dot.end {
  bottom: 2px;
  background: var(--amber);
}

.dot.start {
  top: 2px;
}

.bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 8;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: min(100%, 480px);
  margin: 0 auto;
  border-top: 1px solid var(--border);
  background: var(--card);
}

.bottom-nav button {
  display: grid;
  place-items: center;
  gap: 4px;
  min-height: 62px;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 800;
  transition: color 160ms ease, transform 160ms ease;
}

.bottom-nav button.active {
  color: var(--coral);
}

.profile-hero {
  display: grid;
  grid-template-columns: 58px 1fr auto;
  align-items: center;
  gap: 12px;
  margin: 0 0 12px;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  animation: cardRise 320ms ease-out both;
}

.profile-hero h2 {
  margin: 0 0 4px;
  font-size: 20px;
}

.profile-hero p {
  margin: 0;
  font-size: 13px;
}

.avatar {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 8px;
  color: white;
  background: linear-gradient(135deg, var(--sky), var(--teal));
  font-weight: 900;
  box-shadow: inset 0 -10px 18px rgba(9, 38, 74, 0.14);
}

.driver-avatar {
  background: linear-gradient(135deg, var(--coral), var(--amber));
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  margin: 0 0 12px;
}

.metric {
  min-height: 72px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  box-shadow: var(--shadow);
  animation: cardRise 320ms ease-out both;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.metric strong {
  display: block;
  margin-top: 7px;
  font-size: 18px;
  line-height: 1.1;
}

.invoice-card {
  overflow: hidden;
}

.invoice-lines {
  display: grid;
  gap: 8px;
  margin: 12px -2px 0;
  padding: 12px;
  border-radius: 8px;
  background: var(--soft);
}

.invoice-lines div,
.invoice-total {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.invoice-lines span,
.invoice-total span {
  color: var(--muted);
  font-size: 13px;
}

.invoice-total {
  margin: 12px -15px -15px;
  padding: 13px 15px;
  color: white;
  background: linear-gradient(135deg, var(--navy), var(--navy-2));
}

.invoice-total span {
  color: rgba(255, 255, 255, 0.78);
}

.admin-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 24px auto;
  padding: 0 0 28px;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 22px;
  color: white;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--navy), var(--violet));
  box-shadow: var(--deep-shadow);
}

.admin-header h1 {
  margin: 0 0 6px;
}

.admin-header p {
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
}

.admin-header .button {
  width: auto;
  min-width: 132px;
}

.admin-shell .metric-grid {
  margin-top: 16px;
}

.admin-tabs {
  display: flex;
  gap: 6px;
  margin-top: 20px;
  padding: 4px;
  border-radius: 10px;
  background: var(--soft);
  border: 1px solid var(--border);
  overflow-x: auto;
}

.admin-tab {
  flex: 1;
  min-width: 110px;
  padding: 10px 14px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease;
}

.admin-tab.active {
  background: var(--card);
  color: var(--navy);
  box-shadow: var(--shadow);
}

.admin-tab-panel {
  animation: screenIn 0.25s ease;
}

.admin-filter-btn {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.admin-filter-btn.active {
  background: var(--navy);
  color: white;
  border-color: var(--navy);
}

.table-wrap {
  overflow-x: auto;
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.admin-table th,
.admin-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.admin-table th {
  color: var(--muted);
  background: var(--soft);
  font-size: 12px;
  text-transform: uppercase;
}

.action-cell {
  display: flex;
  gap: 8px;
  min-width: 200px;
}

.action-cell .button {
  width: auto;
  min-height: 36px;
  padding: 7px 12px;
  font-size: 13px;
  white-space: nowrap;
}

.admin-table tr {
  transition: opacity 200ms ease;
}

@keyframes screenIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes cardRise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes routeGlow {
  0%, 100% {
    opacity: 0.65;
  }
  50% {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}

.alert {
  border-color: rgba(220, 38, 38, 0.35);
  background: rgba(220, 38, 38, 0.08);
}

.success {
  border-color: rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.08);
}

@media (max-width: 420px) {
  .tagline {
    display: none;
  }

  .mode-pill {
    padding: 5px 10px;
    font-size: 12px;
  }

  .profile-hero {
    grid-template-columns: 48px 1fr;
  }

  .profile-hero .pill {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .avatar {
    width: 48px;
    height: 48px;
  }
}

@media (min-width: 760px) {
  body {
    padding: 24px 0;
  }

  .app-shell {
    min-height: calc(100vh - 48px);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
  }

  /* Desktop: dock the nav to the bottom of the centered app-shell, not the viewport */
  .bottom-nav {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    transform: none;
    border-left: 0;
    border-right: 0;
    border-radius: 0 0 8px 8px;
  }
}


/* === ISSUE 14: UI/UX Polish === */

/* Better empty states */
.card p:only-child {
  color: var(--muted);
  text-align: center;
  padding: 12px 0;
}

/* Loading spinner animation */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* Better file input styling for mobile (ISSUE 7) */
input[type="file"] {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 12px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--soft);
  font-size: 14px;
  cursor: pointer;
  transition: border-color var(--transition);
}

input[type="file"]:hover,
input[type="file"]:focus {
  border-color: var(--teal);
  outline: none;
}

/* Mobile touch targets (ISSUE 7) */
@media (max-width: 480px) {
  .button {
    min-height: 50px;
    font-size: 15px;
  }

  .field input,
  .field select {
    min-height: 48px;
    font-size: 16px; /* Prevents zoom on iOS */
  }

  input[type="file"] {
    min-height: 56px;
    padding: 16px;
    font-size: 16px;
  }

  .card {
    padding: 14px;
    margin: 0 0 10px;
  }

  .metric-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid-2 {
    grid-template-columns: 1fr;
  }
}

/* Better gradients for ride cards */
.card.feature {
  border-color: rgba(0, 191, 166, 0.2);
  background:
    linear-gradient(145deg, rgba(0, 191, 166, 0.08), rgba(0, 166, 251, 0.06)),
    var(--card);
}

/* Improved pill styling */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 26px;
  border-radius: 999px;
  padding: 4px 10px;
  color: var(--navy);
  background: var(--mint);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* Smooth transitions on mode switch */
.screen {
  padding: 18px 16px 24px;
  animation: screenIn 200ms ease-out both;
}

/* Better star rating */
.star-row {
  display: flex;
  gap: 6px;
}

.star-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  cursor: pointer;
  transition: transform 100ms ease, border-color 100ms ease, background 100ms ease;
}

.star-button:hover {
  transform: scale(1.1);
  background: rgba(255, 183, 3, 0.1);
}

/* Invoice total polish */
.invoice-total {
  margin: 12px -16px -16px;
  padding: 14px 16px;
  border-radius: 0 0 var(--radius) var(--radius);
  color: white;
  background: linear-gradient(135deg, var(--navy), var(--navy-2));
}

/* Bottom nav polish */
.bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 8;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: min(100%, 480px);
  margin: 0 auto;
  border-top: 1px solid var(--border);
  background: var(--card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.bottom-nav button {
  display: grid;
  place-items: center;
  gap: 3px;
  min-height: 64px;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-size: 11px;
  font-weight: 800;
  transition: color var(--transition), transform var(--transition);
}

.bottom-nav button.active {
  color: var(--teal);
}

body.driver-mode .bottom-nav button.active {
  color: var(--violet);
}

/* Improved metric cards */
.metric {
  min-height: 76px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
  animation: cardRise 320ms ease-out both;
  transition: transform var(--transition);
}

.metric:hover {
  transform: translateY(-2px);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 20px;
  line-height: 1.1;
  color: var(--ink);
}

/* Profile hero improvements */
.profile-hero {
  display: grid;
  grid-template-columns: 58px 1fr auto;
  align-items: center;
  gap: 12px;
  margin: 0 0 14px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: cardRise 320ms ease-out both;
}

/* Admin improvements */
.admin-tab {
  flex: 1;
  min-width: 90px;
  padding: 10px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition), color var(--transition);
}

.admin-tab.active {
  background: var(--card);
  color: var(--navy);
  box-shadow: var(--shadow);
}

/* Fade in animation for results */
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.card:nth-child(1) { animation-delay: 0ms; }
.card:nth-child(2) { animation-delay: 50ms; }
.card:nth-child(3) { animation-delay: 100ms; }
.card:nth-child(4) { animation-delay: 150ms; }
.card:nth-child(5) { animation-delay: 200ms; }


/* === Phase 3 UI/UX Polish === */

/* Empty states */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 32px 20px;
  gap: 6px;
}
.empty-state .empty-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--soft);
  color: var(--muted);
  margin-bottom: 6px;
}
.empty-state .empty-icon .icon { width: 26px; height: 26px; }
.empty-state h3 { margin: 0; font-size: 16px; }
.empty-state p { margin: 0; color: var(--muted); font-size: 13px; }

/* Loading card spinner centering */
.loading-spinner {
  width: 28px;
  height: 28px;
  border-width: 3px;
}

/* Bottom nav adapts to 4 or 5 tabs automatically via inline grid-template-columns */
.bottom-nav button span { font-size: 10.5px; }
.bottom-nav button .icon { width: 20px; height: 20px; }

/* Section headings inside screens */
.screen h2 {
  font-size: 16px;
  margin: 20px 0 10px;
  font-weight: 800;
}

/* Trip detail info lines */
.meta strong { color: var(--ink); font-weight: 700; }

/* Pill refinements for new statuses */
.pill { text-transform: none; letter-spacing: 0; }

/* Confirm & Pay screen emphasis */
.card.feature .title-row h3 { font-size: 17px; }

/* Subtle entrance for cards in lists */
@keyframes cardIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
article.card { animation: cardIn 240ms ease-out both; }

/* Mobile: make 5-tab nav fit nicely */
@media (max-width: 420px) {
  .bottom-nav button span { font-size: 9.5px; }
  .bottom-nav button { min-height: 60px; gap: 2px; }
}


/* === Phase 4: notification badge + timeline === */

/* Notification badge on bottom-nav My Rides icon */
.nav-badge {
  position: absolute;
  top: 8px;
  left: 56%;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--coral);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  line-height: 16px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--card);
}
body.driver-mode .nav-badge { background: var(--violet); }

/* Timeline (ride detail) */
.timeline { display: grid; gap: 0; margin-top: 6px; }
.timeline-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0 8px 4px;
  position: relative;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}
.timeline-step .tl-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--border); flex: 0 0 auto;
  border: 2px solid var(--border);
}
.timeline-step.done { color: var(--ink); }
.timeline-step.done .tl-dot { background: var(--teal); border-color: var(--teal); }
.timeline-step.danger { color: var(--error); }
.timeline-step.danger .tl-dot { background: var(--error); border-color: var(--error); }
/* connector line */
.timeline-step:not(:last-child)::after {
  content: ""; position: absolute; left: 9px; top: 26px; bottom: -4px;
  width: 2px; background: var(--border);
}
.timeline-step.done:not(:last-child)::after { background: var(--teal); }

.price-inline { color: var(--teal); font-weight: 800; }


/* === Phase 5: premium splash + admin polish === */
.hero-splash { text-align: center; padding: 36px 24px; }
.hero-badge {
  display: grid; place-items: center;
  width: 64px; height: 64px; margin: 0 auto 14px;
  border-radius: 20px;
  background: linear-gradient(145deg, var(--teal), var(--sky));
  box-shadow: 0 10px 28px rgba(0,191,166,0.4);
  color: #fff;
}
.hero-badge .icon { width: 32px; height: 32px; }
.hero-splash h1 { font-size: 34px; }

/* Admin status pills reuse .pill; ensure action buttons wrap nicely */
.action-cell { flex-wrap: wrap; gap: 6px; }
.action-cell .button { min-height: 32px; padding: 6px 10px; font-size: 12px; }


/* === Phase 6: ride reference code tag === */
.ref-tag {
  display: inline-block;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--navy);
  background: var(--mint);
  padding: 2px 8px;
  border-radius: 6px;
}
body.dark .ref-tag { color: #79f2e5; background: rgba(22,184,166,0.15); }
body.driver-mode .ref-tag { background: rgba(124,58,237,0.12); color: var(--violet); }


/* === Phase 3.1: animations, splash, logo === */

/* Button press feedback */
.button:active { transform: scale(0.97); }
.bottom-nav button:active { transform: scale(0.92); }

/* Splash entrance */
.hero-splash { animation: splashIn 0.6s cubic-bezier(0.34,1.56,0.64,1) both; }
@keyframes splashIn {
  0% { opacity: 0; transform: translateY(16px) scale(0.96); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
.hero-badge { animation: badgePop 0.7s cubic-bezier(0.34,1.56,0.64,1) both; }
@keyframes badgePop { 0% { transform: scale(0); } 70% { transform: scale(1.12); } 100% { transform: scale(1); } }

/* Loading skeleton */
.skeleton {
  background: linear-gradient(90deg, var(--soft) 25%, var(--border) 37%, var(--soft) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: 8px;
  height: 14px;
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* Empty state subtle float */
.empty-state .empty-icon { animation: floaty 3s ease-in-out infinite; }
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }

/* Card touch feedback */
article.card[role="button"]:active { transform: scale(0.99); }

/* Brand logo (temporary) */
.brand-logo { display: inline-flex; align-items: center; gap: 8px; }
.brand-logo svg { width: 30px; height: 30px; }
.brand-logo .logo-text { font-weight: 800; font-size: 18px; color: #fff; letter-spacing: 0.3px; }
.login-logo { display: grid; place-items: center; gap: 10px; margin: 8px 0 18px; text-align: center; }
.login-logo svg { width: 64px; height: 64px; }
.login-logo .logo-title { font-size: 26px; font-weight: 800; color: var(--navy); }
.login-logo .logo-tagline { font-size: 13px; color: var(--muted); font-weight: 600; }
body.dark .login-logo .logo-title { color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  .hero-splash, .hero-badge, .skeleton, .empty-state .empty-icon { animation: none !important; }
}


/* Admin search input */
.admin-search {
  flex: 1;
  min-width: 180px;
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
  font-size: 13px;
}
.admin-search:focus { outline: none; border-color: var(--teal); }


/* === Guaranteed splash overlay (first screen for everyone) === */
#splashOverlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, #1e1b4b 0%, #312e81 55%, #2563eb 100%);
  opacity: 1;
  transition: opacity 0.5s ease;
}
#splashOverlay.splash-hide { opacity: 0; pointer-events: none; }
#splashOverlay .splash-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  animation: splashUp 0.6s cubic-bezier(0.34,1.56,0.64,1) both;
}
#splashOverlay svg { filter: drop-shadow(0 12px 30px rgba(0,0,0,0.35)); animation: badgePop 0.7s cubic-bezier(0.34,1.56,0.64,1) both; }
#splashOverlay .splash-title { color: #fff; font-size: 32px; font-weight: 800; letter-spacing: 0.5px; }
#splashOverlay .splash-tagline { color: #c7d2fe; font-size: 14px; font-weight: 600; letter-spacing: 0.3px; }
#splashOverlay .splash-spinner {
  margin-top: 14px;
  width: 26px; height: 26px;
  border: 3px solid rgba(255,255,255,0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes splashUp { 0% { opacity: 0; transform: translateY(16px); } 100% { opacity: 1; transform: translateY(0); } }

/* ===== Phase 4.1: top bar, notifications, payment block, micro-interactions ===== */
.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.icon-button {
  position: relative;
  cursor: pointer;
  transition: transform 140ms ease, background-color 140ms ease, border-color 140ms ease;
}
.icon-button:hover { background: rgba(255, 255, 255, 0.14); }
.icon-button:active { transform: scale(0.92); }

/* Notification badge on the top-bar bell */
.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--coral, #ef4444);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--navy, #0b1f3a);
}
.notif-badge[hidden] { display: none; }
body.driver-mode .notif-badge { background: #10b981; }

/* Google Pay payment block */
.gpay-card { border: 1px solid var(--border); }
.gpay-number {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
  color: var(--muted, #607086);
}
.gpay-number strong {
  font-size: 22px;
  letter-spacing: 1px;
  color: var(--text, #0f172a);
  font-variant-numeric: tabular-nums;
}
body.dark .gpay-number strong { color: #e6eefc; }

/* Subtle micro-interactions */
.button { transition: transform 140ms ease, box-shadow 140ms ease, opacity 140ms ease; }
.button:active { transform: translateY(1px) scale(0.99); }
.card { transition: box-shadow 160ms ease, transform 160ms ease; }
article.card[role="button"] { cursor: pointer; }
article.card[role="button"]:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(15, 23, 42, 0.10); }

/* Admin action cell spacing */
.action-cell { white-space: nowrap; }
.action-cell .button { padding: 6px 10px; font-size: 12px; }

/* ===== Phase 4.2: mode pill, sustainability, branding ===== */
.mode-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.2px;
  color: #fff;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.28);
}
body.driver-mode .mode-pill { background: rgba(16, 185, 129, 0.28); }

/* Compact eco badge on cards */
.eco-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 8px 0;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: #047857;
  background: rgba(16, 185, 129, 0.12);
}
.eco-badge .icon { width: 15px; height: 15px; }
body.dark .eco-badge { color: #6ee7b7; background: rgba(16, 185, 129, 0.16); }

/* Larger sustainability panel */
.eco-card {
  border: 1px solid rgba(16, 185, 129, 0.35);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.10), rgba(5, 150, 105, 0.04));
}
.eco-metric-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.eco-metric {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 10px 6px;
  border-radius: 12px;
  background: var(--card, #fff);
  border: 1px solid var(--border, #e6ecf5);
}
.eco-metric strong { font-size: 18px; color: #047857; }
.eco-metric span { font-size: 11px; color: var(--muted, #607086); margin-top: 2px; }
body.dark .eco-metric strong { color: #6ee7b7; }
