/* =========================================================
   POCUS MGF — folha de estilos partilhada
   Tema claro. Cada módulo define --mod (cor de acento).
   ========================================================= */

@font-face {
  font-family: "Atkinson Next";
  src: url("../fonts/atkinson-hyperlegible-next-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 800; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Atkinson Next";
  src: url("../fonts/atkinson-hyperlegible-next-latin-wght-italic.woff2") format("woff2");
  font-weight: 200 800; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Bricolage";
  src: url("../fonts/bricolage-grotesque-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 800; font-style: normal; font-display: swap;
}

:root {
  --paper: #F4F7F8;
  --surface: #FFFFFF;
  --wash: #ECF1F3;
  --line: #D8E0E5;
  --line-2: #C2CDD4;
  --ink: #15232C;
  --ink-2: #43535E;
  --ink-3: #6A7984;

  --ok: #24724A;   --ok-bg: #E4F1E9;
  --mid: #8F5B00;  --mid-bg: #FAF0D9;
  --bad: #AE2A20;  --bad-bg: #FBE8E6;
  --info: #285C86; --info-bg: #E5EEF6;

  --mod: #4A5A68;

  --r-lg: 18px;
  --r-md: 10px;
  --r-sm: 6px;

  --font-body: "Atkinson Next", "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-head: "Bricolage", "Bricolage Grotesque", system-ui, -apple-system, "Segoe UI", sans-serif;

  --wrap: 1080px;
  --measure: 72ch;
}

/* ---------- Cores por área ---------- */
.m-intro  { --mod: #4A5A68; }
.m-eco    { --mod: #C0364A; }
.m-pulm   { --mod: #2D6DB5; }
.m-abd    { --mod: #B07A12; }
.m-reno   { --mod: #1B879C; }
.m-aorta  { --mod: #B24D2C; }
.m-tvp    { --mod: #4A52B5; }
.m-gine   { --mod: #A43D88; }
.m-obst   { --mod: #7651B0; }
.m-msk    { --mod: #3B8550; }
.m-moles  { --mod: #848222; }
.m-infil  { --mod: #16876E; }

[class^="m-"], [class*=" m-"] {
  --marker: var(--mod);
  --mod-ink: color-mix(in srgb, var(--mod) 78%, black);
  --mod-soft: color-mix(in srgb, var(--mod) 9%, white);
  --mod-soft-2: color-mix(in srgb, var(--mod) 18%, white);
}

body.m-intro, .m-intro .card:not([class*=" m-"]) { --marker: #D98A00; }
.m-eco { --marker: #C0364A; }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 72px; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.55;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
img, svg { max-width: 100%; }
a { color: var(--mod-ink, var(--info)); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--mod) 60%, white); outline-offset: 2px; border-radius: 4px; }

h1, h2, h3, h4 { font-family: var(--font-head); color: var(--ink); line-height: 1.15; margin: 0; }
h1 { font-size: clamp(1.9rem, 1.3rem + 2.6vw, 2.9rem); font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: clamp(1.35rem, 1.1rem + 1vw, 1.7rem); font-weight: 650; letter-spacing: -0.01em; margin: 2.2rem 0 0.7rem; }
h3 { font-size: 1.15rem; font-weight: 650; margin: 1.6rem 0 0.5rem; }
h4 { font-size: 1rem; font-weight: 650; margin: 1.1rem 0 0.35rem; }
.panel > h2:first-child, .panel > .panel-head:first-child h2 { margin-top: 0.4rem; }
p { margin: 0 0 0.9rem; max-width: var(--measure); }
ul, ol { margin: 0 0 1rem; padding-left: 1.25rem; max-width: var(--measure); }
li { margin: 0.25rem 0; }
li::marker { color: var(--mod); }
strong { font-weight: 700; }
small, .small { font-size: 0.86rem; color: var(--ink-3); }
.lead { font-size: 1.1rem; color: var(--ink-2); }
.muted { color: var(--ink-3); }
abbr[title] { text-decoration: underline dotted; text-underline-offset: 3px; cursor: help; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 12px; border-radius: 6px; z-index: 50; }
.skip:focus { left: 8px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }

/* ---------- Barra superior ---------- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-family: var(--font-head); font-weight: 700; font-size: 1.05rem; letter-spacing: -0.01em; }
.brand svg { width: 30px; height: 24px; flex: none; }
.backlink { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); text-decoration: none; font-size: 0.95rem; padding: 6px 10px 6px 6px; border-radius: 8px; }
.backlink:hover { background: var(--wash); color: var(--ink); }
.backlink svg { width: 18px; height: 18px; }
.btn-install { display: none; font: inherit; font-size: 0.9rem; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 6px 14px; cursor: pointer; }
.btn-install.show { display: inline-block; }

/* ---------- Cabeçalho de módulo ---------- */
.mod-hero { background: var(--surface); border-bottom: 1px solid var(--line); position: relative; overflow: hidden; }
.mod-hero::after {
  /* leque ecográfico em fundo — assinatura visual */
  content: ""; position: absolute; right: -60px; top: -40px; width: 420px; height: 330px;
  background: var(--mod-soft);
  clip-path: path("M150 0 L0 260 A300 300 0 0 0 300 260 Z");
  -webkit-clip-path: path("M150 0 L0 260 A300 300 0 0 0 300 260 Z");
  pointer-events: none;
}
.mod-hero .wrap { position: relative; z-index: 1; display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center; padding-top: 26px; padding-bottom: 22px; }
.mod-hero .badge { width: 96px; height: 96px; }
.mod-hero h1 { color: var(--ink); }
.mod-hero .lead { margin: 6px 0 0; max-width: 60ch; }
@media (max-width: 560px) {
  .mod-hero::after { display: none; }
  .mod-hero .wrap { grid-template-columns: 1fr; gap: 10px; }
  .mod-hero .badge { width: 72px; height: 72px; }
}

/* Leque (badge) */
.badge .fan { fill: var(--mod-soft-2); stroke: none; }
.badge .ill { color: var(--mod-ink); }

/* ---------- Separadores ---------- */
.tabbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top, 0px); }
.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; max-width: var(--wrap); margin: 0 auto; padding: 0 12px; scroll-snap-type: x proximity; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none; font: inherit; font-size: 0.95rem; color: var(--ink-2); background: none; border: 0;
  padding: 14px 12px 12px; cursor: pointer; border-bottom: 3px solid transparent; white-space: nowrap; scroll-snap-align: start;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--mod-ink); border-bottom-color: var(--mod); font-weight: 700; }

main { padding: 20px 0 64px; }
.panel { max-width: var(--wrap); margin: 0 auto; padding: 8px 20px 0; }
.panel[hidden] { display: none; }

/* ---------- Blocos de conteúdo ---------- */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 16px; }
.grid-5 { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.grid-2.fixed { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 760px) { .grid-2.fixed { grid-template-columns: 1fr; } }
.grid-3.fixed { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 760px) { .grid-2.fixed { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 760px) { .grid-2.fixed { grid-template-columns: 1fr; } }
.grid-3.fixed { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 460px) { .grid-2.fixed { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 760px) { .grid-2.fixed { grid-template-columns: 1fr; } }
.grid-3.fixed { grid-template-columns: 1fr; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px 18px; }
.card > :last-child { margin-bottom: 0; }
.card h3, .card h4 { margin-top: 0; }
.card.accent { border-top: 3px solid var(--mod); }

.callout { border-left: 4px solid var(--info); background: var(--info-bg); border-radius: 0 var(--r-sm) var(--r-sm) 0; padding: 12px 16px; margin: 1rem 0; max-width: calc(var(--measure) + 40px); }
.callout > :last-child { margin-bottom: 0; }
.callout .c-title { font-weight: 700; display: block; margin-bottom: 2px; }
.callout.warn { border-color: var(--bad); background: var(--bad-bg); }
.callout.care { border-color: var(--mid); background: var(--mid-bg); }
.callout.pearl { border-color: var(--mod); background: var(--mod-soft); }

/* Sequência numerada (apenas para passos reais) */
.steps { list-style: none; padding: 0; counter-reset: s; max-width: var(--measure); }
.steps > li { counter-increment: s; position: relative; padding: 2px 0 10px 44px; margin: 0; }
.steps > li::before {
  content: counter(s); position: absolute; left: 0; top: 0; width: 30px; height: 30px; border-radius: 50%;
  background: var(--mod-soft-2); color: var(--mod-ink); font-weight: 700; font-family: var(--font-head);
  display: grid; place-items: center; font-size: 0.95rem;
}
.steps > li:not(:last-child)::after { content: ""; position: absolute; left: 14.5px; top: 32px; bottom: 2px; width: 1px; background: var(--line-2); }

/* Tabelas */
.table-wrap { overflow-x: auto; margin: 0.6rem 0 1.2rem; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { background: var(--wash); font-weight: 700; color: var(--ink-2); font-size: 0.88rem; }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { white-space: nowrap; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 0.82rem; font-weight: 700; white-space: nowrap; }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.tag.mid { background: var(--mid-bg); color: var(--mid); }
.tag.bad { background: var(--bad-bg); color: var(--bad); }
.tag.info { background: var(--info-bg); color: var(--info); }
.tag.mod { background: var(--mod-soft-2); color: var(--mod-ink); }

/* Acordeão */
details.acc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); margin: 0 0 10px; }
details.acc > summary { list-style: none; cursor: pointer; padding: 14px 44px 14px 16px; position: relative; font-weight: 700; }
details.acc > summary::-webkit-details-marker { display: none; }
details.acc > summary .sub { display: block; font-weight: 400; color: var(--ink-3); font-size: 0.9rem; }
details.acc > summary::after { content: ""; position: absolute; right: 18px; top: 22px; width: 9px; height: 9px; border-right: 2px solid var(--ink-3); border-bottom: 2px solid var(--ink-3); transform: rotate(45deg); transition: transform .2s; }
details.acc[open] > summary::after { transform: rotate(-135deg); top: 26px; }
details.acc > .acc-body { padding: 0 16px 14px; }
details.acc > .acc-body > :last-child { margin-bottom: 0; }

/* Figuras */
figure.fig { margin: 0.6rem 0 1.2rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px; }
figure.fig svg { display: block; width: 100%; height: auto; }
figure.fig figcaption { font-size: 0.88rem; color: var(--ink-3); margin-top: 8px; line-height: 1.45; }
figure.fig figcaption strong { color: var(--ink-2); }
.fig-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.fig-row figure.fig { margin: 0; }

/* Controlo segmentado */
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; background: var(--wash); padding: 4px; border-radius: 12px; margin: 0.4rem 0 1rem; }
.seg button { font: inherit; font-size: 0.93rem; border: 0; background: none; color: var(--ink-2); padding: 7px 12px; border-radius: 9px; cursor: pointer; }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--mod-ink); font-weight: 700; box-shadow: 0 1px 2px rgba(20,35,44,.12), 0 0 0 1px var(--line); }
.seg.small button { font-size: 0.85rem; padding: 5px 10px; }

/* Calculadoras */
.calc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px 18px; }
.calc h3 { margin-top: 0; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 10px 0 14px; }
.field label { display: block; font-size: 0.88rem; color: var(--ink-2); margin-bottom: 4px; font-weight: 700; }
.field .unit { font-weight: 400; color: var(--ink-3); }
.field input, .field select {
  width: 100%; font: inherit; font-size: 1rem; padding: 9px 10px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface); color: var(--ink);
}
.field input:focus, .field select:focus { outline: 2px solid color-mix(in srgb, var(--mod) 55%, white); border-color: var(--mod); }
.result { border-radius: 8px; padding: 12px 14px; background: var(--wash); color: var(--ink-2); min-height: 48px; }
.result.ok { background: var(--ok-bg); color: var(--ok); }
.result.mid { background: var(--mid-bg); color: var(--mid); }
.result.bad { background: var(--bad-bg); color: var(--bad); }
.result .r-main { font-family: var(--font-head); font-size: 1.25rem; font-weight: 700; display: block; }
.result .r-sub { display: block; color: var(--ink-2); font-size: 0.92rem; margin-top: 2px; }
.btn { font: inherit; font-size: 0.93rem; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); border-radius: 8px; padding: 7px 14px; cursor: pointer; }
.btn:hover { border-color: var(--mod); color: var(--mod-ink); }

/* Pares chave/valor */
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0.4rem 0 1rem; }
dl.kv dt { font-weight: 700; color: var(--ink-2); }
dl.kv dd { margin: 0; }
@media (max-width: 520px) { dl.kv { grid-template-columns: 1fr; } dl.kv dd { margin-bottom: 6px; } }

/* Fontes */
ol.refs { font-size: 0.93rem; color: var(--ink-2); max-width: 90ch; }
ol.refs li { margin: 0.45rem 0; }

/* Rodapé */
.foot { border-top: 1px solid var(--line); background: var(--surface); color: var(--ink-3); font-size: 0.86rem; }
.foot .wrap { padding-top: 18px; padding-bottom: 24px; }
.foot p { max-width: 90ch; margin: 0 0 0.5rem; }

/* ---------- Home ---------- */
.home-head { padding: 34px 0 10px; }
.home-head h1 { font-size: clamp(2.1rem, 1.4rem + 3vw, 3.3rem); }
.home-head .lead { margin-top: 10px; max-width: 54ch; }
.search { position: relative; max-width: 460px; margin: 22px 0 6px; }
.search input { width: 100%; font: inherit; padding: 12px 14px 12px 42px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface); color: var(--ink); }
.search input:focus { outline: 2px solid var(--line-2); border-color: var(--ink-3); }
.search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--ink-3); }
.groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 8px 22px; margin-top: 18px; }
.group { margin: 14px 0 0; }
.group[hidden] { display: none; }
.group h2 { font-size: 1rem; color: var(--ink-3); font-weight: 600; margin: 0 0 8px; letter-spacing: 0; }
.tiles { display: grid; grid-template-columns: 1fr; gap: 10px; }
.tile {
  display: flex; align-items: flex-start; gap: 14px; text-decoration: none; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px 16px 14px 14px;
  transition: border-color .15s, background-color .15s;
}
.tile .badge { flex: none; width: 72px; height: 72px; margin: -4px 0 -4px -4px; }
.tile .t-text { display: flex; flex-direction: column; min-width: 0; }
.tile .t-name { font-family: var(--font-head); font-weight: 650; font-size: 1.08rem; line-height: 1.2; padding-top: 2px; }
.tile .t-desc { font-size: 0.9rem; color: var(--ink-3); line-height: 1.4; margin-top: 3px; }
a.tile:hover { border-color: var(--mod); background: var(--mod-soft); }
.tile.soon { cursor: default; background: color-mix(in srgb, var(--surface) 55%, var(--paper)); }
.tile.soon .badge { opacity: .5; }
.tile.soon .t-name { color: var(--ink-2); }
.tile .soon-tag { align-self: flex-start; font-size: 0.75rem; font-weight: 700; color: var(--ink-3); background: var(--wash); border-radius: 999px; padding: 1px 8px; margin-top: 7px; }
@media (max-width: 480px) {
  .groups { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .tile { flex-direction: column; gap: 8px; padding: 12px; }
  .tile .t-name { font-size: 1rem; hyphens: auto; -webkit-hyphens: auto; overflow-wrap: break-word; }
  .tile .badge { width: 60px; height: 60px; margin: 0; }
  .tile .t-desc { display: none; }
  .tile.wide { grid-column: 1 / -1; flex-direction: row; }
  .tile.wide .t-desc { display: block; }
}
.empty-search { color: var(--ink-3); padding: 12px 0; }

/* ---------- Figuras ecográficas (modo anatomia / modo eco) ---------- */
.us-fig { --tissue: #3a3f43; --myo: #a9adb0; --blood: #050607; --blood-l: #050607; --blood-r: #050607; --bright: #f1f1ef; --liver: #6e7275; --lung: #1a1c1e; --lbl: #ffffff; --lbl-halo: #000000; --vessel: #050607; --bone: #f4f4f2; --fat: #2e3235; --valve: #d9d9d6; --eff: #000; }
.us-fig[data-mode="anat"] { --tissue: #F3E6DC; --myo: #CF6F6A; --blood-l: #F0A8A2; --blood-r: #A9C2E6; --blood: #F0A8A2; --bright: #E4B94A; --liver: #B8745A; --lung: #E9EEF2; --lbl: #15232C; --lbl-halo: #ffffff; --vessel: #A9C2E6; --bone: #EDE6D6; --fat: #F7EBC8; --valve: #FFF6E8; --eff: #F7E27A; }
.us-fig .sector-bg { fill: #000; }
.us-fig[data-mode="anat"] .sector-bg { fill: #FBF7F3; }
.us-fig .speckle { opacity: .55; }
.us-fig[data-mode="anat"] .speckle { opacity: 0; }
.us-fig .tissue { fill: var(--tissue); }
.us-fig .myo { fill: var(--myo); }
.us-fig .bl { fill: var(--blood-l); }
.us-fig .br { fill: var(--blood-r); }
.us-fig .bright { fill: none; stroke: var(--bright); }
.us-fig .bright-f { fill: var(--bright); }
.us-fig .liver { fill: var(--liver); }
.us-fig .valve { fill: none; stroke: var(--valve); stroke-linecap: round; }
.us-fig .vessel { fill: var(--vessel); }
.us-fig .lbl { font-family: var(--font-body); font-size: 13px; font-weight: 700; fill: var(--lbl); paint-order: stroke; stroke: var(--lbl-halo); stroke-width: 3px; stroke-linejoin: round; }
.us-fig .lbl.sm { font-size: 11px; font-weight: 600; }
.us-fig .lead-line { stroke: var(--lbl); stroke-width: 1; opacity: .8; }
.us-fig .marker-dot { fill: var(--marker); }
.us-fig .frame { fill: none; stroke: #5a6166; stroke-width: 1; }
.us-fig[data-mode="anat"] .frame { stroke: var(--line-2); }
.us-fig .depth-tick { stroke: #8b9296; stroke-width: 1; }
.fig-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.fig-toolbar .fig-title { font-weight: 700; font-size: 0.95rem; color: var(--ink-2); }

/* Tórax com posição da sonda */
.torso .skin { fill: #F6EDE6; stroke: #C9B3A4; stroke-width: 1.2; }
.torso .rib { fill: none; stroke: #D8C6B8; stroke-width: 1.4; stroke-linecap: round; }
.torso .sternum { fill: #EFE3D8; stroke: #C9B3A4; stroke-width: 1; }
.torso .clav { fill: none; stroke: #C9B3A4; stroke-width: 2.2; stroke-linecap: round; }
.torso .heart-ghost { fill: #E9A9A3; opacity: .55; }
.torso .nip { fill: #D7A48F; }
.torso .probe-body { fill: #FFFFFF; stroke: var(--ink); stroke-width: 1.4; }
.torso .probe-mark { fill: var(--mod); }
.torso .beam { fill: var(--mod); opacity: .18; }
.torso .t-lbl { font-family: var(--font-body); font-size: 10px; fill: #6A7984; }
.torso .arrow { stroke: var(--mod); stroke-width: 1.6; fill: none; stroke-linecap: round; }

/* Vista em destaque (ecocardio) */
.view-grid { display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr); gap: 16px; align-items: start; }
@media (max-width: 760px) { .view-grid { grid-template-columns: 1fr; } .view-grid .torso { max-width: 250px; margin: 0 auto; } }
.view-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 12px; }

/* Simulador */
.sim { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 760px) { .sim { grid-template-columns: 1fr; } }
.range-field { margin: 0 0 14px; }
.range-field label { display: flex; justify-content: space-between; font-weight: 700; font-size: 0.92rem; color: var(--ink-2); margin-bottom: 4px; }
.range-field output { font-weight: 400; color: var(--ink-3); }
input[type="range"] { width: 100%; accent-color: var(--mod); }

/* ---------- Movimento reduzido ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- Impressão ---------- */
@media print {
  body { background: #fff; font-size: 11pt; }
  .topbar, .tabbar, .btn-install, .seg, .foot .noprint, .search { display: none !important; }
  .panel[hidden] { display: block !important; }
  .panel { page-break-before: always; padding: 0; }
  .panel:first-of-type { page-break-before: auto; }
  .mod-hero::after { display: none; }
  details.acc { break-inside: avoid; }
  details.acc > .acc-body { display: block; }
  figure.fig, .card, .calc, .table-wrap { break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
}

/* ---------- Cabeçalho: ações, tema ---------- */
.top-actions { display: flex; align-items: center; gap: 8px; }
.theme-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; }
.theme-btn:hover { color: var(--ink); border-color: var(--line-2); }
.theme-btn svg { width: 19px; height: 19px; }
.theme-btn .i-sun { display: none; }
html[data-theme="dark"] .theme-btn .i-sun { display: block; }
html[data-theme="dark"] .theme-btn .i-moon { display: none; }
@media (max-width: 420px) { .topbar .brand span { display: none; } }

/* ---------- Crédito GEco / APMGF ---------- */
.credit { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.credit-logo { flex: none; display: block; background: #fff; border-radius: 12px; padding: 8px 12px; line-height: 0; }
.credit-logo img { width: 150px; height: auto; }
.credit p { margin: 0; color: var(--ink-2); font-size: 0.92rem; max-width: 60ch; }

/* ---------- Modo escuro ---------- */
html[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0E1519;
  --surface: #162127;
  --wash: #1D2A31;
  --line: #28373F;
  --line-2: #3A4B55;
  --ink: #E5ECEF;
  --ink-2: #B7C4CB;
  --ink-3: #8B9BA4;
  --ok: #7BCB9C;   --ok-bg: #173327;
  --mid: #E9BE6C;  --mid-bg: #3A2E14;
  --bad: #F29B92;  --bad-bg: #3D1C1A;
  --info: #8EBBE3; --info-bg: #182C3D;
}
html[data-theme="dark"] [class^="m-"], html[data-theme="dark"] [class*=" m-"] {
  --mod-ink: color-mix(in srgb, var(--mod) 55%, white);
  --mod-soft: color-mix(in srgb, var(--mod) 16%, #162127);
  --mod-soft-2: color-mix(in srgb, var(--mod) 28%, #162127);
}
html[data-theme="dark"] .tab[aria-selected="true"] { border-bottom-color: color-mix(in srgb, var(--mod) 70%, white); }
html[data-theme="dark"] .callout.pearl { border-color: color-mix(in srgb, var(--mod) 70%, white); }
html[data-theme="dark"] .steps > li::before { color: var(--ink); }
html[data-theme="dark"] .seg button[aria-pressed="true"] { background: var(--wash); box-shadow: 0 0 0 1px var(--line-2); }
html[data-theme="dark"] a.tile:hover { background: var(--mod-soft); }
html[data-theme="dark"] .tile.soon { background: color-mix(in srgb, var(--surface) 60%, var(--paper)); }
/* Esquemas com cores próprias: apresentados sobre uma placa clara */
html[data-theme="dark"] figure.fig:not(.dark-fig) { background: #EEF2F4; border-color: #EEF2F4; }
html[data-theme="dark"] figure.fig:not(.dark-fig) figcaption { color: #4A5963; }
html[data-theme="dark"] figure.fig:not(.dark-fig) figcaption strong { color: #15232C; }
html[data-theme="dark"] .card .plate, html[data-theme="dark"] .plate { background: #EEF2F4; border-radius: 10px; padding: 6px; }
html[data-theme="dark"] .fig-toolbar .fig-title { color: #43535E; }
html[data-theme="dark"] figure.fig .seg { background: #DCE3E7; }
html[data-theme="dark"] figure.fig .seg button { color: #43535E; }
html[data-theme="dark"] figure.fig .seg button[aria-pressed="true"] { background: #fff; color: color-mix(in srgb, var(--mod) 78%, black); box-shadow: 0 0 0 1px #C2CDD4; }
html[data-theme="dark"] .result.ok .r-sub, html[data-theme="dark"] .result.mid .r-sub, html[data-theme="dark"] .result.bad .r-sub { color: var(--ink-2); }
html[data-theme="dark"] img, html[data-theme="dark"] .credit-logo img { filter: none; }

/* ---------- Esquemas pulmonares ---------- */
.us-fig .lungf { fill: #2a2d2f; }
.us-fig .bonef { fill: #1b1c1d; }
.us-fig .spinev { fill: #d6d6d4; }
.us-fig .fatf { fill: #3f4447; }
.us-fig .fluid { fill: #000; }
.us-fig .lungt { fill: #6f7376; }
.us-fig .aline { stroke: #cfcfcf; fill: none; }
.us-fig .rib-shadow { fill: #050505; }
.us-fig[data-mode="anat"] .lungf { fill: #E3ECF3; }
.us-fig[data-mode="anat"] .bonef { fill: #EDE6D6; stroke: #C9BBA0; stroke-width: 1.5; }
.us-fig[data-mode="anat"] .fatf { fill: #F7EBC8; }
.us-fig[data-mode="anat"] .fluid { fill: #F4E3A1; }
.us-fig[data-mode="anat"] .lungt { fill: #D99A94; }
.us-fig[data-mode="anat"] .aline { stroke: #8FA6BA; stroke-dasharray: 8 6; }
.us-fig[data-mode="anat"] .rib-shadow { fill: transparent; }

.torso .zone-pt circle { fill: var(--marker); }
.torso .zone-pt text, .torso .zone text { font-family: var(--font-body); font-size: 10px; font-weight: 700; }
.torso .zone-pt text { fill: #fff; }
.torso .zone { cursor: pointer; outline: none; }
.torso .zone path { fill: color-mix(in srgb, var(--mod) 10%, transparent); stroke: var(--mod); stroke-width: 1; stroke-dasharray: 3 2; }
.torso .zone text { fill: color-mix(in srgb, var(--mod) 75%, black); }
.torso .zone:hover path, .torso .zone:focus-visible path { fill: color-mix(in srgb, var(--mod) 22%, transparent); stroke-dasharray: none; stroke-width: 2; }
.torso .zone[aria-checked="true"] path { fill: color-mix(in srgb, var(--mod) 70%, transparent); stroke-dasharray: none; }
.torso .zone[aria-checked="true"] text { fill: #fff; }
.zones-wrap { display: grid; grid-template-columns: minmax(0, 300px) 1fr; gap: 18px; align-items: start; }
@media (max-width: 640px) { .zones-wrap { grid-template-columns: 1fr; } }
.flow { display: grid; gap: 10px; }
.flow .node { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 14px; }
.flow .node h4 { margin: 0 0 4px; }
.flow .node p { margin: 0; }
.flow .branch { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.flow .dx { border-left: 4px solid var(--mod); }
figure.fig.narrow { max-width: 620px; }
.us-fig[data-mode="anat"] .eco-only { display: none; }

/* ---------- Esquemas reno-vesicais ---------- */
.us-fig .kcortex { fill: #6c7073; }
.us-fig .kpyr { fill: #34373a; }
.us-fig .ksinus { fill: #d8d8d6; }
.us-fig .prost { fill: #6f7376; }
.us-fig .enh { fill: #fff; opacity: .12; }
.us-fig[data-mode="anat"] .kcortex { fill: #C98A7A; }
.us-fig[data-mode="anat"] .kpyr { fill: #A8605A; }
.us-fig[data-mode="anat"] .ksinus { fill: #F5E3A6; }
.us-fig[data-mode="anat"] .prost { fill: #D9A48E; }
.us-fig[data-mode="anat"] .enh { opacity: 0; }
.us-fig .muscle { fill: #4a4e51; }
.us-fig[data-mode="anat"] .muscle { fill: #D99A94; }
.us-fig .gbwall { fill: #d4d4d2; }
.us-fig .shadowc { fill: #050505; }
.us-fig[data-mode="anat"] .gbwall { fill: #7FA35A; }
.us-fig[data-mode="anat"] .shadowc { fill: transparent; }
.us-fig[data-mode="anat"] .fluid.bile { fill: #CFE0A8; }
.us-fig .gbline { fill: none; stroke: #e2e2e0; stroke-width: 3; }
.us-fig[data-mode="anat"] .gbline { stroke: #6E9448; }
.us-fig[data-mode="anat"] .fluid.free { fill: #E8A94A; }
.us-fig .thrombus { fill: #54585b; }
.us-fig[data-mode="anat"] .thrombus { fill: #9A4550; }

/* ---------- Listas de verificação (scores) ---------- */
.checks { display: grid; gap: 6px; }
.chk { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: start; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; background: var(--surface); }
.chk:hover { border-color: var(--line-2); }
.chk input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--mod); }
.chk .pts { font-weight: 700; color: var(--ink-3); font-size: 0.9rem; }
.chk:has(input:checked) { border-color: var(--mod); background: var(--mod-soft); }

/* ---------- Saúde da mulher ---------- */
.us-fig .uterus { fill: #787c7f; }
.us-fig .endo { fill: #d6d6d4; }
.us-fig .gut { fill: #4f5356; }
.us-fig .decid { fill: #cfcfcd; }
.us-fig .embryo { fill: #cfcfcf; }
.us-fig[data-mode="anat"] .uterus { fill: #D99A9A; }
.us-fig[data-mode="anat"] .endo { fill: #F4CDD0; stroke: #C77C84; stroke-width: 1; }
.us-fig[data-mode="anat"] .gut { fill: #E8C9A8; }
.us-fig[data-mode="anat"] .decid { fill: #F4CDD0; }
.us-fig[data-mode="anat"] .embryo { fill: #E08C8C; }
.pres { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; max-width: 460px; color: var(--mod-ink); text-align: center; font-weight: 700; font-size: .9rem; }

/* ---------- Musculoesquelético ---------- */
.us-fig .tendon { fill: #cfcfcd; }
.us-fig .bursa { fill: #141414; }
.us-fig .cart { fill: #0c0c0c; }
.us-fig[data-mode="anat"] .tendon { fill: #F1E3C0; stroke: #D6C08A; stroke-width: 1; }
.us-fig[data-mode="anat"] .bursa { fill: #A9C2E6; }
.us-fig[data-mode="anat"] .cart { fill: #BFD9EC; }
.inj-tabs { margin-top: 4px; }
.inj-svg { background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); padding: 8px; max-width: 460px; }
.inj-svg svg { width: 100%; height: auto; display: block; font-family: var(--font-body); }
.us-fig[data-mode="anat"] .fluid.jf { fill: #9FC3E6; }
.us-fig[data-mode="anat"] .tendon { fill: #EBD28F; }
