/* Shared base for every tool. Each page overrides the :root tokens for its own look. */
*, *::before, *::after { box-sizing: border-box; }

:root {
  --bg: #f7f4ee; --surface: #fff; --surface-2: #f1ece3; --ink: #1d1b18; --muted: #6a645b; --line: #e2dbcf;
  --accent: #2f5d50; --accent-ink: #fff; --accent-soft: #e3ece8;
  --ok: #2e7d42; --ok-bg: #e4f2e7; --warn: #9a5500; --warn-bg: #fdf0dc; --bad: #b3261e; --bad-bg: #fbe5e3;
  --radius: 14px; --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 14px rgba(0,0,0,.05);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-head: Georgia, "Times New Roman", serif;
}

html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.15; margin: 0 0 .4em; font-weight: 700; }
h1 { font-size: clamp(2rem, 6vw, 3.2rem); letter-spacing: -.01em; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 .8em; }
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }

.top { border-bottom: 1px solid var(--line); background: var(--surface); }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
.back { text-decoration: none; font-weight: 600; color: var(--muted); }
.back:hover { color: var(--ink); }
.top-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.hero { padding: 40px 0 24px; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .75rem; font-weight: 700; color: var(--accent); margin-bottom: .5em; }
.lede { font-size: 1.15rem; max-width: 62ch; }
.note { color: var(--muted); font-size: .92rem; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.stack > * + * { margin-top: 16px; }
.grid { display: grid; gap: 12px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }

.btn {
  appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 600; font-size: .95rem; min-height: 40px; padding: 8px 14px;
  border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); }
.btn.sm { min-height: 34px; padding: 5px 10px; font-size: .85rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.icon-btn { appearance: none; border: 0; background: transparent; font: inherit; font-size: 1.25rem; line-height: 1; width: 36px; height: 36px; border-radius: 8px; cursor: pointer; color: var(--muted); flex: none; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }

.field { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; font-weight: 600; color: var(--muted); min-width: 0; }
.field.inline { flex-direction: row; align-items: center; gap: 8px; }
.field.inline select, .field.inline input { width: auto; }
input, select, textarea {
  font: inherit; font-size: 1rem; color: var(--ink); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 8px 10px; min-height: 40px; width: 100%; font-weight: 400; min-width: 0;
}
textarea { resize: vertical; min-height: 80px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
input[type=checkbox] { width: 18px; height: 18px; min-height: 0; accent-color: var(--accent); margin: 0; flex: none; }
input[type=file] { padding: 6px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.toolbar .spacer { flex: 1; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs [role=tab] { appearance: none; border: 0; background: none; font: inherit; font-weight: 600; padding: 10px 14px; color: var(--muted); border-bottom: 3px solid transparent; cursor: pointer; white-space: nowrap; }
.tabs [role=tab][aria-selected=true] { color: var(--ink); border-bottom-color: var(--accent); }

.pill { display: inline-flex; align-items: center; gap: 4px; font-size: .78rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--ink); white-space: nowrap; border: 0; font-family: var(--font); }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }

.bar { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width .3s; }

.empty { text-align: center; color: var(--muted); padding: 36px 16px; border: 2px dashed var(--line); border-radius: var(--radius); list-style: none; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

dialog { border: 0; border-radius: var(--radius); padding: 0; width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px); background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(20,18,15,.45); }
.dlg-body { padding: 20px; display: grid; gap: 12px; }
.dlg-body h2 { margin: 0; }
.dlg-foot { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--surface-2); position: sticky; bottom: 0; }
.dlg-foot .spacer { flex: 1; }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 20px); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 600; font-size: .92rem; opacity: 0; pointer-events: none; transition: .2s; z-index: 50; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.interest { padding: 48px 0 24px; }
.int-form { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); align-items: end; margin-top: 12px; }
.int-form .wide { grid-column: 1 / -1; }
.site-foot { padding: 24px 0 40px; color: var(--muted); font-size: .85rem; text-align: center; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

@media print {
  .no-print, .top, .interest, .site-foot, .tabs, .toast { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; break-inside: avoid; }
  .hero { padding: 0 0 12px; }
  input, select, textarea { border-color: #ccc; }
}
