:root {
  --background: #f8f3ea;
  --card: #fffdf8;
  --ink: #2b1a14;
  --muted: #6f5a4a;
  --berry: #8e1f2f;
  --berry-deep: #5e1420;
  --gold: #b8894b;
  --green: #4f6f52;
  --warning: #b8792e;
  --alert: #9b2f2f;
  --line: #e2d8ca;
  --shadow: 0 16px 42px rgba(63, 39, 29, .09);
  --radius: 22px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--background); font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font: inherit; }
.content-width, .header-inner { width: min(100% - 36px, 1120px); margin-inline: auto; }
.skip-link { position: fixed; z-index: 100; top: -100px; left: 16px; padding: 12px 16px; color: white; background: var(--berry-deep); border-radius: 10px; }
.skip-link:focus { top: 16px; }

.site-header { color: white; background: var(--berry-deep); }
.header-inner { min-height: 82px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.identity { display: flex; align-items: center; gap: 13px; }
.brand-mark { width: 42px; height: 42px; flex: 0 0 auto; display: grid; place-items: center; color: var(--berry-deep); background: #f5ead8; border-radius: 50% 46% 51% 47%; font-family: Iowan Old Style, Baskerville, Georgia, serif; font-size: 14px; font-weight: 700; }
.identity div { display: flex; flex-direction: column; gap: 3px; }
.identity span:not(.brand-mark) { color: #d9c8c6; font-size: 10px; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; }
.identity strong { font-family: Iowan Old Style, Baskerville, Georgia, serif; font-size: 21px; font-weight: 500; }
.freshness { min-width: 245px; display: flex; align-items: center; gap: 11px; padding: 12px 15px; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12); border-radius: 14px; }
.freshness > div { display: flex; flex-direction: column; gap: 3px; }
.freshness strong { font-size: 12px; }
.freshness span:last-child { color: #d8c9c8; font-size: 11px; }
.signal-dot { width: 9px; height: 9px; flex: 0 0 auto; background: #94bd96; border-radius: 50%; box-shadow: 0 0 0 5px rgba(148,189,150,.12); }
.freshness.delayed .signal-dot, .freshness.issue .signal-dot { background: #e0a950; box-shadow: 0 0 0 5px rgba(224,169,80,.13); }
.freshness.issue .signal-dot { background: #dc766d; }

.hero { color: white; background: linear-gradient(135deg, var(--berry-deep), #341a18); overflow: hidden; }
.hero-inner { position: relative; min-height: 238px; display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; padding-block: 48px; }
.hero-inner::after { content: ""; position: absolute; right: -80px; top: -220px; width: 480px; height: 480px; border: 1px solid rgba(255,255,255,.07); border-radius: 50%; box-shadow: 0 0 0 68px rgba(255,255,255,.025), 0 0 0 136px rgba(255,255,255,.018); pointer-events: none; }
.overline, .eyebrow { display: block; color: var(--green); font-size: 10px; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.hero .overline { color: #d4bbb8; }
h1, h2, h3 { font-family: Iowan Old Style, Baskerville, Georgia, serif; }
.hero h1 { position: relative; z-index: 1; margin: 8px 0 7px; font-size: clamp(47px, 7vw, 72px); font-weight: 500; letter-spacing: -.045em; line-height: .98; }
.hero p { position: relative; z-index: 1; margin: 0; color: #dfd0ce; font-size: 16px; }
.history-jump { position: relative; z-index: 1; min-height: 46px; display: inline-flex; align-items: center; gap: 22px; padding: 0 16px; color: #f9f0e6; border: 1px solid rgba(255,255,255,.2); border-radius: 12px; font-size: 12px; font-weight: 750; }
.history-jump:hover, .history-jump:focus-visible { background: rgba(255,255,255,.09); }

#water-dashboard { padding-bottom: 78px; }
.loading-card, .system-read { position: relative; z-index: 2; margin-top: -31px; padding: 24px 27px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.loading-card h2 { margin: 7px 0 5px; font-size: 28px; font-weight: 500; }
.loading-card p { margin: 0; color: var(--muted); font-size: 13px; }
.system-read { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 25px; }
.system-read h2 { margin: 6px 0 5px; font-size: 30px; font-weight: 500; }
.system-read p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.data-badge { min-height: 34px; display: inline-flex; align-items: center; padding: 7px 11px; color: #38593c; background: #e9f0e8; border-radius: 999px; font-size: 10px; font-weight: 850; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.data-badge.stale { color: #77501d; background: #f8ead0; }
.data-badge.issue { color: #7d2929; background: #f6e2df; }

.dashboard-section { padding-top: 52px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.section-heading h2 { margin: 6px 0 0; font-size: clamp(31px, 4vw, 42px); font-weight: 500; letter-spacing: -.025em; }
.section-heading p { max-width: 430px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; text-align: right; }

.rain-card { min-height: 282px; display: grid; grid-template-columns: 190px minmax(0, 1fr); align-items: center; gap: 34px; padding: 32px; color: white; background: linear-gradient(135deg, #3f5950, #253d35); border-radius: 26px; box-shadow: 0 18px 45px rgba(35,60,51,.14); }
.tank-visual { position: relative; width: 150px; height: 188px; display: flex; align-items: flex-end; overflow: hidden; margin-inline: auto; border: 3px solid rgba(255,255,255,.72); border-top-width: 2px; border-radius: 18px 18px 26px 26px; background: rgba(255,255,255,.07); }
.tank-visual::before { content: ""; position: absolute; z-index: 2; top: -3px; left: 12px; right: 12px; height: 8px; background: #3b544b; border: 2px solid rgba(255,255,255,.72); border-radius: 50%; }
.tank-fill { width: 100%; height: var(--fill, 0%); max-height: 100%; background: linear-gradient(180deg, #c9dccd, #91b29a); transition: height .45s ease; }
.rain-copy .eyebrow { color: #bcd0c0; }
.rain-copy h3 { margin: 9px 0 0; font-size: 37px; font-weight: 500; }
.level-large { display: block; margin-top: 5px; font-family: Iowan Old Style, Baskerville, Georgia, serif; font-size: clamp(68px, 10vw, 98px); line-height: .95; letter-spacing: -.04em; }
.rain-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 23px; color: #d9e4db; font-size: 12px; }
.rain-meta strong { color: white; }

.tank-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.tank-card { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) 74px; align-items: center; gap: 15px; min-height: 185px; padding: 22px; background: var(--card); border: 1px solid var(--line); border-radius: 19px; box-shadow: 0 10px 28px rgba(63,39,29,.055); }
.tank-card h3 { margin: 7px 0 0; font-size: 25px; font-weight: 500; }
.tank-level { display: block; margin: 8px 0 18px; font-family: Iowan Old Style, Baskerville, Georgia, serif; font-size: 46px; line-height: 1; letter-spacing: -.035em; }
.tank-status { display: block; color: var(--green); font-size: 11px; font-weight: 800; }
.tank-status.stale { color: var(--warning); }
.tank-status.issue { color: var(--alert); }
.tank-updated { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.tank-card .tank-visual { width: 67px; height: 109px; border-width: 2px; border-radius: 10px 10px 15px 15px; border-color: #b9aaa0; background: #f1ebe1; }
.tank-card .tank-visual::before { top: -2px; left: 7px; right: 7px; height: 5px; background: var(--card); border-width: 1px; border-color: #b9aaa0; }
.tank-card .tank-fill { background: linear-gradient(180deg, #b8cdbb, #78927c); }
.tank-card.missing { grid-template-columns: 1fr; border-style: dashed; }
.tank-card.missing .tank-level { color: var(--muted); font-size: 30px; line-height: 1.15; }

.history-card { padding: 27px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.asset-selectors { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 22px; }
.asset-selector { min-width: 48px; min-height: 44px; padding: 0 14px; color: var(--muted); background: #f3ece1; border: 1px solid transparent; border-radius: 11px; cursor: pointer; font-size: 12px; font-weight: 800; }
.asset-selector:hover, .asset-selector:focus-visible { border-color: var(--gold); outline: none; }
.asset-selector[aria-pressed="true"] { color: white; background: var(--berry-deep); }
.chart-summary { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 4px; }
.chart-summary h3 { margin: 0; font-size: 26px; font-weight: 500; }
.chart-summary span { color: var(--muted); font-size: 11px; }
.history-chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart-bg { fill: #fdfaf4; stroke: #e8ded0; }
.chart-grid { stroke: #e8ded0; stroke-width: 1; }
.chart-axis { fill: #806e61; font-size: 11px; font-weight: 700; }
.chart-line { fill: none; stroke: var(--berry); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.chart-point { fill: var(--card); stroke: var(--berry); stroke-width: 3; }
.chart-empty { min-height: 245px; display: grid; place-items: center; padding: 28px; color: var(--muted); background: #f5efe5; border-radius: 15px; text-align: center; }

.baseline-card { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 20px; padding: 27px; background: #eee5d8; border: 1px solid #ddd0c0; border-radius: 20px; }
.baseline-icon { width: 44px; height: 44px; display: grid; place-items: center; color: white; background: var(--gold); border-radius: 13px; font-family: Iowan Old Style, Baskerville, Georgia, serif; font-size: 22px; }
.baseline-card h2 { margin: 5px 0 9px; font-size: 28px; font-weight: 500; }
.baseline-card p { max-width: 760px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.65; }
.baseline-card p + p { margin-top: 7px; }

.source-details { margin-top: 15px; background: var(--card); border: 1px solid var(--line); border-radius: 15px; }
.source-details summary { min-height: 48px; display: flex; align-items: center; padding: 0 18px; cursor: pointer; color: var(--muted); font-size: 11px; font-weight: 800; }
.source-details dl { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin: 0; padding: 0 18px 18px; }
.source-details dl div { min-width: 0; padding: 10px 13px; border-left: 1px solid var(--line); }
.source-details dl div:first-child { border-left: 0; padding-left: 0; }
.source-details dt { color: var(--muted); font-size: 9px; font-weight: 750; text-transform: uppercase; }
.source-details dd { margin: 5px 0 0; overflow-wrap: anywhere; font-size: 11px; font-weight: 750; }

footer { color: #ddcecb; background: #351816; }
.footer-inner { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 20px; font-size: 11px; }
.footer-inner a { color: #eddbd4; text-decoration: underline; text-underline-offset: 3px; }

@media (max-width: 820px) {
  .tank-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .source-details dl { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 0; }
  .source-details dl div:nth-child(odd) { padding-left: 0; border-left: 0; }
}

@media (max-width: 560px) {
  .content-width, .header-inner { width: min(100% - 24px, 1120px); }
  .header-inner { min-height: 74px; }
  .identity strong { font-size: 18px; }
  .freshness { min-width: 0; padding: 10px; }
  .freshness strong { max-width: 105px; line-height: 1.25; }
  .freshness span:last-child { display: none; }
  .hero-inner { min-height: 218px; align-items: flex-start; flex-direction: column; padding-block: 40px; }
  .hero h1 { font-size: 49px; }
  .history-jump { min-height: 44px; }
  .system-read { grid-template-columns: 1fr; gap: 15px; padding: 22px; }
  .system-read h2 { font-size: 27px; }
  .data-badge { justify-self: start; }
  .dashboard-section { padding-top: 42px; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 6px; }
  .section-heading p { text-align: left; }
  .rain-card { min-height: 245px; grid-template-columns: 112px minmax(0, 1fr); gap: 21px; padding: 23px 19px; }
  .rain-card .tank-visual { width: 102px; height: 151px; }
  .rain-copy h3 { font-size: 30px; }
  .level-large { font-size: 67px; }
  .rain-meta { align-items: flex-start; flex-direction: column; gap: 6px; margin-top: 17px; }
  .tank-grid { grid-template-columns: 1fr; }
  .tank-card { min-height: 155px; padding: 19px; }
  .history-card { padding: 19px 14px; }
  .asset-selectors { flex-wrap: nowrap; margin-right: -2px; overflow-x: auto; padding-bottom: 4px; }
  .asset-selector { flex: 0 0 auto; }
  .chart-summary { align-items: flex-start; flex-direction: column; gap: 3px; padding-inline: 5px; }
  .history-chart { min-height: 240px; }
  .baseline-card { grid-template-columns: 1fr; padding: 23px; }
  .source-details dl { grid-template-columns: 1fr; }
  .source-details dl div, .source-details dl div:nth-child(odd) { padding: 9px 0; border-left: 0; border-top: 1px solid var(--line); }
  .footer-inner { align-items: flex-start; flex-direction: column; justify-content: center; gap: 7px; }
}

@media (max-width: 390px) {
  .identity span:not(.brand-mark) { display: none; }
  .brand-mark { width: 38px; height: 38px; }
  .freshness strong { max-width: 92px; font-size: 11px; }
  .hero h1 { font-size: 44px; }
  .rain-card { grid-template-columns: 92px minmax(0, 1fr); gap: 16px; }
  .rain-card .tank-visual { width: 84px; height: 138px; }
  .level-large { font-size: 59px; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
