/* Tokens */
:root {
  --ink: #13233a;
  --ink-2: #2b3b52;
  --muted: #566577;
  --paper: #f3f6f9;
  --surface: #ffffff;
  --line: #d5dde6;
  --line-strong: #b8c4d1;
  --blue: #1f5fd6;
  --blue-deep: #174bab;
  --blue-tint: #e8f0fd;
  --green: #127a55;
  --green-tint: #e4f4ec;
  --danger: #b42318;
  --danger-tint: #fdecea;
  --radius: 8px;
  --radius-sm: 5px;
  --font: 'Public Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  --wrap: 1120px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font); font-size: 1rem; line-height: 1.55; }
img, svg { max-width: 100%; }
a { color: var(--blue); text-underline-offset: 2px; }
a:hover { color: var(--blue-deep); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.75rem, 1.3rem + 2vw, 2.5rem); font-weight: 800; }
h2 { font-size: 1.25rem; font-weight: 700; }
p { margin: 0 0 1em; }
code { font-family: var(--mono); font-size: .9em; background: var(--blue-tint); padding: .05em .35em; border-radius: 3px; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 8px; top: -60px; background: var(--ink); color: #fff; padding: 8px 12px; border-radius: var(--radius-sm); z-index: 100; }
.skip:focus { top: 8px; color: #fff; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
[hidden] { display: none !important; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 50; background: var(--surface); border-bottom: 1px solid var(--line); }
.header-row { display: grid; grid-template-columns: auto 1fr; grid-template-areas: "brand search" "cats cats"; gap: 8px 16px; align-items: center; padding-top: 10px; padding-bottom: 6px; }
.brand { grid-area: brand; display: inline-flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; font-weight: 800; font-size: 1.1rem; }
.brand:hover { color: var(--ink); }
.search { grid-area: search; position: relative; justify-self: end; width: min(100%, 360px); }
.search input[type="search"] { width: 100%; font: inherit; font-size: .95rem; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--paper); color: var(--ink); }
.search input[type="search"]:focus { background: var(--surface); border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px var(--blue-tint); }
.search-results { position: absolute; top: calc(100% + 6px); right: 0; left: 0; min-width: 260px; list-style: none; margin: 0; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 12px 30px rgba(19, 35, 58, .14); max-height: 60vh; overflow: auto; }
.search-results a { display: flex; justify-content: space-between; gap: 12px; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--ink); text-decoration: none; }
.search-results a span { color: var(--muted); font-size: .85rem; }
.search-results a:hover, .search-results a[aria-selected="true"] { background: var(--blue-tint); }
.search-results .empty { padding: 8px 10px; color: var(--muted); }
.cats { grid-area: cats; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; margin: 0 -4px; }
.cats a { white-space: nowrap; padding: 6px 10px; color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: .92rem; border-radius: var(--radius-sm); }
.cats a:hover { background: var(--paper); color: var(--ink); }
@media (min-width: 900px) {
  .header-row { grid-template-columns: auto auto 1fr; grid-template-areas: "brand cats search"; padding-bottom: 10px; }
  .cats { margin: 0; }
}

