:root {
  color-scheme: light;
  --ink: #13251d;
  --muted: #647169;
  --paper: #f5f3ed;
  --surface: #fffefa;
  --line: #dce1dc;
  --green: #175c41;
  --green-deep: #0d3d2a;
  --green-soft: #dcece2;
  --gold: #d8b55b;
  --danger: #a4342c;
  --danger-soft: #f8e8e4;
  --shadow: 0 24px 60px rgba(19, 37, 29, 0.09);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 92% 5%, rgba(216, 181, 91, 0.18), transparent 25rem),
    var(--paper);
  color: var(--ink);
}

button { cursor: pointer; font: inherit; }

.site-header,
footer {
  width: min(1180px, calc(100% - 40px));
  margin-inline: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.site-header { padding-block: 24px; }

.brand {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  color: inherit;
  font-weight: 700;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 50%;
  background: var(--green);
  color: white;
  font-family: Georgia, serif;
  letter-spacing: -0.04em;
}

.site-label {
  color: var(--green);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

main {
  width: min(1180px, calc(100% - 40px));
  margin: 50px auto 90px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

h1, h2, p { margin-top: 0; }

h1, h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
  letter-spacing: -0.035em;
}

h1 {
  max-width: 760px;
  margin-bottom: 24px;
  font-size: clamp(3rem, 7vw, 6.4rem);
  line-height: 0.94;
}

h2 {
  margin-bottom: 8px;
  font-size: clamp(1.7rem, 3vw, 2.5rem);
  line-height: 1.05;
}

button {
  border: 0;
  border-radius: 10px;
  background: var(--green);
  color: white;
  padding: 14px 18px;
  font-weight: 800;
}

button:hover { background: var(--green-deep); }
button:disabled { cursor: wait; opacity: 0.62; }

.secondary-button {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
}

.secondary-button:hover { background: var(--green-soft); }

.subtle {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.55;
}

.dashboard { display: grid; gap: 32px; }
.dashboard-content { display: grid; gap: 42px; }

.dashboard-heading,
.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
}

.dashboard-heading h1 {
  margin-bottom: 12px;
  font-size: clamp(2.8rem, 6vw, 5rem);
}

.refresh-button { min-width: 144px; }

.refresh-button[aria-busy="true"]::before {
  display: inline-block;
  width: 0.8em;
  height: 0.8em;
  margin-right: 9px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  content: "";
  vertical-align: -0.08em;
}

.load-status {
  min-height: 1.4em;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.load-error {
  padding: clamp(26px, 5vw, 44px);
  border: 1px solid rgba(164, 52, 44, 0.2);
  border-radius: 18px;
  background: var(--danger-soft);
}

.load-error p:not(.eyebrow) { color: var(--muted); }

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.metric {
  display: grid;
  min-height: 180px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 254, 250, 0.7);
}

.metric-primary {
  border-color: var(--green);
  background: var(--green);
  color: white;
}

.metric span { font-size: 0.82rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; }
.metric strong { align-self: center; font-family: Georgia, serif; font-size: clamp(3rem, 6vw, 5rem); font-weight: 400; }
.metric small { align-self: end; opacity: 0.7; }

.dashboard-section {
  min-width: 0;
  padding-top: 12px;
}

.legend { display: flex; gap: 18px; color: var(--muted); font-size: 0.82rem; }
.legend span { display: flex; gap: 7px; align-items: center; }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; }
.legend-dot.counting { background: var(--green); }
.legend-dot.other { background: #aeb7b1; }

.chart {
  min-height: 300px;
  margin-top: 24px;
  border-bottom: 1px solid var(--line);
}

.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .axis-label { fill: var(--muted); font-size: 11px; }
.chart .trend-line { fill: none; stroke: #aeb7b1; stroke-width: 1.5; }
.chart .point { fill: #aeb7b1; stroke: var(--paper); stroke-width: 3; }
.chart .point.counting { fill: var(--green); }

.table-wrap {
  max-width: 100%;
  margin-top: 20px;
  overflow-x: auto;
}

table { width: 100%; border-collapse: collapse; }
th, td { padding: 15px 12px; border-bottom: 1px solid var(--line); text-align: left; }
th { color: var(--muted); font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; }
td:nth-child(3), td:nth-child(4), th:nth-child(3), th:nth-child(4) { text-align: right; }

.status-pill {
  display: inline-flex;
  border-radius: 999px;
  padding: 5px 9px;
  background: var(--green-soft);
  color: var(--green-deep);
  font-size: 0.75rem;
  font-weight: 800;
}

.skeleton-value,
.skeleton-row i,
.chart-skeleton i {
  display: block;
  border-radius: 999px;
  background: linear-gradient(100deg, rgba(174, 183, 177, 0.28) 20%, rgba(255, 255, 255, 0.58) 38%, rgba(174, 183, 177, 0.28) 56%);
  background-size: 220% 100%;
}

.metric-primary .skeleton-value {
  background: linear-gradient(100deg, rgba(255, 255, 255, 0.22) 20%, rgba(255, 255, 255, 0.52) 38%, rgba(255, 255, 255, 0.22) 56%);
  background-size: 220% 100%;
}

.skeleton-value { width: 1.5em; height: 0.78em; }
.skeleton-value-wide { width: 2.2em; }
.skeleton-row i { min-width: 46px; height: 0.8em; }
.skeleton-row td:nth-child(2) i { width: 70%; }

.chart-skeleton {
  display: grid;
  height: 260px;
  align-content: space-around;
  padding: 15px 0;
}

.chart-skeleton i { width: 100%; height: 2px; }

.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;
}

footer {
  gap: 20px;
  padding-block: 28px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.8rem;
}

.footer-links { display: flex; flex-wrap: wrap; gap: 16px; }
.footer-links a { color: var(--green); font-weight: 700; }

[hidden] { display: none !important; }

@media (max-width: 820px) {
  main { margin-top: 20px; }
  .metric-grid { grid-template-columns: 1fr; }
  .metric { min-height: 150px; }
  .dashboard-heading, .section-heading { align-items: stretch; flex-direction: column; }
  .secondary-button { width: 100%; }
}

@media (max-width: 520px) {
  .site-header, main, footer { width: min(100% - 24px, 1180px); }
  .site-label { display: none; }
  main { margin-bottom: 60px; }
  h1 { font-size: 3.2rem; }
  .legend { flex-wrap: wrap; }
  .chart { min-height: 170px; }
  th, td { padding: 12px 8px; }
  footer { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: no-preference) {
  button { transition: background-color 150ms ease, opacity 150ms ease; }
  .refresh-button[aria-busy="true"]::before { animation: spin 700ms linear infinite; }
  .skeleton-value, .skeleton-row i, .chart-skeleton i { animation: shimmer 1.5s linear infinite; }
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { background-position-x: -220%; } }
