:root {
  --bg: #0b1117;
  --panel: #111a23;
  --card: #17222d;
  --border: #263544;
  --text: #f1f5f9;
  --muted: #91a0af;
  --accent: #ff6b35;
  --danger: #ff3b30;
  --warning: #ff9f0a;
  --watch: #ffd60a;
  --ok: #30d158;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, sans-serif; }
body { overflow: hidden; }
button, select { font: inherit; }
/* minmax(0, 1fr) обязателен: без него строка grid растягивается по содержимому боковой
   панели, height:100vh перестаёт её ограничивать, панель уезжает за экран, а блок карты
   вытягивается на всю эту высоту и Leaflet считает размеры по устаревшему значению. */
.app-shell { height: 100vh; display: grid; grid-template-columns: 410px 1fr; grid-template-rows: minmax(0, 1fr); }
.sidebar { min-width: 0; min-height: 0; overflow-y: auto; padding: 22px; background: var(--panel); border-right: 1px solid var(--border); }
.topbar, .section-heading { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; }
.section-heading.compact { align-items: center; }
h1, h2 { margin: 0; font-weight: 650; }
h1 { font-size: 27px; }
h2 { font-size: 17px; }
.eyebrow { margin-bottom: 5px; color: var(--accent); font-size: 11px; font-weight: 750; letter-spacing: .12em; }
.muted { color: var(--muted); font-size: 13px; }
.icon-button { width: 38px; height: 38px; border: 1px solid var(--border); border-radius: 10px; background: var(--card); color: var(--text); cursor: pointer; font-size: 21px; }
.icon-button:disabled { opacity: .5; cursor: wait; }
.hotel-card, .controls, .nearest-section { margin-top: 20px; padding: 17px; border: 1px solid var(--border); border-radius: 14px; background: var(--card); }
.hotel-card p { margin: 8px 0 14px; }
.risk-badge { padding: 6px 9px; border-radius: 999px; font-size: 11px; font-weight: 750; white-space: nowrap; color: #081018; }
.risk-badge.critical { background: var(--danger); color: white; }
.risk-badge.high { background: var(--warning); }
.risk-badge.elevated, .risk-badge.watch { background: var(--watch); }
.risk-badge.clear { background: var(--ok); }
.metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.metric { padding: 10px; border-radius: 10px; background: #0f1820; border: 1px solid #22303d; }
.metric span { display: block; color: var(--muted); font-size: 11px; margin-bottom: 4px; }
.metric strong { font-size: 15px; }
.radius-counts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 10px; }
.radius-chip { padding: 8px 5px; text-align: center; border: 1px solid var(--border); border-radius: 9px; font-size: 11px; color: var(--muted); }
.radius-chip strong { display: block; margin-bottom: 2px; color: var(--text); font-size: 15px; }
.wind-note { margin-top: 10px; padding: 9px 10px; border-left: 3px solid var(--warning); background: #211b12; border-radius: 6px; font-size: 12px; line-height: 1.4; }
.primary-button { width: 100%; margin-top: 12px; padding: 10px 12px; border: 0; border-radius: 10px; background: var(--accent); color: #111; font-weight: 700; cursor: pointer; }
.controls label { display: block; margin-top: 12px; color: var(--muted); font-size: 12px; }
select { width: 100%; margin-top: 5px; padding: 9px 10px; border: 1px solid var(--border); border-radius: 9px; background: #0f1820; color: var(--text); }
.source-filters { margin-top: 12px; display: grid; gap: 7px; }
.source-row { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 12px; cursor: help; }
.source-row input { accent-color: var(--accent); flex: none; cursor: pointer; }
.source-text { display: flex; flex-direction: column; line-height: 1.25; }
.source-text b { font-weight: 600; }
.source-text i { font-style: normal; color: var(--muted); font-size: 10px; letter-spacing: .02em; }

/* Подсказки: разворачиваются по клику, чтобы не занимать место у тех, кто уже разобрался. */
.hint { margin-top: 12px; border: 1px solid var(--border); border-radius: 9px; background: #0f1820; }
.hint > summary { padding: 9px 11px; cursor: pointer; color: var(--accent); font-size: 12px; font-weight: 600; list-style: none; }
.hint > summary::-webkit-details-marker { display: none; }
.hint > summary::before { content: "?"; display: inline-grid; place-items: center; width: 15px; height: 15px; margin-right: 7px; border: 1px solid var(--accent); border-radius: 50%; font-size: 10px; vertical-align: -2px; }
.hint[open] > summary { border-bottom: 1px solid var(--border); }
.hint p { margin: 0; padding: 9px 11px 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.hint p:last-child { padding-bottom: 11px; }
.hint b { color: var(--text); font-weight: 600; }

.symbol-list { margin: 12px 0 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.symbol-list li { display: flex; gap: 10px; align-items: flex-start; color: var(--muted); font-size: 12px; line-height: 1.45; }
.symbol-list b { color: var(--text); font-weight: 600; }
.symbol-list > li > span { flex: none; width: 18px; height: 18px; margin-top: 1px; display: grid; place-items: center; }
.symbol-pin { position: relative; }
.symbol-pin::before { content: ""; width: 13px; height: 13px; border: 2px solid #fff; border-radius: 50% 50% 50% 0; background: #2684ff; transform: rotate(-45deg); }
.symbol-dot::before { content: ""; width: 12px; height: 12px; border-radius: 50%; background: var(--danger); border: 1px solid #111; }
.symbol-ring::before { content: ""; width: 16px; height: 16px; border-radius: 50%; border: 1px dashed var(--warning); }
.symbol-map::before { content: ""; width: 15px; height: 15px; border-radius: 3px; border: 1px solid var(--border); background: linear-gradient(135deg, #2b4a33 0 45%, #24405c 45% 100%); }
.symbol-pin.own::before { background: var(--ok); }

/* Свои точки наблюдения */
.points-list { display: grid; gap: 7px; margin-top: 12px; }
.point-row { display: flex; align-items: stretch; gap: 6px; border: 1px solid var(--border); border-radius: 9px; background: #0f1820; overflow: hidden; }
.point-row.alarm { border-color: var(--danger); background: #1d1214; }
.point-main { flex: 1; min-width: 0; padding: 10px; text-align: left; border: 0; background: none; color: var(--text); cursor: pointer; }
.point-main strong { display: block; font-size: 13px; }
.point-main span { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.point-row.alarm .point-main span { color: #ff9d97; }
.point-remove { flex: none; width: 34px; border: 0; border-left: 1px solid var(--border); background: none; color: var(--muted); font-size: 19px; line-height: 1; cursor: pointer; }
.point-remove:hover { background: #2a1a1c; color: var(--danger); }

.form-grid { display: grid; gap: 10px; padding: 11px; }
.form-grid label { display: block; color: var(--muted); font-size: 12px; }
.form-grid input[type="text"], .form-grid input[type="password"], .form-grid input[type="number"] {
  width: 100%; margin-top: 5px; padding: 9px 10px; border: 1px solid var(--border);
  border-radius: 9px; background: #0b1219; color: var(--text); font: inherit;
}
.form-grid input:focus { outline: none; border-color: var(--accent); }
.form-help { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.form-help.compact { margin-top: 6px; }
.form-help code { padding: 1px 4px; border-radius: 4px; background: #0b1219; color: #cbd5e1; font-size: 10px; }
.form-grid .inline-check { display: flex; align-items: flex-start; gap: 8px; line-height: 1.35; }
.form-grid .primary-button { margin-top: 2px; }
.ghost-button { width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; background: #0f1820; color: var(--muted); cursor: pointer; font-size: 12px; }
.ghost-button:hover { color: var(--text); border-color: var(--accent); }
.ghost-button:disabled, .primary-button:disabled { opacity: .55; cursor: wait; }
.form-message { padding: 9px 10px; border-radius: 8px; font-size: 12px; line-height: 1.4; background: #0b1219; color: var(--muted); }
.form-message.ok { background: #10241a; color: #7ee2a8; }
.form-message.error { background: #2a1417; color: #ff9d97; }
.nearest-list { display: grid; gap: 7px; margin-top: 10px; }
.nearest-item { width: 100%; padding: 10px; text-align: left; border: 1px solid var(--border); border-radius: 9px; background: #0f1820; color: var(--text); cursor: pointer; }
.nearest-item strong { display: block; font-size: 13px; }
.nearest-item span { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.empty { padding: 15px 0; text-align: center; color: var(--muted); font-size: 13px; }
.warning { margin-top: 15px; padding: 11px; border: 1px solid #72531f; border-radius: 10px; background: #2a2111; color: #ffd487; font-size: 12px; line-height: 1.4; }
.hidden { display: none !important; }
footer { margin: 18px 4px 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.disclaimer { margin-top: 4px; color: #d8a35a; }
.map-wrap { min-width: 0; min-height: 0; position: relative; }
#map { width: 100%; height: 100%; background: #0b1117; }
.map-legend { position: absolute; z-index: 500; right: 14px; top: 14px; display: flex; gap: 12px; padding: 8px 10px; border: 1px solid rgba(255,255,255,.15); border-radius: 9px; background: rgba(11,17,23,.87); backdrop-filter: blur(6px); font-size: 11px; }
.map-legend span { display: flex; align-items: center; gap: 5px; cursor: help; }
.legend-sep { width: 1px; height: 14px; padding: 0; background: rgba(255,255,255,.18); }
.dot.small { width: 6px; height: 6px; }
.legend-pin { width: 9px; height: 9px; border: 2px solid #fff; border-radius: 50% 50% 50% 0; background: #2684ff; transform: rotate(-45deg); display: inline-block; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot.recent { background: var(--danger); }
.dot.today { background: var(--warning); }
.dot.old { background: var(--watch); }
.map-status { position: absolute; z-index: 500; left: 14px; bottom: 14px; padding: 8px 10px; border-radius: 9px; background: rgba(11,17,23,.87); color: var(--muted); font-size: 11px; }
.hotel-marker { width: 24px; height: 24px; border: 3px solid white; border-radius: 50% 50% 50% 0; background: #2684ff; transform: rotate(-45deg); box-shadow: 0 3px 8px rgba(0,0,0,.45); }
.hotel-marker::after { content: ""; position: absolute; width: 7px; height: 7px; border-radius: 50%; background: white; top: 6px; left: 6px; }
.hotel-marker.own { background: var(--ok); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: #111a23; color: var(--text); }
.popup-title { font-weight: 700; margin-bottom: 5px; }
.popup-row { color: #aeb9c4; margin-top: 3px; font-size: 12px; }
.popup-row.muted-note { margin-top: 6px; padding-top: 5px; border-top: 1px solid #24303c; color: #8b98a5; font-size: 11px; }
@media (max-width: 820px) {
  body { overflow: auto; }
  .app-shell { height: auto; min-height: 100vh; grid-template-columns: 1fr; }
  .sidebar { overflow: visible; border-right: 0; }
  .map-wrap { height: 66vh; min-height: 480px; }
}
