:root {
  color-scheme: dark;
  --bg: #10130f;
  --panel: #171b16;
  --surface: #1d221c;
  --surface-2: #242a23;
  --line: rgba(255, 255, 255, 0.09);
  --text: #f3f5ee;
  --muted: #929a8e;
  --accent: #ccff3f;
  --accent-dark: #10140a;
  --low: #73dd6f;
  --medium: #ffc14d;
  --high: #ff6b57;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.36);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; }
button { color: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.app-shell { min-height: 100%; display: grid; grid-template-rows: 72px minmax(0, 1fr); }
.topbar {
  position: relative;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(16, 19, 15, 0.94);
  backdrop-filter: blur(18px);
}
.brand { display: inline-flex; gap: 11px; align-items: center; color: var(--text); text-decoration: none; }
.brand-mark {
  display: grid;
  width: 39px;
  height: 39px;
  place-items: center;
  border-radius: 11px;
  background: var(--accent);
  color: var(--accent-dark);
  font-size: 15px;
  font-weight: 900;
  letter-spacing: -0.03em;
  box-shadow: inset 0 -8px 20px rgba(116, 145, 18, 0.18);
}
.brand > span:last-child { display: flex; flex-direction: column; line-height: 1.05; }
.brand strong { font-size: 16px; letter-spacing: -0.025em; }
.brand small { margin-top: 3px; color: var(--muted); font-size: 11px; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; }
.topbar-actions { display: flex; align-items: center; gap: 20px; }
.sync-state { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.sync-state i { width: 7px; height: 7px; border-radius: 99px; background: var(--low); box-shadow: 0 0 0 4px rgba(115, 221, 111, 0.09); }
.sync-state.loading i { background: var(--medium); animation: pulse 1.1s ease infinite; }
.button { border: 0; border-radius: 12px; min-height: 43px; padding: 0 17px; font-weight: 760; cursor: pointer; transition: transform .18s ease, background .18s ease, opacity .18s ease; }
.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button-primary { display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--accent); color: var(--accent-dark); }
.button-primary svg { width: 17px; height: 17px; stroke-width: 2.3; }

.workspace { min-height: 0; display: grid; grid-template-columns: 402px minmax(0, 1fr); }
.station-panel { position: relative; z-index: 500; min-height: 0; display: flex; flex-direction: column; padding: 31px 24px 0; border-right: 1px solid var(--line); background: var(--panel); }
.panel-heading .eyebrow, .drawer-head .eyebrow { margin: 0 0 9px; color: var(--accent); font-size: 10px; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.panel-heading h1 { margin: 0; font-size: clamp(28px, 2.15vw, 36px); line-height: 1.03; letter-spacing: -.055em; }
.panel-heading > p:last-child { margin: 12px 0 23px; color: var(--muted); font-size: 13px; }
.search-box { display: flex; height: 48px; align-items: center; gap: 10px; padding: 0 13px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); color: var(--muted); transition: border-color .2s, background .2s; }
.search-box:focus-within { border-color: rgba(204,255,63,.46); background: #20261e; }
.search-box svg { width: 18px; }
.search-box input { min-width: 0; flex: 1; border: 0; outline: 0; background: none; color: var(--text); font-size: 13px; }
.search-box input::placeholder { color: #7f877b; }
.search-box kbd { border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; background: #151914; color: #747c70; font-family: inherit; font-size: 10px; }
.filter-row { display: flex; gap: 7px; margin: 14px 0 17px; overflow-x: auto; scrollbar-width: none; }
.filter-row::-webkit-scrollbar { display: none; }
.filter { flex: 0 0 auto; display: inline-flex; min-height: 31px; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 99px; padding: 0 10px; background: transparent; color: var(--muted); font-size: 10.5px; font-weight: 700; cursor: pointer; }
.filter:hover { color: var(--text); }
.filter.active { border-color: transparent; background: #eef2e6; color: #171b16; }
.filter span { opacity: .55; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; }
.dot-low { background: var(--low); }
.dot-medium { background: var(--medium); }
.dot-high { background: var(--high); }
.list-meta { display: flex; align-items: center; justify-content: space-between; padding-bottom: 9px; color: var(--muted); font-size: 10px; font-weight: 720; letter-spacing: .03em; }
.link-button { display: inline-flex; align-items: center; gap: 5px; border: 0; background: none; color: #bcc4b7; font-size: 10px; font-weight: 720; cursor: pointer; }
.link-button:hover { color: var(--accent); }
.link-button svg { width: 14px; height: 14px; }
.station-list { min-height: 0; overflow-y: auto; margin: 0 -10px; padding: 0 10px 26px; scrollbar-color: #384034 transparent; scrollbar-width: thin; }
.station-card { position: relative; display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; align-items: center; width: 100%; border: 1px solid transparent; border-bottom-color: var(--line); padding: 13px 5px; background: transparent; color: inherit; text-align: left; cursor: pointer; transition: background .18s, border-color .18s, transform .18s; }
.station-card:hover { border-color: var(--line); border-radius: 12px; background: var(--surface); padding-left: 10px; padding-right: 10px; transform: translateX(2px); }
.station-card.active { border-color: rgba(204,255,63,.34); border-radius: 12px; background: rgba(204,255,63,.055); padding-left: 10px; padding-right: 10px; }
.station-logo { display: grid; width: 40px; height: 40px; place-items: center; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); color: #dfe5d8; font-size: 11px; font-weight: 900; text-transform: uppercase; }
.station-copy { min-width: 0; }
.station-copy strong { display: block; overflow: hidden; margin-bottom: 5px; font-size: 12.5px; text-overflow: ellipsis; white-space: nowrap; }
.station-copy small { display: block; overflow: hidden; color: var(--muted); font-size: 10.5px; text-overflow: ellipsis; white-space: nowrap; }
.station-status { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.station-status b { font-size: 11px; }
.station-status small { color: var(--muted); font-size: 9px; }
.station-status.low b { color: var(--low); }
.station-status.medium b { color: var(--medium); }
.station-status.high b { color: var(--high); }
.empty-state { padding: 38px 15px; color: var(--muted); text-align: center; font-size: 13px; }

.map-stage { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: #232720; }
#map, .fallback-map { width: 100%; height: 100%; }
.leaflet-container { background: #242821; font: inherit; }
.leaflet-control-attribution { background: rgba(18,20,16,.84) !important; color: #9ea598; font-size: 8px !important; }
.leaflet-control-attribution a { color: #cdd4c7; }
.leaflet-control-zoom { display: none; }
.leaflet-tile-pane { filter: grayscale(1) invert(.88) sepia(.16) hue-rotate(49deg) brightness(.56) contrast(1.12); }
.queue-marker { display: grid; place-items: center; border: 3px solid #171b16; border-radius: 50%; box-shadow: 0 8px 20px rgba(0,0,0,.33); color: #151815; font-size: 8px; font-weight: 900; transition: transform .2s; }
.queue-marker:hover { transform: scale(1.13); }
.queue-marker.low { background: var(--low); }
.queue-marker.medium { background: var(--medium); }
.queue-marker.high { background: var(--high); }
.queue-marker.selected { outline: 3px solid rgba(255,255,255,.76); outline-offset: 2px; }
.map-toolbar { position: absolute; z-index: 450; top: 18px; right: 18px; display: grid; gap: 8px; }
.map-tool, .icon-button { display: grid; width: 42px; height: 42px; place-items: center; border: 1px solid var(--line); border-radius: 12px; background: rgba(23,27,22,.93); color: #d7ddd1; box-shadow: 0 8px 24px rgba(0,0,0,.2); cursor: pointer; backdrop-filter: blur(12px); }
.map-tool:hover, .icon-button:hover { background: #252b23; color: var(--accent); }
.map-tool svg { width: 18px; }
.legend-card { position: absolute; z-index: 450; right: 18px; bottom: 20px; display: flex; gap: 16px; border: 1px solid var(--line); border-radius: 12px; padding: 11px 14px; background: rgba(23,27,22,.92); color: #a8b0a3; font-size: 9px; font-weight: 700; box-shadow: var(--shadow); backdrop-filter: blur(12px); }
.legend-card span { display: flex; align-items: center; gap: 6px; }
.station-detail { position: absolute; z-index: 460; left: 18px; bottom: 20px; width: min(365px, calc(100% - 36px)); border: 1px solid var(--line); border-radius: 17px; padding: 17px; background: rgba(23,27,22,.97); box-shadow: var(--shadow); backdrop-filter: blur(18px); animation: rise .25s ease both; }
.detail-top { display: flex; align-items: flex-start; gap: 11px; }
.detail-copy { min-width: 0; flex: 1; }
.detail-copy h2 { overflow: hidden; margin: 1px 0 5px; font-size: 16px; letter-spacing: -.02em; text-overflow: ellipsis; white-space: nowrap; }
.detail-copy p { overflow: hidden; margin: 0; color: var(--muted); font-size: 10.5px; text-overflow: ellipsis; white-space: nowrap; }
.detail-close { width: 30px; height: 30px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; }
.detail-status { display: flex; align-items: center; justify-content: space-between; margin-top: 15px; border-top: 1px solid var(--line); padding-top: 13px; }
.detail-status > span { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 750; }
.detail-status small { color: var(--muted); font-size: 9px; font-weight: 600; }
.detail-status button { border: 0; border-radius: 9px; padding: 8px 10px; background: var(--surface-2); font-size: 10px; font-weight: 750; cursor: pointer; }
.detail-status button:hover { background: var(--accent); color: var(--accent-dark); }
.mobile-report { display: none; }

.backdrop { position: fixed; z-index: 1900; inset: 0; background: rgba(4,6,4,.68); opacity: 0; backdrop-filter: blur(4px); transition: opacity .22s; }
.backdrop.visible { opacity: 1; }
.report-drawer { position: fixed; z-index: 2000; top: 0; right: 0; width: min(440px, 100%); height: 100%; overflow-y: auto; padding: 29px; border-left: 1px solid var(--line); background: #181c17; box-shadow: -28px 0 70px rgba(0,0,0,.45); transform: translateX(105%); transition: transform .28s cubic-bezier(.2,.85,.32,1); }
.report-drawer.open { transform: translateX(0); }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 30px; }
.drawer-head h2 { margin: 0; font-size: 27px; letter-spacing: -.045em; }
.icon-button { width: 38px; height: 38px; box-shadow: none; }
.icon-button svg { width: 17px; }
.field-label, fieldset legend { display: flex; justify-content: space-between; margin: 0 0 9px; color: #d6dbd0; font-size: 11px; font-weight: 750; }
.field-label span { color: var(--muted); font-size: 9px; font-weight: 600; }
.select-wrap { position: relative; margin-bottom: 24px; }
.select-wrap select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); outline: 0; }
.select-wrap select { height: 48px; appearance: none; padding: 0 42px 0 14px; font-size: 12px; }
.select-wrap svg { position: absolute; top: 15px; right: 14px; width: 16px; pointer-events: none; color: var(--muted); }
fieldset { min-width: 0; margin: 0 0 24px; border: 0; padding: 0; }
.wait-options { display: grid; gap: 8px; }
.wait-options label { cursor: pointer; }
.wait-options input { position: absolute; opacity: 0; pointer-events: none; }
.wait-options label > span { display: grid; grid-template-columns: 10px minmax(0, 1fr); column-gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--surface); transition: border-color .18s, background .18s; }
.wait-options label > span .dot { grid-row: 1 / 3; }
.wait-options b { font-size: 11.5px; }
.wait-options small { margin-top: 2px; color: var(--muted); font-size: 9.5px; }
.wait-options input:checked + span { border-color: rgba(204,255,63,.46); background: rgba(204,255,63,.06); box-shadow: inset 0 0 0 1px rgba(204,255,63,.08); }
textarea { resize: none; min-height: 104px; padding: 13px 14px; line-height: 1.5; font-size: 12px; }
textarea::placeholder { color: #737b70; }
.privacy-note { display: flex; gap: 9px; align-items: flex-start; margin: 13px 0 23px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.privacy-note svg { flex: 0 0 auto; width: 17px; color: var(--accent); }
.submit-report { width: 100%; min-height: 49px; }
.toast { position: fixed; z-index: 3000; left: 50%; bottom: 24px; display: flex; min-width: 315px; align-items: center; gap: 11px; border: 1px solid var(--line); border-radius: 14px; padding: 12px 15px; background: #f0f4e9; color: #151914; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transform: translate(-50%, 20px); transition: opacity .23s, transform .23s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast-icon { display: grid; width: 31px; height: 31px; place-items: center; border-radius: 50%; background: #172014; color: var(--accent); }
.toast-icon svg { width: 16px; stroke-width: 2.5; }
.toast span:last-child { display: flex; flex-direction: column; }
.toast strong { font-size: 11px; }
.toast small { margin-top: 2px; color: #6d7569; font-size: 9px; }

.fallback-map { position: relative; overflow: hidden; background-color: #252a23; background-image: linear-gradient(31deg, transparent 47%, rgba(235,240,229,.045) 48%, rgba(235,240,229,.045) 51%, transparent 52%), linear-gradient(-28deg, transparent 47%, rgba(235,240,229,.035) 48%, rgba(235,240,229,.035) 51%, transparent 52%); background-size: 120px 90px, 170px 130px; }
.fallback-map::before { content: "СХЕМАТИЧНАЯ КАРТА · ИЖЕВСК"; position: absolute; left: 22px; top: 20px; color: rgba(255,255,255,.28); font-size: 9px; font-weight: 800; letter-spacing: .13em; }
.fallback-pin { position: absolute; display: grid; width: 27px; height: 27px; place-items: center; border: 3px solid #171b16; border-radius: 50%; box-shadow: 0 7px 17px rgba(0,0,0,.3); color: #10130f; font-size: 7px; font-weight: 900; cursor: pointer; transform: translate(-50%, -50%); }
.fallback-pin.low { background: var(--low); }
.fallback-pin.medium { background: var(--medium); }
.fallback-pin.high { background: var(--high); }

@keyframes pulse { 50% { opacity: .35; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

@media (max-width: 820px) {
  body { overflow: auto; background: var(--panel); }
  .app-shell { min-height: 100dvh; grid-template-rows: 62px auto; }
  .topbar { position: sticky; top: 0; padding: 0 16px; }
  .sync-state { display: none; }
  .topbar .report-open { display: none; }
  .workspace { display: flex; min-height: calc(100dvh - 62px); flex-direction: column; }
  .station-panel { order: 2; min-height: auto; padding: 24px 16px 20px; border: 0; }
  .panel-heading h1 { font-size: 31px; }
  .panel-heading > p:last-child { margin-bottom: 19px; }
  .list-meta { padding-top: 2px; }
  .station-list { overflow: visible; padding-bottom: 76px; }
  .map-stage { order: 1; height: 44dvh; min-height: 310px; border-bottom: 1px solid var(--line); }
  .legend-card { display: none; }
  .map-toolbar { top: 12px; right: 12px; }
  .station-detail { left: 12px; right: 12px; bottom: 12px; width: auto; }
  .mobile-report { position: fixed; z-index: 1000; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom)); display: grid; width: 52px; height: 52px; place-items: center; border: 0; border-radius: 16px; background: var(--accent); color: var(--accent-dark); box-shadow: 0 12px 28px rgba(0,0,0,.35); }
  .mobile-report svg { stroke-width: 2.3; }
  .report-drawer { padding: 24px 20px calc(30px + env(safe-area-inset-bottom)); }
  .toast { min-width: 0; width: calc(100% - 32px); bottom: calc(16px + env(safe-area-inset-bottom)); }
}

@media (max-width: 430px) {
  .brand-mark { width: 35px; height: 35px; border-radius: 10px; }
  .map-stage { height: 40dvh; min-height: 280px; }
  .filter-row { margin-right: -16px; padding-right: 16px; }
  .station-card { grid-template-columns: 38px minmax(0, 1fr) auto; gap: 10px; }
  .station-logo { width: 38px; height: 38px; }
  .station-detail { padding: 14px; }
  .detail-status { margin-top: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition-duration: .01ms !important; }
}
