/* Sumário — folha de estilos (redesenhada a 2026-11-16, quando o SabeTudo passou a Sumário).
   Linguagem: livro e caderno — índice com reticências, marcas de contagem, fichas pautadas, sublinhado a vermelho.
   Tokens no :root (claro) e redefinidos no escuro: nunca escrever cores à mão fora daqui (excepto --c das disciplinas).
   Tipos alojados em fonts/ (licença OFL, nada pedido à Google): Literata (títulos, perguntas, números) e Sumario Sans
   (interface) = Atkinson Hyperlegible Next com o zero sem traço, em 400 e 700 (scripts/marca/zero.py). Só há esses dois pesos. */
@font-face { font-family: "Literata"; src: url(fonts/literata.woff2) format("woff2"); font-weight: 200 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Literata"; src: url(fonts/literata-italic.woff2) format("woff2"); font-weight: 200 900; font-style: italic; font-display: swap; }
@font-face { font-family: "Sumario Sans"; src: url(fonts/sumario-sans-400.woff2) format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Sumario Sans"; src: url(fonts/sumario-sans-700.woff2) format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Sumario Sans"; src: url(fonts/sumario-sans-400-italic.woff2) format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Sumario Sans"; src: url(fonts/sumario-sans-700-italic.woff2) format("woff2"); font-weight: 700; font-style: italic; font-display: swap; }

:root {
  --paper: #f6f4ee;      /* fundo */
  --card: #fffefa;
  --ink: #121a33;        /* tinta: texto e logótipo */
  --ink-2: #333b57;
  --muted: #5d6480;
  --line: #e4e0d5;
  --line-2: #cdc8ba;
  --soft: #efece4;
  --rule: #dce5f5;       /* pauta azul das fichas */
  --pen: #2747c9;        /* azul caneta: acções, ligações, selecção */
  --pen-d: #1c369f;
  --pen-soft: #e9edfb;
  --on-pen: #ffffff;
  --red: #ff5a3c;        /* vermelho de sublinhar: marcas, «nas aulas», «continuar» */
  --red-ink: #c23a20;    /* o mesmo para texto */
  --red-soft: #ffe9e2;
  --ok: #18774f; --ok-bg: #e3f2ea;
  --bad: #c23a20; --bad-bg: #fbe8e3;
  --warn: #b46d06;
  --btn-ink: #121a33; --on-ink: #f7f5ef;
  --serif: "Literata", Georgia, "Times New Roman", serif;
  --sans: "Sumario Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --r: 14px;
  --shadow: 0 1px 2px rgba(18, 26, 51, .05), 0 8px 24px rgba(18, 26, 51, .07);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0e1324; --card: #161c32; --ink: #eceef6; --ink-2: #c8cde0; --muted: #9aa1ba;
    --line: #262e4c; --line-2: #3a4470; --soft: #1c233f; --rule: #222b4c;
    --pen: #9aaeff; --pen-d: #bccaff; --pen-soft: #1e2752; --on-pen: #0e1324;
    --red: #ff7a5f; --red-ink: #ff9580; --red-soft: #3a1f1b;
    --ok: #5fcb9e; --ok-bg: #11332a; --bad: #ff9580; --bad-bg: #3a1f1b; --warn: #f0b04a;
    --btn-ink: #eceef6; --on-ink: #0e1324;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
  :root:not([data-theme="light"]) [style*="--c"] { --cc: color-mix(in srgb, var(--c) 55%, #fff); }
}
:root[data-theme="dark"] {
  --paper: #0e1324; --card: #161c32; --ink: #eceef6; --ink-2: #c8cde0; --muted: #9aa1ba;
  --line: #262e4c; --line-2: #3a4470; --soft: #1c233f; --rule: #222b4c;
  --pen: #9aaeff; --pen-d: #bccaff; --pen-soft: #1e2752; --on-pen: #0e1324;
  --red: #ff7a5f; --red-ink: #ff9580; --red-soft: #3a1f1b;
  --ok: #5fcb9e; --ok-bg: #11332a; --bad: #ff9580; --bad-bg: #3a1f1b; --warn: #f0b04a;
  --btn-ink: #eceef6; --on-ink: #0e1324;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  color-scheme: dark;
}
/* cor de cada disciplina: --c vem do servidor (escura, para fundo claro); --cc é a versão para texto em cada tema */
[style*="--c"] { --cc: var(--c); }
:root[data-theme="dark"] [style*="--c"] { --cc: color-mix(in srgb, var(--c) 55%, #fff); }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--paper); color: var(--ink); }
body { font-family: var(--sans); font-weight: 400; font-size: 16px; line-height: 1.5; min-height: 100vh; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--pen); text-underline-offset: 2px; }
h1, h2, h3 { margin: 0; line-height: 1.2; text-wrap: balance; }
h1, h2 { font-family: var(--serif); font-weight: 700; letter-spacing: -.005em; }
h1 { font-size: 28px; } h2 { font-size: 22px; } h3 { font-size: 17px; font-weight: 700; }
b, strong { font-weight: 700; }
p { margin: 10px 0; }
:focus-visible { outline: 2.5px solid var(--pen); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 12px; }
.hidden { display: none !important; }
.ic { width: 20px; height: 20px; flex: none; vertical-align: -4px; }
.eyebrow { font-size: 12.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.eyebrow .ic { width: 16px; height: 16px; vertical-align: 0; }
.eyebrow.c { color: var(--cc); }

/* ---------- marca ---------- */
.wm { display: block; height: 24px; width: auto; color: var(--ink); }
.logo { display: inline-flex; align-items: center; margin-right: auto; color: var(--ink); text-decoration: none; }
.logo .wm { height: 23px; }
.logo-big { display: flex; justify-content: center; }
.logo-big .wm { height: 46px; }
.boot { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.boot p { margin: 18px 0; }

/* ---------- botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1.5px solid transparent; border-radius: 12px; padding: 11px 18px; min-height: 48px;
  font-family: var(--sans); font-weight: 700; font-size: 16px; line-height: 1.2;
  background: var(--pen); color: var(--on-pen); cursor: pointer; text-decoration: none;
  transition: background .15s, border-color .15s, color .15s, transform .08s;
}
.btn:hover:not(:disabled) { background: var(--pen-d); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { background: var(--soft); color: var(--muted); border-color: var(--soft); cursor: default; }
.btn .ic { width: 19px; height: 19px; }
.btn.block { width: 100%; }
.btn.blue { background: var(--btn-ink); color: var(--on-ink); }
.btn.blue:hover:not(:disabled) { background: color-mix(in srgb, var(--btn-ink) 85%, var(--pen)); }
.btn.ghost { background: var(--card); color: var(--ink); border-color: var(--line-2); }
.btn.ghost:hover:not(:disabled) { background: var(--card); border-color: var(--ink-2); }
.btn.wa { background: #128c7e; color: #fff; }
.btn.wa:hover { background: #0f7a6d; }
.btn.danger { background: var(--bad); color: var(--card); }
.btn.danger:hover:not(:disabled) { background: color-mix(in srgb, var(--bad) 85%, #000); }
.btn.sm { min-height: 38px; padding: 7px 12px; font-size: 14px; border-radius: 10px; }
.link { background: none; border: 0; padding: 6px; color: var(--pen); font-weight: 700; cursor: pointer; text-decoration: none; }
.link:hover { text-decoration: underline; }
.icon-btn { background: none; border: 0; padding: 8px; cursor: pointer; color: var(--muted); border-radius: 10px; display: inline-grid; place-items: center; }
.icon-btn:hover { background: var(--soft); color: var(--ink); }
.icon-btn .ic { width: 24px; height: 24px; }

/* ---------- formulários ---------- */
.field { display: block; }
.field > span { display: block; font-size: 14px; font-weight: 700; color: var(--ink-2); margin-bottom: 6px; }
.input, select.input, textarea.input {
  width: 100%; border: 1.5px solid var(--line-2); background: var(--card); border-radius: 12px;
  padding: 11px 14px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--pen); box-shadow: 0 0 0 3px color-mix(in srgb, var(--pen) 20%, transparent); }
textarea.input { resize: vertical; min-height: 52px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.check input { width: 20px; height: 20px; margin-top: 1px; accent-color: var(--pen); flex: none; }
.err { color: var(--bad); font-weight: 700; font-size: 14px; min-height: 20px; }

/* ---------- estrutura: topo e navegação ---------- */
.page { max-width: 680px; margin: 0 auto; padding: 0 16px calc(96px + env(safe-area-inset-bottom)); }
.page.wide { max-width: 980px; }
.topbar { position: sticky; top: 0; z-index: 20; background: var(--paper); border-bottom: 1px solid var(--line); }
.topbar .in { max-width: 980px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 14px; min-height: 56px; }
.stats { display: flex; align-items: center; gap: 14px; }
.stat { display: inline-flex; align-items: center; gap: 5px; font-weight: 700; font-size: 15px; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat .ic { width: 18px; height: 18px; color: var(--muted); }
.stat.fire .ic { color: var(--red); }
.stat.fire.off { color: var(--muted); }
.stat.fire.off .ic { color: var(--muted); }
.stat small { color: var(--muted); font-weight: 400; font-size: 13px; }

.nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: var(--card);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.nav .in { max-width: 640px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); padding: 0; min-height: 0; }
.nav a {
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 0 10px;
  color: var(--muted); text-decoration: none; font-size: 12.5px; font-weight: 700; position: relative;
}
.nav a .ic { width: 24px; height: 24px; }
.nav a.on { color: var(--ink); }
.nav a.on::before { content: ""; position: absolute; top: -1px; left: 50%; width: 30px; margin-left: -15px; height: 3px; border-radius: 0 0 3px 3px; background: var(--red); }
.badge {
  position: absolute; top: 4px; left: calc(50% + 7px); background: #c8402a; color: #fff;
  font-size: 11px; font-weight: 700; border-radius: 99px; padding: 1px 6px; min-width: 18px; text-align: center; line-height: 1.45;
}
@media (min-width: 900px) {
  .logo { margin-right: 18px; }
  .nav { position: static; background: none; border: 0; padding: 0; }
  .nav .in { display: flex; gap: 2px; max-width: none; }
  .nav a { flex-direction: row; gap: 8px; padding: 8px 12px; font-size: 15px; border-radius: 10px; }
  .nav a .ic { width: 20px; height: 20px; }
  .nav a:hover { color: var(--ink); background: var(--soft); }
  .nav a.on::before { top: auto; bottom: -11px; left: 12px; right: 12px; width: auto; margin: 0; border-radius: 3px 3px 0 0; }
  .badge { position: static; margin-left: 2px; }
  .stats { margin-left: auto; }
  .page { padding-bottom: 64px; }
}

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.section { margin-top: 20px; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 30px 0 10px; }
.section-title h3 { font-family: var(--serif); font-size: 19px; font-weight: 700; }
.page-title { margin-top: 24px; }
.lede { color: var(--muted); margin: 6px 0 16px; }

/* chips */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-2); background: var(--card);
  border-radius: 99px; padding: 7px 14px; font-weight: 700; cursor: pointer; white-space: nowrap; font-size: 14px; color: var(--ink-2);
}
.chip .ic { width: 17px; height: 17px; }
.chip:hover { border-color: var(--ink-2); }
.chips.wrap-chips { flex-wrap: wrap; overflow: visible; }
.chip:disabled { cursor: default; opacity: .85; }
a.chip { text-decoration: none; }
.chip.on { background: var(--btn-ink); border-color: var(--btn-ink); color: var(--on-ink); }
.chip-edit { border-style: dashed; color: var(--muted); background: transparent; }
.big-chip { padding: 12px 18px; font-size: 16px; }
/* separadores das disciplinas, no ecrã da matéria */
.chips.under { gap: 2px; border-bottom: 1px solid var(--line); padding: 0; margin-top: 4px; }
.chips.under .chip { border: 0; background: none; border-radius: 0; padding: 12px 10px 11px; color: var(--muted); position: relative; }
.chips.under .chip .ic { color: var(--cc, currentColor); }
.chips.under .chip:hover { color: var(--ink); }
.chips.under .chip.on { color: var(--ink); }
.chips.under .chip.on::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: 0; height: 3px; background: var(--red); border-radius: 3px 3px 0 0; }
.chips.under .chip-edit { margin-left: auto; }
.chips.years { margin-top: 14px; }

/* meta de hoje */
.goal { display: flex; gap: 12px; align-items: center; margin-top: 16px; padding: 12px 14px; }
.goal .ico { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--soft); color: var(--ink-2); flex: none; }
.goal.done .ico { background: var(--ok-bg); color: var(--ok); }
.goal b { font-size: 15px; }
.bar { height: 8px; background: var(--soft); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--pen); border-radius: 99px; transition: width .4s; }
.bar.green > i { background: var(--ok); }
.guest-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; padding: 10px 14px; border-radius: 12px;
  background: var(--pen-soft); border: 1px solid color-mix(in srgb, var(--pen) 30%, var(--line)); color: var(--ink); text-decoration: none; font-size: 14px;
}
.guest-banner b { color: var(--pen); white-space: nowrap; }
.guest-card { border-color: color-mix(in srgb, var(--pen) 35%, var(--line)); }

/* ---------- matéria: cabeçalho da disciplina e índice (sumário) das unidades ---------- */
.subject-head { margin-top: 20px; display: flex; align-items: center; gap: 14px; }
.sh-ic {
  width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; flex: none;
  background: color-mix(in srgb, var(--c) 12%, var(--card)); color: var(--cc); border: 1px solid color-mix(in srgb, var(--c) 25%, var(--line));
}
.sh-ic .ic { width: 26px; height: 26px; }
.subject-head h1 { font-size: 26px; }
.sh-meta { color: var(--muted); font-size: 14px; margin-top: 3px; }
.matter-link { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 12px; font-size: 14px; color: var(--muted); text-decoration: none; }
.matter-link .ic { width: 17px; height: 17px; }
.matter-link b { color: var(--pen); font-weight: 700; }
.matter-link:hover b { text-decoration: underline; }
.hint { margin: 16px 2px 0; font-size: 14px; color: var(--muted); display: flex; gap: 8px; align-items: flex-start; }
.hint .ic { color: var(--red); width: 18px; height: 18px; margin-top: 1px; vertical-align: 0; }

/* unidade marcada como «a dar nas aulas»: um marcador de livro a vermelho */
.pinned { position: relative; padding-right: 48px; border-color: color-mix(in srgb, var(--red) 40%, var(--line)); }
.pinned::before { content: ""; position: absolute; top: -1px; right: 18px; width: 18px; height: 30px; background: var(--red); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 72%, 0 100%); }
.pin-label { font-size: 12.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--red-ink); }
.pinned h3 { font-family: var(--serif); font-size: 19px; margin-top: 4px; }
.pinbtn .ic { color: var(--red); }
.pinbtn.on { border-color: var(--red); }

