/* tokens.css */
/* Design tokens. Charting convention: red = needs action, blue = existing / done.
   Light values on :root; dark values for system dark (unless the user picked light) and for an explicit dark choice. */
@font-face { font-family: "Atkinson Hyperlegible"; src: url(/assets/fonts/atkinson-hyperlegible-400.woff2) format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible"; src: url(/assets/fonts/atkinson-hyperlegible-400-italic.woff2) format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible"; src: url(/assets/fonts/atkinson-hyperlegible-700.woff2) format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Bricolage Grotesque"; src: url(/assets/fonts/bricolage-grotesque-var.woff2) format("woff2"); font-weight: 600 800; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url(/assets/fonts/ibm-plex-mono-400.woff2) format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url(/assets/fonts/ibm-plex-mono-600.woff2) format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }

:root {
  color-scheme: light;
  --bg: #f6f8fa;
  --bg-alt: #eef2f6;
  --surface: #ffffff;
  --surface-2: #f9fbfc;
  --ink: #15213a;
  --ink-2: #2c3a55;
  --muted: #586379;
  --line: #dde3ea;
  --line-strong: #c3ccd7;
  --control-line: #808a9c; /* 3:1 boundary for inputs and buttons (WCAG 1.4.11) */
  --red: #c42f3a;
  --red-bg: #fcebec;
  --blue: #2352c2;
  --blue-bg: #e9effc;
  --amber: #985a0a;
  --amber-bg: #fdf2e1;
  --green: #1f7a4d;
  --green-bg: #e6f4ec;
  --gum: #f1c9cf;
  --gum-2: #e7aeb7;
  --enamel: #fffdf8;
  --tooth-ink: #15213a;
  --focus: #2352c2;
  --shadow: 0 1px 2px rgba(21, 33, 58, .06), 0 4px 16px rgba(21, 33, 58, .06);
  --shadow-lg: 0 8px 40px rgba(21, 33, 58, .16);

  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-body: "Atkinson Hyperlegible", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --fs-xs: .8125rem;   /* 13 */
  --fs-sm: .875rem;    /* 14 */
  --fs-base: 1.0625rem;/* 17 */
  --fs-md: 1.25rem;    /* 20 */
  --fs-lg: 1.5rem;     /* 24 */
  --fs-xl: 2rem;       /* 32 */
  --fs-2xl: clamp(2rem, 1.4rem + 2.6vw, 2.75rem); /* 32–44 */

  --sp-1: .25rem; --sp-2: .5rem; --sp-3: .75rem; --sp-4: 1rem; --sp-5: 1.5rem; --sp-6: 2rem; --sp-7: 3rem; --sp-8: 4rem;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --wrap: 1120px;
  --prose: 70ch;
  --tap: 44px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d1320; --bg-alt: #111a2b; --surface: #151d2e; --surface-2: #1a2336;
    --ink: #e7ecf4; --ink-2: #c9d2e0; --muted: #9aa6ba; --line: #283349; --line-strong: #3a475f; --control-line: #64728d;
    --red: #ff7a80; --red-bg: #3a1c22; --blue: #8fb0ff; --blue-bg: #1b2a4d;
    --amber: #f3b65e; --amber-bg: #3a2a12; --green: #67d39a; --green-bg: #15322a;
    --gum: #4a2730; --gum-2: #5e3240; --enamel: #ebe6da; --tooth-ink: #15213a; --focus: #8fb0ff;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, .5);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1320; --bg-alt: #111a2b; --surface: #151d2e; --surface-2: #1a2336;
  --ink: #e7ecf4; --ink-2: #c9d2e0; --muted: #9aa6ba; --line: #283349; --line-strong: #3a475f; --control-line: #64728d;
  --red: #ff7a80; --red-bg: #3a1c22; --blue: #8fb0ff; --blue-bg: #1b2a4d;
  --amber: #f3b65e; --amber-bg: #3a2a12; --green: #67d39a; --green-bg: #15322a;
  --gum: #4a2730; --gum-2: #5e3240; --enamel: #ebe6da; --tooth-ink: #15213a; --focus: #8fb0ff;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, .5);
}

/* base.css */
/* Base element styles */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 80px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg, video { max-width: 100%; height: auto; }
svg.icon { width: 1.25em; height: 1.25em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.25em; }
svg.icon-sm { width: 1em; height: 1em; vertical-align: -.15em; }
svg.icon-lg { width: 1.75em; height: 1.75em; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.15; color: var(--ink); text-wrap: balance; margin: 0; }
h1 { font-size: var(--fs-2xl); font-weight: 800; letter-spacing: -.02em; }
h2 { font-size: var(--fs-xl); font-weight: 700; letter-spacing: -.01em; }
h3 { font-size: var(--fs-md); font-weight: 700; }
h4 { font-size: var(--fs-base); font-weight: 700; }
p { margin: 0; }
a { color: var(--blue); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
strong, b { font-weight: 700; }
small, .small { font-size: var(--fs-sm); }
code, kbd, samp, .mono { font-family: var(--font-mono); font-size: .92em; }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--sp-6) 0; }
abbr[title] { text-decoration: underline dotted; cursor: help; }
::selection { background: var(--blue-bg); color: var(--ink); }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
main:focus { outline: none; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.sr-only {
  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-link {
  position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--ink); color: var(--bg);
  padding: 10px 14px; border-radius: var(--radius-sm); text-decoration: none; font-weight: 700;
}
.skip-link:focus { top: 12px; }
.muted { color: var(--muted); }
.select-all { user-select: all; }
.nowrap { white-space: nowrap; }
.num, .tabular { font-variant-numeric: tabular-nums; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* layout.css */
/* Page frame: wrap, header, nav, footer, page heads, guide column, cards */
.wrap {
  width: 100%; max-width: var(--wrap); margin-inline: auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-row { display: flex; align-items: center; gap: var(--sp-3); min-height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-family: var(--font-display); font-weight: 600; font-size: 1.12rem; letter-spacing: -.01em; white-space: nowrap; }
.brand b { font-weight: 800; color: var(--blue); }
.brand-mark { width: 30px; height: 30px; flex: none; }
.main-nav { margin-left: var(--sp-2); }
.nav-btn, .hdr-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; min-width: 44px; padding: 0 12px;
  border: 1px solid transparent; border-radius: 999px; background: transparent; color: var(--ink);
  font-weight: 700; font-size: var(--fs-sm); text-decoration: none; position: relative;
}
.nav-btn { border-color: var(--line); background: var(--surface); }
.nav-btn:hover, .hdr-btn:hover { background: var(--bg-alt); }
.nav-btn[aria-expanded="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.hdr-btn .dot { position: absolute; top: 7px; right: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); }
.icon-sun { display: none; }
:root[data-theme="dark"] .icon-sun { display: inline; }
:root[data-theme="dark"] .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: inline; }
  :root:not([data-theme="light"]) .icon-moon { display: none; }
}
@media (max-width: 720px) {
  .hdr-label { display: none; }
  .brand-name { font-size: 1rem; }
  .main-nav { margin-left: auto; }
  .header-actions { margin-left: 0; }
}
@media (max-width: 480px) { .brand-name { display: none; } }

.nav-panel {
  position: absolute; left: 0; right: 0; top: 100%;
  background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: var(--shadow-lg);
  max-height: calc(100vh - 60px); overflow-y: auto; padding-block: var(--sp-5);
}
.nav-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-5) var(--sp-4); }
@media (max-width: 960px) { .nav-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .nav-grid { grid-template-columns: 1fr; } }
.nav-hub-title { display: flex; gap: 8px; align-items: center; font-family: var(--font-display); font-weight: 700; color: var(--ink); text-decoration: none; margin-bottom: 6px; }
.nav-hub-title .icon { color: var(--blue); }
.nav-hub ul { list-style: none; margin: 0; padding: 0 0 0 30px; display: grid; gap: 2px; }
.nav-hub li a { color: var(--ink-2); text-decoration: none; font-size: var(--fs-sm); display: block; padding: 3px 0; }
.nav-hub li a:hover { color: var(--blue); text-decoration: underline; }
.nav-foot { margin-top: var(--sp-4); padding-top: var(--sp-3); border-top: 1px solid var(--line); }
.nav-foot a { font-weight: 700; text-decoration: none; }

