.history-page {
  min-height: 100svh;
  background:
    radial-gradient(circle at 22% 8%, rgba(81, 189, 255, 0.36), transparent 34%),
    linear-gradient(180deg, #061942 0%, #0a2f68 48%, #06315c 100%);
  color: #eaf7ff;
}

.history-shell {
  min-height: 100svh;
  padding-bottom: calc(var(--nav-height) + 18px + env(safe-area-inset-bottom));
}

.history-hero {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  padding: 18px 18px 16px;
  margin-bottom: 12px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.94), rgba(232, 247, 255, 0.86)),
    radial-gradient(circle at 80% 0%, rgba(0, 191, 255, 0.26), transparent 36%);
  box-shadow: 0 18px 36px rgba(0, 21, 65, 0.22);
}

.history-kicker {
  margin: 0 0 4px;
  color: #1977d2;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.history-hero h1 {
  margin: 0;
  color: #061942;
  font-size: 27px;
  line-height: 1.02;
  letter-spacing: -0.04em;
}

.history-hero p:last-child {
  margin: 7px 0 0;
  color: rgba(6, 25, 66, 0.68);
  font-size: 13px;
  font-weight: 800;
}

.history-pill {
  flex: 0 0 auto;
  padding: 7px 9px;
  border-radius: 999px;
  background: rgba(25, 119, 210, 0.12);
  color: #0b5eaa;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.history-summary {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.summary-card {
  min-width: 0;
  padding: 12px 10px 10px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 14px 26px rgba(0, 21, 65, 0.16);
  color: #061942;
  overflow: hidden;
}

.summary-card span,
.summary-card small {
  display: block;
  color: rgba(6, 25, 66, 0.56);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.summary-card strong {
  display: block;
  margin: 5px 0 3px;
  font-size: 21px;
  line-height: 1;
  letter-spacing: -0.04em;
  white-space: nowrap;
}

.summary-pool {
  background: linear-gradient(145deg, rgba(255,255,255,0.96), rgba(215,244,255,0.95));
}

.history-chart-card {
  padding: 15px 12px 12px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 22px 42px rgba(0, 21, 65, 0.22);
  overflow: hidden;
}

.chart-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 0 4px 12px;
}

.chart-head h2 {
  margin: 0;
  color: #061942;
  font-size: 18px;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.chart-head p {
  margin: 5px 0 0;
  color: rgba(6, 25, 66, 0.58);
  font-size: 11px;
  font-weight: 800;
}

.legend {
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: flex-end;
  color: #061942;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.legend span {
  position: relative;
  padding-left: 16px;
}

.legend span::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  transform: translateY(-50%);
}

.legend-pool::before { background: #0784ff; }
.legend-air::before { background: #ff9f1a; }

.range-switch {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  margin: 0 0 10px;
  padding: 5px;
  border-radius: 999px;
  background: rgba(6, 25, 66, 0.08);
}

.range-switch button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 9px 8px;
  background: transparent;
  color: rgba(6, 25, 66, 0.64);
  font: 900 11px system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  text-transform: uppercase;
  cursor: pointer;
}

.range-switch button.active {
  background: #ffffff;
  color: #0876d8;
  box-shadow: 0 8px 18px rgba(0, 71, 150, 0.18);
}

.chart-scroll {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(240, 249, 255, 0.98), rgba(255, 255, 255, 0.98));
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.chart-canvas-wrap {
  height: 430px;
  min-width: 100%;
}

#temperatureChart {
  display: block;
  width: 100%;
  height: 430px;
}

.chart-note {
  margin-top: 10px;
  color: rgba(6, 25, 66, 0.62);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

@media (max-width: 390px) {
  .history-summary { gap: 6px; }
  .summary-card { padding-left: 8px; padding-right: 8px; }
  .summary-card strong { font-size: 19px; }
  .history-hero h1 { font-size: 25px; }
}

/* V25 Design-Veredelung: weichere Karten, einheitliche Seitenfamilie */
.history-shell {
  width: 100%;
  max-width: var(--page-max-width);
  padding: var(--screen-pad) var(--screen-pad) calc(var(--nav-height) + 18px + env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 50% -5%, rgba(88, 197, 255, 0.32), transparent 29%),
    radial-gradient(circle at 10% 32%, rgba(19, 123, 255, 0.22), transparent 30%),
    linear-gradient(180deg, #020814 0%, #061942 28%, #0a2f68 68%, #031831 100%);
  overflow: hidden;
}

.history-shell::before {
  content: "";
  position: fixed;
  inset: 0;
  max-width: var(--page-max-width);
  margin: 0 auto;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.026) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255,255,255,0.022) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(180deg, black, transparent 74%);
  pointer-events: none;
}