.toc-head { display: flex; justify-content: space-between; align-items: flex-end; margin: 28px 0 2px; padding: 0 2px 0 4px; }
.toc-head .t {
  font-family: var(--serif); font-weight: 700; font-size: 21px; padding-bottom: 12px;
  background: linear-gradient(var(--red), var(--red)) 0 calc(100% - 6px) / 100% 3px no-repeat, linear-gradient(var(--red), var(--red)) 0 100% / 60% 3px no-repeat;
}
.toc-head .r { font-size: 12.5px; color: var(--muted); font-weight: 700; letter-spacing: .07em; text-transform: uppercase; padding-bottom: 4px; }
.path { list-style: none; margin: 0; padding: 0; }
.node-wrap { border-bottom: 1px solid var(--line); }
.node { display: flex; align-items: baseline; gap: 12px; padding: 15px 6px 15px 4px; text-decoration: none; color: inherit; }
.node .num { flex: none; width: 28px; text-align: right; font-family: var(--serif); font-weight: 600; font-size: 20px; color: var(--cc, var(--ink)); font-variant-numeric: lining-nums tabular-nums; }
.node.fresh .num { color: var(--muted); }
.node .body { flex: 0 1 auto; min-width: 0; }
.node-label { display: block; font-weight: 700; font-size: 16.5px; line-height: 1.35; }
.node:hover .node-label { color: var(--pen); }
.node-meta { display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: 13.5px; color: var(--muted); margin-top: 3px; }
.node-meta:empty { display: none; }
.node .lead { flex: 1 1 20px; min-width: 20px; border-bottom: 2px dotted var(--line-2); transform: translateY(-5px); }
.node-wrap.is-here { background: color-mix(in srgb, var(--pen) 5%, transparent); box-shadow: inset 3px 0 0 var(--red); }
.here { display: inline-flex; align-items: center; gap: 3px; color: var(--red-ink); font-weight: 700; font-size: 12.5px; letter-spacing: .07em; text-transform: uppercase; }
.here .ic { width: 15px; height: 15px; vertical-align: 0; }
.due { display: inline-flex; align-items: center; gap: 4px; color: var(--pen); font-weight: 700; }
.due .ic { width: 15px; height: 15px; vertical-align: 0; }
/* nível 0–5 em marcas de contagem: 4 traços e o 5.º a cortar (a vermelho) */
.tally { flex: none; width: 36px; height: 18px; overflow: visible; }
.tally line { stroke: var(--line-2); stroke-width: 2.2; stroke-linecap: round; }
.tally line.on { stroke: var(--ink-2); }
.tally line.x { stroke: var(--red); stroke-width: 2.6; }