/* ---------- search dialog ---------- */
.search-dialog {
  width: min(640px, calc(100vw - 24px)); max-height: min(80vh, 640px); margin-top: 10vh;
  padding: 0; border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg);
}
.search-dialog::backdrop { background: rgba(10, 16, 28, .45); }
.search-form { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.search-form input { flex: 1; min-width: 0; border: 0; background: transparent; font-size: 1.05rem; padding: 8px 0; outline: none; }
.search-results { list-style: none; margin: 0; padding: 6px; overflow-y: auto; max-height: calc(min(80vh, 640px) - 70px); }
.search-results a { display: grid; gap: 1px; padding: 10px 12px; border-radius: var(--radius-sm); text-decoration: none; color: var(--ink); }
.search-results a:hover, .search-results a[aria-selected="true"] { background: var(--blue-bg); }
.search-results .sr-t { font-weight: 700; }
.search-results .sr-s { font-size: var(--fs-sm); color: var(--muted); }
.search-results .sr-h { font-size: var(--fs-xs); color: var(--blue); text-transform: uppercase; letter-spacing: .06em; }
.search-empty { padding: 16px; color: var(--muted); }

/* ---------- page head ---------- */
.breadcrumbs { padding-top: var(--sp-4); font-size: var(--fs-sm); }
.breadcrumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; color: var(--muted); }
.breadcrumbs li:not(:last-child)::after { content: "›"; margin-left: 6px; color: var(--line-strong); }
.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--blue); text-decoration: underline; }
.page-head { padding-block: var(--sp-4) var(--sp-5); display: grid; gap: var(--sp-2); max-width: 78ch; }
.eyebrow { font-family: var(--font-mono); font-size: var(--fs-xs); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.eyebrow a { color: var(--muted); text-decoration: none; }
.eyebrow a:hover { color: var(--blue); }
.lede { font-size: 1.15rem; color: var(--ink-2); max-width: 64ch; }
.hub-head { grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: var(--sp-4); }
.hub-icon { width: 56px; height: 56px; border-radius: var(--radius); display: grid; place-items: center; background: var(--blue-bg); color: var(--blue); }
.hub-icon .icon { width: 30px; height: 30px; }

/* ---------- guide (content under the tool) ---------- */
.guide { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-6); margin-top: var(--sp-7); }
@media (min-width: 1000px) {
  .guide { grid-template-columns: 220px minmax(0, 1fr); }
  .guide-aside { position: sticky; top: 84px; align-self: start; }
}
.guide-aside:empty { display: none; }
@media (min-width: 1000px) { .guide:has(.guide-aside:empty) { grid-template-columns: minmax(0, 1fr); } }
.toc { font-size: var(--fs-sm); border-left: 2px solid var(--line); padding-left: var(--sp-3); }
.toc-h { font-weight: 700; margin-bottom: 6px; color: var(--muted); text-transform: uppercase; font-size: var(--fs-xs); letter-spacing: .08em; }
.toc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.toc a { color: var(--ink-2); text-decoration: none; line-height: 1.35; display: block; padding-block: 6px; }
.toc a:hover { color: var(--blue); }
@media (max-width: 999px) { .toc { display: none; } }

