/* ── Reset & Tokens ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --sb-w: 252px;
  --sb-bg: #0b1120;
  --sb-bg-2: #0f172a;
  --sb-text: #94a3b8;
  --sb-hover: rgba(255,255,255,.06);
  --sb-active: #2563eb;
  --sb-border: rgba(255,255,255,.08);

  --bg: #f4f6fa;
  --card: #fff;
  --border: #e4e9f0;
  --border-strong: #d7dee8;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --light: #f8fafc;

  --blue: #2563eb;
  --blue-h: #1d4ed8;
  --blue-bg: #eef3ff;
  --blue-ring: rgba(37,99,235,.14);
  --green: #16a34a;
  --green-bg: #eefdf3;
  --amber: #d97706;
  --amber-bg: #fffaeb;
  --red: #dc2626;
  --red-bg: #fef2f2;
  --purple: #7c3aed;
  --purple-bg: #f5f0ff;

  --r-sm: 6px;
  --r: 10px;
  --r-lg: 14px;
  --shadow-xs: 0 1px 2px rgba(15,23,42,.04);
  --shadow: 0 1px 2px rgba(15,23,42,.04), 0 2px 6px rgba(15,23,42,.05);
  --shadow-md: 0 4px 10px rgba(15,23,42,.06), 0 2px 4px rgba(15,23,42,.05);
  --shadow-lg: 0 12px 32px rgba(15,23,42,.12), 0 4px 10px rgba(15,23,42,.06);

  --font: 'Inter', system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, "SFMono-Regular", Menlo, monospace;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { font-weight: 700; letter-spacing: -.01em; }

/* ── Layout ─────────────────────────────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sb-w);
  background: linear-gradient(180deg, var(--sb-bg), var(--sb-bg-2));
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 100;
  border-right: 1px solid var(--sb-border);
  transition: width .18s ease;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 22px 20px 20px;
  border-bottom: 1px solid var(--sb-border);
}
.logo-icon {
  font-size: 19px;
  line-height: 1;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(37,99,235,.16);
  border-radius: 9px;
  flex-shrink: 0;
  color: #60a5fa;
}
.logo-text { font-weight: 700; color: #fff; font-size: 14.5px; letter-spacing: -.2px; }
.logo-sub { font-size: 11px; color: var(--sb-text); margin-top: 1px; }

.sidebar-nav { padding: 16px 12px; flex: 1; display: flex; flex-direction: column; gap: 1px; overflow-x: hidden; }

/* ── Botão de recolher sidebar (tablet/desktop) ─────────────────────────────── */
.sidebar-collapse-btn {
  position: fixed;
  top: 50%;
  left: var(--sb-w);
  transform: translate(-50%, -50%);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--card);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  z-index: 150;
  box-shadow: var(--shadow-md);
  transition: left .18s ease, background .12s, color .12s;
}
.sidebar-collapse-btn:hover { background: var(--blue); color: #fff; border-color: var(--blue); }

.nav-section { font-size: 10.5px; font-weight: 700; color: rgba(148,163,184,.55); letter-spacing: .09em; text-transform: uppercase; padding: 18px 10px 6px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--sb-text);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background .12s, color .12s;
  position: relative;
}
.nav-item:hover { background: var(--sb-hover); color: #e2e8f0; text-decoration: none; }
.nav-item.ativa { background: var(--sb-active); color: #fff; box-shadow: 0 2px 8px rgba(37,99,235,.35); }
.nav-item .icon { font-size: 15px; width: 20px; text-align: center; flex-shrink: 0; opacity: .92; display: inline-flex; align-items: center; justify-content: center; }
.icon-svg { display: inline-block; flex-shrink: 0; vertical-align: -3px; }
.btn .icon-svg { vertical-align: -2px; }
.nav-badge {
  margin-left: auto;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 20px;
  min-width: 18px;
  text-align: center;
}
.nav-divider { border: none; border-top: 1px solid var(--sb-border); margin: 10px 4px; }

.sidebar-footer {
  padding: 14px 12px;
  border-top: 1px solid var(--sb-border);
}
.sidebar-user { display: block; color: var(--sb-text); font-size: 12px; font-weight: 500; padding: 4px 12px 10px; }

/* ── Main Content ─────────────────────────────────────────────────────────── */
.main-content {
  margin-left: var(--sb-w);
  flex: 1;
  min-width: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left .18s ease;
}

.page-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}
.page-title { font-size: 18px; font-weight: 700; color: var(--text); letter-spacing: -.015em; }
.header-actions { display: flex; gap: 8px; align-items: center; }

.notif-wrap { position: relative; }
.notif-bell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--r-sm);
  color: var(--muted);
  flex-shrink: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
}
.notif-bell:hover { background: var(--light); color: var(--text); }

