/* Passo 365 — Provas Substitutivas (Pedagógico). Porta pra vanilla JS o
   protótipo desenhado em claude.ai/design ("Provas Substitutivas.dc.html",
   projeto 5bb4daea-bdb2-41d9-87e3-c5235840f576). O protótipo usa os tokens
   semânticos de passo-a-passo.css (--color-*); aqui eles viram --pv-*,
   apontando pros tokens que o style.css já tem — assim o tema escuro e
   qualquer ajuste de marca valem pro módulo sem manutenção dobrada. Sem
   sombras: a hierarquia vem de linhas de 1px, como no resto do design v2. */

.pv {
  --pv-surface: var(--bg-card);
  --pv-surface-2: var(--blue-50);
  --pv-bg: var(--bg-page);
  --pv-line: var(--border);
  --pv-line-soft: var(--border-soft);
  --pv-text: var(--slate-900);
  --pv-soft: var(--slate-600);
  --pv-muted: var(--slate-500);
  --pv-accent: var(--brand-yellow);
  --pv-accent-strong: var(--brand-yellow-600);
  --pv-accent-bg: #F6F3D2;
  --pv-accent-ink: #16283F;
  --pv-danger: #A32A25;
  --pv-danger-ink: #8E2B26;
  --pv-danger-bg: #FBEDEC;
  --pv-danger-line: #EBD3D1;
  --pv-row-warn: #FCFBEA;
  --pv-row-err: #FDF4F3;
  color: var(--pv-text);
  font-size: 14.5px;
  line-height: 1.5;
}
:root[data-theme="dark"] .pv {
  --pv-accent-bg: #3A3A1C;
  --pv-accent-ink: var(--brand-yellow);
  --pv-danger: #F07A7A;
  --pv-danger-ink: #F3A29E;
  --pv-danger-bg: #3A1D22;
  --pv-danger-line: #5A2B31;
  --pv-row-warn: #24261A;
  --pv-row-err: #2A1B20;
}

@keyframes pv-fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes pv-flash { 0% { background: var(--pv-accent-bg); } 100% { background: transparent; } }
@keyframes pv-spin { to { transform: rotate(360deg); } }
.pv--entrando .pv-view { animation: pv-fade .25s ease both; }
.pv-view--narrow { max-width: 900px; }

