/* QSim Concursos — folha de estilos do app (antes inline em base.html).
   Camada 1: base Bootstrap customizada (sidebar, topbar, cards, botões, questão,
   toasts, player de podcast). Camada 2 (no fim): design system premium — tokens e
   componentes que trazem a linguagem da landing para dentro do app.
   Estilos de uma página só continuam no {% block extra_css %} dela. */
:root {
  --primary: #00CDA0;
  --primary-dark: #00876a;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --sidebar-width: 260px;
  --sidebar-rail: 72px;
  --content-pad: 1.5rem;
}
* { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body { font-family: 'Inter', sans-serif; background: #f6f7fb; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  position: fixed;
  left: 0; top: 0;
  background: linear-gradient(180deg, #052e26 0%, #065f46 100%);
  box-shadow: 1px 0 0 rgba(255,255,255,.04) inset, 4px 0 24px rgba(15,12,60,.08);
  overflow-y: auto; overflow-x: hidden;
  display: flex; flex-direction: column;
  z-index: 1000;
  transition: width .25s ease, transform .3s ease;
}
.sidebar .brand { padding: 1.5rem 1.25rem; border-bottom: 1px solid rgba(255,255,255,.08); display: flex; flex-direction: column; gap: .15rem; }
.sidebar .brand h4 { color: #fff; font-weight: 700; margin: 0; font-size: 1.15rem; display: flex; align-items: center; letter-spacing: -.01em; }
.sidebar .brand h4 i { background: linear-gradient(135deg, #34d399, #a7f3d0); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sidebar .brand-sub { color: #6ee7b7; font-size: .75rem; }
.sidebar .nav-link {
  color: #a7f3d0; padding: .6rem 1.1rem; border-radius: .6rem;
  margin: .15rem .75rem; display: flex; align-items: center; gap: .75rem;
  font-size: .875rem; font-weight: 500; transition: background .2s ease, color .2s ease, transform .15s ease;
  position: relative; white-space: nowrap; overflow: hidden;
}
.sidebar .nav-link:hover { background: rgba(255,255,255,.08); color: #fff; transform: translateX(2px); }
.sidebar .nav-link.active {
  background: linear-gradient(135deg, rgba(0,205,160,.45), rgba(52,211,153,.18));
  color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}
.sidebar .nav-link.active::before {
  content: ''; position: absolute; left: -.75rem; top: 20%; bottom: 20%;
  width: 3px; border-radius: 0 4px 4px 0; background: linear-gradient(180deg, #6ee7b7, var(--success));
}
.sidebar .nav-link i { font-size: 1.05rem; width: 1.25rem; text-align: center; flex-shrink: 0; }
.sidebar .nav-link .link-label {
  display: inline-block; opacity: 1; max-width: 200px;
  transition: opacity .2s ease, max-width .25s ease;
}
.sidebar .section-title {
  color: #34d399; font-size: .7rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .12em;
  padding: 1.1rem 1.25rem .35rem; margin: 0; white-space: nowrap; overflow: hidden;
  transition: opacity .2s ease, max-height .2s ease, padding .2s ease;
}
.sidebar-footer { padding: 1rem 1.25rem; border-top: 1px solid rgba(255,255,255,.08); margin-top: auto; }
.sidebar-footer .user-meta,
.sidebar-footer .powered-by {
  overflow: hidden; white-space: nowrap;
  transition: opacity .2s ease, max-width .25s ease;
  opacity: 1; max-width: 200px;
}
.sidebar-footer .powered-by {
  margin-top: .85rem; padding-top: .75rem; text-align: center;
  border-top: 1px solid rgba(255,255,255,.06);
  font-size: .7rem; color: #34d399;
}
.sidebar-footer .powered-by a { color: #6ee7b7; text-decoration: none; font-weight: 600; transition: color .2s ease; }
.sidebar-footer .powered-by a:hover { color: #fff; }

/* Sidebar overlay backdrop (mobile expanded state) */
.sidebar-backdrop {
  display: none; position: fixed; inset: 0; z-index: 999;
  background: rgba(15,15,35,.45); backdrop-filter: blur(2px);
  opacity: 0; transition: opacity .25s ease;
}
.sidebar-backdrop.show { display: block; opacity: 1; }

/* Content */
.main-content { margin-left: var(--sidebar-width); min-height: 100vh; transition: margin-left .25s ease; }
.topbar {
  background: rgba(255,255,255,.78);
  backdrop-filter: saturate(180%) blur(14px); -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid rgba(226,232,240,.8);
  padding: .875rem 1.5rem; display: flex; align-items: center;
  justify-content: space-between; position: sticky; top: 0; z-index: 100;
}
.content-area { padding: var(--content-pad); animation: qsimFadeIn .35s ease; }
@keyframes qsimFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Cards */
.stat-card {
  background: #fff; border-radius: .9rem; padding: 1.25rem;
  border: 1px solid #eef0f5;
  box-shadow: 0 1px 2px rgba(15,23,42,.04), 0 1px 1px rgba(15,23,42,.02);
  transition: box-shadow .25s ease, transform .25s ease, border-color .25s ease;
}
.stat-card:hover { box-shadow: 0 16px 40px -12px rgba(15,23,42,.16); transform: translateY(-3px); border-color: #e0e4ee; }
.stat-card .stat-icon {
  width: 48px; height: 48px; border-radius: .625rem;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem;
}
.stat-card .stat-value { font-size: 1.75rem; font-weight: 700; line-height: 1; }
.stat-card .stat-label { font-size: .8rem; color: #64748b; margin-top: .25rem; }

/* Progress bars */
.progress { border-radius: 100px; background: #eef1f6; }
.progress-bar { border-radius: 100px; }

/* Alerts */
.alert { border: none; border-radius: .75rem; box-shadow: 0 4px 16px rgba(15,23,42,.05); }

/* Buttons */
.btn { border-radius: .6rem; font-weight: 600; transition: all .2s ease; }
.btn-primary {
  background: linear-gradient(135deg, var(--primary), #10b981);
  border-color: var(--primary);
  box-shadow: 0 4px 14px rgba(0,205,160,.28);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  border-color: var(--primary-dark);
  box-shadow: 0 6px 20px rgba(0,205,160,.38);
  transform: translateY(-1px);
}
.btn-outline-primary { color: var(--primary); border-color: var(--primary); }
.btn-outline-primary:hover {
  background: var(--primary); border-color: var(--primary);
  box-shadow: 0 4px 14px rgba(0,205,160,.25); transform: translateY(-1px);
}
.btn:active { transform: translateY(0) !important; }

/* Tables */
.table th { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: #64748b; font-weight: 600; border-bottom: 2px solid #e2e8f0; }
.table td { vertical-align: middle; }
.table tbody tr { transition: background .15s ease; }
.table-hover tbody tr:hover { background: #f8fafc; }

/* Badges */
.badge-taxa { font-size: .75rem; padding: .25rem .6rem; border-radius: 100px; font-weight: 600; }
.taxa-alta { background: #d1fae5; color: #065f46; }
.taxa-media { background: #fef3c7; color: #92400e; }
.taxa-baixa { background: #fee2e2; color: #991b1b; }
/* Selos de banca/órgão/matéria: mostram a sigla (filtros sigla_banca/sigla_orgao);
   se só houver o nome, truncam em vez de estourar o card. Nome completo no title. */
.badge-inst { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
@media (max-width: 575.98px) { .badge-inst { max-width: 11rem; } }
/* Texto de questão (enunciado/comentário) nunca alarga o card no celular */
.texto-questao { min-width: 0; overflow-wrap: anywhere; word-break: break-word; }
.texto-questao img, .texto-questao table, .texto-questao pre { max-width: 100%; }
.texto-questao table { display: block; overflow-x: auto; }

/* ── Scrollbars modernos e slim ─────────────────────────────── */
* { scrollbar-width: thin; scrollbar-color: #a7f3d0 transparent; }
*::-webkit-scrollbar { width: 5px; height: 5px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: #a7f3d0;
  border-radius: 100px;
}
*::-webkit-scrollbar-thumb:hover { background: #34d399; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); }
.sidebar::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.35); }
.sidebar { scrollbar-color: rgba(255,255,255,.2) transparent; }

/* Botão de recolher (só desktop): a sidebar vira uma faixa só de ícones.
   É irmão de .sidebar (não filho) e usa position:fixed — .sidebar tem
   overflow-x:hidden (necessário pro scroll do menu), então um filho
   posicionado pra fora da borda direita dela ficava cortado. */
.sidebar-collapse-btn {
  display: none; position: fixed; top: 1.6rem; left: calc(var(--sidebar-width) - 13px);
  width: 26px; height: 26px; border-radius: 50%;
  background: #00a683; border: 2px solid #052e26; color: #fff;
  align-items: center; justify-content: center; font-size: .65rem;
  cursor: pointer; z-index: 1001; transition: background .2s ease, transform .2s ease, left .25s ease;
}
.sidebar-collapse-btn:hover { background: var(--primary); }
.sidebar-collapse-btn i { transition: transform .2s ease; }
.sidebar .nav-link .badge { flex-shrink: 0; }

/* ── Desktop (>= 768px): faixa de ícones quando recolhida ─────────────
   Tudo centralizado numa coluna única de 72px: sem gap (o gap sobrava ao
   lado do ícone e o empurrava pra esquerda), sem translateX no hover,
   rótulos/selos fora do fluxo e rodapé sem o padding lateral que
   estreitava o avatar. */
@media (min-width: 768px) {
  .sidebar-collapse-btn { display: flex; }

  body.sidebar-collapsed .sidebar-collapse-btn { left: calc(var(--sidebar-rail) - 13px); }
  body.sidebar-collapsed .sidebar { width: var(--sidebar-rail); }
  body.sidebar-collapsed .sidebar .brand { align-items: center; padding: 1.25rem 0; }
  body.sidebar-collapsed .sidebar .brand h4 { justify-content: center; font-size: 1.35rem; }
  body.sidebar-collapsed .sidebar .brand h4 i { margin: 0 !important; }
  body.sidebar-collapsed .sidebar .brand-text,
  body.sidebar-collapsed .sidebar .brand-sub,
  body.sidebar-collapsed .sidebar .nav-link .link-label,
  body.sidebar-collapsed .sidebar .nav-link .badge-plano,
  body.sidebar-collapsed .sidebar-footer .user-meta,
  body.sidebar-collapsed .sidebar-footer .powered-by { display: none !important; }
  body.sidebar-collapsed .sidebar .nav-link {
    justify-content: center; gap: 0; width: 44px; height: 44px; padding: 0;
    margin: .2rem auto; transform: none;
  }
  body.sidebar-collapsed .sidebar .nav-link i { width: auto; font-size: 1.2rem; }
  body.sidebar-collapsed .sidebar .nav-link.active::before { left: -14px; }
  /* contador do suporte vira um pontinho sobre o ícone */
  body.sidebar-collapsed .sidebar .nav-link .badge {
    position: absolute; top: 3px; right: 3px; margin: 0 !important;
    font-size: .55rem; padding: .15rem .3rem;
  }
  /* título de seção vira um divisor fino */
  body.sidebar-collapsed .sidebar .section-title {
    font-size: 0; line-height: 0; height: 1px; padding: 0; margin: .6rem 1rem !important;
    background: rgba(255,255,255,.12);
  }
  body.sidebar-collapsed .sidebar-footer { padding: .75rem 0; display: flex; flex-direction: column; align-items: center; gap: .25rem; }
  body.sidebar-collapsed .sidebar-footer > .d-flex { margin: 0 !important; justify-content: center; }
  body.sidebar-collapsed .sidebar-footer a.nav-link { margin: 0 auto; }
  body.sidebar-collapsed .main-content { margin-left: var(--sidebar-rail); }
  body.sidebar-collapsed .sidebar-collapse-btn i { transform: rotate(180deg); }
}

/* ── Celular (< 768px): menu em gaveta ────────────────────────────────
   Sem faixa fixa de ícones (roubava 72px de uma tela de ~360px): o menu
   fica fora da tela e abre sobre o conteúdo pelo botão do topo. */
@media (max-width: 767.98px) {
  .sidebar { transform: translateX(-100%); width: min(var(--sidebar-width), 82vw); box-shadow: none; }
  .sidebar.expanded { transform: translateX(0); box-shadow: 12px 0 48px rgba(15,12,60,.35); }
  .main-content { margin-left: 0; }
  .sidebar .nav-link { padding: .75rem 1rem; }
  .sidebar .nav-link:hover { transform: none; }

  .topbar { padding: .65rem 1rem; gap: .5rem; }
  .topbar h6 { font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
  .topbar .topbar-user { display: none; }
  :root { --content-pad: 1rem; }
  .content-area h1, .content-area .h3 { font-size: 1.4rem; }
  /* barras de ação (título + botões) quebram em vez de estourar a largura */
  .content-area .d-flex.justify-content-between.align-items-center { flex-wrap: wrap; gap: .75rem; }
  .stat-card { padding: 1rem; }
  .stat-card:hover { transform: none; }
  .btn { min-height: 40px; }
  .btn-sm { min-height: 34px; }
  .modal-dialog { margin: .75rem; }
  .table-responsive { -webkit-overflow-scrolling: touch; }
}
@media (max-width: 400px) {
  :root { --content-pad: .75rem; }
}
.main-content { min-width: 0; }

/* Questao */
.opcao-btn {
  width: 100%; text-align: left; padding: .875rem 1rem;
  border: 2px solid #e2e8f0; border-radius: .625rem; background: #fff;
  margin-bottom: .5rem; cursor: pointer; transition: all .2s;
  display: flex; align-items: flex-start; gap: .75rem;
}
.opcao-btn:hover { border-color: var(--primary); background: #d1fae5; }
.opcao-btn.selecionada { border-color: var(--primary); background: #d1fae5; }
.opcao-btn.correta { border-color: var(--success); background: #d1fae5; }
.opcao-btn.incorreta { border-color: var(--danger); background: #fee2e2; }
.opcao-letra {
  width: 28px; height: 28px; border-radius: 50%;
  background: #e2e8f0; display: flex; align-items: center;
  justify-content: center; font-weight: 700; font-size: .875rem;
  flex-shrink: 0; transition: all .2s;
}
.selecionada .opcao-letra { background: var(--primary); color: #fff; }
.correta .opcao-letra { background: var(--success); color: #fff; }
.incorreta .opcao-letra { background: var(--danger); color: #fff; }

.timer-badge {
  background: #052e26; color: #6ee7b7;
  padding: .375rem .875rem; border-radius: 100px;
  font-weight: 600; font-family: monospace; font-size: 1rem;
}
.timer-badge.urgente { background: #7f1d1d; color: #fca5a5; }

/* Streak */
.streak-badge { background: linear-gradient(135deg, #f59e0b, #ef4444); color: #fff; }

/* Diálogo de confirmação customizado (substitui window.confirm) */
.qsim-confirm-content { border: none; border-radius: 1rem; box-shadow: 0 20px 60px -12px rgba(15,23,42,.3); }
.qsim-confirm-icon {
  width: 56px; height: 56px; border-radius: 50%; margin: 0 auto;
  display: flex; align-items: center; justify-content: center;
  background: #d1fae5; color: var(--primary-dark); font-size: 1.5rem;
}
.qsim-confirm-icon.danger { background: #fee2e2; color: var(--danger); }

/* Toast customizado (substitui window.alert para resultados/erros) */
#qsimToastContainer { z-index: 1080; }
.qsim-toast {
  border-radius: .75rem; color: #fff;
  box-shadow: 0 12px 32px -8px rgba(15,23,42,.35);
  min-width: 280px;
}
.qsim-toast .toast-body { font-weight: 500; font-size: .875rem; }
.qsim-toast.qsim-toast-success { background: linear-gradient(135deg, var(--primary-dark), var(--primary)); }
.qsim-toast.qsim-toast-danger  { background: linear-gradient(135deg, #b91c1c, var(--danger)); }
.qsim-toast.qsim-toast-warning { background: linear-gradient(135deg, #b45309, var(--warning)); }
.qsim-toast.qsim-toast-info    { background: linear-gradient(135deg, #1d4ed8, #3b82f6); }

/* Player flutuante de podcast — persiste entre páginas (localStorage),
   não bloqueia o resto do site como um modal, e pode ser arrastado. */
.qsim-podcast-player {
  position: fixed; bottom: 20px; right: 20px; z-index: 1085;
  width: 300px; max-width: calc(100vw - 24px);
  background: linear-gradient(165deg, #052e26, #06382f);
  color: #fff; border-radius: 1rem;
  box-shadow: 0 20px 50px -12px rgba(0,0,0,.45), 0 0 0 1px rgba(255,255,255,.06);
  overflow: hidden;
  animation: qsimPodcastIn .3s ease;
}
@keyframes qsimPodcastIn { from { opacity: 0; transform: translateY(16px) scale(.96); } to { opacity: 1; transform: none; } }
.qsim-podcast-drag {
  display: flex; align-items: center; gap: .65rem; padding: .75rem .9rem;
  cursor: grab; background: linear-gradient(135deg, rgba(0,205,160,.22), transparent);
  touch-action: none; user-select: none;
}
.qsim-podcast-drag:active { cursor: grabbing; }
.qsim-podcast-wave { display: flex; align-items: flex-end; gap: 3px; height: 22px; flex-shrink: 0; }
.qsim-podcast-wave span {
  width: 3px; background: var(--primary); border-radius: 2px; height: 5px;
  animation: qsimWave 1s ease-in-out infinite; animation-play-state: paused;
}
.qsim-podcast-wave span:nth-child(1) { animation-duration: .8s;  animation-delay: 0s; }
.qsim-podcast-wave span:nth-child(2) { animation-duration: 1.1s; animation-delay: .1s; }
.qsim-podcast-wave span:nth-child(3) { animation-duration: .7s;  animation-delay: .2s; }
.qsim-podcast-wave span:nth-child(4) { animation-duration: 1.2s; animation-delay: .05s; }
.qsim-podcast-wave span:nth-child(5) { animation-duration: .9s;  animation-delay: .15s; }
.qsim-podcast-player.playing .qsim-podcast-wave span { animation-play-state: running; }
@keyframes qsimWave { 0%, 100% { height: 5px; } 50% { height: 22px; } }
.qsim-podcast-info { flex: 1; min-width: 0; }
.qsim-podcast-nome { font-size: .8rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qsim-podcast-tempo { font-size: .7rem; color: #6ee7b7; font-family: monospace; }
.qsim-podcast-close {
  background: none; border: 0; color: #a7f3d0; padding: .25rem; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; border-radius: 50%;
}
.qsim-podcast-close:hover { color: #fff; background: rgba(255,255,255,.08); }
.qsim-podcast-controles { display: flex; align-items: center; gap: .65rem; padding: 0 .9rem .85rem; }
.qsim-podcast-play {
  width: 34px; height: 34px; border-radius: 50%; background: var(--primary); border: 0; color: #052e26;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 1rem; transition: background .15s ease;
}
.qsim-podcast-play:hover { background: #34d399; }
.qsim-podcast-seek { flex: 1; accent-color: var(--primary); height: 4px; }
@media (max-width: 480px) {
  .qsim-podcast-player { left: 12px; right: 12px; bottom: 12px; width: auto; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Camada 2 — Design system (linguagem da landing dentro do app)
   Superfícies escuras em verde-quase-preto com brilhos radiais verde/lavanda,
   títulos pesados com tracking negativo, acento lavanda, vidro translúcido.
   Use os componentes abaixo em vez de style="" inline.
   ═══════════════════════════════════════════════════════════════════════════ */
:root {
  --brand-950: #04110e; --brand-900: #052e26; --brand-800: #062a22; --brand-700: #064e3b;
  --brand-600: #00876a; --brand-500: #00CDA0; --brand-300: #6ee7b7; --brand-200: #a7f3d0; --brand-100: #d1fae5;
  --accent: #a08df5; --accent-600: #7c6ae6; --accent-100: #ede9fe;
  --ink: #0f172a; --ink-2: #334155; --muted: #64748b; --line: #e9edf3;
  --surface: #fff; --canvas: #f5f7fa;
  --radius: .9rem; --radius-lg: 1.25rem;
  --shadow-1: 0 1px 2px rgba(15,23,42,.04), 0 1px 3px rgba(15,23,42,.03);
  --shadow-2: 0 12px 32px -14px rgba(15,23,42,.22);
  --hero-bg:
    radial-gradient(520px 260px at 92% -10%, rgba(160,141,245,.30), transparent 60%),
    radial-gradient(460px 280px at -5% 110%, rgba(0,205,160,.32), transparent 60%),
    linear-gradient(150deg, #04110e 0%, #062a22 55%, #064e3b 100%);
}
body { background: var(--canvas); color: var(--ink); }

/* Cards: só sobem no hover se forem clicáveis (card estático "pulando" parece barato) */
.stat-card { border-color: var(--line); box-shadow: var(--shadow-1); }
.stat-card:hover { transform: none; box-shadow: var(--shadow-1); border-color: var(--line); }
a.stat-card, .stat-card.is-link { display: block; color: inherit; text-decoration: none; }
a.stat-card:hover, .stat-card.is-link:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: #dfe4ec; }

/* Cabeçalho de página: eyebrow + título + subtítulo + ações */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.eyebrow { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--brand-600); }
.page-title { font-size: 1.65rem; font-weight: 800; letter-spacing: -.025em; line-height: 1.15; margin: .2rem 0 0; color: var(--ink); }
.page-sub { color: var(--muted); font-size: .92rem; margin: .35rem 0 0; }
.grad-text { background: linear-gradient(100deg, #6ee7b7 0%, #a08df5 85%); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* Títulos de seção e cabeçalho de card */
.sec-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 0 0 .75rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.card-head h6, .card-title-sm { margin: 0; font-size: .95rem; font-weight: 700; letter-spacing: -.01em; display: flex; align-items: center; gap: .5rem; }
.card-head a { font-size: .8rem; font-weight: 600; color: var(--brand-600); text-decoration: none; }
.card-head a:hover { color: var(--brand-700); }
.icon-chip { width: 2rem; height: 2rem; border-radius: .6rem; display: inline-flex; align-items: center; justify-content: center; font-size: 1rem; flex-shrink: 0;
  background: var(--brand-100); color: var(--brand-600); }
.icon-chip.accent { background: var(--accent-100); color: var(--accent-600); }
.icon-chip.warn { background: #fef3c7; color: #b45309; }
.icon-chip.danger { background: #fee2e2; color: #b91c1c; }
.icon-chip.lg { width: 2.75rem; height: 2.75rem; border-radius: .8rem; font-size: 1.25rem; }

/* Hero escuro (mesma superfície do hero da landing) */
.hero-card { position: relative; overflow: hidden; background: var(--hero-bg); color: #fff; border-radius: var(--radius-lg); padding: 1.6rem 1.75rem;
  box-shadow: 0 24px 48px -28px rgba(4,17,14,.7); isolation: isolate; }
.hero-card::before { content: ''; position: absolute; inset: 0; z-index: -1; opacity: .5;
  background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 28px 28px; mask-image: linear-gradient(180deg, #000, transparent 85%); -webkit-mask-image: linear-gradient(180deg, #000, transparent 85%); }
.hero-card .eyebrow { color: var(--brand-300); }
.hero-card .eyebrow a { color: inherit; text-decoration: none; }
.hero-card .eyebrow a:hover { color: #fff; }
.hero-card h1, .hero-card h2 { font-weight: 800; letter-spacing: -.03em; line-height: 1.1; margin: .35rem 0 0; color: #fff; }
.hero-card h1 { font-size: 2rem; } .hero-card h2 { font-size: 1.6rem; }
.hero-card .hero-sub { color: #c9f5e4; opacity: .9; margin: .5rem 0 0; font-size: .95rem; max-width: 46ch; }
.hero-card .btn-light { color: var(--brand-900); box-shadow: 0 8px 24px -10px rgba(0,0,0,.5); }
.hero-card .btn-light:hover { background: #fff; transform: translateY(-1px); }
.hero-card .btn-ghost { color: #fff; border: 1px solid rgba(255,255,255,.22); background: rgba(255,255,255,.06); }
.hero-card .btn-ghost:hover { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.35); }
.glass { background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.13); border-radius: var(--radius); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.hero-pills { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.25rem; }
.hero-chip { display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .75rem; border-radius: 100px; font-size: .8rem; font-weight: 500;
  color: #e6fbf3; text-decoration: none; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); transition: background .15s ease, border-color .15s ease; }
.hero-chip b { color: #fff; font-weight: 700; }
.hero-chip i { color: var(--brand-300); }
a.hero-chip:hover { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.25); color: #fff; }
.hero-count { padding: 1rem 1.25rem; text-align: center; min-width: 9rem; }
.hero-count .n { font-size: 2.6rem; font-weight: 800; letter-spacing: -.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.hero-count .l { font-size: .75rem; color: var(--brand-200); margin-top: .3rem; }

/* KPI */
.kpi { display: flex; flex-direction: column; gap: .15rem; }
.kpi .icon-chip { margin-bottom: .6rem; }
.kpi-value { font-size: 1.85rem; font-weight: 800; letter-spacing: -.035em; line-height: 1.05; font-variant-numeric: tabular-nums; color: var(--ink); }
.kpi-value small { font-size: .55em; font-weight: 700; color: var(--muted); margin-left: .1rem; }
.kpi-label { font-size: .8rem; color: var(--muted); font-weight: 500; }
.tone-good { color: #047857 !important; } .tone-mid { color: #b45309 !important; } .tone-bad { color: #b91c1c !important; }

/* Lista compacta (linhas com divisória) */
.list-rows > * { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .55rem 0; border-bottom: 1px solid var(--line); min-width: 0; }
.list-rows > *:last-child { border-bottom: 0; }
.list-rows .lr-main { min-width: 0; font-size: .875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-rows .lr-sub { font-size: .75rem; color: var(--muted); }
.pill { display: inline-flex; align-items: center; gap: .25rem; padding: .15rem .55rem; border-radius: 100px; font-size: .72rem; font-weight: 700; white-space: nowrap; flex-shrink: 0; }
.pill-good { background: var(--brand-100); color: #065f46; } .pill-mid { background: #fef3c7; color: #92400e; }
.pill-bad { background: #fee2e2; color: #991b1b; } .pill-accent { background: var(--accent-100); color: #5b21b6; }

/* Barra de progresso fina com rótulo */
.meter + .meter { margin-top: .85rem; }
.meter-top { display: flex; justify-content: space-between; gap: .75rem; font-size: .84rem; margin-bottom: .35rem; }
.meter-top span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meter-top b { font-variant-numeric: tabular-nums; }
.meter .progress { height: 6px; }

/* Estado vazio */
.empty-state { text-align: center; padding: 1.75rem 1rem; color: var(--muted); }
.empty-state .icon-chip { margin: 0 auto .75rem; }
.empty-state p { font-size: .85rem; margin: 0 auto; max-width: 34ch; }

/* Skeleton de carregamento */
.skeleton { background: linear-gradient(90deg, #eef1f6 25%, #f6f8fb 37%, #eef1f6 63%); background-size: 400% 100%; animation: qsimShimmer 1.3s ease infinite; border-radius: .5rem; color: transparent !important; }
@keyframes qsimShimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* Sidebar na superfície da landing */
.sidebar { background:
  radial-gradient(320px 220px at 0% 0%, rgba(0,205,160,.16), transparent 70%),
  radial-gradient(300px 260px at 100% 100%, rgba(160,141,245,.14), transparent 70%),
  linear-gradient(180deg, #04110e 0%, #062a22 60%, #064e3b 100%); }
.sidebar .nav-link { color: #b9e9d6; }
.sidebar .nav-link.active { background: linear-gradient(135deg, rgba(0,205,160,.28), rgba(160,141,245,.16)); }
.sidebar .nav-link.active::before { background: linear-gradient(180deg, #6ee7b7, #a08df5); }
.sidebar .section-title { color: #5fd3ad; }

@media (prefers-reduced-motion: reduce) {
  .skeleton, .content-area { animation: none; }
  a.stat-card:hover, .stat-card.is-link:hover, .hero-card .btn-light:hover { transform: none; }
}
@media (max-width: 767.98px) {
  .hero-card { padding: 1.25rem; border-radius: 1rem; }
  .hero-card h1 { font-size: 1.55rem; }
  .hero-count { min-width: 0; padding: .75rem 1rem; }
  .hero-count .n { font-size: 2rem; }
  .page-title { font-size: 1.35rem; }
  .kpi-value { font-size: 1.5rem; }
}

/* ── Navegação: contador no menu e barra inferior (celular) ───────────────
   --bottom-nav-h = altura da barra (0 no desktop). Telas de altura cheia descontam
   ela: height: calc(100vh - Xpx - var(--bottom-nav-h)). */
:root { --bottom-nav-h: 0px; --topbar-h: 58px; }
.topbar { height: var(--topbar-h); padding-top: 0; padding-bottom: 0; }
.sidebar .nav-link .nav-count { background: rgba(160,141,245,.9); color: #1b1240; font-size: .65rem; font-weight: 700; }
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 990; height: var(--bottom-nav-h); box-sizing: border-box;
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: .3rem .25rem calc(.3rem + env(safe-area-inset-bottom));
  background: rgba(4,17,14,.92); backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-top: 1px solid rgba(255,255,255,.08); box-shadow: 0 -8px 24px -12px rgba(4,17,14,.6);
}
.bottom-nav a, .bottom-nav button {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .1rem;
  min-height: 50px; padding: .25rem 0; border: 0; background: none; border-radius: .7rem;
  color: #8fbfae; font-size: .68rem; font-weight: 600; text-decoration: none; -webkit-tap-highlight-color: transparent;
}
.bottom-nav i { font-size: 1.25rem; line-height: 1; transition: transform .15s ease; }
.bottom-nav .active { color: #fff; }
.bottom-nav .active i { color: var(--brand-300); transform: translateY(-1px); }
.bottom-nav .active::before { content: ''; position: absolute; top: 0; width: 1.6rem; height: 3px; border-radius: 0 0 3px 3px;
  background: linear-gradient(90deg, var(--brand-300), var(--accent)); }
.bottom-nav .bn-badge { position: absolute; top: .2rem; left: calc(50% + .35rem); min-width: 1.1rem; height: 1.1rem; padding: 0 .25rem;
  border-radius: 100px; background: var(--accent); color: #1b1240; font-size: .6rem; font-weight: 800; line-height: 1.1rem; text-align: center; }
@media (max-width: 767.98px) {
  /* espaço pra barra não cobrir o fim da página, o player de podcast e os toasts */
  :root { --bottom-nav-h: calc(62px + env(safe-area-inset-bottom)); --topbar-h: 50px; }
  .topbar { height: var(--topbar-h); padding-top: 0; padding-bottom: 0; }
  .content-area { padding-bottom: calc(var(--content-pad) + var(--bottom-nav-h)); }
  .qsim-podcast-player { bottom: calc(var(--bottom-nav-h) + 10px) !important; }
  /* a gaveta abre por cima da barra */
  .sidebar { z-index: 1001; } .sidebar-backdrop { z-index: 995; }
  .topbar { padding-left: var(--content-pad); }
}

/* ── Etiquetas de questão (banca/órgão na paleta da marca, não o azul do Bootstrap) ── */
.tag-banca { background: var(--brand-900); color: #d1fae5; font-weight: 700; letter-spacing: .02em; }
.tag-orgao { background: #334155; color: #f1f5f9; font-weight: 700; letter-spacing: .02em; }

/* ── Modo foco (resolução de questões): sem barra inferior, ação fixa no rodapé ── */
body.modo-foco .bottom-nav { display: none; }
@media (max-width: 767.98px) { body.modo-foco { --bottom-nav-h: 0px; } }
.q-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.q-progresso { display: flex; align-items: center; gap: .75rem; min-width: 0; flex: 1 1 220px; }
.q-progresso .q-num { font-size: .8rem; font-weight: 700; color: var(--muted); white-space: nowrap; }
.q-progresso .q-num b { color: var(--ink); font-size: 1rem; }
.q-progresso .progress { flex: 1; height: 6px; max-width: 260px; }
.q-progresso .progress-bar { background: linear-gradient(90deg, var(--brand-500), var(--accent)); }
.q-feedback { display: flex; gap: .75rem; align-items: flex-start; border-radius: var(--radius); padding: .9rem 1rem; margin-top: 1rem; animation: qsimFadeIn .25s ease; }
.q-feedback i { font-size: 1.35rem; line-height: 1; }
.q-feedback b { display: block; font-size: .95rem; }
.q-feedback span { font-size: .85rem; }
.q-feedback.ok { background: var(--brand-100); color: #065f46; border: 1px solid #a7f3d0; }
.q-feedback.erro { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.q-acoes { position: sticky; bottom: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  margin-top: 1rem; padding: .75rem 0 calc(.75rem + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(245,247,250,0), var(--canvas) 35%); }
.q-acoes .btn-main { min-width: 12rem; }
@media (max-width: 575.98px) {
  .q-acoes { margin-left: calc(var(--content-pad) * -1); margin-right: calc(var(--content-pad) * -1); padding-left: var(--content-pad); padding-right: var(--content-pad);
    background: rgba(255,255,255,.92); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line); }
  .q-acoes .btn-main { flex: 1; min-width: 0; min-height: 48px; }
  .q-acoes .btn-voltar { min-height: 48px; min-width: 48px; }
  .q-acoes .btn-voltar .txt { display: none; }
}

/* ── Tema do Bootstrap na cor da marca ──────────────────────────────────────
   Sem isto, tudo que o Bootstrap pinta com o azul padrão (links, foco, checkbox,
   segmentos ativos, paginação, .text-primary/.bg-primary) destoa do app. */
:root {
  --bs-primary: #00a683; --bs-primary-rgb: 0,166,131;
  --bs-link-color: #00876a; --bs-link-color-rgb: 0,135,106;
  --bs-link-hover-color: #065f46; --bs-link-hover-color-rgb: 6,95,70;
  --bs-focus-ring-color: rgba(0,205,160,.25);
  --bs-primary-bg-subtle: #d1fae5; --bs-primary-border-subtle: #a7f3d0; --bs-primary-text-emphasis: #065f46;
}
.form-control:focus, .form-select:focus, .form-check-input:focus, .btn:focus-visible {
  border-color: #6ee7b7; box-shadow: 0 0 0 .2rem rgba(0,205,160,.2);
}
.form-check-input:checked { background-color: var(--brand-600); border-color: var(--brand-600); }
.form-switch .form-check-input:focus:not(:checked) { --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%236ee7b7'/%3e%3c/svg%3e"); }
.btn-outline-primary {
  --bs-btn-color: var(--brand-600); --bs-btn-border-color: #8ee6cc;
  --bs-btn-hover-bg: var(--brand-600); --bs-btn-hover-border-color: var(--brand-600); --bs-btn-hover-color: #fff;
  --bs-btn-active-bg: var(--brand-600); --bs-btn-active-border-color: var(--brand-600); --bs-btn-active-color: #fff;
  --bs-btn-disabled-color: var(--brand-600); --bs-btn-disabled-border-color: #8ee6cc;
}
.btn-check:checked + .btn-outline-primary, .btn-outline-primary.active { background: var(--brand-600); border-color: var(--brand-600); color: #fff; box-shadow: none; }
.btn-check:checked + .btn-outline-secondary, .btn-outline-secondary.active { background: var(--ink-2); border-color: var(--ink-2); color: #fff; }
.pagination { --bs-pagination-color: var(--brand-600); --bs-pagination-hover-color: var(--brand-700); --bs-pagination-focus-color: var(--brand-700);
  --bs-pagination-active-bg: var(--brand-600); --bs-pagination-active-border-color: var(--brand-600); --bs-pagination-focus-box-shadow: 0 0 0 .2rem rgba(0,205,160,.2); }
.nav-pills { --bs-nav-pills-link-active-bg: var(--brand-600); }
.nav-tabs .nav-link { color: var(--muted); } .nav-tabs .nav-link.active { color: var(--ink); font-weight: 600; }
.dropdown-menu { --bs-dropdown-link-active-bg: var(--brand-600); border-color: var(--line); box-shadow: var(--shadow-2); border-radius: .75rem; }
.progress-bar { background-color: var(--brand-500); }
.modal-content { border: 0; border-radius: 1rem; box-shadow: 0 24px 64px -20px rgba(15,23,42,.35); }
.form-control, .form-select { border-color: #dfe4ec; }
.form-label { display: block; font-weight: 600; font-size: .85rem; color: var(--ink-2); }

/* Select2 (selects com busca) na mesma linguagem dos campos */
.select2-container--default .select2-selection--single, .select2-container--default .select2-selection--multiple { border-color: #dfe4ec !important; border-radius: .375rem !important; }
.select2-container--default.select2-container--focus .select2-selection--multiple,
.select2-container--default.select2-container--open .select2-selection--single { border-color: #6ee7b7 !important; box-shadow: 0 0 0 .2rem rgba(0,205,160,.2); }
.select2-container--default .select2-results__option--highlighted[aria-selected], .select2-container--default .select2-results__option--highlighted.select2-results__option--selectable { background-color: var(--brand-600) !important; }

/* Ferramenta (tile clicável com ícone + título + descrição) */
a.stat-card.tool-tile, .tool-tile { display: flex; gap: .85rem; align-items: flex-start; padding: 1rem; height: 100%; }
.tool-tile .icon-chip { margin-top: .1rem; }
.tool-tile > div { min-width: 0; }
.tool-tile > div > b { display: block; font-size: .92rem; color: var(--ink); }
.tool-tile > div > span { display: block; font-size: .8rem; color: var(--muted); line-height: 1.35; margin-top: .1rem; }
.tool-tile .bi-arrow-right-short { margin-left: auto; color: #cbd5e1; font-size: 1.3rem; align-self: center; transition: transform .15s ease, color .15s ease; }
a.tool-tile:hover .bi-arrow-right-short { color: var(--brand-600); transform: translateX(2px); }

/* ── Botões: ícone e texto sempre centralizados ─────────────────────────────
   No celular os botões têm altura mínima (40/48px) e o display:block/inline-block
   do Bootstrap deixava o conteúdo grudado no topo (ícone/texto ~5px acima do
   centro). Flex centraliza nos dois eixos em qualquer altura. */
.btn { display: inline-flex; align-items: center; justify-content: center; vertical-align: middle; }
.btn > .bi { line-height: 1; }

/* ── Celular: alvos de toque ≥ 44px e campos sem zoom do iOS ────────────────
   Botões 40px, .btn-sm 34px, ícones 32×34 e campos 31–38px ficavam abaixo do
   mínimo recomendado (Apple HIG / WCAG 2.5.5). Campos com fonte < 16px fazem o
   Safari do iPhone dar zoom na página ao tocar. */
@media (max-width: 767.98px) {
  .btn, .btn-sm { min-height: 44px; min-width: 44px; }
  .btn-group > .btn, .btn-group > label.btn { min-height: 44px; }
  .form-control, .form-select, .form-control-sm, .form-select-sm, .input-group-text {
    min-height: 44px; font-size: 16px;
  }
  .select2-container .select2-selection--single { min-height: 44px; display: flex; align-items: center; }
  .select2-container .select2-selection--multiple { min-height: 44px; }
  .select2-container .select2-selection__arrow { height: 42px !important; }
  /* checkbox/switch: a linha inteira (input + rótulo) vira o alvo */
  .form-check { min-height: 44px; display: flex; align-items: center; gap: .5rem; padding-left: 0; }
  .form-check .form-check-input { float: none; margin: 0; flex-shrink: 0; width: 1.35em; height: 1.35em; }
  .form-switch .form-check-input { width: 2.4em; height: 1.35em; margin-left: 0; }
  .form-check-label { padding: .5rem 0; }
  .hero-chip { min-height: 44px; padding: .45rem .9rem; }
  .eyebrow a, a.text-reset { display: inline-flex; align-items: center; min-height: 44px; margin: -.75rem 0; }
  .pagination .page-link { min-width: 44px; min-height: 44px; display: flex; align-items: center; justify-content: center; }
  /* link de cabeçalho de card: área de toque maior sem mexer no layout (margem negativa compensa) */
  .card-head a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 .25rem; margin: -.75rem -.25rem; }
}

/* ── Tabelas viram cards no celular ──────────────────────────────────────────
   Use <table class="table table-stack"> e data-label="Coluna" em cada <td>.
   Abaixo de 576px cada linha vira um card com "rótulo: valor". */
@media (max-width: 575.98px) {
  .table-stack thead { display: none; }
  .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
  .table-stack tr { display: flex; flex-direction: column; padding: .65rem 0; border-bottom: 1px solid var(--line); }
  .table-stack td.ts-titulo { order: -1; } /* o título do card vem primeiro, qualquer que seja a coluna */
  .table-stack tr:last-child { border-bottom: 0; }
  .table-stack td { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .2rem 0 !important; border: 0 !important; text-align: right !important; }
  .table-stack td::before { content: attr(data-label); font-size: .75rem; font-weight: 600; color: var(--muted); text-align: left; flex-shrink: 0; }
  .table-stack td[data-label=""]::before, .table-stack td:not([data-label])::before { content: none; }
  .table-stack td.ts-titulo { font-weight: 700; font-size: .95rem; text-align: left !important; justify-content: flex-start; }
  .table-stack td.ts-titulo::before { content: none; }
  .table-stack td[colspan] { justify-content: center; text-align: center !important; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Modo escuro — só nas telas de estudo longo (questão, leitura de notas,
   revisão, treino de flashcards). A página opta com body_class "aceita-escuro";
   o tema vem de <html data-tema="escuro|claro">, definido no <head> antes de
   pintar (preferência salva ou a do sistema). Fora dessas telas nada muda.
   ═══════════════════════════════════════════════════════════════════════════ */
.tema-toggle { display: none; }
body.aceita-escuro .tema-toggle { display: inline-flex; }

html[data-tema="escuro"] body.aceita-escuro {
  --canvas: #0b1411; --surface: #111d19; --surface-2: #172621; --line: #22352e;
  --ink: #e7f2ed; --ink-2: #c3d4cc; --muted: #8fa89e;
  --bs-body-bg: var(--canvas); --bs-body-color: var(--ink); --bs-emphasis-color: #fff;
  --bs-secondary-color: var(--muted); --bs-border-color: var(--line); --bs-tertiary-bg: var(--surface-2);
  --bs-link-color: #6ee7b7; --bs-link-color-rgb: 110,231,183; --bs-link-hover-color: #a7f3d0;
  color-scheme: dark; background: var(--canvas); color: var(--ink);
}
html[data-tema="escuro"] body.aceita-escuro .main-content { background: var(--canvas); }
html[data-tema="escuro"] body.aceita-escuro .topbar { background: rgba(11,20,17,.82); border-bottom-color: var(--line); }
html[data-tema="escuro"] body.aceita-escuro .topbar h6 { color: var(--ink); }
html[data-tema="escuro"] body.aceita-escuro .stat-card,
html[data-tema="escuro"] body.aceita-escuro .rv-nivel,
html[data-tema="escuro"] body.aceita-escuro .nota-bloco,
html[data-tema="escuro"] body.aceita-escuro .leitura-toc,
html[data-tema="escuro"] body.aceita-escuro .flip-face { background: var(--surface); border-color: var(--line); color: var(--ink); box-shadow: none; }
html[data-tema="escuro"] body.aceita-escuro .text-muted,
html[data-tema="escuro"] body.aceita-escuro .text-secondary { color: var(--muted) !important; }
html[data-tema="escuro"] body.aceita-escuro .text-dark { color: var(--ink) !important; }
html[data-tema="escuro"] body.aceita-escuro .page-title,
html[data-tema="escuro"] body.aceita-escuro .kpi-value,
html[data-tema="escuro"] body.aceita-escuro h1, html[data-tema="escuro"] body.aceita-escuro h2,
html[data-tema="escuro"] body.aceita-escuro h3, html[data-tema="escuro"] body.aceita-escuro h5,
html[data-tema="escuro"] body.aceita-escuro h6 { color: var(--ink); }
html[data-tema="escuro"] body.aceita-escuro .hero-card h1, html[data-tema="escuro"] body.aceita-escuro .hero-card h2,
html[data-tema="escuro"] body.aceita-escuro .rv-hero h2 { color: #fff; }
/* campos e botões neutros */
html[data-tema="escuro"] body.aceita-escuro .form-control, html[data-tema="escuro"] body.aceita-escuro .form-select {
  background-color: var(--surface-2); border-color: var(--line); color: var(--ink); }
html[data-tema="escuro"] body.aceita-escuro .btn-outline-secondary { --bs-btn-color: var(--ink-2); --bs-btn-border-color: #2f4840; --bs-btn-hover-bg: #22352e; --bs-btn-hover-color: #fff; --bs-btn-hover-border-color: #2f4840; }
html[data-tema="escuro"] body.aceita-escuro .btn-outline-warning { --bs-btn-border-color: #a16207; }
html[data-tema="escuro"] body.aceita-escuro .btn-light:not(.hero-card .btn-light):not(.rv-hero .btn-light) { background: var(--surface-2); border-color: var(--line); color: var(--ink); }
html[data-tema="escuro"] body.aceita-escuro .badge.bg-light { background: var(--surface-2) !important; color: var(--ink-2) !important; border-color: var(--line) !important; }
html[data-tema="escuro"] body.aceita-escuro .tag-banca { background: #0f3d31; color: #a7f3d0; }
html[data-tema="escuro"] body.aceita-escuro .tag-orgao { background: #2b3a4d; color: #e2e8f0; }
/* pílulas e tons semânticos (fundos claros → escuros translúcidos) */
html[data-tema="escuro"] body.aceita-escuro .pill-good, html[data-tema="escuro"] body.aceita-escuro .rv-f2,
html[data-tema="escuro"] body.aceita-escuro .nivel-facil { background: rgba(16,185,129,.16); color: #6ee7b7; }
html[data-tema="escuro"] body.aceita-escuro .pill-mid, html[data-tema="escuro"] body.aceita-escuro .rv-f1,
html[data-tema="escuro"] body.aceita-escuro .nivel-moderado { background: rgba(245,158,11,.16); color: #fcd34d; }
html[data-tema="escuro"] body.aceita-escuro .pill-bad, html[data-tema="escuro"] body.aceita-escuro .rv-f0,
html[data-tema="escuro"] body.aceita-escuro .nivel-dificil { background: rgba(239,68,68,.16); color: #fca5a5; }
html[data-tema="escuro"] body.aceita-escuro .pill-accent { background: rgba(160,141,245,.18); color: #c4b5fd; }
html[data-tema="escuro"] body.aceita-escuro .tone-good { color: #6ee7b7 !important; }
html[data-tema="escuro"] body.aceita-escuro .tone-mid { color: #fcd34d !important; }
html[data-tema="escuro"] body.aceita-escuro .tone-bad { color: #fca5a5 !important; }
html[data-tema="escuro"] body.aceita-escuro .icon-chip { background: rgba(0,205,160,.14); color: #6ee7b7; }
html[data-tema="escuro"] body.aceita-escuro .icon-chip.warn { background: rgba(245,158,11,.14); color: #fcd34d; }
html[data-tema="escuro"] body.aceita-escuro .icon-chip.danger { background: rgba(239,68,68,.14); color: #fca5a5; }
html[data-tema="escuro"] body.aceita-escuro .icon-chip.accent { background: rgba(160,141,245,.16); color: #c4b5fd; }
html[data-tema="escuro"] body.aceita-escuro .progress { background: #1d2e28; }

/* Questão */
html[data-tema="escuro"] body.aceita-escuro .enunciado, html[data-tema="escuro"] body.aceita-escuro .texto-conteudo,
html[data-tema="escuro"] body.aceita-escuro .markdown-body { color: var(--ink); }
html[data-tema="escuro"] body.aceita-escuro .texto-base, html[data-tema="escuro"] body.aceita-escuro .figura-container,
html[data-tema="escuro"] body.aceita-escuro #comentario-box { background: var(--surface-2) !important; border-color: var(--line) !important; }
html[data-tema="escuro"] body.aceita-escuro .opcao-btn { background: var(--surface-2); border-color: var(--line); color: var(--ink); }
html[data-tema="escuro"] body.aceita-escuro .opcao-btn:hover, html[data-tema="escuro"] body.aceita-escuro .opcao-btn.selecionada { background: rgba(0,205,160,.12); border-color: var(--brand-500); }
html[data-tema="escuro"] body.aceita-escuro .opcao-btn.correta { background: rgba(16,185,129,.16); border-color: #10b981; }
html[data-tema="escuro"] body.aceita-escuro .opcao-btn.incorreta { background: rgba(239,68,68,.14); border-color: #ef4444; }
html[data-tema="escuro"] body.aceita-escuro .opcao-letra { background: #22352e; color: var(--ink); }
html[data-tema="escuro"] body.aceita-escuro .ce-btn { background: var(--surface-2); }
html[data-tema="escuro"] body.aceita-escuro .ce-btn.certo { color: #6ee7b7; } html[data-tema="escuro"] body.aceita-escuro .ce-btn.errado { color: #fca5a5; }
html[data-tema="escuro"] body.aceita-escuro .q-feedback.ok { background: rgba(16,185,129,.14); border-color: rgba(16,185,129,.35); color: #a7f3d0; }
html[data-tema="escuro"] body.aceita-escuro .q-feedback.erro { background: rgba(239,68,68,.12); border-color: rgba(239,68,68,.35); color: #fecaca; }
html[data-tema="escuro"] body.aceita-escuro .q-acoes { background: linear-gradient(180deg, rgba(11,20,17,0), var(--canvas) 35%); }
@media (max-width: 575.98px) { html[data-tema="escuro"] body.aceita-escuro .q-acoes { background: rgba(11,20,17,.92); border-top-color: var(--line); } }
html[data-tema="escuro"] body.aceita-escuro .markdown-body code, html[data-tema="escuro"] body.aceita-escuro .nota-texto pre { background: #1d2e28; color: var(--ink); }
html[data-tema="escuro"] body.aceita-escuro .markdown-body blockquote, html[data-tema="escuro"] body.aceita-escuro .nota-texto blockquote { background: rgba(0,205,160,.08); color: var(--ink-2); }
html[data-tema="escuro"] body.aceita-escuro .nav-q { background: var(--surface-2); border-color: var(--line); color: var(--ink-2); }
html[data-tema="escuro"] body.aceita-escuro .offcanvas { --bs-offcanvas-bg: var(--surface); --bs-offcanvas-color: var(--ink); }
/* Leitura de notas */
html[data-tema="escuro"] body.aceita-escuro .leitura-toc a { color: var(--ink-2); }
html[data-tema="escuro"] body.aceita-escuro .leitura-toc a:hover, html[data-tema="escuro"] body.aceita-escuro .leitura-toc a.ativa { background: rgba(0,205,160,.14); color: #a7f3d0; }
html[data-tema="escuro"] body.aceita-escuro .nota-texto a { color: #6ee7b7; }
html[data-tema="escuro"] body.aceita-escuro .nota-texto th, html[data-tema="escuro"] body.aceita-escuro .nota-texto td { border-color: var(--line); }
/* Revisão */
html[data-tema="escuro"] body.aceita-escuro .rv-trilha b { background: var(--surface-2); color: var(--ink); }
html[data-tema="escuro"] body.aceita-escuro .rv-enunciado { color: var(--ink); }
html[data-tema="escuro"] body.aceita-escuro .rv-escada i { background: #22352e; }
html[data-tema="escuro"] body.aceita-escuro .rv-escada i.on { background: var(--brand-500); }
/* Treino de flashcards */
html[data-tema="escuro"] body.aceita-escuro .placar .item { color: var(--ink-2); }
html[data-tema="escuro"] body.aceita-escuro .placar .item strong, html[data-tema="escuro"] body.aceita-escuro .flip-face .conteudo,
html[data-tema="escuro"] body.aceita-escuro .flip-face p { color: var(--ink); }
html[data-tema="escuro"] body.aceita-escuro .kbd { border-color: #2f4840; color: var(--ink-2); background: var(--surface-2); }
/* Cartão do treino: o texto é .texto (cor fixa escura no <style> da página) — sem isto some no fundo escuro */
html[data-tema="escuro"] body.aceita-escuro .flip-face .texto { color: var(--ink); }
html[data-tema="escuro"] body.aceita-escuro .flip-face .rotulo,
html[data-tema="escuro"] body.aceita-escuro .flip-face .dica { color: var(--muted); }
html[data-tema="escuro"] body.aceita-escuro .flip-face.verso { border-color: var(--brand-600); }
html[data-tema="escuro"] body.aceita-escuro .flip-face.verso .rotulo { color: var(--brand-300); }
html[data-tema="escuro"] body.aceita-escuro .form-check-input { background-color: var(--surface-2); border-color: #3b554c; }
html[data-tema="escuro"] body.aceita-escuro .form-check-input:checked { background-color: var(--brand-600); border-color: var(--brand-600); }
html[data-tema="escuro"] body.aceita-escuro .form-switch .form-check-input:not(:checked) {
  --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%238fa89e'/%3e%3c/svg%3e"); }
html[data-tema="escuro"] body.aceita-escuro .form-select {
  --bs-form-select-bg-img: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23c3d4cc' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e"); }
