:root {
  --blue: #0038a8; --red: #ce1126; --yellow: #fcd116;
  --bg: #f4f6fb; --card: #ffffff; --text: #1a1f2e; --muted: #5b6475; --line: #e3e7ef;
  --green: #12805c; --radius: 16px;
}
body.dark {
  --bg: #0f131c; --card: #1a2030; --text: #eef1f7; --muted: #9aa3b5; --line: #2b3346;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text);
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }

.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  background: var(--blue); color: #fff;
}
.brand { display: flex; gap: 10px; align-items: center; }
.logo { width: 40px; height: 40px; border-radius: 10px; background: #fff; }
.top h1 { font-size: 19px; margin: 0; letter-spacing: .2px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.badge-pill { font-size: 10px; background: var(--yellow); color: #0f131c; padding: 2px 7px; border-radius: 999px; font-weight: 800; }
.tagline { margin: 2px 0 0; font-size: 12px; opacity: .9; }
.top-actions { display: flex; align-items: center; gap: 6px; }
.lang-pills { display: flex; background: rgba(255,255,255,.15); border-radius: 10px; padding: 2px; gap: 2px; }
.lang-pills button { border: 0; background: transparent; color: #fff; font-size: 11px; font-weight: 700; padding: 5px 7px; border-radius: 8px; cursor: pointer; }
.lang-pills button.on { background: var(--yellow); color: #0f131c; }
.icon-btn { background: rgba(255,255,255,.15); border: 0; color: #fff; width: 38px; height: 38px; border-radius: 12px; font-size: 19px; cursor: pointer; }

.region-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; padding: 12px 16px 0; max-width: 680px; margin: 0 auto; }
.matrix-bar { padding: 8px 16px 0; max-width: 680px; margin: 0 auto; }
main { padding: 12px 16px; max-width: 680px; margin: 0 auto; }

.card { background: var(--card); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.card h2 { font-size: 17px; margin: 0 0 6px; }
.label { font-size: 12px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); margin: 4px 0 8px; }

.seg { display: flex; background: var(--line); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 8px 8px; border-radius: 10px; font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap; }
.seg button.on { background: var(--card); color: var(--blue); box-shadow: 0 1px 2px rgba(0,0,0,.12); }
body.dark .seg button.on { color: #8fb0ff; }
.rider button.on { background: var(--red); color: #fff; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 8px; scrollbar-width: none; }
.chips button { flex: none; border: 1.5px solid var(--line); background: transparent; padding: 8px 14px; border-radius: 999px; font-weight: 600; cursor: pointer; font-size: 14px; }
.chips button.on { background: var(--blue); border-color: var(--blue); color: #fff; }
.chips.small button { padding: 6px 12px; font-size: 13px; }
.chips.small button.on { background: rgba(0,56,168,.1); color: var(--blue); border-color: var(--blue); }
body.dark .chips.small button.on { color: #8fb0ff; border-color: #8fb0ff; }

.map { height: 240px; border-radius: 12px; overflow: hidden; background: var(--line); margin-bottom: 8px; }
.map.off { height: auto; padding: 14px; font-size: 14px; color: var(--muted); }
.hint { font-size: 13px; color: var(--muted); margin: 6px 0; }
.note { font-size: 13px; color: var(--muted); background: var(--bg); border-radius: 10px; padding: 8px 10px; margin: 8px 0; }
.note:empty { display: none; }

.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 120px; }
.field { display: block; margin: 8px 0; }
.field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--bg); font-size: 15px;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--blue); }

.btn { display: block; width: 100%; border: 0; background: var(--blue); color: #fff; padding: 12px; border-radius: 12px; font-weight: 700; font-size: 15px; cursor: pointer; margin-top: 10px; text-align: center; text-decoration: none; }
.btn.ghost { background: transparent; color: var(--blue); border: 1.5px solid var(--blue); }
.btn.driver-btn { background: #111827; color: var(--yellow); border: 2px solid var(--yellow); font-size: 16px; }
.btn.big { padding: 18px; font-size: 18px; background: var(--green); }
.btn.big.stop { background: var(--red); }
.link-btn { border: 0; background: none; color: var(--blue); font-weight: 600; padding: 6px 0; cursor: pointer; font-size: 14px; }
.link-btn.danger { color: var(--red); }
body.dark .link-btn, body.dark .btn.ghost { color: #8fb0ff; border-color: #8fb0ff; }

.fare-card { border-top: 5px solid var(--yellow); }
.fare-big { font-size: 46px; font-weight: 800; letter-spacing: -1px; line-height: 1.1; }
.fare-sub { font-size: 15px; color: var(--muted); margin: 4px 0; }
.fare-sub b { color: var(--text); }
details { margin-top: 8px; font-size: 14px; }
summary { color: var(--blue); font-weight: 600; cursor: pointer; }

.sukli-box { margin-top: 12px; padding: 12px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); }
.bill-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 8px; }
.bill-chips button { border: 1px solid var(--line); background: var(--card); border-radius: 8px; padding: 5px 10px; font-weight: 700; font-size: 13px; cursor: pointer; }
.bill-chips button:hover, .bill-chips button.on { background: var(--blue); color: #fff; border-color: var(--blue); }
.sukli-result { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); font-size: 14px; }
.sukli-result b { font-size: 18px; color: var(--green); display: block; }
.sukli-result b.short { color: var(--red); }

.ecosystem-card {
  background: linear-gradient(135deg, #0b132b 0%, #1e3a8a 100%);
  color: #fff; border-radius: var(--radius); padding: 14px 16px; margin-bottom: 16px;
  border: 1px solid rgba(252,209,22,.35);
}
.ecosystem-card h3 { margin: 0 0 4px; font-size: 14px; color: var(--yellow); letter-spacing: .3px; }
.ecosystem-card p { margin: 0 0 10px; font-size: 12.5px; color: #e2e8f0; line-height: 1.4; }
.ecosystem-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; }
.eco-link {
  display: block; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.2);
  border-radius: 10px; padding: 9px 11px; color: #fff; text-decoration: none; font-size: 12.5px; transition: background .2s;
}
.eco-link:hover { background: rgba(255,255,255,.18); }
.eco-link strong { display: block; color: var(--yellow); font-size: 13px; margin-bottom: 2px; }

.meter { text-align: center; }
.meter .fare-big { font-size: 60px; }
.stats { display: flex; gap: 10px; margin: 12px 0; flex-wrap: wrap; }
.stats div { flex: 1; min-width: 110px; background: var(--bg); border-radius: 12px; padding: 10px; text-align: center; }
.stats span { display: block; font-size: 12px; color: var(--muted); }
.stats b { font-size: 20px; }
.over { font-weight: 700; color: var(--red); }

.bar { height: 10px; border-radius: 99px; background: var(--line); overflow: hidden; }
.bar div { height: 100%; width: 0; background: var(--green); transition: width .3s; }
.bar div.warn { background: var(--red); }

.trips { list-style: none; padding: 0; margin: 0; }
.trips li { display: flex; justify-content: space-between; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.trips li small { color: var(--muted); display: block; }
.trips .amt { font-weight: 700; text-align: right; white-space: nowrap; }
.trips .del { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 16px; }

pre { white-space: pre-wrap; background: var(--bg); padding: 12px; border-radius: 10px; font-size: 13px; font-family: inherit; }
.contact { font-size: 15px; line-height: 1.7; }

.printable h3 { margin: 0; font-size: 20px; }
.printable table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 15px; }
.printable th, .printable td { border: 1px solid var(--line); padding: 5px 8px; text-align: center; }
.printable th { background: var(--blue); color: #fff; }
.printable tr:nth-child(even) td { background: var(--bg); }
.printable .foot { font-size: 11px; color: var(--muted); margin-top: 8px; }
.cols { display: grid; grid-template-columns: 1fr; gap: 0 12px; align-items: start; }
@media (min-width: 560px) { .cols { grid-template-columns: 1fr 1fr; } }
@media print { .cols { grid-template-columns: 1fr 1fr; } }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; display: flex;
  background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom); z-index: 2147483647 !important;
}
.tabs button { flex: 1; border: 0; background: none; padding: 8px 2px 10px; cursor: pointer; color: var(--muted); }
.tabs span { display: block; font-size: 20px; }
.tabs b { font-size: 11px; font-weight: 600; }
.tabs button.on { color: var(--blue); }
.tabs button.on b { font-weight: 800; }

dialog { border: 0; border-radius: var(--radius); padding: 20px; width: min(92vw, 420px); background: var(--card); color: var(--text); }
dialog::backdrop { background: rgba(0,0,0,.55); }

#driverModal {
  width: min(96vw, 480px); background: #0b132b; color: #ffffff;
  border: 4px solid var(--yellow); text-align: center; padding: 24px 18px;
}
#driverModal .driver-badge { display: inline-block; background: var(--yellow); color: #0b132b; font-weight: 800; font-size: 12px; padding: 4px 10px; border-radius: 999px; text-transform: uppercase; letter-spacing: .8px; }
#driverModal .driver-amount { font-size: 64px; font-weight: 900; color: var(--yellow); line-height: 1.05; margin: 12px 0 6px; }
#driverModal .driver-meta { font-size: 16px; color: #e2e8f0; margin: 6px 0; }
#driverModal .driver-sukli { background: rgba(255,255,255,.1); border-radius: 12px; padding: 10px; margin: 12px 0; font-size: 18px; font-weight: 700; color: #4ade80; }
#driverModal .driver-law { font-size: 12px; color: #cbd5e1; margin-top: 10px; line-height: 1.4; }

@media print {
  body { padding: 0; background: #fff; color: #000; }
  .top, .region-bar, .matrix-bar, .tabs, .no-print, .ecosystem-card, .view:not(#view-card) { display: none !important; }
  .card { box-shadow: none; padding: 0; }
  .printable th { background: #ddd; color: #000; }
}

.search { position: relative; display: grid; gap: 8px; margin-bottom: 8px; }
.sfield { position: relative; display: flex; align-items: center; gap: 8px; background: var(--bg); border: 1.5px solid var(--line); border-radius: 12px; padding: 0 6px 0 12px; }
.sfield:focus-within { border-color: var(--blue); }
.sfield input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 12px 0; font-size: 15px; outline: none; }
.dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.dot.green { background: var(--green); } .dot.red { background: var(--red); }
.mini { border: 0; background: none; font-size: 18px; color: var(--muted); width: 36px; height: 36px; border-radius: 10px; cursor: pointer; flex: none; }
.mini:hover { background: var(--line); }
.sugg { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 1100; list-style: none; margin: 0; padding: 0;
  background: var(--card); border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.18); overflow: hidden; }
.sugg li { padding: 10px 14px; border-bottom: 1px solid var(--line); cursor: pointer; font-size: 15px; }
.sugg li:hover { background: var(--bg); }
.sugg li small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.sugg li.none { color: var(--muted); cursor: default; }
.summary { font-weight: 700; font-size: 15px; margin: 4px 0 8px; }
.summary:empty { display: none; }
.manual { margin-top: 6px; }

#nl-badge-frame, iframe[id^="nl-"] {
  display: none !important;
  pointer-events: none !important;
}
