:root {
  --bg: #f4f6f5; --card: #ffffff; --ink: #11201d; --ink2: #4b5b57; --mute: #7d8b88; --line: #e1e7e5;
  --acc: #0e7a6b; --acc-ink: #ffffff; --acc-soft: #e2f3ef; --bike: #f26a1b; --ok: #1d8a4e; --warn: #b7791f; --bad: #c43d3d;
  --ok-soft: #e3f4ea; --warn-soft: #fbf0dc; --bad-soft: #fbe6e6; --mute-soft: #eef1f0;
  --r: 14px; --sh: 0 1px 2px rgba(16, 32, 29, .06), 0 4px 16px rgba(16, 32, 29, .06);
  --f: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1513; --card: #15201d; --ink: #e8f0ee; --ink2: #a9bab5; --mute: #7b8d88; --line: #24332f;
    --acc: #4fd1b8; --acc-ink: #06211b; --acc-soft: #133b33; --bike: #ff8a3d; --ok: #4cc983; --warn: #e6b04f; --bad: #f07272;
    --ok-soft: #143524; --warn-soft: #3a2e14; --bad-soft: #3d1a1a; --mute-soft: #1d2a27; --sh: 0 1px 2px rgba(0, 0, 0, .4); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1513; --card: #15201d; --ink: #e8f0ee; --ink2: #a9bab5; --mute: #7b8d88; --line: #24332f;
  --acc: #4fd1b8; --acc-ink: #06211b; --acc-soft: #133b33; --bike: #ff8a3d; --ok: #4cc983; --warn: #e6b04f; --bad: #f07272;
  --ok-soft: #143524; --warn-soft: #3a2e14; --bad-soft: #3d1a1a; --mute-soft: #1d2a27; --sh: 0 1px 2px rgba(0, 0, 0, .4); color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--f); -webkit-font-smoothing: antialiased; }
a { color: var(--acc); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; letter-spacing: -.01em; }
h1 { font-size: clamp(26px, 5vw, 40px); font-weight: 800; }
h2 { font-size: 20px; font-weight: 750; }
h3 { font-size: 16px; font-weight: 700; }
p { margin: 0 0 .8em; }
.muted { color: var(--ink2); } .small { font-size: 13px; } .tiny { font-size: 12px; color: var(--mute); }
.num { font-variant-numeric: tabular-nums; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 560px; }

/* шапка */
.top { position: sticky; top: 0; z-index: 1000; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; gap: 10px; height: 56px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 17px; color: var(--ink); text-decoration: none; min-width: 0; }
.brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logo { width: 30px; height: 30px; border-radius: 9px; background: var(--acc); color: var(--acc-ink); display: grid; place-items: center; flex: none; }
.sp { flex: 1; }
.top select, .ib { height: 34px; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 999px; padding: 0 10px; font: inherit; font-size: 13px; cursor: pointer; }
.ib { width: 34px; padding: 0; display: grid; place-items: center; }
.navl { display: flex; gap: 4px; }
.navl a { padding: 6px 10px; border-radius: 999px; color: var(--ink2); text-decoration: none; font-size: 14px; }
.navl a:hover { background: var(--mute-soft); color: var(--ink); }

/* кнопки, поля */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 42px; padding: 0 16px; border-radius: 11px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-weight: 650; cursor: pointer; text-decoration: none; white-space: nowrap; transition: transform .06s, background .15s; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.pri { background: var(--acc); border-color: var(--acc); color: var(--acc-ink); }
.btn.wa { background: #1fa855; border-color: #1fa855; color: #fff; }
.btn.bad { color: var(--bad); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.big { min-height: 54px; font-size: 16px; border-radius: 14px; }
.btn.sm { min-height: 32px; padding: 0 11px; font-size: 13px; border-radius: 9px; }
.btn.full { width: 100%; }
.f { display: block; margin-bottom: 12px; }
.f > span { display: block; font-size: 13px; font-weight: 600; color: var(--ink2); margin-bottom: 5px; }
input, select, textarea { width: 100%; min-height: 42px; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 10px; padding: 9px 12px; font: inherit; }
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--acc); outline-offset: 1px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 560px) { .row2 { grid-template-columns: 1fr; } }

/* карточки */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh); padding: 16px; }
.banner { background: var(--acc-soft); color: var(--ink); font-size: 13.5px; padding: 9px 16px; text-align: center; }
.banner a { font-weight: 700; margin-left: 6px; }
.chip { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip.acc { background: var(--acc-soft); color: var(--acc); } .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); }
.chip.mute { background: var(--mute-soft); color: var(--ink2); }
.chip.live::before { animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 currentColor; } 70% { box-shadow: 0 0 0 6px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-weight: 600; z-index: 3000; box-shadow: var(--sh); max-width: calc(100% - 32px); }
.empty { text-align: center; color: var(--mute); padding: 28px 10px; }
dialog { border: 0; border-radius: 18px; padding: 0; background: var(--card); color: var(--ink); width: min(560px, calc(100% - 24px)); max-height: calc(100% - 24px); box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
dialog::backdrop { background: rgba(8, 16, 14, .5); }
dialog .dh { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--card); z-index: 2; }
dialog .db { padding: 16px; }
dialog .df { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }

