/* FilsBook pages: layout and components on the shared design tokens (tokens.css, from shared/theme.ts). */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 80px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { transition: none !important; animation: none !important; } }
body { margin: 0; background: var(--fb-bg); color: var(--fb-text); font: 16px/1.6 var(--fb-font); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.015em; }
h1 { font-size: clamp(2rem, 1.4rem + 2.6vw, 3.1rem); font-weight: 800; }
h2 { font-size: clamp(1.45rem, 1.2rem + 1vw, 1.9rem); font-weight: 800; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
a { color: var(--fb-primary); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--fb-focus); outline-offset: 2px; border-radius: 4px; }
img, svg { display: block; max-width: 100%; }
code { font: .92em var(--fb-mono); }
.muted { color: var(--fb-text-muted); }
.small { font-size: .88rem; }
.center { text-align: center; }

.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.wrap.narrow { max-width: 780px; }
@media (min-width: 720px) { .wrap { padding: 0 28px; } }

.skip-link { position: absolute; left: 12px; top: -60px; z-index: 50; background: var(--fb-primary); color: var(--fb-primary-text); padding: 10px 14px; border-radius: 10px; font-weight: 700; }
.skip-link:focus { top: 12px; }

/* account bar + top bar */
.acct-bar { background: var(--fb-surface-alt); border-bottom: 1px solid var(--fb-border); font-size: .85rem; }
.acct-inner { display: flex; gap: 8px; justify-content: flex-end; align-items: center; min-height: 34px; flex-wrap: wrap; }
.acct-text { color: var(--fb-text-muted); }
.acct-pro { color: var(--fb-primary); font-weight: 700; }
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--fb-bg) 92%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--fb-border); }
.topbar-inner { display: flex; align-items: center; gap: 16px; min-height: 62px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--fb-text); text-decoration: none; font-weight: 800; font-size: 1.15rem; letter-spacing: -.01em; }
.brand-mark { width: 30px; height: 30px; }
.bm-paper { fill: var(--fb-primary); }
.bm-lines { stroke: var(--fb-primary-text); stroke-width: 2; stroke-linecap: round; fill: none; }
.bm-coin { fill: #fbbf24; stroke: var(--fb-bg); stroke-width: 1.5; }
.bm-f { stroke: #78350f; stroke-width: 1.4; fill: none; stroke-linecap: round; }
.topnav { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.topnav a:not(.btn) { color: var(--fb-text-muted); text-decoration: none; font-weight: 600; padding: 8px 10px; border-radius: 8px; font-size: .95rem; }
.topnav a:not(.btn):hover, .topnav a[aria-current="page"] { color: var(--fb-text); background: var(--fb-surface-alt); }
@media (max-width: 560px) { .topnav a:not(.btn) { display: none; } }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 20px; border-radius: var(--fb-radius-md); font-weight: 700; text-decoration: none; border: 1px solid transparent; cursor: pointer; font-size: 1rem; }
.btn.small { min-height: 38px; padding: 0 14px; font-size: .92rem; }
.btn.primary { background: var(--fb-primary); color: var(--fb-primary-text); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: var(--fb-surface); color: var(--fb-text); border-color: var(--fb-border); }
.btn.ghost:hover { border-color: var(--fb-primary); }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin: 22px 0 0; }
.center .cta-row { justify-content: center; }

/* notices filled by the Worker */
.announce, .notice { margin: 0; padding: 10px 16px; text-align: center; font-weight: 600; font-size: .95rem; }
.announce { background: var(--fb-primary-soft); color: var(--fb-primary-soft-text); }
.notice { background: var(--fb-warn-soft); color: var(--fb-warn); }

/* hero */
.hero { padding: 48px 0 56px; }
.hero-grid { display: grid; gap: 40px; align-items: center; }
@media (min-width: 900px) { .hero-grid { grid-template-columns: 1.1fr .9fr; } .hero { padding: 72px 0 80px; } }
.eyebrow { font-size: .8rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--fb-primary); margin-bottom: 12px; }
.lead { font-size: 1.15rem; color: var(--fb-text-muted); max-width: 40em; }
.hero-note { margin-top: 18px; color: var(--fb-text-muted); font-size: .92rem; }

