/* Routed — Driver UI. Tokens and base styles come straight from the Claude Design export;
   light is the default and data-theme="dark" swaps the set. */

html { background: #F2F4F6; }
html[data-theme="dark"] { background: #0A0C11; }
body { margin: 0; }

.rt {
  color-scheme: light;
  --bg: #F2F4F6; --surface: #FDFDFE;
  --ink: #11161F; --ink-2: #464D5B; --ink-3: #616978;
  --line: #E1E3E7; --line-2: #CACED4;
  --hero-bg: #313DC7; --hero-ink: #FFFFFF; --hero-ink-2: #DBE0FC;
  --rec: #313DC7; --rec-ink: #FFFFFF;
  --sel-bg: #EEF0FF; --sel-ink: #232C9E; --sel-line: #313DC7;
  --fast-bg: #F4E6CE; --fast-ink: #694413;
  --seg-toll: #212730; --seg-fuel: #6A7281; --seg-time: #ABB3C0;
  --on-toll: #FFFFFF; --on-fuel: #FFFFFF; --on-time: #11161F;
  --tag-bg: #FFFFFF; --tag-ink: #464D5B; --tag-line: #CACED4;
  --track: #868D9A;
  --focus: #313DC7;
  --shadow: 0 1px 2px rgba(17,22,31,.05), 0 10px 28px rgba(17,22,31,.07);
  --shadow-up: 0 -1px 2px rgba(17,22,31,.04), 0 -10px 28px rgba(17,22,31,.07);
  --num: 'Barlow Semi Condensed', 'Barlow', 'IBM Plex Sans Thai', 'Arial Narrow', system-ui, sans-serif;

  min-height: 100vh;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Barlow', 'IBM Plex Sans Thai', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
.rt[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0A0C11; --surface: #14171D;
  --ink: #EDEEF2; --ink-2: #B9BEC6; --ink-3: #9299A4;
  --line: #282B32; --line-2: #393D46;
  --hero-bg: #23298C; --hero-ink: #F2F5FC; --hero-ink-2: #C7CFF5;
  --rec: #8EA5FD; --rec-ink: #081027;
  --sel-bg: #1C2350; --sel-ink: #D3DBFF; --sel-line: #8EA5FD;
  --fast-bg: #382C15; --fast-ink: #E6CA91;
  --seg-toll: #E2E5EA; --seg-fuel: #8C939F; --seg-time: #4B515D;
  --on-toll: #0A0C11; --on-fuel: #0A0C11; --on-time: #EDEEF2;
  --tag-bg: #262A32; --tag-ink: #D5D9E0; --tag-line: #454A55;
  --track: #626978;
  --focus: #8EA5FD;
  --shadow: 0 0 0 0 transparent;
  --shadow-up: 0 0 0 0 transparent;
}
.rt[hidden] { display: none; }

.rt button { appearance: none; -webkit-appearance: none; border: 0; background: none; margin: 0; padding: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.rt button:disabled { cursor: default; opacity: .6; }
.rt button:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.rt-card button:focus-visible { outline-offset: -2px; border-radius: 6px; }
.rt input[type="text"] { appearance: none; -webkit-appearance: none; border: 0; border-radius: 0; background: none; margin: 0; padding: 0; font: inherit; color: inherit; min-width: 0; outline: none; }
.rt input[type="text"]::placeholder { color: var(--ink-3); opacity: 1; }
.rt-field:focus-within { box-shadow: inset 0 0 0 2px var(--focus); }
.rt-over:focus-visible + .rt-face { outline: 2px solid var(--focus); outline-offset: 2px; }
.rt-range:focus-visible + .rt-thumb { outline: 2px solid var(--focus); outline-offset: 3px; }

/* Segmented state styles used by the Now / picker / preset controls. */
.rt .rt-on { background: var(--sel-bg); color: var(--sel-ink); border: 1.5px solid var(--sel-line); }
.rt .rt-off { background: var(--surface); color: var(--ink); border: 1px solid var(--line-2); }
.rt .rt-off-quiet { background: var(--surface); color: var(--ink-2); border: 1px solid var(--line-2); }

/* Inline error under the form (the API's { error } message). */
.rt-error { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line-2); font-size: 14px; line-height: 20px; color: var(--ink-2); }
.rt-error strong { color: var(--ink); font-weight: 600; }
.rt-error[hidden] { display: none; }

/* Regulatory banner (holiday waiver / motorway window / calendar coverage). Uses the design's surface + tag tokens. */
.rt-banner { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; line-height: 20px; color: var(--ink-2); }
.rt-banner svg { flex: none; margin-top: 2px; color: var(--ink); }
.rt-banner strong { color: var(--ink); font-weight: 600; }

/* While the slider re-queries, the comparison dims instead of flashing. */
.rt-busy { opacity: .55; transition: opacity .15s; pointer-events: none; }

/* Route cards in a two-column grid on wide screens, one column on phones. */
.rt-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 12px; align-items: start; }

/* Keep the first row clear of the notch / status bar on phones (viewport-fit=cover). */
.rt > header, .rt > main:first-child { padding-top: calc(6px + env(safe-area-inset-top, 0px)); }
.rt a:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; border-radius: 6px; }

/* Landing screen: brand and placeholder sign-in over the night expressway photo. */
.rt-landing { position: relative; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; justify-content: flex-end; color: #FFFFFF; background: #0A0C11; overflow: hidden; }
.rt-landing[hidden] { display: none; }
.rt-landing-photo { position: absolute; inset: 0; background: url("/landing.jpg") center 30% / cover no-repeat; }
.rt-landing-shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(10,12,17,.25) 0%, rgba(10,12,17,.05) 30%, rgba(10,12,17,.78) 62%, rgba(10,12,17,.96) 100%); }
.rt-landing-body { position: relative; width: 100%; max-width: 480px; margin: 0 auto; box-sizing: border-box; padding: 24px 20px calc(20px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 14px; }
.rt-landing-wordmark { display: block; width: 52%; max-width: 210px; height: auto; margin: 0 0 2px; filter: drop-shadow(0 4px 18px rgba(0,0,0,.45)); }
.rt-landing-lede { margin: 0 0 8px; font-size: 18px; line-height: 25px; color: #DBE0FC; text-wrap: pretty; }
.rt-landing-card { display: flex; flex-direction: column; gap: 10px; padding: 14px; box-sizing: border-box; border-radius: 18px; background: rgba(20,23,29,.72); border: 1px solid rgba(255,255,255,.14); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.rt-landing-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; line-height: 16px; font-weight: 600; color: #B9BEC6; }
.rt-landing-field input { appearance: none; -webkit-appearance: none; box-sizing: border-box; width: 100%; height: 46px; padding: 0 12px; border-radius: 12px; border: 1px solid rgba(255,255,255,.16); background: rgba(10,12,17,.55); color: #FFFFFF; font: 500 16px/22px 'Barlow', system-ui, sans-serif; outline: none; }
.rt-landing-field input::placeholder { color: #6B7280; }
.rt-landing-field input:focus-visible { border-color: #8EA5FD; box-shadow: 0 0 0 2px rgba(142,165,253,.35); }
.rt-landing-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding-top: 2px; }
.rt .rt-landing-btn { height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 600; }
.rt .rt-landing-btn-secondary { background: #FDFDFE; color: #11161F; }
.rt .rt-landing-btn-ghost { background: transparent; color: #FFFFFF; border: 1px solid rgba(255,255,255,.28); }
.rt-landing-note { margin: 0; font-size: 15px; line-height: 21px; color: #C7CFF5; }
.rt .rt-landing-cta { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; box-sizing: border-box; gap: 14px; min-height: 46px; padding: 6px 14px 6px 16px; border-radius: 14px; background: #313DC7; color: #FFFFFF; font-family: var(--num); font-size: clamp(15px, 4.2vw, 18px); line-height: 22px; font-weight: 600; box-shadow: 0 10px 28px rgba(49,61,199,.45); }
.rt .rt-landing-cta:focus-visible { outline: 2px solid #FFFFFF; outline-offset: 2px; }
/* Brand logo in the plan header: full-colour artwork on light, the reversed (white R) artwork on dark. */
.rt-brand { display: block; }
.rt-brand-dark { display: none; }
.rt[data-theme="dark"] .rt-brand-light { display: none; }
.rt[data-theme="dark"] .rt-brand-dark { display: block; }

/* Landing: claim flow */
.rt-pool { display: flex; align-items: baseline; gap: 8px; }
.rt-pool-num { font-family: var(--num); font-size: 34px; line-height: 36px; font-weight: 700; color: #FFFFFF; }
.rt-pool-text { font-size: 14px; line-height: 20px; color: #DBE0FC; }
.rt-landing-cta .rt-cta-arrow { flex: none; width: clamp(34px, 11vw, 52px); height: auto; }
.rt-landing-cta em { font-style: normal; font-weight: 700; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.rt-landing-cta[disabled] { opacity: .7; }
.rt .rt-landing-link { align-self: flex-start; font-size: 16px; font-weight: 600; color: #C7CFF5; text-decoration: underline; text-underline-offset: 3px; }
.rt-code-form { display: flex; flex-direction: column; gap: 8px; }
.rt-landing-error { color: #FFD1C7; }
.rt-inapp { background: rgba(49,61,199,.85); }
/* Allowance line under the Compare button */
.rt-allowance { margin: 8px 0 0; text-align: center; font-size: 13px; line-height: 18px; color: var(--ink-3); }
.rt-allowance button { font-weight: 600; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.rt-allowance[hidden] { display: none; }
/* Bottom sheet */
.rt-sheet { position: fixed; inset: 0; z-index: 60; min-height: 0; display: flex; align-items: flex-end; justify-content: center; background: rgba(10,12,17,.55); }
.rt-sheet[hidden] { display: none; }
.rt-sheet-panel { width: 100%; max-width: 520px; box-sizing: border-box; padding: 20px 20px calc(20px + env(safe-area-inset-bottom, 0px)); border-radius: 22px 22px 0 0; background: var(--surface); color: var(--ink); display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow-up); }
.rt-sheet-field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.rt-sheet-field input { appearance: none; -webkit-appearance: none; box-sizing: border-box; width: 100%; height: 50px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font: 500 17px/22px 'Barlow', system-ui, sans-serif; outline: none; }
.rt-sheet-field input:focus-visible { border-color: var(--focus); box-shadow: 0 0 0 2px rgba(49,61,199,.25); }
.rt-sheet-error { margin: 0; font-size: 13px; line-height: 18px; color: #B3261E; }
.rt[data-theme="dark"] .rt-sheet-error { color: #FFB4A8; }
.rt-sheet-error[hidden] { display: none; }

/* The hidden attribute must win over display rules on any element. */
.rt [hidden], .rt[hidden], .rt-sheet[hidden] { display: none !important; }

/* Place suggestions under the From / To fields */
.rt .rt-step { width: 36px; height: 36px; border-radius: 18px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font-size: 18px; line-height: 1; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.rt .rt-step:active { background: var(--bg); }
.rt-suggest { position: absolute; left: 0; right: 0; top: 100%; z-index: 5; margin: 6px 0 0; padding: 6px; list-style: none; border-radius: 14px; background: var(--surface); border: 1px solid var(--line-2); box-shadow: var(--shadow); max-height: 50vh; overflow: auto; }
.rt-suggest li { display: flex; flex-direction: column; gap: 1px; padding: 10px 12px; border-radius: 10px; cursor: pointer; }
.rt-suggest li[aria-selected="true"], .rt-suggest li:hover { background: var(--bg); }
.rt-suggest .rt-suggest-main { font-size: 15px; line-height: 20px; font-weight: 600; color: var(--ink); }
.rt-suggest .rt-suggest-secondary { font-size: 13px; line-height: 18px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rt-suggest .rt-suggest-tag { font-size: 11px; line-height: 14px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .4px; }

/* Mode chips */
.rt-modes { display: grid; grid-template-columns: repeat(auto-fit, minmax(70px, 1fr)); gap: 8px; }
.rt .rt-mode { min-width: 0; min-height: 52px; box-sizing: border-box; padding: 6px 4px; border-radius: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 12px; line-height: 16px; font-weight: 600; text-align: center; }
.rt-mode-icon { display: flex; }
.rt-mode-icon img { display: block; width: 44px; height: 28px; object-fit: contain; }
.rt-mode-head .rt-mode-icon img { width: 40px; height: 26px; }
.rt-check { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 2px; font-size: 14px; line-height: 20px; color: var(--ink-2); cursor: pointer; }
.rt-check input { width: 20px; height: 20px; accent-color: var(--rec); margin: 0; }
.rt-inline-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rt-small-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; line-height: 16px; font-weight: 600; color: var(--ink-3); }
.rt-small-input { display: flex; align-items: center; gap: 6px; height: 44px; box-sizing: border-box; padding: 0 10px 0 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.rt-small-input input { appearance: none; -webkit-appearance: none; min-width: 0; width: 100%; border: 0; background: none; font: 600 16px/22px var(--num); color: var(--ink); outline: none; }
.rt-small-input em { font-style: normal; font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.rt-small-input:focus-within { box-shadow: inset 0 0 0 2px var(--focus); }
/* Mode comparison cards */
.rt-mode-card { box-sizing: border-box; padding: 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.rt-mode-card.rt-rec { border-color: var(--rec); box-shadow: 0 0 0 1px var(--rec); }
.rt-mode-head { display: flex; align-items: center; gap: 10px; }
.rt-mode-head .rt-mode-icon { width: 52px; height: 36px; border-radius: 10px; background: #FFFFFF; border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; flex: none; }
.rt-mode-name { font-size: 13px; line-height: 18px; font-weight: 600; color: var(--ink-3); }
.rt-mode-title { font-size: 16px; line-height: 22px; font-weight: 600; text-wrap: pretty; }
.rt-mode-figs { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.rt-mode-fig { font-family: var(--num); font-size: 22px; line-height: 26px; font-weight: 600; }
.rt-mode-fig small { font-size: 14px; font-weight: 600; margin-left: 3px; }
.rt-mode-money { display: flex; flex-wrap: wrap; gap: 6px; }
.rt-mode-money span { padding: 2px 8px; border-radius: 999px; background: var(--bg); font-size: 12px; line-height: 18px; color: var(--ink-2); }
.rt-legs { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; font-size: 13px; line-height: 18px; color: var(--ink-2); }
.rt-legs li { display: flex; justify-content: space-between; gap: 10px; }
.rt-legs li.rt-leg-ride { color: var(--ink); font-weight: 500; }
.rt-legs li.rt-leg-covered { margin: -4px 0 0 10px; font-size: 12px; line-height: 16px; color: var(--ink-3); }
.rt .rt-ride-apps { display: flex; gap: 8px; }
.rt .rt-ride-btn { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 46px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 15px; font-weight: 600; text-decoration: none; }
.rt .rt-ride-btn:active { opacity: .7; }
.rt-mode-link { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 40px; border-top: 1px solid var(--line); font-size: 14px; font-weight: 600; color: var(--ink); text-decoration: none; }

/* Grab price log */
.rt-quote { display: flex; flex-direction: column; gap: 6px; padding: 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); }
.rt-quote input[type="number"] { flex: 1 1 auto; min-width: 0; height: 42px; box-sizing: border-box; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 16px; font-family: var(--num); font-weight: 600; }
.rt-quote-tags { display: flex; flex-wrap: wrap; column-gap: 14px; }
.rt .rt-quote-send { height: 42px; padding: 0 16px; border-radius: 10px; background: var(--rec); color: var(--rec-ink); font-size: 14px; font-weight: 600; }
.rt .rt-quote-send:disabled { opacity: .6; }

.rt-allin { display: flex; flex-direction: column; gap: 2px; font-size: 16px; line-height: 22px; font-weight: 700; color: var(--ink); }
.rt-allin span { font-size: 12px; line-height: 16px; font-weight: 400; color: var(--ink-3); }

/* Language switch (EN / ไทย): a pill that shows the current language in bold and toggles on tap. */
.rt .rt-lang { display: flex; align-items: center; min-height: 44px; }
.rt-lang-pill { display: flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line-2); font-size: 13px; line-height: 18px; font-weight: 600; color: var(--ink-3); }
.rt-lang-on { color: var(--ink); font-weight: 700; }
.rt-lang-sep { opacity: .5; }
.rt .rt-lang-landing { position: absolute; top: calc(8px + env(safe-area-inset-top, 0px)); right: 12px; z-index: 2; color: #FFFFFF; }
.rt-lang-landing .rt-lang-pill { border-color: rgba(255,255,255,.4); background: rgba(10,12,17,.4); color: rgba(255,255,255,.72); }
.rt-lang-landing .rt-lang-on { color: #FFFFFF; }

/* Thai: IBM Plex Sans Thai (OFL, self-hosted in /fonts, Thai + Latin subset) for all text; Barlow stays for English.
   The same family name is also requested from Google Fonts in index.html; these local files win and work offline. */
@font-face { font-family: 'IBM Plex Sans Thai'; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/IBMPlexSansThai-400Regular.woff2") format("woff2"); }
@font-face { font-family: 'IBM Plex Sans Thai'; font-style: normal; font-weight: 500; font-display: swap; src: url("/fonts/IBMPlexSansThai-500Medium.woff2") format("woff2"); }
@font-face { font-family: 'IBM Plex Sans Thai'; font-style: normal; font-weight: 600; font-display: swap; src: url("/fonts/IBMPlexSansThai-600SemiBold.woff2") format("woff2"); }
@font-face { font-family: 'IBM Plex Sans Thai'; font-style: normal; font-weight: 700; font-display: swap; src: url("/fonts/IBMPlexSansThai-700Bold.woff2") format("woff2"); }
.rt:lang(th) { font-family: 'IBM Plex Sans Thai', 'Barlow', system-ui, -apple-system, 'Segoe UI', sans-serif; overflow-wrap: break-word; }
.rt:lang(th) .rt-landing-field input, .rt:lang(th) .rt-sheet-field input { font-family: 'IBM Plex Sans Thai', 'Barlow', system-ui, sans-serif; }
/* Thai stacks vowels and tone marks above and below the line: give clipped single-line text a little air. */
.rt:lang(th) .rt-suggest .rt-suggest-secondary, .rt:lang(th) [style*="text-overflow: ellipsis"] { padding-top: 2px; padding-bottom: 2px; }
.rt:lang(th) .rt-mode { line-height: 18px; }
.rt:lang(th) .rt-landing-lede { line-height: 28px; }
.rt:lang(th) .rt-landing-note { line-height: 24px; }
.rt:lang(th) .rt-mode-money span { line-height: 20px; }
.rt:lang(th) .rt-legs li > span:last-child { flex: none; white-space: nowrap; }
.rt:lang(th) .rt-landing-cta em, .rt:lang(th) .rt-landing-link, .rt:lang(th) .rt-allowance button { text-underline-position: under; }

.rt-walk-map { display: block; width: 100%; height: auto; border-radius: 12px; background: var(--line); }
.rt-leg-covered a { color: inherit; }