/* маркеры карты */
.mk { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: #fff; border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .3); position: relative; }
.mk.pick { background: var(--acc); }
.mk.drop { background: #20332f; }
:root[data-theme="dark"] .mk.drop { background: #e8f0ee; color: #0d1513; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .mk.drop { background: #e8f0ee; color: #0d1513; } }
.mk.bike { width: 40px; height: 40px; background: var(--bike); }
.mk.bike::after { content: ""; position: absolute; inset: -8px; border-radius: 50%; border: 2px solid var(--bike); opacity: .5; animation: ring 2s infinite; }
@keyframes ring { from { transform: scale(.7); opacity: .6; } to { transform: scale(1.4); opacity: 0; } }
.mk i { position: absolute; top: 40px; left: 50%; transform: translateX(-50%); background: var(--card); color: var(--ink); font: 700 11px var(--f); padding: 1px 6px; border-radius: 6px; white-space: nowrap; box-shadow: var(--sh); }
.leaflet-container { font: inherit; background: var(--mute-soft); }
.leaflet-control-attribution { font-size: 10px; }

/* шкала статусов */
.tl { list-style: none; margin: 0; padding: 0; }
.tl li { position: relative; padding: 0 0 16px 30px; color: var(--mute); }
.tl li::before { content: ""; position: absolute; left: 7px; top: 4px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line); background: var(--card); }
.tl li::after { content: ""; position: absolute; left: 13px; top: 20px; bottom: 0; width: 2px; background: var(--line); }
.tl li:last-child::after { display: none; }
.tl li.done { color: var(--ink); } .tl li.done::before { background: var(--acc); border-color: var(--acc); }
.tl li.done::after { background: var(--acc); }
.tl li.cur::before { background: var(--bike); border-color: var(--bike); box-shadow: 0 0 0 4px color-mix(in srgb, var(--bike) 25%, transparent); }
.tl li.fail::before { background: var(--bad); border-color: var(--bad); }
.tl b { display: block; font-weight: 650; } .tl small { color: var(--mute); }

/* звёзды */
.stars { display: flex; gap: 6px; }
.stars button { width: 44px; height: 44px; border: 0; background: none; font-size: 32px; line-height: 1; cursor: pointer; color: var(--line); padding: 0; }
.stars button.on { color: #f2b01e; }

/* таблицы и вкладки */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; color: var(--mute); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs button { flex: none; border: 0; background: none; color: var(--ink2); font: inherit; font-weight: 650; padding: 9px 13px; border-radius: 10px; cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--acc-soft); color: var(--acc); }
.seg { display: inline-flex; background: var(--mute-soft); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; font: inherit; font-size: 13px; font-weight: 650; padding: 6px 11px; border-radius: 8px; color: var(--ink2); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: var(--sh); }
details summary { cursor: pointer; font-weight: 650; }
.foot { padding: 30px 16px calc(30px + env(safe-area-inset-bottom)); text-align: center; color: var(--mute); font-size: 13px; }
.foot a { color: var(--ink2); margin: 0 6px; }
.hide { display: none !important; }