.history-hero,
.history-chart-card,
.summary-card {
  border: 1px solid rgba(255, 255, 255, 0.56);
  backdrop-filter: blur(8px);
}

.history-hero {
  min-height: 112px;
  align-items: center;
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at 92% 10%, rgba(45, 190, 255, 0.28), transparent 34%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.97), rgba(224, 246, 255, 0.88));
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.history-hero::after {
  content: "";
  position: absolute;
  right: -22px;
  bottom: -30px;
  width: 118px;
  height: 118px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(7, 132, 255, 0.16), transparent 66%);
}

.history-pill {
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.65), 0 8px 18px rgba(0, 71, 150, 0.12);
}

.summary-card {
  border-radius: var(--radius-lg);
  background: rgba(247, 252, 255, 0.92);
  box-shadow: var(--shadow-soft);
}

.history-chart-card {
  border-radius: var(--radius-xl);
  background: rgba(247, 252, 255, 0.94);
  box-shadow: var(--shadow-card);
}

.range-switch {
  background: rgba(6, 25, 66, 0.075);
  box-shadow: inset 0 1px 2px rgba(6, 25, 66, 0.08);
}

.chart-scroll {
  border: 1px solid rgba(6, 25, 66, 0.07);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.82);
}


/* V31 kleinere Radien: nur Optik, keine Datenlogik */
.history-page,
.chem-page,
.alarm-page {
  background: #01050d;
}

.history-shell,
.chem-shell,
.alarm-shell {
  border-radius: 0;
  background:
    radial-gradient(circle at 50% -8%, rgba(91, 201, 255, 0.45), transparent 31%),
    radial-gradient(circle at 0% 34%, rgba(19, 123, 255, 0.25), transparent 32%),
    radial-gradient(circle at 100% 54%, rgba(42, 238, 143, 0.13), transparent 33%),
    linear-gradient(180deg, #020814 0%, #061942 30%, #0a2f68 70%, #031831 100%) !important;
}

.history-hero,
.chem-hero,
.alarm-hero {
  min-height: 128px !important;
  padding: 22px 20px 20px !important;
  margin-bottom: 14px !important;
  border-radius: 18px !important;
  border: 1px solid rgba(255, 255, 255, 0.72) !important;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.98) 0%, rgba(234,248,255,0.93) 58%, rgba(204,238,255,0.82) 100%) !important;
  box-shadow:
    0 24px 54px rgba(0, 8, 28, 0.34),
    inset 0 1px 0 rgba(255,255,255,0.88) !important;
  backdrop-filter: blur(12px) !important;
}

.alarm-hero {
  background:
    linear-gradient(135deg, rgba(255,255,255,0.98) 0%, rgba(255,246,236,0.94) 58%, rgba(255,221,196,0.82) 100%) !important;
}

.chem-hero {
  background:
    linear-gradient(135deg, rgba(255,255,255,0.98) 0%, rgba(235,251,255,0.94) 58%, rgba(211,252,232,0.82) 100%) !important;
}

.history-hero::before,
.chem-hero::before,
.alarm-hero::before {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  top: 12px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.95), transparent);
}

.history-kicker,
.chem-kicker,
.alarm-kicker {
  display: inline-flex;
  padding: 5px 9px;
  margin-bottom: 8px !important;
  border-radius: 999px;
  background: rgba(8, 118, 216, 0.11);
}

.alarm-kicker { background: rgba(216, 91, 31, 0.12); }
.chem-kicker { background: rgba(23, 166, 83, 0.11); }

.history-hero h1,
.chem-hero h1,
.alarm-hero h1 {
  font-size: 30px !important;
  letter-spacing: -0.055em !important;
}

