:root {
  --brand: #f59e0b; --bg: #f4f5f7; --card: #fff; --ink: #14181f; --muted: #667085; --line: #e4e7ec; --ok: #16a34a; --warn: #d97706; --bad: #dc2626; --blue: #2563eb;
  --top: 56px; --nav: 62px; --safe-b: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0e1117; --card: #171c25; --ink: #eef1f6; --muted: #98a2b3; --line: #262d3a; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overflow-x: hidden; }
#app { min-height: 100%; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h2 { font-size: 1.35rem; } h3 { font-size: 1.05rem; }
a { color: var(--blue); }
.muted { color: var(--muted); } .small { font-size: .85rem; } small { font-size: .82rem; color: var(--muted); }
.row { display: flex; gap: 8px; align-items: center; } .row.wrap { flex-wrap: wrap; } .row.between { justify-content: space-between; } .row.center { justify-content: center; margin-top: 14px; }
.sec { margin: 18px 0 8px; font-size: .95rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
ul.plain { list-style: none; margin: 8px 0; padding: 0; } ul.plain li { padding: 9px 0; border-bottom: 1px solid var(--line); }

/* shell */
header.top { position: fixed; z-index: 30; top: 0; left: 0; right: 0; height: var(--top); display: flex; align-items: center; gap: 4px; padding: 0 8px 0 12px; background: var(--brand); color: #1b1300; box-shadow: 0 1px 6px #0003; }
header.top .title { flex: 1; font-weight: 700; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { position: relative; min-width: 40px; height: 40px; border: 0; border-radius: 12px; background: transparent; color: inherit; font-size: 1.2rem; cursor: pointer; }
.icon-btn.lang { font-size: .8rem; font-weight: 700; }
.icon-btn i { position: absolute; top: 2px; right: 0; background: var(--bad); color: #fff; font: 700 .65rem/1 system-ui; border-radius: 10px; padding: 3px 5px; }
main#view { padding-top: var(--top); padding-bottom: calc(var(--nav) + var(--safe-b)); min-height: 100vh; }
nav#nav { position: fixed; z-index: 30; bottom: 0; left: 0; right: 0; height: calc(var(--nav) + var(--safe-b)); padding-bottom: var(--safe-b); display: flex; background: var(--card); border-top: 1px solid var(--line); }
nav#nav button { flex: 1; border: 0; background: none; color: var(--muted); font-size: .72rem; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; cursor: pointer; }
nav#nav button span { font-size: 1.35rem; } nav#nav button.on { color: var(--ink); font-weight: 700; box-shadow: inset 0 3px 0 var(--brand); }
.page { max-width: 760px; margin: 0 auto; padding: 14px 16px 24px; display: flex; flex-direction: column; gap: 12px; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.loading { text-align: center; padding: 40px; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 32px 12px; background: var(--card); border: 1px dashed var(--line); border-radius: 16px; }

/* controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 12px; padding: 11px 16px; background: var(--brand); color: #1b1300; font: 600 .95rem system-ui; cursor: pointer; text-decoration: none; min-height: 44px; }
.btn.small { padding: 7px 12px; min-height: 36px; font-size: .85rem; } .btn.big { min-height: 56px; font-size: 1.1rem; border-radius: 16px; } .btn.wide { width: 100%; }
.btn.ghost { background: transparent; border: 1.5px solid var(--line); color: var(--ink); } .btn.green, .btn.ok { background: var(--ok); color: #fff; } .btn.warn { background: var(--warn); color: #fff; } .btn.danger { background: var(--bad); color: #fff; } .btn.danger.ghost { background: transparent; color: var(--bad); border-color: var(--bad); }
.btn:disabled { opacity: .5; } .callbtn { display: inline-flex; gap: 6px; }
input, select, textarea { width: 100%; padding: 12px 13px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink); font: inherit; min-height: 46px; }
input[type=checkbox] { width: 20px; height: 20px; min-height: 0; } input[type=color] { padding: 3px; }
.form { display: flex; flex-direction: column; gap: 12px; } .field { display: flex; flex-direction: column; gap: 5px; } .field > span { font-weight: 600; font-size: .9rem; }
.chk { display: flex; align-items: center; gap: 8px; font-size: .92rem; }
.seg { display: flex; background: var(--line); border-radius: 12px; padding: 3px; gap: 3px; } .seg button { flex: 1; border: 0; background: transparent; padding: 10px 6px; border-radius: 10px; color: var(--ink); font: 600 .88rem system-ui; cursor: pointer; } .seg button.on { background: var(--card); box-shadow: 0 1px 4px #0002; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 14px; display: flex; flex-direction: column; gap: 10px; } .card.tap { cursor: pointer; }
.card-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.badge { display: inline-block; padding: 3px 9px; border-radius: 99px; background: var(--line); font-size: .75rem; font-weight: 700; white-space: nowrap; } .badge.ok { background: #16a34a22; color: var(--ok); } .badge.off { background: #dc262622; color: var(--bad); }
.tag { margin-left: 6px; padding: 2px 8px; border-radius: 99px; font-size: .72rem; background: #2563eb22; color: var(--blue); } .tag.warn { background: #d9770622; color: var(--warn); } .tag.ok { background: #16a34a22; color: var(--ok); }
.status { padding: 10px 12px; border-radius: 12px; background: var(--line); font-size: .95rem; } .status.ok { background: #16a34a1f; } .status.warn { background: #d977061f; } .status.now { background: var(--brand); color: #1b1300; font-weight: 700; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; } .stats div { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; } .stats b { font-size: 1.1rem; }
.notice { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px; margin-bottom: 8px; } .notice.new { border-left: 5px solid var(--brand); }
.menu-item { display: flex; justify-content: space-between; width: 100%; padding: 16px; margin-bottom: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; color: var(--ink); font: 600 1rem system-ui; cursor: pointer; }
.plans { display: grid; gap: 10px; } .plan { text-align: left; display: flex; flex-direction: column; gap: 3px; padding: 14px; border-radius: 16px; background: var(--card); border: 2px solid var(--line); color: var(--ink); font: inherit; cursor: pointer; } .plan.sel { border-color: var(--brand); box-shadow: 0 0 0 3px #f59e0b33; } .plan .price { font-size: 1.25rem; font-weight: 800; }
.alert { padding: 11px 12px; border-radius: 14px; background: #d977061f; border-left: 5px solid var(--warn); display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; } .alert.high { background: #dc26261f; border-color: var(--bad); } .alert.done { opacity: .6; }
.hint { font-size: .88rem; } .legend { display: flex; gap: 8px; align-items: center; font-size: .82rem; margin: 6px 0; } .dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; } .dot.g { background: #16a34a88; } .dot.b { background: var(--blue); }
.stoprow { display: grid; grid-template-columns: 22px 1fr 86px 86px 34px 34px; gap: 4px; align-items: center; margin-top: 6px; } .stoprow input { padding: 8px 6px; min-height: 38px; font-size: .85rem; } @media (max-width: 520px) { .stoprow { grid-template-columns: 20px 1fr 78px 78px 30px 30px; } }
.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; } .chip { padding: 5px 11px; border-radius: 99px; background: var(--card); border: 1px solid var(--line); font-size: .8rem; font-weight: 600; color: var(--ink); } .chip.ok { color: var(--ok); } .chip.bad { color: var(--bad); } .btn-chip { cursor: pointer; } .btn-chip.on { background: var(--brand); color: #1b1300; }

/* auth */
.auth { max-width: 420px; margin: 0 auto; padding: 40px 20px; display: flex; flex-direction: column; gap: 14px; text-align: center; } .auth .form { text-align: left; } .auth-logo { font-size: 3.2rem; }

/* sheet */
.sheet-back { position: fixed; inset: 0; z-index: 60; background: #0008; display: flex; align-items: flex-end; justify-content: center; opacity: 0; transition: opacity .2s; } .sheet-back.show { opacity: 1; }
.sheet { width: 100%; max-width: 640px; max-height: 88vh; background: var(--bg); border-radius: 22px 22px 0 0; display: flex; flex-direction: column; transform: translateY(30px); transition: transform .2s; padding-bottom: var(--safe-b); } .sheet-back.show .sheet { transform: none; } .sheet.tall { height: 88vh; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px 6px; } .sheet-body { padding: 8px 16px 20px; overflow-y: auto; }

/* maps */
.mapscreen { display: flex; flex-direction: column; height: calc(100vh - var(--top) - var(--nav) - var(--safe-b)); }
.map { flex: 1; min-height: 240px; width: 100%; z-index: 1; } .map.small { flex: none; height: 240px; border-radius: 14px; } .map.small.tall { height: 300px; }
.panel, .drv-panel, .admin-side { background: var(--bg); padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; border-radius: 20px 20px 0 0; margin-top: -18px; z-index: 5; box-shadow: 0 -4px 14px #0003; }
.mapscreen.drv .map, .mapscreen.admin .map { flex: 0 0 38%; } .drv-panel, .admin-side { flex: 1; overflow-y: auto; }
.panel-main b { font-size: 1.25rem; }
.mk { display: flex; align-items: center; justify-content: center; position: relative; font-size: 1.15rem; }
.mk.bus { width: 44px; height: 44px; border-radius: 50%; background: var(--brand); border: 3px solid #fff; box-shadow: 0 2px 8px #0006; font-size: 1.4rem; animation: pulse 2s infinite; } .mk.bus b { position: absolute; top: 44px; background: #14181f; color: #fff; font-size: .66rem; padding: 2px 6px; border-radius: 6px; white-space: nowrap; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 #f59e0b88; } 70% { box-shadow: 0 0 0 16px #f59e0b00; } 100% { box-shadow: 0 0 0 0 #f59e0b00; } }
.mk.school, .mk.house, .mk.pickup { width: 34px; height: 34px; border-radius: 50%; background: #fff; border: 2px solid #475467; box-shadow: 0 1px 5px #0005; } .mk.house { border-color: #0ea5e9; } .mk.pickup { border-color: #f97316; } .mk.house i { position: absolute; top: -6px; right: -6px; background: #0ea5e9; color: #fff; font: 700 .65rem system-ui; border-radius: 99px; padding: 2px 5px; }
.mk.stop { width: 28px; height: 28px; border-radius: 50%; background: #475467; color: #fff; font: 700 .8rem system-ui; border: 2px solid #fff; box-shadow: 0 1px 4px #0005; } .mk.stop.done { background: var(--ok); } .mk.stop.arrived { background: var(--brand); color: #000; } .mk.stop.skipped { background: #98a2b3; } .mk.stop.target { box-shadow: 0 0 0 5px #2563eb66; } .mk.stop.mine { background: #fff; font-size: 1rem; border-color: var(--brand); width: 34px; height: 34px; }
.mk.alertpin { width: 30px; height: 30px; border-radius: 50%; background: var(--bad); color: #fff; border: 2px solid #fff; }

/* driver */
.next { background: var(--card); border: 2px solid var(--brand); border-radius: 18px; padding: 12px 14px; } .next h2 { margin: 2px 0; }
.kids { display: flex; flex-direction: column; gap: 8px; } .kid { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; } .kid.gone { opacity: .55; } .kid.done { opacity: .7; } .kid-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.sticky { position: sticky; bottom: 0; background: var(--bg); padding: 6px 0; } .sticky .btn.big { flex: 1; }
ol.stops { list-style: none; margin: 8px 0 0; padding: 0; } ol.stops li { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 10px 4px; border-bottom: 1px solid var(--line); cursor: pointer; } ol.stops li.done { opacity: .5; } ol.stops li.target { background: #f59e0b22; border-radius: 8px; } ol.stops li small { grid-column: 1 / 3; } summary { font-weight: 600; cursor: pointer; }

/* calls */
.call-ov { position: fixed; inset: 0; z-index: 100; background: linear-gradient(#0f172aee, #020617f5); display: flex; align-items: center; justify-content: center; padding: 20px; color: #fff; }
.call-card { text-align: center; display: flex; flex-direction: column; gap: 22px; align-items: center; width: 100%; max-width: 360px; } .call-av { width: 110px; height: 110px; border-radius: 50%; background: var(--brand); color: #1b1300; font-size: 3rem; font-weight: 800; display: flex; align-items: center; justify-content: center; margin: 0 auto 12px; } .call-card small { color: #cbd5e1; font-size: 1rem; } .call-card p { color: #cbd5e1; margin: 4px 0 0; }
.call-btns { display: flex; gap: 34px; margin-top: 20px; } .round { width: 74px; height: 74px; border-radius: 50%; border: 0; color: #fff; font-size: 1.7rem; display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; } .round span { font-size: .68rem; margin-top: 2px; } .round.red { background: #dc2626; } .round.green { background: #16a34a; animation: pulse2 1.2s infinite; } .round.grey { background: #475467; } .round.grey.on { background: #fff; color: #000; }
@keyframes pulse2 { 0% { box-shadow: 0 0 0 0 #16a34a99; } 100% { box-shadow: 0 0 0 22px #16a34a00; } }

.toast { position: fixed; left: 50%; top: 66px; transform: translate(-50%, -20px); z-index: 90; background: #14181f; color: #fff; padding: 11px 16px; border-radius: 14px; max-width: 92vw; opacity: 0; transition: .25s; box-shadow: 0 6px 20px #0006; font-size: .92rem; } .toast.show { opacity: 1; transform: translate(-50%, 0); } .toast.bad { background: var(--bad); }
.leaflet-container { font: inherit; }
@media (min-width: 900px) { .mapscreen { flex-direction: row; } .mapscreen .map, .mapscreen.drv .map, .mapscreen.admin .map { flex: 1; } .panel, .drv-panel, .admin-side { width: 420px; flex: none; margin: 0; border-radius: 0; box-shadow: -4px 0 12px #0002; } nav#nav { max-width: 760px; left: 50%; transform: translateX(-50%); border-radius: 18px 18px 0 0; border: 1px solid var(--line); } }

.kinds { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; } .kind { display: flex; align-items: center; gap: 10px; padding: 14px 10px; border-radius: 14px; border: 2px solid var(--line); background: var(--card); color: var(--ink); font: 600 .95rem system-ui; text-align: left; cursor: pointer; } .kind span { font-size: 1.6rem; } .kind.sel { border-color: var(--bad); background: #dc262618; }
.photos { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; } .photos img { width: 92px; height: 92px; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); }
.btn.sos, .chip.sos { background: var(--bad); color: #fff; border-color: var(--bad); }
