:root {
  --bg: #fbf8f1;
  --surface: #ffffff;
  --surface-2: #f0ead8;
  --surface-3: #292018;
  --ink: #221a13;
  --muted: #635647;
  --accent: #166534;
  --accent-hover: #14532d;
  --accent-soft: #e4efe2;
  --gold: #b45309;
  --gold-soft: #fbeed4;
  --rule: rgba(34, 26, 19, 0.14);
  --rule-strong: rgba(34, 26, 19, 0.26);
  --ok-bg: #e4efe2;
  --ok-ink: #14532d;
  --warn-bg: #fbeed4;
  --warn-ink: #7c2d12;
  --bad-bg: #fbe3dc;
  --bad-ink: #7f1d1d;
  --font-sans: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-serif: "Newsreader", Georgia, "Times New Roman", serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --step-small: clamp(0.85rem, 0.83rem + 0.1vw, 0.92rem);
  --step-body: clamp(1rem, 0.97rem + 0.18vw, 1.08rem);
  --step-lead: clamp(1.12rem, 1.06rem + 0.22vw, 1.22rem);
  --step-h2: clamp(1.5rem, 1.2rem + 1.4vw, 2.15rem);
  --step-head: clamp(2rem, 1.45rem + 2.6vw, 3.2rem);
  --gap: 10px;
  --radius: 6px;
  --max-w: 1360px;
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); color: var(--ink); font-family: var(--font-sans); font-size: 16px; line-height: 1.55; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: var(--step-body); overflow-x: clip; }
img { display: block; max-width: 100%; height: auto; }
a { color: var(--accent); text-decoration: underline; text-underline-offset: 0.18em; text-decoration-thickness: 1.5px; }
a:hover { color: var(--accent-hover); }
a:focus-visible, button:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible, .dropzone:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3, h4 { margin: 0 0 0.45em; font-family: var(--font-serif); font-weight: 700; color: inherit; }
h1 { font-size: var(--step-head); line-height: 1.02; letter-spacing: -0.02em; }
h2 { font-size: var(--step-h2); line-height: 1.1; letter-spacing: -0.01em; }
h3, h4 { font-size: var(--step-lead); line-height: 1.25; }
p, ul, ol, dl, table, pre, blockquote { margin: 0 0 0.95rem; }
p, li { max-width: 70ch; overflow-wrap: anywhere; }
p:last-child, ul:last-child, ol:last-child { margin-bottom: 0; }
li + li { margin-top: 0.25rem; }
code, pre, kbd { font-family: var(--font-mono); font-size: 0.86em; }
p code, li code, td code, summary code, kbd { background: var(--surface-2); color: var(--ink); padding: 0.1em 0.36em; border-radius: 3px; }
pre { max-width: 100%; background: var(--surface-2); color: var(--ink); padding: 0.95rem 1.1rem; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; border-radius: var(--radius); }
.skip-link { position: absolute; left: -9999px; top: 8px; background: var(--surface-3); color: #fff; padding: 8px 14px; z-index: 10; }
.skip-link:focus { left: 8px; }

.board-shell { width: 100%; max-width: var(--max-w); margin: 0 auto; padding: 14px 20px; }
.top-bar { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: var(--gap); margin-bottom: var(--gap); }
.brand-tile { background: var(--surface-3); color: #fbf8f1; padding: 11px 16px; min-height: 46px; display: inline-flex; align-items: center; gap: 9px; font-family: var(--font-serif); font-weight: 700; font-size: 1.08rem; text-decoration: none; border-radius: var(--radius); }
.brand-tile:hover { background: var(--accent); color: #ffffff; }
.brand-leaf { width: 14px; height: 14px; background: #4ade80; border-radius: 0 70% 0 70%; flex-shrink: 0; }
.nav-tile { background: var(--surface); padding: 8px 18px; min-height: 46px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; border: 1px solid var(--rule); border-radius: var(--radius); }
.nav-tile a { color: var(--ink); text-decoration: none; font-size: var(--step-small); font-weight: 500; }
.nav-tile a:hover, .nav-tile a[aria-current="page"] { color: var(--accent); text-decoration: underline; }
.cta-tile { background: var(--accent); color: #ffffff; padding: 12px 20px; min-height: 46px; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: var(--step-small); text-decoration: none; border-radius: var(--radius); }
.cta-tile:hover { background: var(--accent-hover); color: #ffffff; }

.board-section { margin-top: clamp(40px, 5vw, 68px); }
.board-section--first { margin-top: 0; }
.tile-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gap); }
.tile { background: var(--surface); color: var(--ink); padding: 22px; display: flex; flex-direction: column; justify-content: space-between; min-width: 0; border: 1px solid var(--rule); border-radius: var(--radius); }
.tile--top { justify-content: flex-start; }
.tile-elev { background: var(--surface-2); }
.tile-photo { padding: 0; position: relative; overflow: hidden; min-height: 240px; }
.tile-photo img { width: 100%; height: 100%; min-height: 240px; max-height: 300px; object-fit: cover; display: block; }
.photo-strip { background: var(--surface-3); color: #fbf8f1; padding: 8px 14px; font-size: var(--step-small); line-height: 1.35; }

.c-12 { grid-column: span 12; }
.c-8  { grid-column: span 8; }
.c-7  { grid-column: span 7; }
.c-6  { grid-column: span 6; }
.c-5  { grid-column: span 5; }
.c-4  { grid-column: span 4; }
.c-3  { grid-column: span 3; }
.c-2  { grid-column: span 2; }

.eyebrow { font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--gold); margin: 0 0 6px; }
.hero-lead { font-size: var(--step-lead); line-height: 1.5; color: var(--ink); margin: 0.4rem 0 0.8rem; max-width: 72ch; }
.cta-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 10px; }
.btn-primary, .btn-ghost { padding: 11px 18px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: var(--step-small); text-decoration: none; cursor: pointer; font-family: var(--font-sans); border-radius: var(--radius); }
.btn-primary { background: var(--accent); color: #ffffff; border: 0; }
.btn-primary:hover { background: var(--accent-hover); color: #ffffff; }
.btn-ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--rule-strong); }
.btn-ghost:hover { background: var(--surface-3); color: #ffffff; }
.stat-note { font-size: var(--step-small); color: var(--muted); margin: 0; }
.stat-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin-top: 12px; }
.stat-pill { background: var(--surface-2); padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; border-radius: var(--radius); }
.stat-pill span { font-size: var(--step-small); color: var(--muted); }
.stat-pill strong { font-size: 0.98rem; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }

/* Interactive UI split */
[data-ui].ui-split { display: grid; grid-template-columns: minmax(0, 42fr) minmax(0, 58fr); background: var(--surface); color: var(--ink); border: 1px solid var(--rule-strong); border-radius: var(--radius); overflow: hidden; }
[data-ui] .ui-controls { padding: 18px; background: var(--surface-2); display: flex; flex-direction: column; gap: 12px; min-width: 0; }
[data-ui] .ui-output { padding: 20px; background: var(--surface); display: flex; flex-direction: column; justify-content: flex-start; gap: 14px; min-width: 0; }
[data-ui] .ctrl-field { display: flex; flex-direction: column; gap: 5px; }
[data-ui] .ctrl-field label, [data-ui] .ctrl-label { font-size: var(--step-small); font-weight: 600; color: var(--ink); }
[data-ui] select, [data-ui] input[type="number"], [data-ui] input[type="text"] {
  width: 100%; min-height: 42px; padding: 8px 12px; background: #ffffff; color: var(--ink);
  border: 1px solid var(--rule-strong); border-radius: 4px; font-family: var(--font-sans); font-size: var(--step-small); font-variant-numeric: tabular-nums;
}
[data-ui] .ui-kpi-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
[data-ui] .ui-kpi-grid.k3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
[data-ui] .ui-kpi { background: var(--surface-2); padding: 11px 13px; border-radius: 4px; min-width: 0; }
[data-ui] .ui-kpi span { display: block; font-size: 0.8rem; color: var(--muted); margin-bottom: 3px; }
[data-ui] .ui-kpi strong { display: block; font-size: 1.18rem; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
[data-ui] .ui-verdict { background: var(--surface-2); padding: 13px 15px; border-left: 4px solid var(--accent); border-radius: 0 4px 4px 0; }
[data-ui] .ui-verdict.is-warn { background: var(--warn-bg); color: var(--warn-ink); border-left-color: var(--gold); }
[data-ui] .ui-verdict.is-bad { background: var(--bad-bg); color: var(--bad-ink); border-left-color: #b91c1c; }
[data-ui] .ui-verdict.is-ok { background: var(--ok-bg); color: var(--ok-ink); border-left-color: var(--accent); }
[data-ui] .ui-verdict strong { display: block; font-size: var(--step-body); margin-bottom: 4px; }
[data-ui] .ui-verdict p { font-size: var(--step-small); margin: 0; max-width: none; }
[data-ui] .sub-h { font-family: var(--font-serif); font-size: 1.15rem; margin: 6px 0 0; }

/* Dropzone */
.dropzone { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 6px; padding: 26px 16px; min-height: 170px; background: #ffffff; border: 2px dashed var(--rule-strong); border-radius: var(--radius); cursor: pointer; transition: border-color 140ms ease, background 140ms ease; }
.dropzone:hover, .dropzone.is-drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.dropzone strong { font-family: var(--font-serif); font-size: 1.22rem; }
.dropzone span { font-size: var(--step-small); color: var(--muted); }
.dz-icon { width: 38px; height: 44px; border: 2px solid var(--accent); border-radius: 3px; position: relative; margin-bottom: 4px; }
.dz-icon::before { content: "XML"; position: absolute; bottom: 5px; left: 0; right: 0; font-family: var(--font-mono); font-size: 0.62rem; color: var(--accent); }
.file-hint { font-size: 0.84rem; color: var(--muted); background: #ffffff; padding: 10px 12px; border-radius: 4px; border: 1px solid var(--rule); }
.file-hint code { font-size: 0.8rem; }

/* Progress rows */
.prog-list { display: flex; flex-direction: column; gap: 7px; margin: 0; padding: 0; list-style: none; }
.prog-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; align-items: baseline; font-size: 0.88rem; margin: 0; max-width: none; }
.prog-row .pr-name { font-weight: 600; }
.prog-row .pr-val { font-family: var(--font-mono); font-size: 0.8rem; color: var(--muted); text-align: right; }
.prog-row .pr-bar { grid-column: 1 / -1; height: 7px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.prog-row .pr-bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 4px; transition: width 220ms ease-out; }
.prog-row.is-done .pr-bar i { background: var(--gold); }
.meter-big { height: 16px; background: var(--surface-2); border-radius: 8px; overflow: hidden; }
.meter-big i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), #4d7c0f); transition: width 260ms ease-out; }

/* Checklists */
.check-list { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }
.check-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; background: #ffffff; padding: 9px 12px; border: 1px solid var(--rule); border-radius: 4px; font-size: 0.88rem; margin: 0; max-width: none; cursor: pointer; }
.check-row input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }
.check-row .ck-pts { font-family: var(--font-mono); font-size: 0.78rem; color: var(--gold); white-space: nowrap; }
.check-row small { display: block; color: var(--muted); font-size: 0.78rem; }
.check-row:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.flag-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 6px; margin: 0; padding: 0; list-style: none; }
.flag-list li { margin: 0; padding: 8px 10px; border-radius: 4px; font-size: 0.84rem; background: var(--bad-bg); color: var(--bad-ink); max-width: none; }
.flag-list li.is-on { background: var(--ok-bg); color: var(--ok-ink); }
.flag-list code { font-size: 0.74rem; background: rgba(255,255,255,0.6); }
.miss-list { margin: 0; padding-left: 1.1rem; font-size: 0.86rem; }

/* Candles */
.candles { display: flex; gap: 14px; align-items: flex-end; justify-content: center; padding: 14px 0 4px; }
.candle { width: 22px; height: 54px; background: #e7dcc3; border-radius: 3px 3px 2px 2px; position: relative; }
.candle::before { content: ""; position: absolute; left: 50%; top: -18px; width: 12px; height: 16px; margin-left: -6px; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; background: #d6cdb8; }
.candle.is-lit { background: #f5e6c4; }
.candle.is-lit::before { background: radial-gradient(circle at 50% 70%, #fde68a 0 30%, #f59e0b 60%, #b45309 100%); box-shadow: 0 0 14px 4px rgba(245, 158, 11, 0.45); }

/* Path copy */
.path-out { display: flex; gap: 8px; align-items: stretch; }
.path-out code { flex: 1; display: block; background: var(--surface-3); color: #fbf8f1; padding: 12px 14px; border-radius: 4px; font-size: 0.86rem; overflow-wrap: anywhere; }
.step-list { margin: 0; padding-left: 1.2rem; font-size: 0.9rem; }

/* Walnut grid */
.nut-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.nut-cell { background: #ffffff; border: 1px solid var(--rule); border-radius: 4px; padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; font-size: 0.84rem; }
.nut-cell label { font-weight: 600; }
.nut-cell input { min-height: 36px !important; }

.next-row-title { font-size: var(--step-lead); margin-bottom: 10px; }
.next-card { text-decoration: none; gap: 8px; }
.next-card:hover { border-color: var(--accent); }
.next-q { font-weight: 700; color: var(--ink); font-size: 0.98rem; }
.next-a { font-size: var(--step-small); color: var(--muted); }
.next-go { font-size: var(--step-small); font-weight: 600; color: var(--accent); margin-top: auto; }

.table-wrap { width: 100%; overflow-x: auto; background: var(--surface); border-radius: 4px; }
table { width: 100%; border-collapse: collapse; font-size: var(--step-small); font-variant-numeric: tabular-nums; margin: 0; }
th, td { text-align: start; padding: 10px 12px; border-bottom: 1px solid var(--surface-2); vertical-align: top; }
th { background: var(--surface-2); font-weight: 600; color: var(--ink); }
.prose h3 { margin-top: 1.1rem; }

.faq-layout { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: var(--gap); align-items: start; }
.faq-sticky { position: sticky; top: 24px; padding-right: 12px; }
.faq-sticky p { color: var(--muted); margin-top: 8px; font-size: var(--step-small); }
.faq-stack { display: flex; flex-direction: column; gap: 8px; }
.faq-tile { background: var(--surface); color: var(--ink); border: 1px solid var(--rule); border-radius: var(--radius); }
.faq-tile summary { list-style: none; padding: 15px 18px; display: flex; align-items: center; justify-content: space-between; gap: 14px; font-weight: 600; cursor: pointer; }
.faq-tile summary::-webkit-details-marker { display: none; }
.faq-plus { width: 14px; height: 14px; position: relative; flex-shrink: 0; }
.faq-plus::before, .faq-plus::after { content: ""; position: absolute; background: currentColor; }
.faq-plus::before { top: 6px; left: 0; width: 14px; height: 2px; }
.faq-plus::after { top: 0; left: 6px; width: 2px; height: 14px; }
.faq-tile[open] { background: var(--surface-3); color: #fbf8f1; }
.faq-tile[open] .faq-plus::after { display: none; }
.faq-ans { padding: 0 18px 16px; font-size: var(--step-small); line-height: 1.55; }

.ad-slot { margin: 12px 0; background: var(--surface); padding: 6px 10px; overflow: hidden; border-radius: var(--radius); }
.ad-leader, .ad-300 { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 68px; }
.ad-n, .ad-native { display: block; width: 100%; text-align: center; }
.ad-slot-label { display: block; font-size: 0.78rem; color: var(--muted); margin-bottom: 4px; }
.ad-slot-pending { display: none; }

.footer-board { margin-top: clamp(52px, 7vw, 96px); display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gap); }
.footer-brand { font-family: var(--font-serif); font-size: var(--step-lead); font-weight: 700; margin-bottom: 8px; }
.footer-head { margin-bottom: 10px; display: block; }
.footer-wordmark { background: var(--surface-3); color: #fbf8f1; padding: 24px; display: flex; align-items: flex-end; min-height: 160px; border-radius: var(--radius); }
.footer-wordmark span { font-family: var(--font-serif); font-size: clamp(2rem, 5vw, 4.2rem); font-weight: 700; line-height: 0.92; }
.footer-cta-tile { background: var(--accent); color: #ffffff; padding: 22px; min-height: 160px; text-decoration: none; display: flex; flex-direction: column; justify-content: space-between; border-radius: var(--radius); }
.footer-cta-tile:hover { background: var(--accent-hover); color: #ffffff; }
.footer-cta-tile strong { font-size: var(--step-lead); line-height: 1.18; }
.footer-cta-arrow { align-self: flex-end; }
.footer-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 7px; }
.footer-list li + li { margin-top: 0; }
.footer-list a { text-decoration: none; color: var(--ink); font-size: var(--step-small); }
.footer-list a:hover { color: var(--accent); text-decoration: underline; }

.board-section--first h1 { margin-bottom: 0.25em; }
.board-section--first .tile { padding: 18px 20px; }

@media (max-width: 980px) {
  .top-bar { grid-template-columns: 1fr auto; }
  .nav-tile { grid-column: 1 / -1; order: 3; }
  .c-3, .c-2 { grid-column: span 6; }
  [data-ui].ui-split, .faq-layout { grid-template-columns: 1fr; }
  .faq-sticky { position: static; }
}
@media (max-width: 680px) {
  .board-shell { padding: 10px 12px; }
  .tile-grid, .footer-board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .c-12, .c-8, .c-7, .c-6, .c-5, .c-4 { grid-column: span 2; }
  .c-3, .c-2 { grid-column: span 1; }
  .tile { padding: 16px; }
  [data-ui] .ui-controls, [data-ui] .ui-output { padding: 14px; }
  [data-ui] .ui-kpi-grid.k3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .path-out { flex-direction: column; }
  .cta-tile { padding: 10px 12px; }
}
@media print {
  .top-bar, .ad-slot, .next-row, .footer-board, [data-no-print] { display: none !important; }
  body, .board-shell, .tile { background: #ffffff !important; }
}