.hero-art { margin: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; position: relative; justify-items: center; }
@media (min-width: 520px) { .hero-art { grid-template-columns: 1fr 1fr; align-items: center; } }
.hero-art figcaption { grid-column: 1 / -1; font-size: .8rem; color: var(--fb-text-muted); margin-top: 12px; }
.mock-receipt { width: 100%; max-width: 240px; background: #fffef8; color: #222; font: 13px/1.5 var(--fb-mono); padding: 18px 16px 22px; border-radius: 4px; box-shadow: var(--fb-shadow); transform: rotate(-2deg); border: 1px solid #e6e1d3; }
.mock-receipt p { margin: 0; }
.mr-head { text-align: center; font-weight: 800; margin-bottom: 8px !important; }
.mr-head span { font-weight: 600; font-family: var(--fb-font); }
.mr-meta { text-align: center; font-size: 11px; color: #555; margin-bottom: 10px !important; }
.mr-line { display: flex; justify-content: space-between; gap: 8px; }
.mr-sub { border-top: 1px dashed #999; margin-top: 6px !important; padding-top: 6px; }
.mr-total { font-weight: 800; border-top: 1px dashed #999; margin-top: 6px !important; padding-top: 6px; }
.mock-card { width: 100%; max-width: 260px; background: var(--fb-surface); border: 1px solid var(--fb-border); border-radius: var(--fb-radius-lg); padding: 16px 18px; box-shadow: var(--fb-shadow); margin-top: -12px; position: relative; }
@media (min-width: 520px) { .mock-card { margin: 40px 0 0 -24px; } }
.mc-title { font-weight: 800; font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; color: var(--fb-primary); margin-bottom: 8px !important; }
.mock-card dl { margin: 0; display: grid; gap: 4px; font-size: .9rem; }
.mock-card dl div { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--fb-border); padding: 3px 0; }
.mock-card dt { color: var(--fb-text-muted); }
.mock-card dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; overflow-wrap: anywhere; }
.mc-check { margin: 10px 0 0 !important; font-size: .85rem; font-weight: 700; color: var(--fb-primary); }

/* bands */
.band { padding: 56px 0; }
.band.alt { background: var(--fb-surface); border-top: 1px solid var(--fb-border); border-bottom: 1px solid var(--fb-border); }
.howto { list-style: none; counter-reset: step; margin: 24px 0 0; padding: 0; display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.howto li { counter-increment: step; background: var(--fb-surface); border: 1px solid var(--fb-border); border-radius: var(--fb-radius-lg); padding: 18px; position: relative; }
.howto li::before { content: counter(step); display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--fb-primary-soft); color: var(--fb-primary-soft-text); font-weight: 800; margin-bottom: 10px; }
.howto h3 { font-size: 1.02rem; }
.howto p { margin: 0; color: var(--fb-text-muted); font-size: .95rem; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; margin: 0 0 16px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--fb-border); vertical-align: top; }
.facts th { width: 30%; white-space: nowrap; color: var(--fb-text); }
.facts td { color: var(--fb-text-muted); }

.checks { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 10px; }
.checks li { padding-left: 30px; position: relative; }
.checks li::before { content: "✓"; position: absolute; left: 0; top: 0; width: 22px; height: 22px; border-radius: 50%; background: var(--fb-primary-soft); color: var(--fb-primary-soft-text); font-weight: 800; font-size: .8rem; display: grid; place-items: center; }

.plans { display: grid; gap: 18px; margin: 24px 0 18px; }
@media (min-width: 760px) { .plans { grid-template-columns: 1fr 1fr; } }
.plan { background: var(--fb-bg); border: 1px solid var(--fb-border); border-radius: var(--fb-radius-xl); padding: 24px; }
.plan.pro { border: 2px solid var(--fb-primary); background: var(--fb-surface); }
.plan-price { font-size: 2rem; font-weight: 800; margin: 0 0 4px; letter-spacing: -.02em; }
.plan-note { color: var(--fb-text-muted); }

.faq details { border-bottom: 1px solid var(--fb-border); padding: 4px 0; }
.faq summary { cursor: pointer; font-weight: 700; padding: 12px 0; list-style: none; position: relative; padding-right: 28px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 4px; top: 10px; font-size: 1.3rem; color: var(--fb-primary); }
.faq details[open] summary::after { content: "–"; }
.faq details p { color: var(--fb-text-muted); }
.cta-box { text-align: center; }
.cta-box .cta-row { justify-content: center; }

/* documents (privacy, terms, delete-account, guides) */
.doc-page { padding-top: 28px; padding-bottom: 64px; }
.doc-page h2 { margin-top: 1.6em; font-size: 1.35rem; }
.doc-page li { margin-bottom: .5em; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0 0 18px; font-size: .88rem; color: var(--fb-text-muted); }
.crumbs li + li::before { content: "›"; margin-right: 6px; }
.crumbs a { color: var(--fb-text-muted); }
.tldr { background: var(--fb-primary-soft); color: var(--fb-primary-soft-text); border-radius: var(--fb-radius-md); padding: 14px 18px; margin: 18px 0; }
.tldr-label { font-weight: 800; margin-bottom: 4px; }
.tldr p:last-child { margin: 0; }
.link-cards { list-style: none; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.link-cards a { display: block; padding: 14px 16px; border: 1px solid var(--fb-border); border-radius: var(--fb-radius-md); text-decoration: none; background: var(--fb-surface); color: var(--fb-text); height: 100%; }
.link-cards span { display: block; color: var(--fb-text-muted); font-size: .9rem; margin-top: 4px; }
.author-box { margin-top: 32px; padding: 16px 18px; border: 1px solid var(--fb-border); border-radius: var(--fb-radius-md); background: var(--fb-surface); font-size: .92rem; }
.author-box p:last-child { margin: 0; }

/* footer */
.site-footer { border-top: 1px solid var(--fb-border); background: var(--fb-surface); padding: 40px 0 28px; font-size: .92rem; }
.footer-cols { display: grid; gap: 24px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.footer-head { font-weight: 800; margin-bottom: 8px; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.site-footer a { color: var(--fb-text-muted); text-decoration: none; }
.site-footer a:hover { color: var(--fb-primary); text-decoration: underline; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; border-top: 1px solid var(--fb-border); margin-top: 28px; padding-top: 18px; color: var(--fb-text-muted); }
.footer-inner p { margin: 0; }
.footer-inner nav { display: flex; gap: 14px; }

/* guides: hub, calculator, code samples, FAQ list */
.article-head { margin-bottom: 8px; }
.sub-head { margin-top: 28px; }
.link-cards.cols-3 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.link-cards a:hover { border-color: var(--fb-primary); }
.hub section { margin-top: 28px; }
.related { margin-top: 32px; }
.faq-list { margin-top: 28px; }
.faq-list h3 { margin-top: 18px; }
.cta-box { margin-top: 32px; padding: 22px; border: 1px solid var(--fb-border); border-radius: var(--fb-radius-lg); background: var(--fb-surface); }
.band .cta-box { border: 0; background: transparent; padding: 0; margin-top: 0; }
.quote { border-left: 4px solid var(--fb-primary); padding: 8px 14px; background: var(--fb-surface); border-radius: 0 var(--fb-radius-sm) var(--fb-radius-sm) 0; }
pre.code { overflow-x: auto; background: var(--fb-surface-alt); border: 1px solid var(--fb-border); border-radius: var(--fb-radius-md); padding: 12px 14px; font-size: .82rem; line-height: 1.5; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
.calc { background: var(--fb-surface); border: 2px solid var(--fb-primary); border-radius: var(--fb-radius-lg); padding: 18px 20px; margin: 24px 0; }
.calc h2 { margin-top: 0; font-size: 1.25rem; }
.calc-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); align-items: start; }
.calc-field { display: grid; gap: 6px; font-weight: 700; }
.calc-field input { min-height: 48px; padding: 8px 12px; font-size: 1.25rem; border-radius: var(--fb-radius-sm); border: 1px solid var(--fb-border); background: var(--fb-bg); font-variant-numeric: tabular-nums; width: 100%; }
.calc-mode { border: 0; padding: 0; margin: 0; display: grid; gap: 6px; }
.calc-mode legend { font-weight: 700; margin-bottom: 6px; padding: 0; }
.calc-mode label { display: flex; gap: 8px; align-items: center; }
.calc-out { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 16px 0 6px; }
.calc-out div { background: var(--fb-primary-soft); color: var(--fb-primary-soft-text); border-radius: var(--fb-radius-md); padding: 10px 12px; }
.calc-out dt { font-size: .82rem; font-weight: 700; }
.calc-out dd { margin: 2px 0 0; font-size: 1.15rem; font-weight: 800; font-variant-numeric: tabular-nums; }
@media (max-width: 420px) { .calc-out { grid-template-columns: 1fr; } }