/* ---------------- Tipografia ---------------- */
.pv h1, .pv h2 { font-family: var(--font-serif); font-weight: 600; line-height: 1.2; letter-spacing: -.01em; margin: 0; }
.pv h1 { font-size: 27px; }
.pv h2 { font-size: 19px; }
.pv-rule { display: block; width: 44px; height: 3px; background: var(--pv-accent); margin-bottom: 12px; }
.pv-label { font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--pv-soft); }
.pv-eyebrow { letter-spacing: .16em; }
.pv-metric { font-size: 40px; font-weight: 600; line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.pv-metric--md { font-size: 30px; }
.pv-sub { margin: 6px 0 0; font-size: 13.5px; color: var(--pv-muted); max-width: 64ch; }
.pv-muted { color: var(--pv-muted); }
.pv-num { font-variant-numeric: tabular-nums; }

.pv-ic { width: 1em; height: 1em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.pv-ic--spin { animation: pv-spin .9s linear infinite; }

/* ---------------- Botões ---------------- */
.pv-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 16px; font: inherit; font-size: 13.5px; font-weight: 600; letter-spacing: .06em; background: var(--pv-surface); color: var(--pv-text); border: 1px solid var(--pv-line); border-radius: 3px; cursor: pointer; white-space: nowrap; }
.pv-btn:hover { background: var(--pv-surface-2); }
.pv-btn:disabled { opacity: .5; cursor: not-allowed; }
.pv-btn .pv-ic { font-size: 16px; }
.pv-btn--primary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.pv-btn--primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.pv-btn--lg { height: 44px; padding: 0 22px; font-size: 15px; }
.pv-btn--lg .pv-ic { font-size: 18px; }
.pv-btn--xl { height: 52px; padding: 0 28px; font-size: 16px; gap: 10px; }
.pv-btn--xl .pv-ic { font-size: 20px; }
.pv-btn--sm { height: 30px; padding: 0 12px; font-size: 12px; }
.pv-btn--ghost { background: transparent; color: var(--primary); border-color: transparent; letter-spacing: 0; }
.pv-btn--outline { background: transparent; color: var(--primary); }
.pv-btn--danger { background: transparent; color: var(--pv-danger-ink); border-color: var(--pv-danger-line); }
.pv-btn--danger:hover { background: var(--pv-danger-bg); }
.pv-btn--block { width: 100%; }
.pv-back { height: 30px; padding: 0 10px 0 6px; margin-bottom: 16px; gap: 6px; }
.pv-link { color: var(--primary); font-weight: 600; cursor: pointer; background: none; border: 0; padding: 0; font: inherit; font-weight: 600; }
.pv-link:hover { color: var(--primary-hover); }

/* ---------------- Campos ---------------- */
.pv-field { display: block; min-width: 0; }
.pv-field > .pv-label { display: block; margin-bottom: 5px; }
.pv-input, .pv-select, .pv-textarea { width: 100%; height: 36px; padding: 0 10px; font: inherit; font-size: 13.5px; background: var(--pv-bg); color: var(--pv-text); border: 1px solid var(--pv-line); border-radius: 3px; min-width: 0; }
.pv-textarea { height: auto; min-height: 250px; padding: 16px; font-size: 14.5px; line-height: 1.6; background: var(--pv-surface); border-radius: 4px; resize: vertical; }
.pv-textarea--msg { min-height: 220px; padding: 12px; font-size: 13.5px; line-height: 1.7; background: var(--pv-bg); border-radius: 3px; }
.pv-input--lg { height: 44px; padding: 0 14px; font-size: 14.5px; background: var(--pv-surface); }
.pv-input:focus-visible, .pv-select:focus-visible, .pv-textarea:focus-visible, .pv-btn:focus-visible, .pv-cell-input:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.pv-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pv-filters .pv-select, .pv-filters .pv-input { width: auto; max-width: 220px; background: var(--pv-surface); }
.pv-check { width: 15px; height: 15px; accent-color: var(--primary); }

/* ---------------- Cabeçalho de tela ---------------- */
.pv-head { display: flex; align-items: flex-end; gap: 20px; flex-wrap: wrap; }
.pv-head__main { flex: 1; min-width: min(280px, 100%); }
.pv-head__actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pv-block { margin-top: 26px; }
.pv-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pv-row--end { margin-left: auto; }

/* ---------------- Cartões e métricas ---------------- */
.pv-card { background: var(--pv-surface); border: 1px solid var(--pv-line); border-radius: 4px; padding: 20px 22px; }
.pv-card--marker { border-left: 3px solid var(--pv-accent); }
.pv-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; }
.pv-stats--sm { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.pv-stat__label { font-size: 12px; color: var(--pv-muted); margin-top: 6px; line-height: 1.35; }
/* padding-top compensa os 2px a mais da borda, pro número não descer em relação aos vizinhos */
.pv-stat--ativo { border-top: 3px solid var(--pv-accent); padding-top: 18px; }
.pv-stat--alerta { border-top: 3px solid var(--pv-danger); padding-top: 18px; }
.pv-stat--alerta .pv-metric { color: var(--pv-danger); }
.pv-counters { display: flex; gap: 32px; margin-left: auto; }
.pv-counters .pv-label { margin-top: 4px; }

/* ---------------- Tabelas ---------------- */
.pv-table-wrap { background: var(--pv-surface); border: 1px solid var(--pv-line); border-radius: 4px; overflow-x: auto; }
.pv-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.pv-table th { text-align: left; padding: 12px; border-bottom: 1px solid var(--pv-line); white-space: nowrap; }
.pv-table td { padding: 11px 12px; border-bottom: 1px solid var(--pv-line-soft); vertical-align: middle; }
.pv-table tr:last-child td { border-bottom: 0; }
.pv-table--tight td { padding: 8px 12px; }
.pv-table .strong { font-weight: 600; }
.pv-table .note { font-weight: 400; font-size: 12px; color: var(--pv-muted); }
.pv-table .right { text-align: right; white-space: nowrap; }
.pv-table tr.is-warn { background: var(--pv-row-warn); }
.pv-table tr.is-err { background: var(--pv-row-err); }
.pv-table tr.is-flash { animation: pv-flash 2s ease both; }
.pv-table tr.is-click { cursor: pointer; }
.pv-table tr.is-click:hover { background: var(--bg-hover); }
.pv-cell-input { width: 100%; height: 30px; padding: 0 8px; font: inherit; font-size: 13.5px; font-variant-numeric: tabular-nums; background: transparent; color: var(--pv-text); border: 1px solid transparent; border-radius: 3px; min-width: 0; }
.pv-cell-input:hover { border-color: var(--pv-line); }
.pv-cell-input:focus { border-color: var(--primary); background: var(--pv-surface); }
.pv-st { font-size: 18px; display: block; }
.pv-st--ok { color: var(--primary); }
.pv-st--warn { color: var(--pv-accent-strong); }
.pv-st--err { color: var(--pv-danger); }
.pv-empty { padding: 44px 24px; text-align: center; color: var(--pv-muted); font-size: 13.5px; }
.pv-empty b { display: block; color: var(--pv-text); font-size: 15.5px; margin-bottom: 4px; }

/* ---------------- Selos ---------------- */
.pv-badge { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; font-size: 12px; font-weight: 600; border-radius: 2px; white-space: nowrap; }
.pv-badge--command { background: var(--primary); color: var(--on-primary); }
.pv-badge--accent { background: var(--pv-accent-bg); color: var(--pv-accent-ink); }
.pv-badge--neutral { background: var(--pv-surface-2); color: var(--blue-700); }
.pv-badge--danger { background: var(--pv-danger-bg); color: var(--pv-danger-ink); }
.pv-badge--outline { background: transparent; color: var(--primary); border: 1px solid var(--pv-line); }
.pv-badge--lg { height: 28px; padding: 0 12px; letter-spacing: .06em; text-transform: uppercase; }

/* ---------------- Avisos ---------------- */
.pv-alert { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 16px; font-size: 13.5px; border-radius: 4px; background: var(--pv-danger-bg); border: 1px solid var(--pv-danger-line); color: var(--pv-danger-ink); }
.pv-alert .pv-ic { font-size: 20px; }
.pv-alert .pv-btn { margin-left: auto; }
.pv-alert--info { background: var(--pv-surface-2); border-color: var(--pv-line); color: var(--pv-text); }
.pv-alert--warn { background: var(--pv-accent-bg); border-color: var(--pv-line); color: var(--pv-accent-ink); }
.pv-feedback { font-size: 13.5px; color: var(--primary); font-weight: 600; margin-top: 10px; min-height: 20px; }
.pv-feedback--erro { color: var(--pv-danger-ink); }

/* ---------------- Importação / processamento ---------------- */
.pv-steps { display: flex; flex-direction: column; gap: 12px; }
.pv-step { display: flex; align-items: center; gap: 10px; opacity: .3; }
.pv-step .pv-ic { font-size: 20px; color: var(--pv-soft); }
.pv-step.is-on { opacity: 1; }
.pv-step.is-on .pv-ic { color: var(--primary); }
.pv-progress { height: 6px; background: var(--pv-surface-2); border-radius: 2px; margin-top: 16px; overflow: hidden; }
.pv-progress > span { display: block; height: 100%; background: var(--primary); transition: width .3s ease; }

/* ---------------- Revisão ---------------- */
.pv-config { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; align-items: end; margin-top: 12px; }
.pv-config .span-2 { grid-column: span 2; }
.pv-config .full { grid-column: 1 / -1; }
.pv-cmd { display: flex; gap: 8px; }
.pv-cmd .pv-input { flex: 1; }
.pv-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.pv-chip { height: 28px; padding: 0 12px; font: inherit; font-size: 12px; background: var(--pv-surface); color: var(--pv-muted); border: 1px solid var(--pv-line); border-radius: 3px; cursor: pointer; }
.pv-chip:hover { background: var(--pv-surface-2); color: var(--pv-text); }
.pv-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-top: 16px; }
.pv-group__nome { font-family: var(--font-serif); font-weight: 600; font-size: 19px; line-height: 1.2; }
.pv-group__meta { font-size: 12px; color: var(--pv-muted); margin-top: 4px; line-height: 1.6; }
.pv-group__lista { font-size: 13.5px; line-height: 1.7; white-space: pre-line; margin-top: 10px; }

