:root {
  --bg: #f3f6fa;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #637083;
  --line: #dce4ee;
  --navy: #102a46;
  --navy-2: #174064;
  --blue: #2563eb;
  --blue-soft: #eaf2ff;
  --green: #17855b;
  --green-soft: #e8f7ef;
  --amber: #b7791f;
  --amber-soft: #fff6df;
  --orange: #c75b12;
  --orange-soft: #fff0e3;
  --red: #b93b45;
  --red-soft: #fdebed;
  --purple: #6657d9;
  --purple-soft: #efedff;
  --shadow: 0 12px 32px rgba(23, 32, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

h1,
h2,
p {
  margin-top: 0;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 28px;
  padding: 26px 32px;
  color: #fff;
  background: linear-gradient(135deg, var(--navy), var(--navy-2));
  box-shadow: 0 2px 18px rgba(16, 42, 70, 0.18);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.brand-icon {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 25px;
}

.brand-block h1 {
  margin-bottom: 4px;
  font-size: 30px;
  line-height: 1.1;
  letter-spacing: 0;
}

.brand-block p {
  margin-bottom: 10px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 14px;
  line-height: 1.45;
}

.mode-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
}

.mode-badge {
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-weight: 700;
}

.header-controls {
  display: grid;
  gap: 8px;
  min-width: 270px;
}

.last-updated,
.station-select-label {
  color: rgba(255, 255, 255, 0.76);
  font-size: 12px;
}

select,
.station-search {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

select {
  padding: 0 12px;
}

.station-search {
  padding: 0 12px;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 24px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px;
}

.station-sidebar {
  position: sticky;
  top: 24px;
  align-self: start;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.sidebar-heading {
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
}

.station-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.station-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  width: 100%;
  min-height: 72px;
  padding: 12px;
  border: 1px solid transparent;
  border-left: 4px solid transparent;
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.station-button:hover,
.station-button.active {
  border-color: #bfd4f8;
  border-left-color: var(--blue);
  background: var(--blue-soft);
}

.station-code {
  display: block;
  font-weight: 850;
}

.station-city {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.station-temp {
  align-self: center;
  color: var(--navy-2);
  font-weight: 800;
  white-space: nowrap;
}

.dashboard-main {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.target-card,
.panel,
.warning-panel,
.disclaimer {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.target-card {
  display: grid;
  grid-template-columns: minmax(220px, 1.1fr) minmax(0, 2fr);
  gap: 20px;
  padding: 20px;
}

.target-station h2 {
  margin-bottom: 4px;
  font-size: 24px;
  letter-spacing: 0;
}

.target-station p,
.panel-heading p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.target-grid,
.metric-grid {
  display: grid;
  gap: 12px;
}

.target-grid {
  grid-template-columns: repeat(4, minmax(120px, 1fr));
}

.target-item,
.metric {
  padding: 14px;
  border: 1px solid #e7edf5;
  border-radius: 10px;
  background: #fbfdff;
}

.target-item span,
.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.target-item strong,
.metric strong {
  display: block;
  margin-top: 6px;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.metric-grid {
  grid-template-columns: repeat(6, minmax(140px, 1fr));
}

.current-and-recent {
  display: grid;
  grid-template-columns: minmax(260px, 0.85fr) minmax(0, 2.15fr);
  gap: 18px;
  align-items: stretch;
}

.current-card {
  display: grid;
  gap: 16px;
  min-height: 100%;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  box-shadow: var(--shadow);
}

.current-card-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.current-card h2 {
  margin-bottom: 6px;
  font-size: 17px;
}

.current-value {
  margin: 0;
  color: var(--navy);
  font-size: 42px;
  line-height: 1;
  font-weight: 850;
}

.current-meta,
.trend-copy {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.trend-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink);
  font-weight: 850;
}

.change-grid,
.recent-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.change-item,
.recent-item {
  padding: 10px;
  border: 1px solid #e7edf5;
  border-radius: 9px;
  background: #fff;
}

.change-item span,
.recent-item span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.change-item strong,
.recent-item strong {
  display: block;
  margin-top: 5px;
  font-size: 15px;
}

.metric {
  min-height: 104px;
}

.metric-icon {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-bottom: 10px;
  border-radius: 8px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 15px;
}

.panel {
  padding: 18px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  margin-bottom: 14px;
}

.panel-heading h2,
.warning-panel h2 {
  margin-bottom: 0;
  font-size: 18px;
}

.chart-wrap {
  position: relative;
  width: 100%;
  height: 340px;
  min-height: 340px;
  max-height: 340px;
  overflow: hidden;
}

.recent-chart-wrap {
  height: 360px;
  min-height: 360px;
  max-height: 360px;
}

.chart-wrap canvas {
  width: 100% !important;
  height: 100% !important;
  max-height: 100% !important;
}

.range-controls {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f7faff;
}

.range-button {
  min-width: 48px;
  min-height: 32px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
}

.range-button.active,
.range-button:hover {
  background: var(--blue);
  color: #fff;
}

.recent-summary {
  margin-top: 14px;
  grid-template-columns: repeat(7, minmax(96px, 1fr));
}

.empty-state {
  display: grid;
  place-items: center;
  height: 100%;
  min-height: 100%;
  border: 1px dashed var(--line);
  border-radius: 10px;
  color: var(--muted);
  background: #fbfdff;
  font-weight: 700;
  text-align: center;
  line-height: 1.5;
}

.chart-note {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.table-scroll {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid #e7edf5;
  text-align: left;
  font-size: 14px;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.badge.accepted,
.badge.strongly-supported {
  background: var(--green-soft);
  color: var(--green);
}

.badge.caution,
.badge.uncertain {
  background: var(--amber-soft);
  color: var(--amber);
}

.badge.insufficient-data,
.badge.not-supported {
  background: var(--orange-soft);
  color: var(--orange);
}

.badge.stale,
.badge.very-unlikely {
  background: var(--red-soft);
  color: var(--red);
}

.badge.research-provisional,
.badge.supported {
  background: var(--purple-soft);
  color: var(--purple);
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 18px;
}

.source-list {
  display: grid;
  gap: 10px;
}

.source-row {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid #e7edf5;
  border-radius: 10px;
  background: #fbfdff;
}

.provider-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--blue);
}

.provider-dot.open-meteo {
  background: var(--green);
}

.provider-dot.metar {
  background: var(--purple);
}

.provider-dot.consensus {
  background: var(--orange);
}

.source-title,
.source-value {
  font-weight: 800;
}

.source-meta {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.insight-list,
.warning-list {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.insight-list li,
.warning-list li {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  line-height: 1.45;
}

.warning-panel {
  padding: 18px;
  border-color: #f0d6ae;
  background: #fffaf0;
}

.warning-panel h2 {
  margin-bottom: 12px;
  color: #8a4b0f;
}

.disclaimer {
  padding: 15px 18px;
  color: #4f5c6f;
  background: #f8fbff;
  font-size: 14px;
}

.app-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 18px;
  padding: 20px 24px 28px;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .station-sidebar {
    position: static;
  }

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

  .metric-grid {
    grid-template-columns: repeat(3, minmax(160px, 1fr));
  }

  .current-and-recent {
    grid-template-columns: 1fr;
  }

  .recent-summary {
    grid-template-columns: repeat(4, minmax(120px, 1fr));
  }
}

@media (max-width: 820px) {
  .app-header,
  .target-card,
  .panel-heading,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .app-header,
  .panel-heading {
    display: grid;
    align-items: start;
  }

  .header-controls {
    min-width: 0;
  }

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

  .recent-heading {
    gap: 12px;
  }

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

  .chart-wrap {
    height: 280px;
    min-height: 280px;
    max-height: 280px;
  }
}

@media (max-width: 560px) {
  .app-header {
    padding: 20px;
  }

  .brand-block {
    align-items: flex-start;
  }

  .brand-icon {
    width: 40px;
    height: 40px;
  }

  .brand-block h1 {
    font-size: 24px;
  }

  .app-shell {
    padding: 14px;
  }

  .station-list,
  .target-grid,
  .metric-grid,
  .change-grid {
    grid-template-columns: 1fr;
  }

  .current-value {
    font-size: 34px;
  }

  .range-controls {
    width: 100%;
  }

  .range-button {
    flex: 1 1 42px;
  }

  .target-card,
  .panel,
  .warning-panel {
    padding: 14px;
  }
}