/* ---------- cards ---------- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: var(--sp-3); }
.card {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--sp-3); align-items: start;
  padding: var(--sp-4); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  color: var(--ink); text-decoration: none; transition: border-color .15s, box-shadow .15s, transform .15s;
}
.card:hover { border-color: var(--blue); box-shadow: var(--shadow); }
.card-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: var(--radius-sm); background: var(--blue-bg); color: var(--blue); }
.card-body { display: grid; gap: 2px; min-width: 0; }
.card-title { font-weight: 700; line-height: 1.3; }
.card-text { font-size: var(--fs-sm); color: var(--muted); line-height: 1.4; }
.card-arrow { color: var(--muted); margin-top: 4px; }
.card:hover .card-arrow { color: var(--blue); }

.hub-tools { margin-bottom: var(--sp-6); }
.related { margin-top: var(--sp-7); padding-top: var(--sp-6); border-top: 1px solid var(--line); display: grid; gap: var(--sp-4); }
.related h2 { font-size: var(--fs-lg); }
.other-hubs { margin-top: var(--sp-7); display: grid; gap: var(--sp-3); }
.other-hubs h2 { font-size: var(--fs-lg); }
.hub-strip { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.hub-chip { display: inline-flex; gap: 8px; align-items: center; min-height: 44px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); text-decoration: none; font-weight: 700; font-size: var(--fs-sm); }
.hub-chip:hover { border-color: var(--blue); color: var(--blue); }

/* ---------- footer ---------- */
.site-footer { margin-top: var(--sp-8); border-top: 1px solid var(--line); background: var(--surface); padding-block: var(--sp-7) var(--sp-5); }
.footer-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr); gap: var(--sp-6); }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr; } }
.footer-brand { display: grid; gap: var(--sp-2); align-content: start; }
.footer-h { font-family: var(--font-mono); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: var(--sp-2); font-weight: 600; }
.footer-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.footer-col a { color: var(--ink-2); text-decoration: none; font-size: var(--fs-sm); }
.footer-col a:hover { color: var(--blue); text-decoration: underline; }
.footer-base { margin-top: var(--sp-6); padding-top: var(--sp-4); border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--sp-2); font-size: var(--fs-xs); color: var(--muted); }

/* ---------- hub cards (home, 404) ---------- */
.hub-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: var(--sp-3); }
.hub-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: var(--sp-4); display: grid; gap: var(--sp-3); align-content: start; }
.hub-card-head { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--sp-3); color: var(--ink); text-decoration: none; }
.hub-card-head > span:last-child { display: grid; gap: 2px; }
.hub-card ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: var(--fs-sm); }
.hub-card li a { color: var(--ink-2); text-decoration: none; }
.hub-card li a:hover { color: var(--blue); text-decoration: underline; }
.hub-card-more { font-size: var(--fs-sm); font-weight: 700; text-decoration: none; }
.az-hub { display: grid; gap: var(--sp-3); margin-bottom: var(--sp-6); }
.az-hub h2 { font-size: var(--fs-lg); display: flex; gap: 10px; align-items: center; }

/* Tap targets of at least 44px for small text links */
.footer-col ul { gap: 0; }
.footer-col a { display: inline-block; padding: 10px 4px; margin-inline: -4px; }
.nav-hub li a { padding: 10px 0; }
.breadcrumbs a, .eyebrow a { display: inline-block; padding: 12px 4px; margin: -12px -4px; }
.brand { min-height: 44px; min-width: 44px; }
.hub-card-more { display: inline-block; padding-block: 10px; margin-block: -10px; }
/* Hub-card tool lists: full 44px rows on touch screens only, so desktop cards stay compact */
@media (pointer: coarse) { .hub-card ul { gap: 0; } .hub-card li a { display: inline-block; padding-block: 10px; } }
/* QA6: 14px text has a 22.4px line, so 10px padding gave 42.4px footer links, hub "All N tools" links and touch
   hub-card rows; the short hub-card heads were 43.7px and the Spanish "Inicio" crumb 43.98px wide */
.footer-col a { padding-block: 11px; }
.hub-card-more { padding-block: 11px; margin-block: -11px; }
.hub-card-head { min-height: 44px; }
@media (pointer: coarse) { .hub-card li a { padding-block: 11px; } }
.breadcrumbs a { min-width: 44px; text-align: center; }
/* QA6: the last hub's 32px bottom margin pushed /tools/ onto a blank fifth printed page (on screen it collapses into the footer margin) */
.az-hub:last-child { margin-bottom: 0; }

/* Language switch (shown when a page has a translation) */
.lang-switch { font-size: var(--fs-xs); letter-spacing: .02em; border: 1px solid var(--line); }
@media (max-width: 400px) { .header-actions .hdr-btn { padding: 0 8px; } .lang-switch { padding: 0 6px; } }
/* With a language switch in the header, drop the "Tools" word on narrow screens (icon + chevron stay) */
@media (max-width: 520px) { .header-row:has(.lang-switch) .nav-btn > span { display: none; } }
@media (max-width: 400px) { :root[lang^="es"] .nav-btn > span { display: none; } }
/* 44px header buttons on the smallest phones: tighter gaps, icon-only Tools button, EN/ES short switch */
@media (max-width: 400px) { .header-row { gap: 8px; } }
@media (max-width: 350px) {
  .nav-btn > span, .lang-switch > span { display: none; }
  .lang-switch::after { content: attr(data-short); }
  .header-row:has(.lang-switch) .nav-btn > .icon-sm { display: none; }
}