/* ---------- folha inferior (sheet) ---------- */
.backdrop { position: fixed; inset: 0; background: rgba(10, 14, 30, .5); z-index: 50; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.sheet {
  background: var(--card); width: 100%; max-width: 560px; border-radius: 20px 20px 0 0;
  padding: 22px 18px calc(20px + env(safe-area-inset-bottom)); max-height: 90vh; overflow: auto; animation: up .22s cubic-bezier(.2, .8, .2, 1);
}
.sheet::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 4px; background: var(--line-2); margin: -10px auto 14px; }
@media (min-width: 600px) { .backdrop { align-items: center; padding: 20px; } .sheet { border-radius: 20px; } .sheet::before { display: none; } }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.sheet-head { display: flex; gap: 10px; align-items: flex-start; }
.sheet-head h2 { margin-top: 4px; }
.level-row { display: flex; justify-content: space-between; align-items: center; margin: 4px 0 12px; font-size: 14px; color: var(--muted); font-weight: 700; }
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mode {
  display: flex; gap: 10px; align-items: center; padding: 11px 12px; text-decoration: none; color: inherit; text-align: left;
  border: 1px solid var(--line); border-radius: 12px; background: var(--card); cursor: pointer; transition: border-color .15s, transform .08s;
}
.mode:hover { border-color: var(--ink-2); }
.mode:active { transform: translateY(1px); }
.mode .mi { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--soft); color: var(--ink-2); flex: none; }
.mode b { display: block; font-weight: 700; }
.mode small { color: var(--muted); font-size: 13px; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.kpi { background: var(--soft); border-radius: 12px; padding: 10px 6px; text-align: center; }
.kpi b { display: block; font-family: var(--serif); font-size: 22px; font-weight: 700; line-height: 1.2; font-variant-numeric: lining-nums tabular-nums; }
.kpi small { color: var(--muted); font-weight: 400; font-size: 12.5px; }

/* ---------- listas ---------- */
.list { display: flex; flex-direction: column; gap: 8px; }
.item {
  display: flex; gap: 12px; align-items: center; padding: 12px 14px; background: var(--card); width: 100%; text-align: left; font: inherit;
  border: 1px solid var(--line); border-radius: var(--r); cursor: pointer; text-decoration: none; color: inherit; transition: border-color .15s;
}
a.item:hover, button.item:hover { border-color: var(--line-2); }
.item .em { width: 40px; height: 40px; display: grid; place-items: center; background: var(--soft); color: var(--ink-2); border-radius: 11px; flex: none; }
.item .em.c { background: color-mix(in srgb, var(--c) 12%, var(--card)); color: var(--cc); }
.item h3 { font-size: 16px; }
.item .meta { font-size: 13.5px; color: var(--muted); }
.item .chev { color: var(--line-2); }
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 700; border-radius: 99px; padding: 2px 9px; background: var(--soft); color: var(--muted); white-space: nowrap; vertical-align: 1px; }
.pill .ic { width: 14px; height: 14px; vertical-align: 0; }
.pill.red { background: var(--red-soft); color: var(--red-ink); }
.pill.green { background: var(--ok-bg); color: var(--ok); }
.pill.blue { background: var(--pen-soft); color: var(--pen); }
.tabs { display: flex; background: var(--soft); border-radius: 12px; padding: 4px; gap: 4px; margin-top: 16px; }
.tabs button, .tabs a { text-align: center; text-decoration: none; flex: 1; border: 0; background: none; padding: 9px; border-radius: 9px; font-weight: 700; cursor: pointer; color: var(--muted); }
.tabs button.on, .tabs a.on { background: var(--card); color: var(--ink); box-shadow: 0 0 0 1px var(--line), 0 1px 3px rgba(18, 26, 51, .08); }
.empty { text-align: center; padding: 30px 12px; color: var(--muted); }
.empty .em { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; margin: 0 auto 12px; background: var(--soft); color: var(--ink-2); }
.empty .em .ic { width: 28px; height: 28px; }
.empty h2 { color: var(--ink); margin-bottom: 6px; }

