:root {
  color-scheme: dark;
  --bg: #0f1110;
  --panel: #181b19;
  --panel-2: #20241f;
  --line: #343a32;
  --text: #f0f4e8;
  --muted: #a9b49d;
  --green: #44c28d;
  --blue: #6aa9d6;
  --gold: #e7b642;
  --rust: #f06d4f;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  min-height: 100%;
}

body {
  margin: 0;
  background: #0f1110;
  color: var(--text);
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(240, 244, 232, 0.12);
  background: rgba(15, 17, 16, 0.96);
}

.brand {
  min-width: 0;
}

.brand span {
  display: block;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand h1 {
  margin: 2px 0 0;
  font-size: 36px;
  line-height: 1;
  letter-spacing: 0;
}

.date-control {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
}

.date-control label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.date-control input,
.date-control button {
  min-height: 40px;
  border: 1px solid rgba(240, 244, 232, 0.15);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
}

.date-control input {
  width: 168px;
  padding: 0 10px;
}

.date-control button {
  padding: 0 16px;
  cursor: pointer;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  min-height: 0;
}

.hero {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid rgba(240, 244, 232, 0.1);
  background: #121513;
}

.stat {
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(240, 244, 232, 0.12);
  border-radius: 8px;
  background: var(--panel);
}

.stat span,
.stat em,
.source-grid span {
  display: block;
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
}

.stat strong {
  display: block;
  margin-top: 4px;
  font-size: 26px;
  line-height: 1;
  overflow-wrap: anywhere;
}

.stat em {
  margin-top: 6px;
}

.map-wrap {
  min-height: 610px;
  background: #d8d7ce;
}

.map {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 610px;
  background: #d8d7ce;
}

.leaflet-container {
  font: inherit;
}

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

.gate-tooltip {
  border: 0;
  border-radius: 8px;
  background: rgba(15, 17, 16, 0.88);
  color: var(--text);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
  font-weight: 800;
}

.gate-tooltip span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.map-fallback {
  display: grid;
  min-height: 610px;
  place-items: center;
  padding: 24px;
  color: #20241f;
  text-align: center;
}

.side {
  min-width: 0;
  overflow: auto;
  border-left: 1px solid rgba(240, 244, 232, 0.12);
  background: var(--bg);
}

.panel,
.source-panel {
  padding: 16px;
  border-bottom: 1px solid rgba(240, 244, 232, 0.1);
}

.panel h2,
.source-panel h2 {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.2;
  text-transform: uppercase;
}

.table,
.forecast,
.factor-list {
  display: grid;
  gap: 8px;
}

.gate-row,
.forecast-day {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(240, 244, 232, 0.12);
  border-radius: 8px;
  background: var(--panel);
  cursor: pointer;
}

.gate-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 11px 12px;
  text-align: left;
}

.gate-row strong,
.gate-row em {
  display: block;
}

.gate-row strong {
  line-height: 1.15;
}

.gate-row em {
  margin-top: 3px;
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
}

.gate-row b {
  font-size: 22px;
}

.gate-row.active,
.forecast-day.active {
  border-color: rgba(240, 109, 79, 0.8);
  background: rgba(240, 109, 79, 0.12);
}

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

.forecast-day {
  min-height: 74px;
  padding: 8px 6px;
  text-align: center;
}

.forecast-day span,
.forecast-day em {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.forecast-day strong {
  display: block;
  margin: 5px 0;
  font-size: 16px;
}

.factor-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(240, 244, 232, 0.09);
}

.factor-row span {
  color: var(--muted);
}

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

.source-grid div {
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(240, 244, 232, 0.1);
  border-radius: 8px;
  background: var(--panel);
}

.source-grid strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.source-panel p {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.45;
}

.source-panel a {
  color: var(--green);
  text-decoration: none;
}

.empty {
  padding: 24px;
}

@media (max-width: 1120px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .side {
    border-left: 0;
    border-top: 1px solid rgba(240, 244, 232, 0.12);
  }

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

@media (max-width: 680px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .date-control {
    align-items: stretch;
  }

  .date-control label {
    flex: 1 1 180px;
  }

  .date-control input,
  .date-control button {
    width: 100%;
  }

  .stats,
  .forecast,
  .source-grid {
    grid-template-columns: 1fr;
  }

  .brand h1 {
    font-size: 28px;
  }

  .stat strong {
    font-size: 22px;
  }

}
