:root {
  --ink: #171717; --muted: #5b5b5b; --line: #e4e4e0; --bg: #fafaf8; --card: #fff;
  --accent: #1c5cab; --accent-ink: #fff; --bar: #2a78d6; --soft: #eef4fc;
  --mono: ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
main { max-width: 820px; margin: 0 auto; padding: 32px 16px 64px; }
h1 { font-size: 32px; line-height: 1.15; margin: 0 0 12px; letter-spacing: -0.01em; }
h2 { font-size: 24px; line-height: 1.25; margin: 4px 0 16px; }
h3 { font-size: 18px; margin: 0 0 4px; }
h4 { font-size: 14px; margin: 16px 0 6px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.lede { font-size: 18px; margin: 0 0 8px; }
.fake { font-size: 14px; color: var(--muted); margin: 0 0 24px; }
a { color: var(--accent); }

form { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-bottom: 32px; }
label { font-weight: 600; display: block; margin-bottom: 8px; }
textarea { width: 100%; font: inherit; border: 1px solid #c9c9c4; border-radius: 10px; padding: 12px; resize: vertical; }
textarea:focus, button:focus-visible, summary:focus-visible { outline: 3px solid #86b6ef; outline-offset: 2px; }
.examples { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 16px; }
.chip { font: inherit; font-size: 14px; text-align: left; background: var(--soft); color: var(--ink);
  border: 1px solid #cfdff3; border-radius: 10px; padding: 8px 12px; min-height: 44px; cursor: pointer; }
.chip:hover { border-color: var(--accent); }
#go { font: inherit; font-weight: 700; background: var(--accent); color: var(--accent-ink); border: 0;
  border-radius: 12px; padding: 12px 20px; min-height: 48px; width: 100%; cursor: pointer; }
#go:disabled { opacity: .6; cursor: wait; }
.status { margin: 12px 0 0; font-size: 15px; color: var(--muted); min-height: 1.5em; }

.tag { font-size: 14px; color: var(--muted); margin: 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-bottom: 16px; }
.reading { margin: 8px 0 0; padding-left: 20px; }
.reading li { margin-bottom: 4px; }
.standout { margin: 4px 0 16px; font-size: 19px; line-height: 1.5; font-weight: 500; }
.note { font-size: 14px; color: var(--muted); margin: 0 0 12px; }

.funnel, .check { list-style: none; padding: 0; margin: 0; }
.funnel li, .check li { display: flex; gap: 12px; justify-content: space-between; align-items: baseline;
  padding: 8px 0; border-top: 1px solid var(--line); }
.funnel li:first-child, .check li:first-child { border-top: 0; }
.funnel b, .check b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.check li span { flex: 1; }
.check small { width: 52px; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

.bars { display: grid; gap: 10px; }
.bar { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; }
.bar .name { overflow-wrap: anywhere; }
.bar .num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.bar .num small { color: var(--muted); margin-left: 8px; display: inline-block; min-width: 36px; }
.track { grid-column: 1 / -1; display: block; height: 6px; background: #f0f0ec; border-radius: 4px; overflow: hidden; }
.track span { display: block; height: 100%; background: var(--bar); border-radius: 4px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stats div { background: var(--soft); border-radius: 12px; padding: 12px; }
.stats b { display: block; font-size: 26px; font-variant-numeric: tabular-nums; }
.stats span { font-size: 14px; color: var(--muted); }

.scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 15px; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 8px 10px 8px 0; border-top: 1px solid var(--line); white-space: nowrap; }
th { font-size: 13px; color: var(--muted); font-weight: 600; border-top: 0; }
tr.total td { font-weight: 600; }
.empty { color: var(--muted); margin: 0; }

details { margin-top: 8px; }
summary { cursor: pointer; font-size: 14px; color: var(--muted); min-height: 44px; display: inline-flex; align-items: center; gap: 6px; }
summary:hover { color: var(--accent); }
summary::-webkit-details-marker { display: none; }
summary { list-style: none; }
summary::after { content: '›'; font-size: 18px; transition: transform .15s; }
details[open] summary::after { transform: rotate(90deg); }
details textarea { font: 13px/1.5 var(--mono); min-height: 220px; white-space: pre; overflow-x: auto; margin-top: 8px; }
.sqlbar { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.sqlbar button { font: inherit; font-size: 14px; border: 1px solid #c9c9c4; background: #fff; border-radius: 10px;
  padding: 8px 12px; min-height: 44px; cursor: pointer; }
.sqlbar .run { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.sqlmsg { font-size: 14px; color: var(--muted); margin: 8px 0 0; }

.how { margin-top: 40px; border-top: 1px solid var(--line); padding-top: 24px; }
.how ol { padding-left: 20px; }
.how li { margin-bottom: 10px; }
.limits, .by { font-size: 14px; color: var(--muted); }

@media (max-width: 480px) {
  h1 { font-size: 28px; }
  .stats { gap: 8px; }
  .stats div { padding: 10px 8px; }
  .stats b { font-size: 22px; }
  .stats span { font-size: 13px; }
}

/* ---- redesign: header, cards, charts */
.kicker { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--accent);
  background: var(--soft); border-radius: 999px; padding: 4px 12px; margin: 0 0 16px; }
.kicker .dot { width: 8px; height: 8px; border-radius: 50%; background: #2a78d6; }
.card { padding: 20px; box-shadow: 0 1px 2px rgba(0,0,0,.03); }
.card h3 { font-size: 19px; }
.card .out { margin-top: 8px; }
.qlabel { font-weight: 600; font-size: 14px; margin: 16px 0 0; }
#sec-headline { border-color: #cfdff3; background: linear-gradient(#fff, #fbfdff); }

.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; border-top: 1px solid var(--line); padding-top: 16px; }
.kpi { padding: 0 16px; display: flex; flex-direction: column; gap: 2px; border-left: 1px solid var(--line); }
.kpi:first-child { padding-left: 0; border-left: 0; }
.kpi b { font-size: 28px; line-height: 1.1; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.kpi span { font-size: 14px; line-height: 1.35; }
.kpi small { font-size: 12px; color: var(--muted); }

svg.chart { display: block; max-width: 100%; overflow: visible; }
svg .lbl { font-size: 14px; fill: var(--ink); }
svg .lbl .sub { font-size: 12px; fill: var(--muted); }
svg .lbl .big { font-size: 17px; font-weight: 700; }
svg .lbl.strong { font-weight: 600; }
svg .axis { font-size: 12px; fill: var(--muted); }
svg .grid { stroke: #ecebe6; stroke-width: 1; }
svg .flow { transition: fill-opacity .15s; cursor: pointer; }
svg .flow:hover { fill-opacity: .5; }
svg .tile { font-size: 11px; font-weight: 600; fill: #3b3b3b; pointer-events: none; }
svg .tile.on { fill: #fff; }
svg [data-tip] { cursor: pointer; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 14px; margin: 8px 0; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; flex: none; }
.who { margin-bottom: 8px; }
.stack { display: flex; gap: 2px; height: 22px; border-radius: 6px; overflow: hidden; background: #f0f0ec; }
.seg { display: block; min-width: 0; }
.seg:first-child { border-radius: 6px 0 0 6px; }
.seg:last-child { border-radius: 0 6px 6px 0; }

.map { margin: 4px 0 0; }
.scale { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin: 10px 0 0; }
.scale .ramp { display: flex; gap: 2px; }
.scale .ramp i { width: 18px; height: 10px; border-radius: 2px; display: block; }

.docs { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; counter-reset: d; }
.docs li { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; counter-increment: d; }
.docs .who-doc { font-size: 15px; }
.docs .who-doc b { margin-right: 6px; font-variant-numeric: tabular-nums; }
.docs .n { font-variant-numeric: tabular-nums; font-weight: 600; }
.track { background: #f0f0ec; }
.track span { background: var(--bar); }

.funnel li { display: block; padding: 10px 0; }
.funnel .frow { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; margin-bottom: 6px; }
#sec-funnel h4 { margin-top: 20px; }
#sec-funnel h4:first-child { margin-top: 4px; }

.tip { position: absolute; z-index: 10; pointer-events: none; opacity: 0; transition: opacity .12s; max-width: 240px;
  background: #171717; color: #fff; font-size: 13px; line-height: 1.4; padding: 8px 10px; border-radius: 8px; }

@media (max-width: 640px) {
  .kpis { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi b { font-size: 24px; }
  .card { padding: 16px; }
  .standout { font-size: 17px; }
}
.all { margin: 0; font-size: 15px; }
.docs .track { height: 4px; }

/* ---- second pass */
.headline { font-size: 22px; line-height: 1.35; font-weight: 650; margin: 4px 0 6px; letter-spacing: -0.01em; }
.sub { font-size: 17px; margin: 0 0 16px; color: #333; }
.lead { font-weight: 600; margin: 0 0 12px; }
.base { font-size: 13px; color: var(--muted); margin: 8px 0 0; }
.funnel b small { font-weight: 400; color: var(--muted); margin-left: 8px; font-size: 13px; }
.check li { display: grid; grid-template-columns: 1fr auto 56px; }
.check b { text-align: right; }
.check small.big { color: #b4441c; font-weight: 600; }
.dochead { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 8px; max-width: 560px; }
.docs { max-width: 560px; }
.example-link { display: inline-block; margin-top: 8px; font-size: 15px; }
@media (max-width: 640px) {
  .kpis { grid-template-columns: 1fr 1fr 1fr; }
  .kpi { padding: 0 8px; }
  .kpi b { font-size: 22px; }
  .kpi span { font-size: 13px; }
  .kpi small { display: none; }
  .headline { font-size: 20px; }
  .sub { font-size: 16px; }
  .chip:nth-child(n+3) { display: none; }
  .lede { font-size: 17px; }
  .docs li:nth-child(n+6) { display: none; }
}
