:root {
  --bg: #f2f7f8;
  --card: #ffffff;
  --ink: #12303c;
  --muted: #566f7a;
  --accent: #0788a9;
  --accent-deep: #075d72;
  --ok: #0f6f4a;
  --ok-bg: #e4f6ee;
  --warn: #925b0d;
  --warn-bg: #fff4dc;
  --bad: #b93c3c;
  --bad-bg: #ffeded;
  --line: #e1ebee;
  --radius: 20px;
  --shadow: 0 2px 4px rgba(16, 55, 66, .03), 0 12px 32px rgba(16, 55, 66, .07);
  --shadow-lift: 0 4px 8px rgba(16, 55, 66, .05), 0 18px 38px rgba(16, 55, 66, .11);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background:
    radial-gradient(700px 360px at 100% 30%, rgba(8, 145, 178, .045), transparent 70%),
    var(--bg);
  color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button { -webkit-tap-highlight-color: transparent; }
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 24px; }
.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.site-header { padding: 20px 0 0; color: #fff; }
.pool-hero {
  position: relative; height: 245px; overflow: hidden; border-radius: 24px;
  background: #073b4c; box-shadow: 0 16px 38px rgba(8,43,54,.16);
}
.pool-hero-image {
  display: block; width: 100%; height: 100%; object-fit: cover; object-position: center 58%;
}
.pool-hero-shade {
  position: absolute; inset: 0;
  background:
    linear-gradient(90deg, rgba(3,24,33,.70) 0%, rgba(3,27,36,.38) 48%, rgba(3,25,34,.10) 100%),
    linear-gradient(0deg, rgba(3,24,33,.45) 0%, transparent 48%);
}
.header-row {
  position: absolute; inset: 0; z-index: 1; display: flex; align-items: flex-start;
  justify-content: space-between; gap: 24px; padding: 27px 28px;
}
.hero-location {
  position: absolute; z-index: 1; left: 28px; bottom: 22px;
  display: flex; align-items: center; gap: 7px; color: #f0fafb;
  font-size: 12px; font-weight: 650; text-shadow: 0 1px 3px rgba(0,0,0,.65);
}
.hero-location > span:first-child {
  width: 6px; height: 6px; border-radius: 50%; background: #74e5c1;
  box-shadow: 0 0 0 4px rgba(116,229,193,.13);
}
.brand { display: flex; align-items: center; gap: 17px; min-width: 0; }
.brand-mark {
  display: grid; place-items: center; flex: 0 0 58px; height: 58px;
  color: #d9fbff; border: 1px solid rgba(255,255,255,.22);
  border-radius: 18px; background: rgba(255,255,255,.10);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.14);
  backdrop-filter: blur(10px);
}
.brand-mark svg { width: 34px; height: 34px; }
.eyebrow {
  margin: 0 0 2px; color: #93e4ed; font-size: 10px; line-height: 1.4;
  font-weight: 800; letter-spacing: 2.4px;
}
.site-header h1 {
  margin: 0; font-size: 34px; line-height: 1.2; letter-spacing: -.8px;
  font-weight: 720; text-transform: capitalize;
}
.subtitle { margin: 6px 0 0; color: rgba(239,252,253,.92); font-size: 13px; text-shadow: 0 1px 3px rgba(0,0,0,.4); }
.status-pill {
  display: inline-flex; align-items: center; gap: 9px; flex: none;
  background: rgba(3, 30, 40, .62); border: 1px solid rgba(255,255,255,.24);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.07);
  backdrop-filter: blur(10px); padding: 10px 15px; border-radius: 12px;
  color: rgba(255,255,255,.92); font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