/* ---------------- Comunicações ---------------- */
.pv-msgs { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.pv-msg.is-off { opacity: .45; }
.pv-msg__head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; }
.pv-msg__fone { margin-left: auto; font-size: 12px; color: var(--pv-muted); white-space: nowrap; }
.pv-msg__body { font-size: 13.5px; line-height: 1.7; white-space: pre-line; background: var(--pv-bg); border: 1px solid var(--pv-line-soft); border-radius: 3px; padding: 16px; margin-top: 12px; overflow-wrap: anywhere; }
.pv-msg__actions { display: flex; gap: 8px; margin-top: 12px; }
.pv-msg__actions .pv-btn:last-child { margin-left: auto; }
.pv-result { display: flex; flex-direction: column; gap: 12px; }
.pv-result__line { display: flex; gap: 10px; align-items: flex-start; }
.pv-result__line .pv-ic { font-size: 20px; margin-top: 1px; }

/* ---------------- Detalhe ---------------- */
.pv-tabs { display: flex; gap: 18px; border-bottom: 1px solid var(--pv-line); overflow-x: auto; }
.pv-tab { height: 42px; padding: 0 4px; font: inherit; font-size: 14.5px; font-weight: 600; background: transparent; color: var(--pv-muted); border: 0; border-bottom: 3px solid transparent; cursor: pointer; white-space: nowrap; }
.pv-tab.on { color: var(--pv-text); border-bottom-color: var(--pv-accent); }
.pv-kvs { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 26px; max-width: 920px; }
.pv-kv__v { font-size: 16px; margin-top: 5px; overflow-wrap: anywhere; }
.pv-timeline { max-width: 640px; }
.pv-tl { display: grid; grid-template-columns: 150px 16px 1fr; gap: 16px; align-items: start; padding: 10px 0; border-bottom: 1px solid var(--pv-line-soft); }
.pv-tl__when { font-size: 12px; color: var(--pv-muted); font-variant-numeric: tabular-nums; padding-top: 2px; }
.pv-tl__dot { display: block; width: 8px; height: 8px; border-radius: 50%; background: var(--slate-400); margin: 7px auto 0; }
.pv-tl__dot--command { background: var(--primary); }
.pv-tl__dot--accent { background: var(--pv-accent); }
.pv-tl__dot--danger { background: var(--pv-danger); }
.pv-tl__who { font-size: 12px; color: var(--pv-muted); }

