:root {
  color-scheme: light;
  --bg: #f2f5f3;
  --surface: #ffffff;
  --surface-soft: #f7f9f8;
  --text: #17221e;
  --muted: #66736d;
  --line: #dce4e0;
  --green: #08775b;
  --green-dark: #055843;
  --green-soft: #dff4ec;
  --blue: #2761a8;
  --red: #ad2b32;
  --shadow: 0 12px 34px rgba(26, 54, 43, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--text); background: var(--bg); }
button, input, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }
.eyebrow { margin: 0; color: var(--green); font-size: 0.72rem; font-weight: 780; text-transform: uppercase; letter-spacing: 0.13em; }
h1, h2, h3, p { margin-top: 0; }

.hero { color: white; background: linear-gradient(120deg, #073f34, #086b54 68%, #13886b); }
.hero-inner { width: min(1480px, calc(100% - 40px)); min-height: 210px; margin: auto; display: flex; align-items: center; justify-content: space-between; gap: 30px; }
.hero .eyebrow { color: #bfe8dc; }
.hero h1 { margin: 5px 0 10px; font-size: clamp(2rem, 4vw, 3.7rem); letter-spacing: -0.055em; }
.hero-copy { max-width: 620px; margin-bottom: 0; color: #d6eee7; font-size: 1.03rem; }
.hero-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 10px; }
.hero-actions span { width: 100%; color: #cce8df; text-align: right; font-size: 0.82rem; }

main { width: min(1480px, calc(100% - 40px)); margin: -28px auto 64px; position: relative; }
.button { display: inline-flex; align-items: center; justify-content: center; padding: 10px 14px; border: 1px solid transparent; border-radius: 8px; font-weight: 720; }
.button.primary { color: white; background: var(--green); }
.button.primary:hover { background: var(--green-dark); }
.button.light { color: var(--green-dark); background: white; }
.button.outline-light { color: white; border-color: rgba(255,255,255,.45); background: transparent; }
.button.ghost { color: var(--green-dark); border-color: var(--line); background: white; }
.button:disabled { cursor: not-allowed; opacity: .5; }

.message { margin-bottom: 16px; padding: 13px 16px; border: 1px solid #bce3d6; border-radius: 10px; color: var(--green-dark); background: var(--green-soft); }
.message.error { color: var(--red); border-color: #f5c6c9; background: #fde7e8; }
.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 38px; }
.summary-card { min-width: 0; padding: 20px 22px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); box-shadow: var(--shadow); }
.summary-card span { color: var(--muted); font-size: 0.82rem; }
.summary-card strong { display: block; margin-top: 4px; font-size: 1.9rem; letter-spacing: -0.045em; }
.summary-card .summary-date { margin-top: 8px; font-size: 1rem; letter-spacing: -0.01em; }

.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin: 0 3px 16px; }
.section-heading h2, .panel-heading h2 { margin: 3px 0 0; letter-spacing: -0.035em; }
.section-heading > p { max-width: 520px; margin-bottom: 0; color: var(--muted); font-size: .88rem; text-align: right; }
.sites-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 38px; }
.site-card { padding: 19px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); box-shadow: var(--shadow); }
.site-card-heading { display: flex; justify-content: space-between; gap: 14px; }
.site-card h3 { margin-bottom: 3px; }
.site-id, .site-description, .site-updated { color: var(--muted); font-size: .8rem; }
.site-description { min-height: 2.7em; margin: 13px 0 17px; line-height: 1.45; }
.availability { flex: none; align-self: start; padding: 5px 9px; border-radius: 999px; color: var(--green); background: var(--green-soft); font-size: .74rem; font-weight: 750; }
.availability.offline { color: var(--red); background: #fde7e8; }
.site-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 13px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.site-metric span { display: block; color: var(--muted); font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; }
.site-metric strong { display: block; margin-top: 4px; font-size: .88rem; font-variant-numeric: tabular-nums; }
.site-updated { display: block; margin-top: 11px; }

.panel { border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.panel-heading { min-height: 76px; padding: 18px 22px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); }
.filters { display: grid; grid-template-columns: repeat(6, minmax(120px, 1fr)); gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); background: var(--surface-soft); }
label { display: grid; gap: 6px; color: #46534d; font-size: .76rem; font-weight: 680; }
input, select { width: 100%; padding: 10px 11px; color: var(--text); border: 1px solid #cbd6d1; border-radius: 8px; background: white; outline: none; }
input:focus, select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(8,119,91,.12); }
.filter-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 9px; }

.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.chart-card { min-width: 0; padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); }
.chart-card h3 { margin-bottom: 3px; }
.chart-card > div > span { color: var(--muted); font-size: .76rem; }
.chart-card canvas { display: block; width: 100%; height: 240px; margin-top: 14px; }
.chart-empty { height: 240px; margin: 14px 0 0; display: grid; place-items: center; color: var(--muted); font-size: .83rem; }
.table-heading, .pagination { padding: 13px 22px; display: flex; align-items: center; justify-content: space-between; gap: 16px; color: var(--muted); font-size: .8rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .86rem; }
th { padding: 11px 16px; color: var(--muted); background: var(--surface-soft); text-align: left; font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; }
td { padding: 13px 16px; border-top: 1px solid var(--line); vertical-align: middle; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: #f2faf7; }
.measurement-type { display: inline-flex; padding: 4px 8px; border-radius: 999px; color: var(--green-dark); background: var(--green-soft); font-size: .73rem; font-weight: 720; }
.metric { white-space: nowrap; font-variant-numeric: tabular-nums; }
.empty { padding: 42px; color: var(--muted); text-align: center; }
.pagination { justify-content: center; border-top: 1px solid var(--line); }

dialog { width: min(760px, calc(100% - 28px)); max-height: calc(100vh - 40px); padding: 0; border: 1px solid var(--line); border-radius: 16px; color: var(--text); background: var(--surface); box-shadow: 0 30px 80px rgba(7,63,52,.25); }
dialog::backdrop { background: rgba(12,30,24,.52); backdrop-filter: blur(2px); }
.dialog-heading { padding: 19px 22px; display: flex; align-items: flex-start; justify-content: space-between; border-bottom: 1px solid var(--line); }
.dialog-heading h2 { margin: 3px 0 0; }
.icon-button { width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); background: white; font-size: 1.5rem; line-height: 1; }
.measurement-meta { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 0; padding: 20px 22px; }
.measurement-meta div { min-width: 0; }
.measurement-meta dt { color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; }
.measurement-meta dd { margin: 4px 0 0; overflow-wrap: anywhere; font-size: .87rem; }
dialog > h3 { margin: 0 22px 10px; }
pre { max-height: 330px; margin: 0 22px 22px; padding: 15px; overflow: auto; border-radius: 10px; color: #d8eee7; background: #10241e; font: .78rem/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; }

@media (max-width: 1100px) {
  .sites-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 760px) {
  .hero-inner { min-height: 270px; padding: 28px 0 55px; align-items: flex-start; flex-direction: column; }
  .hero-actions { justify-content: flex-start; }
  .hero-actions span { text-align: left; }
  main { width: min(100% - 24px, 1480px); margin-top: -30px; }
  .summary-grid, .sites-grid, .charts-grid { grid-template-columns: 1fr; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .section-heading, .panel-heading { align-items: flex-start; flex-direction: column; }
  .section-heading > p { text-align: left; }
  .filters { grid-template-columns: 1fr; }
  .charts-grid { padding: 14px; }
  .measurement-meta { grid-template-columns: 1fr; }
}