/* Hero */
.hero { background: var(--surface); border-bottom: 1px solid var(--line); padding: 32px 0 36px; }
.hero-grid { display: grid; gap: 28px; align-items: center; }
.hero h1 { max-width: 16ch; font-size: clamp(2rem, 1.4rem + 3vw, 3.1rem); line-height: 1.08; }
.hero .lede { font-size: 1.1rem; color: var(--ink-2); max-width: 46ch; }
.hero-points { display: flex; flex-wrap: wrap; gap: 8px 18px; list-style: none; padding: 0; margin: 0; color: var(--green); font-weight: 600; font-size: .95rem; }
.hero-points li { display: inline-flex; align-items: center; gap: 6px; }
.hero-points li::before { content: ""; width: 14px; height: 14px; border-radius: 50%; background: var(--green-tint) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='m3.8 7.2 2.1 2 4.3-4.5' fill='none' stroke='%23127a55' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E") center/14px no-repeat; }
@media (min-width: 860px) { .hero { padding: 56px 0 60px; } .hero-grid { grid-template-columns: 1.1fr 1fr; gap: 56px; } }

.drop-start-zone, .drop-zone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 6px;
  border: 2px dashed var(--line-strong); border-radius: 14px; background: var(--paper); color: var(--ink-2);
  cursor: pointer; transition: border-color .15s, background-color .15s;
}
.drop-start-zone { min-height: 260px; padding: 28px; }
.drop-start-zone svg, .drop-zone svg { color: var(--blue); }
.drop-start-zone strong { font-size: 1.25rem; color: var(--ink); }
.drop-start-zone span, .drop-zone span { color: var(--muted); font-size: .95rem; max-width: 34ch; }
.drop-start-zone:hover, .drop-zone:hover, .is-over .drop-start-zone, .is-over .drop-zone { border-color: var(--blue); background: var(--blue-tint); }
input:focus-visible + .drop-start-zone, input:focus-visible + .drop-zone { outline: 3px solid var(--blue); outline-offset: 3px; }
.start-result { margin-top: 14px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.start-result p { margin: 0 0 10px; font-weight: 600; }
.start-result p span { font-weight: 400; color: var(--muted); }
.start-result ul { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0; padding: 0; }
.start-result button { font: inherit; font-size: .92rem; font-weight: 600; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--blue); background: var(--surface); color: var(--blue); cursor: pointer; }
.start-result button:hover { background: var(--blue); color: #fff; }

/* Directory */
.directory { display: grid; gap: 8px 40px; padding-top: 40px; padding-bottom: 56px; }
.dir-group { padding: 20px 0; border-top: 2px solid var(--ink); }
.dir-group h2 { font-size: 1.2rem; margin-bottom: 2px; }
.dir-group h2 a { color: var(--ink); text-decoration: none; }
.dir-group h2 a:hover { color: var(--blue); }
.dir-group > p { color: var(--muted); font-size: .95rem; margin-bottom: 10px; }
.dir-group ul { list-style: none; padding: 0; margin: 0; }
.dir-group li a { display: block; padding: 7px 0; border-bottom: 1px solid var(--line); color: var(--ink-2); text-decoration: none; font-weight: 500; }
.dir-group li a:hover { color: var(--blue); }
@media (min-width: 700px) { .directory { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1040px) { .directory { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 40px; } }

/* Page scaffolding */
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; font-size: .88rem; color: var(--muted); padding: 18px 0 10px; }
.crumbs a { color: var(--muted); }
.tool-page, .cat-page, .prose-page { padding-bottom: 56px; }
.tool-head { max-width: 760px; margin-bottom: 18px; }
.lede { font-size: 1.08rem; color: var(--ink-2); }
.privacy { display: inline-flex; align-items: center; gap: 6px; margin: 0; padding: 5px 10px; border-radius: 999px; background: var(--green-tint); color: var(--green); font-size: .88rem; font-weight: 600; }

/* Tool panel */
.tool { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; max-width: 900px; }
@media (min-width: 640px) { .tool { padding: 24px; } }
.drop-zone { min-height: 190px; padding: 24px; }
.drop-zone strong { font-size: 1.12rem; color: var(--ink); }
.tool.has-file .drop-zone { min-height: 0; padding: 14px; flex-direction: row; gap: 12px; }
.tool.has-file .drop-zone svg { width: 24px; height: 24px; }
.tool.has-file .drop-zone span { display: none; }
.panel { margin-top: 18px; }
.panel-title { font-size: 1.05rem; }
.count { color: var(--muted); font-weight: 500; }
.file-meta { margin: 0 0 14px; padding: 10px 12px; background: var(--paper); border-radius: var(--radius-sm); font-size: .95rem; overflow-wrap: anywhere; }
.file-meta strong { color: var(--ink); }
.hint { color: var(--muted); font-size: .88rem; margin: 4px 0 0; }
.amt-words { color: var(--muted); font-size: .88rem; margin: 5px 0 0; font-variant-numeric: tabular-nums; }
.note { color: var(--muted); font-size: .9rem; margin: 14px 0 0; max-width: 70ch; }

/* Form controls */
label, .label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 5px; color: var(--ink-2); }
label output { font-weight: 700; color: var(--blue); margin-left: 4px; }
input[type="text"], input[type="number"], input[type="date"], input[type="search"], input[type="tel"], input[type="email"], input[type="month"], input[type="url"], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 9px 11px; min-height: 44px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-tint); }
textarea { resize: vertical; line-height: 1.5; }
textarea.mono { font-family: var(--mono); font-size: .9rem; }
input[type="range"] { width: 100%; accent-color: var(--blue); min-height: 32px; }
.field { margin-bottom: 14px; min-width: 0; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0 14px; align-items: start; }
.field-row.tight { grid-template-columns: 1fr 1fr; }
.field.grow { grid-column: span 2; }
@media (max-width: 480px) { .field.grow { grid-column: 1 / -1; } }
.self-end { align-self: end; margin-bottom: 22px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; margin: 4px 16px 10px 0; }
.check input { width: 18px; height: 18px; accent-color: var(--blue); margin: 0; }
.choice { border: 0; padding: 0; margin: 0 0 14px; }
.choice legend { font-weight: 600; font-size: .92rem; margin-bottom: 6px; color: var(--ink-2); }
.choice label { display: flex; align-items: center; gap: 8px; font-weight: 500; padding: 6px 0; cursor: pointer; }
.choice.inline { display: flex; flex-wrap: wrap; gap: 0 18px; }
.choice.inline legend { width: 100%; }
.choice input { accent-color: var(--blue); width: 18px; height: 18px; margin: 0; }
.affix { display: flex; align-items: stretch; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); overflow: hidden; }
.affix:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-tint); }
.affix input, .affix select { border: 0; border-radius: 0; box-shadow: none !important; min-width: 0; }
.affix select { width: auto; flex: 0 0 auto; min-width: 104px; background: var(--paper); border-left: 1px solid var(--line); }
.affix span { display: flex; align-items: center; padding: 0 10px; background: var(--paper); color: var(--muted); font-weight: 600; font-size: .92rem; white-space: nowrap; }

