:root {
  --bg: #EDEBE6;
  --surface: #F4F2EE;
  --text: #1C1C1E;
  --muted: #96959A;
  --cyan: #5FA8B8;
  --axis: #8FA3AC;
  --grid: #DCDAD4;
  --scale: #A6A49E;
  --low: #8B96C9;
  --alert: #E0A868;
  --evac: #C1443B;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 520px;
  margin: 0 auto;
  padding: 20px;
}

.mono { font-family: Consolas, Menlo, monospace; }

/* ---------- header ---------- */
.head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 30px 0 0;
  padding-left: 20px;
}
.station {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.iconbtn {
  border: none;
  background: var(--surface);
  color: var(--muted);
  font-size: 16px;
  padding: 4px 8px;
  border-radius: 8px;
  cursor: pointer;
  line-height: 1;
}
.iconbtn:hover { background: #e6e3da; }
#btnChange { font-size: 16px; }
#btnInstall { font-size: 20px; margin-left: 2px; }

/* ---------- valor ---------- */
.value-row {
  display: flex;
  align-items: flex-end;
  padding-left: 20px;
  margin-top: 8px;
}
.value { font-size: 56px; font-weight: 700; line-height: 1; }
.unit { color: var(--muted); font-size: 18px; margin-left: 6px; margin-bottom: 6px; }
.updated { color: var(--muted); font-size: 11px; padding-left: 20px; margin-top: 4px; }
.fc-stack { display: flex; flex-direction: column; gap: 5px; margin-left: 14px; margin-bottom: 2px; }
.fc-line { display: flex; align-items: baseline; gap: 4px; }
.fc-delta { font-size: 15px; font-weight: 700; color: var(--text); }
.fc-days { font-size: 10px; color: var(--muted); }

/* ---------- charts ---------- */
.chart-title {
  font-size: 14px;
  font-weight: 700;
  margin: 36px 0 0;
  padding-left: 20px;
}
.chart-sub {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
  margin: 3px 0 0;
  padding-left: 20px;
}
.chart {
  margin-top: 10px;
}
.chart svg {
  display: block;
  width: 100%;
  height: auto;
}
.chart svg text {
  font-family: "Segoe UI", system-ui, sans-serif;
}

/* ---------- botones máx/mín históricos ---------- */
.histo {
  margin-top: 12px;
}
.histo-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  flex-wrap: nowrap;
}
.histo-kind {
  width: 30px;
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}
.histo-btn {
  flex: 1;
  border: 1px solid var(--grid);
  background: var(--surface);
  color: var(--muted);
  border-radius: 14px;
  padding: 4px 4px;
  font-size: 11px;
  cursor: pointer;
  white-space: nowrap;
}
.histo-btn:hover { background: #e6e3da; }
.histo-btn.active {
  background: var(--text);
  color: #fff;
  border-color: var(--text);
}

/* ---------- footer ---------- */
.sources {
  color: var(--muted);
  font-size: 11px;
  margin: 24px 0 40px;
  padding-left: 20px;
}

/* ---------- dialog estaciones ---------- */
dialog {
  border: none;
  border-radius: 14px;
  background: var(--surface);
  padding: 20px;
  max-width: 360px;
  width: 90%;
  box-shadow: 0 8px 30px rgba(28,28,30,.15);
}
dialog::backdrop { background: rgba(28,28,30,.4); }
dialog h3 { margin: 0 0 12px; font-size: 16px; }
.station-opt {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: none;
  padding: 10px 8px;
  font-size: 15px;
  color: var(--text);
  border-bottom: 1px solid var(--grid);
  cursor: pointer;
}
.station-opt:hover { background: #e6e3da; }
.dismiss {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 10px;
  border: none;
  background: var(--grid);
  color: var(--text);
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}