/* Passo 365 — Simulados (Pedagógico). Porta pra vanilla JS do protótipo
   "Montador de Simulado.dc.html" (claude.ai/design, projeto
   87e66fd8-7a08-446c-9529-dfea8025635f). O protótipo tem cores próprias
   (fundo cru, azul #2F4DB0); aqui elas viram --sm-* apontando pros tokens do
   style.css, então tema escuro e ajustes de marca valem pro módulo sem
   manutenção dobrada. A exceção é a FOLHA (a prova em si, .sm-folha): papel
   branco e tinta preta nos dois temas, porque é o que sai na impressora. */

.sm {
  --sm-surface: var(--bg-card);
  --sm-surface-2: var(--bg-input);
  --sm-bg: var(--bg-page);
  --sm-line: var(--border);
  --sm-line-soft: var(--border-soft);
  --sm-line-strong: var(--border-strong);
  --sm-text: var(--slate-900);
  --sm-soft: var(--slate-700);
  --sm-muted: var(--slate-500);
  --sm-accent: var(--primary);
  --sm-on-accent: var(--on-primary);
  --sm-accent-soft: var(--blue-50);
  --sm-accent-line: var(--blue-100);
  --sm-accent-ink: var(--blue-700);
  --sm-ok: #1E6B45;
  --sm-ok-bg: #E3F0E8;
  --sm-ok-line: #BFDCC9;
  --sm-warn: #7A4A00;
  --sm-warn-bg: #F6E7C8;
  --sm-danger: #8C1D18;
  --sm-danger-bg: #FBE9E7;
  --sm-strong: var(--brand-navy);
  --sm-on-strong: #fff;
  color: var(--sm-text);
  font-size: 14px;
  line-height: 1.5;
}
:root[data-theme="dark"] .sm {
  --sm-ok: #7FD3A1;
  --sm-ok-bg: #16301F;
  --sm-ok-line: #245A38;
  --sm-warn: #F2D77A;
  --sm-warn-bg: #3A3217;
  --sm-danger: #F3A29E;
  --sm-danger-bg: #3A1D22;
  --sm-strong: var(--brand-yellow);
  --sm-on-strong: #14263F;
}

@keyframes sm-spin { to { transform: rotate(360deg); } }
@keyframes sm-fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.sm--entrando > * { animation: sm-fade .22s ease both; }

/* ---------------- Tipografia ---------------- */
.sm h1, .sm h2, .sm h3 { margin: 0; line-height: 1.25; }
.sm h1 { font-family: var(--font-serif); font-weight: 600; font-size: 25px; letter-spacing: -.01em; }
.sm h2 { font-size: 19px; font-weight: 600; }
.sm h3 { font-size: 14px; font-weight: 600; }
.sm-sub { margin: 4px 0 0; font-size: 13.5px; color: var(--sm-muted); text-wrap: pretty; max-width: 72ch; }
.sm-muted { color: var(--sm-muted); }
.sm-eyebrow { font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--sm-muted); }
.sm-mono { font-family: var(--font-mono); font-size: 12px; }
.sm-serif { font-family: 'Source Serif 4', var(--font-serif), Georgia, serif; }
.sm-pre { white-space: pre-line; }