.notif-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
  max-width: 88vw;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  overflow: hidden;
}
.notif-panel-header {
  padding: 10px 10px 10px 16px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.notif-limpar-btn {
  border: none;
  background: transparent;
  color: var(--blue);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--r-sm);
  font-family: inherit;
}
.notif-limpar-btn:hover { background: var(--blue-bg); }
.notif-panel-body { max-height: 320px; overflow-y: auto; }
.notif-panel-empty { padding: 16px; text-align: center; font-size: 12.5px; color: var(--muted); }
.notif-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--light); text-decoration: none; }
.notif-item-nome { font-size: 13px; font-weight: 600; }
.notif-item-sub { font-size: 11.5px; color: var(--muted); }
/* ── Busca-e-seleciona (Sede/Turma/Modelo em vários formulários) ────────────── */
.turma-search-wrap { position: relative; }
.turma-dropdown {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 100;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--r-sm);
  max-height: 220px; overflow-y: auto; box-shadow: var(--shadow-lg); margin-top: 4px;
}
.turma-option { padding: 9px 12px; cursor: pointer; border-bottom: 1px solid var(--border); font-size: 13.5px; color: var(--text); }
.turma-option:last-child { border-bottom: none; }
.turma-option:hover, .turma-option:focus { background: var(--blue); color: #fff; outline: none; }
.turma-option:hover .turma-option-nome, .turma-option:focus .turma-option-nome { color: rgba(255,255,255,.8); }
.turma-option-nome { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.turma-msg { padding: 12px; text-align: center; color: var(--muted); font-size: 12.5px; }

.notif-panel-footer {
  display: block;
  padding: 10px 16px;
  text-align: center;
  font-size: 12.5px;
  font-weight: 600;
  border-top: 1px solid var(--border);
  background: var(--light);
  color: var(--blue);
}
.notif-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 20px;
  min-width: 16px;
  text-align: center;
}

.page-body { padding: 32px; flex: 1; min-width: 0; max-width: 1400px; width: 100%; margin: 0 auto; }

/* ── Stat Cards ────────────────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; margin-bottom: 28px; }

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 22px 22px 20px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.stat-label { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 10px; }
.stat-val { font-size: 30px; font-weight: 800; color: var(--text); line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.stat-card.blue::before, .stat-card.green::before, .stat-card.amber::before, .stat-card.red::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
}
.stat-card.blue::before { background: var(--blue); }
.stat-card.green::before { background: var(--green); }
.stat-card.amber::before { background: var(--amber); }
.stat-card.red::before { background: var(--red); }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  min-width: 0;
}
.card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  row-gap: 10px;
  justify-content: space-between;
  gap: 12px;
}
.card-title { font-size: 14.5px; font-weight: 700; letter-spacing: -.01em; }
.card-body { padding: 20px 22px; }

/* ── Grid com 2 colunas ──────────────────────────────────────────────────── */
.two-col { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 20px; }
.two-col-lg { display: grid; grid-template-columns: minmax(0,2fr) minmax(0,1fr); gap: 20px; }

/* ── Tabelas ─────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: left;
  padding: 13px 18px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  background: var(--light);
  white-space: nowrap;
}
td {
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text-2);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: color-mix(in srgb, var(--blue) 3%, var(--light)); }
.td-mono { font-family: var(--font-mono); font-size: 12.5px; color: var(--text); }

/* ── Badges / Status ─────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 11px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: -.005em;
}
.badge-blue   { background: var(--blue-bg);  color: var(--blue-h); }
.badge-green  { background: var(--green-bg); color: #15803d; }
.badge-amber  { background: var(--amber-bg); color: #b45309; }
.badge-red    { background: var(--red-bg);   color: #b91c1c; }
.badge-gray   { background: var(--light); color: var(--muted); border: 1px solid var(--border); }

/* ── Botões ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background .12s, opacity .12s, box-shadow .12s, transform .08s;
  white-space: nowrap;
  font-family: inherit;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--blue); color: #fff; box-shadow: 0 1px 2px rgba(37,99,235,.25), 0 2px 6px rgba(37,99,235,.18); }
.btn-primary:hover { background: var(--blue-h); text-decoration: none; box-shadow: 0 2px 6px rgba(37,99,235,.3); }
.btn-outline { background: #fff; color: var(--blue); border: 1.5px solid var(--border-strong); }
.btn-outline:hover { background: var(--blue-bg); border-color: var(--blue); text-decoration: none; }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--border); color: var(--text); text-decoration: none; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { opacity: .9; }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

/* ── Formulários ─────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--r-sm);
  font-size: 13.5px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3.5px var(--blue-ring);
}
.form-hint { font-size: 11.5px; color: var(--muted); margin-top: 5px; }

/* Barra de busca inline */
.search-bar { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.search-bar .form-group { margin-bottom: 0; }

/* Linha de campos em grid — colunas de largura igual, quebra pra 1 coluna no mobile */
.form-row { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr) minmax(0,1fr); gap: 1.25rem; }
.form-row .form-group { margin-bottom: 0; }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }

