:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #111827;
  background: #f3f4f6;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: #f3f4f6; }
body { margin: 0; min-height: 100vh; background: #f3f4f6; }
button, input, select, textarea { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.app-shell {
  width: min(100%, 560px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 16px max(28px, env(safe-area-inset-bottom));
}

.topbar, .dialog-header, .vehicle-card-top, .settings-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar { margin-bottom: 18px; }
.eyebrow { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.13em; color: #6b7280; }
h1, h2, h3 { margin: 0; }
h1 { font-size: 1.75rem; line-height: 1.05; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1rem; }

.icon-button {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 14px;
  background: #ffffff;
  color: #111827;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
  font-size: 1.2rem;
  cursor: pointer;
}

.card {
  background: #ffffff;
  border-radius: 24px;
  padding: 22px;
  box-shadow: 0 12px 40px rgba(17,24,39,.08);
}

.status-dot-row {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 750;
  margin-bottom: 24px;
}
.status-dot { width: 11px; height: 11px; border-radius: 999px; display: inline-block; }
.status-dot.ready { background: #22c55e; }
.status-dot.active { background: #f97316; animation: pulse 1.4s infinite; }
.status-dot.review { background: #2563eb; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.35} }

.field-label { display: block; font-size: .82rem; font-weight: 750; color: #374151; margin: 16px 0 7px; }
.input {
  width: 100%;
  min-height: 50px;
  border: 1px solid #d1d5db;
  border-radius: 13px;
  background: #fff;
  padding: 11px 13px;
  color: #111827;
  outline: none;
}
.input:focus { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.textarea { resize: vertical; }
.helper { margin-top: 7px; font-size: .78rem; line-height: 1.4; color: #6b7280; }
.center { text-align: center; }
.muted { color: #6b7280; }

.primary-button {
  width: 100%;
  border: 0;
  border-radius: 22px;
  color: #fff;
  font-weight: 850;
  cursor: pointer;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.12), 0 10px 24px rgba(0,0,0,.10);
}
.primary-button:disabled { opacity: .55; cursor: wait; }
.start-button, .stop-button {
  min-height: 190px;
  margin: 24px 0 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.start-button { background: #16a34a; }
.stop-button { background: #dc2626; }
.button-kicker { font-size: 1.15rem; letter-spacing: .14em; }
.button-main { font-size: 2.5rem; line-height: 1; margin-top: 4px; }
.save-button, .settings-save { min-height: 58px; background: #111827; margin-top: 22px; }

.active-vehicle { text-align: center; font-weight: 750; color: #374151; }
.elapsed { text-align: center; font-size: 3.05rem; font-weight: 850; letter-spacing: -0.05em; margin: 16px 0 2px; }
.text-button { border: 0; background: transparent; padding: 10px 5px; cursor: pointer; font-weight: 700; }
.danger-text { color: #b91c1c; }
#cancelTripButton { display: block; margin: 0 auto; }

.message, .pending-banner {
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 12px;
  font-size: .86rem;
  line-height: 1.35;
  font-weight: 650;
}
.message.info { background: #dbeafe; color: #1e3a8a; }
.message.success { background: #dcfce7; color: #166534; }
.message.error { background: #fee2e2; color: #991b1b; }
.pending-banner { background: #fef3c7; color: #92400e; }
.hidden { display: none !important; }

.miles-box { background: #f9fafb; border-radius: 18px; padding: 17px; text-align: center; }
.miles-label { font-size: .78rem; font-weight: 800; color: #6b7280; text-transform: uppercase; letter-spacing: .08em; }
.miles-input-row { display: flex; justify-content: center; align-items: baseline; gap: 7px; font-size: 1.35rem; font-weight: 800; }
.miles-input { width: 150px; border: 0; border-bottom: 2px solid #d1d5db; background: transparent; text-align: right; font-size: 2.35rem; font-weight: 850; padding: 6px; outline: none; }
.miles-input:focus { border-color: #2563eb; }

.fieldset { border: 0; padding: 0; margin: 22px 0 0; }
.fieldset legend { font-size: .82rem; font-weight: 800; color: #374151; margin-bottom: 9px; }
.purpose-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.purpose-option { position: relative; }
.purpose-option input { position: absolute; opacity: 0; pointer-events: none; }
.purpose-option label { display: flex; min-height: 52px; align-items: center; justify-content: center; text-align: center; padding: 9px; border: 1px solid #d1d5db; border-radius: 13px; font-size: .82rem; font-weight: 750; cursor: pointer; }
.purpose-option input:checked + label { border-color: #111827; background: #111827; color: #fff; }

.money-input-wrap { position: relative; }
.money-input-wrap > span { position: absolute; left: 14px; top: 14px; z-index: 1; color: #6b7280; }
.money-input { padding-left: 30px; }
.details { margin-top: 17px; }
.details summary { cursor: pointer; color: #4b5563; font-size: .84rem; font-weight: 700; }

.footer { text-align: center; color: #9ca3af; font-size: .72rem; line-height: 1.35; padding: 20px 20px 0; }

.settings-dialog {
  width: min(calc(100% - 24px), 560px);
  max-height: calc(100vh - 32px);
  border: 0;
  border-radius: 24px;
  padding: 0;
  box-shadow: 0 22px 80px rgba(0,0,0,.25);
}
.settings-dialog::backdrop { background: rgba(17,24,39,.58); backdrop-filter: blur(2px); }
.settings-dialog form { padding: 20px; overflow-y: auto; max-height: calc(100vh - 32px); }
.settings-section-header { margin-top: 26px; margin-bottom: 10px; }
.small-button { border: 1px solid #d1d5db; background: #fff; border-radius: 10px; padding: 8px 10px; font-size: .8rem; font-weight: 750; cursor: pointer; }
.vehicle-card { border: 1px solid #e5e7eb; border-radius: 16px; padding: 14px; margin-top: 11px; background: #f9fafb; }
.vehicle-card .input { margin-top: 9px; background: #fff; }
.vehicle-card .field-label { margin-top: 10px; }
.two-column { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: .82rem; font-weight: 700; margin-top: 12px; }

@media (max-width: 380px) {
  .purpose-grid, .two-column { grid-template-columns: 1fr; }
  .start-button, .stop-button { min-height: 165px; }
  .button-main { font-size: 2.15rem; }
  .elapsed { font-size: 2.65rem; }
}
