:root {
  --bg: #ffffff; --bg-soft: #f6f7fb; --text: #1b2033; --muted: #5d6580; --line: #e3e6f0;
  --accent: #4f46e5; --accent-dark: #4338ca; --accent-soft: #eceafd; --teal: #0d9488; --warn: #b45309;
  --radius: 12px; --shadow: 0 1px 2px rgba(27, 32, 51, .05), 0 6px 20px rgba(27, 32, 51, .06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1220; --bg-soft: #161a2e; --text: #e8eaf4; --muted: #9aa2c0; --line: #262b45;
    --accent: #8b85ff; --accent-dark: #a7a2ff; --accent-soft: #232650; --teal: #2dd4bf; --warn: #fbbf24;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
  }
}
* { box-sizing: border-box; }
html { color-scheme: light dark; scroll-padding-top: 72px; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.65 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; -webkit-text-size-adjust: 100%; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-dark); }
img, svg { max-width: 100%; }
h1, h2, h3 { line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: clamp(28px, 4.4vw, 42px); margin: 0 0 16px; }
h2 { font-size: 24px; margin: 40px 0 12px; }
h3 { font-size: 18px; margin: 24px 0 8px; }
h2.first { margin-top: 0; } p.more { margin-top: 20px; } p.copy { margin-top: 24px; }
p { margin: 0 0 16px; }
code { font: 14px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--bg-soft); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; }
pre { background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; overflow-x: auto; margin: 0 0 20px; }
pre code { background: none; border: 0; padding: 0; word-break: break-all; white-space: pre-wrap; }
table { width: 100%; border-collapse: collapse; margin: 0 0 24px; font-size: 15px; display: block; overflow-x: auto; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--bg-soft); font-weight: 600; white-space: nowrap; }
ul, ol { padding-left: 22px; margin: 0 0 18px; } li { margin-bottom: 6px; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 760px; }

/* header */
.site-header { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; min-height: 64px; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 20px; color: var(--text); text-decoration: none; letter-spacing: -.02em; }
.brand svg { width: 30px; height: 30px; }
.nav { display: flex; gap: 6px; }
.nav a { color: var(--text); text-decoration: none; padding: 8px 12px; border-radius: 8px; font-size: 15px; }
.nav a:hover, .nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-dark); }
.menu { display: none; }
.menu summary { list-style: none; cursor: pointer; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 15px; }
.menu summary::-webkit-details-marker { display: none; }
.menu .nav { position: absolute; right: 20px; top: 62px; flex-direction: column; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; box-shadow: var(--shadow); min-width: 200px; }
@media (max-width: 760px) { .nav.desktop { display: none; } .menu { display: block; } }

/* hero & sections */
.hero { padding: 64px 0 40px; background: radial-gradient(1200px 400px at 85% -10%, var(--accent-soft), transparent 60%); }
.hero p.lead { font-size: 19px; color: var(--muted); max-width: 640px; }
.hero .actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.btn { display: inline-block; padding: 11px 20px; border-radius: 10px; background: var(--accent); color: #fff; text-decoration: none; font-weight: 600; border: 1px solid var(--accent); cursor: pointer; font-size: 15px; }
.btn:hover { background: var(--accent-dark); color: #fff; }
.btn.secondary { background: transparent; color: var(--accent); }
.btn.secondary:hover { background: var(--accent-soft); color: var(--accent-dark); }
section.block { padding: 36px 0; }
.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.card { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); display: block; text-decoration: none; color: var(--text); }
a.card:hover { border-color: var(--accent); }
.card h3 { margin: 0 0 6px; color: var(--text); }
.card p { margin: 0; color: var(--muted); font-size: 15px; }
.card .meta { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.kicker { color: var(--accent); font-weight: 600; font-size: 14px; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px; }
.page-head { padding: 40px 0 8px; }
.page-head p.lead { color: var(--muted); font-size: 18px; }
.crumbs { font-size: 14px; color: var(--muted); margin-bottom: 12px; }
.crumbs a { color: var(--muted); }
.article { padding-bottom: 40px; }
.article h2 { margin-top: 36px; }
.callout { background: var(--accent-soft); border-radius: var(--radius); padding: 16px 18px; margin: 24px 0; }
dl.gloss dt { font-weight: 700; margin-top: 18px; } dl.gloss dd { margin: 4px 0 0; color: var(--muted); }

/* tools */
.tool { background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin: 16px 0 28px; }
.fields { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
label { display: block; font-size: 14px; color: var(--muted); }
label input, label select { display: block; width: 100%; margin-top: 6px; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; }
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.out { margin-top: 18px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; word-break: break-all; min-height: 52px; }
.results { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-top: 18px; }
.stat { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.stat b { display: block; font-size: 22px; letter-spacing: -.02em; } .stat span { color: var(--muted); font-size: 13px; }
.verdict { margin-top: 14px; padding: 12px 14px; border-radius: 10px; background: var(--accent-soft); }
.verdict.warn { background: color-mix(in srgb, var(--warn) 14%, var(--bg)); }
.row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.tabs { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-bottom: 16px; }
.tabs button { border: 0; background: transparent; padding: 8px 16px; font: inherit; cursor: pointer; color: var(--text); }
.tabs button[aria-pressed="true"] { background: var(--accent); color: #fff; }
.bars .bar { margin: 10px 0; } .bars .bar .label { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; margin-bottom: 4px; } .bars .bar .label span:last-child { text-align: right; }
.bars .track { background: var(--line); border-radius: 6px; height: 12px; overflow: hidden; } .bars .fill { background: var(--accent); height: 100%; width: 0; }
.note { color: var(--muted); font-size: 14px; }
#funnel-rows .fields { grid-template-columns: 2fr 1fr; margin-bottom: 10px; }
label.check { display: flex; align-items: center; gap: 8px; margin-top: 14px; color: var(--text); }
label.check input { width: auto; margin: 0; }

/* demo dashboard */
.kpis { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin: 18px 0; }
.kpi { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.kpi span { color: var(--muted); font-size: 13px; } .kpi b { display: block; font-size: 26px; letter-spacing: -.02em; }
.kpi i { font-style: normal; font-size: 13px; } .up { color: var(--teal); } .down { color: var(--warn); }
.panel { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); margin-bottom: 18px; }
.panel h3 { margin-top: 0; }
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font-size: 11px; font-family: inherit; }
.chart .grid { stroke: var(--line); stroke-width: 1; } .chart .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; } .chart .area { fill: var(--accent); opacity: .12; }
.chart .dot { fill: var(--accent); }
.two { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); }

/* footer */
.site-footer { border-top: 1px solid var(--line); margin-top: 48px; padding: 28px 0 40px; color: var(--muted); font-size: 14px; background: var(--bg-soft); }
.site-footer .cols { display: grid; gap: 28px 40px; grid-template-columns: 1.3fr 1fr 1fr 1fr; }
@media (max-width: 860px) { .site-footer .cols { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .site-footer .cols { grid-template-columns: 1fr; } }
.site-footer a { color: var(--muted); } .site-footer ul { list-style: none; padding: 0; margin: 0; } .site-footer li { margin: 4px 0; }
.err { text-align: center; padding: 80px 0; } .err .code { font-size: 72px; font-weight: 800; color: var(--accent); letter-spacing: -.04em; }
