:root {
  --bg: #F6F5EF; --surface: #FFFFFF; --fg: #15140F; --muted: #5E5B4D; --line: #E2DFD0;
  --accent: #FFC20E; --accent-fg: #15140F; --accent-soft: #FFF2C2; --ink: #7A5700;
  --seat: #F2A900; --seat-off: #E2DFD0; --vwin: #FFFFFF;
  --ok: #1B7F4B; --ok-soft: #DCF2E5; --warn: #7A5000; --warn-soft: #FFEFC2; --bad: #B3261E; --bad-soft: #F9DEDC;
  --font-body: 'Noto Sans Tamil', 'Noto Sans Sinhala', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-num: 'Space Grotesk', 'Noto Sans Tamil', 'Noto Sans Sinhala', system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E0E0B; --surface: #191915; --fg: #F4F2E6; --muted: #A9A692; --line: #302F27;
    --accent: #FFC20E; --accent-fg: #15140F; --accent-soft: #3B3110; --ink: #FFC83A;
    --seat: #FFC20E; --seat-off: #302F27; --vwin: #191915;
    --ok: #5CD08F; --ok-soft: #123623; --warn: #FFC83A; --warn-soft: #3A2E0C; --bad: #F2877F; --bad-soft: #3D1816;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E0E0B; --surface: #191915; --fg: #F4F2E6; --muted: #A9A692; --line: #302F27;
  --accent: #FFC20E; --accent-fg: #15140F; --accent-soft: #3B3110; --ink: #FFC83A;
  --seat: #FFC20E; --seat-off: #302F27; --vwin: #191915;
  --ok: #5CD08F; --ok-soft: #123623; --warn: #FFC83A; --warn-soft: #3A2E0C; --bad: #F2877F; --bad-soft: #3D1816;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg); font-family: var(--font-body); font-size: 15px; line-height: 1.6;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
[hidden] { display: none !important; }
.wrap { max-width: 560px; margin: 0 auto; padding-block: calc(18px + env(safe-area-inset-top, 0px)) calc(100px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 16px; }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
a { color: var(--ink); }

.top { display: flex; align-items: center; gap: 12px; }
.mark { flex: none; width: 40px; height: 40px; border-radius: 12px; background: var(--accent); color: var(--accent-fg); display: grid; place-items: center; }
.brand { min-width: 0; }
.brand h1 { margin: 0; font-size: 21px; line-height: 1.25; font-weight: 700; text-wrap: balance; }
.brand p { margin: 0; font-size: 13px; color: var(--muted); }

.stack { display: flex; flex-direction: column; gap: 14px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.panel h2 { margin: 0; font-size: 16px; }
.row { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: end; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > label, .lbl { font-size: 12.5px; color: var(--muted); font-weight: 500; }
select, input[type=time], input[type=number], input[type=text], input[type=email], input[type=password], input[type=tel], input[type=search] {
  width: 100%; min-width: 0; font-size: 16px; padding: 10px; background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px; min-height: 44px;
}
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.check input { width: 22px; height: 22px; accent-color: var(--ink); }
.swap { width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); display: grid; place-items: center; }
.seg { display: flex; gap: 4px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 8px 10px; border-radius: 8px; font-weight: 500; min-height: 40px; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); }

.btn { border: 0; border-radius: 10px; padding: 10px 16px; min-height: 44px; font-weight: 600; background: var(--accent); color: var(--accent-fg); }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.bad { background: transparent; color: var(--bad); border: 1px solid var(--line); }
.btn.sm { min-height: 40px; padding: 8px 14px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.link { background: none; border: 0; padding: 6px 0; color: var(--muted); text-decoration: underline; font-size: 13px; }

.chip { display: inline-flex; align-items: center; font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--ink); white-space: nowrap; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.sect { margin: 4px 0 -4px; font-size: 13px; font-weight: 700; color: var(--muted); }

.ride { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px 14px; }
.time { display: flex; flex-direction: column; align-items: flex-start; min-width: 54px; }
.time .t { font-family: var(--font-num); font-weight: 700; font-size: 24px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.time .p { font-size: 12px; color: var(--muted); }
.route { font-weight: 700; font-size: 16px; line-height: 1.4; overflow-wrap: anywhere; }
.route .arr { color: var(--ink); }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 13px; color: var(--muted); margin-top: 2px; }
.foot { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; border-top: 1px dashed var(--line); padding-top: 10px; }
.seats { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.dots { display: flex; gap: 3px; }
.dots i { width: 9px; height: 14px; border-radius: 3px; background: var(--seat); }
.buy { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.fare { text-align: right; line-height: 1.2; }
.fare b { font-family: var(--font-num); font-size: 19px; font-variant-numeric: tabular-nums; }
.fare span { display: block; font-size: 11.5px; color: var(--muted); }

.empty { text-align: center; padding: 28px 16px; color: var(--muted); display: flex; flex-direction: column; gap: 12px; align-items: center; background: var(--surface); border: 1px dashed var(--line); border-radius: 14px; }
.sugg { background: var(--accent-soft); border-radius: 10px; padding: 10px 12px; font-size: 13.5px; }
.sugg b { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.err { color: var(--bad); font-size: 13.5px; }
.err:empty { display: none; }
.note { font-size: 12.5px; color: var(--muted); line-height: 1.6; margin: 0; }
.notice { font-size: 13.5px; background: var(--warn-soft); color: var(--warn); border-radius: 10px; padding: 10px 12px; }

.person { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.person .head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.person .nm { font-weight: 700; overflow-wrap: anywhere; }
.person .sub { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.acts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.stat b { display: block; font-family: var(--font-num); font-size: 22px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--muted); display: block; }
.ledger { display: flex; flex-direction: column; }
.ledger div { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.ledger div:first-child { border-top: 0; }
.ledger small { color: var(--muted); display: block; }
.ledger b { font-family: var(--font-num); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ledger b.pos { color: var(--ok); }
.ledger b.neg { color: var(--bad); }
.contact { background: var(--accent-soft); border-radius: 10px; padding: 8px 12px; font-size: 14px; }

.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--surface); border-top: 1px solid var(--line);
  padding: 6px max(8px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px)); }
.nav-in { max-width: 560px; margin: 0 auto; display: grid; gap: 4px; }
.nav button { border: 0; background: transparent; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; min-height: 52px; border-radius: 10px; font-size: 11.5px; font-weight: 500; line-height: 1.25; }
.nav button[aria-current="page"] { color: var(--ink); background: var(--accent-soft); font-weight: 700; }
.badge { position: relative; display: inline-flex; }
.badge em { position: absolute; top: -5px; right: -9px; background: var(--bad); color: #fff; font-style: normal; font-size: 10.5px; font-weight: 700; min-width: 17px; height: 17px; border-radius: 9px; display: grid; place-items: center; padding: 0 4px; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(76px + env(safe-area-inset-bottom, 0px)); z-index: 30; background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; max-width: calc(100% - 32px); box-shadow: 0 6px 20px rgba(0,0,0,.25); }
@media (prefers-reduced-motion: no-preference) { .toast { animation: rise .2s ease-out; } @keyframes rise { from { opacity: 0; transform: translate(-50%, 8px); } } }

/* ---------- பாதுகாப்பு மேம்பாடு: படங்கள், இலக்கத் தகடு, ஆவணங்கள் ---------- */
#banner:empty { display: none; }
.notice.bad { background: var(--bad-soft); color: var(--bad); }
.banner { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.banner span { min-width: 0; flex: 1 1 200px; }

.av { position: relative; flex: none; display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--accent-soft); color: var(--ink); font-weight: 700; font-size: 15px; overflow: hidden; }
.av.md { width: 48px; height: 48px; font-size: 19px; }
.av.lg { width: 84px; height: 84px; font-size: 32px; }
.av img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
img:not([src]) { visibility: hidden; }
img.failed { display: none; }
.who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.who > div { min-width: 0; }

.drv { display: flex; align-items: center; gap: 10px; margin-top: 8px; min-width: 0; }
.dtxt { min-width: 0; }
.dtxt .nm { font-weight: 700; overflow-wrap: anywhere; }
.rmain { min-width: 0; }

.plate { display: inline-block; font-family: var(--font-num); font-weight: 700; font-size: 13px; letter-spacing: .06em; border: 2px solid #1b1b1b; border-radius: 6px; padding: 0 8px; background: #fff; color: #111; white-space: nowrap; line-height: 1.5; }
.vehicle, .vehline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 14px; }
.vehicle { background: var(--accent-soft); border-radius: 10px; padding: 8px 12px; }
.vehline { color: var(--muted); }

.file { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.file:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }
label.btn { display: inline-flex; align-items: center; justify-content: center; width: fit-content; }

.docs-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.doc { border: 1px solid var(--line); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 8px; min-width: 0; position: relative; }
.dh { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.dn { font-size: 13.5px; font-weight: 600; overflow-wrap: anywhere; }
.thumb { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); cursor: zoom-in; background: var(--bg); }
.docs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.dthumb { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.dl { font-size: 12px; color: var(--muted); }
.miss { aspect-ratio: 4 / 3; display: grid; place-items: center; border: 1px dashed var(--bad); color: var(--bad); border-radius: 8px; font-size: 12px; }

#lightbox { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .88); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 16px; }
#lightbox img { max-width: 100%; max-height: 80vh; object-fit: contain; border-radius: 8px; visibility: visible; }

.sos { border-color: var(--bad); }
.flat { display: flex; flex-direction: column; gap: 10px; border-top: 1px dashed var(--line); padding-top: 10px; }
textarea { width: 100%; min-width: 0; min-height: 80px; font: inherit; font-size: 16px; color: inherit; padding: 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; resize: vertical; }
.amt { max-width: 150px; }
.acts input[type=text] { flex: 1 1 140px; width: auto; }
.stats { grid-template-columns: repeat(2, 1fr); }
.doc .thumb { max-height: 170px; }
.miss.opt { border-color: var(--line); color: var(--muted); }
a.btn { text-decoration: none; }

/* ---------- வாகன ஐகான் தேர்வு ---------- */
.vpick { display: grid; grid-template-columns: repeat(auto-fit, minmax(72px, 1fr)); gap: 8px; }
.vopt { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 10px 6px; min-height: 78px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--muted); font-size: 12.5px; font-weight: 600; line-height: 1.3; text-align: center; }
.vopt[aria-checked="true"] { border-color: var(--ink); background: var(--accent-soft); color: var(--ink); }
.vico { width: 46px; height: 30px; flex: none; }
.vico.sm { width: 28px; height: 18px; vertical-align: middle; margin-right: 6px; }
.vl { display: inline-flex; align-items: center; }
.vdisp { --vwin: var(--bg); display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); font-weight: 600; }
.vdisp .vico { width: 34px; height: 22px; }


/* ---------- மேல் பட்டி: மொழி, theme, அறிவிப்பு ---------- */
.top { flex-wrap: nowrap; }
.tools { margin-left: auto; display: flex; align-items: center; gap: 6px; flex: none; }
.langs { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.langs button { border: 0; background: transparent; min-width: 36px; min-height: 40px; padding: 0 8px; font-size: 13px; font-weight: 700; color: var(--muted); }
.langs button[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); }
.tbtn { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--fg); padding: 0; }
.sh-head .tbtn, .bank .tbtn { border-color: transparent; background: transparent; }
.mark { color: var(--accent-fg); }
@media (max-width: 380px) { .brand p { display: none; } .tools { gap: 4px; } .langs button { min-width: 32px; padding: 0 6px; } }

/* ---------- இடத் தேர்வு ---------- */
.pbtn { width: 100%; min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 8px; text-align: left; padding: 8px 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; color: var(--muted); }
.pbtn.set { color: var(--fg); font-weight: 600; background: var(--surface); border-color: var(--accent); }
.pbtn .pl { display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; line-height: 1.3; }
.pbtn small, .route small.sub, .sub small { font-size: 11.5px; font-weight: 400; color: var(--muted); }
.quick { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.quick::-webkit-scrollbar { display: none; }
.qchip { flex: none; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 600; min-height: 36px; color: var(--fg); white-space: nowrap; }
.km { font-size: 12.5px; color: var(--muted); }
body.noscroll { overflow: hidden; }
#sheet { position: fixed; inset: 0; z-index: 40; display: flex; flex-direction: column; justify-content: flex-end; }
.sheet-bg { position: absolute; inset: 0; background: rgba(0, 0, 0, .5); }
.sheet { position: relative; max-width: 560px; width: 100%; margin: 0 auto; max-height: 82vh; display: flex; flex-direction: column; background: var(--surface); border-radius: 18px 18px 0 0; padding-bottom: env(safe-area-inset-bottom, 0px); }
.sh-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.sh-head h3 { margin: 0; flex: 1; text-align: center; font-size: 16px; }
.sh-head .sp { width: 40px; }
.sh-list { overflow-y: auto; padding: 8px 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.opt { text-align: left; min-height: 48px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); font-weight: 600; color: var(--fg); }
.opt.any { background: var(--accent-soft); border-color: var(--accent); }
.pickother { display: flex; gap: 8px; margin-top: 6px; }
.pickother input { flex: 1; }

/* ---------- வங்கி விவரங்கள் ---------- */
.banks { display: flex; flex-direction: column; gap: 8px; }
.bank { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.blogo { flex: none; width: 46px; height: 46px; border-radius: 12px; background: var(--accent); color: var(--accent-fg); display: grid; place-items: center; font-weight: 800; font-size: 13px; letter-spacing: .03em; overflow: hidden; }
.blogo img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.bt { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.bt span { font-size: 13px; color: var(--muted); }
.bt code { font-size: 16px; font-weight: 700; letter-spacing: .04em; user-select: all; font-family: var(--font-num); overflow-wrap: anywhere; }
.btn.wa { background: #25D366; color: #06210F; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; }
.btn.ghost.wa { background: transparent; color: var(--fg); border: 1px solid var(--line); }
.waic { flex: none; }

/* ---------- மதிப்பீடு, அறிவிப்பு, சட்டப் பக்கம் ---------- */
.rate { font-size: 12.5px; font-weight: 700; color: var(--ink); }
.rate small { font-weight: 400; color: var(--muted); }
.rate.none { color: var(--muted); font-weight: 500; }
.stars-ro { color: var(--seat); letter-spacing: 2px; }
.rate-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13.5px; }
.stars { display: inline-flex; gap: 2px; }
.star { border: 0; background: transparent; font-size: 28px; line-height: 1; padding: 2px 4px; min-width: 40px; min-height: 40px; color: var(--seat); }
.nlist { display: flex; flex-direction: column; }
.nitem { padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; }
.nitem:first-child { border-top: 0; }
.nitem small { display: block; color: var(--muted); margin-top: 2px; }
.nitem.unread { border-left: 3px solid var(--accent); padding-left: 10px; }
.doc-text { font-size: 14px; line-height: 1.75; }
.doc-text h3 { font-size: 15px; margin: 16px 0 4px; }
.doc-text p, .doc-text ul { margin: 6px 0; }
.doc-text ul { padding-left: 20px; }
.doc-text .stamp { font-size: 12.5px; color: var(--muted); }
.link.inl { display: inline; padding: 0; font-size: inherit; color: var(--ink); }
.legal-links { display: inline-flex; flex-wrap: wrap; gap: 4px 6px; }
.trip { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.trip:first-child { border-top: 0; }
.trip > span { min-width: 0; display: block; }
.trip small { display: block; color: var(--muted); }
.trip .acts { margin-top: 6px; }
.person .sub .rate { font-size: 12px; }
