/* The signed-in app (account.html): rail and bar shell, Bookings, Scan, Vans, and the check flow. */

/* Shell */
.app { flex: 1 0 auto; min-width: 0; }
.rail { background: var(--black); color: var(--white); z-index: 30; }
.rail__top { display: flex; align-items: center; justify-content: space-between; gap: 16px; }

.tabs { position: relative; }
.tabs__tab {
  display: flex; align-items: center; min-width: 0; border: 0 solid var(--rule-on-black);
  font-family: var(--font-display); font-weight: 600; line-height: 1; letter-spacing: -0.01em;
  color: var(--mute-on-black); text-decoration: none; white-space: nowrap;
  -webkit-tap-highlight-color: transparent; transition: color 160ms ease;
}
a.tabs__tab { cursor: pointer; }
a.tabs__tab:focus-visible { outline-offset: -5px; }
@media (hover: hover) and (pointer: fine) { a.tabs__tab:hover { color: var(--white); transition-duration: 70ms; } }
/* The selected section is the tariff board's inverted row: the tab labels again, black on
   white, clipped square to the active tab. */
.tabs__lens { position: absolute; inset: 0; pointer-events: none; background: var(--white); clip-path: inset(0 100% 100% 0); transition: clip-path 380ms var(--ease-drawer); }
.tabs__lens .tabs__tab { color: var(--black); border-color: var(--white); }
.tabs:has(a[aria-current]:focus-visible) .tabs__lens { box-shadow: inset 0 0 0 3px var(--red); }
/* Nothing glides or fades before the app has drawn once. */
.app:not(.is-ready) .tabs__lens, .app:not(.is-ready) .account { transition: none !important; }

.account-toggle {
  display: inline-flex; align-items: center; min-height: 44px; max-width: 46vw; padding: 0 14px;
  background: none; color: var(--white); border: 1.5px solid var(--white); border-radius: var(--radius);
  font-weight: 600; cursor: pointer; -webkit-tap-highlight-color: transparent; transition: transform 160ms var(--ease-out);
}
.account-toggle span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-toggle:active { transform: scale(0.97); }
.account__name { margin: 0; font-weight: 600; }
.account__email { margin: 0 0 10px; color: var(--mute-on-black); font-size: 0.9375rem; overflow-wrap: anywhere; }
.account__signout { justify-self: start; padding: 6px 0; background: none; border: 0; color: var(--white); font-weight: 500; text-decoration: underline; text-underline-offset: 0.18em; text-decoration-thickness: 1px; cursor: pointer; }
@media (hover: hover) and (pointer: fine) { .account__signout:hover { text-decoration-color: var(--red); } }
.account__credit { margin: 16px 0 0; color: var(--mute-on-black); font-size: 0.875rem; }
.account__credit a { color: var(--white); }

.stage { display: block; min-width: 0; outline: none; }
.stage__panels { display: grid; max-width: 880px; margin-inline: auto; }
.stage__noscript { max-width: 880px; margin: 0 auto; }
.stage__credit { max-width: 880px; margin: 56px auto 0; padding-top: 16px; border-top: 1px solid var(--rule); color: var(--mute); font-size: 0.9375rem; }
.panel { grid-area: 1 / 1; min-width: 0; }
.panel__head { margin-bottom: 28px; }
.panel__head h1 { font-size: var(--step-3); margin-bottom: 0.15em; }
.panel__head p { margin: 0; color: var(--mute); }

html.is-flow-open, html.is-flow-open body { overflow: hidden; }

@media (min-width: 901px) {
  .app { display: grid; grid-template-columns: 256px minmax(0, 1fr); align-items: start; }
  .rail { position: sticky; top: 0; height: 100vh; height: 100dvh; display: grid; grid-template-rows: auto 1fr auto; padding: 0 0 24px; }
  .rail__top { height: 76px; padding: 0 28px; }
  .account-toggle { display: none; }
  .tabs, .tabs__lens { display: grid; grid-auto-rows: 62px; align-content: start; }
  .tabs { margin-top: 32px; border-top: 1px solid var(--rule-on-black); }
  .tabs__tab { padding: 0 28px; font-size: var(--step-2); border-bottom-width: 1px; }
  .account { display: grid; padding: 20px 28px 0; border-top: 1px solid var(--rule-on-black); }
  .stage { padding: clamp(40px, 5vw, 64px) clamp(28px, 4vw, 56px) 48px; }
  .stage__credit { display: none; }
}

