:root {
  --avis-red: #D4002A;
  --avis-deep: #A50026;
  --ink: #10131a;
  --muted: #6b7280;
  --line: #e3e6ea;
  --bg: #f5f6f8;
  --ok: #0f8a4d;
  --warn: #b45309;
  --radius: 10px;
  /* code pane */
  --code-bg: #0f1420;
  --code-line: #1e2636;
  --code-dim: #7d8aa3;
  --code-key: #7ee0b8;
  --code-str: #ffd08a;
  --code-num: #9bb8ff;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font: 14px/1.5 -apple-system, "SF Pro Text", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: #dfe3e8;
  overflow: hidden;
}
.hidden { display: none !important; }

/* ================= stage ================= */
.stage {
  display: grid; grid-template-columns: minmax(0, 1fr) 480px;
  grid-template-rows: minmax(0, 1fr);   /* rows must be capped, or the panes grow to content */
  height: 100vh;
}
.app-pane {
  display: flex; flex-direction: column; min-width: 0; min-height: 0;
  overflow: hidden; background: var(--bg);
}

.pane-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; background: #eceff3; border-bottom: 1px solid var(--line);
}
.seg { display: inline-flex; background: #dfe4ea; border-radius: 8px; padding: 3px; gap: 3px; }
.seg-btn {
  border: none; background: none; padding: 6px 16px; border-radius: 6px;
  font: 700 12.5px/1 inherit; color: var(--muted); cursor: pointer;
}
.seg-btn.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.badge {
  font-size: 10px; font-weight: 800; letter-spacing: .6px; padding: 4px 9px;
  border-radius: 20px; background: var(--ink); color: #fff;
}
.badge.mock { background: var(--warn); }

/* device wrapper: transparent on web, a phone in mobile mode.
   .frame is the positioning context for overlays and never scrolls — an overlay
   inside the scroller anchors to the top of the content, not the viewport. */
.device { flex: 1; min-height: 0; position: relative; }
.frame { position: relative; height: 100%; overflow: hidden; background: #fff; }
.device-notch { display: none; }
.device-screen { height: 100%; overflow-y: auto; background: #fff; }

/* ================= nav ================= */
.nav { background: #fff; border-top: 3px solid var(--avis-red); border-bottom: 1px solid var(--line); }
.nav-inner { max-width: 1120px; margin: 0 auto; padding: 14px 24px; display: flex; align-items: center; gap: 32px; }
.logo { font: italic 800 24px/1 "Helvetica Neue", Arial; color: var(--avis-red); letter-spacing: -.5px; }
.logo span { font-size: 9px; vertical-align: super; font-style: normal; }
.nav-links { display: flex; gap: 22px; flex: 1; }
.nav-links a { color: var(--ink); text-decoration: none; font-weight: 600; font-size: 13.5px; }
.nav-links a:hover { color: var(--avis-red); }
.signin { color: var(--ink); font-weight: 700; font-size: 13.5px; text-decoration: none; }

.stepbar { background: #fff; border-bottom: 1px solid var(--line); }
.stepbar-inner {
  max-width: 1120px; margin: 0 auto; padding: 10px 24px;
  display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted);
}
.stepbar .step.done { color: var(--ok); font-weight: 600; }
.stepbar .step.active { color: var(--ink); font-weight: 700; }
.stepbar .trip { margin-left: auto; }
.sep { color: #c8ccd2; }

/* ================= page ================= */
.screen { padding: 24px 0 60px; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.wrap.narrow { max-width: 620px; }
.hero-banner { display: none; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; gap: 16px; }
.page-head h1 { font: 800 24px/1.2 "Helvetica Neue", Arial; letter-spacing: -.4px; margin: 0; }
.page-head h1 span { color: var(--muted); font-weight: 600; font-size: 16px; }
.controls { display: flex; gap: 10px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 20px; padding: 8px 16px; font-size: 13px; font-weight: 600; cursor: pointer; }
.chip.dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.timer { background: #fdf6e7; border: 1px solid #f0d9a8; border-radius: 20px; padding: 7px 14px; font-size: 12.5px; }

/* vehicles */
.vehicle-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.vehicle-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; }
.vehicle-card.rec { border-color: var(--ink); }
.tag {
  display: inline-block; align-self: flex-start; background: var(--avis-red); color: #fff;
  font-size: 9.5px; font-weight: 800; letter-spacing: .5px; padding: 3px 7px; border-radius: 3px; margin-bottom: 8px;
}
.vehicle-card h3 { margin: 0; font-size: 17px; letter-spacing: -.2px; }
.vehicle-card .example { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; margin: 3px 0 8px; }
.specs { display: flex; gap: 6px; font-size: 11.5px; color: var(--muted); }
.specs span { border: 1px solid var(--line); border-radius: 20px; padding: 2px 9px; }
.car { width: 100%; height: 92px; margin: 10px 0; }
.price-line { display: flex; align-items: flex-end; justify-content: space-between; margin-top: auto; gap: 10px; }
.amt { font: 800 24px/1 "Helvetica Neue", Arial; }
.amt small { font-size: 12px; font-weight: 600; color: var(--muted); }
.rate { font-size: 11.5px; color: var(--muted); margin-top: 3px; }

/* checkout */
.checkout-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 22px; align-items: start; }
.col-rail { grid-column: 2; grid-row: 1; position: sticky; top: 18px; }
.col-main { grid-column: 1; grid-row: 1; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; }
.card h2 { margin: 0 0 4px; font-size: 17px; }
.card .sub { margin: 0 0 16px; color: var(--muted); font-size: 13px; }

.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.fields label { font-size: 12.5px; font-weight: 600; }
.fields label.wide { grid-column: span 2; }
.fields input { display: block; width: 100%; margin-top: 5px; padding: 10px 12px; font-size: 14px; border: 1px solid var(--line); border-radius: 8px; background: #fafbfc; color: var(--ink); }
.req { color: var(--avis-red); }

.option { display: grid; grid-template-columns: minmax(0, 1fr) 190px; gap: 20px; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; }
.option.axle { border: 2px solid var(--ink); background: linear-gradient(180deg, #fbfcfd, #f4f6f8); }
.option h3 { margin: 7px 0 6px; font-size: 16px; }
.option p { margin: 0; font-size: 13px; color: #3d434c; }
.option-action { display: flex; flex-direction: column; justify-content: center; gap: 8px; }
.option-action.price { text-align: right; }
.option-action .amt span { font-size: 13px; font-weight: 600; color: var(--muted); }
.was { font-size: 11.5px; color: var(--muted); }
.was em { color: var(--ok); font-style: normal; font-weight: 700; }
.add { font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 7px; justify-content: flex-end; cursor: pointer; }
.add input { width: 17px; height: 17px; accent-color: var(--avis-red); }
.pill { display: inline-block; background: var(--ink); color: #fff; font-size: 9.5px; font-weight: 800; letter-spacing: .6px; padding: 3px 8px; border-radius: 20px; }
.pill.grey { background: #e9edf1; color: #445; }
.powered { margin-top: 10px !important; font-size: 11.5px; color: var(--muted) !important; }

.btn { padding: 12px 20px; border: none; border-radius: 8px; font: 700 14px/1 inherit; cursor: pointer; }
.btn.primary { background: var(--avis-red); color: #fff; }
.btn.primary:hover { background: var(--avis-deep); }
.btn.block { width: 100%; margin-top: 14px; }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }

.addon-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.addon { display: flex; justify-content: space-between; align-items: center; border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; font-size: 13px; }

/* summary rail */
.card-kicker { font: 800 11px/1 "Helvetica Neue", Arial; letter-spacing: .6px; color: var(--muted); }
.card-title { font: 800 17px/1.2 "Helvetica Neue", Arial; text-transform: uppercase; margin: 5px 0 4px; }
.car-art .car { height: 78px; margin: 4px 0 10px; }
.meta { padding: 9px 0; border-top: 1px solid var(--line); }
.meta-label { font-size: 11.5px; color: var(--muted); }
.meta-value { font-weight: 700; font-size: 13.5px; }
.meta-sub { font-size: 12.5px; color: var(--muted); }
.row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 13px; }
.row em { color: var(--muted); font-style: normal; font-size: 11.5px; }
.row s { color: var(--muted); font-weight: 500; }
.row.total { font-weight: 800; font-size: 15.5px; }
.rail-total { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; font-size: 12px; color: var(--muted); }
.rail-total b { font-size: 17px; color: var(--ink); }
.pay-bar { display: none; }

/* verified panel */
.verified { border: 2px solid var(--ok); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; background: #f4fbf7; }
.verified.caution { border-color: var(--warn); background: #fdf7ec; }
.verified h3 { margin: 0 0 3px; font-size: 16px; }
.verified .savings { font-size: 13px; color: var(--ok); font-weight: 700; margin: 0 0 14px; }
.verified.caution .savings { color: var(--warn); }
.verified-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
.policy-card { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 14px; }
.policy-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.carrier-mark { width: 34px; height: 34px; border-radius: 8px; background: var(--ink); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 13px; flex: none; }
.policy-head b { display: block; font-size: 14px; text-transform: capitalize; }
.policy-head span { font-size: 12px; color: var(--muted); }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 5px 14px; font-size: 12.5px; }
.kv span { color: var(--muted); }
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; align-content: start; }
.checks li { display: flex; gap: 8px; font-size: 12.5px; align-items: flex-start; }
.checks .mark { flex: none; width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; font-size: 10px; color: #fff; background: var(--ok); }
.checks li.fail .mark, .checks li.caution .mark { background: var(--warn); }
.checks .note { display: block; color: var(--muted); font-size: 11.5px; }
.verified .btn.ghost { margin-top: 14px; }

/* confirmation */
.confirm { text-align: center; padding: 32px; }
.big-check { width: 50px; height: 50px; margin: 0 auto 12px; border-radius: 50%; background: var(--ok); color: #fff; font-size: 26px; display: grid; place-items: center; }
.confirm h2 { margin: 0 0 4px; font-size: 19px; }
.confirm > p { margin: 0 0 16px; color: var(--muted); font-size: 13px; }
.confirm .row { text-align: left; }
.insurance-chip { margin-top: 16px; padding: 13px; border-radius: 8px; background: #f4fbf7; border: 1px solid #bfe3cf; font-size: 12.5px; text-align: left; }

/* overlays */
.overlay { position: absolute; inset: 0; z-index: 60; background: rgba(16, 19, 26, .55); display: grid; place-items: center; padding: 24px; }
.modal { width: 440px; max-width: 100%; height: min(720px, 92%); background: #fff; border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 24px 60px rgba(0,0,0,.3); }
.modal-bar { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.modal-bar button { background: none; border: none; font-size: 16px; cursor: pointer; color: var(--ink); }
#ignition-frame { flex: 1; width: 100%; border: none; }
.frame-loading {
  position: absolute; inset: 0; top: 41px; z-index: 5; background: #fff;
  display: grid; place-items: center; align-content: center; gap: 14px;
}
.frame-loading p { margin: 0; font-size: 12.5px; color: var(--muted); }
.loading-card { background: #fff; border-radius: 14px; padding: 32px 44px; display: grid; place-items: center; gap: 14px; }
.spinner { width: 32px; height: 32px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--avis-red); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ================= MOBILE MODE ================= */
body.mobile .device { display: grid; place-items: center; padding: 22px 0; overflow: hidden; }
body.mobile .frame {
  width: 390px; height: min(844px, 100%);
  border-radius: 36px; border: 12px solid #111; background: #111;
  box-shadow: 0 24px 60px rgba(10, 15, 25, .35);
}
body.mobile .device-screen { border-radius: 24px; }
body.mobile .device-notch {
  display: block; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 128px; height: 26px; background: #111; border-radius: 0 0 16px 16px; z-index: 30;
}
body.mobile .nav-inner { padding: 28px 16px 12px; gap: 12px; }
body.mobile .nav-links, body.mobile .stepbar .trip, body.mobile .page-head h1,
body.mobile .controls, body.mobile .timer { display: none; }
body.mobile .stepbar-inner { padding: 10px 16px; font-size: 11.5px; }
body.mobile .wrap { padding: 0 12px; }
body.mobile .screen { padding: 0 0 90px; }
body.mobile .page-head { margin-bottom: 12px; }
body.mobile .hero-banner {
  display: block; background: var(--avis-deep); color: #fff; text-align: center;
  font: 800 21px/1.2 "Helvetica Neue", Arial; letter-spacing: -.2px;
  padding: 26px 18px; text-transform: uppercase; margin-bottom: 12px;
}
body.mobile #screen-vehicles .wrap { padding-top: 14px; }
body.mobile #screen-vehicles .page-head h1 {
  display: block; font-size: 20px; text-transform: uppercase;
}
body.mobile .vehicle-grid { grid-template-columns: 1fr; gap: 14px; }
body.mobile .checkout-grid { grid-template-columns: 1fr; gap: 0; }
body.mobile .col-rail { grid-column: 1; grid-row: 1; position: static; }
body.mobile .col-main { grid-column: 1; grid-row: 2; }
body.mobile .col-rail .btn.block, body.mobile .rail-total { display: none; }
body.mobile .card { padding: 16px; margin-bottom: 12px; }
body.mobile .fields, body.mobile .addon-grid { grid-template-columns: 1fr; }
body.mobile .fields label.wide { grid-column: span 1; }
body.mobile .option { grid-template-columns: 1fr; gap: 12px; }
body.mobile .option-action.price { text-align: left; flex-direction: row; align-items: center; justify-content: space-between; }
body.mobile .add { justify-content: flex-start; }
body.mobile .verified-grid { grid-template-columns: 1fr; }
body.mobile .pay-bar {
  display: flex; position: sticky; bottom: 0; gap: 12px; align-items: center;
  padding: 12px 14px; background: #fff; border-top: 1px solid var(--line); z-index: 20;
}
body.mobile .pay-bar span { display: block; font-size: 11px; color: var(--muted); }
body.mobile .pay-bar b { font-size: 18px; }
body.mobile .pay-bar .btn { flex: 1; }
body.mobile .overlay { border-radius: 24px; padding: 0; }
body.mobile .modal { width: 100%; height: 100%; border-radius: 24px; }
body.mobile .frame-loading { border-radius: 24px; }

/* ================= CODE PANE ================= */
.code-pane {
  display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden;
  background: var(--code-bg); color: #d7deea; border-left: 1px solid #000;
}
.code-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 18px 12px; border-bottom: 1px solid var(--code-line); }
.code-head h2 { margin: 0; font-size: 14px; color: #fff; }
.code-head p { margin: 3px 0 0; font-size: 11.5px; color: var(--code-dim); }
.code-head a { color: #7ee0b8; font-size: 11.5px; text-decoration: none; white-space: nowrap; }
.code-tabs { display: flex; gap: 4px; padding: 10px 14px; border-bottom: 1px solid var(--code-line); }
.tab { background: none; border: none; color: var(--code-dim); font: 700 11.5px/1 inherit; padding: 6px 12px; border-radius: 6px; cursor: pointer; }
.tab.active { background: #1b2333; color: #fff; }
.code-body { flex: 1; overflow-y: auto; padding: 14px; }

.block { margin-bottom: 14px; border: 1px solid var(--code-line); border-radius: 8px; overflow: hidden; }
.block-head {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  background: #151d2c; font-size: 11px; color: var(--code-dim);
}
.block-head b { color: #fff; font-size: 11.5px; }
.block-head .stat { margin-left: auto; font: 700 10px/1 ui-monospace, Menlo, monospace; padding: 3px 7px; border-radius: 4px; background: #16321f; color: #7ee0b8; }
.block-head .stat.err { background: #3a1a1c; color: #ff9d9d; }
.block-head .copy { background: none; border: 1px solid var(--code-line); color: var(--code-dim); border-radius: 4px; font-size: 10px; padding: 3px 7px; cursor: pointer; }
.block-head .copy:hover { color: #fff; }
pre { margin: 0; padding: 12px; font: 11.5px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; overflow-x: auto; white-space: pre; }
pre .k { color: var(--code-key); }
pre .s { color: var(--code-str); }
pre .n { color: var(--code-num); }
pre .c { color: var(--code-dim); }
pre.folded { max-height: 220px; overflow-y: auto; }
.waiting { color: var(--code-dim); font-size: 12px; padding: 8px 2px; }

.ev-group { margin-bottom: 18px; }
.ev-group h3 { font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--code-dim); margin: 0 0 8px; }
ul.log { list-style: none; margin: 0; padding: 0; font: 11px/1.5 ui-monospace, Menlo, monospace; }
ul.log li { padding: 7px 9px; background: #151d2c; border: 1px solid var(--code-line); border-radius: 6px; margin-bottom: 6px; word-break: break-all; color: #c8d2e2; }
ul.log li.empty { color: var(--code-dim); background: transparent; border-style: dashed; }
ul.log li b { color: #7ee0b8; }
.code-chip { display: inline-block; margin-top: 4px; padding: 1px 6px; border-radius: 4px; background: #1b2333; color: var(--code-str); border: 1px solid var(--code-line); }
.code-chip.expired { color: var(--code-dim); text-decoration: line-through; }

@media (max-width: 1180px) {
  .stage { grid-template-columns: minmax(0, 1fr) 400px; }
  .vehicle-grid { grid-template-columns: repeat(2, 1fr); }
  .checkout-grid { grid-template-columns: 1fr; }
  .col-rail { grid-column: 1; grid-row: 1; position: static; }
  .col-main { grid-column: 1; grid-row: 2; }
  .verified-grid { grid-template-columns: 1fr; }
}