/* components.css */
/* Tool UI kit. Tools use these classes; page-specific styles go in the page folder's style.css. */

/* ---------- tool frame ---------- */
.tool {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); padding: var(--sp-5); display: grid; gap: var(--sp-5);
}
@media (max-width: 600px) { .tool { padding: var(--sp-4); border-radius: var(--radius); } }
.tool-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-5); align-items: start; }
@media (min-width: 880px) {
  .tool-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
  .tool-grid.even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .tool-grid .sticky { position: sticky; top: 84px; }
}
.tool-inputs, .tool-output { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-4); align-content: start; min-width: 0; }
.tool-inputs > *, .tool-output > * { min-width: 0; } /* wide tables scroll inside their wrapper instead of widening the column */
.tool-title { font-family: var(--font-display); font-size: var(--fs-md); font-weight: 700; }
.section-label { font-family: var(--font-mono); font-size: var(--fs-xs); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.example-flag { justify-self: start; display: inline-flex; gap: 6px; align-items: center; font-size: var(--fs-xs); font-weight: 700; color: var(--amber); background: var(--amber-bg); padding: 3px 10px; border-radius: 999px; }
.divider { height: 1px; background: var(--line); border: 0; margin: 0; }

/* ---------- form fields ---------- */
.field { display: grid; gap: 6px; min-width: 0; }
.field > label, .field > .label, fieldset > legend { font-weight: 700; font-size: var(--fs-sm); color: var(--ink); }
.hint { font-size: var(--fs-xs); color: var(--muted); line-height: 1.4; }
.field-error { font-size: var(--fs-xs); color: var(--red); font-weight: 700; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; display: grid; gap: 8px; }
.row { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: end; }
.row > * { flex: 1 1 140px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-3); }
/* minmax(0, 1fr): a date input's built-in minimum width can't push the column past a narrow card */
@media (max-width: 520px) { .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); } }

.input, .select, textarea.input {
  width: 100%; min-height: var(--tap); padding: 10px 12px;
  border: 1px solid var(--control-line); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--ink); font-size: 1rem; line-height: 1.3;
}
.input:hover, .select:hover { border-color: var(--muted); }
.input:focus, .input:focus-within, .select:focus { outline: 3px solid color-mix(in srgb, var(--focus) 35%, transparent); outline-offset: 0; border-color: var(--focus); }
.input[aria-invalid="true"] { border-color: var(--red); }
.input.mono { font-family: var(--font-mono); }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
.input-group { display: flex; align-items: stretch; }
.input-group .input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-unit { display: grid; place-items: center; padding: 0 12px; border: 1px solid var(--control-line); border-left: 0; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; background: var(--bg-alt); color: var(--muted); font-size: var(--fs-sm); white-space: nowrap; }
input[type="range"] { width: 100%; accent-color: var(--blue); min-height: 44px; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--blue); width: 18px; height: 18px; }

/* segmented control: <div class="seg" role="radiogroup"><label><input type="radio" name="x" value="a"><span>A</span></label>…</div> */
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--bg-alt); border: 1px solid var(--control-line); border-radius: 12px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.seg span { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; min-width: 44px; padding: 0 14px; border-radius: 9px; font-weight: 700; font-size: var(--fs-sm); color: var(--ink-2); }
.seg input:checked + span { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 2px var(--blue), 0 1px 3px rgba(0,0,0,.12); }
.seg input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 1px; }
.seg.block { display: flex; } .seg.block label { flex: 1; } .seg.block span { width: 100%; justify-content: center; }

/* chips: <label class="chip"><input type="checkbox"><span>Label</span></label> */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; margin: 0; width: 100%; height: 100%; cursor: pointer; }
.chip span { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; border: 1px solid var(--control-line); border-radius: 999px; background: var(--surface); font-size: var(--fs-sm); font-weight: 700; }
.chip input:checked + span { background: var(--blue-bg); border-color: var(--blue); color: var(--blue); }
.chip input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 1px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 18px; border-radius: var(--radius-sm);
  border: 1px solid var(--control-line); background: var(--surface); color: var(--ink);
  font-weight: 700; font-size: .98rem; text-decoration: none; line-height: 1.1; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { border-color: var(--ink); }