/* lista de cartões de um baralho (como um glossário) */
.terms { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r); background: var(--card); overflow: hidden; }
.term { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 12px 14px; border-top: 1px solid var(--line); font-size: 15px; }
.term:first-child { border-top: 0; }
.term > div:first-child { font-weight: 700; }
.term > div:last-child { color: var(--ink-2); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); margin-right: 6px; vertical-align: 1px; }
.dot.s1 { background: var(--bad); } .dot.s2 { background: var(--warn); } .dot.s3 { background: var(--ok); }
@media (max-width: 480px) { .term { grid-template-columns: 1fr; gap: 4px; } }

/* ---------- editor ---------- */
.ed-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.ed-card .hd { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-family: var(--serif); font-weight: 700; font-size: 15px; margin-bottom: 8px; }
.ed-card .hd .icon-btn .ic { width: 19px; height: 19px; }
.ed-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 480px) { .ed-grid { grid-template-columns: 1fr; } }
.ed-card textarea { min-height: 46px; }
details summary { cursor: pointer; color: var(--pen); font-weight: 700; font-size: 13.5px; margin-top: 8px; }
.savebar { position: sticky; bottom: calc(70px + env(safe-area-inset-bottom)); padding: 12px 0; background: linear-gradient(transparent, var(--paper) 35%); }
@media (min-width: 900px) { .savebar { bottom: 0; } }