.status-pill .dot {
  width: 8px; height: 8px; border-radius: 50%; background: #fbbf24;
  box-shadow: 0 0 0 4px rgba(251,191,36,.12);
}
.status-pill.ok .dot { background: #55e8ae; box-shadow: 0 0 0 4px rgba(85,232,174,.12); }
.status-pill.bad .dot { background: #ff8888; box-shadow: 0 0 0 4px rgba(255,136,136,.12); }
main { position: relative; margin-top: 0; padding: 26px 0 40px; }
.notice {
  background: #fff8e9; border: 1px solid #f1d69b; color: #86530d;
  box-shadow: var(--shadow); padding: 14px 18px; border-radius: 15px;
  margin-bottom: 18px; font-size: 14px;
}
.section-heading {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 18px; margin: 0 2px 19px; color: var(--ink);
}
.section-heading h2 { margin: 0; font-size: 20px; line-height: 1.3; letter-spacing: -.25px; }
.section-heading p { margin: 4px 0 0; color: var(--muted); font-size: 12.5px; }
.title-with-live { display: flex; align-items: center; gap: 11px; }
.live-label {
  display: inline-flex; align-items: center; gap: 5px; color: #0d7352;
  font-size: 9px; font-weight: 800; letter-spacing: 1.1px;
}
.live-label .live-dot {
  width: 5px; height: 5px; border-radius: 50%; background: #159d70;
  box-shadow: 0 0 0 3px rgba(21,157,112,.12);
}
.update-note { color: var(--muted); font-size: 11.5px; padding-bottom: 2px; }

.cards { display: grid; gap: 15px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card {
  position: relative; min-width: 0; overflow: hidden;
  background: var(--card); border: 1px solid rgba(218,232,236,.85);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 17px 18px 16px;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.card::after {
  content: ""; position: absolute; width: 90px; height: 90px; right: -50px; top: -50px;
  border-radius: 50%; background: var(--state-soft, #edf5f7); opacity: .7;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); border-color: #d2e3e8; }
.card.ok { --state: var(--ok); --state-soft: var(--ok-bg); }
.card.warn { --state: var(--warn); --state-soft: var(--warn-bg); }
.card.bad { --state: var(--bad); --state-soft: var(--bad-bg); }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.metric-icon {
  display: grid; place-items: center; width: 34px; height: 34px;
  color: var(--accent-deep); background: #edf7f8; border-radius: 11px;
}
.metric-icon svg { width: 19px; height: 19px; }
.source {
  display: inline-flex; align-items: center; gap: 5px; color: var(--muted);
  font-size: 9.5px; font-weight: 700; letter-spacing: .45px; text-transform: uppercase;
}
.source::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: #0796bd; }
.source.manual::before { background: #d89432; }
.card .label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.card .value {
  font-size: 32px; line-height: 1.25; font-weight: 730; margin: 2px 0 15px;
  color: #102f3b; font-variant-numeric: tabular-nums; letter-spacing: -1px;
  white-space: nowrap;
}
.card .value .unit {
  font-size: 13px; font-weight: 600; color: var(--muted); margin-left: 4px; letter-spacing: 0;
}
.ideal-row {
  display: flex; justify-content: space-between; gap: 6px; color: var(--muted);
  font-size: 10.5px; line-height: 1.4;
}
.ideal-row strong { color: #49636e; font-weight: 650; font-variant-numeric: tabular-nums; }
.range-bar {
  position: relative; height: 5px; margin: 8px 0 14px; border-radius: 99px;
  background: #edf2f4;
}
.ideal-zone { position: absolute; top: 0; bottom: 0; border-radius: 99px; background: #a9e4cd; }
.range-marker {
  position: absolute; top: 50%; width: 11px; height: 11px; border-radius: 50%;
  background: var(--state, var(--accent)); border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(15,48,58,.25); transform: translate(-50%, -50%);
}
.card-bottom { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.card .meta { min-width: 0; font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge {
  display: inline-flex; align-items: center; flex: none; font-size: 9px; font-weight: 800;
  letter-spacing: .45px; padding: 3px 7px; border-radius: 99px; text-transform: uppercase;
}
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.card.placeholder { grid-column: 1 / -1; color: var(--muted); text-align: center; padding: 38px; }
.card.placeholder::after { display: none; }

.history-section { margin-top: 35px; }
.charts-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 18px; margin-bottom: 17px; padding: 0 2px;
}
.section-kicker { margin: 0 0 2px; color: var(--accent); font-size: 9.5px; font-weight: 800; letter-spacing: 1.5px; }
.charts-head h2 { margin: 0; font-size: 23px; line-height: 1.3; letter-spacing: -.45px; }
.charts-subtitle { display: inline-block; margin: 4px 0 0; color: var(--muted); font-size: 12.5px; }
.table-view-link { display: inline-block; margin-left: 10px; color: var(--accent-deep); font-size: 11.5px; font-weight: 700; text-decoration: none; }
.table-view-link:hover { text-decoration: underline; }
.chart-toolbar { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 9px; }
.zoom-btns { display: inline-flex; gap: 3px; padding: 3px; border: 1px solid #dfe9ec; border-radius: 11px; background: #e7eff1; }
.zoom-btns button { min-width: 30px; height: 30px; padding: 0 7px; border: 0; border-radius: 7px;
  color: var(--accent-deep); background: transparent; font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.zoom-btns button:hover { background: #fff; }
.zoom-btns button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.zoom-btns .zoom-reset { min-width: 48px; font-size: 10px; }
.range-btns {
  display: inline-flex; flex: none; background: #e7eff1; border: 1px solid #dfe9ec;
  border-radius: 12px; padding: 4px;
}
.range-btns button {
  border: 0; background: transparent; min-width: 48px; padding: 7px 13px; border-radius: 8px;
  font: inherit; font-size: 12px; font-weight: 700; color: var(--muted); cursor: pointer;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}
.range-btns button:hover { color: var(--ink); }
.range-btns button.active { background: #fff; color: var(--accent-deep); box-shadow: 0 2px 7px rgba(20,62,74,.10); }
.range-btns button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.charts-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px; }
.chart-card {
  min-width: 0; background: var(--card); border: 1px solid rgba(218,232,236,.85);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 19px 18px 12px;
}
.chart-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.chart-card h3 { margin: 0; font-size: 14.5px; line-height: 1.4; font-weight: 700; }
.chart-card .unit { color: var(--muted); font-size: 11.5px; font-weight: 500; margin-left: 3px; }
.src-legend { display: flex; flex: none; gap: 11px; font-size: 9.5px; color: var(--muted); font-weight: 600; padding-top: 3px; }
.src-legend span { display: inline-flex; align-items: center; gap: 5px; }
.src-legend i { display: inline-block; width: 13px; height: 3px; border-radius: 2px; }
.src-legend .manual-line {
  height: 0; border-top: 2px dashed #d89432; border-radius: 0; background: transparent !important;
}
.range-legend { display: flex; gap: 12px; margin-top: 7px; color: var(--muted); font-size: 9px; font-weight: 600; }
.range-legend span { display: inline-flex; align-items: center; gap: 4px; }
.range-legend i { width: 10px; height: 7px; border-radius: 2px; }
.range-legend .ok-zone { background: rgba(22,135,93,.22); }
.range-legend .warn-zone { background: rgba(224,161,67,.28); }
.range-legend .bad-zone { background: rgba(185,60,60,.20); }
.chart-box { margin-top: 6px; }
.chart-empty {
  display: grid; place-items: center; min-height: 180px; color: var(--muted);
  font-size: 12.5px; text-align: center; background: #f8fbfc; border-radius: 12px;
}
.plot-legend { margin-top: 5px; padding: 8px 4px 1px; border-top: 1px solid var(--line); }
.plot-time { margin-bottom: 5px; color: var(--muted); font-size: 10.5px; font-variant-numeric: tabular-nums; }
.plot-readings { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.plot-reading { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 10.5px; }
.plot-reading i { width: 10px; height: 3px; border-radius: 2px; }
.plot-reading strong { margin-left: 2px; color: var(--ink); font-size: 11px; font-variant-numeric: tabular-nums; }
.u-over { border-radius: 8px; }

.footer {
  display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  color: var(--muted); font-size: 11.5px; margin-top: 30px;
  border-top: 1px solid var(--line); padding: 18px 2px 0;
}

@media (min-width: 1500px) {
  .wrap { max-width: 1200px; }
}
@media (max-width: 980px) {
  .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .charts-grid { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .wrap { padding: 0 16px; }
  .site-header { padding: 14px 0 0; }
  .pool-hero { height: 260px; border-radius: 20px; }
  .pool-hero-image { object-position: 58% center; }
  .pool-hero-shade {
    background: linear-gradient(180deg, rgba(3,24,33,.60) 0%, rgba(3,24,33,.10) 48%, rgba(3,24,33,.48) 100%);
  }
  .header-row { padding: 20px; }
  .hero-location { left: 20px; bottom: 18px; }
  .header-row { align-items: flex-start; gap: 16px; flex-wrap: wrap; }
  .brand-mark { flex-basis: 48px; height: 48px; border-radius: 15px; }
  .brand-mark svg { width: 29px; height: 29px; }
  .site-header h1 { font-size: 28px; }
  .status-pill { margin-left: 65px; padding: 7px 11px; font-size: 11px; }
  main { margin-top: 0; padding-top: 22px; }
  .section-heading { align-items: flex-start; }
  .update-note { padding-top: 4px; text-align: right; max-width: 130px; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .card { padding: 14px; border-radius: 17px; }
  .card-top { margin-bottom: 12px; }
  .card .value { font-size: 29px; }
  .charts-head { align-items: flex-end; }
  .charts-subtitle { max-width: 210px; }
  .range-btns button { min-width: 40px; padding: 7px 9px; }
}
@media (max-width: 430px) {
  .brand { gap: 12px; }
  .eyebrow { font-size: 9px; }
  .site-header h1 { font-size: 25px; }
  .subtitle { font-size: 11.5px; }
  .status-pill { margin-left: 60px; }
  .section-heading h2 { font-size: 17px; }
  .section-heading p { font-size: 11px; }
  .title-with-live { gap: 7px; }
  .update-note { font-size: 10px; max-width: 100px; }
  .metric-icon { width: 30px; height: 30px; border-radius: 9px; }
  .source { font-size: 8px; letter-spacing: .25px; }
  .card .label { font-size: 11.5px; }
  .card .value { font-size: 26px; margin-bottom: 13px; letter-spacing: -.7px; }
  .card .value .unit { font-size: 11px; }
  .card .meta { font-size: 9px; }
  .badge { font-size: 8px; padding: 3px 6px; }
  .ideal-row { font-size: 9.5px; }
  .charts-head { flex-direction: column; align-items: stretch; gap: 13px; }
  .charts-subtitle { max-width: none; }
  .chart-toolbar { justify-content: flex-start; }
  .range-btns { align-self: flex-start; }
  .chart-card { padding: 16px 10px 10px; }
  .chart-title { padding: 0 6px; }
  .src-legend { gap: 7px; font-size: 8.5px; }
}
@media (prefers-reduced-motion: reduce) {
  .card, .range-btns button { transition: none; }
}

.header-tools { display: flex; align-items: center; gap: 11px; flex: none; }
.language-picker {
  display: flex; align-items: center; gap: 7px; position: relative;
  color: rgba(240,252,253,.95); background: rgba(3,30,40,.58);
  border: 1px solid rgba(255,255,255,.17); border-radius: 11px; padding: 0 9px;
}
.language-picker svg { width: 16px; height: 16px; flex: none; }
.language-picker select {
  appearance: none; border: 0; outline: 0; cursor: pointer; color: inherit;
  background: transparent; font: inherit; font-size: 12px; font-weight: 600;
  padding: 9px 14px 9px 0; max-width: 90px;
}
.language-picker::after {
  content: ""; position: absolute; right: 9px; top: 50%; width: 5px; height: 5px;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: translateY(-70%) rotate(45deg); pointer-events: none;
}
.language-picker select option { color: #12303c; background: #fff; }
.language-picker:focus-within { outline: 2px solid #93e4ed; outline-offset: 2px; }

.guide-section { margin-top: 40px; }
.guide-heading { margin: 0 2px 18px; }
.guide-heading h2 { margin: 0; font-size: 23px; line-height: 1.3; letter-spacing: -.45px; }
.guide-heading > p:last-child { margin: 5px 0 0; color: var(--muted); font-size: 12.5px; }
.guide-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; align-items: start; }
.guide-card {
  min-width: 0; background: #fff; border: 1px solid rgba(218,232,236,.9);
  border-radius: 17px; box-shadow: 0 4px 18px rgba(16,55,66,.04); overflow: hidden;
}
.guide-card summary {
  display: flex; align-items: center; gap: 12px; padding: 15px 17px;
  cursor: pointer; list-style: none; user-select: none;
}
.guide-card summary::-webkit-details-marker { display: none; }
.guide-card summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
.guide-card .metric-icon { flex: 0 0 34px; }
.guide-summary-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.guide-summary-text strong { font-size: 13.5px; font-weight: 700; }
.guide-summary-text > span { color: var(--muted); font-size: 10.5px; }
.guide-toggle { position: relative; flex: 0 0 22px; height: 22px; border-radius: 50%; background: #eef6f7; }
.guide-toggle::before, .guide-toggle::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 9px; height: 1.5px;
  border-radius: 2px; background: var(--accent-deep); transform: translate(-50%, -50%);
  transition: transform .15s ease;
}
.guide-toggle::after { transform: translate(-50%, -50%) rotate(90deg); }
.guide-card[open] .guide-toggle::after { transform: translate(-50%, -50%) rotate(0); }
.guide-body { padding: 0 17px 16px; border-top: 1px solid var(--line); }
.guide-body > p { margin: 13px 0; color: #49636e; font-size: 12.5px; }
.guide-effect { padding: 9px 11px; border-radius: 10px; margin-top: 8px; font-size: 11.5px; }
.guide-effect strong { display: block; margin-bottom: 2px; font-size: 10px; text-transform: uppercase; letter-spacing: .45px; }
.guide-effect p { margin: 0; color: #526a74; }
.guide-effect.high { background: #fff5e8; }
.guide-effect.high strong { color: #87500d; }
.guide-effect.low { background: #edf5fa; }
.guide-effect.low strong { color: #35738e; }
.guide-note {
  margin: 15px 2px 0; color: var(--muted); font-size: 11px; line-height: 1.6;
}

@media (max-width: 700px) {
  .header-tools { width: 100%; margin: 12px 0 30px; justify-content: space-between; }
  .status-pill { margin-left: 0; }
  .language-picker select { padding-top: 7px; padding-bottom: 7px; font-size: 11px; }
  .guide-grid { grid-template-columns: 1fr; }
}
@media (max-width: 430px) {
  .header-tools { width: 100%; margin-left: 0; gap: 7px; }
  .status-pill { min-width: 0; max-width: calc(100% - 93px); overflow: hidden; }
  .status-pill #status-text { overflow: hidden; text-overflow: ellipsis; }
  .guide-heading h2 { font-size: 21px; }
}
