/* Anvare — "Quiet SaaS" design system
   Mobile-first. Hairline borders, one indigo accent, Inter, 8px spacing scale.
   Tokens: full light palette on :root; dark palette under prefers-color-scheme
   (guarded) and again under [data-theme="dark"] so the header toggle wins. */

:root {
  color-scheme: light;
  --bg: #f9f9fb;
  --surface: #ffffff;
  --surface-2: #f3f3f6;
  --ink: #18181b;
  --ink-2: #52525b;
  --ink-3: #63636e;
  --line: #e4e4e7;
  --line-2: #c9c9cf;
  --accent: #4f46e5;
  --accent-soft: #eef2ff;
  --accent-line: #c7d2fe;
  --btn-bg: #4f46e5;
  --btn-hover: #4338ca;
  --btn-ink: #ffffff;
  --danger: #b91c1c;
  --ok: #15803d;
  --header-bg: rgba(249, 249, 251, .8);
  --sheet-shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 12px 32px rgba(0, 0, 0, .07);
  --show-sun: none;
  --show-moon: inline;
  --bf-bg: #eef2ff; --bf-ink: #3730a3;
  --bh-bg: #ecfdf5; --bh-ink: #065f46;
  --be-bg: #fffbeb; --be-ink: #92400e;
  --bd-bg: #f0f9ff; --bd-ink: #075985;
  --bc-bg: #f5f3ff; --bc-ink: #5b21b6;
  --bb-bg: #f0fdfa; --bb-ink: #115e59;
  --ba-bg: #fdf4ff; --ba-ink: #86198f;
  --radius: 10px;
  --radius-s: 6px;
  --header-h: 56px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #101013;
    --surface: #17171a;
    --surface-2: #1e1e22;
    --ink: #ededef;
    --ink-2: #a1a1aa;
    --ink-3: #8b8b95;
    --line: #27272a;
    --line-2: #45454d;
    --accent: #a5b4fc;
    --accent-soft: #1b1c33;
    --accent-line: #34377a;
    --btn-bg: #4f46e5;
    --btn-hover: #6366f1;
    --danger: #f87171;
    --ok: #4ade80;
    --header-bg: rgba(16, 16, 19, .72);
    --sheet-shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px rgba(0, 0, 0, .5);
    --show-sun: inline;
    --show-moon: none;
    --bf-bg: #1e1b4b; --bf-ink: #a5b4fc;
    --bh-bg: #052e16; --bh-ink: #86efac;
    --be-bg: #451a03; --be-ink: #fcd34d;
    --bd-bg: #082f49; --bd-ink: #7dd3fc;
    --bc-bg: #2e1065; --bc-ink: #c4b5fd;
    --bb-bg: #042f2e; --bb-ink: #5eead4;
    --ba-bg: #4a044e; --ba-ink: #f0abfc;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101013;
  --surface: #17171a;
  --surface-2: #1e1e22;
  --ink: #ededef;
  --ink-2: #a1a1aa;
  --ink-3: #8b8b95;
  --line: #27272a;
  --line-2: #45454d;
  --accent: #a5b4fc;
  --accent-soft: #1b1c33;
  --accent-line: #34377a;
  --btn-bg: #4f46e5;
  --btn-hover: #6366f1;
  --danger: #f87171;
  --ok: #4ade80;
  --header-bg: rgba(16, 16, 19, .72);
  --sheet-shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px rgba(0, 0, 0, .5);
  --show-sun: inline;
  --show-moon: none;
  --bf-bg: #1e1b4b; --bf-ink: #a5b4fc;
  --bh-bg: #052e16; --bh-ink: #86efac;
  --be-bg: #451a03; --be-ink: #fcd34d;
  --bd-bg: #082f49; --bd-ink: #7dd3fc;
  --bc-bg: #2e1065; --bc-ink: #c4b5fd;
  --bb-bg: #042f2e; --bb-ink: #5eead4;
  --ba-bg: #4a044e; --ba-ink: #f0abfc;
}
@media (min-width: 760px) { :root { --header-h: 60px; } }

