/* Estágio Simulado — sistema visual (mesma linguagem do Motor de Correção) */
:root {
  --bg: #F5F4F0; --surface: #FFFFFF; --surface-2: #FAF9F6;
  --ink: #15171C; --ink-2: #3C414B; --muted: #6B707A; --faint: #9A9EA6;
  --line: #E5E2DA; --line-2: #EFEDE7;
  --accent: #23395B; --accent-ink: #FFFFFF; --accent-soft: #E9EDF4;
  --ok: #2F6B4F; --ok-soft: #E6F0EA; --warn: #8F6418; --warn-soft: #F6EEDC; --bad: #9C3A35; --bad-soft: #F5E5E3;
  --focus: 0 0 0 3px rgba(35, 57, 91, .18);
  --shadow: 0 1px 2px rgba(20, 22, 28, .04), 0 4px 16px rgba(20, 22, 28, .04);
  --radius: 10px; --radius-s: 7px;
  --sans: "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Roboto, system-ui, sans-serif;
  --display: "Segoe UI Variable Display", "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", system-ui, sans-serif;
  --serif: "Times New Roman", Times, "Liberation Serif", serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121418; --surface: #191C21; --surface-2: #1D2026; --ink: #ECEDEF; --ink-2: #C9CCD2; --muted: #9298A3; --faint: #6C727C;
    --line: #2A2E36; --line-2: #23272E; --accent: #9DB5DA; --accent-ink: #10141B; --accent-soft: #1F2836;
    --ok: #7FC4A0; --ok-soft: #18291F; --warn: #DDB66B; --warn-soft: #2B2416; --bad: #E39088; --bad-soft: #2E1C1B;
    --focus: 0 0 0 3px rgba(157, 181, 218, .25); --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--ink); font: 14px/1.5 var(--sans); -webkit-font-smoothing: antialiased; font-feature-settings: "tnum" 1; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--accent); }
[hidden] { display: none !important; }

/* ---------- elementos */
.cartao { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: var(--radius-s); padding: 8px 15px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); font-weight: 500; transition: background .15s, border-color .15s, filter .15s; white-space: nowrap; text-decoration: none; color: var(--ink); }
.btn:hover { background: var(--surface-2); }
.btn:focus-visible { outline: none; box-shadow: var(--focus); }
.btn.primario { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.primario:hover { filter: brightness(1.12); background: var(--accent); }
.btn.perigo { color: var(--bad); }
.btn.leve { border-color: transparent; background: transparent; color: var(--muted); }
.btn.leve:hover { background: var(--line-2); color: var(--ink); }
.btn.grande { padding: 11px 20px; font-size: 15px; }
.btn.pequeno { padding: 4px 10px; font-size: 12.5px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn svg, .ic { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
input[type=text], input[type=password], input[type=number], input[type=datetime-local], input[type=search], select, textarea {
  width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-s); padding: 9px 12px; outline: none; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: var(--focus); }
textarea { resize: vertical; min-height: 80px; }
.campo { display: flex; flex-direction: column; gap: 6px; }
.campo label { font-size: 12.5px; color: var(--ink-2); font-weight: 500; }
.campo small { color: var(--faint); font-size: 12px; }
.grade { display: grid; gap: 16px 18px; grid-template-columns: repeat(6, 1fr); }
.c2 { grid-column: span 2; } .c3 { grid-column: span 3; } .c4 { grid-column: span 4; } .c6 { grid-column: span 6; }
.selo { display: inline-block; font-size: 11.5px; padding: 2px 9px; border-radius: 20px; font-weight: 600; white-space: nowrap; }
.s-ok { background: var(--ok-soft); color: var(--ok); } .s-warn { background: var(--warn-soft); color: var(--warn); }
.s-bad { background: var(--bad-soft); color: var(--bad); } .s-info { background: var(--accent-soft); color: var(--accent); }
.s-neutro { background: var(--line-2); color: var(--muted); }
.muted { color: var(--muted); } .faint { color: var(--faint); }
.vazio { color: var(--faint); text-align: center; padding: 48px 20px; }
.giro { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent); animation: giro .8s linear infinite; flex: none; }
@keyframes giro { to { transform: rotate(360deg); } }
@keyframes surgir { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--bg); padding: 10px 16px;
  border-radius: 8px; font-size: 13px; opacity: 0; transition: all .25s; pointer-events: none; z-index: 100; max-width: min(560px, 90vw); text-align: center; }