/* ---------------- Botões, chips, segmentos ---------------- */
.sm-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px; font: inherit; font-size: 13.5px; font-weight: 500; color: var(--sm-text); background: var(--sm-surface); border: 1px solid var(--sm-line-strong); border-radius: var(--radius); cursor: pointer; white-space: nowrap; text-decoration: none; }
.sm-btn:hover { background: var(--sm-surface-2); color: var(--sm-text); }
.sm-btn:disabled { opacity: .5; cursor: not-allowed; }
.sm-btn--sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.sm-btn--xs { height: 26px; padding: 0 8px; font-size: 12px; }
.sm-btn--primary { background: var(--sm-accent); color: var(--sm-on-accent); border-color: var(--sm-accent); }
.sm-btn--primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--sm-on-accent); }
.sm-btn--strong { background: var(--sm-strong); color: var(--sm-on-strong); border-color: var(--sm-strong); }
.sm-btn--strong:hover { background: var(--sm-strong); color: var(--sm-on-strong); opacity: .9; }
.sm-btn--soft { background: var(--sm-accent-soft); color: var(--sm-accent-ink); border-color: var(--sm-accent-line); }
.sm-btn--soft:hover { background: var(--sm-accent-line); color: var(--sm-accent-ink); }
.sm-btn--ok { background: var(--sm-ok); color: #fff; border-color: var(--sm-ok); }
.sm-btn--ok:hover { background: var(--sm-ok); color: #fff; opacity: .9; }
.sm-btn--ok-soft { background: var(--sm-ok-bg); color: var(--sm-ok); border-color: var(--sm-ok-line); }
.sm-btn--ok-soft:hover { background: var(--sm-ok-bg); color: var(--sm-ok); }
.sm-btn--ghost { background: transparent; border-color: transparent; }
.sm-btn--ghost:hover { background: var(--sm-surface-2); }
.sm-btn--danger { background: transparent; border-color: transparent; color: var(--sm-danger); }
.sm-btn--danger:hover { background: var(--sm-danger-bg); color: var(--sm-danger); }
.sm-btn--link { background: none; border: 0; padding: 0; height: auto; color: var(--sm-muted); text-decoration: underline; font-weight: 400; }
.sm-btn--link:hover { background: none; color: var(--sm-text); }
.sm-btn .sm-spin { width: 12px; height: 12px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: sm-spin .8s linear infinite; }
.sm-spin { display: inline-block; width: 10px; height: 10px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: sm-spin .8s linear infinite; }
.sm-file { position: relative; overflow: hidden; }
.sm-file input[type="file"] { display: none; }

.sm-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.sm-chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px; font: inherit; font-size: 12.5px; color: var(--sm-text); background: var(--sm-surface); border: 1px solid var(--sm-line-strong); border-radius: 20px; cursor: pointer; white-space: nowrap; }
.sm-chip:hover { background: var(--sm-surface-2); }
.sm-chip.on { background: var(--sm-strong); color: var(--sm-on-strong); border-color: var(--sm-strong); }
.sm-chip--sm { height: 24px; padding: 0 9px; font-size: 12px; }

.sm-seg { display: inline-flex; background: var(--sm-surface-2); border: 1px solid var(--sm-line); border-radius: var(--radius); padding: 3px; gap: 2px; }
.sm-seg button { height: 26px; padding: 0 10px; font: inherit; font-size: 12.5px; font-weight: 500; color: var(--sm-text); background: transparent; border: 0; border-radius: var(--radius-sm); cursor: pointer; white-space: nowrap; }
.sm-seg button:hover { color: var(--sm-text); }
.sm-seg button.on { background: var(--sm-surface); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.sm-seg--mono button { font-family: var(--font-mono); font-size: 12px; }
.sm-stepper { display: inline-flex; align-items: center; border: 1px solid var(--sm-line-strong); border-radius: var(--radius); background: var(--sm-surface); }
.sm-stepper button { width: 28px; height: 28px; font: inherit; font-size: 15px; color: var(--sm-text); background: transparent; border: 0; cursor: pointer; }
.sm-stepper span { min-width: 22px; text-align: center; font-family: var(--font-mono); font-size: 12.5px; }
.sm-stepper--sm button { width: 24px; height: 24px; font-size: 14px; }
.sm-stepper--sm span { min-width: 44px; font-size: 12px; }

/* ---------------- Campos ---------------- */
.sm-field { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--sm-muted); min-width: 0; }
.sm-field--wide { grid-column: 1 / -1; }
.sm-field small { color: var(--slate-400); font-size: 11.5px; }
.sm-input, .sm-select, .sm-textarea { width: 100%; min-width: 0; font: inherit; font-size: 14px; color: var(--sm-text); background: var(--sm-surface); border: 1px solid var(--sm-line-strong); border-radius: var(--radius); padding: 8px 10px; }
.sm-input:focus-visible, .sm-select:focus-visible, .sm-textarea:focus-visible, .sm-btn:focus-visible, .sm-chip:focus-visible { outline: 2px solid var(--blue-600); outline-offset: 1px; }
.sm-textarea { resize: vertical; line-height: 1.5; }
.sm-textarea--serif { font-family: 'Source Serif 4', var(--font-serif), serif; min-height: 180px; }
.sm-input--busca { width: 240px; }
.sm-check { width: 15px; height: 15px; accent-color: var(--sm-accent); }

/* ---------------- Cartões, listas, badges ---------------- */
.sm-card { background: var(--sm-surface); border: 1px solid var(--sm-line); border-radius: var(--radius); }
.sm-card--pad { padding: 18px; }
.sm-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; border-radius: var(--radius-sm); padding: 3px 8px; white-space: nowrap; }
.sm-badge--neutro { background: var(--sm-surface-2); color: var(--sm-muted); }
.sm-badge--simulado, .sm-badge--info { background: var(--sm-accent-soft); color: var(--sm-accent-ink); }
.sm-badge--prova, .sm-badge--warn { background: var(--sm-warn-bg); color: var(--sm-warn); }
.sm-badge--tarefa, .sm-badge--ok { background: var(--sm-ok-bg); color: var(--sm-ok); }
.sm-badge--disc { background: var(--sm-surface-2); color: var(--sm-text); font-weight: 500; }
.sm-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; flex: none; }
.sm-vazio { margin: 0; padding: 28px; text-align: center; color: var(--sm-muted); font-size: 13.5px; }
.sm-erro { font-size: 13px; color: var(--sm-danger); }
.sm-aviso { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: var(--radius); background: var(--sm-warn-bg); color: var(--sm-warn); font-size: 13px; line-height: 1.45; }
.sm-aviso b { font-weight: 600; }
.sm-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sm-row--end { margin-left: auto; }
.sm-grow { flex: 1; min-width: 0; }
.sm-stack { display: flex; flex-direction: column; gap: 16px; }
.sm-stack--sm { gap: 8px; }
.sm-stack--md { gap: 12px; }