/* ---------- base ---------- */
*, ::before, ::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; font-size: 16px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
[hidden] { display: none !important; }
img, svg { max-width: 100%; vertical-align: middle; }
a { color: var(--accent); text-decoration: none; text-underline-offset: 2px; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-weight: 600; line-height: 1.2; letter-spacing: -.02em; margin: 0; text-wrap: balance; }
h1 { font-size: 1.75rem; margin-bottom: 8px; }
h2 { font-size: 1.125rem; letter-spacing: -.01em; margin: 32px 0 12px; }
h3 { font-size: 1rem; letter-spacing: -.005em; margin: 24px 0 8px; }
p { margin: 0 0 12px; }
.lede { color: var(--ink-2); font-size: 1.0625rem; max-width: 62ch; margin: 0 0 24px; }
.wrap { max-width: 960px; margin: 0 auto; padding: 0 20px; }
.page { padding: 32px 20px 64px; }
.eyebrow, .related h2 {
  font-size: .75rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-3); margin: 0 0 12px;
}
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link { position: absolute; left: 8px; top: -48px; z-index: 100; padding: 8px 12px; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius-s); color: var(--ink); font-weight: 500; }
.skip-link:focus { top: 8px; }
[id] { scroll-margin-top: calc(var(--header-h) + 16px); }
@media (min-width: 760px) {
  h1 { font-size: 2.125rem; }
  .page { padding: 48px 20px 80px; }
}

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--header-bg);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; gap: 8px; height: var(--header-h); }
.brand {
  display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0;
  font-weight: 600; font-size: 1rem; letter-spacing: -.01em; color: var(--ink); white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand svg { color: var(--accent); }
.site-nav {
  display: flex; align-items: center; gap: 2px; flex: 1; min-width: 0;
  overflow-x: auto; scrollbar-width: none; padding-left: 4px;
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent);
  mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent);
}
.site-nav::-webkit-scrollbar { display: none; }
.site-nav::after { content: ""; flex: 0 0 28px; }
.site-nav a {
  flex-shrink: 0; color: var(--ink-2); font-size: .875rem; font-weight: 500;
  padding: 6px 10px; border-radius: var(--radius-s); white-space: nowrap;
}
.site-nav a:hover { color: var(--ink); background: var(--surface-2); text-decoration: none; }
.theme-toggle {
  flex-shrink: 0; margin-left: auto; display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border: 1px solid var(--line); border-radius: var(--radius-s);
  background: transparent; color: var(--ink-2); cursor: pointer;
}
.theme-toggle:hover { background: var(--surface-2); color: var(--ink); }
.theme-toggle .i-sun { display: var(--show-sun); }
.theme-toggle .i-moon { display: var(--show-moon); }
@media (min-width: 760px) {
  .site-nav { flex: 0 1 auto; margin-left: auto; padding: 0; overflow: visible; -webkit-mask-image: none; mask-image: none; }
  .site-nav::after { display: none; }
  .theme-toggle { margin-left: 0; }
}

/* ---------- ad wells (native, bordered; hidden while empty) ---------- */
.ad-slot { min-height: 0; }
.ad-slot:empty { display: none; }
.ad-slot:not(:empty) {
  margin: 16px 0; padding: 12px; text-align: center;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
}
.ad-slot:not(:empty)::before {
  content: "Advertisement"; display: block; margin-bottom: 8px;
  font-size: .6875rem; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3);
}
.ad-slot--top:not(:empty) { margin: 20px 0 0; }
.ad-slot--bottom:not(:empty) { margin: 0 0 24px; }

/* ---------- cards ---------- */
.calc, .builder__form {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; margin-bottom: 24px;
}
.calc > h2:first-child, .calc > h3:first-child { margin-top: 0; }
.calc--muted { background: var(--surface-2); }
.calc[style*="fbfbfd"] { background: var(--surface-2) !important; }
.calc ul, .calc ol { margin: 8px 0 0; padding-left: 1.25em; }
.calc li { margin: 6px 0; font-size: .9375rem; color: var(--ink-2); overflow-wrap: anywhere; }
@media (min-width: 560px) { .calc, .builder__form { padding: 24px; } }