@media (max-width: 900px) {
  .app { padding-top: calc(60px + env(safe-area-inset-top)); padding-bottom: calc(57px + env(safe-area-inset-bottom)); }
  .rail { position: fixed; top: 0; left: 0; right: 0; padding: env(safe-area-inset-top) var(--gutter) 0; }
  .rail__top { height: 60px; }
  .tabs { position: fixed; left: 0; right: 0; bottom: 0; background: var(--black); border-top: 1px solid var(--rule-on-black); }
  .tabs, .tabs__lens { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
  .tabs__tab { justify-content: center; height: 56px; font-size: 1.5rem; }
  .tabs__tab + .tabs__tab { border-left-width: 1px; }
  .account {
    position: fixed; top: calc(64px + env(safe-area-inset-top)); right: var(--gutter); width: min(300px, 100vw - 2 * var(--gutter));
    display: grid; padding: 16px 18px 18px; background: var(--black); color: var(--white); border-radius: var(--radius);
    transform-origin: top right; opacity: 0; transform: translateY(-4px) scale(0.97); visibility: hidden;
    transition: opacity 120ms ease, transform 120ms var(--ease-out), visibility 0s linear 120ms;
  }
  .account.is-open { opacity: 1; transform: none; visibility: visible; transition: opacity 180ms ease, transform 200ms var(--ease-out), visibility 0s; }
  .stage { padding: 28px var(--gutter) 28px; }
}

/* Bookings */
.bookings { display: grid; gap: 40px; }
.bookings__group h2 { font-size: 1.5rem; margin: 0 0 12px; }
.bookings__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.booking { display: grid; grid-template-columns: 184px minmax(0, 1fr) auto; grid-template-areas: "fig body act"; gap: 10px 24px; align-items: center; padding: 16px; border: 1px solid var(--rule); border-radius: var(--radius); }
.booking .van-figure { grid-area: fig; padding: 10% 6%; min-height: 0; }
.booking__body { grid-area: body; display: grid; gap: 4px; min-width: 0; }
.booking__body h3 { font-size: 1.6rem; margin: 0; }
.booking__meta { margin: 0; color: var(--mute); }
.booking__meta b { display: block; color: var(--ink); font-weight: 600; }
.booking__ref { font-size: 0.9375rem; }
.booking__status { display: flex; margin: 6px 0 2px; }
.booking__todo { margin: 0; color: var(--mute); font-size: 0.9375rem; }
.booking__act { grid-area: act; display: grid; justify-items: end; }
.booking__act .small { margin: 0; max-width: 18ch; text-align: right; color: var(--mute); }
.booking.is-past .van-figure img { opacity: 0.55; }
@media (max-width: 640px) {
  .booking { grid-template-columns: 104px minmax(0, 1fr); grid-template-areas: "fig body" "act act"; gap: 14px 16px; align-items: start; padding: 14px; }
  .booking .van-figure { aspect-ratio: 4 / 3; padding: 8% 6%; }
  .booking__body h3 { font-size: 1.5rem; }
  .booking__act { justify-items: stretch; }
  .booking__act .btn { width: 100%; }
  .booking__act .small { max-width: none; text-align: left; }
}
.empty { display: grid; justify-items: center; padding: clamp(40px, 8vw, 88px) 16px; text-align: center; }
.empty h2 { font-size: var(--step-2); margin-bottom: 0.3em; }
.empty p { margin-bottom: 24px; }

/* Scan */
.scan { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 32px; align-items: start; }
@media (max-width: 1100px) { .scan { grid-template-columns: minmax(0, 1fr); gap: 24px; } }
.scanner { position: relative; width: min(100%, 520px, 58vh); aspect-ratio: 1 / 1; background: var(--black); color: var(--white); border-radius: var(--radius); overflow: hidden; isolation: isolate; }
.scanner__video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 240ms ease; }
.scanner[data-state="live"] .scanner__video, .scanner[data-found] .scanner__video { opacity: 1; }
.scanner__frame { position: absolute; inset: 17%; border-radius: 8px; pointer-events: none; transition: transform 300ms var(--ease-out), box-shadow 240ms ease; }
.scanner[data-state="live"] .scanner__frame, .scanner[data-found] .scanner__frame { box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.42); }
.scanner__frame i { position: absolute; width: 22%; height: 22%; border: 0 solid var(--white); }
.scanner__frame i:nth-child(1) { top: 0; left: 0; border-top-width: 4px; border-left-width: 4px; border-top-left-radius: 8px; }
.scanner__frame i:nth-child(2) { top: 0; right: 0; border-top-width: 4px; border-right-width: 4px; border-top-right-radius: 8px; }
.scanner__frame i:nth-child(3) { bottom: 0; left: 0; border-bottom-width: 4px; border-left-width: 4px; border-bottom-left-radius: 8px; }
.scanner__frame i:nth-child(4) { bottom: 0; right: 0; border-bottom-width: 4px; border-right-width: 4px; border-bottom-right-radius: 8px; }
.scanner[data-found="ok"] .scanner__frame { transform: scale(0.9); }
.scanner__ok { position: absolute; left: 50%; top: 50%; width: 64px; height: 64px; margin: -32px 0 0 -32px; border-radius: 50%; background: var(--ok); color: var(--white); opacity: 0; transform: scale(0.8); transition: opacity 160ms ease, transform 280ms var(--ease-out); }
.scanner__ok svg { width: 64px; height: 64px; }
.scanner[data-found="ok"] .scanner__ok { opacity: 1; transform: none; }
.scanner__status { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 16px; padding: 24px; text-align: center; transition: opacity 160ms ease; }
.scanner[data-state="live"] .scanner__status, .scanner[data-state="idle"] .scanner__status, .scanner[data-found] .scanner__status { opacity: 0; visibility: hidden; }
.scanner__message { margin: 0; max-width: 30ch; }
.scanner:not([data-state="starting"]) .spinner { display: none; }
.spinner { display: block; width: 22px; height: 22px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 640ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.scan__staging { margin: 0 0 20px; padding: 12px 14px; background: var(--paper); border-radius: var(--radius); font-size: 0.9375rem; }
.scan__result { margin: 0 0 24px; padding: 14px 16px 16px; background: var(--red-tint); color: var(--red-press); border-radius: var(--radius); font-weight: 500; }
.scan__result p { margin: 0 0 14px; }
.scan__code { white-space: nowrap; }
.scan__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
.scan__actions .btn-ghost { color: var(--ink); border-color: var(--red-press); }
.scan__link { color: var(--ink); font-weight: 600; }
.scan__manual label { display: block; margin-bottom: 6px; font-weight: 600; }
.scan__row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; max-width: 420px; }
.scan__manual .field-error { margin-top: 8px; }

