:root {
  --bg: #f6f8fb;
  --card: #ffffff;
  --text: #17202b;
  --muted: #5d6b7c;
  --line: #dfe5ee;
  --brand: #1f5fa8;
  --brand-ink: #ffffff;
  --brand-soft: #e6effa;
  --ok: #1d7a46;
  --ok-soft: #e3f4ea;
  --warn: #9a5b00;
  --warn-soft: #fff3dc;
  --bad: #b3261e;
  --bad-soft: #fde8e7;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141b;
    --card: #18202a;
    --text: #e8edf3;
    --muted: #9aa8b8;
    --line: #2a3542;
    --brand: #5d9be0;
    --brand-ink: #0b1220;
    --brand-soft: #1b2d44;
    --ok: #5ccf8b;
    --ok-soft: #173326;
    --warn: #f0b45a;
    --warn-soft: #3a2b13;
    --bad: #ff8a80;
    --bad-soft: #3d1c1a;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Kannada", sans-serif;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 1.4rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: 1rem; }
p { margin: .25rem 0 .75rem; }
a { color: var(--brand); }

.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 650; }
.net { font-size: .8rem; background: var(--warn-soft); color: var(--warn); padding: 2px 8px; border-radius: 99px; }

main { max-width: 640px; margin: 0 auto; padding: 16px; }
main.center, .center { text-align: center; }
main.center { max-width: 420px; padding-top: 15vh; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 12px; box-shadow: var(--shadow);
}
.card.soft { background: var(--brand-soft); border-color: transparent; }
.card.ok { background: var(--ok-soft); border-color: transparent; }
.card.warn { background: var(--warn-soft); border-color: transparent; }
.card.bad { background: var(--bad-soft); border-color: transparent; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.row.wrap { flex-wrap: wrap; }
.stack > * + * { margin-top: 8px; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.big-num { font-size: 2rem; font-weight: 700; letter-spacing: -.01em; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 10px 0; border-top: 1px solid var(--line); }
.list > li:first-child { border-top: 0; }
.pill {
  display: inline-block; font-size: .75rem; font-weight: 600; padding: 2px 8px; border-radius: 99px;
  background: var(--brand-soft); color: var(--brand); white-space: nowrap;
}
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.grey { background: var(--line); color: var(--muted); }
.plus { color: var(--ok); }
.minus { color: var(--text); }

button, .btn {
  font: inherit; font-weight: 600; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); padding: 9px 14px; cursor: pointer;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 42px;
}
button:disabled { opacity: .5; cursor: default; }
button.primary, .btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
button.okb { background: var(--ok); color: #fff; border-color: var(--ok); }
button.danger { color: var(--bad); }
button.link { background: none; border: 0; color: var(--brand); padding: 4px; min-height: 0; }
button.link.danger { color: var(--bad); }
button.big, .btn.big { width: 100%; padding: 14px; font-size: 1.05rem; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; }
.btns > * { flex: 1; }

label { display: block; font-size: .875rem; color: var(--muted); margin: 10px 0 4px; }
input, select, textarea {
  font: inherit; width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); color: var(--text);
}
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
input[type=checkbox] { width: auto; }
.switch { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 1rem; margin: 0; }
.switch input { width: 22px; height: 22px; }

.stepper { display: flex; align-items: center; gap: 6px; }
.stepper button { width: 42px; padding: 0; font-size: 1.25rem; }
.stepper output { min-width: 28px; text-align: center; font-weight: 700; font-size: 1.1rem; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; scrollbar-width: none; }
.chip {
  flex: none; border-radius: 12px; padding: 6px 12px; border: 1px solid var(--line); background: var(--card);
  text-align: center; min-width: 64px; line-height: 1.2; font-weight: 500;
  color: var(--text); text-decoration: none;
}
.chip b { display: block; font-size: 1.05rem; }
.chip.on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.chip .dot { display: block; width: 6px; height: 6px; border-radius: 3px; margin: 3px auto 0; background: currentColor; opacity: .7; }

.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 5; display: flex;
  background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.tabs a {
  flex: 1; text-align: center; padding: 8px 2px 10px; font-size: .75rem; color: var(--muted); text-decoration: none;
  position: relative;
}
.tabs a .ic { display: block; font-size: 1.3rem; line-height: 1.4; }
.tabs a.on { color: var(--brand); font-weight: 650; }
.badge {
  position: absolute; top: 4px; left: calc(50% + 6px); background: var(--bad); color: #fff; font-size: .7rem;
  border-radius: 99px; padding: 0 6px; font-weight: 700;
}

.toast {
  position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; z-index: 20;
  max-width: calc(100% - 32px); box-shadow: var(--shadow);
}
.toast.err { background: var(--bad); color: #fff; }

dialog {
  border: 0; border-radius: var(--radius); padding: 18px; width: min(440px, calc(100% - 32px));
  background: var(--card); color: var(--text);
}
dialog::backdrop { background: rgba(0, 0, 0, .45); }

.route-item.done { opacity: .65; }
.route-item .lines { margin: 4px 0 0; }
.qr { display: block; width: 220px; max-width: 70vw; margin: 8px auto; background: #fff; border-radius: 8px; padding: 6px; }
table { width: 100%; border-collapse: collapse; }
td, th { padding: 6px 4px; border-top: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: .875rem; border-top: 0; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 18px 0 8px; }
.section-title h2 { margin: 0; }
.empty { padding: 16px; text-align: center; color: var(--muted); }
details summary { cursor: pointer; color: var(--brand); font-weight: 600; padding: 4px 0; }

main.narrow { max-width: 460px; }
.creds .cred {
  font: 700 1.45rem/1.3 ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .02em;
  margin: 2px 0 10px; word-break: break-all; user-select: all;
}
ol.steps { margin: 0; padding-left: 1.2rem; }
ol.steps li { margin: 6px 0; }
details.manual { margin: 10px 0 4px; }
details.manual .cred { font: 700 1rem ui-monospace, "SF Mono", Menlo, Consolas, monospace; user-select: all; word-break: break-all; }
.upi-apps > .btn { flex: 1 1 40%; text-align: center; }