/* ---------------- Início ---------------- */
.sm-inicio { max-width: 1080px; display: flex; flex-direction: column; gap: 26px; }
.sm-novos { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.sm-novo { text-align: left; display: flex; flex-direction: column; gap: 8px; padding: 16px 18px; font: inherit; color: var(--sm-text); background: var(--sm-surface); border: 1px solid var(--sm-line); border-radius: var(--radius); cursor: pointer; }
.sm-novo:hover { border-color: var(--sm-strong); }
.sm-novo__top { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 600; white-space: nowrap; }
.sm-novo__plus { width: 28px; height: 28px; border-radius: var(--radius-sm); display: grid; place-items: center; font-size: 17px; font-weight: 500; }
.sm-novo__desc { font-size: 12.5px; color: var(--sm-muted); text-wrap: pretty; }
.sm-lista { background: var(--sm-surface); border: 1px solid var(--sm-line); border-radius: var(--radius); overflow-x: auto; }
.sm-lista__inner { min-width: 960px; }
.sm-lista__head, .sm-lista__row { display: grid; grid-template-columns: 84px minmax(240px, 1fr) 120px 92px 72px 170px 140px; gap: 14px; padding: 12px 18px; align-items: center; }
.sm-lista__head { padding: 10px 18px; border-bottom: 1px solid var(--sm-line); font-size: 11.5px; font-weight: 600; color: var(--sm-muted); text-transform: uppercase; letter-spacing: .04em; }
.sm-lista__row { border-bottom: 1px solid var(--sm-line-soft); font-size: 13.5px; cursor: pointer; }
.sm-lista__row:last-child { border-bottom: 0; }
.sm-lista__row:hover { background: var(--bg-hover); }
.sm-lista__titulo { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sm-lista__titulo b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sm-lista__titulo span { font-size: 12px; color: var(--sm-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sm-lista__acoes { display: flex; gap: 4px; justify-content: flex-end; }

/* ---------------- Editor: barra e grade ---------------- */
.sm-topbar { position: sticky; top: -30px; z-index: 4; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin: -30px -32px 22px; padding: 12px 32px; background: var(--sm-surface); border-bottom: 1px solid var(--sm-line); }
@media (max-width: 880px) { .sm-topbar { margin: -20px -20px 18px; padding: 10px 20px; top: -20px; } }
.sm-topbar__brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sm-topbar__mark { width: 30px; height: 30px; flex: none; border-radius: var(--radius-sm); background: var(--sm-strong); color: var(--sm-on-strong); display: grid; place-items: center; font-family: var(--font-serif); font-weight: 700; font-size: 16px; }
.sm-topbar__title { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.sm-topbar__title b { font-size: 13.5px; font-weight: 600; white-space: nowrap; }
.sm-topbar__title span { font-size: 12px; color: var(--sm-muted); max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sm-steps { display: flex; gap: 4px; flex-wrap: wrap; }
.sm-step { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px; font: inherit; font-size: 13.5px; font-weight: 500; color: var(--sm-text); background: transparent; border: 0; border-radius: var(--radius); cursor: pointer; }
.sm-step:hover { background: var(--sm-surface-2); }
.sm-step.on { background: var(--sm-strong); color: var(--sm-on-strong); }
.sm-step__n { font-family: var(--font-mono); font-size: 11.5px; opacity: .7; }
.sm-step__badge { font-size: 11px; font-weight: 600; background: var(--sm-warn-bg); color: var(--sm-warn); border-radius: 10px; padding: 1px 7px; }
.sm-topbar__right { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--sm-muted); }
.sm-status { font-size: 12px; color: var(--sm-muted); white-space: nowrap; }
.sm-status--erro { color: var(--sm-danger); font-weight: 600; }

.sm-editor { display: grid; gap: 20px; align-items: start; }
.sm-editor--etapas { grid-template-columns: minmax(0, 1fr); max-width: 1180px; }
.sm-editor--unica { grid-template-columns: minmax(360px, 1fr) minmax(360px, 1fr) minmax(460px, 1.05fr); }
.sm-editor__wrap--unica { overflow-x: auto; padding-bottom: 8px; }
.sm-col { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.sm-section { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.sm-section__head { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.sm-section__head > div:first-child { flex: 1; min-width: 220px; }
.sm-navrodape { max-width: 1180px; margin-top: 28px; display: flex; justify-content: space-between; gap: 12px; }

/* ---------------- Importar ---------------- */
.sm-drop { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 22px; text-align: center; cursor: pointer; background: var(--sm-surface-2); border: 1.5px dashed var(--sm-line-strong); border-radius: var(--radius); }
.sm-drop:hover, .sm-drop.sm-drop--over { border-color: var(--sm-accent); background: var(--sm-accent-soft); }
.sm-drop b { font-size: 14px; font-weight: 500; }
.sm-drop span { font-size: 12.5px; color: var(--sm-muted); }
.sm-drop .sm-lendo { color: var(--sm-accent-ink); }
.sm-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.sm-thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.sm-thumb { display: flex; flex-direction: column; gap: 3px; align-items: center; }
.sm-thumb__img { width: 84px; height: 64px; border: 1px solid var(--sm-line); border-radius: var(--radius-sm); background-color: var(--sm-surface-2); background-size: contain; background-repeat: no-repeat; background-position: center; }
.sm-thumb span { font-family: var(--font-mono); font-size: 10.5px; color: var(--sm-muted); }
.sm-arquivos { display: flex; flex-direction: column; }
.sm-arquivo { display: flex; align-items: center; gap: 12px; padding: 11px 16px; border-bottom: 1px solid var(--sm-line-soft); font-size: 13.5px; }
.sm-arquivo:last-child { border-bottom: 0; }
.sm-arquivo b { font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sm-arquivo .sm-mono { margin-left: auto; color: var(--sm-muted); white-space: nowrap; }

/* ---------------- Digitar questões (rascunhos) ---------------- */
.sm-rasc { display: flex; flex-direction: column; gap: 12px; padding: 16px 18px; }
.sm-rasc__head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sm-rasc__alt { display: flex; gap: 8px; align-items: center; }
.sm-input--serif { font-family: 'Source Serif 4', var(--font-serif), serif; padding: 7px 10px; }
.sm-textarea--bruto { font-family: 'Source Serif 4', var(--font-serif), serif; font-size: 15px; min-height: 110px; border: 1.5px dashed var(--sm-line-strong); background: var(--sm-surface-2); }
.sm-textarea--enun { font-size: 15px; min-height: 72px; }
.sm-letra--v { background: var(--sm-ok); color: #fff; border-color: var(--sm-ok); }
.sm-letra--f { background: var(--sm-danger); color: #fff; border-color: var(--sm-danger); }
.sm-btn--dashed { border-style: dashed; color: var(--sm-soft); font-weight: 400; }
.sm-tipo-chips { gap: 4px; margin-top: 2px; }
.sm-chip--xs { height: 20px; padding: 0 7px; font-size: 10.5px; }
.sm-prova-item .sm-tipo-chips { flex: none; margin-top: 0; gap: 2px; }
.sm-disp__num { font-family: var(--font-mono); font-size: 11.5px; color: var(--sm-muted); margin-right: 6px; }

/* ---------------- Revisão ---------------- */
.sm-q { display: flex; flex-direction: column; gap: 12px; padding: 18px 20px; }
.sm-q__meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12.5px; color: var(--sm-muted); }
.sm-q__meta .sm-row--end { display: flex; gap: 6px; }
.sm-apoio { font-family: 'Source Serif 4', var(--font-serif), serif; font-size: 14px; line-height: 1.55; color: var(--sm-soft); background: var(--sm-surface-2); border-radius: var(--radius); padding: 10px 14px; text-wrap: pretty; white-space: pre-line; }
.sm-q__img { width: 100%; height: 220px; border-radius: var(--radius); border: 1px solid var(--sm-line-soft); background-size: contain; background-repeat: no-repeat; background-position: left center; }
.sm-q__ph { height: 90px; border-radius: var(--radius); background: repeating-linear-gradient(45deg, var(--sm-surface-2), var(--sm-surface-2) 8px, var(--sm-line-soft) 8px, var(--sm-line-soft) 16px); display: grid; place-items: center; font-family: var(--font-mono); font-size: 11.5px; color: var(--sm-muted); text-align: center; padding: 0 12px; }
.sm-enunciado { margin: 0; font-family: 'Source Serif 4', var(--font-serif), serif; font-size: 15.5px; line-height: 1.55; text-wrap: pretty; white-space: pre-line; }
.sm-q .sm-textarea--edit { font-family: 'Source Serif 4', var(--font-serif), serif; font-size: 15px; border: 1.5px solid var(--sm-accent); min-height: 90px; }
.sm-alts { display: flex; flex-direction: column; gap: 4px; }
.sm-alts div { display: flex; gap: 10px; font-family: 'Source Serif 4', var(--font-serif), serif; font-size: 14.5px; line-height: 1.45; }
.sm-alts .sm-mono { color: var(--sm-muted); padding-top: 2px; min-width: 22px; }
.sm-gab { font-size: 12.5px; color: var(--sm-muted); }
.sm-gab b { font-family: var(--font-mono); font-weight: 500; color: var(--sm-text); }
.sm-sugs { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--sm-line-soft); padding-top: 12px; }
.sm-sug { display: flex; flex-direction: column; gap: 9px; padding: 12px 14px; border-radius: var(--radius); background: var(--sm-surface); border: 1px solid var(--sm-line-soft); }
.sm-sug--pend { background: var(--sm-surface-2); border-color: var(--sm-line); }
.sm-sug__head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.sm-sug__tipo { font-size: 11.5px; font-weight: 600; color: var(--sm-accent-ink); text-transform: uppercase; letter-spacing: .04em; }
.sm-sug__exp { font-size: 13px; color: var(--sm-muted); text-wrap: pretty; }
.sm-diff { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-family: 'Source Serif 4', var(--font-serif), serif; font-size: 14.5px; }
.sm-diff del { background: var(--sm-danger-bg); color: var(--sm-danger); padding: 2px 6px; border-radius: 4px; }
.sm-diff ins { background: var(--sm-ok-bg); color: var(--sm-ok); padding: 2px 6px; border-radius: 4px; text-decoration: none; }
.sm-sug__lista { display: flex; flex-direction: column; gap: 2px; font-family: 'Source Serif 4', var(--font-serif), serif; font-size: 14px; color: var(--sm-ok); }
.sm-sug__ref { font-family: 'Source Serif 4', var(--font-serif), serif; font-size: 14px; color: var(--sm-soft); background: var(--sm-surface); border-radius: var(--radius-sm); padding: 8px 10px; border: 1px solid var(--sm-line-soft); }
.sm-letras { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; color: var(--sm-muted); }
.sm-letra { width: 30px; height: 30px; border-radius: 50%; cursor: pointer; font-family: var(--font-mono); font-size: 12.5px; border: 1px solid var(--sm-line-strong); background: var(--sm-surface); color: var(--sm-text); }
.sm-letra.on { background: var(--sm-strong); color: var(--sm-on-strong); border-color: var(--sm-strong); }
.sm-sug__estado { font-size: 12.5px; color: var(--sm-muted); }
.sm-sug__estado--ok { color: var(--sm-ok); font-weight: 500; }

/* ---------------- Montagem ---------------- */
.sm-cab-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; padding: 16px; }
.sm-mont-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; align-items: start; }
.sm-mont-col { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.sm-mont-col__head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.sm-mont-col__head span { font-size: 12.5px; color: var(--sm-muted); }
.sm-grupo { display: flex; flex-direction: column; gap: 6px; }
.sm-grupo__titulo { display: flex; align-items: center; gap: 6px; padding-top: 4px; font-size: 12px; font-weight: 600; color: var(--sm-muted); text-transform: uppercase; letter-spacing: .04em; }
.sm-disp { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; background: var(--sm-surface); border: 1px solid var(--sm-line); border-radius: var(--radius); cursor: grab; }
.sm-disp:hover { border-color: var(--sm-line-strong); }
.sm-disp__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.sm-disp__resumo { font-family: 'Source Serif 4', var(--font-serif), serif; font-size: 14px; line-height: 1.4; text-wrap: pretty; }
.sm-disp__meta { font-size: 11.5px; color: var(--sm-muted); }
.sm-disp__meta em { font-style: normal; color: var(--sm-warn); }
.sm-add { flex: none; width: 28px; height: 28px; border-radius: var(--radius-sm); border: 1px solid var(--sm-line-strong); background: var(--sm-surface); color: var(--sm-text); cursor: pointer; font-size: 16px; line-height: 1; }
.sm-add:hover { background: var(--sm-strong); color: var(--sm-on-strong); border-color: var(--sm-strong); }
.sm-vazio--dashed { padding: 18px; font-size: 13px; border: 1px dashed var(--sm-line-strong); border-radius: var(--radius); }
.sm-toggle { display: flex; align-items: center; gap: 10px; padding: 0; font: inherit; text-align: left; color: var(--sm-text); background: transparent; border: 0; cursor: pointer; }
.sm-toggle__sw { flex: none; width: 34px; height: 20px; border-radius: 10px; position: relative; background: var(--sm-line-strong); transition: background .12s; }
.sm-toggle__sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .12s; }
.sm-toggle.on .sm-toggle__sw { background: var(--sm-strong); }
.sm-toggle.on .sm-toggle__sw::after { left: 16px; }
.sm-toggle__txt { display: flex; flex-direction: column; gap: 1px; }
.sm-toggle__txt b { font-size: 13px; font-weight: 500; }
.sm-toggle__txt span { font-size: 11.5px; color: var(--sm-muted); }
.sm-ordem { display: flex; flex-direction: column; gap: 4px; }
.sm-ordem__item { display: flex; align-items: center; gap: 10px; padding: 5px 6px 5px 8px; border-radius: var(--radius); background: var(--sm-surface-2); font-size: 13px; }
.sm-ordem__item .sm-mono { color: var(--sm-muted); min-width: 18px; }
.sm-ordem__item b { flex: 1; font-weight: 500; }
.sm-ordem__item span { font-size: 11.5px; color: var(--sm-muted); }
.sm-ordem__btn { width: 24px; height: 24px; border: 1px solid var(--sm-line-strong); border-radius: var(--radius-sm); background: var(--sm-surface); color: var(--sm-text); cursor: pointer; font-size: 10px; }
.sm-ordem__btn:disabled { opacity: .3; cursor: default; }
.sm-prova-box { display: flex; flex-direction: column; gap: 6px; min-height: 160px; padding: 8px; background: var(--sm-surface-2); border: 1px solid var(--sm-line); border-radius: var(--radius); }
.sm-prova-box.sm-drop--over { border-color: var(--sm-accent); }
.sm-prova-item { position: relative; display: flex; gap: 10px; align-items: center; padding: 9px 10px; background: var(--sm-surface); border: 1px solid var(--sm-line); border-radius: var(--radius); cursor: grab; font-size: 13px; }
.sm-prova-item.sm-over::before { content: ""; position: absolute; left: 0; right: 0; top: -5px; height: 3px; border-radius: 2px; background: var(--sm-accent); }
.sm-prova-item.sm-dragging { opacity: .4; }
.sm-prova-item__grip { color: var(--slate-400); font-size: 14px; letter-spacing: -2px; }
.sm-prova-item__num { font-family: var(--font-mono); font-size: 12px; font-weight: 500; min-width: 22px; }
.sm-prova-item__resumo { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sm-prova-item__x { flex: none; width: 24px; height: 24px; border-radius: var(--radius-sm); border: 0; background: transparent; color: var(--sm-muted); font-size: 15px; cursor: pointer; }
.sm-prova-item__x:hover { background: var(--sm-danger-bg); color: var(--sm-danger); }
.sm-prova-box .sm-vazio { margin: auto; padding: 24px; font-size: 13px; }

/* ---------------- Pré-visualização: ferramentas ---------------- */
.sm-prev-tools { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; font-size: 12.5px; color: var(--sm-muted); }
.sm-prev-tools > label { display: flex; align-items: center; gap: 6px; }
.sm-prev-edit { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex-basis: 100%; padding: 10px 12px; border-radius: var(--radius); background: var(--sm-surface); border: 1px solid var(--sm-line); }
.sm-prev-edit .sm-row--end { display: flex; align-items: center; gap: 6px; }
.sm-prev-nota { font-size: 12px; color: var(--sm-muted); flex-basis: 100%; }
.sm-prev-scroll { overflow: auto; padding: 4px 0 24px; }
.sm-prev-pager { display: flex; align-items: center; gap: 10px; font-size: 13px; justify-content: center; margin-bottom: 14px; }
.sm-prev-pager span { font-family: var(--font-mono); font-size: 12.5px; min-width: 130px; text-align: center; }

/* ---------------- A folha (papel) ---------------- */
.sm-folhas { display: flex; flex-wrap: wrap; gap: 28px 24px; justify-content: center; position: relative; max-width: 100%; }
.sm-pagina { flex: none; display: flex; flex-direction: column; gap: 8px; position: relative; top: 0; }
.sm-pagina--fora { position: absolute; left: -10000px; }
.sm-pagina__rotulo { font-size: 12px; color: var(--sm-muted); text-align: center; }
.sm-caixa { overflow: hidden; }
.sm-folha { width: 794px; height: 1123px; background: #fff; color: #111; box-shadow: 0 1px 2px rgba(0,0,0,.06), 0 8px 28px rgba(0,0,0,.12); transform-origin: top left; padding: 40px 42px 16px; display: flex; flex-direction: column; font-family: 'Source Serif 4', var(--font-serif), Georgia, serif; overflow: hidden; }
.sm-folha--livre { overflow: visible; }
.sm-folha--solta { height: auto; min-height: 1123px; padding: 40px 42px; font-family: var(--font); transform: none; }
.sm-folha .sans { font-family: var(--font); }
/* Cabeçalho livre: blocos posicionados dentro de .sm-folha__cab, cuja altura
   js/simulados.js fixa em px (medida pelo conteúdo ou escolhida pela
   pessoa). left/top/width/font-size vêm inline, em px da folha sem escala. */
.sm-folha__cab { position: relative; flex: none; padding-bottom: 12px; }
.sm-cab-bloco { position: absolute; min-height: 8px; line-height: 1.35; }
.sm-cab-bloco:focus { outline: none; }
.sm-cab-txt { min-height: 1em; }
.sm-cab-bloco--escola { font-family: var(--font); letter-spacing: .08em; text-transform: uppercase; }
.sm-cab-bloco--titulo { line-height: 1.2; }
.sm-cab-bloco--linha { font-family: var(--font); }
.sm-cab-bloco--versao { border: 2px solid #111; padding: 6px 4px; text-align: center; font-family: var(--font); line-height: 1.1; }
.sm-cab-versao__rotulo { font-size: 9px; letter-spacing: .08em; }
.sm-cab-versao__letra { font-size: 22px; font-weight: 600; }
.sm-cab-bloco--regra { border-top: 2px solid #111; height: 2px; min-height: 0; }
.sm-cab-bloco--nome { display: flex; gap: 14px; font-family: var(--font); }
.sm-cab-nome__campo { border-bottom: 1px solid #111; padding-bottom: 3px; }
.sm-cab-nome__campo.n { flex: 3; }
.sm-cab-nome__campo.num { flex: 1; }
.sm-cab-nome__campo.nota { flex: 1.2; display: flex; justify-content: space-between; }
.sm-cab-bloco--instr { border: 1.5px solid #111; padding: 10px 14px; font-family: var(--font); }
.sm-cab-instr__titulo { display: block; font-size: 10px; font-weight: 600; letter-spacing: .08em; margin-bottom: 6px; }
.sm-cab-instr__lista { display: flex; flex-direction: column; gap: 3px; }
.sm-cab-instr__lista > div { display: flex; flex-direction: row; gap: 8px; line-height: 1.45; }
.sm-cab-instr__lista > div > span:first-child { flex: none; min-width: 12px; font-weight: 600; }
.sm-cab-bloco--logo img { display: block; width: 100%; height: 100%; object-fit: contain; object-position: left center; -webkit-user-drag: none; user-select: none; }
.sm-cab-logo__ph { display: grid; place-items: center; height: 100%; border: 1px dashed #999; font-family: var(--font-mono); font-size: 10px; color: #666; }
.sm-versao { flex: none; border: 2px solid #111; padding: 6px 12px; text-align: center; font-family: var(--font); line-height: 1.1; }
.sm-versao div:first-child { font-size: 9px; letter-spacing: .08em; }
.sm-versao div:last-child { font-size: 22px; font-weight: 600; }
/* Edição do cabeçalho (modo "Editar na folha"): alça, quadrado de largura,
   barrinha de ajustes do bloco selecionado e borda de altura. Tudo com
   data-noprint. */
.sm-folha__cab--ed .sm-cab-bloco { outline: 1px dashed #C4CDEE; outline-offset: 3px; cursor: move; touch-action: none; }
.sm-folha__cab--ed .sm-cab-bloco [contenteditable="true"] { cursor: text; }
.sm-folha__cab--ed .sm-cab-bloco.sel { outline: 1.5px solid #2F4DB0; }
.sm-cab-bloco--ativo { opacity: .8; }
/* Alça e quadrado ficam acima de qualquer bloco (z-index): blocos podem se
   sobrepor, e o que está por cima não pode "roubar" o clique da alça. */
.sm-cab-grip { position: absolute; z-index: 6; left: -17px; top: -4px; width: 14px; height: 18px; display: grid; place-items: center; font-family: var(--font); font-size: 11px; font-weight: 400; letter-spacing: 0; text-transform: none; line-height: 1; color: #2F4DB0; background: #F3F5FC; border-radius: 3px; cursor: move; }
.sm-cab-redim { display: none; position: absolute; z-index: 6; right: -7px; bottom: -7px; width: 11px; height: 11px; background: #2F4DB0; border: 1.5px solid #fff; border-radius: 2px; cursor: ew-resize; }
.sm-cab-bloco.sel .sm-cab-redim { display: block; }
.sm-cab-tb { display: none; position: absolute; left: 0; bottom: 100%; margin-bottom: 8px; z-index: 5; gap: 4px; white-space: nowrap; font-family: var(--font); font-size: 10.5px; font-weight: 400; letter-spacing: 0; text-transform: none; text-align: left; line-height: 1.3; color: #2F4DB0; }
.sm-cab-bloco.sel .sm-cab-tb { display: flex; }
.sm-cab-tb > * { display: flex; align-items: center; gap: 2px; background: #F3F5FC; border-radius: 5px; padding: 2px 7px; border: 0; font: inherit; color: inherit; cursor: pointer; }
.sm-cab-tb .sm-tb-grupo { padding: 1px 2px 1px 6px; cursor: default; }
.sm-cab-tb .sm-tb-grupo button { border: 0; background: transparent; cursor: pointer; color: #2F4DB0; font: inherit; font-size: 12px; padding: 0 4px; }
.sm-cab-tb .sm-tb-grupo--seg { padding: 1px 2px; }
.sm-cab-tb .sm-tb-grupo--seg button { font-size: 10.5px; padding: 1px 6px; border-radius: 3px; }
.sm-cab-tb .sm-tb-grupo--seg button.on, .sm-cab-tb .sm-tb-neg.on { background: #1B1E23; color: #fff; }
.sm-cab-tb .sm-tb-neg { font-weight: 700; }
.sm-cab-tb .sm-tb-rm { background: #FBE9E7; color: #8C1D18; }
.sm-cab-alt { position: absolute; left: 0; right: 0; bottom: 0; height: 8px; cursor: ns-resize; border-bottom: 2px dashed #C4CDEE; }
.sm-cab-alt:hover { border-bottom-color: #2F4DB0; }
.sm-folha__grid { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 26px; align-content: start; align-items: start; position: relative; line-height: 1.5; }
.sm-folha__grid::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; border-left: 1px solid #BBB; }
.sm-folha__col { min-width: 0; display: flex; flex-direction: column; }
.sm-folha__rodape { height: 28px; flex: none; display: flex; justify-content: space-between; align-items: center; border-top: 1px solid #111; font-family: var(--font); font-size: 9.5px; }

.sm-qitem { position: relative; margin: 0 -6px; padding: 4px 6px; border-radius: 4px; outline: 1px dashed transparent; }
.sm-qitem--ed { outline-color: #C4CDEE; }
.sm-qitem__toolbar { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; font-family: var(--font); font-size: 10.5px; color: #2F4DB0; }
.sm-qitem__toolbar > * { display: flex; align-items: center; gap: 2px; background: #F3F5FC; border-radius: 5px; padding: 2px 7px; border: 0; font: inherit; color: inherit; cursor: pointer; }
.sm-qitem__toolbar .sm-tb-grupo { padding: 1px 2px 1px 6px; cursor: default; }
.sm-qitem__toolbar .sm-tb-grupo button { border: 0; background: transparent; cursor: pointer; color: #2F4DB0; font-size: 12px; width: 18px; padding: 0; }
.sm-qitem__toolbar .sm-tb-rm { background: #FBE9E7; color: #8C1D18; }
.sm-qitem__toolbar .sm-tb-quebra { border: 1px solid #C4CDEE; background: #fff; }
.sm-qitem__toolbar .sm-tb-quebra.on { background: #1B1E23; color: #fff; }
.sm-qitem__disc { background: #111; color: #fff; font-family: var(--font); font-size: 10.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; padding: 4px 8px; margin-bottom: 10px; }
.sm-qitem__num { font-family: var(--font); font-weight: 600; font-size: 11.5px; margin-bottom: 4px; }
.sm-qitem__apoio { margin: 0 0 6px; font-size: .96em; text-align: justify; text-wrap: pretty; white-space: pre-line; }
.sm-qitem__enun { margin: 0 0 6px; text-align: justify; text-wrap: pretty; white-space: pre-line; }
.sm-qitem__img { width: 100%; margin: 6px 0; background-size: contain; background-repeat: no-repeat; background-position: center; }
.sm-qitem__ph { border: 1px solid #999; margin: 6px 0; display: grid; place-items: center; font-family: var(--font-mono); font-size: 10px; color: #666; background: repeating-linear-gradient(45deg, #fff, #fff 6px, #F2F2F2 6px, #F2F2F2 12px); }
.sm-qitem__alts { display: flex; flex-direction: column; gap: 3px; }
.sm-alt { display: flex; gap: 7px; align-items: flex-start; }
.sm-alt__letra { flex: none; width: 17px; height: 17px; border: 1px solid #111; border-radius: 50%; display: grid; place-items: center; font-family: var(--font); font-size: 9.5px; font-weight: 600; margin-top: 1px; }
.sm-vf { display: flex; gap: 6px; }
.sm-vf__caixa { flex: none; font-family: var(--font-mono); font-size: 11px; }
.sm-linhas { display: flex; flex-direction: column; }
.sm-linha { height: 22px; border-bottom: 1px solid #999; }
.sm-folha [contenteditable="true"]:focus { outline: 1.5px solid #2F4DB0; outline-offset: 2px; border-radius: 2px; }

/* Gabarito e cartão-resposta */
.sm-gabarito__cab, .sm-cartao__cab { border-bottom: 2px solid #111; padding-bottom: 10px; display: flex; justify-content: space-between; align-items: flex-end; }
.sm-gabarito__cab { margin-bottom: 16px; }
.sm-gabarito__cab small, .sm-cartao__cab small { display: block; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; }
.sm-gabarito__cab b, .sm-cartao__cab b { display: block; font-family: 'Source Serif 4', var(--font-serif), serif; font-size: 21px; font-weight: 700; }
.sm-gabarito__grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 24px; }
.sm-gabarito__item { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #DDD; padding: 7px 0; font-size: 13px; }
.sm-gabarito__item span:first-child { font-family: var(--font-mono); }
.sm-gabarito__item span:last-child { font-weight: 600; }
.sm-cartao__nome { display: grid; grid-template-columns: 3fr 1fr 1fr; gap: 14px; margin: 16px 0 22px; font-size: 11px; }
.sm-cartao__nome div { border-bottom: 1px solid #111; padding-bottom: 3px; }
.sm-cartao__nota { font-size: 10.5px; margin: 0 0 16px; color: #333; }
.sm-cartao__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 28px; }
.sm-cartao__item { display: flex; align-items: center; gap: 7px; padding: 3px 0; border-bottom: 1px solid #EEE; }
.sm-cartao__item > span:first-child { font-family: var(--font-mono); font-size: 12px; min-width: 24px; }
.sm-bolha { width: 20px; height: 20px; border: 1.3px solid #111; border-radius: 50%; display: grid; place-items: center; font-size: 9.5px; font-weight: 600; }

/* ---------------- Toast e modal ---------------- */
.sm-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--brand-navy-900); color: #fff; font-size: 13.5px; padding: 10px 16px; border-radius: var(--radius); box-shadow: var(--shadow-lg); z-index: 600; max-width: min(90vw, 520px); text-align: center; }
.sm-modal h3 { margin: 0 0 6px; font-size: 16px; }
.sm-modal p { margin: 0; font-size: 13.5px; color: var(--sm-muted); }

/* ---------------- Impressão ----------------
   js/simulados.js clona #sm-folhas pra #sm-print-root (direto no body) no
   beforeprint; aqui só ele aparece. */
#sm-print-root { display: none; }
@media print {
  @page { size: A4; margin: 0; }
  html, body { height: auto !important; background: #fff !important; margin: 0 !important; }
  body > :not(#sm-print-root) { display: none !important; }
  #sm-print-root { display: block; width: 210mm; }
  #sm-print-root .sm-folhas { display: block; gap: 0; max-width: none; }
  #sm-print-root .sm-pagina { position: static; left: auto; width: auto !important; display: block; }
  #sm-print-root .sm-caixa { width: auto !important; height: auto !important; overflow: visible; }
  /* 794×1123 px é A4 a 96 dpi, mas com meio pixel a mais que a página do
     navegador — sem esta folga cada folha ganharia uma página em branco. */
  #sm-print-root .sm-folha { width: 210mm !important; height: 296.5mm !important; transform: none !important; zoom: 1 !important; box-shadow: none; margin: 0 !important; break-after: page; overflow: hidden !important; }
  #sm-print-root .sm-pagina:last-child .sm-folha, #sm-print-root .sm-folha:last-child { break-after: auto; }
  #sm-print-root .sm-folha--solta { height: auto !important; min-height: 0 !important; break-after: auto; }
  #sm-print-root [data-noprint], #sm-print-root .sm-qitem__toolbar, #sm-print-root .sm-pagina__rotulo { display: none !important; }
  #sm-print-root .sm-qitem, #sm-print-root [contenteditable], #sm-print-root .sm-cab-bloco { outline: none !important; }
}
