:root {
  color-scheme: dark;
  --bg: #08110f;
  --panel: #10211f;
  --panel-2: #132927;
  --line: rgba(160, 198, 185, 0.18);
  --text: #eff8f4;
  --muted: #94b4aa;
  --green: #57d68d;
  --cyan: #52d3cf;
  --amber: #efb75d;
  --blue: #79aef7;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", "Segoe UI", "Microsoft YaHei", sans-serif;
}

.app {
  width: min(1500px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 22px 0 28px;
}

.header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.eyebrow,
p,
small,
label {
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 5px;
  font-size: 12px;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  font-weight: 680;
}

h2 {
  font-size: 16px;
  font-weight: 650;
}

.selectors {
  display: flex;
  gap: 12px;
  align-items: end;
}

label {
  display: grid;
  gap: 7px;
  font-size: 13px;
}

select {
  min-width: 170px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: #102522;
  padding: 0 10px;
}

#unitSelect {
  min-width: 260px;
}

.search-label {
  opacity: 0.92;
}

.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.kpis article,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.kpis article {
  min-height: 92px;
  padding: 14px;
}

.kpis span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.kpis strong {
  display: inline-block;
  margin: 8px 4px 0 0;
  font-size: 30px;
  line-height: 1;
}

.map-trend-grid {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 12px;
  margin-bottom: 12px;
}

#map {
  height: 438px;
  border-radius: 6px;
  background: #08110f;
  overflow: hidden;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  color: var(--text);
  background: #102522;
}

.leaflet-control-attribution {
  color: var(--muted) !important;
  background: rgba(8, 17, 15, 0.72) !important;
}

.panel {
  min-width: 0;
  padding: 14px;
}

.panel-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 8px;
}

.panel-title p {
  font-size: 13px;
}

.chart {
  height: 360px;
}

.trend-panel .chart {
  height: 390px;
}

.annual-panel {
  margin-bottom: 12px;
}

.annual-panel .chart {
  height: 460px;
}

.table-panel {
  margin-top: 12px;
}

.table-wrap {
  max-height: 320px;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 10px 9px;
  border-bottom: 1px solid rgba(160, 198, 185, 0.12);
  text-align: left;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  background: var(--panel-2);
  color: #d9ece6;
  font-weight: 620;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover,
tbody tr.active {
  background: rgba(82, 211, 207, 0.1);
}

.pos {
  color: var(--blue);
}

.neg {
  color: var(--amber);
}

@media (max-width: 1000px) {
  .header,
  .selectors {
    align-items: stretch;
    flex-direction: column;
  }

  .kpis,
  .map-trend-grid {
    grid-template-columns: 1fr;
  }

  .annual-panel .chart,
  .trend-panel .chart,
  .chart {
    height: 380px;
  }
}