/* ---------------- Relatórios ---------------- */
.pv-bars { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 32px; max-width: 920px; }
.pv-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 13.5px; }
.pv-bar__label { width: 110px; flex: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-bar__fill { height: 10px; background: var(--brand-navy); min-width: 2px; }
.pv-bar__fill--accent { background: var(--brand-yellow); }
:root[data-theme="dark"] .pv-bar__fill { background: var(--blue-600); }
:root[data-theme="dark"] .pv-bar__fill--accent { background: var(--brand-yellow); }

/* ---------------- Solicitação manual ---------------- */
.pv-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; }
.pv-form .full { grid-column: 1 / -1; }
.pv-form__sep { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; padding-top: 6px; border-top: 1px solid var(--pv-line-soft); }
.pv-form__sep .pv-btn { margin-left: auto; }
.pv-aluno-pick { display: flex; gap: 8px; }
.pv-aluno-pick .pv-input { flex: 1; }
.pv-classlist { max-height: 320px; overflow: auto; margin-bottom: 4px; }
.pv-classlist label { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--pv-line-soft); cursor: pointer; }
.pv-classlist .pv-check { width: 16px; height: 16px; }

/* ---------------- Modais (em cima de .crm-modal-overlay, que já trava a rolagem) ---------------- */
.pv-modal { background: var(--pv-surface, var(--bg-card)); border: 1px solid var(--border); border-radius: 4px; width: min(540px, 100%); max-height: 88vh; overflow: auto; padding: 26px; box-shadow: none; }
.pv-modal--lg { width: min(720px, 100%); }
.pv-modal h2 { margin: 0 0 8px; }
.pv-modal__sub { margin: 0 0 20px; font-size: 13.5px; color: var(--pv-muted); }
.pv-modal__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; flex-wrap: wrap; }
.pv-candidatos { display: flex; flex-direction: column; gap: 8px; }
.pv-candidato { text-align: left; padding: 14px; font: inherit; font-size: 14.5px; background: var(--pv-bg); color: var(--pv-text); border: 1px solid var(--pv-line); border-radius: 3px; cursor: pointer; }
.pv-candidato:hover { border-color: var(--primary); background: var(--pv-surface-2); }
.pv-radios { display: flex; gap: 20px; flex-wrap: wrap; margin-bottom: 16px; }
.pv-radios label { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; }
.pv-radios input { accent-color: var(--primary); }
.pv-placeholders { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 12px; color: var(--pv-muted); margin-top: 12px; }
.pv-placeholders code { font-family: var(--font-mono); color: var(--pv-text); }

@media (max-width: 720px) {
  .pv-counters { margin-left: 0; gap: 22px; }
  .pv-tl { grid-template-columns: 1fr; gap: 2px; }
  .pv-tl__dot { display: none; }
  .pv-msgs { grid-template-columns: 1fr; }
  .pv-config .span-2 { grid-column: 1 / -1; }
  .pv-cmd { flex-direction: column; }
}
