:root {
  --bg: #f4f7f8;
  --surface: #ffffff;
  --surface-soft: #eef4f5;
  --border: #d6e1e4;
  --text: #162127;
  --muted: #5f6f76;
  --accent: #087f8c;
  --accent-strong: #05616b;
  --warning: #ad6b00;
  --danger: #b42318;
  --blue: #2364aa;
  --red: #b42318;
  --green: #2f7d32;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

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

button,
input,
select {
  font: inherit;
}

.hourly-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.hourly-header h1 {
  margin: 2px 0 0;
  font-size: 1.35rem;
}

.hourly-header p {
  margin: 4px 0 0;
  color: var(--muted);
}

.back-link {
  color: var(--accent);
  font-size: .85rem;
  font-weight: 700;
  text-decoration: none;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.secondary-action,
.primary-action,
.quick-row button {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
  padding: 9px 12px;
}

.primary-action {
  width: 100%;
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.secondary-action:hover,
.quick-row button:hover {
  border-color: var(--accent);
}

.primary-action:hover {
  background: var(--accent-strong);
}

.status-pill {
  min-width: 128px;
  border-radius: 999px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: .85rem;
  font-weight: 800;
  padding: 8px 12px;
  text-align: center;
}

.status-pill.loading {
  color: var(--warning);
}

.status-pill.error {
  color: var(--danger);
}

.hourly-shell {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  gap: 22px;
  padding: 22px;
}

.filters {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.filter-section,
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.filter-section {
  padding: 16px;
}

.filter-section h2,
.panel h2,
.chart-panel h3 {
  margin: 0;
}

.filter-section h2 {
  margin-bottom: 14px;
  font-size: .95rem;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 700;
}

input[type="search"],
input[type="date"],
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  padding: 9px 10px;
}

input:focus,
select:focus {
  border-color: var(--accent);
  outline: 2px solid rgba(8, 127, 140, .14);
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.checkbox-row input {
  width: 16px;
  height: 16px;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.quick-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 14px 0;
}

.station-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  max-height: 420px;
  overflow: auto;
}

.station-option {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  padding: 10px;
  text-align: left;
}

.station-option.active {
  border-color: var(--accent);
  background: #e6f4f5;
}

.station-option strong {
  display: block;
  font-size: .92rem;
}

.station-option span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: .76rem;
}

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

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
}

.kpi {
  min-height: 96px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
}

.kpi span {
  color: var(--muted);
  font-size: .78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.kpi strong {
  display: block;
  margin-top: 8px;
  font-size: 1.55rem;
  line-height: 1.1;
}

.kpi small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
}

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

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

.panel-title h2 {
  font-size: 1rem;
}

.panel-title span,
.source-legend {
  color: var(--muted);
  font-size: .82rem;
}

.source-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.source-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: .74rem;
  font-weight: 800;
  padding: 3px 8px;
  white-space: nowrap;
}

.source-pill.provisional {
  border-color: #f3bf6b;
  background: #fff7e8;
  color: var(--warning);
}

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

.chart-panel {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbfb 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8);
}

.chart-panel.wide {
  grid-column: span 2;
}

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

.chart-panel h3 {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: .86rem;
}

.svg-chart {
  position: relative;
  width: 100%;
  height: 240px;
}

.svg-chart.large {
  height: 340px;
}

.svg-chart svg {
  display: block;
  width: 100%;
  height: 100%;
}

.chart-canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.chart-empty {
  display: grid;
  place-items: center;
  height: 100%;
  color: var(--muted);
  font-size: .9rem;
}

.table-wrap {
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.table-wrap.tall {
  max-height: 620px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .86rem;
}

th,
td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: .74rem;
  text-transform: uppercase;
}

tbody tr:hover {
  background: #f7fbfb;
}

.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.compact-action {
  width: auto;
  min-width: 92px;
  padding: 7px 10px;
}

.hourly-detail-panel.collapsed {
  padding-bottom: 10px;
}

.hourly-detail-panel.collapsed .table-wrap {
  display: none;
}

.empty {
  padding: 18px;
  color: var(--muted);
  text-align: center;
}

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

.text-red {
  color: var(--red);
}

.delta {
  font-weight: 800;
}

.delta.positive {
  color: var(--red);
}

.delta.negative {
  color: var(--blue);
}

.delta.neutral {
  color: var(--muted);
}

.kpi .delta-badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 6px;
  font-weight: 800;
  font-size: .8rem;
  white-space: nowrap;
  text-transform: none;
}

.delta-badge.positive {
  background: #fdecea;
  color: var(--red);
}

.delta-badge.negative {
  background: #e8f1fb;
  color: var(--blue);
}

.delta-badge.neutral {
  background: var(--surface-soft);
  color: var(--muted);
}

.kpi small {
  line-height: 1.6;
}

/* Consolidated daily table: tint rows by data source, flag provisional days. */
tbody tr[data-source="climatologie"] {
  background: rgba(8, 127, 140, .04);
}

tbody tr[data-source="hourly"],
tbody tr[data-source="hourly+radome"] {
  background: rgba(35, 100, 170, .05);
}

tbody tr[data-source="radome"] {
  background: rgba(173, 107, 0, .05);
}

tbody tr[data-provisional="1"] td:first-child {
  box-shadow: inset 3px 0 0 var(--warning);
}

tbody tr[data-source]:hover {
  background: #f0f7f8;
}

.compact-select {
  width: 130px;
}

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

  .filters {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

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

  .chart-panel.wide {
    grid-column: 1 / -1;
  }
}

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

  .hourly-shell {
    padding: 14px;
  }

  .filters,
  .chart-grid,
  .lab-grid,
  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }
}
