/* ============================================================
   Giz — Design System (visual do Educa.ai)
   Preto / branco / emerald · Inter · cards arredondados.
   Fonte Inter hospedada localmente (mantém a CSP restritiva).
   ============================================================ */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/assets/fonts/inter.woff2') format('woff2');
}

:root {
  --bg:         #F5F5F5;
  --emerald-50: #ECFDF5;
  --emerald-100:#D1FAE5;
  --emerald-400:#34D399;
  --emerald-500:#10B981;
  --emerald-600:#059669;
  --emerald-700:#047857;
  --emerald-800:#065F46;
  --emerald-900:#064E3B;
  --gray-50:  #F9FAFB;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-400: #9CA3AF;
  --gray-500: #6B7280;
  --gray-600: #4B5563;
  --gray-700: #374151;
  --gray-800: #1F2937;
  --gray-900: #111827;
  --red-500:  #EF4444;
  --red-50:   #FEF2F2;
  --zinc-900: #18181B;
  --zinc-400: #A1A1AA;
  --zinc-100: #F4F4F5;
  --zinc-200: #E4E4E7;
  --sans: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: #000;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid #000; outline-offset: 2px; }

/* ---------- Tipografia ---------- */
h1, h2, h3, h4 { line-height: 1.15; letter-spacing: -0.025em; font-weight: 800; }
.font-black { font-weight: 900; }
.tracking-tight { letter-spacing: -0.025em; }

/* ---------- Layout util ---------- */
.wrap { width: 100%; max-width: 1140px; margin-inline: auto; padding-inline: clamp(16px, 4vw, 32px); }
.stack > * + * { margin-top: 1.25rem; }
.muted { color: var(--gray-500); }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: .75rem; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.wrapflex { flex-wrap: wrap; }
.hide-mobile { }
@media (max-width: 767px){ .hide-mobile { display: none !important; } }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .875rem 1.25rem; border-radius: 12px; border: 1px solid transparent;
  font-weight: 500; font-size: .95rem; cursor: pointer;
  transition: background .15s ease, color .15s ease, opacity .15s ease;
  white-space: nowrap;
}
.btn-black  { background: #000; color: #fff; }
.btn-black:hover  { background: var(--gray-800); }
.btn-gray   { background: var(--gray-100); color: var(--gray-800); }
.btn-gray:hover   { background: var(--gray-200); }
.btn-emerald { background: var(--emerald-500); color: #fff; }
.btn-emerald:hover { background: var(--emerald-600); }
.btn-block  { width: 100%; }
.btn-lg     { padding: 1rem 1.5rem; font-size: 1rem; }
.btn-pill   { border-radius: 9999px; padding: .5rem 1rem; font-size: .875rem; }
.btn[disabled] { opacity: .6; cursor: not-allowed; }
.btn-danger-ghost { background: transparent; color: var(--red-500); border-color: var(--gray-200); }
.btn-danger-ghost:hover { background: var(--red-50); }

/* ---------- Cards ---------- */
.card { background: #fff; border: 1px solid var(--gray-100); border-radius: 24px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.card-2xl { border-radius: 16px; }
.card-pad { padding: clamp(1.5rem, 4vw, 2rem); }

/* ---------- Forms ---------- */
.field { margin-bottom: 1.25rem; }
.label { display: block; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--gray-500); margin-bottom: .375rem; }
.label-light { color: var(--gray-400); letter-spacing: .1em; }
.input, .select, .textarea {
  width: 100%; padding: .75rem 1rem; font-size: .9rem;
  background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: 12px;
  color: #000; transition: border-color .15s ease, background .15s ease;
}
.input::placeholder, .textarea::placeholder { color: var(--gray-400); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: #000; background: #fff; }
.textarea { resize: vertical; min-height: 120px; line-height: 1.6; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236B7280' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 1rem center; padding-right: 2.5rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }
@media (max-width: 640px){ .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ---------- Alerts / mensagens ---------- */
.alert { padding: .75rem 1rem; border-radius: 12px; font-size: .9rem; }
.alert-error { background: var(--red-50); color: var(--red-500); }
.alert-ok    { background: var(--emerald-50); color: var(--emerald-700); }
.msg-error { color: var(--red-500); font-size: .875rem; }
.msg-ok    { color: var(--emerald-600); font-size: .875rem; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .6rem; border-radius: 9999px; font-size: .72rem; font-weight: 600; }
.badge-emerald { background: var(--emerald-100); color: var(--emerald-800); }
.badge-gray    { background: var(--gray-100); color: var(--gray-700); }
.badge-red     { background: var(--red-50); color: var(--red-500); }
.badge-mono    { font-family: var(--mono); letter-spacing: .04em; }

/* ============================================================
   Shell do app (sidebar preta + conteúdo)
   ============================================================ */
.shell { display: flex; min-height: 100vh; background: var(--bg); }
.sidebar { width: 256px; background: #000; color: #fff; display: flex; flex-direction: column; flex-shrink: 0; position: sticky; top: 0; height: 100vh; }
.sidebar-logo { display: flex; align-items: center; gap: .75rem; padding: 1.5rem; }
.sidebar-logo .ico { color: var(--emerald-500); display: flex; }
.sidebar-logo svg { width: 28px; height: 28px; flex-shrink: 0; }
.sidebar-logo h1 { font-size: 1.25rem; font-weight: 700; letter-spacing: -.02em; color: #fff; }
.nav { flex: 1; padding: .5rem 1rem; margin-top: 1rem; display: flex; flex-direction: column; gap: .5rem; }
.nav a { display: flex; align-items: center; gap: .75rem; padding: .75rem 1rem; border-radius: 12px; color: rgba(255,255,255,.6); font-weight: 500; transition: background .15s ease, color .15s ease; }
.nav a:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav a.active { background: rgba(255,255,255,.1); color: #fff; }
.nav a.admin.active { background: rgba(16,185,129,.2); color: var(--emerald-400); }
.nav a svg { width: 20px; height: 20px; flex-shrink: 0; }
.sidebar-foot { padding: 1rem; margin-top: auto; display: flex; flex-direction: column; gap: .5rem; }
.logout-btn { width: 100%; display: flex; align-items: center; justify-content: center; gap: .5rem; padding: .75rem 1rem; border-radius: 12px; background: rgba(255,255,255,.05); color: rgba(255,255,255,.6); font-size: .875rem; font-weight: 500; cursor: pointer; border: none; transition: background .15s ease, color .15s ease; }
.logout-btn:hover { background: rgba(255,255,255,.1); color: #fff; }
.logout-btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.profile-chip { display: flex; align-items: center; gap: .75rem; padding: .75rem; border-radius: 16px; background: var(--zinc-100); transition: background .15s ease; }
.profile-chip:hover { background: var(--zinc-200); }
.avatar { width: 40px; height: 40px; flex-shrink: 0; border-radius: 9999px; background: var(--emerald-100); color: var(--emerald-600); display: grid; place-items: center; font-weight: 700; font-size: .85rem; }
.avatar-sm { width: 32px; height: 32px; font-size: .72rem; }
.profile-chip .pname { font-weight: 700; font-size: .875rem; color: var(--zinc-900); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-chip .pplan { font-size: .625rem; font-weight: 700; color: var(--zinc-400); letter-spacing: .08em; }

.main { flex: 1; min-height: 0; overflow: auto; }
.page { padding: 1rem; max-width: 100%; }
@media (min-width: 768px){ .page { padding: 2rem; } }
.page-narrow { max-width: 768px; margin-inline: auto; }
.page-wide   { max-width: 1152px; margin-inline: auto; }
.page-head { margin-bottom: 1.5rem; }
@media (min-width: 768px){ .page-head { margin-bottom: 2.5rem; } }
.page-head h2 { font-size: 1.5rem; font-weight: 700; letter-spacing: -.025em; color: var(--gray-900); margin-bottom: .5rem; }
@media (min-width: 768px){ .page-head h2 { font-size: 2.25rem; } }
.page-head p { color: var(--gray-500); }

/* Mobile: sidebar vira top bar + bottom tabs */
.topbar, .bottomnav { display: none; }
@media (max-width: 767px) {
  .shell { flex-direction: column; }
  .sidebar { position: static; width: 100%; height: auto; }
  .sidebar-logo, .nav, .sidebar-foot { display: none; }
  .topbar { display: flex; align-items: center; justify-content: space-between; padding: .75rem 1rem; background: #000; color: #fff; }
  .topbar .brand { display: flex; align-items: center; gap: .5rem; font-weight: 700; }
  .topbar .brand svg { color: var(--emerald-500); width: 24px; height: 24px; }
  .bottomnav { display: flex; position: sticky; bottom: 0; z-index: 40; background: #000; border-top: 1px solid rgba(255,255,255,.1); }
  .bottomnav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .15rem; padding: .625rem; font-size: .68rem; font-weight: 500; color: rgba(255,255,255,.5); }
  .bottomnav a svg { width: 20px; height: 20px; }
  .bottomnav a.active { color: #fff; }
  .bottomnav a.admin.active { color: var(--emerald-400); }
  .main { padding-bottom: 0; }
}

/* ============================================================
   Auth split (login / ativar / recuperar)
   ============================================================ */
.auth { min-height: 100vh; display: flex; }
.auth-brand { position: relative; width: 46%; background: #000; display: flex; flex-direction: column; justify-content: space-between; padding: 3rem; overflow: hidden; }
@media (max-width: 767px){ .auth-brand { display: none; } }
.auth-brand .dots { position: absolute; inset: 0; opacity: .07; background-image: radial-gradient(circle, #fff 1px, transparent 1px); background-size: 28px 28px; }
.auth-brand .glow { position: absolute; bottom: 0; left: 0; width: 16rem; height: 16rem; border-radius: 9999px; background: rgba(16,185,129,.2); filter: blur(64px); transform: translate(-33%, 33%); }
.auth-brand .z { position: relative; z-index: 1; }
.auth-brand .logo { display: flex; align-items: center; gap: .75rem; color: #fff; }
.auth-brand .logo svg { color: var(--emerald-400); width: 28px; height: 28px; }
.auth-brand .logo span { font-size: 1.25rem; font-weight: 700; letter-spacing: -.02em; }
.auth-brand .eyebrow { color: rgba(255,255,255,.4); font-size: .875rem; font-weight: 500; text-transform: uppercase; letter-spacing: .2em; margin-bottom: 1rem; }
.auth-brand h2 { color: #fff; font-size: 2.25rem; font-weight: 900; line-height: 1.1; letter-spacing: -.025em; margin-bottom: 1.5rem; }
.auth-brand .desc { color: rgba(255,255,255,.5); font-size: 1rem; line-height: 1.6; max-width: 20rem; }
.auth-brand .divider { width: 3rem; height: 1px; background: var(--emerald-500); margin-bottom: 2rem; }
.auth-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.auth-stats .v { color: #fff; font-size: 1.5rem; font-weight: 900; letter-spacing: -.02em; margin-bottom: .25rem; }
.auth-stats .l { color: rgba(255,255,255,.4); font-size: .75rem; line-height: 1.3; }
.auth-form { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 3rem 2rem; background: #fff; }
@media (min-width: 768px){ .auth-form { padding: 3rem 4rem; } }
.auth-form .inner { max-width: 24rem; width: 100%; margin-inline: auto; }
.auth-form h1 { color: #000; font-size: 1.875rem; font-weight: 900; letter-spacing: -.025em; line-height: 1.2; margin-bottom: .5rem; }
.auth-form .sub { color: var(--gray-400); font-size: .875rem; margin-bottom: 2.5rem; }
.auth-mobile-logo { display: none; }
@media (max-width: 767px){ .auth-mobile-logo { display: flex; align-items: center; gap: .5rem; margin-bottom: 2.5rem; font-weight: 700; } .auth-mobile-logo svg { color: var(--emerald-500); width: 24px; height: 24px; } }
.auth-alt { margin-top: 2rem; font-size: .875rem; color: var(--gray-400); text-align: center; }
.auth-alt a { color: #000; font-weight: 600; }
.auth-alt a:hover { text-decoration: underline; }

/* Auth centralizado (ativar / recuperar / redefinir / paywall / erro) */
.auth-simple { min-height: 100vh; display: grid; place-items: center; padding: 2rem 1.25rem;
  background: radial-gradient(1000px 400px at 50% -5%, rgba(16,185,129,.06), transparent 60%), var(--bg); }
.auth-simple .box { width: 100%; max-width: 400px; }
.auth-simple .logo { display: flex; justify-content: center; align-items: center; gap: .5rem; margin-bottom: 1.5rem; font-weight: 700; font-size: 1.4rem; letter-spacing: -.02em; }
.auth-simple .logo svg { color: var(--emerald-500); width: 30px; height: 30px; }
.auth-simple h1 { font-size: 1.5rem; font-weight: 900; letter-spacing: -.02em; margin-bottom: .35rem; }
.auth-simple .sub { color: var(--gray-500); font-size: .9rem; margin-bottom: 1.5rem; }

/* ============================================================
   Biblioteca (grid de cards)
   ============================================================ */
.lib-grid { display: grid; grid-template-columns: 1fr; gap: 1.5rem; }
@media (min-width: 768px){ .lib-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1024px){ .lib-grid { grid-template-columns: 1fr 1fr 1fr; } }
.lib-card { background: #fff; border-radius: 24px; padding: 1.5rem; box-shadow: 0 1px 2px rgba(0,0,0,.04); border: 1px solid var(--gray-100); display: flex; flex-direction: column; transition: transform .15s ease; }
.lib-card:hover { transform: translateY(-4px); }
.lib-card h3 { font-size: 1.25rem; font-weight: 700; color: var(--gray-900); margin: 0 0 .5rem; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lib-card .meta { display: flex; align-items: center; gap: .5rem; font-size: .875rem; color: var(--gray-500); margin-top: .5rem; }
.lib-card .meta svg { width: 16px; height: 16px; }
.lib-card .foot { margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid var(--gray-100); }
.lib-card .view { display: block; text-align: center; padding: .625rem; background: var(--gray-50); border-radius: 12px; font-weight: 500; color: var(--gray-900); transition: background .15s ease; }
.lib-card .view:hover { background: var(--gray-100); }
.icon-del { color: var(--gray-400); background: none; border: none; cursor: pointer; transition: color .15s ease; }
.icon-del:hover { color: var(--red-500); }
.empty-box { text-align: center; padding: 5rem 1rem; background: #fff; border-radius: 24px; border: 1px solid var(--gray-100); }
.empty-box svg { width: 48px; height: 48px; color: var(--gray-300); margin: 0 auto 1rem; }
.empty-box h3 { font-size: 1.125rem; font-weight: 500; color: var(--gray-900); }
.empty-box p { color: var(--gray-500); margin: .25rem 0 1.5rem; }

/* ============================================================
   Documento da atividade
   ============================================================ */
.doc { max-width: 56rem; margin-inline: auto; background: #fff; min-height: 100vh; box-shadow: 0 20px 50px rgba(0,0,0,.1); }
.doc-bar { position: sticky; top: 0; z-index: 10; background: rgba(255,255,255,.8); backdrop-filter: blur(8px); border-bottom: 1px solid var(--gray-200); padding: .75rem; display: flex; align-items: center; justify-content: space-between; }
@media (min-width: 768px){ .doc-bar { padding: 1rem; } }
.doc-bar .back { display: flex; align-items: center; gap: .375rem; color: var(--gray-600); font-weight: 500; font-size: .875rem; }
.doc-bar .back:hover { color: #000; }
.doc-body { padding: 2.5rem; }
@media (min-width: 768px){ .doc-body { padding: 4rem; } }
.doc-header { margin-bottom: 3rem; border-bottom: 2px solid #000; padding-bottom: 2rem; }
.doc-header h1 { font-size: 2.25rem; font-weight: 900; letter-spacing: -.025em; color: #000; margin-bottom: .5rem; }
.doc-header .sub { font-size: 1.125rem; color: var(--gray-600); font-weight: 500; }
.bncc-box { display: inline-block; border: 2px solid #000; padding: .25rem .75rem; font-family: var(--mono); font-size: .875rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; }
.student-block { display: grid; grid-template-columns: 1fr; gap: 1rem; margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--gray-200); }
@media (min-width: 768px){ .student-block { grid-template-columns: 2fr 1fr; } }
.student-block label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--gray-500); display: block; margin-bottom: .25rem; }
.write-line { width: 100%; border: none; border-bottom: 1px solid var(--gray-300); padding: .5rem 0; background: transparent; }
.write-line:focus { outline: none; border-color: #000; }
.bncc-skill { margin-bottom: 2.5rem; background: var(--gray-50); padding: 1.5rem; border-radius: 16px; }
.bncc-skill h3 { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--gray-500); margin-bottom: .5rem; }
.bncc-skill p { font-size: .875rem; color: var(--gray-800); line-height: 1.6; }
.questions-title { font-size: 1.5rem; font-weight: 900; letter-spacing: -.02em; border-bottom: 1px solid var(--gray-200); padding-bottom: 1rem; margin-bottom: 2rem; }
.question { display: flex; gap: 1rem; margin-bottom: 3rem; }
.question .qn { font-size: 1.25rem; font-weight: 900; }
.question .qbody { flex: 1; }
.question .qtext { font-weight: 500; color: var(--gray-900); line-height: 1.6; margin-bottom: 1rem; }
.opt { display: flex; align-items: flex-start; gap: .75rem; padding: .75rem; border-radius: 12px; border: 1px solid transparent; margin-bottom: .5rem; }
.opt .ol { font-weight: 700; color: var(--gray-500); }
.opt .otext { color: var(--gray-800); }
/* Destaque da alternativa correta só quando o gabarito está visível */
.doc.show-answers .opt.correct { background: var(--emerald-50); border-color: var(--emerald-100); }
.doc.show-answers .opt.correct .ol { color: var(--emerald-600); }
.doc.show-answers .opt.correct .otext { font-weight: 600; color: var(--emerald-900); }
.opt-check { margin-left: auto; color: var(--emerald-500); display: none; }
.doc.show-answers .opt.correct .opt-check { display: block; }
.answer-box, .answer-expected { display: none; }
.doc.show-answers .answer-box, .doc.show-answers .answer-expected { display: block; }
.answer-box { margin-top: 1rem; padding: 1rem; background: var(--gray-50); border-left: 4px solid #000; border-radius: 0 12px 12px 0; }
.answer-box h4 { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--gray-500); margin-bottom: .25rem; }
.answer-box p { font-size: .875rem; color: var(--gray-800); }
.answer-expected { margin-top: 1rem; padding: 1rem; background: var(--emerald-50); border: 1px solid var(--emerald-100); border-radius: 12px; }
.answer-expected h4 { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--emerald-800); margin-bottom: .5rem; }
.answer-expected p { color: var(--emerald-900); }
.write-area { width: 100%; border: none; outline: none; resize: none; min-height: 12rem; padding-top: .5rem; background-image: repeating-linear-gradient(transparent, transparent 31px, #d1d5db 31px, #d1d5db 32px); background-size: 100% 32px; line-height: 32px; }

/* Prose (markdown) */
.prose { line-height: 1.7; color: var(--gray-800); margin-bottom: 4rem; }
.prose h1, .prose h2, .prose h3 { font-weight: 900; letter-spacing: -.02em; color: #000; margin: 1.75rem 0 .75rem; }
.prose h1 { font-size: 1.5rem; } .prose h2 { font-size: 1.25rem; } .prose h3 { font-size: 1.125rem; }
.prose p { margin: .9rem 0; } .prose ul, .prose ol { margin: 1rem 0 1rem 1.5rem; } .prose li { margin: .35rem 0; }
.prose strong { color: #000; font-weight: 700; }

/* ============================================================
   Stat cards (admin) + tabela
   ============================================================ */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); gap: 1rem; }
.stat { background: #fff; border: 1px solid var(--gray-100); border-radius: 16px; padding: 1.5rem; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.stat .k { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--gray-400); }
.stat .v { font-size: 1.875rem; font-weight: 900; color: var(--gray-900); letter-spacing: -.02em; margin-top: .5rem; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--gray-400); padding: .75rem; border-bottom: 2px solid var(--gray-100); }
.table td { padding: .875rem .75rem; border-bottom: 1px solid var(--gray-100); font-size: .9rem; }

/* ---------- Spinner ---------- */
.spinner { width: 32px; height: 32px; border: 3px solid var(--gray-200); border-bottom-color: #000; border-radius: 50%; animation: spin 1s linear infinite; }
.spinner-sm { width: 16px; height: 16px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.gen-loading { display: none; flex-direction: column; align-items: center; gap: 1rem; text-align: center; padding: 2rem; }
.gen-loading.on { display: flex; }

/* ---------- Animação de entrada ---------- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.fade-up { animation: fadeUp .4s ease both; }

/* ---------- Páginas legais (termos / privacidade) ---------- */
.legal { max-width: 760px; margin-inline: auto; padding: clamp(2rem, 6vw, 4rem) 1.25rem 4rem; }
.legal .legal-logo { display: flex; align-items: center; gap: .5rem; font-weight: 800; font-size: 1.3rem; letter-spacing: -.02em; margin-bottom: 2rem; }
.legal .legal-logo svg { color: var(--emerald-500); width: 26px; height: 26px; }
.legal h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); font-weight: 900; letter-spacing: -.025em; margin-bottom: .4rem; }
.legal .updated { color: var(--gray-400); font-size: .85rem; margin-bottom: 2rem; }
.legal h2 { font-size: 1.15rem; font-weight: 800; margin: 2rem 0 .6rem; }
.legal p, .legal li { color: var(--gray-700); line-height: 1.7; }
.legal p { margin: .7rem 0; }
.legal ul { margin: .7rem 0 .7rem 1.3rem; }
.legal li { margin: .35rem 0; }
.legal a { color: var(--emerald-600); font-weight: 600; }
.legal .back-link { display: inline-block; margin-top: 2.5rem; color: var(--gray-500); font-weight: 600; }

/* ---------- CTA de reporte (fim da atividade) ---------- */
.report-cta { margin-top: 3rem; padding: 1.5rem; border-radius: 16px; background: var(--gray-50); border: 1px solid var(--gray-100); text-align: center; }
.report-cta p { color: var(--gray-600); font-size: .95rem; margin-bottom: 1rem; }
.report-cta .row { justify-content: center; flex-wrap: wrap; }

/* ---------- Modal ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: none; align-items: center; justify-content: center; z-index: 100; padding: 1rem; }
.modal-overlay.on { display: flex; }
.modal { background: #fff; border-radius: 20px; max-width: 460px; width: 100%; padding: 1.75rem; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal h3 { font-size: 1.2rem; font-weight: 800; letter-spacing: -.02em; margin-bottom: .3rem; }
.modal .msub { color: var(--gray-500); font-size: .9rem; margin-bottom: 1.25rem; }
.modal .modal-foot { display: flex; gap: .6rem; justify-content: flex-end; margin-top: 1.25rem; }

/* ============================================================
   Impressão (do index.css original do Educa.ai)
   ============================================================ */
/* A margem vem do @page → o navegador a aplica em TODAS as folhas.
   (padding no body só criaria margem na 1ª e na última página.) */
@page { margin: 1.8cm; size: A4 portrait; }

@media print {
  html, body {
    background: #fff !important; color: #000;
    margin: 0 !important; padding: 0 !important;
  }
  /* Nada de interface na impressão */
  .no-print, .sidebar, .topbar, .bottomnav, .doc-bar,
  .report-cta, .modal-overlay { display: none !important; }

  /* Dissolve o "papel" (.doc) e os contêineres: sem moldura, sem sombra,
     sem altura mínima, sem largura fixa — só o conteúdo fluindo. Assim a
     margem de cada folha é dada pelo @page, e não por uma caixa que
     atravessa as páginas. */
  .shell, .main, .doc, .doc-body {
    display: block !important;
    margin: 0 !important; padding: 0 !important;
    max-width: none !important; width: auto !important;
    min-height: 0 !important; height: auto !important;
    background: transparent !important; box-shadow: none !important;
    border: none !important; border-radius: 0 !important; overflow: visible !important;
  }

  /* Os exercícios sempre começam em uma folha nova */
  .questions-title { break-before: page; page-break-before: always; }
  /* Uma questão nunca é partida entre duas folhas */
  .question, .bncc-skill, .print-break-inside-avoid {
    break-inside: avoid; page-break-inside: avoid;
  }

  /* Impressão limpa (sem realce colorido do gabarito) */
  .opt.correct { background: transparent !important; border: none !important; }
  .answer-box, .answer-expected, .bncc-skill {
    background: transparent !important;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
}

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