:root {
  color-scheme: dark;
  --bg: #0c1311;
  --surface: #121d19;
  --surface-2: #182720;
  --border: #294139;
  --text: #f2f7f4;
  --muted: #9eb0a9;
  --accent: #f3c94c;
  --accent-ink: #211b07;
  --success: #63d59c;
  --danger: #ff8f85;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; background: var(--bg); }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 50% -10%, #213a30 0, var(--bg) 42%); }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }

.auth-page { display: grid; place-items: center; padding: 24px; }
.auth-shell { width: min(100%, 440px); }
.auth-card, .action-card, .utility-card, .panel-card, .evidence-card {
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: 0 24px 80px rgba(0,0,0,.28);
}
.auth-card { border-radius: 28px; padding: 34px; }
.brand-mark { width: 58px; height: 58px; border: 7px solid #38584d; border-radius: 50%; position: relative; margin-bottom: 28px; }
.brand-mark::before { content: ""; position: absolute; width: 28px; height: 7px; border-radius: 9px; background: var(--accent); left: 24px; top: 9px; transform: rotate(-38deg); transform-origin: left center; }
.brand-mark span { position: absolute; width: 14px; height: 14px; background: var(--accent); border-radius: 50%; left: 15px; top: 15px; }
.brand-mark.compact { width: 32px; height: 32px; border-width: 4px; margin: 0; flex: none; }
.brand-mark.compact::before { width: 16px; height: 4px; left: 13px; top: 5px; }
.brand-mark.compact span { width: 8px; height: 8px; left: 8px; top: 8px; }
.eyebrow { color: var(--accent); text-transform: uppercase; font-weight: 750; font-size: 12px; letter-spacing: .12em; margin: 0 0 10px; }
h1 { font-size: clamp(32px, 8vw, 54px); line-height: 1.02; letter-spacing: -.045em; margin: 0; }
.auth-card h1 { font-size: 38px; }
h2 { font-size: 22px; letter-spacing: -.025em; margin: 0 0 8px; }
h3 { font-size: 15px; margin: 28px 0 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.lede { color: var(--muted); line-height: 1.6; font-size: 16px; margin: 16px 0 0; }
form { margin-top: 28px; }
label { display: block; font-weight: 700; margin-bottom: 9px; }
input:not([type="checkbox"]), select { width: 100%; border: 1px solid var(--border); border-radius: 14px; background: #0d1713; color: var(--text); padding: 15px 16px; outline: none; }
input:not([type="checkbox"]):focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(243,201,76,.16); }
input[type="checkbox"] { width: 19px; height: 19px; flex: none; margin: 0; accent-color: var(--accent); }
form .button { margin-top: 14px; width: 100%; }
.form-error, .danger-text { color: var(--danger) !important; }
.form-error { margin: 10px 0 0; }

.app-header {
  min-height: calc(72px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) max(20px, env(safe-area-inset-right)) 0 max(20px, env(safe-area-inset-left));
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(82,112,101,.25);
  background: rgba(12,19,17,.92);
  backdrop-filter: blur(20px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.wordmark { display: flex; align-items: center; gap: 12px; font-weight: 800; text-decoration: none; letter-spacing: -.02em; }
.text-button, .back-link { border: 0; background: transparent; color: var(--muted); font-weight: 700; text-decoration: none; padding: 10px; }
.page-shell { width: min(100% - 32px, 780px); margin: 0 auto; padding: 56px 0 max(48px, env(safe-area-inset-bottom)); }
.hero-status { padding: 10px 2px 36px; }
.status-pulse { width: 11px; height: 11px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 7px rgba(99,213,156,.12), 0 0 24px rgba(99,213,156,.5); margin-bottom: 24px; }
.status-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 32px; }
.status-grid > div { border-top: 1px solid var(--border); padding-top: 14px; }
.metric-label { display: block; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; margin-bottom: 7px; }
.status-grid strong { font-size: 15px; }
.action-card, .utility-card, .panel-card { border-radius: 22px; padding: 24px; margin-top: 18px; }
.action-card { display: grid; grid-template-columns: auto 1fr; gap: 0 18px; }
.action-icon { width: 48px; height: 48px; border-radius: 15px; display: grid; place-items: center; background: rgba(243,201,76,.12); font-size: 22px; }
.action-copy p, .utility-card p { color: var(--muted); line-height: 1.55; margin: 0; }
.button-row, .inline-message { grid-column: 1 / -1; }
.button-row { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.button { min-height: 48px; border-radius: 13px; padding: 12px 17px; border: 1px solid transparent; font-weight: 800; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.button:disabled { opacity: .55; cursor: wait; }
.button.primary { background: var(--accent); color: var(--accent-ink); }
.button.secondary { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.inline-message { min-height: 20px; margin: 12px 0 0; color: var(--success); font-size: 14px; }
.utility-card { display: flex; align-items: center; gap: 22px; justify-content: space-between; flex-wrap: wrap; }
.utility-card > div { flex: 1 1 360px; }

.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.section-heading .eyebrow { margin-bottom: 7px; }
.section-count { min-width: 34px; height: 34px; border-radius: 999px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); font-size: 13px; font-weight: 800; }
.history-list { display: grid; gap: 10px; margin-top: 20px; }
.history-item { display: grid; grid-template-columns: 1fr auto; gap: 7px 14px; padding: 16px; border-radius: 16px; background: var(--surface-2); border: 1px solid transparent; text-decoration: none; }
.history-item:focus-visible { outline: 3px solid rgba(243,201,76,.32); outline-offset: 2px; }
.history-title { grid-column: 1; grid-row: 1; font-weight: 850; line-height: 1.25; }
.history-body { grid-column: 1; grid-row: 3; color: var(--muted); line-height: 1.45; font-size: 14px; white-space: pre-line; }
.history-meta { grid-column: 1; grid-row: 2; color: var(--muted); font-size: 12px; }
.history-arrow { grid-column: 2; grid-row: 1 / span 3; align-self: center; color: var(--accent); font-size: 25px; }
.empty-state { color: var(--muted); margin: 0; line-height: 1.5; }

.preferences-form { margin-top: 24px; display: grid; gap: 22px; }
.preferences-form fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.preferences-form legend, .field-label { font-weight: 800; margin: 0 0 10px; }
.choice-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.choice-option { display: flex; align-items: center; gap: 9px; min-height: 46px; padding: 11px 12px; margin: 0; border: 1px solid var(--border); border-radius: 13px; background: #0d1713; font-weight: 750; cursor: pointer; }
.choice-option:has(input:checked) { border-color: #557d6d; background: #172a22; }
.choice-option:has(input:disabled) { opacity: .55; cursor: default; }
.all-brands-option { margin-bottom: 9px; }
.brand-choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field-help { color: var(--muted); font-size: 13px; line-height: 1.45; margin: -13px 0 0; }
.save-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.save-row .inline-message { min-height: 0; margin: 0; }

.evidence-shell { width: min(100% - 28px, 720px); }
.evidence-heading { margin-bottom: 30px; }
.evidence-list { display: grid; gap: 18px; }
.evidence-card { border-radius: 24px; padding: 24px; }
.evidence-card h2 { font-size: 30px; margin-top: 18px; }
.evidence-topline { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.fuel-badge { background: var(--accent); color: var(--accent-ink); border-radius: 999px; font-weight: 900; padding: 7px 11px; }
.confidence { color: var(--muted); font-size: 14px; }
.address { color: var(--muted); margin: 4px 0 24px; }
.fact-row { display: flex; justify-content: space-between; gap: 16px; padding: 13px 0; border-top: 1px solid var(--border); }
.fact-row span { color: var(--muted); }
.fact-row strong { text-align: right; }
.evidence-sources { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.evidence-sources li { padding: 16px; border-radius: 15px; background: var(--surface-2); }
.evidence-sources li > div { display: flex; justify-content: space-between; gap: 10px; }
.evidence-sources span { color: var(--muted); font-size: 13px; }
.evidence-sources p { color: var(--muted); line-height: 1.5; margin: 8px 0; }
.evidence-sources a { color: var(--accent); font-weight: 750; }
.route-row { display: flex; gap: 10px; margin-top: 22px; }
.route-row .button { flex: 1; }

@media (max-width: 560px) {
  .auth-page { padding: 0; display: block; }
  .auth-shell { width: 100%; }
  .auth-card { min-height: 100vh; border: 0; border-radius: 0; padding: max(54px, env(safe-area-inset-top)) 24px 36px; display: flex; flex-direction: column; justify-content: center; }
  .app-header { min-height: calc(64px + env(safe-area-inset-top)); }
  .wordmark > span:last-child { font-size: 14px; }
  .page-shell { padding-top: 38px; }
  .status-grid { grid-template-columns: 1fr; }
  .action-card { grid-template-columns: 1fr; }
  .action-icon { margin-bottom: 16px; }
  .button-row { flex-direction: column; }
  .button-row .button { width: 100%; }
  .choice-grid, .brand-choices { grid-template-columns: 1fr; }
  .save-row .button { width: 100%; }
  .utility-card .button { width: 100%; }
  .fact-row { flex-direction: column; gap: 4px; }
  .fact-row strong { text-align: left; }
  .route-row { flex-direction: column; }
}

@media (prefers-reduced-motion: no-preference) {
  .status-pulse { animation: breathe 2.4s ease-in-out infinite; }
  @keyframes breathe { 50% { box-shadow: 0 0 0 10px rgba(99,213,156,.05), 0 0 34px rgba(99,213,156,.6); } }
}
