/* ============================================================
   Matemática 1 — Estilos com temas por fase
   ============================================================ */

/* ── Variáveis de tema (Fase 1 · verde bebê) ──────────────── */
:root {
  --c-primary:   #7bc47b;
  --c-dark:      #4a9e4a;
  --c-light:     #d4f0d4;
  --c-bg:        #f0faf0;
  --c-text:      #2d5a2d;
  --c-shadow:    rgba(75,158,74,.18);
  --c-success:   #28a745;
  --c-danger:    #dc3545;
  --c-gray-100:  #f8f9fa;
  --c-gray-200:  #e9ecef;
  --c-gray-400:  #ced4da;
  --c-gray-600:  #6c757d;
  --c-gray-800:  #343a40;
  --c-white:     #ffffff;
  --radius:      12px;
  --radius-lg:   20px;
  --trans:       all .25s ease;
}

body.phase-2 {
  --c-primary:  #4a90d9;
  --c-dark:     #2575c4;
  --c-light:    #d1e8f7;
  --c-bg:       #f0f7ff;
  --c-text:     #1a3a5c;
  --c-shadow:   rgba(37,117,196,.18);
}

body.phase-3 {
  --c-primary:  #ff8c00;
  --c-dark:     #d97400;
  --c-light:    #fff3e0;
  --c-bg:       #fff8f0;
  --c-text:     #7a3900;
  --c-shadow:   rgba(217,116,0,.18);
}

body.phase-4 {
  --c-primary:  #9b59b6;
  --c-dark:     #7d3c98;
  --c-light:    #f0e0f8;
  --c-bg:       #faf0ff;
  --c-text:     #4a1a6e;
  --c-shadow:   rgba(125,60,152,.18);
}

body.phase-5 {
  --c-primary:  #e74c3c;
  --c-dark:     #c0392b;
  --c-light:    #fde8e8;
  --c-bg:       #fff5f5;
  --c-text:     #7b1a1a;
  --c-shadow:   rgba(192,57,43,.18);
}