.btn-primary { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn-primary:hover { background: var(--ink-2); border-color: var(--ink-2); }
.btn-blue { background: var(--blue); border-color: var(--blue); color: #fff; }
:root[data-theme="dark"] .btn-blue { color: #0d1320; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-blue { color: #0d1320; } }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
:root[data-theme="dark"] .btn-danger { color: #0d1320; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-danger { color: #0d1320; } }
.btn-quiet { border-color: transparent; background: transparent; }
.btn-quiet:hover { background: var(--bg-alt); border-color: transparent; }
.btn-sm { min-height: 44px; padding: 0 12px; font-size: var(--fs-sm); }
.btn-lg { min-height: 56px; padding: 0 26px; font-size: 1.1rem; border-radius: var(--radius); }
.btn-block { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; }
.actions .btn { min-height: 44px; padding: 0 14px; font-size: var(--fs-sm); }
.action-menu { position: relative; }
.action-menu-list { position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; min-width: 220px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; display: grid; }
.action-menu-list button, .action-menu-list a { text-align: left; border: 0; background: none; padding: 10px 12px; border-radius: var(--radius-sm); color: var(--ink); text-decoration: none; font-weight: 700; font-size: var(--fs-sm); }
.action-menu-list button:hover, .action-menu-list a:hover { background: var(--bg-alt); }

/* ---------- results ---------- */
.result { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); padding: var(--sp-4); display: grid; gap: var(--sp-3); }
.result-label { font-size: var(--fs-sm); color: var(--muted); font-weight: 700; }
.result-value { font-family: var(--font-display); font-size: clamp(1.9rem, 1.4rem + 2vw, 2.6rem); font-weight: 800; line-height: 1.05; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.result-sub { color: var(--ink-2); }
.result-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--sp-2); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--sp-2); }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; display: grid; gap: 2px; }
.stat small { font-size: var(--fs-xs); color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.stat b { font-family: var(--font-mono); font-size: 1.2rem; font-variant-numeric: tabular-nums; }
/* fit-content(55%): a long label can't squeeze the value to nothing on a phone */
dl.kv { margin: 0; display: grid; grid-template-columns: fit-content(55%) minmax(0, 1fr); gap: 6px 16px; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.big-num { font-family: var(--font-mono); font-weight: 600; font-variant-numeric: tabular-nums; }
.countdown { font-family: var(--font-mono); font-size: clamp(2.2rem, 1.6rem + 3vw, 3.6rem); font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1; }

/* pills */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 999px; font-size: var(--fs-xs); font-weight: 700; line-height: 1.6; white-space: nowrap; border: 1px solid transparent; background: var(--bg-alt); color: var(--ink-2); }
.pill-red { background: var(--red-bg); color: var(--red); }
.pill-amber { background: var(--amber-bg); color: var(--amber); }
.pill-blue { background: var(--blue-bg); color: var(--blue); }
.pill-green { background: var(--green-bg); color: var(--green); }
.pill-muted { background: transparent; color: var(--muted); border-color: var(--line); }

/* urgency banner: <div class="urgency" data-level="emergency|urgent|soon|self"> */
.urgency { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--sp-3); padding: var(--sp-4); border-radius: var(--radius); border: 2px solid var(--line); background: var(--surface); }
.urgency .u-icon { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; }
.urgency .u-icon .icon { width: 24px; height: 24px; }
.urgency .u-level { font-family: var(--font-mono); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.urgency .u-title { font-family: var(--font-display); font-size: var(--fs-md); font-weight: 800; line-height: 1.2; }
.urgency[data-level="emergency"] { border-color: var(--red); background: var(--red-bg); }
.urgency[data-level="emergency"] .u-icon { background: var(--red); color: #fff; }
.urgency[data-level="emergency"] .u-level, .urgency[data-level="emergency"] .u-title { color: var(--red); }
.urgency[data-level="urgent"] { border-color: var(--amber); background: var(--amber-bg); }
.urgency[data-level="urgent"] .u-icon { background: var(--amber); color: #fff; }
.urgency[data-level="urgent"] .u-level, .urgency[data-level="urgent"] .u-title { color: var(--amber); }
.urgency[data-level="soon"] { border-color: var(--blue); background: var(--blue-bg); }
.urgency[data-level="soon"] .u-icon { background: var(--blue); color: #fff; }
.urgency[data-level="soon"] .u-level, .urgency[data-level="soon"] .u-title { color: var(--blue); }
.urgency[data-level="self"] { border-color: var(--green); background: var(--green-bg); }
.urgency[data-level="self"] .u-icon { background: var(--green); color: #fff; }
.urgency[data-level="self"] .u-level, .urgency[data-level="self"] .u-title { color: var(--green); }

/* callouts (also produced by markdown "> [!NOTE]") */
.callout { border-left: 4px solid var(--blue); background: var(--blue-bg); padding: var(--sp-3) var(--sp-4); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; display: grid; gap: var(--sp-2); }
.callout > :first-child { margin-top: 0; }
.callout-tip, .callout-ok { border-color: var(--green); background: var(--green-bg); }
.callout-warning { border-color: var(--amber); background: var(--amber-bg); }
.callout-danger { border-color: var(--red); background: var(--red-bg); }

/* safety box under tools */
.safety { margin-top: var(--sp-4); display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--sp-3); padding: var(--sp-4) var(--sp-5); border: 1px solid var(--red); border-radius: var(--radius); background: var(--red-bg); }
.safety-icon { color: var(--red); }
.safety-icon .icon { width: 28px; height: 28px; }
.safety-title { font-weight: 700; color: var(--red); }
.safety ul { margin: 6px 0 0; padding-left: 1.1em; display: grid; gap: 3px; }
.safety-note { margin-top: 8px; font-weight: 700; }
.safety-pro, .safety-kids-medicine { border-color: var(--blue); background: var(--blue-bg); }
.safety-pro .safety-icon, .safety-pro .safety-title, .safety-kids-medicine .safety-icon, .safety-kids-medicine .safety-title { color: var(--blue); }

/* progress bar: <div class="progress" role="progressbar" ...><span style="width:40%"></span></div> */
.progress { height: 10px; border-radius: 999px; background: var(--bg-alt); border: 1px solid var(--line); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--blue); border-radius: inherit; transition: width .3s; }
.progress.green > span { background: var(--green); }

/* meter: score scale with zones and a marker
   <div class="meter"><div class="meter-zones"><span style="flex:4" class="z-green"></span>…</div><span class="meter-mark" style="left:40%"></span></div> */
.meter { position: relative; padding-top: 6px; }
.meter-zones { display: flex; height: 12px; border-radius: 999px; overflow: hidden; gap: 2px; }
.meter-zones .z-green { background: var(--green); } .meter-zones .z-blue { background: var(--blue); }
.meter-zones .z-amber { background: var(--amber); } .meter-zones .z-red { background: var(--red); }
.meter-mark { position: absolute; top: 0; width: 4px; height: 24px; margin-left: -2px; background: var(--ink); border-radius: 2px; box-shadow: 0 0 0 2px var(--surface); }
.meter-labels { display: flex; justify-content: space-between; font-size: var(--fs-xs); color: var(--muted); margin-top: 6px; }

/* timeline: <ol class="timeline"><li class="is-done|is-now|is-next"><b>Title</b><span>text</span></li></ol> */
.timeline { list-style: none; margin: 0; padding: 0; display: grid; }
.timeline li { position: relative; padding: 0 0 var(--sp-4) 30px; display: grid; gap: 2px; }
.timeline li::before { content: ""; position: absolute; left: 7px; top: 8px; bottom: -8px; width: 2px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline li::after { content: ""; position: absolute; left: 0; top: 4px; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line-strong); background: var(--surface); }
.timeline li.is-done::after { background: var(--blue); border-color: var(--blue); }
.timeline li.is-now::after { background: var(--surface); border: 4px solid var(--red); }
.timeline li.is-now > b, .timeline li.is-now > .tl-title { color: var(--red); }
.timeline .tl-when { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--muted); }
.timeline li > span, .timeline .tl-text { color: var(--ink-2); font-size: var(--fs-sm); }

/* question flow: <div class="q-card"><p class="q">Question?</p><div class="q-options"><button class="opt" aria-pressed="false">…</button></div></div> */
.q-card { display: grid; gap: var(--sp-3); }
.q-card .q { font-family: var(--font-display); font-size: var(--fs-md); font-weight: 700; line-height: 1.25; }
.q-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: var(--sp-2); }
.opt { text-align: left; display: flex; gap: 10px; align-items: center; min-height: 52px; padding: 10px 14px; border: 1px solid var(--control-line); border-radius: var(--radius); background: var(--surface); color: var(--ink); font-weight: 700; line-height: 1.3; }
.opt:hover { border-color: var(--blue); }
.opt[aria-pressed="true"] { border: 2px solid var(--blue); background: var(--blue-bg); color: var(--blue); }
.opt.opt-danger[aria-pressed="true"] { border-color: var(--red); background: var(--red-bg); color: var(--red); }
.opt small { display: block; font-weight: 400; color: var(--muted); font-size: var(--fs-xs); }
.q-progress { font-size: var(--fs-xs); color: var(--muted); font-family: var(--font-mono); }

/* numbered steps: <ol class="steps"><li><b>Title</b><span>Text</span></li></ol> */
ol.steps { list-style: none; counter-reset: st; margin: 0; padding: 0; display: grid; gap: var(--sp-2); }
ol.steps > li { counter-increment: st; display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: var(--sp-3); padding: var(--sp-3); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
ol.steps > li::before { content: counter(st); width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--ink); color: var(--bg); font-weight: 700; font-family: var(--font-mono); }
ol.steps > li > div { display: grid; gap: 2px; }
ol.steps > li span { color: var(--ink-2); font-size: var(--fs-sm); }

/* tables */
.table-wrap { position: relative; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table.data { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
table.data th, table.data td { padding: 10px 12px; text-align: left; vertical-align: top; border-top: 1px solid var(--line); }
table.data thead th { border-top: 0; background: var(--bg-alt); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); white-space: nowrap; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data tr.is-now { background: var(--blue-bg); }
/* A link alone in a cell (hub tables): full-row tap target without changing the row height */
table.data td > a:only-child { display: inline-block; padding-block: 11px; margin-block: -11px; }
/* QA6: page rules that make the cell link a block (tooth-letter tables: min-height 40px) left it 42.4px tall */
main table.data td > a:only-child { min-height: var(--tap); }
table.data th button { border: 0; background: none; padding: 0; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; display: inline-flex; gap: 4px; align-items: center; }

/* charts */
.chart svg { display: block; width: 100%; height: auto; }
.chart .axis { stroke: var(--line-strong); stroke-width: 1; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .line { fill: none; stroke: var(--blue); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--blue-bg); }
.chart .dot { fill: var(--blue); stroke: var(--surface); stroke-width: 2; }
.chart .bar { fill: var(--blue); }
.chart .bar.alt { fill: var(--red); }
.chart text { fill: var(--muted); font-family: var(--font-mono); font-size: 11px; }
/* Charts scale down with the screen (600-wide view box), so 11px text renders at about 6px on a phone */
@media (max-width: 520px) {
  .chart text { font-size: 17px; }
  .chart .dense .bar-val, .chart .dense .minor { display: none; }
}

/* empty state */
.empty { text-align: center; padding: var(--sp-6) var(--sp-4); border: 2px dashed var(--line); border-radius: var(--radius); color: var(--muted); display: grid; gap: var(--sp-2); justify-items: center; }

/* toast */
.toast { position: fixed; z-index: 90; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: var(--radius); box-shadow: var(--shadow-lg); font-weight: 700; max-width: calc(100vw - 32px); }

/* ---------- prose (content under tools) ---------- */
.prose { max-width: var(--prose); display: grid; gap: var(--sp-4); min-width: 0; }
.prose > * { margin: 0; }
.prose h2 { font-size: var(--fs-lg); margin-top: var(--sp-5); scroll-margin-top: 84px; }
.prose h3 { font-size: 1.15rem; margin-top: var(--sp-3); scroll-margin-top: 84px; }
.prose ul, .prose ol:not(.steps):not(.timeline):not(.sources) { padding-left: 1.25em; display: grid; gap: 6px; }
.prose li::marker { color: var(--muted); }
.prose blockquote { border-left: 3px solid var(--line-strong); padding-left: var(--sp-4); color: var(--ink-2); }
.prose .table-wrap { max-width: 100%; }
.prose img { border-radius: var(--radius); }
.faq { display: grid; gap: 0; border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; list-style: none; padding: 14px 32px 14px 0; font-weight: 700; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 4px; top: 10px; font-size: 1.4rem; color: var(--muted); font-weight: 400; }
.faq details[open] summary::after { content: "–"; }
.faq-a { padding: 0 0 16px; color: var(--ink-2); }
ol.sources { padding-left: 1.4em; display: grid; gap: 8px; font-size: var(--fs-sm); color: var(--ink-2); }
ol.sources .src-pub { font-weight: 700; color: var(--ink); }
.reviewed { font-size: var(--fs-sm); color: var(--muted); border-top: 1px solid var(--line); padding-top: var(--sp-3); margin-top: var(--sp-3); }

.print-only { display: none; }

/* ---------- ad slots (build/ads.mjs, core/ads.js) ----------
   An empty slot takes no space at all: zero height, invisible, and inside the grid-based .prose it is taken out
   of the grid (absolute), so no gap is left either. core/ads.js adds .is-filled only after an ad has drawn.
   A filled slot is a plain white panel: ads stay readable in dark mode and read as separate from our content. */
.ad-slot { height: 0; overflow: hidden; visibility: hidden; }
.prose { position: relative; }
.prose > .ad-slot:not(.is-filled) { position: absolute; left: 0; right: 0; }
.ad-slot.is-filled {
  height: auto; visibility: visible; overflow: hidden; max-width: 100%;
  margin-block: var(--sp-6); padding: var(--sp-3);
  background: #fff; color: #15213a; color-scheme: light;
  border: 1px solid var(--line); border-radius: var(--radius);
}
.prose > .ad-slot.is-filled { margin-block: var(--sp-2); }
.ad-row .ad-slot.is-filled { margin-block: var(--sp-7) 0; }
.guide-aside .ad-slot.is-filled { margin-block: var(--sp-5) 0; padding: var(--sp-2); }
@media (min-width: 1000px) {
  /* the sticky sidebar stays within the screen once it also holds an ad: a long contents list scrolls inside it,
     so the ad below it stays in view */
  .guide-aside:has(.ad-slot.is-filled) { max-height: calc(100vh - 100px); display: flex; flex-direction: column; }
  .guide-aside:has(.ad-slot.is-filled) .toc { flex: 1 1 auto; min-height: 120px; overflow-y: auto; scrollbar-width: thin; }
  .guide-aside .ad-slot.is-filled { flex: none; }
}
.ad-slot.is-held { display: none; }

/* European visitors' ad choice (core/ads.js) */
.ad-consent {
  position: fixed; z-index: 60; left: 12px; right: 12px; bottom: 12px; max-width: 620px; margin-inline: auto;
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-4); padding: var(--sp-3) var(--sp-4);
  background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); font-size: var(--fs-sm);
}
.ad-consent p { margin: 0; flex: 1 1 240px; }
.ad-consent-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); }

