:root {
  --bg: #f4f5f7; --panel: #fff; --ink: #111827; --mut: #6b7280; --line: #e5e7eb;
  --acc: #111827; --yel: #facc15;
  --move: #16a34a; --park: #2563eb; --lost: #d97706; --off: #9ca3af;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.45 -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
button { font: inherit; cursor: pointer; }
[hidden] { display: none !important; }

.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 17px; letter-spacing: -.01em; }
.logo { width: 30px; height: 30px; border-radius: 8px; background: var(--acc); color: var(--yel); display: inline-flex; align-items: center; justify-content: center; font-weight: 900; }

.login { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-box { width: min(360px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 26px 24px; display: grid; gap: 14px; box-shadow: 0 10px 30px rgba(17,24,39,.06); }
.login-box label { display: grid; gap: 5px; font-size: 13px; color: var(--mut); font-weight: 600; }
.login-box input { height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; font-size: 15px; color: var(--ink); }
.login-box button { height: 44px; border: 0; border-radius: 10px; background: var(--acc); color: #fff; font-weight: 700; font-size: 15px; }
.err { background: #fdecea; color: #b42318; border-radius: 8px; padding: 8px 11px; font-size: 13px; }

.app { height: 100%; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 14px; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; background: #fff; }
.chip i { width: 9px; height: 9px; border-radius: 50%; display: block; }
.chip b { font-size: 15px; }
.sp { flex: 1; }
.upd { color: var(--mut); font-size: 12.5px; }
.upd.bad { color: #b42318; font-weight: 600; }
.ghost { height: 34px; padding: 0 13px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.ghost:hover { border-color: #9ca3af; }

.main { flex: 1; min-height: 0; display: grid; grid-template-columns: 380px 1fr; }
.side { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: var(--panel); }
.mapwrap { min-height: 0; position: relative; }
#map { position: absolute; inset: 0; }

.filters { padding: 10px 12px; display: grid; gap: 8px; border-bottom: 1px solid var(--line); }
.filters input { height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 9px; font: inherit; }
.seg { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.seg button { height: 32px; border: 0; background: #fff; color: var(--mut); font-weight: 600; font-size: 13px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--acc); color: #fff; }

.list { overflow: auto; flex: 1; }
.row { display: grid; grid-template-columns: 12px 1fr auto; gap: 10px; align-items: center; padding: 10px 14px; border-bottom: 1px solid #f1f2f4; cursor: pointer; }
.row:hover { background: #f8f9fa; }
.row.sel { background: #fefce8; }
.dot { width: 11px; height: 11px; border-radius: 50%; }
.row .pl { font-weight: 700; font-size: 15px; letter-spacing: .02em; }
.row .ad { color: var(--mut); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }
.row .st { text-align: right; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.row .st small { display: block; color: var(--mut); font-weight: 400; }
.empty { padding: 26px 16px; color: var(--mut); text-align: center; }

.card { padding: 14px 14px 12px; border-bottom: 1px solid var(--line); background: #fffdf3; display: grid; gap: 8px; }
.card-h { display: flex; align-items: center; gap: 10px; }
.card-h .pl { font-size: 20px; font-weight: 800; letter-spacing: .02em; }
.card-h .x { margin-left: auto; width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: 16px; line-height: 1; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 700; color: #fff; }
.meta { color: var(--mut); font-size: 13px; }
.meta b { color: var(--ink); font-weight: 600; }
.day { display: flex; gap: 8px; align-items: center; }
.day input { height: 34px; padding: 0 9px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.sum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.sum div { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 7px 9px; }
.sum b { display: block; font-size: 17px; }
.sum span { font-size: 11.5px; color: var(--mut); }
.stops { font-size: 12.5px; color: var(--mut); max-height: 120px; overflow: auto; }
.stops div { padding: 2px 0; }
.note { font-size: 12px; color: var(--mut); }

.mk { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35); }
.mk.sel { width: 20px; height: 20px; box-shadow: 0 0 0 4px rgba(250,204,21,.6), 0 1px 4px rgba(0,0,0,.35); }

/* разделы */
.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.tabs button { height: 34px; padding: 0 12px; border: 0; border-radius: 8px; background: none; color: var(--mut); font-weight: 600; white-space: nowrap; }
.tabs button:hover { background: #f3f4f6; color: var(--ink); }
.tabs button.on { background: var(--acc); color: #fff; }
.badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: #dc2626; color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
.page { flex: 1; min-height: 0; overflow: auto; padding: 16px; }
.page h2 { margin: 0 0 4px; font-size: 19px; }
.page .lead { margin: 0 0 14px; color: var(--mut); }
.bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.bar input, .bar select, .f input, .f select, .f textarea { height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: #fff; color: var(--ink); }
.f textarea { height: 120px; padding: 8px 10px; width: 100%; }
.btn { height: 36px; padding: 0 14px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-weight: 600; }
.btn:hover { border-color: #9ca3af; }
.btn.pri { background: var(--acc); border-color: var(--acc); color: #fff; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.danger { color: #b42318; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin-bottom: 14px; }
.tile { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 11px 14px; }
.tile b { display: block; font-size: 22px; }
.tile span { color: var(--mut); font-size: 12.5px; }
.tw { overflow: auto; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.t th { position: sticky; top: 0; background: #f9fafb; text-align: left; font-size: 12px; color: var(--mut); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; cursor: default; }
table.t th.s { cursor: pointer; }
table.t td { padding: 8px 10px; border-bottom: 1px solid #f1f2f4; white-space: nowrap; }
table.t td.n, table.t th.n { text-align: right; font-variant-numeric: tabular-nums; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: #f8f9fa; }
.muted { color: var(--mut); }
.pos { color: #b42318; font-weight: 700; }
.neg { color: #15803d; font-weight: 700; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; background: #f3f4f6; }
.tag.red { background: #fdecea; color: #b42318; } .tag.green { background: #e7f6ec; color: #15803d; } .tag.amber { background: #fdf3e1; color: #92400e; } .tag.blue { background: #e8effd; color: #1d4ed8; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.box { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.box h3 { margin: 0 0 10px; font-size: 15px; }
.f { display: grid; gap: 4px; margin-bottom: 10px; font-size: 12.5px; color: var(--mut); font-weight: 600; }
.f input, .f select { width: 100%; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.note2 { background: #fdf3e1; color: #92400e; border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; font-size: 13px; }
.ok2 { background: #e7f6ec; color: #15803d; border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; font-size: 13px; }
.modal { position: fixed; inset: 0; background: rgba(17,24,39,.45); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 2000; }
.modal-box { background: #fff; border-radius: 14px; padding: 18px; width: min(520px, 100%); max-height: 90vh; overflow: auto; }
.modal-box h3 { margin: 0 0 12px; }
.acts { display: flex; gap: 8px; justify-content: flex-end; margin-top: 6px; }
.zonetool { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 1000; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; box-shadow: 0 4px 14px rgba(0,0,0,.12); display: flex; gap: 8px; align-items: center; font-size: 13px; }
@media (max-width: 820px) { .grid2, .row2 { grid-template-columns: 1fr; } .page { padding: 12px; } }

@media (max-width: 820px) {
  .main { grid-template-columns: 1fr; grid-template-rows: 45vh 1fr; }
  .mapwrap { grid-row: 1; }
  .side { grid-row: 2; border-right: 0; }
  .upd { display: none; }
  .row .ad { max-width: 52vw; }
}