/* Segmented control and preset chips */
.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; margin-bottom: 14px; }
.seg label { margin: 0; position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg label { padding: 9px 14px; font-weight: 600; font-size: .92rem; color: var(--ink-2); cursor: pointer; border-right: 1px solid var(--line); }
.seg label:last-child { border-right: 0; }
.seg label:has(input:checked) { background: var(--ink); color: #fff; }
.seg label:has(input:focus-visible) { outline: 3px solid var(--blue); outline-offset: -3px; }
.presets { display: flex; flex-wrap: wrap; gap: 8px; }
.presets button { font: inherit; font-size: .92rem; font-weight: 600; min-height: 40px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); cursor: pointer; }
.presets button:hover { border-color: var(--blue); color: var(--blue); }
.presets button.on { background: var(--ink); border-color: var(--ink); color: #fff; }

/* Buttons */
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 6px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 700; font-size: .98rem; min-height: 46px; padding: 10px 20px; border-radius: var(--radius-sm); border: 1px solid transparent; cursor: pointer; text-decoration: none; margin: 0; }
.btn.primary { background: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-deep); color: #fff; }
.btn.primary:disabled { background: var(--line-strong); cursor: progress; }
.btn.ghost { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn.ghost:hover { border-color: var(--ink); color: var(--ink); }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: .88rem; }
.btn.download { background: var(--green); color: #fff; }
.btn.download:hover { background: #0d5f42; color: #fff; }

/* File list */
.file-list { list-style: none; margin: 0 0 12px; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); }
.file-list li { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.file-list li:last-child { border-bottom: 0; }
.file-list .idx { width: 26px; height: 26px; border-radius: 50%; background: var(--paper); display: grid; place-items: center; font-weight: 700; font-size: .85rem; color: var(--muted); }
.file-list .thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 4px; border: 1px solid var(--line); }
.file-list .name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.file-list .name small { display: block; color: var(--muted); font-weight: 400; }
.file-list .ctl { display: flex; gap: 4px; }
.file-list .ctl button { width: 36px; height: 36px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink-2); cursor: pointer; font-size: 1rem; line-height: 1; }
.file-list .ctl button:hover { border-color: var(--ink); }
.file-list .ctl button:disabled { opacity: .35; cursor: default; }
.thumbs li { grid-template-columns: auto auto 1fr auto; }

/* Status and result */
.status { margin: 14px 0 0; font-weight: 600; min-height: 1px; }
.status:empty { margin: 0; }
.status.error { color: var(--danger); background: var(--danger-tint); padding: 10px 12px; border-radius: var(--radius-sm); }
.status.ok { color: var(--green); }
.status.busy::before { content: ""; display: inline-block; width: 14px; height: 14px; margin-right: 8px; vertical-align: -2px; border: 2px solid var(--line-strong); border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .status.busy::before { animation: none; } }
.progress { height: 6px; background: var(--paper); border-radius: 999px; overflow: hidden; margin-top: 10px; }
.progress span { display: block; height: 100%; background: var(--blue); width: 0; transition: width .2s; }
.result { margin-top: 18px; padding: 16px; border-radius: var(--radius); background: var(--green-tint); border: 1px solid #b7e1cb; }
.result h2 { font-size: 1.05rem; color: var(--green); margin-bottom: 8px; }
.result .summary { margin: 0 0 12px; }
.result-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.result-list li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px; }
.result-list .meta { min-width: 0; overflow-wrap: anywhere; font-size: .95rem; }
.result-list .meta small { display: block; color: var(--muted); }
.result-list .saved { color: var(--green); font-weight: 700; }
.result-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-bottom: 12px; }
.result-grid figure { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.result-grid img { width: 100%; height: 160px; object-fit: contain; background: var(--paper); }
.result-grid figcaption { font-size: .85rem; color: var(--muted); }
.preview-img { display: block; max-width: 100%; max-height: 340px; margin: 0 0 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: repeating-conic-gradient(#eef1f4 0% 25%, #fff 0% 50%) 50%/16px 16px; }

/* Crop */
.crop-area { margin: 6px 0 14px; }
.crop-stage { position: relative; display: inline-block; max-width: 100%; touch-action: none; user-select: none; -webkit-user-select: none; line-height: 0; }
.crop-stage img { display: block; max-width: 100%; max-height: 420px; }
.crop-box { position: absolute; border: 2px solid #fff; outline: 2px solid var(--blue); box-shadow: 0 0 0 9999px rgba(19, 35, 58, .55); cursor: move; }
.crop-box:focus-visible { outline: 3px solid #ffd43b; }
.crop-stage { overflow: hidden; border-radius: var(--radius-sm); }

/* Calculators */
.calc { display: grid; gap: 20px; }
@media (min-width: 760px) { .calc { grid-template-columns: 1fr 1fr; gap: 32px; } }
.calc-out { background: var(--paper); border-radius: var(--radius); padding: 18px; align-self: start; }
.big { margin: 0 0 14px; }
.big span { display: block; color: var(--muted); font-weight: 600; font-size: .92rem; }
.big strong { display: block; font-size: clamp(1.9rem, 1.4rem + 2vw, 2.5rem); font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.kv { margin: 0; }
.kv div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.split-bar { display: flex; height: 12px; border-radius: 999px; overflow: hidden; margin-top: 14px; background: var(--line); }
.split-bar .a { background: var(--blue); }
.split-bar .b { background: #7fb4f0; }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 8px 0 0; font-size: .88rem; color: var(--muted); }
.legend.small { font-size: .8rem; }
.sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.sw.a { background: var(--blue); }
.sw.b { background: #7fb4f0; }
.tag { display: inline-block; margin: -6px 0 12px; padding: 3px 10px; border-radius: 999px; font-weight: 700; font-size: .9rem; background: var(--line); }
.tag.under { background: #fff3d6; color: #8a5a00; }
.tag.normal { background: var(--green-tint); color: var(--green); }
.tag.over { background: #ffe6cc; color: #9a4a00; }
.tag.obese { background: var(--danger-tint); color: var(--danger); }
.bmi-scale { position: relative; display: grid; grid-template-columns: 18.5fr 6.5fr 5fr 10fr; height: 10px; border-radius: 999px; overflow: hidden; margin-top: 14px; }
.bmi-scale span:nth-child(1) { background: #f4c95d; }
.bmi-scale span:nth-child(2) { background: #3fae7a; }
.bmi-scale span:nth-child(3) { background: #f29a4a; }
.bmi-scale span:nth-child(4) { background: #d9534f; }
.bmi-scale i { position: absolute; top: -3px; width: 4px; height: 16px; background: var(--ink); border-radius: 2px; transform: translateX(-2px); }
.bmi-scale { overflow: visible; }
.table-wrap { margin-top: 18px; border: 1px solid var(--line); border-radius: var(--radius); }
.table-wrap summary { padding: 12px 14px; font-weight: 700; cursor: pointer; }
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; font-variant-numeric: tabular-nums; }
th, td { padding: 8px 12px; text-align: right; border-top: 1px solid var(--line); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { background: var(--paper); font-weight: 700; color: var(--ink-2); }
.pct-grid { display: grid; gap: 14px; }
.pct-card { padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); }
.pct-card h2 { font-size: 1.05rem; font-weight: 600; line-height: 2.4; margin: 0; }
.pct-card input { display: inline-block; width: 7.5em; min-height: 40px; padding: 6px 8px; margin: 0 4px; font-weight: 700; }
.pct-card .ans { margin: 8px 0 0; font-size: 1.5rem; font-weight: 800; color: var(--blue); }

/* Text tools */
.text-tool > label:not(.btn):not(.check) { margin-top: 10px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 1px; margin: 14px 0; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.stats div { background: var(--surface); padding: 10px 12px; }
.stats dt { font-size: .82rem; color: var(--muted); font-weight: 600; }
.stats dd { margin: 0; font-size: 1.5rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.case-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.pw-out { display: flex; gap: 10px; align-items: stretch; }
.pw-out output { flex: 1; min-width: 0; display: flex; align-items: center; padding: 12px 14px; font-family: var(--mono); font-size: 1.2rem; font-weight: 600; background: var(--paper); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow-wrap: anywhere; word-break: break-all; }
.strength { margin: 8px 0 16px; font-weight: 600; color: var(--muted); }
.strength b { color: var(--green); }
.checks { display: flex; flex-wrap: wrap; }

/* Info below tool */
.tool-info { display: grid; gap: 10px 48px; margin-top: 40px; max-width: 1000px; }
@media (min-width: 900px) { .tool-info { grid-template-columns: 1fr 1fr; } .related { grid-column: 1 / -1; } }
.tool-info h2 { font-size: 1.3rem; margin-top: 8px; }
.steps { padding-left: 0; list-style: none; counter-reset: s; margin: 0; }
.steps li { counter-increment: s; position: relative; padding: 0 0 14px 40px; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: -1px; width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: #fff; font-weight: 700; font-size: .9rem; display: grid; place-items: center; }
.faq details { border-top: 1px solid var(--line); }
.faq details:last-child { border-bottom: 1px solid var(--line); }
.faq summary { padding: 12px 28px 12px 0; font-weight: 600; cursor: pointer; list-style: none; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 4px; top: 9px; font-size: 1.3rem; color: var(--muted); }
.faq details[open] summary::after { content: "−"; }
.faq details div { padding: 0 0 14px; color: var(--ink-2); }
.related ul, .tool-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.related a, .tool-list a { display: block; height: 100%; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--blue); border-radius: var(--radius-sm); text-decoration: none; color: var(--ink); }
.related a:hover, .tool-list a:hover { border-color: var(--blue); }
.related strong, .tool-list strong { display: block; }
.related span, .tool-list span { color: var(--muted); font-size: .92rem; }
.cat-page .lede { max-width: 62ch; margin-bottom: 24px; }
.prose-page { max-width: 720px; }
.prose-page h1 { margin-top: 28px; }
.prose-page h2 { margin-top: 1.6em; }
.contact-mail { font-size: 1.3rem; font-weight: 700; }
.ad-slot { margin: 24px 0; min-height: 100px; max-width: 900px; }

/* Footer */
.site-footer { background: var(--ink); color: #c9d3df; padding: 40px 0 28px; font-size: .92rem; }
.site-footer a { color: #e6edf5; text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; }
.footer-grid { display: grid; gap: 24px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.footer-grid h2 { font-size: 1rem; margin-bottom: 8px; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid li { padding: 3px 0; }
.footer-base { margin-top: 32px; padding-top: 18px; border-top: 1px solid #2c3f5a; display: grid; gap: 8px; }
.footer-base p { margin: 0; }
.footer-base nav { display: flex; flex-wrap: wrap; gap: 6px 18px; }

/* Shown only in the private backup copy */
.backup-note { margin: 0; padding: 8px 16px; background: #fff3d6; color: #6b4600; font-size: .88rem; font-weight: 600; text-align: center; }

/* ---------- Document makers ---------- */
.tool.wide { max-width: none; }
.doc-tool { display: grid; gap: 20px; }
@media (min-width: 980px) { .doc-tool { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; align-items: start; } .doc-side { position: sticky; top: 120px; } }
.doc-form { min-width: 0; }
.doc-group { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px 4px; margin: 0 0 14px; min-width: 0; }
.doc-group legend { font-weight: 700; padding: 0 6px; font-size: 1rem; }
.doc-form textarea { min-height: 0; }
.doc-form-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 8px; }
.doc-side { min-width: 0; }
.doc-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.doc-preview { display: grid; gap: 12px; background: #e4e9ef; border-radius: var(--radius); padding: 10px; max-height: 80vh; overflow: auto; }
.doc-preview canvas { display: block; background: #fff; box-shadow: 0 1px 3px rgba(19, 35, 58, .2); max-width: 100%; height: auto; }
.doc-notes { margin: 0 0 10px; padding: 10px 12px 10px 28px; background: #fff3d6; color: #6b4600; border-radius: var(--radius-sm); font-size: .9rem; }
.img-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.img-row img { width: 56px; height: 56px; object-fit: contain; border: 1px solid var(--line); border-radius: 4px; background: var(--paper); }
.rep { margin-bottom: 12px; }
.rep-rows { display: grid; gap: 8px; margin-bottom: 8px; }
.rep-row { display: grid; grid-template-columns: var(--cols) auto; gap: 6px; align-items: end; padding: 8px; background: var(--paper); border-radius: var(--radius-sm); }
.rep-cell { min-width: 0; }
.rep-label { display: block; font-size: .78rem; font-weight: 600; color: var(--muted); margin-bottom: 2px; }
.rep-row input, .rep-row select, .rep-row textarea { min-height: 38px; padding: 6px 8px; font-size: .92rem; }
.rep-ctl { display: flex; gap: 4px; }
.rep-cell.full { grid-column: 1 / -2; }
.rep-ctl button { width: 34px; height: 38px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; font-size: 1rem; color: var(--ink-2); }
.rep-ctl button:hover { border-color: var(--ink); }
@media (max-width: 640px) {
  .rep-row { grid-template-columns: 1fr 1fr; }
  .rep-cell:first-child, .rep-cell.full { grid-column: 1 / -1; }
  .rep-ctl { grid-column: 1 / -1; justify-content: flex-end; }
}
.crop-box .h { position: absolute; width: 18px; height: 18px; background: #fff; border: 2px solid var(--blue); }
.crop-box .h.nw { left: -1px; top: -1px; cursor: nwse-resize; }
.crop-box .h.ne { right: -1px; top: -1px; cursor: nesw-resize; }
.crop-box .h.sw { left: -1px; bottom: -1px; cursor: nesw-resize; }
.crop-box .h.se { right: -1px; bottom: -1px; cursor: nwse-resize; }
@media (pointer: coarse) { .crop-box .h { width: 26px; height: 26px; } }
.tool-controls { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.canvas-preview { display: block; max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; margin: 0 0 12px; }

/* Sign PDF */
.sig-pad { display: block; width: 100%; max-width: 600px; aspect-ratio: 3 / 1; height: auto; background: #fff; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); touch-action: none; cursor: crosshair; }
.sign-stage { position: relative; display: inline-block; max-width: 100%; line-height: 0; border: 1px solid var(--line); box-shadow: 0 1px 4px rgba(19, 35, 58, .12); }
.sign-stage canvas { display: block; max-width: 100%; height: auto; }
.sig-float { position: absolute; cursor: move; outline: 2px dashed var(--blue); outline-offset: 2px; touch-action: none; user-select: none; -webkit-user-drag: none; }
.sig-float:focus-visible { outline: 3px solid #ffd43b; }
.sign-stage .placed { position: absolute; height: auto; opacity: .9; pointer-events: none; }
.pager { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 10px; }
.placed-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; }
.placed-list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 10px; background: var(--paper); border-radius: var(--radius-sm); }
.step-title { font-size: 1.05rem; margin: 18px 0 8px; }

/* Organise pages */
.page-grid { list-style: none; margin: 0 0 14px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.page-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px; display: grid; gap: 6px; justify-items: center; cursor: grab; }
.page-card.dragging { opacity: .4; }
.page-card.over { border-color: var(--blue); box-shadow: 0 0 0 2px var(--blue-tint); }
.thumb-wrap { width: 110px; height: 140px; display: grid; place-items: center; }
.thumb-wrap canvas { max-width: 100%; max-height: 100%; background: #fff; box-shadow: 0 1px 3px rgba(19, 35, 58, .2); transition: transform .15s; }
@media (prefers-reduced-motion: reduce) { .thumb-wrap canvas { transition: none; } }
.page-card .pg { font-weight: 700; font-size: .9rem; }
.page-card .pg small { font-weight: 400; color: var(--muted); }
.pc-ctl { display: flex; gap: 4px; }
.pc-ctl button { width: 28px; height: 30px; border: 1px solid var(--line-strong); border-radius: 4px; background: var(--surface); cursor: pointer; font-size: .9rem; color: var(--ink-2); }
.pc-ctl button:disabled { opacity: .35; cursor: default; }

/* Income tax and multi-part calculators */
.calc + .calc { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line); }
.regime-cmp { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.regime-cmp .big strong { font-size: clamp(1.4rem, 1.1rem + 1.4vw, 1.9rem); }
.verdict { margin: 0 0 12px; padding: 10px 12px; background: var(--surface); border-left: 4px solid var(--green); border-radius: var(--radius-sm); }
.verdict strong { color: var(--green); }
table.cmp td, table.cmp th { padding: 7px 8px; white-space: normal; }
table.cmp td:first-child { color: var(--ink-2); }
table.cmp tr.total td { font-weight: 800; border-top: 2px solid var(--ink); }
details.ded { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin-top: 6px; }
details.ded summary { font-weight: 700; cursor: pointer; margin-bottom: 8px; }
details.ded .hint { margin: -8px 0 12px; }
.kv .lowest dt, .kv .lowest dd { color: var(--green); }
.kv .tag { margin: 0 0 0 6px; padding: 1px 8px; font-size: .78rem; }

/* ---------- Batch 3: text, developer and SEO tools ---------- */
.compare-grid { display: grid; gap: 12px; }
@media (min-width: 760px) { .compare-grid { grid-template-columns: 1fr 1fr; } }
.compare-grid > * { min-width: 0; }
.code-out { margin: 0 0 12px; padding: 12px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-sm); font-family: var(--mono); font-size: .88rem; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 360px; overflow: auto; min-height: 44px; }
.code-out.hl mark { background: #ffe58a; color: inherit; border-radius: 2px; padding: 0 1px; }
.summary-line { font-weight: 700; margin: 12px 0 8px; }
.diff-wrap { border: 1px solid var(--line); border-radius: var(--radius-sm); max-height: 520px; overflow: auto; }
table.diff { font-family: var(--mono); font-size: .85rem; }
table.diff td { text-align: left; white-space: pre-wrap; overflow-wrap: anywhere; border-top: 0; padding: 2px 8px; vertical-align: top; }
table.diff td.n { color: var(--muted); width: 1%; text-align: right; user-select: none; }
table.diff td.sign { width: 1%; font-weight: 700; user-select: none; }
table.diff tr.del { background: #fdecea; }
table.diff tr.add { background: #e4f4ec; }
table.diff del { background: #f6b8b2; text-decoration: none; }
table.diff ins { background: #9fdcbc; text-decoration: none; }
.hashes dd { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; justify-content: flex-end; min-width: 0; }
.hashes .hash, .kv code { font-family: var(--mono); font-size: .82rem; overflow-wrap: anywhere; word-break: break-all; text-align: left; }
.kv dd { min-width: 0; }
.now-line { font-size: 1.05rem; }
.now-line strong { font-family: var(--mono); }
.swatch { height: 72px; border-radius: var(--radius); border: 1px solid var(--line); margin: 4px 0 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { width: 64px; height: 52px; border-radius: var(--radius-sm); border: 1px solid var(--line); cursor: pointer; display: flex; align-items: flex-end; justify-content: center; padding: 0 0 4px; }
.chip span { font-family: var(--mono); font-size: .66rem; background: rgba(255, 255, 255, .85); color: #13233a; padding: 1px 3px; border-radius: 3px; }
.hint.warn { color: #9a4a00; font-weight: 600; }
.serp { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 0 0 16px; font-family: Arial, sans-serif; max-width: 600px; }
.serp-site { display: flex; gap: 10px; align-items: center; margin-bottom: 4px; }
.serp-site strong { display: block; font-size: 14px; color: #202124; font-weight: 400; }
.serp-site small { display: block; font-size: 12px; color: #4d5156; }
.serp-icon { width: 26px; height: 26px; border-radius: 50%; background: #e8eaed; flex: none; }
.serp-title { color: #1a0dab; font-size: 20px; line-height: 1.3; margin-bottom: 3px; overflow-wrap: anywhere; }
.serp-desc { color: #4d5156; font-size: 14px; line-height: 1.58; overflow-wrap: anywhere; }
.faq-row { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px 4px; margin-bottom: 10px; }
.faq-row .btn { margin-bottom: 8px; }
.qr-canvas { display: block; width: 100%; max-width: 320px; height: auto; image-rendering: pixelated; border: 1px solid var(--line); border-radius: var(--radius-sm); margin: 0 auto 10px; background: #fff; }
.calc-out textarea { background: var(--surface); }

/* Health tools */
.disclaimer { max-width: 80ch; margin: 18px 0 0; padding: 12px 14px; border-left: 4px solid var(--blue); background: var(--blue-tint); border-radius: var(--radius-sm); font-size: .9rem; color: var(--ink-2); }
.sources ul { margin: 0 0 8px; padding-left: 1.2em; }
.sources li { margin: 4px 0; overflow-wrap: anywhere; }
.hp-mem { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin-top: 8px; padding-top: 10px; border-top: 1px dashed var(--line); font-size: .9rem; }
.hp-mem .check { margin: 0; }
.linkish { background: none; border: 0; padding: 0; color: var(--blue); text-decoration: underline; text-underline-offset: 2px; font: inherit; cursor: pointer; }
.linkish:hover { color: var(--blue-deep); }
.field > .label { display: block; font-weight: 600; margin-bottom: 6px; }
.field-row.tight.three { grid-template-columns: 1fr 1fr 1fr; }
.band-bar { position: relative; display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 14px; font-size: .72rem; font-weight: 700; text-align: center; }
.band-bar span { padding: 4px 2px; color: #13233a; }
.band-bar .b1 { background: #f4c95d; border-radius: 999px 0 0 999px; }
.band-bar .b2 { background: #3fae7a; color: #fff; }
.band-bar .b3 { background: #f29a4a; }
.band-bar .b4 { background: #d9534f; color: #fff; border-radius: 0 999px 999px 0; }
.band-bar i { position: absolute; top: -4px; bottom: -4px; width: 4px; background: var(--ink); border-radius: 2px; transform: translateX(-2px); }
.progress { height: 10px; background: var(--line); border-radius: 999px; overflow: hidden; margin: -4px 0 14px; }
.progress span { display: block; height: 100%; width: 0; background: var(--green); transition: width .2s; }
.kv .ok dd { color: var(--green); }
.kv .short dd { color: #9a4a00; }
.kv dd .tag { margin: 0; }
.kv .local dt { font-weight: 700; color: var(--ink); }
.kv .local small { display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 999px; background: var(--blue-tint); color: var(--blue-deep); font-size: .72rem; font-weight: 700; }
.alert { margin: 0 0 14px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--danger-tint); color: var(--danger); border: 1px solid #f3b7b1; font-size: .92rem; }
.bp-log { margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--line); }
.bp-log-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }
.bp-log-head h2 { margin: 0; }
.bp-log-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.table-scroll { overflow-x: auto; }
.bp-log table td, .bp-log table th { text-align: left; padding: 7px 8px; border-top: 1px solid var(--line); }
.bp-log td.empty { color: var(--muted); }
.market { display: inline-block; margin: 0 0 10px; padding: 2px 10px; border-radius: 999px; background: #fff3d6; color: #8a5a00; font-weight: 700; font-size: .82rem; }