/* mouth-map.css */
/* Smile Map / tooth chart SVG (rendered by core/mouth-map.js).
   Tooth groups: <g class="t" data-tooth="3"> with <rect class="t-body">, <text class="t-num">, <circle class="t-mark">.
   State classes on .t: is-notyet, is-erupting, is-shedding, is-lost, is-selected, is-hurt, is-dim,
   record classes: c-filling, c-crown, c-rootcanal, c-implant, c-bridge, c-missing, c-needs, c-watch. */
.mouth-wrap { display: grid; gap: var(--sp-3); justify-items: center; min-width: 0; }
svg.mouth { width: 100%; max-width: 480px; height: auto; display: block; overflow: visible; touch-action: manipulation; }
svg.mouth.size-sm { max-width: 260px; }
svg.mouth.size-md { max-width: 360px; }
.mm-gum { fill: var(--gum); }
.mm-side { font-family: var(--font-mono); font-size: 10px; fill: var(--muted); letter-spacing: .06em; }
.mm-arch-label { font-family: var(--font-mono); font-size: 10px; fill: var(--muted); letter-spacing: .08em; }

.t { cursor: pointer; outline: none; }
.t .t-body { fill: var(--enamel); stroke: var(--tooth-ink); stroke-width: 1.4; transition: fill .15s, stroke .15s, opacity .15s; }
.t .t-num { font-family: var(--font-mono); font-size: 8.5px; font-weight: 600; fill: var(--tooth-ink); pointer-events: none; }
.t .t-mark { display: none; pointer-events: none; }
.t:hover .t-body { fill: color-mix(in srgb, var(--enamel) 80%, var(--blue)); }
.t:focus-visible .t-body { stroke: var(--focus); stroke-width: 3; }
svg.mouth.no-interact .t { cursor: default; }
svg.mouth.no-interact .t:hover .t-body { fill: var(--enamel); }