/* ---------- perfil ---------- */
.avatar { width: 64px; height: 64px; border-radius: 50%; background: var(--btn-ink); color: var(--on-ink); font-family: var(--serif); font-size: 28px; font-weight: 700; display: grid; place-items: center; flex: none; }
.statgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.statbox { border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; gap: 12px; align-items: center; background: var(--card); }
.statbox .em { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--soft); color: var(--ink-2); flex: none; }
.statbox .em .ic { width: 19px; height: 19px; }
.statbox b { display: block; font-family: var(--serif); font-size: 21px; font-weight: 700; line-height: 1.15; font-variant-numeric: lining-nums; }
.statbox small { color: var(--muted); font-weight: 400; font-size: 12.5px; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; align-items: end; height: 130px; padding-top: 10px; }
.week .col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.week .b { width: 100%; max-width: 28px; background: var(--pen); border-radius: 5px 5px 2px 2px; min-height: 3px; }
.week .b.zero { background: var(--line); }
.week .col span { font-size: 11.5px; color: var(--muted); font-weight: 700; }
.week .col em { font-style: normal; font-size: 11.5px; font-weight: 700; }
.lb { display: flex; flex-direction: column; }
.lb .r { display: flex; align-items: center; gap: 12px; padding: 10px 6px; border-bottom: 1px solid var(--line); }
.lb .r:last-child { border-bottom: 0; }
.lb .r.me { background: var(--pen-soft); border-radius: 10px; }
.lb .pos { width: 26px; text-align: center; font-family: var(--serif); font-weight: 700; color: var(--muted); }
.lb .pos.p1 { color: var(--red-ink); }
.lb .ini { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--soft); font-family: var(--serif); font-weight: 700; }
.pts { font-weight: 700; color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- entrada (é também a primeira página de sumario.pt) ---------- */
.auth { max-width: 1060px; margin: 0 auto; padding: 28px 16px 48px; display: grid; gap: 26px; grid-template-areas: "brand" "box" "feat"; }
.auth.solo { max-width: 460px; grid-template-areas: "box"; }
.auth-brand { grid-area: brand; }
.auth-brand .wm { height: 40px; }
.pitch { font-family: var(--serif); font-weight: 700; font-size: 33px; line-height: 1.14; margin: 22px 0 10px; letter-spacing: -.01em; text-wrap: balance; }
.pitch em { font-style: normal; background: linear-gradient(var(--red), var(--red)) 0 93% / 100% 4px no-repeat; }
.auth-brand p { color: var(--muted); font-size: 17px; margin: 0; max-width: 46ch; }
.auth-box { grid-area: box; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 20px; box-shadow: var(--shadow); }
.auth-box .tabs { margin-top: 0; }
.auth-box > .icon-btn { margin: -8px 0 6px -8px; }
.auth-box .hero { text-align: center; margin: 4px 0 18px; }
.auth-box .hero p { color: var(--muted); margin: 10px 0 0; }
.feat { grid-area: feat; list-style: none; padding: 0; margin: 0; display: grid; gap: 16px; }
.feat li { display: flex; gap: 12px; align-items: flex-start; }
.feat .fi { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: var(--card); border: 1px solid var(--line); color: var(--ink-2); flex: none; }
.feat b { display: block; }
.feat span { color: var(--muted); font-size: 15px; }
@media (min-width: 900px) {
  .auth { grid-template-columns: 1.15fr .85fr; grid-template-rows: auto 1fr; grid-template-areas: "brand box" "feat box"; column-gap: 64px; row-gap: 34px; padding-top: 72px; align-items: start; }
  .auth.solo { grid-template-columns: 1fr; grid-template-rows: none; grid-template-areas: "box"; padding-top: 48px; }
  .pitch { font-size: 48px; margin-top: 34px; }
}
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-weight: 700; font-size: 13px; margin: 20px 0 14px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.prose { max-width: 680px; margin: 0 auto; padding: 20px 16px 60px; }
.prose h1 { margin-top: 10px; }
.prose h2 { margin-top: 26px; font-size: 20px; }
.prose p, .prose li { color: var(--ink-2); }

/* ---------- sessões de estudo ---------- */
.study { position: fixed; inset: 0; background: var(--paper); z-index: 40; display: flex; flex-direction: column; }
.study-top { max-width: 720px; width: 100%; margin: 0 auto; display: flex; align-items: center; gap: 12px; padding: 12px 16px 6px; }
.study-top .bar { flex: 1; height: 6px; }
.combo { color: var(--muted); font-size: 13px; font-weight: 700; min-width: 0; white-space: nowrap; font-variant-numeric: tabular-nums; }
.study-body { flex: 1; overflow: auto; }
.study-body .in { max-width: 680px; margin: 0 auto; padding: 18px 16px 24px; }
.ex-kind { font-weight: 700; font-size: 12.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.ex-kind.new { color: var(--red-ink); }
.prompt { text-wrap: pretty; font-family: var(--serif); font-size: 24px; font-weight: 600; line-height: 1.3; margin-bottom: 22px; overflow-wrap: anywhere; }
.opts { display: flex; flex-direction: column; gap: 10px; }
.opt {
  border: 1.5px solid var(--line-2); background: var(--card); border-radius: 12px; padding: 12px 14px; text-align: left; cursor: pointer;
  font-size: 17px; display: flex; gap: 12px; align-items: center; overflow-wrap: anywhere; transition: border-color .12s, background .12s;
}
.opt:hover:not(:disabled) { border-color: var(--ink-2); }
.opt .k { flex: none; width: 28px; height: 28px; border: 1.5px solid var(--line-2); border-radius: 8px; display: grid; place-items: center; font-family: var(--serif); font-size: 14px; color: var(--muted); font-weight: 700; }
.opt.sel { border-color: var(--pen); background: var(--pen-soft); }
.opt.sel .k { border-color: var(--pen); background: var(--pen); color: var(--on-pen); }
.opt.right { border-color: var(--ok); background: var(--ok-bg); }
.opt.right .k { border-color: var(--ok); background: var(--ok); color: var(--card); }
.opt.wrong { border-color: var(--bad); background: var(--bad-bg); }
.opt.wrong .k { border-color: var(--bad); background: var(--bad); color: var(--card); }
.opt.wrong > span:last-child { text-decoration: line-through; text-decoration-color: var(--bad); text-decoration-thickness: 2px; }
.opt:disabled { cursor: default; color: inherit; }
.tf { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tf .opt { justify-content: center; font-weight: 700; }
.tf .opt .ic { width: 19px; height: 19px; }
.claim { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin-bottom: 18px; }
.claim .q { font-family: var(--serif); font-weight: 600; font-size: 20px; line-height: 1.3; }
.claim .a { margin-top: 12px; padding-top: 12px; border-top: 1.5px dashed var(--line-2); font-size: 20px; font-weight: 700; color: var(--pen); }
.typein { font-size: 19px; }
.study-foot { border-top: 1px solid var(--line); background: var(--card); padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); }
.study-foot .in { max-width: 680px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.study-foot.ok { box-shadow: inset 0 3px 0 var(--ok); }
.study-foot.bad { box-shadow: inset 0 3px 0 var(--bad); }
.study-foot.skip { box-shadow: inset 0 3px 0 var(--line-2); }
.fb-title { font-family: var(--serif); font-size: 21px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.fb-title .ic { width: 24px; height: 24px; }
.study-foot.ok .fb-title { color: var(--ok); }
.study-foot.bad .fb-title { color: var(--bad); }
.study-foot.skip .fb-title { color: var(--ink); }
.fb-text .e { color: var(--muted); font-size: 14.5px; margin-top: 4px; }

/* resumo da matéria nova no início da lição: o «Sumário» do caderno */
.sumario { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 18px 18px 6px; }
.sum-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.sum-head .t {
  font-family: var(--serif); font-weight: 700; font-size: 26px; line-height: 1.1; padding-bottom: 12px;
  background: linear-gradient(var(--red), var(--red)) 0 calc(100% - 6px) / 100% 3px no-repeat, linear-gradient(var(--red), var(--red)) 0 100% / 60% 3px no-repeat;
}
.sum-head .d { color: var(--muted); font-size: 14px; padding-bottom: 4px; }
.sumario > p { margin: 16px 0 4px; }
.summary { display: flex; flex-direction: column; counter-reset: sm; }
.sum-item { position: relative; padding: 14px 0 14px 32px; border-top: 1px solid var(--line); counter-increment: sm; }
.sum-item:first-child { border-top: 0; }
.sum-item::before { content: counter(sm) "."; position: absolute; left: 2px; top: 13px; font-family: var(--serif); font-weight: 700; color: var(--red-ink); }
.sum-item .q { color: var(--muted); font-size: 15px; }
.sum-item .a { font-weight: 700; font-size: 18px; margin-top: 2px; }
.sum-item .e { margin-top: 6px; font-size: 14.5px; color: var(--ink-2); }

/* associar */
.match { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.match .opt, .game .opt { font-size: 14.5px; justify-content: center; text-align: center; min-height: 64px; padding: 10px; }
.opt.gone { visibility: hidden; }
.opt.shake { animation: shake .3s; border-color: var(--bad); }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.game { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (min-width: 560px) { .game { grid-template-columns: repeat(4, 1fr); } }
.game .opt { min-height: 96px; }
.timer { font-family: var(--serif); font-variant-numeric: tabular-nums lining-nums; font-weight: 700; font-size: 20px; }

/* fichas pautadas: cartões e revisão */
.flip { perspective: 1200px; cursor: pointer; user-select: none; }
.flip .inner { position: relative; min-height: 300px; transition: transform .5s cubic-bezier(.3, .7, .2, 1); transform-style: preserve-3d; }
.flip.on .inner { transform: rotateY(180deg); }
.ficha {
  border: 1px solid var(--line-2); border-radius: 8px; box-shadow: var(--shadow);
  background: linear-gradient(var(--red), var(--red)) 0 46px / 100% 2px no-repeat,
    repeating-linear-gradient(var(--card) 0 29px, var(--rule) 29px 30px) 0 48px / 100% calc(100% - 48px) no-repeat, var(--card);
}
.flip .face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  padding: 64px 26px 40px; font-family: var(--serif); font-size: 23px; font-weight: 600; line-height: 1.3; overflow: auto;
}
.flip .face.back { transform: rotateY(180deg); color: var(--pen); }
.flip .face .e { margin-top: 14px; font-family: var(--sans); font-size: 15px; color: var(--muted); font-weight: 400; }
.flip .hint { position: absolute; bottom: 12px; left: 0; right: 0; display: block; margin: 0; font-family: var(--sans); font-size: 12.5px; color: var(--muted); font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.rv-card { position: relative; padding: 64px 22px 24px; min-height: 260px; }
.rv-card .from { position: absolute; top: 15px; left: 22px; right: 22px; white-space: nowrap; overflow: hidden; }
.rv-card .q { font-family: var(--serif); font-size: 22px; font-weight: 600; line-height: 1.3; }
.rv-card .a { font-family: var(--serif); font-size: 22px; font-weight: 700; color: var(--pen); margin-top: 18px; padding-top: 16px; border-top: 1.5px dashed var(--line-2); }
.rv-card .e { margin-top: 10px; color: var(--muted); font-size: 15px; }
.grades { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.grades .btn { flex-direction: column; gap: 0; min-height: 60px; padding: 8px 4px; font-size: 14.5px; background: var(--card); color: var(--ink); border: 1.5px solid var(--line-2); border-top-width: 4px; }
.grades .btn:hover:not(:disabled) { background: var(--soft); }
.grades .btn small { font-size: 12px; color: var(--muted); font-weight: 400; }
.btn.g1 { border-top-color: var(--bad); }
.btn.g2 { border-top-color: var(--warn); }
.btn.g3 { border-top-color: var(--ok); }
.btn.g4 { border-top-color: var(--pen); }

/* fim de sessão */
.done { text-align: center; padding-top: 26px; }
.done .big { width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto; background: var(--pen-soft); color: var(--pen); animation: pop .45s cubic-bezier(.2, 1.4, .5, 1); }
.done .big .ic { width: 40px; height: 40px; }
.done .big.ok { background: var(--ok-bg); color: var(--ok); }
.done .big.red { background: var(--red-soft); color: var(--red-ink); }
@keyframes pop { from { transform: scale(.4); opacity: 0; } }
.done h1 { margin: 16px 0 4px; font-size: 30px; }
.done .muted { margin: 0; }
.streak-note { display: inline-flex; gap: 6px; align-items: center; color: var(--red-ink); font-weight: 700; margin-top: 12px; }
.done .kpis { margin: 24px 0; }
.done .kpi { border: 1px solid var(--line); background: var(--card); }
.review-wrong { text-align: left; margin-top: 20px; }
.review-wrong h3 { font-family: var(--serif); font-size: 19px; }

/* rever: o número do dia */
.review-hero { text-align: center; padding: 26px 18px 20px; }
.big-num { font-family: var(--serif); font-weight: 700; font-size: 64px; line-height: 1; font-variant-numeric: lining-nums; }
.review-hero h2 { font-size: 20px; margin: 8px 0 2px; }
.review-hero p { margin: 0 0 16px; }

#toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px);
  background: var(--btn-ink); color: var(--on-ink); padding: 10px 16px; border-radius: 12px; font-weight: 700; font-size: 14px;
  opacity: 0; pointer-events: none; transition: .2s; z-index: 100; max-width: calc(100% - 32px); text-align: center;
}
#toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
.spinner { width: 32px; height: 32px; border: 3px solid var(--line); border-top-color: var(--pen); border-radius: 50%; animation: spin .8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- admin ---------- */
.admin-kpis { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 700px) { .admin-kpis { grid-template-columns: repeat(3, 1fr); } }
.grid2 { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 700px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.dbars-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.dbars-head b { font-family: var(--serif); font-size: 20px; font-weight: 700; }
.dbars { display: grid; grid-template-columns: repeat(30, 1fr); gap: 2px; height: 110px; align-items: end; border-bottom: 1px solid var(--line); }
.dcol { height: 100%; display: flex; align-items: flex-end; cursor: default; outline: none; }
.dcol i { display: block; width: 100%; background: var(--pen); border-radius: 3px 3px 0 0; }
.dcol:hover i, .dcol:focus i { filter: brightness(1.2); }
.dcol:hover, .dcol:focus { background: var(--soft); border-radius: 3px; }
.dbars-axis { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); font-weight: 700; margin-top: 4px; }
#ctip { position: absolute; z-index: 200; display: none; background: var(--btn-ink); color: var(--on-ink); font-size: 12px; font-weight: 700; padding: 5px 9px; border-radius: 8px; pointer-events: none; white-space: nowrap; }
.ini-lg { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--soft); font-family: var(--serif); font-weight: 700; font-size: 18px; flex: none; }
.right-stats { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-weight: 700; font-size: 14px; white-space: nowrap; }
.right-stats .ic { width: 15px; height: 15px; vertical-align: -2px; }
.sess .srow { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.sess .srow:last-child { border-bottom: 0; }
.sess .srow .grow { min-width: 140px; }

/* ---------- encarregado de educação ---------- */
.parent { max-width: 760px; margin: 0 auto; padding: 18px 16px 48px; }
.parent .logo { margin-right: auto; }
.subhead { margin: 22px 0 8px; font-size: 17px; display: flex; align-items: center; gap: 8px; color: var(--cc); }
.subhead .ic { width: 19px; height: 19px; }

/* ---------- o meu estudo ---------- */
.block-link { display: block; margin: 10px auto 0; font-size: 14px; color: var(--muted); }
.subj-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 560px) { .subj-grid { grid-template-columns: 1fr 1fr; } }
.subj { border: 1px solid var(--line); border-radius: var(--r); background: var(--card); overflow: hidden; transition: border-color .15s; }
.subj.on { border-color: color-mix(in srgb, var(--c) 50%, var(--line)); box-shadow: inset 4px 0 0 var(--c); }
.subj-main { width: 100%; display: flex; align-items: center; gap: 12px; padding: 14px; background: none; border: 0; cursor: pointer; text-align: left; }
.subj-main .em { width: 40px; height: 40px; display: grid; place-items: center; background: var(--soft); color: var(--muted); border-radius: 11px; flex: none; }
.subj.on .subj-main .em { background: color-mix(in srgb, var(--c) 12%, var(--card)); color: var(--cc); }
.subj-main b { display: block; font-weight: 700; }
.subj-main small { color: var(--muted); font-size: 13px; }
.subj .tick, .check-box { width: 26px; height: 26px; border-radius: 8px; border: 1.5px solid var(--line-2); display: grid; place-items: center; color: var(--on-ink); flex: none; }
.subj .tick .ic, .check-box .ic { width: 17px; height: 17px; }
.subj.on .tick, .unit-row.on .check-box { background: var(--btn-ink); border-color: var(--btn-ink); }
.subj-matter { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-top: 1px solid var(--line); font-weight: 700; font-size: 14px; color: var(--pen); text-decoration: none; }
.subj-matter .ic { width: 17px; height: 17px; }
.unit-row { text-align: left; width: 100%; font: inherit; }
.unit-row:not(.on) h3 { color: var(--muted); }

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