/* Margem: sépia, cartões pastel, pílulas pretas. Mobile primeiro. */
:root {
  --bg: #F4ECDF;
  --bg-grad: linear-gradient(180deg, #F7F0E4 0%, #F1E6D3 55%, #EEE1CB 100%);
  --surface: #FFFBF4;
  --surface-2: #EFE5D4;
  --ink: #1C1915;
  --ink-2: #4A4239;
  --muted: #877B6B;
  --line: #E6D9C3;
  --black: #1C1915;
  --on-black: #FFFBF4;
  --read: #2B241C;
  --ok: #2F7A43; --ok-bg: #CFEFC9;
  --err: #B5452E; --err-bg: #FFD3C2;
  --warn: #8A6410; --warn-bg: #FBE7A6;
  --m: #EADFCB; --m-deep: #1C1915; --m-strong: #1C1915;
  --shadow: 0 1px 2px rgba(60, 40, 10, .05), 0 10px 30px -12px rgba(60, 40, 10, .18);
  --sans: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Literata", Georgia, "Times New Roman", serif;
  --r: 24px; --gutter: 16px;
  --top-h: 56px; --tab-h: 64px; --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
.m-mod1 { --m: #FFD2BC; --m-deep: #7A3418; --m-strong: #EE7A47; }
.m-mod2 { --m: #D3F0CB; --m-deep: #2D5A26; --m-strong: #5DB653; }
.m-mod3 { --m: #CDE6F7; --m-deep: #1D4B6B; --m-strong: #4C9ED6; }
.m-mod4 { --m: #FBE9AB; --m-deep: #6A5008; --m-strong: #E0AE1E; }
.m-mod5 { --m: #E7D2F7; --m-deep: #5A2D7A; --m-strong: #A574D6; }
/* módulos criados a partir dos PDFs enviados */
.m-mod6, .m-mod10, .m-mod14 { --m: #C9EDE6; --m-deep: #1E5A50; --m-strong: #3FAE9B; }
.m-mod7, .m-mod11, .m-mod15 { --m: #F9D3DE; --m-deep: #7A2740; --m-strong: #E0668A; }
.m-mod8, .m-mod12, .m-mod16 { --m: #E3E8B8; --m-deep: #4E5612; --m-strong: #A3AE2E; }
.m-mod9, .m-mod13, .m-mod17 { --m: #D5D8F6; --m-deep: #2E3378; --m-strong: #6E76D8; }

:root[data-theme="dark"] {
  --bg: #1B1814; --bg-grad: linear-gradient(180deg, #211D18 0%, #1B1814 100%);
  --surface: #29241E; --surface-2: #332D26; --ink: #F3EADB; --ink-2: #D6CCBC; --muted: #A39783; --line: #3B342C;
  --black: #F3EADB; --on-black: #1C1915; --read: #E9DFCE;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px -12px rgba(0,0,0,.5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink);
  font: 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--tab-h) + 28px + var(--safe-b)); overflow-x: hidden;
}
a { color: inherit; }
button { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; }
p { margin: 0; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2.5px solid var(--ink); outline-offset: 2px; border-radius: 10px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 50; border-radius: 10px; }
.skip:focus { left: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
[hidden] { display: none !important; }

/* ---------- Topo ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; height: calc(var(--top-h) + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) 8px 0 var(--gutter); display: flex; align-items: center; gap: 6px;
  background: transparent; transition: background .2s, box-shadow .2s;
}
.topbar.scrolled { background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: 0 1px 0 var(--line); }
.topbar.has-back { padding-left: 8px; }
.brand { font: 800 21px/1 var(--sans); text-decoration: none; letter-spacing: -0.03em; }
.brand::after { content: "."; color: #EE7A47; }
.topbar.has-back .brand { display: none; }
.topbar-title { flex: 1; min-width: 0; font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0; transition: opacity .2s; }
.topbar.scrolled .topbar-title { opacity: 1; }
.topbar:not(.has-back) .topbar-title { display: none; }
.topbar:not(.has-back) .brand { flex: 1; }
.icon-btn {
  width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 50%;
  background: var(--surface); box-shadow: var(--shadow); cursor: pointer; color: var(--ink); text-decoration: none; flex: none;
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:active { transform: scale(.95); }

/* ---------- Barra inferior: pílula preta flutuante ---------- */
.tabbar {
  position: fixed; z-index: 20; left: 50%; transform: translateX(-50%);
  bottom: calc(12px + var(--safe-b)); width: min(calc(100% - 32px), 420px); height: var(--tab-h);
  display: grid; grid-template-columns: repeat(4, 1fr); padding: 7px;
  background: #1C1915; border-radius: 32px; box-shadow: 0 14px 30px -10px rgba(30, 20, 5, .5);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border-radius: 26px;
  text-decoration: none; color: #B9AE9C; font-size: 11px; font-weight: 600; transition: background .2s, color .2s;
}
.tabbar a svg { width: 21px; height: 21px; }
.tabbar a[aria-current="page"] { background: #FFFBF4; color: #1C1915; }
body[class*="m-mod"] .tabbar a[aria-current="page"] { background: var(--m); }
body.foco .tabbar, body.foco .topbar a[href='#/busca'] { display: none; }
body.foco { padding-bottom: var(--safe-b); }

/* ---------- Layout ---------- */
main { max-width: 640px; margin: 0 auto; padding: 4px var(--gutter) 24px; outline: none; }
.page-head { padding: 10px 0 18px; }
.eyebrow { font: 600 13px/1.3 var(--sans); color: var(--muted); }
.page-title { font: 800 32px/1.08 var(--sans); letter-spacing: -0.035em; margin-top: 4px; }
.page-sub { color: var(--ink-2); margin-top: 8px; font-size: 15px; }
.section { margin-top: 26px; }
.section-title { font: 800 19px/1.2 var(--sans); letter-spacing: -0.02em; margin-bottom: 12px; color: var(--ink); }
.section-title .muted { font-weight: 600; font-size: 14px; }
.stack > * + * { margin-top: 10px; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mt { margin-top: 16px; }
.mt-s { margin-top: 8px; }

/* ---------- Cartões ---------- */
.card { background: var(--surface); border-radius: var(--r); padding: 18px; box-shadow: var(--shadow); }
.card-link { display: block; text-decoration: none; color: inherit; }
.card-link:active, .item:active, .stat:active { transform: scale(.985); }
.hero { padding: 22px 20px 20px; position: relative; overflow: hidden; }
.hero .meta { font: 600 13px/1.3 var(--sans); color: var(--ink-2); position: relative; }
.hero h2 { font: 800 26px/1.12 var(--sans); letter-spacing: -0.03em; margin: 8px 64px 6px 0; position: relative; }
.hero p { color: var(--ink-2); max-width: 30ch; position: relative; }
.hero .btn { margin-top: 18px; position: relative; }
.hero.fill { background: var(--m); color: #1C1915; box-shadow: 0 16px 34px -18px var(--m-strong); }
.hero.fill .meta, .hero.fill p { color: var(--m-deep); }
.hero .deco { position: absolute; right: -40px; bottom: -50px; width: 170px; height: 170px; border-radius: 50%; border: 22px solid rgba(255, 255, 255, .35); pointer-events: none; }
.hero .num { position: absolute; right: 18px; top: 18px; width: 52px; height: 52px; border-radius: 50%; background: rgba(255,255,255,.6); display: grid; place-items: center; font: 800 22px/1 var(--sans); color: var(--m-deep); }
.hero.fill .btn:not(.ghost) { background: #1C1915; color: #FFFBF4; }

/* números do dia */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.stat { border-radius: 20px; padding: 14px 8px 12px; text-align: center; text-decoration: none; color: #1C1915; }
.stat b { display: block; font: 800 28px/1 var(--sans); letter-spacing: -0.03em; }
.stat span { display: block; font-size: 12.5px; font-weight: 600; margin-top: 6px; opacity: .75; }
.stat.a { background: #CDE6F7; } .stat.b { background: #D3F0CB; }
.stat.c { background: transparent; border: 2px dashed var(--line); color: var(--ink); }

/* listas = pilha de cartões */
.list { display: grid; gap: 8px; }
.item {
  display: flex; align-items: center; gap: 12px; padding: 14px 14px 14px 16px; min-height: 64px; width: 100%;
  text-decoration: none; color: inherit; text-align: left; cursor: pointer;
  background: var(--surface); border: 0; border-radius: 20px; box-shadow: var(--shadow);
}
.item .t { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }
.item .s { color: var(--muted); font-size: 13px; margin-top: 2px; line-height: 1.35; }
.item .chev { width: 32px; height: 32px; padding: 7px; border-radius: 50%; background: var(--surface-2); color: var(--ink); flex: none; }
.tile { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; flex: none; background: var(--m); color: var(--m-deep); font: 800 16px/1 var(--sans); }
.tile svg { width: 20px; height: 20px; }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 22px;
  border-radius: 999px; border: 0; background: var(--black); color: var(--on-black); font: 700 15px/1.2 var(--sans);
  text-decoration: none; cursor: pointer; -webkit-tap-highlight-color: transparent; transition: transform .1s; text-align: center;
}
.btn:active { transform: scale(.97); }
.btn.block { width: 100%; }
.btn.ghost { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.soft { background: var(--m); color: var(--m-deep); }
.btn.small { min-height: 44px; padding: 0 16px; font-size: 14px; }
.btn[disabled] { opacity: .4; pointer-events: none; }
.link-btn { background: none; border: 0; padding: 8px 0; color: var(--ink-2); font-size: 14px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1.5px; cursor: pointer; }
.btn-row { display: flex; gap: 10px; }
.btn-row > * { flex: 1; }

/* ---------- Estados ---------- */
.dot { width: 12px; height: 12px; border-radius: 50%; flex: none; border: 2px solid var(--muted); background: transparent; }
.dot.andamento { border-color: #EE7A47; background: linear-gradient(90deg, #EE7A47 50%, transparent 50%); }
.dot.estudado { border-color: #5DB653; background: #5DB653; }
.dot.revisando { border-color: #4C9ED6; background: #CDE6F7; }
.dot.dominado { border-color: #E0AE1E; background: #E0AE1E; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.pill { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px; border-radius: 999px; font: 700 12px/1 var(--sans); white-space: nowrap; }
.pill.nao { background: var(--surface-2); color: var(--muted); }
.pill.andamento { background: #FFD2BC; color: #7A3418; }
.pill.estudado { background: #D3F0CB; color: #2D5A26; }
.pill.revisando { background: #CDE6F7; color: #1D4B6B; }
.pill.dominado { background: #FBE9AB; color: #6A5008; }
.progress-line { color: var(--ink-2); font-size: 14px; font-weight: 600; }
.bar { height: 8px; background: var(--surface-2); border-radius: 8px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--m-strong); border-radius: 8px; transition: width .4s; }

/* anéis */
.rings { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.ring-item { display: flex; flex-direction: column; align-items: center; gap: 6px; text-decoration: none; color: inherit; text-align: center; }
.ring { width: 54px; height: 54px; position: relative; }
.ring svg, .result-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle, .result-ring circle { fill: none; }
.ring circle { stroke-width: 6; }
.ring .trk, .result-ring .trk { stroke: var(--m); }
.ring .val, .result-ring .val { stroke: var(--m-strong); stroke-linecap: round; transition: stroke-dashoffset .6s; }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font: 800 12px/1 var(--sans); color: var(--ink); }
.ring-item span { font-size: 11px; font-weight: 600; line-height: 1.25; color: var(--ink-2); }

/* ---------- Trilha ---------- */
.modulo-card { margin-top: 30px; }
.modulo-head { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.modulo-head h2 { font: 800 21px/1.15 var(--sans); letter-spacing: -0.025em; }
.modulo-head .badge { width: 44px; height: 44px; border-radius: 15px; background: var(--m); color: var(--m-deep); display: grid; place-items: center; font: 800 18px/1 var(--sans); flex: none; }
.modulo-card .ring { width: 46px; height: 46px; }
.modulo-card .ring b { font-size: 11px; }
.modulo-desc { color: var(--muted); font-size: 13.5px; margin: 2px 0 0 56px; }
.rail { position: relative; padding-left: 26px; margin-top: 14px; display: grid; gap: 10px; }
.rail::before { content: ""; position: absolute; left: 8px; top: 24px; bottom: 24px; border-left: 2px dashed var(--m-strong); opacity: .55; }
.rail .item { position: relative; align-items: flex-start; }
.rail .item::before { content: ""; position: absolute; left: -23px; top: 24px; width: 10px; height: 10px; border-radius: 50%; background: var(--bg); border: 2px solid var(--m-strong); }
.rail .item.feito::before { background: var(--m-strong); }
.rail .item .chev { align-self: center; }
.rail .item .pill { margin-top: 10px; }

/* ---------- Tópico ---------- */
.topic-head { background: var(--m); color: #1C1915; border-radius: 28px; padding: 18px 18px 20px; margin: 4px 0 16px; position: relative; overflow: hidden; }
.topic-head::after { content: ""; position: absolute; right: -50px; top: -60px; width: 170px; height: 170px; border-radius: 50%; border: 20px solid rgba(255,255,255,.35); pointer-events: none; }
.topic-head > * { position: relative; z-index: 1; }
.topic-head .page-title { font-size: 28px; color: #1C1915; }
.topic-head .page-sub { color: var(--m-deep); }
.topic-head .link-btn { color: var(--m-deep); }
.chip-mod { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: 999px; background: rgba(255,255,255,.7); color: var(--m-deep); font: 700 12px/1 var(--sans); }
.eyebrow.mod { color: var(--m-deep); }

.tabs { display: flex; gap: 4px; background: var(--surface); padding: 5px; border-radius: 999px; box-shadow: var(--shadow); position: sticky; top: calc(var(--top-h) + env(safe-area-inset-top, 0px) + 4px); z-index: 5; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: 1; min-height: 42px; border: 0; background: none; border-radius: 999px; font-weight: 700; font-size: 13.5px; color: var(--muted); cursor: pointer; white-space: nowrap; padding: 0 12px; }
.tabs button[aria-selected="true"] { background: var(--black); color: var(--on-black); }

/* leitura estilo Kindle */
.reading { font: 400 18px/1.72 var(--serif); color: var(--read); padding: 4px 2px; }
.reading .para { margin-top: 22px; }
.reading .para:first-child { margin-top: 20px; }
.src-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.src {
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 12px;
  font: 700 12px/1 var(--sans); color: var(--ink-2); background: var(--surface);
  border: 0; border-radius: 999px; cursor: pointer; box-shadow: var(--shadow);
}
.src svg { width: 14px; height: 14px; color: var(--m-strong); }
.src:active { transform: scale(.96); }
.keypoints { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 10px; }
.keypoints li { background: var(--surface); border-radius: 20px; padding: 16px 16px 14px; box-shadow: var(--shadow); }
.keypoints .kp { font: 600 16.5px/1.45 var(--sans); letter-spacing: -0.01em; }
.keypoints.num { counter-reset: kp; }
.keypoints.num li { position: relative; padding-left: 60px; }
.keypoints.num li::before { counter-increment: kp; content: counter(kp); position: absolute; left: 14px; top: 14px; width: 32px; height: 32px; border-radius: 50%; background: var(--m); color: var(--m-deep); display: grid; place-items: center; font: 800 14px/1 var(--sans); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { white-space: nowrap; flex: none; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 0; background: var(--surface); box-shadow: var(--shadow); font-size: 14px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; text-decoration: none; color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--black); color: var(--on-black); }
.note { width: 100%; min-height: 240px; resize: vertical; padding: 18px; border-radius: var(--r); border: 0; background: var(--surface); box-shadow: var(--shadow); color: var(--read); font: 400 17px/1.6 var(--serif); margin-top: 18px; }
.hint { color: var(--muted); font-size: 13px; margin-top: 8px; }

/* citação do PDF */
.quote { background: #F7EEDF; padding: 18px; border-radius: 20px; font: 400 16px/1.65 var(--serif); color: #2B241C; white-space: pre-line; }
:root[data-theme="dark"] .quote { background: var(--surface-2); color: var(--read); }
.origem { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.origem.ocr { color: var(--warn); }

/* ---------- Prática ---------- */
.quiz-top { display: flex; align-items: center; gap: 12px; padding: 6px 0 2px; }
.quiz-top .count { font: 800 14px/1 var(--sans); font-variant-numeric: tabular-nums; background: var(--surface); padding: 9px 13px; border-radius: 999px; box-shadow: var(--shadow); }
.quiz-top .bar { flex: 1; margin: 0; }
.q-tipo { margin-top: 22px; }
.q-enunciado { font: 800 22px/1.3 var(--sans); letter-spacing: -0.02em; margin-top: 6px; }
.options { list-style: none; margin: 20px 0 0; padding: 0; display: grid; gap: 10px; }
.opt {
  width: 100%; text-align: left; min-height: 60px; padding: 14px 16px; border-radius: 20px; border: 2px solid transparent;
  background: var(--surface); box-shadow: var(--shadow); cursor: pointer; font-size: 15.5px; font-weight: 600; line-height: 1.4;
  display: flex; align-items: center; gap: 12px; color: var(--ink);
}
.opt .mark { width: 28px; height: 28px; flex: none; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; }
.opt .mark svg { width: 15px; height: 15px; stroke-width: 2.6; }
.opt:active:not([disabled]) { border-color: var(--ink); }
.opt.right { background: var(--ok-bg); box-shadow: none; color: #1C1915; }
.opt.right .mark { background: #1C1915; color: #FFFBF4; }
.opt.wrong { background: var(--err-bg); box-shadow: none; color: #1C1915; }
.opt.wrong .mark { background: #B5452E; color: #FFFBF4; }
.opt[disabled] { cursor: default; }
.opt.dim { opacity: .5; }
.feedback { margin-top: 16px; padding: 18px; border-radius: 22px; background: var(--surface); color: #1C1915; }
.feedback.ok { background: var(--ok-bg); }
.feedback.err { background: var(--err-bg); }
.feedback .verdict { font: 800 17px/1.2 var(--sans); }
.feedback .verdict.ok { color: #2F7A43; } .feedback .verdict.err { color: #A33B25; }
.feedback p { margin-top: 8px; color: #3A3229; }
.feedback .src { background: rgba(255,255,255,.75); box-shadow: none; color: #3A3229; }
.dock { position: sticky; bottom: 0; padding: 14px 0 calc(14px + var(--safe-b)); background: linear-gradient(transparent, var(--bg) 35%); margin-top: 14px; }
.flash { min-height: 260px; display: flex; flex-direction: column; justify-content: center; text-align: center; padding: 30px 22px; margin-top: 22px; background: var(--m); border-radius: 30px; transform: rotate(-1.2deg); box-shadow: 0 18px 34px -18px var(--m-strong); color: #1C1915; }
.flash .face { font: 800 21px/1.35 var(--sans); letter-spacing: -0.02em; }
.flash .back { margin-top: 18px; padding: 16px; background: rgba(255,255,255,.65); border-radius: 18px; font: 400 17px/1.55 var(--serif); color: #2B241C; }
.flash .src-row { justify-content: center; }
.result-ring { width: 150px; height: 150px; margin: 0 auto; position: relative; }
.result-ring circle { stroke-width: 14; }
.result-ring b { position: absolute; inset: 0; display: grid; place-items: center; font: 800 36px/1 var(--sans); letter-spacing: -0.03em; }

/* ---------- Busca ---------- */
.search-box {
  position: sticky; top: calc(var(--top-h) + env(safe-area-inset-top, 0px)); z-index: 6;
  margin: 0 calc(var(--gutter) * -1); padding: 4px var(--gutter) 12px; background: var(--bg);
  box-shadow: 0 10px 14px -14px rgba(60, 40, 10, .35);
}
.search-field { position: relative; }
.search-box input {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 52px; padding: 0 52px 0 48px; border-radius: 999px; border: 1.5px solid transparent; box-shadow: var(--shadow);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23877B6B' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='M16 16l4.5 4.5'/%3E%3C/svg%3E") 18px 50% / 20px no-repeat;
  font: 600 16px var(--sans); color: var(--ink); text-overflow: ellipsis;
}
.search-box input::placeholder { color: var(--muted); font-weight: 500; }
.search-box input::-webkit-search-cancel-button, .search-box input::-webkit-search-decoration { -webkit-appearance: none; display: none; }
.search-box input:focus { outline: none; border-color: #EE7A47; box-shadow: 0 0 0 4px rgba(238, 122, 71, .18); }
.search-clear { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--surface-2); color: var(--ink); display: grid; place-items: center; cursor: pointer; }
.search-clear svg { width: 16px; height: 16px; stroke-width: 2.4; }
#filtros { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 10px calc(var(--gutter) * -1) 0; padding: 2px var(--gutter) 4px;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 var(--gutter), #000 calc(100% - 40px), transparent);
          mask-image: linear-gradient(90deg, transparent 0, #000 var(--gutter), #000 calc(100% - 40px), transparent); }
#filtros::-webkit-scrollbar { display: none; }
#filtros .chip { min-height: 38px; box-shadow: none; background: var(--surface); }
#filtros .chip[aria-pressed="true"] { background: var(--black); color: var(--on-black); }
body.pg-busca .topbar { background: var(--bg); box-shadow: none; backdrop-filter: none; }
body.pg-busca .topbar a[href='#/busca'] { display: none; }
#res .section:first-child { margin-top: 14px; }
.result { padding: 16px; display: block; text-decoration: none; color: inherit; width: 100%; text-align: left; background: var(--surface); border: 0; border-radius: 20px; box-shadow: var(--shadow); cursor: pointer; }
.result .t { font-weight: 700; }
.result .snip { color: var(--ink-2); font-size: 14.5px; margin-top: 4px; font-family: var(--serif); line-height: 1.55; }
.result .o { margin-top: 8px; font: 700 12px/1 var(--sans); color: var(--muted); }
mark { background: #FBE9AB; color: #1C1915; border-radius: 4px; padding: 0 2px; }
.empty { text-align: center; color: var(--muted); padding: 40px 16px; font-weight: 500; }

/* ---------- Folha inferior ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(28, 20, 8, .4); z-index: 40; animation: fade .15s; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-height: 86vh; display: flex; flex-direction: column;
  background: var(--surface); border-radius: 30px 30px 0 0; box-shadow: 0 -10px 40px rgba(0,0,0,.18);
  padding-bottom: var(--safe-b); animation: up .22s cubic-bezier(.2,.8,.2,1); max-width: 640px; margin: 0 auto;
}
.sheet-handle { width: 44px; height: 5px; border-radius: 3px; background: var(--line); margin: 10px auto 0; }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px 6px 20px; }
.sheet-head h2 { flex: 1; font: 800 18px/1.25 var(--sans); letter-spacing: -0.02em; }
.sheet-head .icon-btn { box-shadow: none; background: var(--surface-2); width: 40px; height: 40px; }
.sheet-body { overflow: auto; padding: 4px 20px 24px; overscroll-behavior: contain; }
.sheet-body .actions { margin-top: 16px; display: grid; gap: 10px; }
textarea.input, select.input, input.input { width: 100%; border: 0; border-radius: 18px; background: var(--surface-2); color: var(--ink); padding: 14px; font: 15px var(--sans); }
textarea.input { min-height: 110px; }
label.lbl { display: block; font-weight: 700; font-size: 14px; margin: 14px 0 6px; }
@keyframes up { from { transform: translateY(24px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

/* ---------- PDF ---------- */
.pdf-wrap { border-radius: 20px; overflow: hidden; background: var(--surface); box-shadow: var(--shadow); min-height: 40vh; display: grid; place-items: center; }
.pdf-wrap canvas { width: 100%; height: auto; display: block; background: #fff; }
.pdf-bar { display: flex; align-items: center; gap: 8px; padding: 6px 0 12px; }
.pdf-bar .btn { width: 52px; padding: 0; font-size: 22px; }
.pdf-bar .pg { flex: 1; text-align: center; font: 800 15px/1 var(--sans); font-variant-numeric: tabular-nums; }
.loading { color: var(--muted); padding: 40px; text-align: center; font-size: 14px; }

/* ---------- Diversos ---------- */
.toast { position: fixed; left: 50%; bottom: calc(var(--tab-h) + var(--safe-b) + 26px); transform: translate(-50%, 20px); background: #1C1915; color: #FFFBF4; padding: 12px 18px; border-radius: 999px; font-size: 14px; font-weight: 600; opacity: 0; pointer-events: none; transition: .2s; z-index: 60; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.tag { display: inline-flex; align-items: center; height: 26px; font: 700 12px/1 var(--sans); padding: 0 10px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.noscript { padding: 24px; }
.fade-in { animation: fade .2s ease-out; }

@media (min-width: 720px) {
  .page-title { font-size: 38px; }
  .reading { font-size: 19px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } .flash { transform: none; } }

.hero .meta { margin-right: 64px; }
.dock { background: none; }
.dock .btn { box-shadow: 0 12px 24px -10px rgba(30, 20, 5, .45); }
.install { margin-bottom: 14px; }
@media (min-width: 720px) { .search-box { box-shadow: none; } }

/* Na prática e casos */
.pratica .on-m { background: var(--m); color: #1C1915; box-shadow: none; }
.pratica .on-m .tag { background: rgba(255,255,255,.7); color: var(--m-deep); }
.pratica .sit { font-size: 17px; line-height: 1.6; color: #1C1915; margin-top: 10px; padding: 0; }
.pratica .leitura { font-size: 17px; margin-top: 14px; }
.pratica .sub { font: 800 15px/1.2 var(--sans); letter-spacing: -0.01em; }
.sinais { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 10px; }
.sinais li { position: relative; padding-left: 26px; font-size: 15px; line-height: 1.45; color: var(--ink-2); }
.sinais li::before { content: ""; position: absolute; left: 2px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--m); box-shadow: inset 0 0 0 3px var(--m-strong); }
.tag.caso { background: var(--m); color: var(--m-deep); margin-top: 6px; }
.feedback .criado { font-size: 12.5px; color: #5A5046; margin-top: 10px; }
main:focus-visible { outline: none; }

/* Adicionar PDF */
input.input { min-height: 52px; font-weight: 600; }
input.input:focus { outline: none; box-shadow: 0 0 0 3px var(--ink); }
.hint.err { color: var(--err); font-weight: 600; }
.passo-t { display: flex; align-items: center; gap: 10px; font: 800 16px/1.2 var(--sans); letter-spacing: -0.01em; }
.passo-n { width: 28px; height: 28px; border-radius: 50%; background: var(--black); color: var(--on-black); display: grid; place-items: center; font-size: 13px; flex: none; }
.passos { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 14px; }
.passos li { display: flex; align-items: center; gap: 12px; color: var(--muted); font-weight: 600; }
.passos .b { width: 26px; height: 26px; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--line); display: grid; place-items: center; flex: none; }
.passos .b svg { width: 16px; height: 16px; stroke-width: 2.6; }
.passos .feito { color: var(--ink-2); }
.passos .feito .b { background: var(--ok-bg); color: var(--ok); box-shadow: none; }
.passos .agora { color: var(--ink); }
.passos .agora .b { box-shadow: inset 0 0 0 2px var(--line); border-top: 2.5px solid var(--ink); animation: gira .9s linear infinite; }
.seg { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ink-2); }
@keyframes gira { to { transform: rotate(360deg); } }
.ia-nota { font-size: 12.5px; color: var(--m-deep); margin-top: 10px; }
.ia-nota a { font-weight: 700; }
.modulo-desc .tag { height: 22px; font-size: 11px; vertical-align: 1px; }