.t.is-notyet .t-body { fill: transparent; stroke: var(--muted); stroke-dasharray: 2 3; opacity: .6; }
.t.is-notyet .t-num { fill: var(--muted); }
.t.is-erupting .t-body { stroke: var(--blue); stroke-width: 2.6; stroke-dasharray: 4 3; }
.t.is-shedding .t-body { stroke: var(--amber); stroke-width: 2.6; }
.t.is-lost .t-body { fill: transparent; stroke: var(--line-strong); stroke-dasharray: 1 3; }
.t.is-lost .t-num { fill: var(--muted); opacity: .6; }
.t.is-dim { opacity: .35; }
.t.is-selected .t-body { fill: var(--blue); stroke: var(--blue); stroke-dasharray: none; opacity: 1; }
.t.is-selected .t-num { fill: #fff; }
.t.is-hurt .t-body { fill: var(--red); stroke: var(--red); stroke-dasharray: none; opacity: 1; }
.t.is-hurt .t-num { fill: #fff; }
:root[data-theme="dark"] .t.is-selected .t-num, :root[data-theme="dark"] .t.is-hurt .t-num { fill: #0d1320; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .t.is-selected .t-num, :root:not([data-theme="light"]) .t.is-hurt .t-num { fill: #0d1320; } }

/* dental record conditions (charting: blue = existing work, red = needs treatment) */
.t.c-filling .t-mark, .t.c-crown .t-mark, .t.c-rootcanal .t-mark, .t.c-implant .t-mark,
.t.c-bridge .t-mark, .t.c-needs .t-mark, .t.c-watch .t-mark { display: block; }
.t.c-filling .t-mark { fill: var(--blue); }
.t.c-crown .t-body { stroke: var(--blue); stroke-width: 3; }
.t.c-crown .t-mark { fill: var(--blue); }
.t.c-rootcanal .t-mark { fill: none; stroke: var(--blue); stroke-width: 2; }
.t.c-implant .t-body { fill: color-mix(in srgb, var(--enamel) 70%, var(--muted)); }
.t.c-implant .t-mark { fill: var(--muted); }
.t.c-bridge .t-body { stroke: var(--blue); stroke-dasharray: 6 2; stroke-width: 2.4; }
.t.c-missing .t-body { fill: transparent; stroke: var(--muted); stroke-dasharray: 2 2; }
.t.c-missing .t-num { fill: var(--muted); }
.t.c-needs .t-body { stroke: var(--red); stroke-width: 3; }
.t.c-needs .t-mark { fill: var(--red); }
.t.c-watch .t-mark { fill: var(--amber); }

.mm-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; font-size: var(--fs-xs); color: var(--muted); }
.mm-legend span { display: inline-flex; align-items: center; gap: 6px; }
.mm-legend i { width: 16px; height: 12px; border-radius: 3px; border: 1.4px solid var(--tooth-ink); background: var(--enamel); display: inline-block; }
.mm-legend i.l-erupting { border: 2px dashed var(--blue); }
.mm-legend i.l-notyet { border: 1.4px dashed var(--muted); background: transparent; }
.mm-legend i.l-shedding { border: 2px solid var(--amber); }
.mm-legend i.l-lost { border: 1.4px dotted var(--line-strong); background: transparent; }
.mm-legend i.l-selected { background: var(--blue); border-color: var(--blue); }
.mm-legend i.l-hurt { background: var(--red); border-color: var(--red); }

/* list view alternative for screen readers / small screens */
.mm-list { width: 100%; }
.mm-list table { font-size: var(--fs-sm); }

/* Labels on not-yet / missing / lost teeth sit on the gum color: keep them dark enough to read */
.t.is-notyet .t-num, .t.c-missing .t-num, .t.is-lost .t-num { fill: var(--ink-2); opacity: 1; }
/* Keyboard focus must stay visible on every tooth state (these come last so they win) */
svg.mouth .t:focus-visible .t-body { stroke: var(--focus); stroke-width: 3.4; stroke-dasharray: none; opacity: 1; }
svg.mouth .t.is-selected:focus-visible .t-body, svg.mouth .t.is-hurt:focus-visible .t-body { stroke: var(--ink); }

/* print.css */
/* Print: keep the tool result and the guide, drop site chrome and buttons. */
@media print {
  @page { margin: 14mm; }
  :root { --bg: #fff; --surface: #fff; --surface-2: #fff; --ink: #000; --ink-2: #222; --muted: #555; --line: #bbb; --shadow: none; --shadow-lg: none; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .site-header, .site-footer, .skip-link, .search-dialog, .toast, .breadcrumbs, .guide-aside, .related, .other-hubs,
  .actions, .no-print, button, .btn, .nav-panel, .hub-strip, .ad-slot, .ad-consent { display: none !important; }
  .print-only { display: block !important; }
  /* Grid layout breaks badly across pages in Chrome (the review line printed over the last source): use block flow */
  .prose { display: block; }
  .prose > * + * { margin-top: var(--sp-4); }
  /* QA6: same Chrome bug inside tools: a break-inside: avoid card three grids deep (tool > output > card list) was
     pushed to the next page while the grid kept its height, so the safety box and guide printed on top of it
     (When Can I…? EN/ES, eat-after ES, care finder ES, specialist finder, implant pages, LA dose, food checker, RDA chart).
     The tool frame uses block flow in print; margins replace the grid gaps. Page rules that hide a part still win. */
  .tool, .tool-grid, .tool-inputs, .tool-output { display: block; }
  .tool > * + *, .tool-grid > * + * { margin-top: var(--sp-5); }
  .tool-inputs > * + *, .tool-output > * + * { margin-top: var(--sp-4); }
  .wrap { max-width: none; padding: 0; }
  .tool { box-shadow: none; border: 1px solid #999; }
  .tool-grid { grid-template-columns: 1fr !important; }
  .guide { margin-top: 16pt; grid-template-columns: 1fr !important; }
  .prose { max-width: none; }
  .prose h2 { break-after: avoid; }
  .urgency, .callout, .safety, .result, .stat, table { break-inside: avoid; }
  .urgency, .safety, .callout { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  svg.mouth { max-width: 90mm; }
  .t .t-body, .mm-gum { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  a { color: #000; text-decoration: none; }
  .faq details { break-inside: avoid; }
  .faq details:not([open]) .faq-a { display: block; }
  input, select { border: 1px solid #999 !important; }
}