/* ── Alertas ─────────────────────────────────────────────────────────────── */
.alert {
  padding: 13px 18px;
  border-radius: var(--r);
  font-size: 13.5px;
  margin-bottom: 18px;
  border: 1px solid transparent;
  font-weight: 500;
}
.alert-info  { background: var(--blue-bg);  color: #1e40af; border-color: #c7d9fc; }
.alert-warn  { background: var(--amber-bg); color: #92400e; border-color: #fbe3ac; }
.alert-error { background: var(--red-bg);   color: #991b1b; border-color: #f9c9c9; }
.alert-ok    { background: var(--green-bg); color: #14532d; border-color: #b9ecc7; }

/* ── Paginação ───────────────────────────────────────────────────────────── */
.pagination { display: flex; gap: 4px; align-items: center; margin-top: 18px; }
.pg-btn {
  padding: 6px 12px; border-radius: var(--r-sm); font-size: 13px; border: 1px solid var(--border-strong);
  background: var(--card); color: var(--text); cursor: pointer; font-weight: 500;
}
.pg-btn:hover { background: var(--light); text-decoration: none; border-color: var(--blue); }
.pg-btn.ativa { background: var(--blue); color: #fff; border-color: var(--blue); }
.pg-info { font-size: 12px; color: var(--muted); margin: 0 8px; font-weight: 500; }

/* ── Barra de progresso (banner de importação) ──────────────────────────── */
.progress { height: 7px; background: var(--border); border-radius: 4px; overflow: hidden; margin: 10px 0; }
.progress-bar { height: 100%; background: var(--blue); border-radius: 4px; transition: width .3s ease; }

/* ── Empty state ─────────────────────────────────────────────────────────── */
.empty, .empty-state { text-align: center; padding: 56px 24px; color: var(--muted); }
.empty-icon { font-size: 38px; margin-bottom: 14px; opacity: .5; }
.empty-text { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.empty-sub { font-size: 13px; }

/* ── Utilitários usados nas páginas de Operações (wizard) ───────────────────── */
.text-muted { color: var(--muted); font-size: 13px; }
.text-red { color: var(--red); }
.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--r-sm);
  font-size: 13.5px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.form-control:focus { border-color: var(--blue); box-shadow: 0 0 0 3.5px var(--blue-ring); }
.form-control:disabled { background: var(--light); color: var(--muted); cursor: not-allowed; }
.form-control-sm { padding: 6px 10px; font-size: 12.5px; }
textarea.form-control { resize: vertical; min-height: 60px; }

/* ── Modal ("cadastro rápido": Nova turma, Novo usuário, Novo mapeamento...) ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 200;
  align-items: center; justify-content: center;
}
.modal-box {
  background: var(--card); border-radius: var(--r); padding: 32px;
  width: 480px; max-width: 95vw; max-height: 90vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.modal-box h2 { font-size: 17px; font-weight: 700; margin-bottom: 20px; }
@media (max-width: 640px) { .modal-box { padding: 20px; } }

/* ── Scrollbar fino (modais e dropdowns de busca) ───────────────────────────── */
.modal-overlay > div, .turma-dropdown {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
.modal-overlay > div::-webkit-scrollbar, .turma-dropdown::-webkit-scrollbar { width: 7px; }
.modal-overlay > div::-webkit-scrollbar-track, .turma-dropdown::-webkit-scrollbar-track { background: transparent; }
.modal-overlay > div::-webkit-scrollbar-thumb, .turma-dropdown::-webkit-scrollbar-thumb {
  background: var(--border-strong); border-radius: 8px;
}
.modal-overlay > div::-webkit-scrollbar-thumb:hover, .turma-dropdown::-webkit-scrollbar-thumb:hover { background: var(--muted-2); }

/* ── Login ───────────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 20%, rgba(37,99,235,.25), transparent 45%),
    radial-gradient(circle at 85% 80%, rgba(124,58,237,.18), transparent 45%),
    var(--sb-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.login-box {
  background: var(--card);
  border-radius: var(--r-lg);
  padding: 44px 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255,255,255,.08);
}
.login-logo { text-align: center; margin-bottom: 30px; }
.login-logo .icon { display: flex; align-items: center; justify-content: center; }
.login-logo .icon img { border-radius: 9px; }
.login-logo h1 { font-size: 21px; font-weight: 800; margin-top: 10px; letter-spacing: -.02em; }
.login-logo p { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* ── Log timeline ────────────────────────────────────────────────────────── */
.log-item { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.log-item:last-child { border-bottom: none; }
.log-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); flex-shrink: 0; margin-top: 6px; box-shadow: 0 0 0 3px var(--blue-bg); }
.log-acao { font-weight: 600; font-size: 13px; }
.log-detalhe { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.log-time { font-size: 11px; color: var(--muted-2); margin-top: 3px; }

/* ── Polling banner ──────────────────────────────────────────────────────── */
.poll-status {
  background: var(--blue-bg);
  border: 1px solid #c7d9fc;
  border-radius: var(--r);
  padding: 18px 22px;
  margin-bottom: 22px;
}

/* ── Wizard Stepper ──────────────────────────────────────────────────────── */
:root { --primary: #2563eb; --danger: #dc2626; }

.wizard {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 0;
  margin-bottom: 2.25rem;
  padding: 20px 0 4px;
  counter-reset: step;
}

.wizard-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  position: relative;
  min-width: 0;
}

/* Connecting line between steps */
.wizard-step::before {
  content: '';
  position: absolute;
  top: 16px;
  left: calc(-50% + 20px);
  right: calc(50% + 20px);
  height: 2px;
  background: var(--border);
  z-index: 0;
}
.wizard-step:first-child::before { display: none; }
.wizard-step.concluida::before { background: var(--green, #16a34a); }
.wizard-step.ativa::before { background: var(--green, #16a34a); }

/* Circle */
.wizard-step-circle {
  width: 33px;
  height: 33px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  border: 2px solid var(--border);
  background: var(--card);
  color: var(--muted);
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  transition: background .2s, border-color .2s, color .2s;
}
.wizard-step.ativa .wizard-step-circle {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
  box-shadow: 0 0 0 4px var(--blue-ring);
}
.wizard-step.concluida .wizard-step-circle {
  background: #16a34a;
  border-color: #16a34a;
  color: #fff;
}
.wizard-step.concluida .wizard-step-circle::after {
  content: '✓';
  font-size: 14px;
  font-weight: 800;
}
.wizard-step.concluida .step-num { display: none; }

/* Label */
.wizard-step-label {
  margin-top: 9px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  text-align: center;
  white-space: nowrap;
  line-height: 1.3;
}
.wizard-step.ativa .wizard-step-label {
  color: var(--blue);
  font-weight: 700;
}
.wizard-step.concluida .wizard-step-label {
  color: #16a34a;
  font-weight: 600;
}

@media (max-width: 480px) {
  .wizard-step-label { display: none; }
  .wizard-step.ativa .wizard-step-label { display: block; }
}

/* ── Sidebar toggle (mobile) ─────────────────────────────────────────────── */
.sidebar-toggle-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--card);
  cursor: pointer;
  flex-shrink: 0;
}
.sidebar-toggle-btn span { width: 16px; height: 2px; background: var(--text-2); border-radius: 2px; }

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.5);
  z-index: 99;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
}
.sidebar-backdrop.show { opacity: 1; pointer-events: auto; }

/* ── Sidebar recolhida (tablet/desktop) ─────────────────────────────────────── */
@media (min-width: 769px) {
  html.sb-collapsed { --sb-w: 68px; }
  html.sb-collapsed .logo-text-wrap,
  html.sb-collapsed .nav-label,
  html.sb-collapsed .nav-section,
  html.sb-collapsed .nav-badge {
    display: none;
  }
  html.sb-collapsed .sidebar-logo { justify-content: center; padding-left: 0; padding-right: 0; }
  html.sb-collapsed .nav-item { justify-content: center; padding-left: 0; padding-right: 0; }
  html.sb-collapsed .nav-item .icon { font-size: 17px; }
  html.sb-collapsed .sidebar-footer { display: flex; flex-direction: column; align-items: center; }
}
@media (max-width: 768px) {
  .sidebar-collapse-btn { display: none; }
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar-toggle-btn { display: flex; }
  .sidebar {
    transform: translateX(-100%);
    transition: transform .22s ease;
  }
  .sidebar.aberta { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .sidebar-backdrop { display: block; }
  .main-content { margin-left: 0; }
  .page-header { padding: 0 16px; height: 56px; }
  .page-body { padding: 18px; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .two-col, .two-col-lg { grid-template-columns: 1fr; gap: 14px; }
  .card-body { padding: 16px; }
  .card-header { padding: 14px 16px; }
  .wizard { gap: 0; padding: 12px 0 4px; }
  .search-bar { flex-direction: column; align-items: stretch; }
  .search-bar .form-group { min-width: 0 !important; flex: none !important; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .page-title { font-size: 15.5px; }
  .stat-val { font-size: 24px; }
  table { font-size: 12.5px; }
  th, td { padding: 10px 12px; }
}

/* ── Modal de confirmação (substitui window.confirm) ───────────────────────── */
.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, background-color .18s ease;
}
.confirm-overlay.show {
  opacity: 1;
  pointer-events: auto;
  background: rgba(15, 23, 42, .5);
}
.confirm-modal {
  background: #fff;
  border-radius: var(--r-lg);
  padding: 28px 28px 22px;
  width: 400px;
  max-width: 92vw;
  box-shadow: var(--shadow-lg);
  transform: translateY(-14px) scale(.94);
  opacity: 0;
  transition: transform .24s cubic-bezier(.22, 1, .36, 1), opacity .18s ease;
}
.confirm-overlay.show .confirm-modal {
  transform: translateY(0) scale(1);
  opacity: 1;
}
.confirm-message {
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--text);
  margin: 0;
}
.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}
.confirm-loading {
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 8px 0 4px;
  text-align: center;
}
.confirm-loading .confirm-message {
  color: var(--muted);
}
.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid var(--blue-ring);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 1.6s; }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.progress-wrap {
  width: 100%;
}
.progress-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: var(--blue-ring);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--blue);
  border-radius: 999px;
  transition: width .3s ease;
}
.progress-text {
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--muted);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* ── Manual de uso ───────────────────────────────────────────────────────── */
.manual-layout { display: flex; align-items: flex-start; gap: 28px; }

.manual-toc {
  position: sticky;
  top: 32px;
  flex: 0 0 240px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 16px 14px;
  max-height: calc(100vh - 64px);
  overflow-y: auto;
}
.manual-toc-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  padding: 4px 10px 10px;
}
.manual-toc a {
  display: block;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  font-size: 13px;
  color: var(--text-2);
  text-decoration: none;
  line-height: 1.35;
}
.manual-toc a:hover { background: var(--light); color: var(--text); }

.manual-content { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 20px; }

.manual-section { scroll-margin-top: 20px; }

.manual-prose { color: var(--text-2); font-size: 14px; line-height: 1.65; }
.manual-prose p { margin-bottom: 12px; }
.manual-prose p:last-child { margin-bottom: 0; }
.manual-prose ul, .manual-prose ol { margin: 0 0 12px 22px; }
.manual-prose li { margin-bottom: 6px; }
.manual-prose li:last-child { margin-bottom: 0; }
.manual-prose ul ul, .manual-prose ol ul { margin-top: 6px; margin-bottom: 0; }
.manual-prose h3 {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text);
  margin: 22px 0 8px;
}
.manual-prose h3:first-child { margin-top: 0; }
.manual-prose code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  background: var(--light);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
}
.manual-prose table { margin-top: 4px; }
.manual-prose .alert { margin-top: 14px; }

@media (max-width: 900px) {
  .manual-layout { flex-direction: column; }
  .manual-toc { position: static; width: 100%; flex-basis: auto; max-height: none; }
}