/* ── Tela de login ────────────────────────────────────────── */
.welcome-screen {
  position: fixed; inset: 0; z-index: 900;
  background: linear-gradient(135deg, #c8f0c8 0%, #a0d8a0 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.welcome-card {
  background: var(--c-white);
  border-radius: 24px;
  padding: 2.6rem 2.2rem;
  max-width: 400px;
  width: 100%;
  text-align: center;
  box-shadow: 0 16px 50px rgba(0,0,0,.15);
  animation: popIn .3s ease;
}

.welcome-icon  { font-size: 3.5rem; margin-bottom: .5rem; }
.welcome-title { font-size: 1.8rem; font-weight: 700; color: #2d5a2d; margin-bottom: .3rem; }
.welcome-sub   { font-size: .85rem; color: var(--c-gray-600); margin-bottom: 1.8rem; }

.welcome-form { text-align: left; display: flex; flex-direction: column; gap: .9rem; }

.form-group { display: flex; flex-direction: column; gap: .3rem; }
.form-group label { font-size: .85rem; font-weight: 600; color: var(--c-gray-600); }

.form-group select,
.form-group input[type="password"] {
  padding: .7rem 1rem;
  border: 2px solid var(--c-gray-400);
  border-radius: var(--radius);
  font-size: 1rem;
  outline: none;
  transition: var(--trans);
  font-family: inherit;
}
.form-group select:focus,
.form-group input[type="password"]:focus {
  border-color: #4a9e4a;
  box-shadow: 0 0 0 3px rgba(75,158,74,.18);
}

.login-error {
  background: #fff5f5;
  border: 1px solid #f5c6cb;
  border-radius: 8px;
  padding: .6rem .9rem;
  font-size: .85rem;
  color: #c0392b;
}

.welcome-btn {
  margin-top: .4rem;
  padding: .85rem;
  background: #4a9e4a;
  color: var(--c-white);
  border: none;
  border-radius: var(--radius);
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--trans);
  font-family: inherit;
}
.welcome-btn:hover { background: #2d7a2d; transform: translateY(-1px); }
.register-link {
  margin-top: .2rem;
  background: transparent;
  border: 2px solid #4a9e4a;
  border-radius: var(--radius);
  color: #4a9e4a;
  font-size: .95rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  padding: .7rem;
  text-align: center;
  transition: var(--trans);
}
.register-link:hover { background: #4a9e4a; color: #fff; }
.captcha-group label { font-weight: 700; color: var(--c-text); }

/* ── Info do aluno no header ──────────────────────────────── */
.header-right {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}

.student-info {
  display: flex;
  align-items: center;
  gap: .4rem;
  background: rgba(255,255,255,.2);
  padding: .35rem .85rem;
  border-radius: 20px;
  font-size: .9rem;
  font-weight: 600;
  color: var(--c-white);
}
.student-avatar { font-size: 1rem; }

.logout-btn {
  background: rgba(255,255,255,.25);
  border: 1px solid rgba(255,255,255,.5);
  border-radius: 6px;
  color: var(--c-white);
  font-size: .75rem;
  padding: .2rem .55rem;
  cursor: pointer;
  transition: var(--trans);
  font-family: inherit;
}
.logout-btn:hover { background: rgba(255,255,255,.4); }
.disc-change-btn  { background: rgba(255,255,255,.35); font-weight: 600; }

/* ── Reset ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--c-bg);
  color: var(--c-gray-800);
  min-height: 100vh;
  transition: background .4s ease, color .4s ease;
}

button { cursor: pointer; font-family: inherit; }

/* ── Header ───────────────────────────────────────────────── */
header {
  background: linear-gradient(135deg, var(--c-primary), var(--c-dark));
  color: var(--c-white);
  padding: 1rem 1.5rem;
  box-shadow: 0 3px 12px var(--c-shadow);
  transition: var(--trans);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .8rem;
}

/* Logo */
.logo { display: flex; align-items: center; gap: .6rem; }
.logo-icon { font-size: 1.8rem; }
.logo h1 { font-size: 1.3rem; font-weight: 700; line-height: 1.1; }
.logo-sub { font-size: .75rem; opacity: .85; }

/* Fases */
.phases { display: flex; align-items: center; gap: .4rem; }

.phase-btn {
  display: flex; flex-direction: column; align-items: center;
  padding: .4rem .9rem;
  border: 2px solid rgba(255,255,255,.45);
  border-radius: 10px;
  background: rgba(255,255,255,.12);
  color: var(--c-white);
  transition: var(--trans);
  min-width: 76px;
}
.phase-btn:hover:not(:disabled) { background: rgba(255,255,255,.25); border-color: var(--c-white); }
.phase-btn.active { background: rgba(255,255,255,.28); border-color: var(--c-white); box-shadow: 0 0 14px rgba(255,255,255,.25); }
.phase-btn:disabled { opacity: .4; cursor: not-allowed; }
.phase-num  { font-size: 1.25rem; font-weight: 700; }
.phase-lbl  { font-size: .65rem; opacity: .9; }
.phase-arrow { color: rgba(255,255,255,.6); font-size: 1rem; }

/* Streak */
.streak {
  display: flex; align-items: center; gap: .35rem;
  background: rgba(255,255,255,.2);
  padding: .4rem .9rem;
  border-radius: 20px;
}
.streak-icon { font-size: 1.2rem; }
#streakCount { font-size: 1.4rem; font-weight: 700; }
.streak-lbl  { font-size: .75rem; opacity: .9; }

/* ── Navegação (abas) ─────────────────────────────────────── */
nav.tabs {
  background: var(--c-white);
  border-bottom: 2px solid var(--c-light);
  padding: 0 1.5rem;
  transition: var(--trans);
}

.tab-btn {
  padding: .85rem 1.6rem;
  border: none;
  background: transparent;
  font-size: .95rem;
  font-weight: 500;
  color: var(--c-gray-600);
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: var(--trans);
}
.tab-btn:hover { color: var(--c-primary); }
.tab-btn.active { color: var(--c-primary); border-bottom-color: var(--c-primary); font-weight: 700; }

/* ── Conteúdo das abas ────────────────────────────────────── */
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Exercícios ───────────────────────────────────────────── */
.exercise-wrap {
  max-width: 720px;
  margin: 1.8rem auto;
  padding: 0 1rem;
}

/* Barra de progresso */
.prog-row { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.4rem; }
.prog-bar  { flex: 1; height: 9px; background: var(--c-light); border-radius: 5px; overflow: hidden; }
.prog-fill { height: 100%; background: var(--c-primary); border-radius: 5px; transition: width .4s ease; width: 0%; }
.prog-text { font-size: .82rem; color: var(--c-gray-600); white-space: nowrap; }

/* Card da questão */
.q-card {
  background: var(--c-white);
  border-radius: var(--radius-lg);
  padding: 1.8rem;
  box-shadow: 0 4px 22px var(--c-shadow);
  border: 1px solid var(--c-light);
  animation: slideUp .28s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.q-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: .9rem;
}

.q-tags { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }

.chapter-tag {
  background: var(--c-gray-200);
  color: var(--c-gray-800);
  padding: .25rem .75rem;
  border-radius: 20px;
  font-size: .78rem;
  font-weight: 600;
}

.subject-tag {
  background: var(--c-light);
  color: var(--c-text);
  padding: .25rem .75rem;
  border-radius: 20px;
  font-size: .78rem;
  font-weight: 600;
}

.phase-badge {
  background: var(--c-primary);
  color: var(--c-white);
  padding: .25rem .75rem;
  border-radius: 20px;
  font-size: .78rem;
  font-weight: 600;
}

.q-number { font-size: .82rem; color: var(--c-gray-600); margin-bottom: .4rem; }

.q-text {
  font-size: 1.2rem;
  font-weight: 500;
  line-height: 1.6;
  margin-bottom: 1.6rem;
  min-height: 52px;
}

/* Input de resposta */
.answer-label { display: block; font-size: .88rem; font-weight: 600; color: var(--c-gray-600); margin-bottom: .45rem; }

.answer-row { display: flex; gap: .6rem; }

.answer-input {
  flex: 1;
  padding: .7rem 1rem;
  border: 2px solid var(--c-gray-400);
  border-radius: var(--radius);
  font-size: 1.05rem;
  outline: none;
  transition: var(--trans);
}
.answer-input:focus { border-color: var(--c-primary); box-shadow: 0 0 0 3px var(--c-shadow); }
.answer-input.correct   { border-color: var(--c-success); background: #f0fff4; }
.answer-input.incorrect { border-color: var(--c-danger);  background: #fff5f5; }

.submit-btn {
  padding: .7rem 1.4rem;
  background: var(--c-primary);
  color: var(--c-white);
  border: none;
  border-radius: var(--radius);
  font-size: .95rem;
  font-weight: 700;
  transition: var(--trans);
  white-space: nowrap;
}
.submit-btn:hover { background: var(--c-dark); transform: translateY(-1px); box-shadow: 0 4px 12px var(--c-shadow); }
.submit-btn:active { transform: translateY(0); }

/* Feedback */
.feedback {
  margin-top: 1.3rem;
  padding: 1.2rem 1.4rem;
  border-radius: var(--radius);
  display: none;
}
.feedback-correct   { background: #f0fff4; border: 1px solid #c3e6cb; }
.feedback-incorrect { background: #fff5f5; border: 1px solid #f5c6cb; }

.feedback-icon { font-size: 1.6rem; margin-bottom: .3rem; }
.feedback-text { font-size: 1rem; font-weight: 600; margin-bottom: .4rem; }
.feedback-hint { font-size: .9rem; color: var(--c-gray-600); line-height: 1.55; margin-bottom: .9rem; }

.next-btn {
  padding: .5rem 1.3rem;
  background: var(--c-primary);
  color: var(--c-white);
  border: none;
  border-radius: 8px;
  font-size: .9rem;
  font-weight: 600;
  transition: var(--trans);
}
.next-btn:hover { background: var(--c-dark); }

/* ── Modais ───────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-overlay.active { display: flex; }

.modal-box {
  background: var(--c-white);
  border-radius: var(--radius-lg);
  padding: 2.2rem;
  max-width: 440px;
  width: 100%;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0,0,0,.25);
  animation: popIn .25s ease;
}

@keyframes popIn {
  from { opacity: 0; transform: scale(.9); }
  to   { opacity: 1; transform: scale(1); }
}

.modal-icon  { font-size: 3rem; margin-bottom: .8rem; }
.modal-box h2 { font-size: 1.5rem; margin-bottom: .6rem; color: var(--c-text); }
.modal-box p  { color: var(--c-gray-600); margin-bottom: 1.4rem; line-height: 1.5; }

.modal-btns { display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap; }

.btn-advance {
  padding: .7rem 1.6rem;
  background: var(--c-primary);
  color: var(--c-white);
  border: none;
  border-radius: 10px;
  font-size: .95rem;
  font-weight: 700;
  transition: var(--trans);
}
.btn-advance:hover { background: var(--c-dark); }

.btn-stay {
  padding: .7rem 1.6rem;
  background: var(--c-gray-100);
  color: var(--c-gray-800);
  border: 2px solid var(--c-gray-400);
  border-radius: 10px;
  font-size: .95rem;
  font-weight: 600;
  transition: var(--trans);
}
.btn-stay:hover { background: var(--c-gray-200); }

/* ── Dashboard ────────────────────────────────────────────── */
.dashboard-wrap {
  max-width: 1100px;
  margin: 1.8rem auto;
  padding: 0 1rem;
}

.dash-title { font-size: 1.6rem; color: var(--c-text); margin-bottom: 1.2rem; font-weight: 700; }

/* Cards de resumo */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 1.8rem;
}

.stat-card {
  background: var(--c-white);
  border-radius: var(--radius);
  padding: 1.3rem 1rem;
  text-align: center;
  box-shadow: 0 3px 14px var(--c-shadow);
  border: 1px solid var(--c-light);
  transition: var(--trans);
}
.stat-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px var(--c-shadow); }

.stat-icon  { font-size: 1.8rem; margin-bottom: .4rem; }
.stat-value { font-size: 2rem; font-weight: 700; color: var(--c-dark); }
.stat-label { font-size: .78rem; color: var(--c-gray-600); margin-top: .2rem; }

/* Grade de gráficos */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
  margin-bottom: 1.8rem;
}

.chart-card {
  background: var(--c-white);
  border-radius: var(--radius);
  padding: 1.3rem;
  box-shadow: 0 3px 14px var(--c-shadow);
  border: 1px solid var(--c-light);
}
.chart-card h3 { font-size: .95rem; color: var(--c-gray-600); margin-bottom: 1rem; font-weight: 600; }
.chart-wide { grid-column: 1 / -1; }

/* Dicas */
.tips-section {
  background: var(--c-white);
  border-radius: var(--radius);
  padding: 1.4rem;
  box-shadow: 0 3px 14px var(--c-shadow);
  border: 1px solid var(--c-light);
  margin-bottom: 2rem;
}
.tips-section > h3 { font-size: 1rem; font-weight: 700; margin-bottom: 1rem; }

#tipsList { display: flex; flex-direction: column; gap: .75rem; }

.tip-card {
  padding: 1rem 1.1rem;
  background: var(--c-light);
  border-radius: 10px;
  border-left: 4px solid var(--c-primary);
}

.tip-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: .35rem; }
.tip-subject { font-weight: 700; color: var(--c-text); font-size: .95rem; }
.tip-pct { font-size: .8rem; font-weight: 700; padding: .15rem .55rem; border-radius: 20px; }
.pct-low { background: #ffecec; color: #c0392b; }
.pct-mid { background: #fff8e0; color: #b7770d; }

.tip-text { font-size: .88rem; color: var(--c-gray-600); line-height: 1.55; }

.no-data { text-align: center; color: var(--c-gray-600); padding: 1.5rem; font-style: italic; }

/* ── Loading overlay ──────────────────────────────────────── */
#loadingOverlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(255,255,255,.88);
  z-index: 500;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}
#loadingOverlay.active { display: flex; }

.spinner {
  width: 46px; height: 46px;
  border: 4px solid var(--c-gray-200);
  border-top-color: var(--c-primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Controles de admin ───────────────────────────────────── */
.admin-controls {
  background: var(--c-white);
  border-radius: var(--radius);
  padding: .9rem 1.2rem;
  margin-bottom: 1.3rem;
  box-shadow: 0 3px 14px var(--c-shadow);
  border-left: 4px solid var(--c-primary);
}

.admin-row {
  display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
}
.admin-label { font-weight: 600; font-size: .88rem; color: var(--c-gray-600); }

.admin-row select {
  padding: .4rem .75rem;
  border: 2px solid var(--c-gray-400);
  border-radius: 8px;
  font-size: .9rem;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  transition: var(--trans);
}
.admin-row select:focus { border-color: var(--c-primary); }

.comp-toggle-btn {
  margin-left: auto;
  padding: .45rem 1.1rem;
  background: var(--c-primary);
  color: var(--c-white);
  border: none;
  border-radius: 8px;
  font-size: .88rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--trans);
  font-family: inherit;
}
.comp-toggle-btn:hover { background: var(--c-dark); }

/* ── Questões com erro ────────────────────────────────────── */
.wrong-section {
  background: var(--c-white);
  border-radius: var(--radius);
  padding: 1.4rem;
  box-shadow: 0 3px 14px var(--c-shadow);
  border: 1px solid var(--c-light);
  margin-bottom: 2rem;
}
.wrong-section > h3 { font-size: 1rem; font-weight: 700; margin-bottom: 1rem; }

#wrongAnswersList { display: flex; flex-direction: column; gap: .65rem; }

.wrong-item {
  padding: .9rem 1rem;
  background: #fff5f5;
  border-radius: 10px;
  border-left: 4px solid var(--c-danger);
  display: flex;
  flex-direction: column;
  gap: .45rem;
}

.wrong-item-header {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
}

.corrected-badge {
  font-size: .72rem;
  background: #d4edda;
  color: #155724;
  padding: .15rem .55rem;
  border-radius: 20px;
  font-weight: 600;
  margin-left: auto;
}

.wrong-item-question {
  font-size: .95rem;
  font-weight: 500;
  color: var(--c-gray-800);
  line-height: 1.4;
}

.wrong-answer-row {
  display: flex; align-items: center; gap: .5rem;
  font-size: .85rem; flex-wrap: wrap;
}
.wrong-label   { color: var(--c-gray-600); }
.wrong-user    { color: var(--c-danger);   font-weight: 700; }
.wrong-arrow   { color: var(--c-gray-400); font-size: 1.1rem; }
.wrong-correct { color: var(--c-success);  font-weight: 700; }

/* ── Comparativo ──────────────────────────────────────────── */
.comp-table-wrap {
  background: var(--c-white);
  border-radius: var(--radius);
  padding: 1.3rem;
  box-shadow: 0 3px 14px var(--c-shadow);
  border: 1px solid var(--c-light);
  margin-bottom: 2rem;
  overflow-x: auto;
}

.comp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}
.comp-table th {
  padding: .65rem 1rem;
  text-align: left;
  font-size: .75rem;
  color: var(--c-gray-600);
  border-bottom: 2px solid var(--c-gray-200);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  white-space: nowrap;
}
.comp-table td {
  padding: .75rem 1rem;
  border-bottom: 1px solid #f0f0f0;
  white-space: nowrap;
}
.comp-table tr:last-child td { border-bottom: none; }
.comp-table tr:hover td { background: var(--c-gray-100); }

.acc-badge {
  padding: .2rem .65rem;
  border-radius: 20px;
  font-weight: 700;
  font-size: .82rem;
}
.acc-high { background: #d4edda; color: #155724; }
.acc-mid  { background: #fff3cd; color: #856404; }
.acc-low  { background: #f8d7da; color: #721c24; }

.comp-phase-badge {
  padding: .2rem .65rem;
  border-radius: 20px;
  font-size: .78rem;
  font-weight: 700;
  color: var(--c-white);
}
.comp-phase-1 { background: #7bc47b; }
.comp-phase-2 { background: #4a90d9; }
.comp-phase-3 { background: #ff8c00; }
.comp-phase-4 { background: #9b59b6; }
.comp-phase-5 { background: #e74c3c; }

/* ── Seleção de disciplina ────────────────────────────────── */
.disc-list {
  display: flex;
  flex-direction: column;
  gap: .7rem;
  margin-top: .5rem;
  text-align: left;
}

.disc-btn {
  display: flex;
  align-items: center;
  gap: .85rem;
  width: 100%;
  padding: 1rem 1.2rem;
  background: var(--c-gray-100);
  border: 2px solid var(--c-gray-200);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--trans);
  font-family: inherit;
}
.disc-btn:hover {
  border-color: #4a9e4a;
  background: #f0faf0;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(75,158,74,.15);
}

.disc-btn-icon { font-size: 1.6rem; flex-shrink: 0; }

.disc-btn-text { flex: 1; }
.disc-btn-name { font-size: 1rem; font-weight: 700; color: var(--c-gray-800); }
.disc-btn-desc { font-size: .8rem; color: var(--c-gray-600); margin-top: .15rem; }

.disc-btn-arrow { font-size: 1.4rem; color: var(--c-gray-400); flex-shrink: 0; }

/* ── Gestão de Alunos ─────────────────────────────────────── */
.sm-add-card,
.sm-list-card {
  background: var(--c-white);
  border-radius: var(--radius);
  padding: 1.4rem;
  box-shadow: 0 3px 14px var(--c-shadow);
  border: 1px solid var(--c-light);
  margin-bottom: 1.4rem;
}
.sm-add-card h3,
.sm-list-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: 1rem; }

.sm-add-form {
  display: flex; gap: .6rem; flex-wrap: wrap; align-items: center;
}

.sm-input {
  flex: 1; min-width: 140px;
  padding: .6rem .9rem;
  border: 2px solid var(--c-gray-400);
  border-radius: var(--radius);
  font-size: .95rem;
  font-family: inherit;
  outline: none;
  transition: var(--trans);
}
.sm-input:focus { border-color: var(--c-primary); box-shadow: 0 0 0 3px var(--c-shadow); }

.sm-btn-add {
  padding: .6rem 1.4rem;
  background: var(--c-primary);
  color: var(--c-white);
  border: none;
  border-radius: var(--radius);
  font-size: .95rem;
  font-weight: 700;
  transition: var(--trans);
  white-space: nowrap;
}
.sm-btn-add:hover { background: var(--c-dark); }

.sm-msg {
  margin-top: .75rem;
  padding: .5rem .9rem;
  border-radius: 8px;
  font-size: .88rem;
  font-weight: 600;
}
.sm-msg-ok  { background: #d4edda; color: #155724; }
.sm-msg-err { background: #f8d7da; color: #721c24; }

.sm-table-wrap { overflow-x: auto; }

.sm-table {
  width: 100%; border-collapse: collapse; font-size: .9rem;
}
.sm-table th {
  padding: .6rem 1rem;
  text-align: left;
  font-size: .75rem;
  color: var(--c-gray-600);
  border-bottom: 2px solid var(--c-gray-200);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  white-space: nowrap;
}
.sm-table td {
  padding: .7rem 1rem;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: middle;
}
.sm-table tr:last-child td { border-bottom: none; }
.sm-table tr:hover td { background: var(--c-gray-100); }

.status-badge {
  padding: .2rem .65rem;
  border-radius: 20px;
  font-size: .8rem;
  font-weight: 700;
  white-space: nowrap;
}
.status-active   { background: #d4edda; color: #155724; }
.status-inactive { background: #f8d7da; color: #721c24; }

.self-badge {
  background: var(--c-light);
  color: var(--c-text);
  font-size: .7rem;
  font-weight: 600;
  padding: .1rem .45rem;
  border-radius: 20px;
  vertical-align: middle;
}

.pw-dots { letter-spacing: .1em; color: var(--c-gray-600); }

.sm-actions { display: flex; gap: .4rem; flex-wrap: wrap; }

.sm-btn-edit,
.sm-btn-toggle,
.sm-btn-save,
.sm-btn-cancel {
  padding: .28rem .75rem;
  border: none;
  border-radius: 6px;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--trans);
  font-family: inherit;
  white-space: nowrap;
}
.sm-btn-edit   { background: #e3f2fd; color: #1565c0; }
.sm-btn-edit:hover { background: #bbdefb; }
.sm-btn-deact  { background: #fff3e0; color: #e65100; }
.sm-btn-deact:hover { background: #ffe0b2; }
.sm-btn-act    { background: #e8f5e9; color: #2e7d32; }
.sm-btn-act:hover { background: #c8e6c9; }
.sm-btn-save   { background: var(--c-primary); color: var(--c-white); }
.sm-btn-save:hover { background: var(--c-dark); }
.sm-btn-cancel { background: var(--c-gray-200); color: var(--c-gray-800); }
.sm-btn-cancel:hover { background: var(--c-gray-400); }

.edit-pw-row {
  display: flex; gap: .5rem; flex-wrap: wrap; align-items: center;
  padding: .5rem 0;
}

/* ── Responsivo ───────────────────────────────────────────── */
@media (max-width: 680px) {
  .header-inner { flex-direction: column; text-align: center; }
  .charts-grid  { grid-template-columns: 1fr; }
  .chart-wide   { grid-column: 1; }
  .answer-row   { flex-direction: column; }
  .q-text       { font-size: 1.05rem; }
  .phases       { flex-wrap: wrap; justify-content: center; }
}


/* ── Aba Materiais / Provas ─────────────────────────────── */
.mt-hint { margin-top: .6rem; font-size: .8rem; color: var(--c-gray-600, #6c757d); }

.ex-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
@media (max-width: 640px) { .ex-grid { grid-template-columns: 1fr; } }

.ex-field { display: block; margin-bottom: .9rem; }
.ex-field > span {
  display: block; margin-bottom: .3rem;
  font-size: .82rem; font-weight: 600; color: #6c757d;
}
.ex-textarea { width: 100%; font-family: inherit; resize: vertical; line-height: 1.5; }

.ex-picker {
  max-height: 190px; overflow-y: auto;
  border: 1px solid #dee2e6; border-radius: 8px; padding: .55rem; background: #fff;
}
.ex-mat {
  display: flex; align-items: center; gap: .5rem;
  padding: .35rem .3rem; border-radius: 6px; cursor: pointer; font-size: .9rem;
}
.ex-mat:hover { background: #f1f3f5; }
.ex-mat input { width: auto; margin: 0; }

.ex-sub   { font-size: .8rem; color: #6c757d; }
.ex-draft { color: #e65100; font-weight: 600; }


/* ── Geração e revisão ──────────────────────────────────── */
.sm-btn-gen, .sm-btn-review {
  padding: .3rem .7rem; border: none; border-radius: 6px;
  font-size: .8rem; font-weight: 600; cursor: pointer;
  font-family: inherit; margin-right: .3rem;
}
.sm-btn-gen    { background: #ede7f6; color: #5e35b1; }
.sm-btn-gen:hover { background: #d1c4e9; }
.sm-btn-review { background: #fff3e0; color: #e65100; }
.sm-btn-review:hover { background: #ffe0b2; }

.gen-status {
  margin: .9rem 0; padding: .9rem 1rem; border-radius: 10px;
  background: #ede7f6; color: #4527a0; font-size: .9rem; font-weight: 600;
}

.rv-toolbar {
  display: flex; flex-wrap: wrap; gap: .6rem;
  align-items: center; justify-content: space-between; margin-bottom: .6rem;
}
.rv-count { margin-right: .8rem; font-size: .85rem; color: #6c757d; }

.rv-card {
  border: 1px solid #dee2e6; border-radius: 10px;
  padding: .9rem 1rem; margin-bottom: .9rem; background: #fdfdfd;
}
.rv-head { display: flex; flex-wrap: wrap; gap: .45rem; margin-bottom: .7rem; }
.rv-phase   { background: #4a90d9; color: #fff; padding: .15rem .55rem; border-radius: 20px; font-size: .75rem; font-weight: 700; }
.rv-subject { background: #e8f5e9; color: #2e7d32; padding: .15rem .55rem; border-radius: 20px; font-size: .75rem; font-weight: 600; }
.rv-chapter { color: #6c757d; font-size: .75rem; align-self: center; }
.rv-actions { display: flex; flex-wrap: wrap; gap: .4rem; }


/* ── Atalho para a área do professor ────────────────────── */
.teacher-link {
  display: block; width: 100%; margin-top: 1rem; padding: .8rem;
  border: 2px dashed #b39ddb; border-radius: 10px; background: #f6f3fb;
  color: #5e35b1; font-size: .92rem; font-weight: 700;
  cursor: pointer; font-family: inherit; text-align: center;
}
.teacher-link:hover { background: #ede7f6; border-style: solid; }


/* Input dentro do modal de pergunta */
#askInput { width: 120px; margin: .6rem auto 0; text-align: center; font-size: 1.1rem; }
#askModal .modal-box p { margin-bottom: .3rem; }


/* ── Pó de Fênix, nível e novas ações ───────────────────── */
.dust-box .streak-icon { filter: none; }
.level-box {
  display: flex; flex-direction: column; align-items: center;
  padding: .2rem .7rem; border-left: 1px solid rgba(0,0,0,.08);
}
.level-lbl { font-size: .62rem; text-transform: uppercase; letter-spacing: .04em; color: #6c757d; }
#levelName { font-size: .85rem; font-weight: 800; color: #5e35b1; white-space: nowrap; }

.restart-btn { background: #fff3e0 !important; color: #e65100 !important; }

.feedback-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .9rem; }
.dust-btn {
  padding: .6rem 1.1rem; border: 2px solid #b39ddb; border-radius: 10px;
  background: #f6f3fb; color: #5e35b1;
  font-size: .92rem; font-weight: 700; cursor: pointer; font-family: inherit;
}
.dust-btn:hover { background: #ede7f6; }