.history-pill,
.chem-pill,
.alarm-pill,
.alarm-filter-pill {
  padding: 9px 12px !important;
  border: 1px solid rgba(255,255,255,0.72);
  background: rgba(255,255,255,0.58) !important;
  backdrop-filter: blur(8px);
}

.history-summary,
.chem-summary,
.alarm-summary {
  gap: 10px !important;
  margin-bottom: 14px !important;
}

.summary-card,
.chem-summary-card,
.alarm-summary-card {
  border-radius: 16px !important;
  padding: 14px 11px 12px !important;
  border: 1px solid rgba(255,255,255,0.66) !important;
  background: rgba(248, 253, 255, 0.94) !important;
  box-shadow:
    0 16px 34px rgba(0, 8, 28, 0.22),
    inset 0 1px 0 rgba(255,255,255,0.78) !important;
}

.summary-pool,
.chem-summary-ph,
.chem-summary-redox,
.alarm-summary-active {
  background:
    radial-gradient(circle at 100% 0%, rgba(31, 184, 255, 0.18), transparent 45%),
    rgba(248, 253, 255, 0.96) !important;
}

.chem-summary-redox {
  background:
    radial-gradient(circle at 100% 0%, rgba(42, 238, 143, 0.20), transparent 45%),
    rgba(248, 253, 255, 0.96) !important;
}

.alarm-summary-active {
  background:
    radial-gradient(circle at 100% 0%, rgba(255, 125, 80, 0.22), transparent 45%),
    rgba(248, 253, 255, 0.96) !important;
}

.history-chart-card,
.chem-chart-card,
.alarm-list-card {
  border-radius: 20px !important;
  padding: 18px 15px 15px !important;
  border: 1px solid rgba(255,255,255,0.70) !important;
  background: rgba(248, 253, 255, 0.95) !important;
  box-shadow:
    0 26px 58px rgba(0, 8, 28, 0.34),
    inset 0 1px 0 rgba(255,255,255,0.85) !important;
  backdrop-filter: blur(12px) !important;
}

.chart-head,
.chem-chart-head,
.alarm-list-head {
  padding: 1px 5px 14px !important;
}

.chart-head h2,
.chem-chart-head h2,
.alarm-list-head h2 {
  font-size: 21px !important;
}

.range-switch,
.alarm-filter {
  padding: 6px !important;
  border-radius: 16px !important;
  background: rgba(6, 25, 66, 0.075) !important;
  border: 1px solid rgba(6, 25, 66, 0.06);
}

.range-switch button,
.alarm-filter button {
  border-radius: 12px !important;
}

.chart-scroll,
.chem-chart-scroll {
  border-radius: 18px !important;
  border: 1px solid rgba(6, 25, 66, 0.08) !important;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.92),
    0 10px 24px rgba(0, 24, 62, 0.10) !important;
}

.alarm-event {
  border-radius: 16px !important;
  padding: 13px 12px !important;
  background: rgba(6, 25, 66, 0.045) !important;
  border: 1px solid rgba(6, 25, 66, 0.08) !important;
}

.alarm-event.active {
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.13), rgba(255,255,255,0.50)) !important;
}

/* V32: fixe Y-Skala links, Diagramm rechts horizontal scrollbar */
.chart-frame {
  display: flex;
  width: 100%;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid rgba(6, 25, 66, 0.08);
  background: linear-gradient(180deg, rgba(240, 249, 255, 0.98), rgba(255, 255, 255, 0.98));
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.92),
    0 10px 24px rgba(0, 24, 62, 0.10);
}

.chart-y-axis {
  flex: 0 0 44px;
  width: 44px;
  height: 350px;
  display: block;
  background: linear-gradient(180deg, rgba(240, 249, 255, 0.98), rgba(255, 255, 255, 0.98));
  border-right: 1px solid rgba(6, 25, 66, 0.08);
  z-index: 2;
}

.chart-frame .chart-scroll {
  flex: 1 1 auto;
  min-width: 0;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: transparent;
}

.chart-frame .chart-canvas-wrap {
  height: 350px;
}

.chart-frame #temperatureChart {
  height: 350px;
}