/* ---------- fields ---------- */
.calc-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 560px) { .calc-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 760px) { .calc-grid--3 { grid-template-columns: repeat(3, 1fr); } }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { font-size: .875rem; font-weight: 500; color: var(--ink-2); }
.field input, .field select, .field textarea, .tool-search, .text-tool__in, .text-tool__out {
  width: 100%; padding: 9px 12px; font-size: 1rem;
  border: 1px solid var(--line-2); border-radius: var(--radius-s);
  background: var(--surface); color: var(--ink); font-variant-numeric: tabular-nums;
  transition: border-color .15s, background .15s;
}
.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--ink-3); }
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible,
.tool-search:focus-visible, .text-tool__in:focus-visible, .text-tool__out:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent);
}
.field select {
  appearance: none; -webkit-appearance: none; padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.field .hint { font-size: .8125rem; color: var(--ink-3); line-height: 1.45; }
::placeholder { color: var(--ink-3); opacity: 1; }
input[type="search"]::-webkit-search-decoration { -webkit-appearance: none; }

/* ---------- buttons ---------- */
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 20px; }
.calc-btn, .btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 0 16px; border-radius: var(--radius-s);
  font-size: .9375rem; font-weight: 500; line-height: 1; white-space: nowrap; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.calc-btn { background: var(--btn-bg); color: var(--btn-ink); border: 1px solid transparent; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12); }
.calc-btn:hover { background: var(--btn-hover); text-decoration: none; }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line-2); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--ink-3); text-decoration: none; }
.btn-sm { min-height: 32px; padding: 0 10px; font-size: .8125rem; }
.calc-btn:disabled, .btn-ghost:disabled { opacity: .5; cursor: not-allowed; }
.calc-btn:disabled:hover { background: var(--btn-bg); }

/* ---------- result panel ---------- */
.result {
  display: none; margin-top: 20px; padding: 16px 18px;
  border: 1px solid var(--accent-line); border-radius: var(--radius-s); background: var(--accent-soft);
}
.result.show { display: block; }
.result .big {
  font-size: 1.75rem; font-weight: 600; letter-spacing: -.02em; line-height: 1.15;
  color: var(--accent); font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}
