/* One stylesheet, no build step, no framework. The repo ships zero npm
   dependencies on purpose and this page keeps that promise. */

:root {
  --bg: #f6f6f4;
  --panel: #ffffff;
  --ink: #16181d;
  --muted: #676e7b;
  --line: #e2e3e0;
  --accent: #1b6b5a;
  --warn: #a33f2a;
  --good: #2f7d4f;
  --chip: #eceeea;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 18, 22, .06), 0 8px 24px rgba(16, 18, 22, .05);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101216;
    --panel: #171a20;
    --ink: #e9eaec;
    --muted: #9aa1ad;
    --line: #262a33;
    --accent: #58c0a4;
    --warn: #e4805f;
    --good: #6fc98d;
    --chip: #1e222a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 28px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 ui-sans-serif, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 4rem;
}

h1 { font-size: 1.05rem; margin: 0; letter-spacing: -.01em; }
h2 { font-size: .95rem; margin: 0 0 .35rem; letter-spacing: -.01em; }
h3 { font-size: .8rem; margin: 1.1rem 0 .4rem; text-transform: uppercase;
     letter-spacing: .07em; color: var(--muted); }
p { margin: 0 0 .6rem; }
a { color: var(--accent); }

.bar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: .8rem 1rem;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .5rem; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--good); }
.dot.stale { background: var(--warn); }
.stamp { font-size: .75rem; color: var(--muted); font-variant-numeric: tabular-nums; }

.tabs {
  display: flex; gap: .25rem; padding: .6rem 1rem 0;
  overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  flex: 0 0 auto; border: 0; background: transparent; color: var(--muted);
  font: inherit; font-size: .85rem; padding: .45rem .7rem; border-radius: 999px;
  cursor: pointer;
}
.tabs button.on { background: var(--chip); color: var(--ink); }

main { padding: 1rem; max-width: 1200px; margin: 0 auto; }
.view { display: none; }
.view.on { display: block; }

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem;
  box-shadow: var(--shadow);
}
.hint { color: var(--muted); font-size: .8rem; }

.kpis {
  display: grid; gap: .6rem; margin-bottom: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}
.kpi {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: .8rem .9rem; box-shadow: var(--shadow);
}
.kpi .label { font-size: .7rem; text-transform: uppercase; letter-spacing: .07em;
              color: var(--muted); }
.kpi .value { font-size: 1.4rem; font-weight: 600; font-variant-numeric: tabular-nums;
              letter-spacing: -.02em; margin-top: .15rem; }
.kpi .sub { font-size: .72rem; color: var(--muted); }

.filters { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .9rem; }
.filters button, .filters select {
  border: 1px solid var(--line); background: var(--panel); color: var(--muted);
  font: inherit; font-size: .8rem; padding: .35rem .7rem; border-radius: 999px;
  cursor: pointer;
}
.filters button.on { background: var(--accent); border-color: var(--accent); color: #fff; }

.grid {
  display: grid; gap: .8rem;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
}
.tile {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; cursor: pointer; text-align: left; padding: 0; font: inherit;
  color: inherit; box-shadow: var(--shadow); transition: transform .12s ease;
}
.tile:hover { transform: translateY(-2px); }
.tile .thumb {
  aspect-ratio: 1 / 1; width: 100%; object-fit: cover; display: block;
  background: var(--chip);
}
.tile .thumb.empty {
  display: grid; place-items: center; color: var(--muted); font-size: .72rem;
  text-align: center; padding: .5rem;
}
.tile .meta { padding: .55rem .6rem .7rem; }
.tile .name { font-size: .78rem; font-weight: 600; line-height: 1.3;
              display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
              overflow: hidden; }
.tile .row { display: flex; justify-content: space-between; gap: .4rem;
             font-size: .72rem; color: var(--muted); margin-top: .3rem;
             font-variant-numeric: tabular-nums; }
.badge { display: inline-block; font-size: .62rem; text-transform: uppercase;
         letter-spacing: .06em; padding: .1rem .35rem; border-radius: 4px;
         background: var(--chip); color: var(--muted); }
.badge.live { background: color-mix(in srgb, var(--good) 20%, transparent); color: var(--good); }

table { width: 100%; border-collapse: collapse; font-size: .8rem; }
th, td { text-align: right; padding: .4rem .5rem; border-bottom: 1px solid var(--line);
         font-variant-numeric: tabular-nums; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; white-space: normal; }
th { color: var(--muted); font-weight: 500; font-size: .72rem; text-transform: uppercase;
     letter-spacing: .06em; }
.scroll { overflow-x: auto; }

.chart svg { width: 100%; height: auto; display: block; }
.na { color: var(--muted); font-style: italic; font-size: .78rem; }

.sheet {
  position: fixed; inset: 0; z-index: 40; background: rgba(8, 10, 14, .5);
  display: grid; place-items: end center; padding: 0;
}
/* `display: grid` beats the [hidden] default of display:none, so without this the
   detail sheet sits open over the page from first paint — a transparent scrim that
   swallows every click, including the tabs. The page looks loaded and is inert. */
.sheet[hidden] { display: none; }
.sheet-inner {
  background: var(--panel); width: min(760px, 100%); max-height: 92vh; overflow-y: auto;
  border-radius: var(--radius) var(--radius) 0 0; padding: 1.2rem;
  border: 1px solid var(--line); position: relative;
}
@media (min-width: 760px) {
  .sheet { place-items: center; padding: 1.5rem; }
  .sheet-inner { border-radius: var(--radius); }
}
.close { position: absolute; top: .6rem; right: .7rem; border: 0; background: var(--chip);
         color: var(--ink); width: 30px; height: 30px; border-radius: 50%; font-size: 1.1rem;
         cursor: pointer; line-height: 1; }
.sheet-hero { display: flex; gap: 1rem; align-items: flex-start; margin-bottom: .8rem; }
.sheet-hero img { width: 120px; height: 120px; object-fit: cover; border-radius: 10px;
                  background: var(--chip); flex: 0 0 auto; }
.copy { background: var(--chip); border-radius: 10px; padding: .7rem .8rem;
        font-size: .82rem; white-space: pre-wrap; }
.chips { display: flex; flex-wrap: wrap; gap: .3rem; }
.chips span { background: var(--chip); border-radius: 999px; padding: .15rem .55rem;
              font-size: .72rem; color: var(--muted); }
