/* iPathik — Minimal, mobile-first CSS. No framework needed. */

:root {
  --orange: #e8521a;
  --orange-dark: #c44216;
  --orange-light: #fff3ee;
  --orange-border: #fcd5c0;
  --focus-ring: rgba(232,82,26,.12);
  --on-brand: #fff;
  --surface: #fff;
  --gray-50:  #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-400: #6b7280;               /* text on white must reach 4.5:1 (scripts/webui.sh checks) */
  --gray-500: #5b6270;
  --fill: #c44216;                   /* brand surfaces with white text on them: 5:1 */
  --ink: #c44216;                    /* brand-coloured text (links, fares) on white: 5:1 */
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-900: #111827;
  --green:    #16a34a;
  --red:      #dc2626;
  --blue:     #2563eb;
  --ok-bg: #dcfce7;  --ok-fg: #166534;  --ok-line: #86c99a; --seat-free: #e8f7ee;
  --bad-bg: #fee2e2; --bad-fg: #b91c1c;
  --warn-bg: #fff7e0; --warn-fg: #6b4e00; --warn-line: #e0a800;
  --info-bg: #dbeafe; --info-fg: #1d4ed8;
  --violet-bg: #ede9fe; --violet-fg: #6d28d9;
  --amber-fg: #854d0e; --amber-line: #ca8a04;
  --radius:   12px;
  --shadow:   0 1px 4px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  color-scheme: light;
}
/* Themes: <html data-theme> comes from the visitor's choice on /settings ("system" follows the device). */
:root[data-theme="dark"] {
  --orange: #f26a33;
  --orange-dark: #ff8a57;
  --orange-light: #3a2117;
  --orange-border: #6b3a24;
  --focus-ring: rgba(242,106,51,.25);
  --on-brand: #fff;
  --surface: #1c1f26;
  --gray-50:  #12141a;
  --gray-100: #232731;
  --gray-200: #353b48;
  --gray-400: #8a93a5;
  --fill: #c2410c;
  --ink: #ff8a57;
  --gray-500: #9aa2b1;
  --gray-600: #b3bac6;
  --gray-700: #cdd2db;
  --gray-900: #eef0f4;
  --green:    #4ade80;
  --red:      #f87171;
  --blue:     #60a5fa;
  --ok-bg: #143322;  --ok-fg: #86efac;  --ok-line: #2f7a4b; --seat-free: #16301f;
  --bad-bg: #3b1717; --bad-fg: #fca5a5;
  --warn-bg: #352a0c; --warn-fg: #fcd34d; --warn-line: #a17a12;
  --info-bg: #172a4a; --info-fg: #93c5fd;
  --violet-bg: #2a2050; --violet-fg: #c4b5fd;
  --amber-fg: #fcd34d; --amber-line: #ca8a04;
  --shadow:   0 1px 4px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.3);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]), :root[data-theme="system"] {
    --orange: #f26a33;
    --orange-dark: #ff8a57;
    --orange-light: #3a2117;
    --orange-border: #6b3a24;
    --focus-ring: rgba(242,106,51,.25);
    --on-brand: #fff;
    --surface: #1c1f26;
    --gray-50:  #12141a;
    --gray-100: #232731;
    --gray-200: #353b48;
    --gray-400: #8a93a5;
  --fill: #c2410c;
  --ink: #ff8a57;
    --gray-500: #9aa2b1;
    --gray-600: #b3bac6;
    --gray-700: #cdd2db;
    --gray-900: #eef0f4;
    --green:    #4ade80;
    --red:      #f87171;
    --blue:     #60a5fa;
    --ok-bg: #143322;  --ok-fg: #86efac;  --ok-line: #2f7a4b; --seat-free: #16301f;
    --bad-bg: #3b1717; --bad-fg: #fca5a5;
    --warn-bg: #352a0c; --warn-fg: #fcd34d; --warn-line: #a17a12;
    --info-bg: #172a4a; --info-fg: #93c5fd;
    --violet-bg: #2a2050; --violet-fg: #c4b5fd;
    --amber-fg: #fcd34d; --amber-line: #ca8a04;
    --shadow:   0 1px 4px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.3);
    color-scheme: dark;
  }
}
:root[data-theme="indigo"] {
  --orange: #3949ab;
  --fill: #3949ab;
  --ink: #3949ab;
  --orange-dark: #283593;
  --orange-light: #eef0fb;
  --orange-border: #c5cae9;
  --focus-ring: rgba(57,73,171,.15);
}
:root[data-theme="contrast"] {
  --orange: #9a2d07;
  --fill: #9a2d07;
  --ink: #9a2d07;
  --orange-dark: #6e1f03;
  --orange-light: #fff;
  --orange-border: #000;
  --focus-ring: rgba(0,0,0,.35);
  --gray-50:  #fff;
  --gray-100: #f0f0f0;
  --gray-200: #000;
  --gray-400: #333;
  --gray-500: #1a1a1a;
  --gray-600: #000;
  --gray-700: #000;
  --gray-900: #000;
  --green: #0a5d1e; --red: #a30000; --blue: #0033a0;
  --ok-fg: #0a4d1a; --bad-fg: #8a0000; --warn-fg: #3d2c00; --info-fg: #002a80; --violet-fg: #3d0a8a; --amber-fg: #4a2a00;
  --shadow: none;
}
:root[data-theme="contrast"] .field, :root[data-theme="contrast"] .card, :root[data-theme="contrast"] .btn-secondary { border-width: 2px; }
:root[data-theme="contrast"] main a:not([class*="btn"]), :root[data-theme="contrast"] footer a { text-decoration: underline; }
/* Blue (the default): white text on iPathik blue, a darker blue top bar, white fields and white buttons with blue text.
   Information is light yellow straight on the blue; errors are red on white. */