/* Vans */
.vans-dates { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; max-width: 560px; }
.vans-dates .field { margin: 0; }
.vans-dates input::-webkit-calendar-picker-indicator { cursor: pointer; }
.vans-dates__error { grid-column: 1 / -1; margin: 0; }
.vans-summary { margin: 14px 0 0; color: var(--mute); }
.vans-summary:empty { display: none; }
.vans { list-style: none; margin: 28px 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 640px) { .vans { grid-template-columns: minmax(0, 1fr); } }
.van-item { display: grid; grid-template-rows: auto 1fr; min-width: 0; overflow: hidden; border: 1px solid var(--rule); border-radius: var(--radius); }
.van-item .van-figure { border-radius: 0; padding: 8% 6%; min-height: 0; }
.van-item .van-figure img { transition: opacity 200ms ease; }
.van-item__body { display: grid; align-content: start; gap: 8px; padding: 16px 18px 18px; }
.van-item__body h3 { margin: 0; font-size: 1.5rem; transition: color 200ms ease; }
.van-item__body p { margin: 0; color: var(--mute); }
.van-item__spec { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 0.9375rem; }
.van-item .van-item__spec { color: var(--ink); }
.van-item__spec b { font-weight: 600; font-variant-numeric: tabular-nums; }
.van-item__foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 66px; margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--rule); }
.van-item__rate { font-family: var(--font-display); font-size: 1.75rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.van-item__rate small { font-family: var(--font-body); font-size: 0.875rem; font-weight: 500; color: var(--mute); }
.van-item.is-unavailable .van-figure img { opacity: 0.35; }
.van-item.is-unavailable h3 { color: var(--mute); }

/* Flow: the full-screen steps a scan opens */
.flow { position: fixed; inset: 0; z-index: 60; display: grid; grid-template-rows: auto auto minmax(0, 1fr); background: var(--white); }
.flow__bar { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 12px; height: calc(60px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) var(--gutter) 0; background: var(--black); color: var(--white); }
.flow__btn { justify-self: start; min-height: 44px; padding: 0 14px; background: none; color: var(--white); border: 1.5px solid transparent; border-radius: var(--radius); font-weight: 600; cursor: pointer; -webkit-tap-highlight-color: transparent; transition: transform 160ms var(--ease-out), border-color 160ms ease; }
.flow__btn:first-child { grid-column: 1; margin-left: -14px; }
.flow__btn--end { grid-column: 3; justify-self: end; border-color: var(--white); }
.flow__btn:active { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) { .flow__btn:first-child:hover { border-color: var(--rule-on-black); transition-duration: 70ms; } }
.flow__title { grid-column: 2; margin: 0; font-family: var(--font-display); font-size: 1.5rem; font-weight: 600; line-height: 1; text-align: center; white-space: nowrap; }
.flow__count { margin-left: 4px; font-family: var(--font-body); font-size: 0.9375rem; font-weight: 500; color: var(--mute-on-black); font-variant-numeric: tabular-nums; }
.flow__progress { list-style: none; margin: 0; padding: 3px 0 0; display: grid; transition: opacity 200ms ease; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 3px; }
.flow__progress li { position: relative; height: 4px; overflow: hidden; background: var(--rule); }
.flow__progress li::after { content: ""; position: absolute; inset: 0; background: var(--ink); transform: scaleX(0); transform-origin: left; transition: transform 320ms var(--ease-out), background-color 200ms ease; }
.flow__progress li.is-current::after { background: var(--red); transform: scaleX(1); }
.flow__progress li.is-done::after { transform: scaleX(1); }
.flow.is-done .flow__progress { opacity: 0; }
.flow__scroll { overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.flow__steps { display: grid; width: min(720px, 100% - 2 * var(--gutter)); margin: 0 auto; padding: clamp(24px, 5vw, 48px) 0 calc(48px + env(safe-area-inset-bottom)); }
.flow__step { grid-area: 1 / 1; min-width: 0; }
.flow__head { margin-bottom: 20px; }
.flow__head h2 { font-size: var(--step-3); margin-bottom: 0.15em; }
.flow__head p { margin: 0; }
.flow__next { margin-top: 8px; }
.flow .spec { column-gap: 0; }
.flow .spec dd { padding-left: 24px; }

.flow-van { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; align-items: center; }
@media (max-width: 720px) { .flow-van { grid-template-columns: minmax(0, 1fr); gap: 20px; } }
.flow-van__figure { aspect-ratio: 1.6 / 1; padding: 8% 6%; min-height: 0; }
.flow-van__body h2 { font-size: var(--step-3); margin-bottom: 0.4em; }
.flow-van__staged { margin: 0 0 16px; padding: 12px 14px; background: var(--paper); border-radius: var(--radius); font-size: 0.9375rem; }
.flow-van .spec { grid-template-columns: max-content minmax(0, 1fr); margin-bottom: 16px; }
.flow-van__hint { margin: 0 0 16px; }

.flow__tally { margin: -6px 0 16px; color: var(--mute); }
.flow__tally b { margin-right: 2px; font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.shots { list-style: none; margin: 0 0 20px; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 12px; }
@media (min-width: 700px) { .shots { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.shot label { display: grid; align-content: start; gap: 6px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.shot__media { position: relative; display: block; aspect-ratio: 4 / 3; overflow: hidden; background: var(--paper); border: 1.5px dashed var(--rule-strong); border-radius: var(--radius); transition: border-color 160ms ease, transform 160ms var(--ease-out); }
.shot label:active .shot__media { transform: scale(0.98); }
.shot:focus-within .shot__media { outline: 3px solid var(--red); outline-offset: 2px; }
.shot.is-set .shot__media { border-style: solid; border-color: var(--ink); }
@media (hover: hover) and (pointer: fine) { .shot:not(.is-set) label:hover .shot__media { border-color: var(--ink); transition-duration: 70ms, 160ms; } }
.shot__img { position: absolute; inset: 0; background-position: center; background-size: cover; opacity: 0; transform: scale(1.04); filter: blur(6px); transition: opacity 240ms ease, transform 320ms var(--ease-out), filter 240ms ease; }
.shot.is-set .shot__img { opacity: 1; transform: none; filter: none; }
.shot__cta { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 500; color: var(--red-press); text-decoration: underline; text-underline-offset: 0.18em; text-decoration-thickness: 1px; transition: opacity 160ms ease; }
.shot.is-set .shot__cta, .shot.is-busy .shot__cta { opacity: 0; }
.shot .spinner { position: absolute; left: 50%; top: 50%; margin: -11px 0 0 -11px; color: var(--ink); display: none; }
.shot.is-busy .spinner { display: block; }
.shot__tick { position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; border-radius: 50%; background: var(--ok); color: var(--white); opacity: 0; transform: scale(0.8); transition: opacity 160ms ease, transform 240ms var(--ease-out); }
.shot__tick svg { width: 26px; height: 26px; }
.shot.is-set .shot__tick { opacity: 1; transform: none; }
.shot__name { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-weight: 600; }
.shot__opt { font-size: 0.8125rem; font-weight: 400; color: var(--mute); }
.shot__hint { font-size: 0.875rem; line-height: 1.4; color: var(--mute); }

.reading { max-width: 240px; font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.fuel { min-width: 0; margin: 0 0 20px; padding: 0; border: 0; }
.fuel legend { padding: 0; margin-bottom: 6px; font-weight: 600; }
.fuel__track, .fuel__lens { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; padding: 4px; }
.fuel__track { position: relative; max-width: 480px; border: 1.5px solid var(--rule-strong); border-radius: 8px; }
.fuel__opt { display: grid; place-items: center; height: 41px; border-radius: 4px; font-weight: 600; transition: background-color 160ms ease; }
.fuel__opt > span[aria-hidden="true"], .fuel__lens .fuel__opt:nth-child(n+2):nth-child(-n+4) { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; }
label.fuel__opt { cursor: pointer; -webkit-tap-highlight-color: transparent; }
label.fuel__opt:has(input:focus-visible) { outline: 3px solid var(--red); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) { label.fuel__opt:hover { background: var(--paper); transition-duration: 70ms; } }
.fuel__lens { position: absolute; inset: 0; pointer-events: none; background: var(--ink); color: var(--white); clip-path: inset(0 50% 0 50% round 4px); transition: clip-path 320ms var(--ease-drawer); }

.terms { display: grid; gap: 10px; margin: 0 0 24px; padding-left: 1.4em; }
.terms li { padding-left: 4px; }
.terms li::marker { font-family: var(--font-display); font-weight: 700; color: var(--mute); }
.sign { margin-top: 8px; }
.sign__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.sign__head .label { font-weight: 600; }
.sign__mode, .sign__clear { padding: 4px 0; background: none; border: 0; color: var(--ink); font-size: 0.9375rem; font-weight: 500; text-decoration: underline; text-underline-offset: 0.18em; text-decoration-thickness: 1px; cursor: pointer; }
.sign__pad { position: relative; height: 188px; background: var(--white); border: 1.5px solid var(--rule-strong); border-radius: var(--radius); touch-action: none; transition: border-color 140ms ease; }
.sign__pad::after { content: ""; position: absolute; left: 20px; right: 20px; bottom: 46px; height: 1px; background: var(--rule-strong); pointer-events: none; }
.sign__pad.is-signing { border-color: var(--ink); }
.sign__canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.sign__hint { position: absolute; left: 20px; bottom: 16px; color: var(--mute); font-size: 0.9375rem; pointer-events: none; transition: opacity 160ms ease; }
.sign__pad.has-ink .sign__hint { opacity: 0; }
.sign__clear { position: absolute; top: 8px; right: 14px; }
.sign__typed-input { font-size: var(--step-1); }
.sign__name { margin: 8px 0 0; color: var(--mute); font-size: 0.9375rem; }

.flow-done__tick { display: block; width: 64px; height: 64px; margin-bottom: 20px; }
.flow-done__tick circle { fill: var(--ok); transform-origin: center; animation: tickPop 360ms var(--ease-out) both; }
.flow-done__tick path { fill: none; stroke: var(--white); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: tickDraw 420ms var(--ease-out) 140ms forwards; }
@keyframes tickPop { from { opacity: 0; transform: scale(0.6); } to { opacity: 1; transform: none; } }
@keyframes tickDraw { to { stroke-dashoffset: 0; } }
.flow-done h2 { font-size: var(--step-4); margin-bottom: 0.3em; }
.flow-done .spec { max-width: 62ch; margin: 8px 0 28px; }