.toast.visivel { opacity: 1; transform: translateX(-50%); }
.toast.erro { background: var(--bad); color: #fff; }

/* ---------- entrada (login) */
.entrada { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.entrada-marca { background: var(--accent); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between;
  background-image: repeating-linear-gradient(0deg, rgba(255,255,255,.035) 0 1px, transparent 1px 7px); }
.entrada-marca .simbolo { width: 44px; height: 44px; border-radius: 11px; background: #fff; color: var(--accent); display: grid; place-items: center; font: 600 24px/1 Georgia, serif; }
.entrada-marca h1 { font: 600 34px/1.15 var(--display); letter-spacing: -.02em; margin: 26px 0 10px; }
.entrada-marca p { color: rgba(255,255,255,.72); max-width: 380px; margin: 0; }
.entrada-marca small { color: rgba(255,255,255,.5); }
.entrada-form { display: grid; place-items: center; padding: 40px 24px; }
.entrada-caixa { width: min(380px, 100%); animation: surgir .25s ease; }
.entrada-caixa h2 { font: 600 24px/1.2 var(--display); letter-spacing: -.01em; margin: 0 0 6px; }
.entrada-caixa > p { color: var(--muted); margin: 0 0 26px; }
.entrada-caixa .campo { margin-bottom: 16px; }
.entrada-caixa .btn.primario { width: 100%; margin-top: 6px; }
.entrada-rodape { margin-top: 26px; font-size: 13px; color: var(--muted); text-align: center; }
.entrada-rodape a { cursor: pointer; }
.opcoes-turma { display: grid; gap: 8px; margin-bottom: 18px; }
.opcao { text-align: left; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface); cursor: pointer; }
.opcao:hover { border-color: var(--accent); background: var(--surface-2); }
.opcao b { display: block; } .opcao span { font-size: 12.5px; color: var(--muted); }
.erro-msg { color: var(--bad); font-size: 13px; background: var(--bad-soft); border-radius: var(--radius-s); padding: 9px 12px; margin-bottom: 14px; }
.voltar { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0; margin-bottom: 18px; font-size: 13px; display: inline-flex; gap: 6px; align-items: center; }

/* ---------- casca (aluno e professor) */
.casca { min-height: 100vh; display: flex; flex-direction: column; }
.topo { display: flex; align-items: center; gap: 18px; padding: 0 28px; height: 60px; border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 10; }
.topo .marca { display: flex; align-items: center; gap: 10px; font: 600 14.5px var(--display); }
.topo .marca i { width: 28px; height: 28px; border-radius: 7px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font: 600 15px/1 Georgia, serif; font-style: normal; }
.topo nav { display: flex; gap: 4px; margin-left: 18px; }
.topo nav a { padding: 7px 12px; border-radius: var(--radius-s); text-decoration: none; color: var(--ink-2); font-weight: 500; }
.topo nav a:hover { background: var(--line-2); }
.topo nav a.ativo { background: var(--accent-soft); color: var(--accent); }
.topo .usuario { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); }
.topo .usuario b { color: var(--ink); font-weight: 600; }
.pagina { max-width: 1180px; width: 100%; margin: 0 auto; padding: 34px 28px 80px; animation: surgir .25s ease; }
.cab { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.cab h1 { font: 600 26px/1.15 var(--display); letter-spacing: -.02em; margin: 0 0 6px; }
.cab p { margin: 0; color: var(--muted); }
.secao { font: 600 11.5px/1 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 30px 0 12px; }

/* lista de simulados do aluno */
.simulados { display: grid; gap: 14px; }
.sim { padding: 20px 22px; display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: center; }
.sim h3 { font: 600 17px/1.3 var(--display); margin: 0 0 4px; }
.sim .meta { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 13px; margin-top: 6px; }
.sim .meta span { display: inline-flex; gap: 6px; align-items: center; }
.sim .acoes { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.sim .nota { font: 600 26px/1 var(--display); }
.sim .nota small { font: 500 13px var(--sans); color: var(--faint); }

/* tabelas */
.tabela { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tabela th { text-align: left; font-size: 11.5px; color: var(--muted); font-weight: 600; letter-spacing: .05em; text-transform: uppercase; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); position: sticky; top: 0; z-index: 1; }
.pagina .tabela th { top: 60px; }
.tabela td { padding: 11px 16px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tabela tr:last-child td { border-bottom: 0; }
.tabela tr:hover td { background: var(--surface-2); }
.tabela .sub { color: var(--muted); font-size: 12px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.barra-ferr { display: flex; gap: 10px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.barra-ferr input[type=search] { max-width: 280px; }
.barra-ferr select { width: auto; }
.contadores { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.contador { padding: 14px 18px; min-width: 140px; }
.contador b { display: block; font: 600 24px/1.1 var(--display); }
.contador span { font-size: 12px; color: var(--muted); }
.nota-input { width: 72px !important; text-align: right; padding: 5px 8px !important; }

/* formulários do professor */
.painel-form { padding: 22px; }
.turmas-check { display: flex; flex-wrap: wrap; gap: 8px; }
.turmas-check label { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 20px; padding: 6px 12px; cursor: pointer; font-size: 13px; }
.turmas-check input { accent-color: var(--accent); }
.docs-lista { display: grid; gap: 8px; margin-top: 12px; }
.doc-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface-2); }
.doc-item .nome { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.soltar { border: 1.5px dashed var(--line); border-radius: var(--radius); padding: 26px; text-align: center; color: var(--muted); cursor: pointer; transition: border-color .15s, background .15s; }
.soltar:hover, .soltar.sobre { border-color: var(--accent); background: var(--surface-2); color: var(--accent); }
.chave { position: relative; width: 38px; height: 22px; flex: none; display: inline-block; }
.chave input { opacity: 0; width: 0; height: 0; }
.chave span { position: absolute; inset: 0; background: var(--line); border-radius: 22px; cursor: pointer; transition: background .2s; }
.chave span::after { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.chave input:checked + span { background: var(--accent); }
.chave input:checked + span::after { transform: translateX(16px); }
.linha-acoes { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }

/* modal */
.modal-fundo { position: fixed; inset: 0; background: rgba(15, 17, 22, .45); display: grid; place-items: center; z-index: 50; padding: 24px; animation: surgir .15s ease; }
.modal { width: min(560px, 100%); max-height: calc(100vh - 48px); overflow: auto; padding: 24px; }
.modal.largo { width: min(980px, 100%); }
.modal h2 { font: 600 19px/1.25 var(--display); margin: 0 0 8px; }
.modal p { color: var(--muted); margin: 0 0 16px; }
.modal iframe { width: 100%; height: 62vh; border: 1px solid var(--line); border-radius: var(--radius-s); background: #fff; }

/* ---------- PROVA (tela dividida) */
.prova { height: 100vh; display: grid; grid-template-rows: 56px 1fr; overflow: hidden; }
.prova-topo { display: flex; align-items: center; gap: 16px; padding: 0 18px; border-bottom: 1px solid var(--line); background: var(--surface); }
.prova-topo .titulo { font: 600 14.5px var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prova-topo .titulo small { display: block; font: 400 12px var(--sans); color: var(--muted); }
.relogio { margin-left: auto; display: flex; align-items: center; gap: 10px; padding: 6px 14px; border-radius: 20px; background: var(--surface-2); border: 1px solid var(--line); font: 600 16px var(--display); font-variant-numeric: tabular-nums; }
.relogio.alerta { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.relogio.critico { background: var(--bad-soft); color: var(--bad); border-color: transparent; animation: pulsar 1s ease-in-out infinite; }
@keyframes pulsar { 50% { opacity: .65; } }
.salvamento { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.salvamento i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); display: inline-block; }
.salvamento.offline i { background: var(--warn); }
.prova-corpo { display: grid; grid-template-columns: var(--esq, 50%) 6px 1fr; min-height: 0; }
.docs { display: grid; grid-template-rows: auto 1fr; min-height: 0; background: var(--surface-2); }
.docs-abas { display: flex; gap: 2px; padding: 8px 10px 0; border-bottom: 1px solid var(--line); overflow-x: auto; background: var(--surface); }
.doc-aba { border: 1px solid transparent; border-bottom: 0; background: none; padding: 8px 14px; border-radius: 7px 7px 0 0; cursor: pointer; color: var(--muted); font-size: 13px; white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.doc-aba.ativa { background: var(--surface-2); border-color: var(--line); color: var(--ink); font-weight: 600; margin-bottom: -1px; }
.docs-abas { overflow-y: hidden; }
.visor-pdf { display: grid; grid-template-rows: auto 1fr; min-height: 0; background: #DCDAD4; }
.pdf-ferr { display: flex; align-items: center; gap: 4px; padding: 6px 12px; background: var(--surface); border-bottom: 1px solid var(--line); font-size: 12.5px; }
.pdf-ferr span:first-of-type { min-width: 44px; text-align: center; font-variant-numeric: tabular-nums; }
.pdf-ferr .faint { margin-left: auto; }
.pdf-paginas { overflow: auto; padding: 20px; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.pdf-paginas canvas { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 6px 20px rgba(0,0,0,.08); }
.folha .ql-editor h1 { font-size: 12pt; font-weight: bold; text-align: center; margin: 1em 0 .6em; }
.folha .ql-editor h2 { font-size: 12pt; font-weight: bold; margin: 1em 0 .6em; }
.docs .carregando { display: grid; place-items: center; color: var(--muted); gap: 10px; }
.divisor { background: var(--line); cursor: col-resize; position: relative; }
.divisor::after { content: ""; position: absolute; top: 50%; left: 1px; width: 4px; height: 36px; margin-top: -18px; border-radius: 4px; background: var(--faint); opacity: .5; }
.divisor:hover, .divisor.arrastando { background: var(--accent); }
.editor-lado { display: grid; grid-template-rows: auto 1fr; min-height: 0; background: #E9E7E1; }
.editor-lado .ql-toolbar.ql-snow { border: 0; border-bottom: 1px solid var(--line); background: var(--surface); padding: 8px 12px; font-family: var(--sans); }
.editor-lado .ql-container.ql-snow { border: 0; overflow: auto; font-family: var(--serif); }
.folha-rolagem { overflow: auto; padding: 28px 0 80px; }
.folha { width: min(794px, calc(100% - 40px)); min-height: 1123px; margin: 0 auto; background: #fff; color: #111; box-shadow: 0 1px 3px rgba(0,0,0,.08), 0 8px 30px rgba(0,0,0,.06); }
.folha .ql-editor { padding: 96px 76px 96px 113px; font: 12pt/1.5 var(--serif); min-height: 1123px; text-align: justify; }
.folha .ql-editor p { margin: 0 0 .6em; }
.folha .ql-editor.ql-blank::before { left: 113px; right: 76px; font-style: normal; color: #A0A0A0; }
.prova-bloqueada .ql-toolbar { opacity: .4; pointer-events: none; }
.faixa { padding: 9px 18px; font-size: 13px; text-align: center; }
.faixa.aviso { background: var(--warn-soft); color: var(--warn); }
.faixa.erro { background: var(--bad-soft); color: var(--bad); }
.entregue-tela { display: grid; place-items: center; min-height: 100vh; padding: 24px; }
.entregue-caixa { max-width: 520px; text-align: center; padding: 44px; }
.entregue-caixa .icone { width: 60px; height: 60px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: grid; place-items: center; margin: 0 auto 18px; }
.entregue-caixa .icone svg { width: 28px; height: 28px; stroke-width: 2.2; }
.entregue-caixa h2 { font: 600 22px/1.2 var(--display); margin: 0 0 8px; }
.entregue-caixa p { color: var(--muted); }

@media (max-width: 860px) {
  .entrada { grid-template-columns: 1fr; } .entrada-marca { display: none; }
  .prova-corpo { grid-template-columns: 1fr; grid-template-rows: 40% 6px 1fr; }
  .grade { grid-template-columns: 1fr; } .c2, .c3, .c4, .c6 { grid-column: span 1; }
  .topo nav { display: none; }
}