.result .note { margin-top: 4px; }
.result table { width: 100%; border-collapse: collapse; margin-top: 14px; font-size: .9375rem; font-variant-numeric: tabular-nums; }
.result td { padding: 8px 0; border-top: 1px solid var(--accent-line); vertical-align: top; }
.result td:last-child { text-align: right; font-weight: 500; white-space: nowrap; padding-left: 16px; }
@media (min-width: 560px) { .result { padding: 20px 22px; } .result .big { font-size: 2rem; } }
.note { font-size: .875rem; color: var(--ink-2); margin: 12px 0 0; line-height: 1.55; }
.note + .note { margin-top: 8px; }
.table { width: 100%; border-collapse: collapse; font-size: .9375rem; font-variant-numeric: tabular-nums; }
.table th { font-size: .8125rem; font-weight: 500; color: var(--ink-2); text-align: left; }
.table th, .table td { padding: 8px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.table .num { text-align: right; }
.msg { margin-top: 12px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: var(--radius-s); background: var(--surface); font-size: .875rem; }
.msg--error { color: var(--danger); border-color: currentColor; }
.msg--ok { color: var(--ok); border-color: currentColor; }

/* ---------- faq ---------- */
.faq { margin: 40px 0 32px; }
.faq h2 { margin: 0 0 4px; }
.faq dt { font-weight: 600; margin-top: 20px; letter-spacing: -.005em; }
.faq dd { margin: 6px 0 0; color: var(--ink-2); max-width: 70ch; }

/* ---------- badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px;
  border-radius: 999px; font-size: .75rem; font-weight: 500; letter-spacing: .01em; line-height: 1;
  white-space: nowrap; background: var(--surface-2); color: var(--ink-2);
}
.badge--finance { background: var(--bf-bg); color: var(--bf-ink); }
.badge--health { background: var(--bh-bg); color: var(--bh-ink); }
.badge--everyday { background: var(--be-bg); color: var(--be-ink); }
.badge--documents { background: var(--bd-bg); color: var(--bd-ink); }
.badge--career { background: var(--bc-bg); color: var(--bc-ink); }
.badge--business { background: var(--bb-bg); color: var(--bb-ink); }
.badge--ai { background: var(--ba-bg); color: var(--ba-ink); }

/* ---------- per-category page theme ----------
   Every tool page carries a category class on <body>. Header/footer chrome stays neutral
   (so navigating between sections never feels jarring), but the content area — links, focus
   rings, buttons, the first card's top edge and the result panel — picks up that category's
   colour, reusing the same badge tokens above so it's always the same hue family. Buttons get
   their own solid, theme-independent fill (readable on both light and dark) since the badge
   tints are pastel washes, not solid enough for button text. */
body.cat-finance   { --accent: var(--bf-ink); --accent-soft: var(--bf-bg); --btn-bg: #4f46e5; --btn-hover: #4338ca; }
body.cat-health    { --accent: var(--bh-ink); --accent-soft: var(--bh-bg); --btn-bg: #059669; --btn-hover: #047857; }
body.cat-everyday  { --accent: var(--be-ink); --accent-soft: var(--be-bg); --btn-bg: #b45309; --btn-hover: #92400e; }
body.cat-documents { --accent: var(--bd-ink); --accent-soft: var(--bd-bg); --btn-bg: #0369a1; --btn-hover: #075985; }
body.cat-career    { --accent: var(--bc-ink); --accent-soft: var(--bc-bg); --btn-bg: #7c3aed; --btn-hover: #6d28d9; }
body.cat-business  { --accent: var(--bb-ink); --accent-soft: var(--bb-bg); --btn-bg: #0f766e; --btn-hover: #115e59; }
body.cat-ai        { --accent: var(--ba-ink); --accent-soft: var(--ba-bg); --btn-bg: #a21caf; --btn-hover: #86198f; }
/* first card on a tool page gets a coloured top edge — a quiet per-section signature */
.page > .calc:first-of-type, .page > .badge + .lede + .calc { border-top: 3px solid var(--accent); }
/* "you are here" in the header nav, coloured to match */
.site-nav a[href$="#finance"], .site-nav a[href$="#health"], .site-nav a[href$="#everyday"],
.site-nav a[href$="#documents"], .site-nav a[href$="#career"], .site-nav a[href$="#business"], .site-nav a[href$="#ai"] {
  transition: color .15s, background .15s;
}
body.cat-finance .site-nav a[href$="#finance"], body.cat-health .site-nav a[href$="#health"],
body.cat-everyday .site-nav a[href$="#everyday"], body.cat-documents .site-nav a[href$="#documents"],
body.cat-career .site-nav a[href$="#career"], body.cat-business .site-nav a[href$="#business"],
body.cat-ai .site-nav a[href$="#ai"] {
  color: var(--accent); background: var(--accent-soft);
}

/* ---------- back-to-index link (tool pages only) ---------- */
.back-link {
  display: inline-flex; align-items: center; gap: 6px; margin-bottom: 16px;
  font-size: .875rem; font-weight: 500; color: var(--ink-2);
}
.back-link:hover { color: var(--accent); text-decoration: none; }
.back-link svg { width: 15px; height: 15px; }

/* a little life when a result appears, respecting reduced-motion (handled globally below) */
@keyframes result-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.result.show { animation: result-in .25s ease-out; }

/* ---------- homepage ---------- */
.hero { position: relative; padding: 44px 0 8px; text-align: center; overflow: clip; }
.hero::before {
  content: ""; position: absolute; top: -120px; left: 50%; width: 640px; height: 320px;
  transform: translateX(-50%); pointer-events: none; z-index: -1;
  background: radial-gradient(closest-side, var(--accent-soft), transparent 70%);
  opacity: .9;
}
.hero h1 {
  font-size: 2.125rem; font-weight: 700; letter-spacing: -.03em; margin-bottom: 12px;
  background: linear-gradient(135deg, var(--ink) 40%, var(--accent));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.hero p { color: var(--ink-2); font-size: 1.0625rem; max-width: 56ch; margin: 0 auto; }
.hero-stats {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 14px;
  margin: 14px 0 0; font-size: .8125rem; font-weight: 500; color: var(--ink-3);
}
.hero-stats b { color: var(--ink-2); font-weight: 600; }
.hero-stats .dot { opacity: .5; }
.tool-search-wrap { position: relative; max-width: 520px; margin: 24px auto 0; }
.tool-search-wrap svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.tool-search {
  min-height: 48px; padding-left: 42px; border-radius: 10px; appearance: none; -webkit-appearance: none;
  box-shadow: var(--sheet-shadow);
}
.tool-search__empty { text-align: center; color: var(--ink-2); padding: 40px 0; }

.category { margin: 44px 0 0; }
.category h2 {
  display: flex; align-items: center; gap: 10px; margin: 0; padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.category h2 small { font-size: .8125rem; font-weight: 500; color: var(--ink-3); letter-spacing: 0; }
.cat-icon {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 30px; height: 30px; border-radius: 9px;
}
.cat-icon svg { width: 17px; height: 17px; }
.category--finance .cat-icon { background: var(--bf-bg); color: var(--bf-ink); }
.category--health .cat-icon { background: var(--bh-bg); color: var(--bh-ink); }
.category--everyday .cat-icon { background: var(--be-bg); color: var(--be-ink); }
.category--documents .cat-icon { background: var(--bd-bg); color: var(--bd-ink); }
.category--career .cat-icon { background: var(--bc-bg); color: var(--bc-ink); }
.category--business .cat-icon { background: var(--bb-bg); color: var(--bb-ink); }
.category--ai .cat-icon { background: var(--ba-bg); color: var(--ba-ink); }

.calc-list, .related ul { display: grid; grid-template-columns: 1fr; gap: 10px; list-style: none; padding: 0; margin: 16px 0 0; }
.calc-list li, .related li {
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.calc-list li:hover, .related li:hover {
  border-color: var(--line-2); transform: translateY(-2px); box-shadow: var(--sheet-shadow);
}
.related a { display: block; padding: 14px 16px; color: var(--ink); font-weight: 500; font-size: .9375rem; line-height: 1.35; }
.related a:hover { text-decoration: none; }
.related a > span:not(.badge) { display: block; margin-top: 3px; font-weight: 400; font-size: .8125rem; color: var(--ink-3); }

/* homepage cards only: icon + title/hint side by side (kept separate from .related, which every
   hand-written tool page already links via the simpler text+span grammar) */
.calc-list a {
  display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px;
  color: var(--ink); font-weight: 600; font-size: .9375rem; line-height: 1.35;
}
.calc-list a:hover { text-decoration: none; }
.calc-list a .tool-hint { display: block; margin-top: 3px; font-weight: 400; font-size: .8125rem; color: var(--ink-3); }
.tool-icon {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 34px; height: 34px; border-radius: 9px; margin-top: 1px;
}
.tool-icon svg { width: 18px; height: 18px; }
.tool-icon--finance { background: var(--bf-bg); color: var(--bf-ink); }
.tool-icon--health { background: var(--bh-bg); color: var(--bh-ink); }
.tool-icon--everyday { background: var(--be-bg); color: var(--be-ink); }
.tool-icon--documents { background: var(--bd-bg); color: var(--bd-ink); }
.tool-icon--career { background: var(--bc-bg); color: var(--bc-ink); }
.tool-icon--business { background: var(--bb-bg); color: var(--bb-ink); }
.tool-icon--ai { background: var(--ba-bg); color: var(--ba-ink); }

@media (min-width: 560px) { .calc-list, .related ul { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 760px) {
  .hero { padding: 68px 0 16px; }
  .hero h1 { font-size: 3rem; }
  .calc-list, .related ul { grid-template-columns: repeat(3, 1fr); gap: 12px; }
}
.related { margin: 48px 0 0; padding-top: 24px; border-top: 1px solid var(--line); }
@media (prefers-contrast: more) {
  .hero h1 { -webkit-text-fill-color: initial; background: none; color: var(--ink); }
}

/* ---------- file tool ---------- */
.dropzone {
  display: block; position: relative; padding: 32px 20px; text-align: center; cursor: pointer;
  border: 1px dashed var(--line-2); border-radius: var(--radius); background: var(--surface);
  transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone--active { border-color: var(--accent); background: var(--accent-soft); }
.dropzone:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.dropzone__icon {
  display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px;
  border-radius: 50%; background: var(--surface-2); color: var(--ink-2); margin-bottom: 12px;
}
.dropzone:hover .dropzone__icon, .dropzone--active .dropzone__icon { background: var(--surface); color: var(--accent); }
.dropzone__title { font-weight: 500; margin: 0 0 4px; }
.dropzone__hint { font-size: .875rem; color: var(--ink-3); margin: 0; }
.dropzone__browse { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.file-list { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.file-list li {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; font-size: .9375rem;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
}
.file-list li svg { color: var(--ink-3); flex-shrink: 0; }
.file-list__name { font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-list__meta { color: var(--ink-3); font-size: .8125rem; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.file-list__remove { margin-left: auto; }
.progress { height: 6px; margin: 16px 0 0; border-radius: 999px; background: var(--line); overflow: hidden; }
.progress__bar { height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width .2s; }
.progress--busy .progress__bar { width: 40%; animation: slide 1.2s ease-in-out infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
.progress__label { margin-top: 6px; font-size: .8125rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* ---------- text tool ---------- */
.text-tool { display: grid; grid-template-columns: 1fr; gap: 12px; }
.text-tool__bar { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.text-tool__count { margin-left: auto; font-size: .8125rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.text-tool__pane { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.text-tool__label { font-size: .8125rem; font-weight: 500; color: var(--ink-2); }
.text-tool__in, .text-tool__out { min-height: 240px; padding: 12px 14px; border-radius: 8px; line-height: 1.6; resize: vertical; font-variant-numeric: normal; }
.text-tool__out { background: var(--surface-2); }
@media (min-width: 760px) {
  .text-tool:not(.text-tool--stacked) { grid-template-columns: 1fr 1fr; }
  .text-tool__in, .text-tool__out { min-height: 320px; font-size: .9375rem; }
}

/* ---------- builder tool ---------- */
.builder { display: grid; grid-template-columns: 1fr; gap: 24px; align-items: start; }
.builder__form { margin-bottom: 0; }
.builder__preview { min-width: 0; }
.builder__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.sheet {
  background: #fff; color: #18181b; padding: 28px; min-height: 480px;
  border: 1px solid var(--line); border-radius: 4px; box-shadow: var(--sheet-shadow);
  font-size: .875rem; line-height: 1.5; overflow-wrap: anywhere;
}
.sheet--a4 { aspect-ratio: 210 / 297; overflow: hidden; }
.sheet h1, .sheet h2, .sheet h3 { color: inherit; margin: 0 0 .4em; }
.sheet h1 { font-size: 1.5rem; }
.sheet h2 { font-size: 1.0625rem; margin-top: 1.2em; }
.sheet h3 { font-size: .9375rem; margin-top: 1em; }
.sheet p { margin: 0 0 .6em; }
.sheet a { color: #4f46e5; }
.sheet table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.sheet th, .sheet td { padding: 6px 8px; border-bottom: 1px solid #e4e4e7; text-align: left; vertical-align: top; }
.sheet th { font-size: .75rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: #52525b; }
.sheet .num { text-align: right; }
@media (min-width: 900px) {
  .builder { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 32px; }
  .builder__preview { position: sticky; top: calc(var(--header-h) + 24px); max-height: calc(100vh - var(--header-h) - 48px); overflow: auto; }
  .sheet { padding: 40px; }
}

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 32px 0 48px; color: var(--ink-3); font-size: .8125rem; line-height: 1.6; }
.site-footer .brand { font-size: .9375rem; margin-bottom: 12px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0 0 16px; padding: 0; list-style: none; }
.site-footer a { color: var(--ink-2); font-weight: 500; }
.site-footer p { margin: 0 0 8px; max-width: 80ch; }

/* ---------- print (builder previews) ---------- */
@media print {
  .site-header, .site-footer, .ad-slot, .builder__form, .builder__actions, .related, .faq, .actions, .skip-link { display: none !important; }
  body { background: #fff; }
  .builder { display: block; }
  .sheet { border: 0; box-shadow: none; padding: 0; min-height: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after { transition: none !important; animation: none !important; }
}