:root[data-theme="blue"] {
  --fill: var(--orange);             /* this theme styles its own brand surfaces */
  --ink: var(--orange);
  --orange: #ffffff;
  --orange-dark: #e3ecf9;
  --orange-light: #1a60b8;
  --orange-border: #5b8bd6;
  --focus-ring: rgba(255,255,255,.45);
  --on-brand: #0b4da2;
  --surface: #1257ae;
  --gray-50:  #0b4da2;
  --gray-100: #1a60b8;
  --gray-200: #4a7fcc;
  --gray-400: #c4d6f2;
  --gray-500: #d3e1f6;
  --gray-600: #e3ecf9;
  --gray-700: #f1f6fd;
  --gray-900: #ffffff;
  --green:    #9af0b8;
  --red:      #ffc2c2;
  --blue:     #cfe0ff;
  --ok-bg: transparent; --ok-fg: #ffe08a; --ok-line: #ffe08a; --seat-free: #dff3e6;
  --bad-bg: #ffffff; --bad-fg: #c62828;
  --warn-bg: transparent; --warn-fg: #ffe08a; --warn-line: #ffe08a;
  --info-bg: transparent; --info-fg: #ffe08a;
  --violet-bg: #ffffff; --violet-fg: #4a1d96;
  --amber-fg: #ffe08a; --amber-line: #ffe08a;
  --shadow: 0 1px 4px rgba(0,0,0,.18), 0 4px 16px rgba(0,0,0,.12);
  color-scheme: light;
}
:root[data-theme="blue"] nav { background: #083b7d; }
:root[data-theme="blue"] .logo, :root[data-theme="blue"] .nav-lang, :root[data-theme="blue"] .nav-account,
:root[data-theme="blue"] .nav-staff, :root[data-theme="blue"] .pnr-form button { color: #fff; }
:root[data-theme="blue"] .station-field input, :root[data-theme="blue"] .filter-field input,
:root[data-theme="blue"] .filter-field select, :root[data-theme="blue"] .field, :root[data-theme="blue"] .swap-btn {
  background: #fff; color: #111; border-color: #fff;
}
:root[data-theme="blue"] ::placeholder { color: #6b7280; }
:root[data-theme="blue"] .btn-secondary { background: transparent; color: #fff; border-color: rgba(255,255,255,.7); }
:root[data-theme="blue"] .btn-secondary:hover { background: rgba(255,255,255,.12); }
:root[data-theme="blue"] .btn-danger { color: #fff; }
:root[data-theme="blue"] .field-err:not(:empty) { display: inline-block; background: #fff; padding: 1px 6px; border-radius: 4px; }
:root[data-theme="blue"] .no-trains { background: transparent; color: #ffe08a; border: 1px solid #ffe08a; border-radius: 8px; padding: 12px 16px; margin: 16px 0;
                                      box-shadow: 0 1px 4px rgba(0,0,0,.2); }
:root[data-theme="blue"] .error-msg, :root[data-theme="blue"] .form-error { box-shadow: 0 1px 4px rgba(0,0,0,.2); }
:root[data-theme="blue"] .ok-msg, :root[data-theme="blue"] .notice { border: 1px solid #ffe08a; }
:root[data-theme="blue"] .promo-ticker ul { background: #fff; } :root[data-theme="blue"] .promo-ticker li { color: #0b4da2; }
/* Booking counter: the railway counter-terminal look in our own colours. Phosphor-green text, amber for
   actions and the top bar (shown in reverse, like a terminal's status line), monospaced, square corners, no shadows. */
:root[data-theme="terminal"] {
  --fill: var(--orange);             /* this theme styles its own brand surfaces */
  --ink: var(--orange);
  --orange: #ffb000;
  --orange-dark: #ffc94d;
  --orange-light: #1c1704;
  --orange-border: #5c4700;
  --focus-ring: rgba(255,176,0,.30);
  --on-brand: #0a0e0a;
  --surface: #0d140d;
  --gray-50:  #0a0e0a;
  --gray-100: #122012;
  --gray-200: #1f3d24;
  --gray-400: #4aa865;
  --gray-500: #5ccf7b;
  --gray-600: #62da82;
  --gray-700: #7cee9a;
  --gray-900: #3dff74;
  --green:    #3dff74;
  --red:      #ff5c5c;
  --blue:     #5cc8ff;
  --ok-bg: #0f2e17;  --ok-fg: #7dffa3;  --ok-line: #2f7a43; --seat-free: #0f2a15;
  --bad-bg: #3a0f0f; --bad-fg: #ff9a9a;
  --warn-bg: #2e2405; --warn-fg: #ffd25c; --warn-line: #a37b00;
  --info-bg: #0d2433; --info-fg: #8fdcff;
  --violet-bg: #231a3d; --violet-fg: #c9b8ff;
  --amber-fg: #ffd25c; --amber-line: #a37b00;
  --radius: 2px;
  --shadow: none;
  color-scheme: dark;
}
:root[data-theme="terminal"] body,
:root[data-theme="terminal"] input, :root[data-theme="terminal"] select,
:root[data-theme="terminal"] textarea, :root[data-theme="terminal"] button {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, 'Liberation Mono', 'DejaVu Sans Mono', monospace;
}
:root[data-theme="terminal"] h1, :root[data-theme="terminal"] h2, :root[data-theme="terminal"] h3 {
  text-transform: uppercase; letter-spacing: .06em;
}
:root[data-theme="terminal"] .card, :root[data-theme="terminal"] .field { border-color: var(--gray-200); }
:root[data-theme="terminal"] input, :root[data-theme="terminal"] select, :root[data-theme="terminal"] textarea { color: var(--gray-900); }
:root[data-theme="terminal"] ::placeholder { color: var(--gray-400); opacity: 1; }
:root[data-theme="terminal"] ::selection { background: var(--gray-900); color: var(--gray-50); }

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
       background: var(--gray-50); color: var(--gray-900); line-height: 1.5; }
a { color: var(--ink, var(--orange)); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Nav ─────────────────────────────────────────────────────────────────── */
nav {
  background: var(--fill, var(--orange)); color: var(--on-brand);
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px; position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.logo { color: var(--on-brand); font-size: 1.25rem; font-weight: 800; letter-spacing: -.5px;
        display: inline-flex; align-items: center; gap: .45rem; }
.logo svg { width: 1.75rem; height: 1.75rem; flex: none; }
.tagline { color: rgba(255,255,255,.7); font-size: .8rem; flex: 1; }
.pnr-form { display: flex; gap: 6px; }
.pnr-form input { padding: 6px 12px; border-radius: 8px; border: none;
                   font-size: .85rem; width: 140px; }
.pnr-form button { padding: 6px 14px; background: rgba(255,255,255,.2);
                    color: var(--on-brand); border: 1px solid rgba(255,255,255,.4);
                    border-radius: 8px; cursor: pointer; font-weight: 600; }
.pnr-form button:hover { background: rgba(255,255,255,.35); }

/* ── Layout ──────────────────────────────────────────────────────────────── */
main { max-width: 720px; margin: 0 auto; padding: 24px 16px 48px; }
footer { text-align: center; padding: 16px; font-size: .75rem; color: var(--gray-400); }

/* ── Hero ────────────────────────────────────────────────────────────────── */
.hero { text-align: center; margin-bottom: 24px; }
.hero h1 { font-size: 1.75rem; font-weight: 800; }
.hero .sub { color: var(--gray-400); font-size: .9rem; margin-top: 4px; }

/* ── Search card ─────────────────────────────────────────────────────────── */
.search-card {
  background: var(--surface); border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow); border: 1px solid var(--gray-200);
}
.station-row { display: flex; align-items: flex-end; gap: 8px; margin-bottom: 14px; }
.station-field { flex: 1; position: relative; }
.station-field label,
.filter-field  label { display: block; font-size: .7rem; font-weight: 700;
                        text-transform: uppercase; letter-spacing: .05em;
                        color: var(--gray-400); margin-bottom: 4px; }
.station-field input,
.filter-field  input,
.filter-field  select,
.field { width: 100%; padding: 10px 12px; border: 1.5px solid var(--gray-200);
          border-radius: 8px; font-size: .9rem; outline: none; background: var(--surface); }
.station-field input:focus,
.filter-field input:focus,
.filter-field select:focus,
.field:focus { border-color: var(--orange); box-shadow: 0 0 0 3px var(--focus-ring); }
.field-sm { max-width: 90px; }
.swap-btn { flex-shrink: 0; padding: 10px 12px; border: 1.5px solid var(--gray-200);
             background: var(--surface); border-radius: 8px; cursor: pointer; font-size: 1rem;
             color: var(--gray-600); transition: background .15s; }
.swap-btn:hover { background: var(--orange-light); border-color: var(--orange); }

.filters-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
                gap: 10px; margin-bottom: 16px; }
.filters-row > * { min-width: 0; }                 /* a time or date box never pushes the row off the screen */
.filter-field[hidden] { display: none; }
.filter-field select { appearance: none; cursor: pointer; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn-primary {
  display: inline-block; width: 100%; padding: 13px;
  background: var(--fill, var(--orange)); color: var(--on-brand); border: none; border-radius: var(--radius);
  font-size: 1rem; font-weight: 700; cursor: pointer; text-align: center;
  transition: background .15s; text-decoration: none;
}
.btn-primary:hover { background: var(--orange-dark); text-decoration: none; color: var(--on-brand); }
/* a test payment (the gateway's test environment): red, the opposite of the brand colour, the same in every theme */
.btn-primary.btn-test, .btn-primary.btn-test:hover { --fill: #c62828; background: #c62828; color: #fff; }
.btn-primary.btn-test:hover { background: #a61b1b; }
.btn-primary.btn-sim, .btn-primary.btn-sim:hover { --fill: #1565c0; background: #1565c0; color: #fff; box-shadow: inset 0 0 0 2px #fff; }   /* a simulated payment: blue, white outline */
.btn-primary.btn-sim:hover { background: #0d47a1; }
.btn-secondary {
  display: inline-block; padding: 10px 20px;
  background: var(--surface); color: var(--gray-900); border: 1.5px solid var(--gray-200);
  border-radius: var(--radius); font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn-secondary:hover { background: var(--gray-50); text-decoration: none; }
.btn-cancel {
  display: inline-block; padding: 10px 20px;
  background: var(--surface); color: var(--red); border: 1.5px solid var(--red);
  border-radius: var(--radius); font-weight: 600; cursor: pointer;
}

/* ── Autocomplete suggestions ────────────────────────────────────────────── */
.suggestions {
  position: absolute; z-index: 200; top: 100%; left: 0; right: 0;
  background: var(--surface); border: 1.5px solid var(--gray-200);
  border-radius: 8px; box-shadow: var(--shadow); list-style: none;
  max-height: 240px; overflow-y: auto; margin-top: 2px;
}
.suggestion-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; cursor: pointer; border-bottom: 1px solid var(--gray-100);
}
.suggestion-item:last-child { border-bottom: none; }
.suggestion-item:hover { background: var(--orange-light); }
.stn-name { font-weight: 600; font-size: .9rem; }
.stn-meta { font-size: .75rem; color: var(--gray-400); }
.stn-code { font-family: monospace; font-weight: 800; color: var(--ink, var(--orange)); font-size: .85rem; }
.no-results { padding: 10px 14px; color: var(--gray-400); font-size: .85rem; list-style: none; }

/* ── Quick routes ────────────────────────────────────────────────────────── */
.quick-routes { margin-top: 24px; }
.section-label { font-size: .7rem; font-weight: 700; text-transform: uppercase;
                  letter-spacing: .05em; color: var(--gray-400); margin-bottom: 8px; }
.route-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 7px 14px; background: var(--surface); border: 1.5px solid var(--gray-200);
         border-radius: 99px; font-size: .85rem; cursor: pointer; font-weight: 500;
         transition: all .15s; }
.chip:hover { border-color: var(--orange); color: var(--ink, var(--orange)); background: var(--orange-light); }

/* ── HTMX indicator ──────────────────────────────────────────────────────── */
.htmx-indicator { display: none; text-align: center; padding: 8px;
                   color: var(--gray-400); font-size: .85rem; }
.htmx-request .htmx-indicator { display: block; }

/* ── Results header ──────────────────────────────────────────────────────── */
.results-header { margin: 20px 0 12px; font-size: .85rem; color: var(--gray-600);
                   font-weight: 600; }

/* ── Train card ──────────────────────────────────────────────────────────── */
.train-card {
  background: var(--surface); border-radius: var(--radius); padding: 16px;
  box-shadow: var(--shadow); border: 1px solid var(--gray-200); margin-bottom: 12px;
}
.train-header { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.train-name { font-weight: 700; font-size: 1rem; }
.train-num  { color: var(--gray-400); font-size: .8rem; }
.train-timing { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.time-block { text-align: center; }
.time-block.right { text-align: right; }
.time { display: block; font-size: 1.4rem; font-weight: 800; }
.stn  { display: block; font-size: .75rem; color: var(--gray-400); font-weight: 700;
         font-family: monospace; }
.duration-block { flex: 1; text-align: center; }
.duration { display: block; font-size: .8rem; color: var(--gray-600); }
.arrow    { display: block; color: var(--gray-400); font-size: .75rem; }
.dist     { display: block; font-size: .7rem; color: var(--gray-400); }
.class-row { display: flex; flex-wrap: wrap; gap: 8px; }
.class-btn {
  display: flex; flex-direction: column; align-items: center;
  padding: 8px 12px; border-radius: 8px; font-size: .8rem; min-width: 64px;
  text-decoration: none;
}
.class-btn b    { font-size: .85rem; font-weight: 800; }
.class-btn .fare { font-size: .9rem; font-weight: 700; color: var(--ink, var(--orange)); margin-top: 2px; }
.class-btn small { font-size: .65rem; margin-top: 2px; }
.class-btn.avail {
  border: 1.5px solid var(--orange); color: var(--gray-900);
  background: var(--orange-light); cursor: pointer;
}
.class-btn.avail:hover { background: var(--fill, var(--orange)); color: var(--on-brand); text-decoration: none; }
.class-btn.avail:hover .fare { color: var(--on-brand); }
.class-btn.unavail {
  border: 1.5px solid var(--gray-200); color: var(--gray-400);
  background: var(--gray-50); cursor: not-allowed;
}
.class-btn.unavail small { color: var(--red); }

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge { display: inline-block; font-size: .65rem; font-weight: 700;
          padding: 2px 8px; border-radius: 99px; text-transform: uppercase; }
.badge-raj  { background: var(--info-bg); color: var(--info-fg); }
.badge-shd  { background: var(--violet-bg); color: var(--violet-fg); }
.badge-exp  { background: var(--ok-bg); color: var(--ok-fg); }
.badge-mail { background: var(--gray-100); color: var(--gray-600); }
.badge-avl  { background: var(--ok-bg); color: var(--ok-fg); }
.badge-wl   { background: var(--warn-bg); color: var(--warn-fg); }
.badge-can  { background: var(--bad-bg); color: var(--bad-fg); }

/* ── Book page ───────────────────────────────────────────────────────────── */
.back-link { display: inline-block; margin-bottom: 12px; font-size: .85rem;
              color: var(--gray-600); }
.summary-card { background: var(--orange-light); border: 1px solid var(--orange-border);
                 border-radius: var(--radius); padding: 14px; margin-bottom: 20px; }
.summary-train { font-size: 1.05rem; font-weight: 700; margin-bottom: 4px; }
.summary-route { font-size: .85rem; color: var(--gray-600); }
.summary-fare  { margin-top: 8px; font-size: .95rem; }
.summary-fare b { color: var(--ink, var(--orange)); font-size: 1.1rem; }
.book-form h3 { font-size: .9rem; font-weight: 700; color: var(--gray-600);
                text-transform: uppercase; letter-spacing: .04em;
                margin: 20px 0 10px; border-bottom: 1px solid var(--gray-200); padding-bottom: 4px; }
.pax-block { border: 1.5px solid var(--gray-200); border-radius: var(--radius);
              padding: 12px; margin-bottom: 10px; }
.pax-block legend { padding: 0 6px; font-size: .8rem; font-weight: 700;
                     color: var(--gray-600); }
.pax-fields  { display: flex; gap: 8px; flex-wrap: wrap; }
.pax-fields .field { flex: 1; min-width: 120px; }
.contact-fields { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.contact-fields .field { flex: 1; min-width: 160px; }
.payment-opts { display: flex; gap: 16px; flex-wrap: wrap; margin: 8px 0 16px; }
.payment-opts label { display: flex; align-items: center; gap: 6px;
                       font-size: .9rem; cursor: pointer; }
.fare-total { text-align: right; font-size: 1rem; margin-bottom: 12px; color: var(--gray-600); }
.fare-total b { color: var(--ink, var(--orange)); font-size: 1.2rem; }
.btn-book { margin-top: 8px; font-size: 1.1rem; padding: 15px; }

/* ── Confirmation / Ticket ───────────────────────────────────────────────── */
.confirm-card, .ticket-card {
  background: var(--surface); border-radius: var(--radius); padding: 24px;
  box-shadow: var(--shadow); border: 1px solid var(--gray-200); text-align: center;
}
.confirm-icon { font-size: 3rem; margin-bottom: 8px; }
.confirm-card h2 { font-size: 1.5rem; margin-bottom: 16px; }
.pnr-display { display: inline-flex; align-items: center; gap: 10px;
                background: var(--orange-light); border: 1px solid var(--orange-border);
                border-radius: 8px; padding: 8px 20px; margin-bottom: 20px; }
.pnr-label  { font-size: .7rem; font-weight: 700; text-transform: uppercase;
               color: var(--gray-400); }
.pnr-number { font-size: 1.4rem; font-weight: 900; font-family: monospace;
               color: var(--orange); letter-spacing: 2px; }
.confirm-details { width: 100%; border-collapse: collapse; text-align: left;
                    margin-bottom: 20px; font-size: .9rem; }
.confirm-details th { padding: 6px 12px; color: var(--gray-600); font-weight: 600;
                       width: 40%; }
.confirm-details td { padding: 6px 12px; }
.confirm-details tr { border-bottom: 1px solid var(--gray-100); }
.confirm-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ── Ticket ──────────────────────────────────────────────────────────────── */
.ticket-card { text-align: left; }
.ticket-header { display: flex; justify-content: space-between; align-items: center;
                  margin-bottom: 12px; }
.ticket-train  { font-size: 1.15rem; font-weight: 800; margin-bottom: 14px; }
.ticket-route  { display: flex; align-items: center; gap: 16px;
                  background: var(--gray-50); border-radius: 10px;
                  padding: 12px 16px; margin-bottom: 16px; }
.stn-big       { display: block; font-size: 1.3rem; font-weight: 900;
                  font-family: monospace; color: var(--orange); }
.stn-name      { display: block; font-size: .75rem; color: var(--gray-400); }
.arrow-big     { color: var(--gray-400); }
.ticket-meta   { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 16px;
                  font-size: .85rem; }
.ticket-meta span { color: var(--gray-600); }
.pax-table     { width: 100%; border-collapse: collapse; font-size: .85rem;
                  margin-bottom: 16px; }
.pax-table th  { text-align: left; padding: 6px 10px; background: var(--gray-50);
                  font-weight: 700; font-size: .75rem; color: var(--gray-400);
                  text-transform: uppercase; }
.pax-table td  { padding: 8px 10px; border-bottom: 1px solid var(--gray-100); }
.ticket-contact { font-size: .8rem; color: var(--gray-400); margin-bottom: 16px; }
.ticket-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ── Errors / PNR page ───────────────────────────────────────────────────── */
.error-msg { background: var(--bad-bg); color: var(--bad-fg); padding: 10px 14px;
              border-radius: 8px; font-size: .9rem; margin: 12px 0; }
.no-trains { padding: 24px; text-align: center; color: var(--gray-400); }
.pnr-page  { text-align: center; padding: 40px 20px; }
.pnr-page h2 { font-size: 1.3rem; margin-bottom: 16px; }
.pnr-lookup { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.pnr-lookup input { padding: 10px 14px; border: 1.5px solid var(--gray-200);
                     border-radius: 8px; font-size: 1rem; width: 200px; }
.pnr-lookup button { padding: 10px 24px; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .filters-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .station-row { flex-direction: column; }
  .swap-btn    { align-self: center; transform: rotate(90deg); }
  .train-timing { gap: 6px; }
  .time         { font-size: 1.1rem; }
  nav           { flex-wrap: wrap; }
  .tagline      { display: none; }
}

/* Async booking panel (htmx): form + pay view load here without a page navigation */
#booking-panel:empty { display: none; }
#booking-panel { margin: 16px 0; }
.form-error:empty { display: none; }
.form-error { margin: 8px 0 12px; padding: 10px 12px; border-radius: 8px; background: var(--bad-bg); }
.htmx-request .btn-book { opacity: .6; pointer-events: none; }

/* ═══ Mobile / touch ═════════════════════════════════════════════════════════
   Phones first-class: no iOS focus-zoom (inputs >= 16px), 44px tap targets, safe-area
   insets for notches, one-handed primary actions, tables that never overflow the screen. */
html { -webkit-text-size-adjust: 100%; }
body { overflow-x: hidden; }
a, button, .chip, .class-btn, .suggestion-item, label { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
main { overflow-wrap: anywhere; }
img, svg, video { max-width: 100%; height: auto; }

@media (max-width: 640px) {
  /* inputs: 16px stops iOS Safari zooming the page on focus; 44px is a comfortable tap height */
  input, select, textarea, .field,
  .station-field input, .filter-field input, .filter-field select,
  .pnr-form input, .pnr-lookup input { font-size: 16px; min-height: 44px; }
  .btn-primary, .btn-secondary, .btn-cancel, .pnr-form button, .swap-btn, .chip { min-height: 44px; }

  nav { padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top, 0px));
        padding-left: calc(14px + env(safe-area-inset-left, 0px));
        padding-right: calc(14px + env(safe-area-inset-right, 0px)); gap: 8px; }
  .pnr-form { flex: 1 1 100%; order: 3; }
  .pnr-form input { flex: 1; width: auto; min-width: 0; }

  main { padding: 16px 14px calc(32px + env(safe-area-inset-bottom, 0px)); }
  .hero h1 { font-size: 1.5rem; }
  .search-card { padding: 14px; }

  .filters-row { grid-template-columns: 1fr 1fr; }
  .filters-row .filter-field:first-child { grid-column: 1 / -1; }   /* date gets a full row */
  .station-row { align-items: stretch; }          /* desktop rule is flex-end: it pushed fields right */
  .station-field { width: 100%; }
  .station-field input { width: 100%; }

  /* autocomplete: taller rows, never taller than the visible screen under the keyboard */
  .suggestions { max-height: 38vh; -webkit-overflow-scrolling: touch; }
  .suggestion-item { min-height: 48px; }

  /* quick routes scroll sideways instead of wrapping into a tall block */
  .route-chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
  .route-chips::-webkit-scrollbar { display: none; }
  .chip { white-space: nowrap; display: inline-flex; align-items: center; }

  /* train cards */
  .train-card { padding: 12px; }
  .time { font-size: 1.15rem; }
  .class-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); }
  .class-btn { min-height: 60px; justify-content: center; }

  /* booking form: stacked fields, primary action pinned within thumb reach */
  .pax-fields { display: grid; grid-template-columns: 1fr 1fr; }
  .pax-fields .field:first-child { grid-column: 1 / -1; }
  .field-sm { max-width: none; }
  .contact-fields { flex-direction: column; align-items: stretch; }
  .contact-fields .field { min-width: 0; }
  .contact-fields .fld, .contact-fields .fld-sm { flex: 0 0 auto; width: 100%; }   /* stacked: full width, natural height */
  .payment-opts { gap: 10px; }
  .payment-opts label { min-height: 44px; }
  .btn-book { position: sticky; bottom: calc(10px + env(safe-area-inset-bottom, 0px));
              box-shadow: 0 6px 18px rgba(0,0,0,.25); z-index: 50; }

  /* pay / ticket / confirmation */
  .confirm-card, .ticket-card { padding: 16px; }
  .pnr-display { padding: 8px 14px; }
  .pnr-number  { font-size: 1.15rem; letter-spacing: 1px; }
  .confirm-details th { width: 38%; padding: 6px 8px; }
  .confirm-details td { padding: 6px 8px; }
  .confirm-actions .btn-primary, .confirm-actions .btn-secondary,
  .ticket-actions .btn-primary, .ticket-actions .btn-secondary, .ticket-actions .btn-cancel { flex: 1 1 100%; text-align: center; }
  .pax-table { display: block; overflow-x: auto; white-space: nowrap; }
  .ticket-route { flex-wrap: wrap; gap: 10px; padding: 10px 12px; }
  .ticket-meta { gap: 10px; }
  .pnr-lookup input { width: 100%; }
  .pnr-lookup button { width: 100%; }
}

@media (max-width: 360px) {
  .filters-row { grid-template-columns: 1fr; }
  .tagline { display: none; }
  .logo { font-size: 1.1rem; }
}

/* touch screens have no real hover: don't leave a tapped button stuck in its hover colour */
@media (hover: none) {
  .class-btn.avail:hover { background: var(--orange-light); color: var(--gray-900); }
  .class-btn.avail:hover .fare { color: var(--ink, var(--orange)); }
  .suggestion-item:hover { background: transparent; }
  .btn-primary:hover { background: var(--fill, var(--orange)); }
  .class-btn.avail:active { background: var(--fill, var(--orange)); color: var(--on-brand); }
  .class-btn.avail:active .fare { color: var(--on-brand); }
  .suggestion-item:active { background: var(--orange-light); }
}

/* ── One cohesive page: navigation swaps content in place (hx-boost), never reloads ── */
#topbar { position: fixed; top: 0; left: 0; height: 3px; width: 0; background: var(--on-brand);
          opacity: 0; z-index: 1000; pointer-events: none; }
#topbar.htmx-request { width: 85%; opacity: 1; transition: width 6s cubic-bezier(.1,.8,.2,1); }
@keyframes etb-in  { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
main, #booking-panel > *, #results > * { animation: etb-in .18s ease-out; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .15s; }
@media (prefers-reduced-motion: reduce) {
  main, #booking-panel > *, #results > * { animation: none; }
  #topbar.htmx-request { transition: none; }
}
@media (max-width: 640px) { .pax-fields select:last-child { grid-column: 1 / -1; } }

/* ── Home: Human / AI toggle, per-end "nearby" controls, priority ───────────────────────── */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mode-toggle { display: inline-flex; border: 1.5px solid var(--gray-200); border-radius: 999px; padding: 3px;
               margin: 0 0 14px; background: var(--gray-50); }
.mode-opt { padding: 7px 20px; border-radius: 999px; font-weight: 600; font-size: .9rem; cursor: pointer;
            color: var(--gray-600); display: inline-flex; align-items: center; gap: 6px; min-height: 36px; }
.mode-opt:has(input:checked) { background: var(--fill, var(--orange)); color: var(--on-brand); }
.mode-opt input { accent-color: var(--orange); }
.mode-panel[hidden] { display: none; }
.suggest-row { display: flex; align-items: center; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.suggest-row .field-sm { max-width: 110px; padding: 6px 8px; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--gray-600);
         text-transform: none; letter-spacing: 0; font-weight: 600; cursor: pointer; min-height: 32px; }
.opts-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; align-items: end; }
#return-row { margin-top: 6px; }
#return-row[hidden] { display: none; }
#ai-form textarea { resize: vertical; margin: 6px 0 12px; font-family: inherit; }
.hint { font-size: .75rem; color: var(--gray-400); margin-top: 8px; }
@media (max-width: 640px) {
  .opts-row { grid-template-columns: 1fr; }
  .mode-opt { padding: 9px 22px; min-height: 44px; }
  .suggest-row .field-sm { max-width: none; flex: 1; }
}

/* checkboxes and radios keep their natural size: the 44px minimum is for text boxes and selects */
input[type="checkbox"], input[type="radio"] { min-height: 0; width: 1.15rem; height: 1.15rem; flex: none;
                                             accent-color: var(--orange); padding: 0; }
.check, .station-field .check, .filter-field .check { text-transform: none; letter-spacing: 0; font-size: .85rem;
                                                       color: var(--gray-600); font-weight: 600; }
.swap-btn { align-self: center; height: 44px; }
.station-row { align-items: flex-start; }
.station-row .swap-btn { margin-top: 24px; }
@media (max-width: 480px) { .station-row .swap-btn { margin-top: 0; align-self: center; } }

/* nearby-alternative note inside a result card */
.alt-note { font-size: .82rem; line-height: 1.45; color: var(--gray-600); background: var(--orange-light);
            border-radius: 8px; padding: 8px 10px; margin: 0 0 10px; }
.alt-note b { color: var(--gray-900); }
.suggestions-header { margin-top: 24px; }

/* booking pages */
.cancel-form { margin: 16px 0; text-align: left; }
.cancel-form label { display: block; font-size: .8rem; color: var(--gray-600); margin-bottom: 6px; }
.cancel-form .field { margin-bottom: 10px; }
.table-scroll { overflow-x: auto; }

/* polish found in real renders of the booking pages */
@media (max-width: 640px) { .tagline { display: none; } }
.table-scroll .pax-table { display: table; width: 100%; white-space: normal; }
.confirm-card .summary-card, .ticket-card .summary-card { margin: 12px 0 16px; text-align: left; }

/* accounts */
.nav-account { color: var(--on-brand); margin-left: auto; flex: 0 0 auto; padding: 6px 12px; border: 1px solid rgba(255,255,255,.4); border-radius: 8px; font-weight: 600; font-size: .85rem; white-space: nowrap; max-width: 45vw; overflow: hidden; text-overflow: ellipsis; }
.pnr-form input { min-width: 0; }
.pnr-form { min-width: 0; flex: 1 1 auto; }
.auth-page { max-width: 420px; margin: 24px auto; padding: 0 4px; }
.auth-page h2 { margin-bottom: 12px; }
.auth-form { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }
.auth-page .kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 12px 0; }
.auth-page .kv dt { color: var(--gray-500); }
.auth-page ul { padding-left: 18px; line-height: 1.8; }
.auth-page .danger { margin-top: 28px; border-top: 1px solid var(--gray-200); padding-top: 12px; }
.ok-msg { background: var(--ok-bg); color: var(--ok-fg); padding: 10px 14px; border-radius: 8px; margin: 8px 0; }
.btn-danger { background: var(--bad-fg); color: var(--on-brand); border: 0; padding: 10px 16px; border-radius: 8px; font-weight: 600; cursor: pointer; }

/* seat map */
.seatmap h3 { margin-bottom: 6px; }
.sm-types { display: flex; flex-wrap: wrap; gap: 6px 16px; list-style: none; padding: 0; margin: 8px 0; font-size: .85rem; }
.sm-legend { font-size: .85rem; display: flex; align-items: center; gap: 8px; margin: 8px 0 14px; }
.coach { border: 1.5px solid var(--gray-200); border-radius: 14px; padding: 8px 10px 10px; margin-bottom: 12px; background: var(--surface); }
.coach h4 { margin: 0 0 8px; font-size: .95rem; }
.coach h4 small { color: var(--gray-500); font-weight: 400; margin-left: 6px; }
.coach-body.berth { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.bay { display: flex; gap: 2px; padding: 4px; border-radius: 8px; background: var(--gray-50); flex: 0 0 auto; }
.bay-col { display: flex; flex-direction: column; gap: 2px; }
.bay-side { margin-left: 8px; justify-content: flex-end; border-left: 2px dashed var(--gray-200); padding-left: 6px; }
.coach-body.seat { display: flex; flex-direction: column; gap: 3px; align-items: center; }
.seat-row { display: flex; gap: 3px; }
.seat-row .aisle { width: 18px; }
.sm { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 26px;
  border-radius: 6px; border: 1.5px solid var(--ok-line); background: var(--seat-free); font-size: .68rem; font-style: normal; }
.sm i { font-style: normal; }
.sm b { position: absolute; font-size: 1rem; line-height: 1; color: var(--bad-fg); }
.sm.taken { background: var(--gray-200); border-color: var(--gray-400); color: var(--gray-500); }
.sm.taken i { opacity: .35; }

/* e-catering */
.food-page { max-width: 560px; margin: 0 auto; }
.food-page ul { list-style: none; padding: 0; margin: 8px 0 16px; }
.food-page li.stop, .food-page li.order { display: flex; justify-content: space-between; align-items: center; gap: 12px;
  border: 1.5px solid var(--gray-200); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; background: var(--surface); }
.food-page .menu li.item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--gray-200); }
.food-page .menu label { flex: 1; }
.food-form { display: flex; flex-direction: column; gap: 10px; }
.diet { display: inline-block; font-size: .7rem; font-weight: 700; padding: 1px 6px; border-radius: 6px; margin-right: 4px; border: 1.5px solid; }
.diet-veg { color: var(--ok-fg); border-color: var(--green); }
.diet-jain { color: var(--amber-fg); border-color: var(--amber-line); }
.diet-nonveg { color: var(--bad-fg); border-color: var(--red); }
.food-page .menu li.item .field { width: 76px; flex: 0 0 76px; text-align: center; }
.food-page .menu label { min-width: 0; }
.food-page li.stop .btn-primary { flex: 0 0 auto; width: auto; padding: 8px 20px; }
.food-page li.order { flex-wrap: wrap; }
.food-page li.order .cancel-form { flex: 1 1 200px; }

/* first / last mile options on alternatives */
.ride-legs { margin: 6px 0 4px; display: flex; flex-direction: column; gap: 6px; }
.ride-head { display: block; font-size: .8rem; color: var(--gray-500); margin-bottom: 4px; }
.ride-row { display: flex; flex-wrap: wrap; gap: 6px; }
.ride-btn { display: inline-flex; flex-direction: column; align-items: flex-start; padding: 6px 10px; border-radius: 10px;
  border: 1.5px solid var(--gray-200); background: var(--surface); color: inherit; font-size: .8rem; line-height: 1.25; min-width: 92px; }
.ride-btn:hover { border-color: var(--orange); text-decoration: none; }
.ride-btn b { font-size: .85rem; }
.ride-btn small { color: var(--gray-500); }
.ride-local_train { border-style: dashed; }
.ride-note { font-size: .72rem; color: var(--gray-500); margin: 0; }

/* an expired hold: search again (same search) or start over */
.search-choices { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 12px 0 6px; }

/* booking form: more passenger details, children under 5, options */
.pax-more { margin-top: 6px; }
.chk { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; }
.book-options { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.lbl { display: block; font-size: .8rem; font-weight: 600; margin: 10px 0 4px; color: var(--gray-500); }

/* ── Terms, privacy, refunds, contact ────────────────────────────────────── */
footer a { color: inherit; }
.legal { max-width: 720px; margin: 0 auto; line-height: 1.55; }
.legal h1 { font-size: 1.5rem; font-weight: 800; }
.legal h2 { font-size: 1.05rem; font-weight: 700; margin-top: 20px; }
.legal ul { padding-left: 20px; }
.legal .notice { background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: 8px; padding: 10px 12px; margin: 12px 0; }
.legal-table { border-collapse: collapse; margin: 8px 0; }
.legal-table th, .legal-table td { border: 1px solid var(--gray-200); padding: 6px 10px; text-align: left; }

/* form fields: required / optional tags, the error under a field, a disabled button */
.lbl .req, .lbl .opt { font-weight: 400; font-size: .75rem; margin-left: 4px; }
.lbl .req { color: var(--orange-dark); }
.lbl .opt { color: var(--gray-500); }
.field-err { display: block; color: var(--bad-fg); font-size: .8rem; margin-top: 3px; }
.field[aria-invalid="true"] { border-color: var(--bad-fg); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary:disabled:hover { background: var(--fill, var(--orange)); }
.fld { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.fld-l { font-size: .78rem; font-weight: 600; color: var(--gray-700); }
.fld-l .req, .fld-l .opt { font-style: normal; font-weight: 400; font-size: .72rem; margin-left: 3px; }
.fld-l .req { color: var(--orange-dark); }
.fld-l .opt { color: var(--gray-500); }
.fld .field-err { margin-top: 0; }
.pax-fields .fld { flex: 1 1 110px; }
.pax-fields .fld-wide { flex: 2 1 200px; }
.pax-fields .fld-sm { flex: 0 1 120px; }
.pax-fields .fld .field { width: 100%; min-width: 0; max-width: none; }
.contact-fields .fld { flex: 1 1 180px; }
.contact-fields .fld-sm { flex: 0 1 130px; }
.pax-block legend .opt { font-style: normal; font-weight: 400; font-size: .75rem; color: var(--gray-500); }
@media (max-width: 640px) { .pax-fields .fld-wide { grid-column: 1 / -1; } }
.pax-fields, .contact-fields { align-items: flex-end; }
.contact-fields .fld .field { min-width: 0; width: 100%; }
.station-field label .req, .filter-field label .req, .check .opt { font-style: normal; font-weight: 400; text-transform: none; letter-spacing: 0; margin-left: 3px; }
.station-field label .req, .filter-field label .req { color: var(--orange-dark); }
.check .opt { color: var(--gray-500); font-size: .75rem; }

/* ── Language and theme ─────────────────────────────────────────────────── */
.nav-lang { color: var(--on-brand); flex: 0 0 auto; padding: 6px 10px; border: 1px solid rgba(255,255,255,.4); border-radius: 8px; font-size: .85rem; white-space: nowrap; }
.nav-lang:hover { text-decoration: none; background: rgba(255,255,255,.15); }
@media (max-width: 480px) { .nav-lang span { display: none; } }
.settings-page { text-align: left; max-width: 760px; }
.settings-page h2 { text-align: center; }
.settings-page fieldset { border: 0; margin: 16px 0; }
.settings-page legend { font-weight: 700; margin-bottom: 8px; }
.choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.choice b, .choice small { white-space: nowrap; }
.choice { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1.5px solid var(--gray-200); border-radius: 10px; background: var(--surface); cursor: pointer; }
.choice:has(input:checked) { border-color: var(--orange); background: var(--orange-light); }
.choice small { color: var(--gray-500); }
.swatch { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--gray-400); flex: 0 0 auto; }
.sw-system { background: linear-gradient(135deg, #fff 50%, #12141a 50%); }
.sw-light { background: linear-gradient(135deg, #fff 50%, #e8521a 50%); }
.sw-dark { background: linear-gradient(135deg, #1c1f26 50%, #f26a33 50%); }
.sw-indigo { background: linear-gradient(135deg, #fff 50%, #3949ab 50%); }
.sw-contrast { background: linear-gradient(135deg, #fff 50%, #000 50%); }
.sw-blue { background: linear-gradient(135deg, #fff 50%, #0b4da2 50%); }
.sw-terminal { background: linear-gradient(135deg, #0a0e0a 50%, #3dff74 50%); }

/* ── Our fee ─────────────────────────────────────────────────────────────── */
.fee-table { margin-top: 6px; font-size: .85rem; }
.fee-back { color: var(--ok-fg); font-weight: 600; }

/* ── Admin and agent desk ────────────────────────────────────────────────── */
.nav-staff { color: var(--on-brand); flex: 0 0 auto; padding: 6px 10px; border: 1px solid rgba(255,255,255,.4); border-radius: 8px; font-size: .85rem; font-weight: 600; white-space: nowrap; }
.admin-page { width: min(1100px, calc(100vw - 32px)); position: relative; left: 50%; transform: translateX(-50%); }
.admin-page .inline-form .btn-primary, .admin-page .inline-form .btn-secondary, .admin-form .btn-primary { width: auto; padding: 10px 18px; }
.admin-page h2 { margin: 12px 0 8px; }
.admin-page h3 { margin: 20px 0 8px; }
.admin-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.admin-tabs .tab { padding: 6px 12px; border: 1.5px solid var(--gray-200); border-radius: 999px; background: var(--surface); color: var(--gray-700); font-size: .9rem; }
.admin-tabs .tab.on { background: var(--fill, var(--orange)); border-color: var(--orange); color: var(--on-brand); }
.admin-tabs .tab:hover { text-decoration: none; border-color: var(--orange); }
.pnl-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin: 12px 0; }
.pnl-card { background: var(--surface); border: 1.5px solid var(--gray-200); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.pnl-card span { font-size: .8rem; color: var(--gray-500); }
.pnl-card small { font-size: .75rem; color: var(--gray-500); }
.pnl-card b { font-size: 1.3rem; }
.pos { color: var(--ok-fg); }
.neg { color: var(--bad-fg); }
.chart-box { background: var(--surface); border: 1.5px solid var(--gray-200); border-radius: var(--radius); padding: 10px; margin: 12px 0; }
.pnl-chart { width: 100%; height: auto; display: block; }
.ch-axis { stroke: var(--gray-400); stroke-width: 1; }
.ch-grid { stroke: var(--gray-200); stroke-width: 1; stroke-dasharray: 3 3; }
.ch-tick, .ch-label { fill: var(--gray-500); font-size: 10px; }
.ch-tick { text-anchor: end; }
.ch-label { text-anchor: middle; }
.ch-in { fill: var(--orange); }
.ch-out { fill: var(--gray-400); }
.ch-net { fill: none; stroke: var(--ok-fg); stroke-width: 2; }
.chart-box figcaption { font-size: .8rem; color: var(--gray-500); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.key { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.key-in { background: var(--orange); } .key-out { background: var(--gray-400); } .key-net { background: var(--ok-fg); height: 3px; }
.pnl-table { width: 100%; border-collapse: collapse; background: var(--surface); font-size: .9rem; }
.pnl-table th, .pnl-table td { padding: 8px 10px; border-bottom: 1px solid var(--gray-200); text-align: right; white-space: nowrap; }
.pnl-table th:first-child, .pnl-table td:first-child, .pnl-table.queries td, .pnl-table.queries th { text-align: left; }
.pnl-table thead th { color: var(--gray-500); font-weight: 600; font-size: .8rem; }
.pnl-table tfoot th, .pnl-table tfoot td { font-weight: 700; border-top: 2px solid var(--gray-400); }
.admin-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; background: var(--surface); padding: 12px; border-radius: var(--radius); border: 1.5px solid var(--gray-200); }
.admin-form .fld { flex: 1 1 180px; }
.admin-form .fld-wide { flex: 1 1 100%; }
.inline-form { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.btn-sm { padding: 4px 10px; font-size: .85rem; }
.btn-link { background: none; border: 0; color: var(--bad-fg); cursor: pointer; text-decoration: underline; }
.desk-search .field { min-width: 260px; }
.desk-new { margin: 16px 0; }
.desk-new summary { cursor: pointer; font-weight: 700; margin-bottom: 8px; }
.desk-actions { display: flex; gap: 8px; margin: 8px 0; }
.notes { list-style: none; padding: 0; display: grid; gap: 8px; }
.note { background: var(--surface); border: 1.5px solid var(--gray-200); border-radius: 10px; padding: 10px 12px; }
.note-customer { border-left: 4px solid var(--orange); }
.note-head { font-size: .8rem; color: var(--gray-500); margin-bottom: 4px; }
.help-page { text-align: left; max-width: 720px; }

/* ── The rolling promotions banner, next to "iPathik" ──────────────────── */
.promo-ticker { flex: 0 1 400px; min-width: 200px; height: 30px; overflow: hidden; position: relative; }
.promo-ticker ul { list-style: none; margin: 0; padding: 0; height: 100%; }
.promo-ticker li { position: absolute; inset: 0; display: flex; align-items: center; opacity: 0; transform: translateY(100%);
                   transition: opacity .45s, transform .45s; }
.promo-ticker li.on { opacity: 1; transform: none; }
.promo-ticker li.off { opacity: 0; transform: translateY(-100%); }
.promo-ticker li, .promo-ticker a { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.promo-ticker li > *, .promo-ticker li { font-weight: 800; font-size: .85rem; letter-spacing: .01em; }
.promo-ticker li { color: var(--orange-dark); }
.promo-ticker li::before { content: "★"; margin-right: 6px; }
.promo-ticker li, .promo-ticker li:not(:has(a)) { padding: 0 12px; }
.promo-ticker ul { background: #fff; border-radius: 999px; box-shadow: 0 1px 3px rgba(0,0,0,.25); max-width: 460px; position: relative; }
.promo-ticker a { color: inherit; text-decoration: none; display: flex; align-items: center; min-width: 0; }
.promo-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.promo-media { width: 24px; height: 24px; flex: none; object-fit: cover; border-radius: 6px; margin-right: 8px; background: rgba(0,0,0,.06); }
.promo-ticker li:has(.promo-media)::before { content: none; }
.promo-media-big { display: block; max-width: 160px; max-height: 160px; border-radius: 8px; margin-bottom: 6px; }
.promo-ticker a:hover { text-decoration: underline; }
:root[data-theme="dark"] .promo-ticker ul { background: #111; } :root[data-theme="dark"] .promo-ticker li { color: #ffb38a; }
@media (prefers-color-scheme: dark) { :root[data-theme="system"] .promo-ticker ul { background: #111; } :root[data-theme="system"] .promo-ticker li { color: #ffb38a; } }
:root[data-theme="contrast"] .promo-ticker ul { background: #000; } :root[data-theme="contrast"] .promo-ticker li { color: #fff; }
:root[data-theme="terminal"] .promo-ticker ul { background: #000; } :root[data-theme="terminal"] .promo-ticker li { color: #ffb000; }
@media (prefers-reduced-motion: reduce) { .promo-ticker li { transition: none; } }
@media (max-width: 640px) { nav { flex-wrap: wrap; } .promo-ticker { order: 9; flex-basis: 100%; } .promo-ticker ul { max-width: none; } }
.promo-preview { background: var(--fill, var(--orange)); padding: 10px; border-radius: var(--radius); display: flex; }

/* My trips (/trips): one card per booking, linking to its ticket */
.trips-page h3 { margin: 20px 0 8px; }
.trip-card { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; margin: 8px 0; border-radius: var(--radius);
             background: var(--surface); border: 1px solid var(--gray-200); color: var(--gray-900); box-shadow: var(--shadow); }
.trip-card:hover { text-decoration: none; border-color: var(--orange); }
.trip-top { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.trip-route { color: var(--gray-700); font-size: .9rem; }
.trip-meta { color: var(--gray-500); font-size: .8rem; }
.trip-status { margin-left: auto; font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 999px;
               background: var(--info-bg); color: var(--info-fg); }
.trip-status.st-confirmed { background: var(--ok-bg); color: var(--ok-fg); }
.trip-status.st-cancelled, .trip-status.st-expired { background: var(--bad-bg); color: var(--bad-fg); }
.trip-status.st-held { background: var(--warn-bg); color: var(--warn-fg); }
.trips-page .pnr-lookup { display: flex; gap: 8px; }
@media (max-width: 480px) { .nav-trips span { display: inline; } }   /* "My trips" stays spelled out on phones */
.cancel-who { border: 1px solid var(--gray-200); border-radius: 8px; padding: 8px 12px; margin: 8px 0; }
.cancel-who legend { font-weight: 700; padding: 0 4px; }
.cancel-who .check { display: flex; gap: 8px; align-items: center; margin: 4px 0; }
/* Sign-up captcha: our own picture, on white in every theme */
.captcha img { display: block; background: #fff; border-radius: 6px; margin: 4px 0 6px; }
/* Blue: the chosen Human/AI pill is white, so its radio dot is blue */
:root[data-theme="blue"] .mode-opt input[type="radio"] { accent-color: #0b4da2; }
/* Multi-city trips */
.trip-leg { border: 1px solid var(--gray-200); border-radius: 10px; padding: 10px 12px; margin: 10px 0; }
.trip-leg legend { font-weight: 700; padding: 0 6px; }
.trip-leg-buttons { display: flex; gap: 8px; margin: 6px 0 12px; }
.trip-link { margin: 10px 0 0; text-align: center; }
.trip-leg-results { margin: 18px 0; }
.trip-picks { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.trip-pick { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--gray-200); border-radius: 8px; padding: 4px 8px; cursor: pointer; }
.trip-pick.is-off { opacity: .5; cursor: not-allowed; }
.trip-return { margin-top: 24px; }
.trip-legs td, .trip-legs th { padding: 6px 8px; }
/* Every departure and arrival shows its day ("Fri 24 Oct"); an arrival on a later day is marked */
.time-block .day { display: block; font-size: .78rem; color: var(--gray-500); }
.time-block .day.next-day { color: var(--orange-dark); font-weight: 600; }
/* Booking form: optional fields look lighter; passport fields only for foreign nationals; ID digits only with an ID type */
.fld:has(i.opt) .fld-l { color: var(--gray-500); }
.fld:has(i.opt) .field { background: var(--gray-50); border-style: dashed; }
:root[data-theme="blue"] .fld:has(i.opt) .field { background: #e8eef8; }
.pax-block .foreign-only, .pax-block .id-only { display: none; }
.pax-block.is-foreign .foreign-only, .pax-block.has-id .id-only { display: flex; }
.pax-actions { display: flex; gap: 8px; margin: 4px 0 16px; }
.pax-actions [hidden] { display: none; }
/* narrow screens, stated last so it wins over the general .contact-fields .fld rule above */
@media (max-width: 640px) {
  .contact-fields .fld, .contact-fields .fld-sm { flex: 0 0 auto; width: 100%; }
}
/* Time-preference picker: a kind, its value and +, then one chip per preference set (✎ change, ✕ remove) */
.time-prefs { margin: 0 0 14px; }
.crit [hidden] { display: none !important; }
.crit-title { display: block; font-size: .78rem; font-weight: 700; color: var(--gray-600); margin-bottom: 6px; }
.crit-add { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.crit-add select, .crit-add input { padding: 9px 10px; border: 1.5px dashed var(--gray-200); border-radius: 8px;
              font-size: .9rem; background: var(--surface); color: var(--gray-900); min-width: 0; }
.crit-add .crit-kind { flex: 1 1 200px; color: var(--gray-500); }
.crit-add .crit-in { flex: 1 1 160px; border-style: solid; border-color: var(--orange-border); }
.crit-plus, .crit-edit, .crit-del { border: 0; border-radius: 50%; cursor: pointer; line-height: 1; }
.crit-plus { width: 38px; height: 38px; flex: 0 0 38px; font-size: 1.4rem; font-weight: 700; background: var(--fill, var(--orange)); color: var(--on-brand); }
.crit-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.crit-list:empty { display: none; }
.crit-chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 4px 4px 12px; border-radius: 999px;
              background: var(--orange-light); border: 1px solid var(--orange-border); color: var(--gray-900); font-size: .85rem; }
.crit-chip.editing { outline: 2px solid var(--orange); }
.crit-edit, .crit-del { width: 28px; height: 28px; background: transparent; color: var(--gray-600); font-size: .9rem; }
.crit-edit:hover, .crit-del:hover { background: var(--surface); color: var(--orange-dark); }
:root[data-theme="blue"] .crit-add select, :root[data-theme="blue"] .crit-add input { background: #fff; color: #111; }
:root[data-theme="blue"] .crit-chip { background: #fff; border-color: #fff; color: #111; }
.outside-header { margin-top: 18px; padding-top: 10px; border-top: 1px dashed var(--gray-200); color: var(--gray-500); }
:root[data-theme="blue"] .crit-edit, :root[data-theme="blue"] .crit-del { color: #333; }
/* Refine bar above the results: other time preferences or priority without going back to the form */
.refine-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end;
              margin: 0 0 14px; padding: 10px 12px; border: 1px solid var(--gray-200); border-radius: 10px; }
.refine-bar .crit { flex: 3 1 320px; min-width: 0; }
.refine-bar > label { flex: 1 1 160px; display: flex; flex-direction: column; gap: 3px; font-size: .7rem; font-weight: 700; color: var(--gray-500); min-width: 0; }
.refine-bar > label select { width: 100%; padding: 7px 8px; border: 1.5px solid var(--gray-200); border-radius: 7px;
              font-size: .85rem; background: var(--surface); }
:root[data-theme="blue"] .refine-bar > label select { background: #fff; color: #111; }
@media (max-width: 640px) { .refine-bar button[type=submit] { flex: 1 1 100%; } }
/* Children under 5: a count and "+ Add a child"; rows only for the children added, each with ✕ at its top right */
.pax-block.kids .kids-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pax-block.kids .kids-bar label { display: inline; margin: 0; font-weight: 700; font-size: .85rem; }
.pax-block.kids .kids-bar select.field { width: 76px; min-width: 0; flex: 0 0 76px; }
.pax-block.kids #add-kid[hidden] { display: none; }
.pax-block.kids fieldset.kid-row { position: relative; border: 0; border-top: 1px dashed var(--gray-200); border-radius: 0;
           padding: 12px 0 0; margin: 12px 0 0; min-width: 0; }
.pax-block.kids fieldset.kid-row[hidden] { display: none; }
.pax-block.kids .kid-del { position: absolute; top: 6px; right: 0; width: 30px; height: 30px; min-height: 0; padding: 0;
           border: 0; border-radius: 50%; cursor: pointer; background: var(--gray-100); color: var(--gray-600); font-size: .85rem; }
.pax-block.kids .kid-del:hover { color: var(--red); }
:root[data-theme="blue"] .pax-block.kids .kid-del { background: #fff; color: #333; }
/* Priority, then the return ticket on a line of its own: ticking it shows the date beside it, nothing else moves */
.prio-line { margin: 0 0 12px; max-width: 360px; }
.return-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 0 0 16px; }
.return-line .check { margin: 0; }
.return-line #return-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.return-line #return-row[hidden] { display: none; }
.return-line #return-date { width: auto; min-width: 170px; }
.return-line #ret-elsewhere { flex-basis: 100%; }
@media (max-width: 640px) { .prio-line { max-width: none; } .return-line #return-row, .return-line #return-date { width: 100%; } }
/* Required: a * after the label (the word stays for screen readers). Optional: unmarked (the field is grey and dashed).
   Conditions ("if ID proof chosen") stay as text. Each form says "* required" once. */
i.req { font-size: 0 !important; margin-left: 0 !important; }
i.req::after { content: "*"; font-size: .95rem; font-weight: 700; font-style: normal; color: var(--orange-dark); margin-left: 3px; }
:root[data-theme="blue"] i.req::after, :root[data-theme="terminal"] i.req::after { color: #ffe08a; }
i.opt { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
i.cond { font-style: normal; font-weight: 400; font-size: .72rem; margin-left: 3px; color: var(--gray-500); text-transform: none; letter-spacing: 0; }
.req-note { display: block; margin-top: 6px; }
.req-note[hidden] { display: none; }
/* Home: departure date, passengers, children under 5, class on one row (two per row on a phone) */
#search-form > .filters-row { grid-template-columns: 1.4fr 1fr 1fr 1.2fr; }
@media (max-width: 640px) { #search-form > .filters-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* the * never makes its label taller than its neighbours' */
i.req::after { line-height: 0; vertical-align: 0; }
/* Multi-city form: passengers and "the way back starts" share the row, each select full width */
.trip-form .filters-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.trip-form .filters-row select { width: 100%; min-width: 0; }
/* Multi-city passengers: the same box as the booking form's */
.trip-book fieldset.pax { border: 1.5px solid var(--gray-200); border-radius: var(--radius); padding: 10px 14px 12px; margin: 0 0 12px; min-width: 0; }
.trip-book fieldset.pax legend { padding: 0 6px; font-size: .8rem; font-weight: 700; }
:root[data-theme="blue"] .trip-book fieldset.pax { border-color: rgba(255,255,255,.35); }
/* "Time preferences" looks like every other field label; Priority as wide as the fields around it */
.time-prefs .crit-title { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--gray-400); margin-bottom: 4px; }
:root[data-theme="blue"] .time-prefs .crit-title { color: #d3e1f6; }
.prio-line { max-width: none; }
/* every control in the home row is the same height */
#search-form > .filters-row input, #search-form > .filters-row select { height: 42px; box-sizing: border-box; }
/* Passenger box: one tidy grid (name wide; age, gender; berth, meal, nationality, ID; the child checkbox on its own line).
   The two .pax-fields groups flow into the fieldset's grid, so no field sits alone on a ragged row. */
fieldset.pax-block[data-pax] { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 10px 10px; align-items: end; }
fieldset.pax-block[data-pax][hidden] { display: none; }
fieldset.pax-block[data-pax] > legend { grid-column: 1 / -1; }
fieldset.pax-block[data-pax] > .pax-fields { display: contents; }
fieldset.pax-block[data-pax] .fld { min-width: 0; }
fieldset.pax-block[data-pax] .chk { grid-column: 1 / -1; }
@media (max-width: 640px) {
  fieldset.pax-block[data-pax] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  fieldset.pax-block[data-pax] .fld-wide { grid-column: 1 / -1; }
}
/* A child's row: name, age, gender and ✕ in line on a wide screen; ✕ at the row's top right on a phone */
@media (min-width: 641px) {
  .pax-block.kids fieldset.kid-row { display: grid; grid-template-columns: 2fr 1fr 1fr auto; gap: 10px; align-items: end; }
  .pax-block.kids fieldset.kid-row[hidden] { display: none; }
  .pax-block.kids fieldset.kid-row > .pax-fields { display: contents; }
  .pax-block.kids .kid-del { position: static; align-self: end; margin-bottom: 6px; }
}
/* The booking form opens above the results: a clear break before the other trains */
#booking-panel:not(:empty) { margin-bottom: 28px; padding-bottom: 20px; border-bottom: 2px dashed var(--gray-200); }
/* Home on a phone: Class takes the full row rather than sitting alone at half width */
@media (max-width: 640px) { #search-form > .filters-row > :last-child { grid-column: 1 / -1; } }
/* the sticky "Hold seats" bar never covers the last field */
.book-form { padding-bottom: 24px; }
@media (max-width: 640px) { .trip-form .filters-row { grid-template-columns: minmax(0, 1fr); } }
.trip-form .btn-primary { margin-top: 12px; }
.trip-form + p { margin-top: 14px; }
/* Found by scripts/webui.sh: tap targets on a phone, the child's ✕ clear of its label, the train number readable */
.crit-edit, .crit-del { width: 36px; height: 36px; }
@media (max-width: 640px) {
  .pax-block.kids fieldset.kid-row { padding-top: 44px; }
  .pax-block.kids .kid-del { top: 8px; width: 36px; height: 36px; }
}
.train-num { color: var(--gray-500); }
:root[data-theme="blue"] .train-num { color: #d3e1f6; }
/* the nationality select shows "Foreign national" in full: three columns on a wide screen, its own row on a phone */
fieldset.pax-block[data-pax] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 640px) {
  fieldset.pax-block[data-pax] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  fieldset.pax-block[data-pax] .fld:has(.pax-nat), fieldset.pax-block[data-pax] .fld:has(.pax-idtype) { grid-column: 1 / -1; }
}
/* Search tabs: 👤 Human | ✨ AI, and under Human: One journey | Multi-city (the same on the home and multi-city pages) */
.mode-toggle a.mode-opt { text-decoration: none; }
.mode-opt.on { background: var(--fill, var(--orange)); color: var(--on-brand); }
.trip-kind { display: flex; gap: 6px; margin: -4px 0 16px; }
.trip-kind[hidden] { display: none; }
.kind-opt { padding: 6px 14px; border-radius: 8px; border: 1.5px solid var(--gray-200); font-size: .85rem; font-weight: 600;
            color: var(--gray-600); text-decoration: none; min-height: 34px; display: inline-flex; align-items: center; }
.kind-opt:hover { text-decoration: none; border-color: var(--orange); }
.kind-opt.on { border-color: var(--fill, var(--orange)); color: var(--ink, var(--orange)); background: var(--orange-light); }
:root[data-theme="blue"] .kind-opt { color: #fff; border-color: rgba(255,255,255,.55); }
:root[data-theme="blue"] .kind-opt.on { background: #fff; color: #0b4da2; border-color: #fff; }
:root[data-theme="blue"] .mode-opt.on { background: #fff; color: #0b4da2; }
/* the Human / AI tabs look the same on every page: no radio circles (still there for keyboards and screen readers) */
.mode-opt input[type="radio"] { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.mode-opt:focus-within { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
/* one row of three tabs: City | Multiple cities | ✨ AI (fits a 360px phone) */
.mode-toggle { display: flex; flex-wrap: nowrap; max-width: 100%; }
.mode-toggle .mode-opt { flex: 1 1 auto; justify-content: center; white-space: nowrap; padding: 7px 14px; }
@media (max-width: 400px) { .mode-toggle .mode-opt { padding: 7px 10px; font-size: .85rem; } }
/* Long labels (Malayalam, Tamil...): a label that wraps to two lines keeps its box level with its neighbours' */
.filters-row > .filter-field { display: flex; flex-direction: column; }
.filters-row > .filter-field > label { flex: 1 0 auto; }
/* the refine bar's priority box is as wide as its longest choice */
.refine-bar > label { flex: 1 1 auto; }
/* a crowded header wraps (the PNR box onto a second line) rather than squeezing the PNR box or the buttons */
nav { flex-wrap: wrap; row-gap: 8px; }
.pnr-form { min-width: 190px; }
/* the distance box keeps room for "50 km": a long "suggest nearby" label pushes it onto its own line instead */
.suggest-row .field-sm { min-width: 84px; }
/* the simulated payment page (payments mode "simulated"): a card, the amount large, two full-width choices */
.sim-pay { max-width: 440px; margin: 24px auto; text-align: center; display: flex; flex-direction: column; gap: 12px; }
.sim-pay h2 { font-size: 1.3rem; margin: 0; }
.sim-pay p { margin: 0; }
.sim-pay .sim-amount { font-size: 1.6rem; font-weight: 800; }
.sim-pay .hint { margin-bottom: 8px; }
.sim-pay form { margin: 0; }
.sim-pay form button, .sim-pay > a { width: 100%; padding-top: 13px; padding-bottom: 13px; }
