:root {
  color-scheme: light;
  --bg: #f4efe6;
  --surface: rgba(255, 252, 247, 0.82);
  --surface-strong: #fffaf3;
  --ink: #1b1c1f;
  --muted: #6f726d;
  --line: rgba(27, 28, 31, 0.12);
  --brand: #12634d;
  --brand-strong: #0a4837;
  --accent: #df7e2f;
  --danger: #c94a3f;
  --shadow: 0 20px 60px rgba(19, 22, 25, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(223, 126, 47, 0.22), transparent 32%),
    radial-gradient(circle at top right, rgba(18, 99, 77, 0.18), transparent 30%),
    linear-gradient(180deg, #f5efe5 0%, #efe7db 100%);
}

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.topbar,
.status-strip,
.hero,
.controls,
.map-section,
.stations-section {
  background: var(--surface);
  backdrop-filter: blur(16px);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px;
}

.status-strip {
  margin-top: 14px;
  padding: 12px 16px;
  background: rgba(255, 250, 243, 0.72);
}

.status-strip p {
  color: var(--muted);
}

.status-strip.ok {
  border-color: rgba(18, 99, 77, 0.18);
  background: rgba(18, 99, 77, 0.08);
}

.status-strip.warn {
  border-color: rgba(223, 126, 47, 0.22);
  background: rgba(223, 126, 47, 0.12);
}

.status-strip.bad {
  border-color: rgba(201, 74, 63, 0.24);
  background: rgba(201, 74, 63, 0.12);
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
  color: var(--muted);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 30px;
}

h2 {
  max-width: 14ch;
  font-size: clamp(28px, 4vw, 46px);
  line-height: 1;
}

h3 {
  font-size: 22px;
}

.hero {
  margin-top: 18px;
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 24px;
  padding: 28px;
}

.hero-copy {
  display: grid;
  gap: 14px;
}

.hero-text,
.section-note {
  color: var(--muted);
  line-height: 1.5;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.stat {
  display: grid;
  align-content: end;
  min-height: 150px;
  padding: 16px;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(18, 99, 77, 0.08), rgba(18, 99, 77, 0.02)),
    var(--surface-strong);
  border: 1px solid rgba(18, 99, 77, 0.12);
}

.stat span {
  font-size: 34px;
  font-weight: 700;
  color: var(--brand-strong);
}

.controls,
.map-section,
.stations-section {
  margin-top: 18px;
  padding: 20px;
}

.controls {
  display: grid;
  gap: 16px;
}

.route-grid,
.filter-row {
  display: grid;
  gap: 14px;
}

.route-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.filter-row {
  grid-template-columns: 180px 180px minmax(180px, 1fr);
  align-items: end;
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  font-size: 14px;
  color: var(--muted);
}

.field input,
.field select,
.field textarea,
.primary-button,
.ghost-button {
  min-height: 46px;
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--line);
  font: inherit;
}

.field input,
.field select,
.field textarea {
  padding: 12px 14px;
  background: var(--surface-strong);
  color: var(--ink);
}

.primary-button,
.ghost-button,
.ghost-icon {
  cursor: pointer;
  transition: transform 120ms ease, background-color 120ms ease, border-color 120ms ease;
}

.primary-button {
  padding: 0 18px;
  background: var(--brand);
  color: white;
  border-color: transparent;
}

.primary-button:hover,
.ghost-button:hover,
.ghost-icon:hover {
  transform: translateY(-1px);
}

.ghost-button,
.ghost-icon {
  padding: 0 16px;
  background: rgba(255, 250, 243, 0.85);
  color: var(--ink);
}

.ghost-icon {
  width: 40px;
  min-width: 40px;
}

.map-header,
.section-heading,
.dialog-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}

.map-surface {
  position: relative;
  margin-top: 18px;
  min-height: 360px;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid rgba(18, 99, 77, 0.14);
  background: linear-gradient(180deg, #dfe7dc 0%, #efe8dc 100%);
}

#map {
  width: 100%;
  min-height: 360px;
  height: 100%;
}

.leaflet-container {
  background: #dfe7dc;
  font: inherit;
}

.leaflet-control-attribution {
  font-size: 11px;
}

.leaflet-popup-content {
  margin: 12px 14px;
  color: var(--ink);
}

.leaflet-popup-content h4 {
  margin: 0 0 8px;
  font-size: 16px;
}

.leaflet-popup-content p {
  margin: 4px 0;
  color: var(--muted);
}

.station-marker {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 3px solid white;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.yandex-station-marker {
  cursor: pointer;
}

.station-marker.ok {
  background: var(--brand);
}

.station-marker.warn {
  background: var(--accent);
}

.station-marker.bad {
  background: var(--danger);
}

.ymaps-2-1-79-map {
  font: inherit;
}

[class*="ymaps3"] {
  font: inherit;
}

.map-legend {
  position: absolute;
  left: 16px;
  bottom: 16px;
  z-index: 500;
  display: flex;
  gap: 14px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(255, 250, 243, 0.9);
  border: 1px solid var(--line);
  font-size: 13px;
}

.map-legend span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.map-legend i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.ok { background: var(--brand); }
.warn { background: var(--accent); }
.bad { background: var(--danger); }

.station-list {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.station-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border-radius: 8px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
}

.station-top,
.station-meta,
.station-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.station-meta,
.station-copy p {
  color: var(--muted);
}

.badge-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 13px;
  background: rgba(18, 99, 77, 0.08);
  color: var(--brand-strong);
  border: 1px solid rgba(18, 99, 77, 0.14);
}

.badge.warn {
  background: rgba(223, 126, 47, 0.12);
  color: #9a5419;
  border-color: rgba(223, 126, 47, 0.22);
}

.badge.bad {
  background: rgba(201, 74, 63, 0.12);
  color: #8e2f28;
  border-color: rgba(201, 74, 63, 0.22);
}

.station-actions button {
  min-height: 38px;
}

.empty-state {
  padding: 24px;
  border-radius: 8px;
  border: 1px dashed var(--line);
  color: var(--muted);
  background: rgba(255, 250, 243, 0.72);
}

.report-dialog {
  width: min(560px, calc(100% - 24px));
  border: none;
  padding: 0;
  border-radius: 8px;
  background: transparent;
}

.report-dialog::backdrop {
  background: rgba(12, 16, 18, 0.5);
}

.report-form {
  display: grid;
  gap: 16px;
  padding: 20px;
  border-radius: 8px;
  background: #fffaf3;
  border: 1px solid rgba(27, 28, 31, 0.12);
  box-shadow: var(--shadow);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

@media (max-width: 900px) {
  .hero,
  .station-list {
    grid-template-columns: 1fr;
  }

  .hero-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .filter-row {
    grid-template-columns: 1fr;
  }

  #map,
  .map-surface {
    min-height: 320px;
  }
}

@media (max-width: 640px) {
  .shell {
    width: min(100%, calc(100% - 20px));
    padding-top: 12px;
  }

  .topbar,
  .map-header,
  .section-heading,
  .dialog-header {
    align-items: stretch;
    flex-direction: column;
  }

  .route-grid,
  .hero-stats {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 26px;
  }

  h2 {
    max-width: none;
    font-size: 30px;
  }
}
