:root {
  --bg: #f5f6f2; --panel: #ffffff; --ink: #1d2a2c; --muted: #66757a; --line: #e3e7e1;
  --accent: #1f7a6d; --accent-ink: #145a50; --accent-soft: #e3f1ee;
  --warn: #b0701c; --warn-soft: #fbf0dc; --off: #8a949a; --info: #3f6a93; --info-soft: #e5eef7; --ok-soft: #e3f1ee;
  --err: #a34a4a; --radius: 14px; --shadow: 0 1px 2px rgba(29,42,44,.05), 0 6px 18px rgba(29,42,44,.04);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink); background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; font-size: 15px; line-height: 1.45; }
a { color: var(--accent-ink); }
h1 { font-size: 1.55rem; margin: 0; letter-spacing: -.01em; font-weight: 650; }
h2 { font-size: 1.05rem; margin: 2rem 0 .8rem; font-weight: 650; color: var(--ink); }
h3 { font-size: 1rem; margin: 0; font-weight: 620; }
small, .small { font-size: .8rem; }
.muted { color: var(--muted); }

.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: #fbfcf9; border-right: 1px solid var(--line); padding: 22px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 10px 22px; }
.brand-mark { width: 36px; height: 36px; border-radius: 11px; background: var(--accent); color: #fff; display: grid; place-items: center; }
.brand-ico { width: 22px; height: 22px; }
.brand-text { font-weight: 650; display: flex; flex-direction: column; line-height: 1.15; }
.brand-text small { color: var(--muted); font-weight: 450; }
.side ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.side a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: #3b4b4f; text-decoration: none; }
.side a:hover { background: #eef2ec; }
.side a.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.ico { width: 20px; height: 20px; flex: none; }
.live-state { margin-top: auto; display: flex; align-items: center; gap: 8px; padding: 10px 12px; color: var(--muted); font-size: .85rem; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #c4cbc6; }
.dot.on { background: #3a9d7f; box-shadow: 0 0 0 4px rgba(58,157,127,.15); }

.content { padding: 28px 36px 60px; max-width: 1240px; width: 100%; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 22px; }
.sub { color: var(--muted); margin: .25rem 0 0; }
.stamp { color: var(--muted); font-size: .8rem; white-space: nowrap; padding-top: 8px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow); }
.stat strong { font-size: 1.6rem; font-weight: 650; letter-spacing: -.01em; }
.stat-label { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }
.stat small { color: var(--muted); }
.stat.warn strong { color: var(--warn); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.card.flat { padding: 6px 18px; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.count { min-width: 30px; height: 30px; border-radius: 15px; background: var(--accent-soft); color: var(--accent-ink); display: grid; place-items: center; font-weight: 650; padding: 0 8px; }
.empty { color: var(--muted); margin: .6rem 0; }
.next { margin: .2rem 0 .4rem; font-size: .9rem; color: #3b4b4f; }
.rows, .feed, .hits, .clinic-list { list-style: none; margin: 0; padding: 0; }
.rows li { display: grid; grid-template-columns: 52px 1fr auto; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); align-items: start; }
.rows li.cancelled .row-main { opacity: .55; text-decoration: line-through; }
.time { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--accent-ink); }
.feed li { display: flex; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); }
.feed li:first-child { border-top: 0; }
.feed .time { color: var(--muted); font-weight: 450; min-width: 44px; }

.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: #eceff0; color: #4a5a5e; white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--accent-ink); }
.pill.info { background: var(--info-soft); color: var(--info); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.off { background: #eceff0; color: var(--off); }

table.grid { width: 100%; border-collapse: collapse; }
.grid th { text-align: left; font-size: .75rem; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 12px 8px; }
.grid td { padding: 11px 8px; border-top: 1px solid var(--line); vertical-align: top; }
.grid .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.grid tfoot td { padding: 12px 8px; }

.find { margin-bottom: 18px; }
.find label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 6px; color: #3b4b4f; }
.find-row { display: flex; gap: 10px; max-width: 640px; }
.input { flex: 1; font: inherit; padding: 12px 14px; border-radius: 11px; border: 1px solid #cfd6cf; background: #fff; color: var(--ink); }
.input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.btn { font: inherit; font-weight: 600; padding: 0 20px; border-radius: 11px; border: 0; background: var(--accent); color: #fff; cursor: pointer; }
.btn:hover { background: var(--accent-ink); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip { padding: 6px 14px; border-radius: 999px; background: #fff; border: 1px solid var(--line); text-decoration: none; color: #3b4b4f; }
.chip:hover { border-color: var(--accent); color: var(--accent-ink); }
.notice-err { background: #f8eceb; color: var(--err); border-radius: 10px; padding: 10px 14px; max-width: 640px; }
.footnote { color: var(--muted); font-size: .85rem; margin-top: 14px; }

.nearest { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 10px; max-width: 760px; }
.nearest li { display: grid; grid-template-columns: 38px 1fr auto; gap: 14px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; box-shadow: var(--shadow); }
.nearest li:first-child { border-color: #a9d3cb; }
.rank { width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); font-weight: 650; display: grid; place-items: center; }
.n-km { text-align: right; display: flex; flex-direction: column; }
.n-km strong { font-size: 1.35rem; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.n-km small { color: var(--warn); }

.hits { display: grid; gap: 10px; max-width: 760px; margin-top: 12px; }
.hits li { display: grid; grid-template-columns: 70px 1fr auto; gap: 14px; align-items: start; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; box-shadow: var(--shadow); }
.best { font-size: .75rem; color: var(--accent-ink); font-weight: 600; }

.map-wrap { max-width: 920px; }
.map-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; box-shadow: var(--shadow); }
.map { width: 100%; height: auto; display: block; max-height: 74vh; }
.sea { fill: #e9eeea; } .land { fill: #fcfcf9; stroke: #aebdb6; stroke-width: 1.4; } .grat { stroke: #dbe5e2; stroke-dasharray: 3 5; }
.pin .halo { fill: rgba(31,122,109,.16); } .pin .dot { fill: var(--accent); stroke: #fff; stroke-width: 2; }
.pin.approx .dot { fill: #fff; stroke: var(--accent); stroke-width: 2.4; } .pin.approx .halo { fill: rgba(176,112,28,.14); }
.pin text { font-size: 15px; font-weight: 600; fill: #243438; paint-order: stroke; stroke: #f7f8f3; stroke-width: 4px; }
.map-legend { color: var(--muted); font-size: .85rem; margin: 10px 4px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.key { display: inline-block; width: 11px; height: 11px; border-radius: 50%; background: var(--accent); flex: none; margin-left: 8px; }
.key.hollow { background: #fff; border: 2px solid var(--accent); }
.clinic-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 10px; margin-top: 12px; }
.clinic-list li { display: flex; gap: 10px; align-items: flex-start; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.clinic-list .key { margin-top: 5px; margin-left: 0; }
.coords { margin-left: auto; white-space: nowrap; }

.chart-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 14px; margin-top: 16px; }
.canvas-wrap { position: relative; height: 250px; margin-top: 10px; }

#toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 10px; width: min(380px, calc(100vw - 40px)); z-index: 20; }
.toast { background: #223539; color: #f2f6f4; border-radius: 12px; padding: 12px 14px; box-shadow: 0 10px 30px rgba(20,30,32,.25); animation: in .25s ease-out; transition: opacity .3s; }
.toast.out { opacity: 0; }
.toast-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.toast .tag { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: #9fd3c8; font-weight: 600; }
.toast button { background: none; border: 0; color: #9fb0b3; font-size: 1.2rem; cursor: pointer; line-height: 1; }
.toast-changed { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.toast-changed span { background: rgba(255,255,255,.12); border-radius: 6px; padding: 1px 8px; font-size: .8rem; }
@keyframes in { from { transform: translateY(8px); opacity: 0; } }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; padding: 10px; align-items: center; }
  .side ul { grid-auto-flow: column; overflow-x: auto; }
  .side a span { display: none; } .side a.active span { display: inline; }
  .brand { padding: 0 8px; } .brand-text, .live-state { display: none; }
  .content { padding: 18px 16px 50px; }
  .cards, .chart-grid { grid-template-columns: 1fr; }
}
