:root {
  /* tema CLARO (refinado p/ o espectro neural) */
  --bg-page: #eef1f7;
  --bg-card: #ffffff;
  --bg-header-a: #1a1a23;
  --bg-header-b: #26262f;
  --primary: #7c3aed;
  --primary-dark: #6d28d9;
  --accent: #0891b2;
  --text: #10131c;
  --text-muted: #6b7280;
  --border: #e4e8f0;
  --success: #15803d;
  --success-bg: #dcfce7;
  --error: #b91c1c;
  --error-bg: #fee2e2;
  --hover-bg: #f1ecfe;
  --surface-bg: #f4f6fb;
  --badge-real-bg: #fff0e0;
  --badge-real-text: #c2410c;
  --badge-ia-bg: #ede9fe;
  --badge-ia-text: #6d28d9;
  --radius: 14px;
  --shadow: 0 4px 18px rgba(15, 23, 42, 0.07);
  /* assinatura NeuralWorld/Sinaptcom (independente de tema) */
  --cyan: #22d3ee; --blue: #3b82f6; --violet: #8b5cf6; --magenta: #d946ef; --orange: #ff6b00;
  --spectrum: linear-gradient(115deg, #22d3ee, #3b82f6, #8b5cf6, #d946ef, #ff6b00);
  --aura: linear-gradient(120deg, #a855f7, #22d3ee);
  --sidebar-w: 250px;
}

[data-theme="dark"] {
  /* tema ESCURO NEURAL (padrão) — quase-preto + espectro */
  --bg-page: #07070b;
  --bg-card: #121219;
  --bg-header-a: #0c0c12;
  --bg-header-b: #1a1a23;
  --primary: #8b5cf6;
  --primary-dark: #a855f7;
  --accent: #22d3ee;
  --text: #ecedf3;
  --text-muted: #8b8c9b;
  --border: #262630;
  --success: #22c55e;
  --success-bg: rgba(34, 197, 94, 0.12);
  --error: #f87171;
  --error-bg: rgba(248, 113, 113, 0.12);
  --hover-bg: rgba(139, 92, 246, 0.10);
  --surface-bg: #1a1a23;
  --badge-real-bg: rgba(255, 107, 0, 0.16);
  --badge-real-text: #ffa040;
  --badge-ia-bg: rgba(139, 92, 246, 0.18);
  --badge-ia-text: #c4b5fd;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

[data-theme="light"] {
  /* tema CLARO — branco + azul suave */
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-header-a: #f1f5f9;
  --bg-header-b: #e2e8f0;
  --primary: #2f5fc4;
  --primary-dark: #1e3a6e;
  --accent: #0d9488;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --success: #15803d;
  --success-bg: #dcfce7;
  --error: #b91c1c;
  --error-bg: #fee2e2;
  --hover-bg: #eaf1fb;
  --surface-bg: #f1f5f9;
  --badge-real-bg: #fef3c7;
  --badge-real-text: #92400e;
  --badge-ia-bg: #e0e7ff;
  --badge-ia-text: #3730a3;
  --shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  background: var(--bg-page);
  color: var(--text);
  line-height: 1.6;
  transition: background 0.2s, color 0.2s;
}

.app-header {
  position: relative;
  background: linear-gradient(135deg, var(--bg-header-a), var(--bg-header-b));
  color: #fff;
  padding: 32px 16px;
  text-align: center;
}

.app-header h1 {
  margin: 0 0 4px;
  font-size: 1.8rem;
}

.app-header .subtitle {
  margin: 0;
  opacity: 0.9;
  font-size: 0.95rem;
}

.theme-toggle {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.22);
}

.container {
  max-width: 880px;
  margin: 0 auto;
  padding: 24px 16px 64px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  transition: background 0.2s, border-color 0.2s;
}

.card h2 {
  margin-top: 0;
  font-size: 1.2rem;
  color: var(--primary-dark);
}

.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
}

select,
input[type="range"] {
  width: 100%;
}

select {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 1rem;
  background: var(--bg-card);
  color: var(--text);
}

.hint {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 8px 0 0;
}

.materias-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.materia-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  transition: border-color 0.15s, background 0.15s;
}

.materia-item:hover {
  border-color: var(--primary);
  background: var(--hover-bg);
}

.materia-item input {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
}

.materias-actions {
  display: flex;
  gap: 16px;
  margin-top: 10px;
}

.link-btn {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0;
  text-decoration: underline;
}

.btn {
  display: inline-block;
  border: none;
  border-radius: 8px;
  padding: 12px 22px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.05s, opacity 0.15s, background 0.15s;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: var(--accent);
  color: #fff;
  margin-top: 16px;
}

.btn-secondary:hover {
  opacity: 0.9;
}

/* Conteudo didatico */
.conteudo-item {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  margin-top: 16px;
}

.conteudo-item:first-child {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

.conteudo-item h3 {
  color: var(--primary-dark);
}

.markdown-body h2 {
  font-size: 1.1rem;
  color: var(--accent);
  margin-top: 20px;
}

.markdown-body h3 {
  font-size: 1rem;
}

.markdown-body ul {
  padding-left: 20px;
}

.markdown-body code {
  background: var(--surface-bg);
  padding: 2px 4px;
  border-radius: 4px;
  font-size: 0.9em;
}

/* Conteudo didatico: accordion de topicos + quiz inline */
.conteudo-materia {
  margin-bottom: 28px;
}

.conteudo-materia > h3 {
  margin: 0 0 12px;
  color: var(--primary-dark);
}

.topico {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  background: var(--bg-card);
  overflow: hidden;
}

.topico > summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 18px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  user-select: none;
}

.topico > summary::-webkit-details-marker {
  display: none;
}

.topico > summary::after {
  content: '⌄';
  font-size: 1.1rem;
  line-height: 1;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.topico[open] > summary::after {
  transform: rotate(180deg);
}

.topico > summary:hover {
  background: var(--surface-bg);
}

.topico-body {
  padding: 4px 18px 18px;
  border-top: 1px solid var(--border);
}

/* Quiz inline do conteudo */
.quiz-bloco {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}

.quiz-bloco > h4 {
  margin: 0 0 12px;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.quiz {
  margin-bottom: 18px;
}

.quiz-enunciado {
  margin: 0 0 10px;
  font-weight: 500;
  color: var(--text);
}

.quiz-alts {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quiz-alt {
  text-align: left;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.quiz-alt:hover:not(:disabled) {
  background: var(--surface-bg);
  border-color: var(--primary);
}

.quiz-alt:disabled {
  cursor: default;
}

.quiz-alt.correct {
  border-color: var(--success);
  background: var(--success-bg);
}

.quiz-alt.incorrect {
  border-color: var(--error);
  background: var(--error-bg);
}

.quiz-feedback {
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--surface-bg);
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.quiz-feedback p {
  margin: 0;
}

.quiz-tag {
  display: block;
  font-weight: 700;
  margin-bottom: 4px;
}

.quiz-tag.acerto {
  color: var(--success);
}

.quiz-tag.erro {
  color: var(--error);
}

/* Visor de custo da geracao de questoes */
.custo-visor {
  margin: 0 0 14px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--surface-bg);
  border: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--text);
}

.custo-visor .custo-teto {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Login + barra de usuario + painel admin */
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--surface-bg);
}

.login-screen[hidden] {
  display: none;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 24px;
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-card h2 {
  margin: 0;
  color: var(--primary-dark);
  text-align: center;
}

.login-sub {
  margin: 0 0 4px;
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
}

.login-input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-bg);
  color: var(--text);
  font-size: 1rem;
  box-sizing: border-box;
}

.login-input:focus {
  outline: none;
  border-color: var(--primary);
}

.login-erro {
  margin: 0;
  color: var(--error);
  font-size: 0.88rem;
}

.user-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
  font-size: 0.9rem;
}

.user-greet {
  font-weight: 600;
}

.quota-info {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface-bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.82rem;
}

.admin-card {
  max-width: 460px;
}

.admin-lista {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.admin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-bg);
}

.admin-nome {
  font-weight: 600;
}

.admin-num {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.admin-num small {
  opacity: 0.75;
}

/* Ranking */
.ranking-section h2 {
  margin-bottom: 4px;
}

.ranking-output {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  margin-top: 12px;
}

.ranking-materia {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-bg);
  padding: 12px 14px;
}

.ranking-materia h4 {
  margin: 0 0 10px;
  font-size: 0.95rem;
  color: var(--primary-dark);
}

.ranking-lista {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ranking-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
}

.ranking-pos {
  font-weight: 700;
  color: var(--text-muted);
  width: 22px;
  flex-shrink: 0;
}

.avatar {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
}

.ranking-nome {
  flex: 1;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ranking-nums {
  color: var(--text-muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

.ranking-nums strong {
  color: var(--success);
}

/* Questoes */
.questao {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

.questao-header {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
}

.badge-real {
  background: var(--badge-real-bg);
  color: var(--badge-real-text);
}

.badge-ia {
  background: var(--badge-ia-bg);
  color: var(--badge-ia-text);
}

.badge-materia {
  background: var(--surface-bg);
  color: var(--text-muted);
}

.questao-enunciado {
  margin: 0 0 12px;
}

.alternativas {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.alternativa {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}

.alternativa:hover {
  border-color: var(--primary);
}

.alternativa input {
  margin-top: 4px;
  accent-color: var(--primary);
}

.alternativa.correta {
  border-color: var(--success);
  background: var(--success-bg);
}

.alternativa.incorreta {
  border-color: var(--error);
  background: var(--error-bg);
}

.explicacao {
  margin-top: 12px;
  padding: 12px;
  background: var(--surface-bg);
  border-radius: 8px;
  font-size: 0.92rem;
}

.explicacao .base-legal {
  color: var(--text-muted);
  font-style: italic;
}

/* Selo discreto de origem (IA / Banco) no canto do card */
.origem-tag {
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 1px 7px;
  border-radius: 999px;
  opacity: 0.6;
  pointer-events: none;
}
.origem-tag.origem-ia { background: var(--badge-ia-bg); color: var(--badge-ia-text); }
.origem-tag.origem-real { background: var(--badge-real-bg); color: var(--badge-real-text); }
.origem-tag.origem-banco { background: var(--success-bg); color: var(--success); }
.questao-header { padding-right: 56px; }
.gerar-acoes { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* Ações e estados da correção por questão */
.questao-acoes { margin-top: 12px; }
.btn-corrigir-questao {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--primary);
  background: transparent;
  border: 1px solid var(--primary);
  border-radius: 8px;
  padding: 5px 12px;
  cursor: pointer;
}
.btn-corrigir-questao:hover { background: var(--primary); color: #fff; }
.questao.corrigida.acertou { border-left: 3px solid var(--success); }
.questao.corrigida.errou { border-left: 3px solid var(--error); }
.questao.pendente-flash { outline: 2px solid var(--primary); outline-offset: 2px; }
.res-tag {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 6px;
}
.res-tag.acerto { color: var(--success); }
.res-tag.erro { color: var(--error); }
.questoes-acoes-rodape { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-top: 8px; }

/* Questoes discursivas */
.discursiva {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

.discursiva-resposta {
  width: 100%;
  resize: vertical;
  min-height: 180px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 0.95rem;
  background: var(--bg-card);
  color: var(--text);
}

.discursiva-contador {
  margin: 6px 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: right;
}

.discursiva-contador.limite-excedido {
  color: var(--error);
  font-weight: 600;
}

.discursiva-correcao {
  margin-top: 14px;
  padding: 14px;
  background: var(--surface-bg);
  border-radius: 8px;
}

.discursiva-correcao[hidden] {
  display: none;
}

/* Textos de apoio (redacao) */
.textos-apoio {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 12px 0 16px;
}

.texto-apoio {
  position: relative;
  padding: 12px 14px 12px 18px;
  background: var(--surface-bg);
  border-left: 3px solid var(--primary);
  border-radius: 8px;
  font-size: 0.92rem;
}

.texto-apoio .texto-apoio-numero {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.resultado {
  margin-top: 16px;
  padding: 14px;
  border-radius: 8px;
  background: var(--hover-bg);
  font-weight: 600;
  text-align: center;
  color: var(--primary-dark);
}

/* Modal de confirmacao */
.confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1200;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.confirm-overlay[hidden] {
  display: none;
}

.confirm-overlay.visible {
  opacity: 1;
}

.confirm-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  max-width: 380px;
  width: 100%;
  transform: scale(0.94) translateY(8px);
  transition: transform 0.2s ease;
}

.confirm-overlay.visible .confirm-card {
  transform: scale(1) translateY(0);
}

.confirm-card h3 {
  margin: 0 0 8px;
  color: var(--primary-dark);
}

.confirm-card p {
  margin: 0 0 20px;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: var(--surface-bg);
  color: var(--text);
}

/* Loading overlay */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
  gap: 16px;
  z-index: 1000;
  padding: 24px;
  text-align: center;
}

.loading-overlay[hidden] {
  display: none;
}

.spinner {
  width: 42px;
  height: 42px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-tip {
  max-width: 340px;
  font-size: 0.9rem;
  opacity: 0.95;
  min-height: 2.6em;
  transition: opacity 0.3s ease;
}

.loading-tip.fade {
  opacity: 0;
}

.app-footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 16px;
}

/* Agente de Estudos (chat) */
.chat-fab {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 52px;
  height: 52px;
  border-radius: 999px;
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 1.4rem;
  cursor: grab;
  box-shadow: var(--shadow);
  z-index: 1101;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.85;
  touch-action: none;
  transition: opacity 0.15s, transform 0.15s;
}

.chat-fab:hover {
  opacity: 1;
  transform: scale(1.05);
}

.chat-fab.dragging {
  cursor: grabbing;
  opacity: 1;
  transform: scale(1.08);
  transition: none;
}

.chat-panel {
  position: fixed;
  bottom: 84px;
  right: 20px;
  width: min(380px, calc(100vw - 32px));
  height: min(520px, calc(100vh - 120px));
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1100;
}

.chat-panel[hidden] {
  display: none;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: linear-gradient(135deg, var(--bg-header-a), var(--bg-header-b));
  color: #fff;
  font-weight: 600;
}

.chat-header-actions {
  display: flex;
  gap: 6px;
}

.chat-icon-btn {
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: #fff;
  border-radius: 6px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-icon-btn:hover {
  background: rgba(255, 255, 255, 0.22);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-msg {
  max-width: 90%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.5;
}

.chat-msg.user {
  align-self: flex-end;
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-msg.assistant {
  align-self: flex-start;
  background: var(--surface-bg);
  color: var(--text);
  border-bottom-left-radius: 4px;
}

.chat-msg.assistant.loading {
  font-style: italic;
  color: var(--text-muted);
}

.chat-msg p:first-child {
  margin-top: 0;
}

.chat-msg p:last-child {
  margin-bottom: 0;
}

.chat-empty {
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
  margin: auto;
  padding: 16px;
}

.chat-form {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--border);
}

.chat-input {
  flex: 1;
  resize: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 0.9rem;
  background: var(--bg-card);
  color: var(--text);
  max-height: 100px;
}

.chat-send {
  border: none;
  background: var(--primary);
  color: #fff;
  border-radius: 8px;
  width: 40px;
  font-size: 1.1rem;
  cursor: pointer;
}

.chat-send:hover {
  background: var(--primary-dark);
}

.chat-send:disabled {
  opacity: 0.6;
  cursor: default;
}

.btn-duvida {
  margin-top: 10px;
  background: var(--surface-bg);
  color: var(--primary-dark);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-duvida:hover {
  border-color: var(--primary);
}

@media (max-width: 480px) {
  .chat-panel {
    right: 8px;
    left: 8px;
    width: auto;
    bottom: 78px;
  }

  .chat-fab {
    right: 16px;
    bottom: 16px;
  }
}

/* Marca d'água */
.brand-watermark {
  position: fixed;
  bottom: 10px;
  left: 14px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.7rem;
  opacity: 0.6;
  pointer-events: none;
  user-select: none;
  z-index: 500;
}

.brand-watermark strong {
  color: var(--primary);
  font-weight: 700;
}

/* Aviso de cobertura: materias selecionadas x quantidade de questoes */
.aviso-cobertura {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  border-left: 3px solid var(--primary);
  background: var(--surface-bg);
  color: var(--text);
  font-size: 0.85rem;
  line-height: 1.5;
}

.aviso-cobertura[hidden] {
  display: none;
}

/* Sala 1×1 (prova compartilhada) */
.sala-acoes {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 8px;
}
.sala-entrar {
  display: flex;
  gap: 8px;
  align-items: center;
}
.sala-entrar .login-input {
  width: 160px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.sala-topo {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
#sala-codigo-atual {
  font-family: monospace;
  letter-spacing: 0.12em;
  background: var(--surface-bg);
  padding: 2px 10px;
  border-radius: 8px;
}
.sala-status {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
}
.sala-status.ok { background: var(--success-bg); color: var(--success); }
.sala-status.wait { background: var(--surface-bg); color: var(--text-muted); }
.sala-respostas {
  list-style: none;
  padding: 0;
  margin: 6px 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sala-respostas li {
  font-size: 0.9rem;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--surface-bg);
}
.sala-respostas li.acerto { color: var(--success); }
.sala-respostas li.erro { color: var(--error); }
.sala-placar {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sala-placar li { font-size: 1rem; }

/* ===================== Seletor de dificuldade ===================== */
.dificuldade-row { display: flex; gap: 8px; flex-wrap: wrap; }
.dif-btn {
  flex: 1; min-width: 90px; padding: 9px 10px; cursor: pointer;
  border: 1.5px solid var(--border); border-radius: 8px;
  background: var(--surface-bg); color: var(--text-muted);
  font-size: 0.9rem; font-weight: 600; transition: all 0.15s;
}
.dif-btn:hover { border-color: var(--primary); }
.dif-btn.on { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ===================== Minhas Questões ===================== */
.minhas-topo { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.minhas-resumo { margin: 10px 0 4px; }
.minhas-cards { display: flex; gap: 10px; flex-wrap: wrap; }
.minha-card {
  flex: 1; min-width: 90px; text-align: center; padding: 12px 8px;
  background: var(--surface-bg); border: 1px solid var(--border); border-radius: 10px;
}
.minha-card strong { display: block; font-size: 1.5rem; color: var(--text); line-height: 1.1; }
.minha-card span { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.4px; }
.minha-card.ok strong { color: var(--success); }
.minha-card.err strong { color: var(--error); }
.minhas-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.minha-chip {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 0.74rem; font-weight: 600; border: 1px solid var(--border);
  background: var(--surface-bg); color: var(--text-muted);
}
.minha-chip.dif-facil { background: var(--success-bg); color: var(--success); border-color: transparent; }
.minha-chip.dif-medio { background: var(--badge-real-bg); color: var(--badge-real-text); border-color: transparent; }
.minha-chip.dif-dificil { background: var(--error-bg); color: var(--error); border-color: transparent; }
.minha-chip.materia { background: var(--badge-ia-bg); color: var(--badge-ia-text); border-color: transparent; }
.minha-chip.vezes { background: var(--hover-bg); color: var(--primary); border-color: transparent; }

.minhas-filtros { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin: 14px 0; }
.minhas-filtro-chk { display: flex; align-items: center; gap: 6px; font-size: 0.9rem; font-weight: 600; color: var(--text); cursor: pointer; }
.minhas-filtro-chk input { width: 16px; height: 16px; cursor: pointer; }
.minhas-select {
  padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg-card); color: var(--text); font-size: 0.86rem; cursor: pointer;
}

.minhas-lista { display: flex; flex-direction: column; gap: 14px; }
.minha-questao {
  border: 1px solid var(--border); border-left: 4px solid var(--border);
  border-radius: 10px; padding: 14px 16px; background: var(--bg-card);
}
.minha-questao.q-err { border-left-color: var(--error); }
.minha-questao.q-ok { border-left-color: var(--success); }
.minha-q-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.minha-remover { margin-left: auto; }
.minha-enunciado { font-size: 0.92rem; line-height: 1.5; color: var(--text); margin-bottom: 10px; }
.minha-alts { display: flex; flex-direction: column; gap: 5px; margin-bottom: 8px; }
.minha-alt { font-size: 0.86rem; padding: 7px 11px; border-radius: 6px; border: 1px solid var(--border); color: var(--text-muted); }
.minha-alt.correta { background: var(--success-bg); color: var(--success); border-color: transparent; font-weight: 600; }
.minha-alt.incorreta { background: var(--error-bg); color: var(--error); border-color: transparent; text-decoration: line-through; }
.minha-tag { display: inline-block; font-size: 0.82rem; font-weight: 600; margin: 4px 0; }
.minha-tag.ok { color: var(--success); }
.minha-tag.err { color: var(--error); }
.minha-just { font-size: 0.84rem; line-height: 1.5; color: var(--text); background: var(--surface-bg); padding: 9px 12px; border-radius: 7px; margin-top: 8px; }
.minha-base { font-size: 0.78rem; color: var(--text-muted); margin-top: 6px; }

/* ===================================================================== */
/* ================  CASCA — Aprove no Concurso (Sinaptcom)  ============ */
/* ===================================================================== */
/* brilhos via gradiente no fundo (sem filter:blur — barato p/ GPU) */
body { position: relative; overflow-x: hidden; min-height: 100vh; background:
  radial-gradient(760px 520px at 10% -8%, rgba(139,92,246,.13), transparent 60%),
  radial-gradient(720px 520px at 108% 112%, rgba(255,107,0,.10), transparent 60%),
  var(--bg-page); background-attachment: fixed; }
[data-theme="light"] body { background:
  radial-gradient(760px 520px at 10% -8%, rgba(139,92,246,.07), transparent 60%),
  radial-gradient(720px 520px at 108% 112%, rgba(255,107,0,.05), transparent 60%),
  var(--bg-page); background-attachment: fixed; }
#nw-mesh { position: fixed; inset: 0; z-index: 0; opacity: .42; pointer-events: none; }
[data-theme="light"] #nw-mesh { opacity: .2; }
.nw-glow { display: none; }
.grad { background: var(--spectrum); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---- logo ---- */
.brand { display: flex; align-items: center; gap: 11px; }
.brand .mark { width: 38px; height: 38px; flex-shrink: 0; filter: drop-shadow(0 0 9px rgba(139,92,246,.5)); }
.brand-name { font-weight: 800; font-size: 16px; line-height: 1.1; letter-spacing: .2px; color: var(--text); }
.brand-name b { background: var(--spectrum); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-sub { font-size: 9.5px; letter-spacing: 2px; text-transform: uppercase; color: var(--text-muted); margin-top: 3px; }

/* ---- sidebar ---- */
.sidebar { position: fixed; left: 0; top: 0; width: var(--sidebar-w); height: 100vh; background: linear-gradient(180deg, var(--bg-header-a), var(--bg-page)); border-right: 1px solid var(--border); display: flex; flex-direction: column; z-index: 40; }
.side-logo { padding: 18px 18px; border-bottom: 1px solid var(--border); }
.nav { flex: 1; padding: 10px 0; overflow-y: auto; }
.nav-sec { padding: 14px 20px 6px; font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-muted); font-weight: 700; }
.nav-item { display: flex; align-items: center; gap: 13px; padding: 11px 20px; color: var(--text-muted); cursor: pointer; font-size: 14px; font-weight: 500; position: relative; transition: .18s; text-decoration: none; }
.nav-item svg { width: 19px; height: 19px; flex-shrink: 0; }
.nav-item:hover { color: var(--text); background: var(--hover-bg); }
.nav-item.active { color: var(--text); background: linear-gradient(90deg, rgba(139,92,246,.16), transparent); }
.nav-item.active::before { content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 3px; height: 22px; border-radius: 0 3px 3px 0; background: var(--spectrum); }
.nav-tag { margin-left: auto; font-size: 9px; font-weight: 800; padding: 2px 7px; border-radius: 8px; background: rgba(255,107,0,.16); color: #ffa040; letter-spacing: .5px; }
.side-foot { padding: 13px 16px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 11px; }
.s-avatar { width: 38px; height: 38px; border-radius: 11px; background: var(--spectrum); display: flex; align-items: center; justify-content: center; font-weight: 800; color: #fff; font-size: 14px; flex-shrink: 0; }
.s-name { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.s-role { font-size: 11px; color: var(--text-muted); }

/* ---- app main + topbar ---- */
.app-main { margin-left: var(--sidebar-w); position: relative; z-index: 1; min-height: 100vh; padding: 18px 26px 50px; }
.topbar { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.hamb { display: none; width: 40px; height: 40px; border-radius: 11px; background: var(--bg-card); border: 1px solid var(--border); color: var(--text); cursor: pointer; align-items: center; justify-content: center; }
.hamb svg { width: 20px; height: 20px; }
.searchbox { flex: 1; max-width: 440px; display: flex; align-items: center; gap: 9px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; color: var(--text-muted); }
.searchbox svg { width: 17px; height: 17px; flex-shrink: 0; }
.searchbox input { flex: 1; background: none; border: none; color: var(--text); font-size: 13px; outline: none; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.top-right[hidden] { display: none; }
.aura-pill { display: flex; align-items: center; gap: 8px; padding: 7px 14px 7px 10px; border-radius: 30px; background: rgba(168,85,247,.10); border: 1px solid rgba(168,85,247,.30); }
.aura-orb { width: 18px; height: 18px; border-radius: 50%; background: var(--aura); box-shadow: 0 0 12px rgba(168,85,247,.8); animation: auraOrb 2.6s ease-in-out infinite; flex-shrink: 0; }
@keyframes auraOrb { 0%,100% { transform: scale(1); } 50% { transform: scale(1.15); filter: brightness(1.3); } }
.aura-val { font-weight: 800; font-size: 14px; background: var(--aura); -webkit-background-clip: text; background-clip: text; color: transparent; line-height: 1; }
.aura-lbl { font-size: 8.5px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--text-muted); }
.icon-pill { width: 38px; height: 38px; border-radius: 11px; background: var(--bg-card); border: 1px solid var(--border); cursor: pointer; font-size: 15px; color: var(--text); transition: .2s; display: inline-flex; align-items: center; justify-content: center; }
.icon-pill:hover { border-color: var(--primary); }
.user-greet { font-size: 13px; font-weight: 600; color: var(--text); }
.quota-info { font-size: 12px; color: var(--text-muted); }

/* ---- home hero ---- */
.home-hero { margin-bottom: 8px; }
.hero-welcome h1 { font-size: 23px; font-weight: 800; color: var(--text); }
.hero-welcome p { color: var(--text-muted); font-size: 13.5px; margin: 3px 0 0; }
.hero-grid { display: grid; grid-template-columns: 1fr 320px; gap: 18px; margin: 18px 0 6px; }
.promo { position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); min-height: 290px; display: flex; background: var(--bg-card); }
.promo-bg { position: absolute; inset: 0; background: radial-gradient(120% 140% at 82% 18%, rgba(255,107,0,.26), transparent 55%), radial-gradient(100% 120% at 8% 92%, rgba(139,92,246,.30), transparent 55%), linear-gradient(135deg, #15151d, #0c0c12); }
[data-theme="light"] .promo-bg { background: radial-gradient(120% 140% at 82% 18%, rgba(255,107,0,.14), transparent 55%), radial-gradient(100% 120% at 8% 92%, rgba(139,92,246,.16), transparent 55%), linear-gradient(135deg, #fbfbfe, #eef1f7); }
.promo-c { position: relative; z-index: 2; padding: 26px 28px; display: flex; flex-direction: column; justify-content: space-between; flex: 1; }
.promo-tags { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { font-size: 11px; font-weight: 700; padding: 5px 11px; border-radius: 20px; border: 1px solid var(--border); background: rgba(127,127,140,.08); color: var(--text); display: inline-flex; align-items: center; gap: 6px; }
.chip.live { color: #4ade80; border-color: rgba(34,197,94,.35); background: rgba(34,197,94,.12); }
.chip.live .ld { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; animation: auraOrb 1.6s infinite; }
.chip.peso { color: #fff; border: none; background: var(--spectrum); box-shadow: 0 4px 16px rgba(217,70,239,.35); }
.promo h3 { font-size: 24px; font-weight: 800; margin: 12px 0 5px; max-width: 470px; line-height: 1.15; color: #fff; }
[data-theme="light"] .promo h3 { color: var(--text); }
.promo .org { font-size: 13px; margin-bottom: 14px; color: #b6b7c6; }
[data-theme="light"] .promo .org { color: var(--text-muted); }
.promo .meta-row { display: flex; gap: 20px; margin-bottom: 16px; flex-wrap: wrap; }
.promo .mini { font-size: 12px; color: #8b8c9b; }
.promo .mini b { display: block; font-size: 18px; font-weight: 800; color: var(--text); margin-top: 2px; }
[data-theme="dark"] .promo .mini b { color: #fff; }
.promo-cta { display: flex; gap: 10px; flex-wrap: wrap; }
.promo-art { width: 210px; position: relative; z-index: 2; display: flex; align-items: center; justify-content: center; }
.promo-art svg { width: 200px; }
.btn-spectrum { padding: 12px 22px; border: none; border-radius: 12px; font-weight: 800; font-size: 14px; cursor: pointer; color: #fff; background: var(--spectrum); background-size: 200% auto; transition: .4s; box-shadow: 0 8px 26px rgba(139,92,246,.32); width: auto; }
.btn-spectrum:hover { background-position: right center; transform: translateY(-1px); }
#login-form .btn-spectrum { width: 100%; padding: 14px; font-size: 15px; }
.hero-side { display: flex; flex-direction: column; gap: 16px; }
.card.glassy { background: var(--bg-card); }
.card.glassy .ttl { font-size: 11px; letter-spacing: 1.3px; text-transform: uppercase; color: var(--text-muted); font-weight: 700; margin-bottom: 12px; }
.aura-big { display: flex; align-items: center; gap: 12px; }
.aura-num { font-size: 30px; font-weight: 900; background: var(--aura); -webkit-background-clip: text; background-clip: text; color: transparent; line-height: 1; }
.aura-cap { font-size: 12px; color: var(--text-muted); }
.divrank { display: flex; align-items: center; gap: 12px; }
.div-badge { width: 44px; height: 44px; border-radius: 13px; background: var(--surface-bg); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 21px; }
.divrank .dv { font-weight: 800; font-size: 14.5px; }
.divrank .dc { font-size: 12px; color: var(--text-muted); }
.rank-link { font-size: 12px; font-weight: 700; color: var(--primary); cursor: pointer; margin-top: 10px; display: inline-block; }

/* ---- container (dentro do app-main) ---- */
.container { max-width: 100%; margin: 0; padding: 0; display: block; }
.app-footer { margin-left: 0; background: none; border: none; color: var(--text-muted); font-size: 11px; padding: 24px 0 0; }
.app-footer p { max-width: none; }
.brand-watermark { display: none; }

/* ---- rastro Sinaptcom ---- */
.sinapt-trace { margin-top: 24px; padding: 18px 22px; border: 1px solid var(--border); border-radius: var(--radius); background: linear-gradient(90deg, rgba(139,92,246,.10), rgba(34,211,238,.05), rgba(255,107,0,.05)); display: flex; align-items: center; gap: 16px; }
.st-orb { width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: rgba(139,92,246,.14); color: #c4b5fd; flex-shrink: 0; }
.st-orb svg { width: 22px; height: 22px; }
.st-t { font-size: 14.5px; font-weight: 800; color: var(--text); }
.st-s { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ---- LOGIN redesenhado ---- */
.login-screen { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(7,7,11,.82); }
[data-theme="light"] .login-screen { background: rgba(40,42,60,.45); }
.login-screen[hidden] { display: none; }
.login-panel { display: flex; width: min(940px, 100%); min-height: 520px; border-radius: 24px; overflow: hidden; border: 1px solid var(--border); background: var(--bg-card); box-shadow: 0 40px 120px rgba(0,0,0,.55); }
.login-left { flex: 1.1; padding: 44px 40px; display: flex; flex-direction: column; justify-content: space-between; gap: 18px; background: linear-gradient(160deg, rgba(34,211,238,.10), rgba(139,92,246,.10), rgba(255,107,0,.10)); border-right: 1px solid var(--border); }
.login-left h1 { font-size: 28px; line-height: 1.15; margin: 22px 0 12px; font-weight: 800; color: var(--text); }
.login-pitch { color: var(--text-muted); font-size: 14px; line-height: 1.6; max-width: 330px; }
.eco { display: flex; gap: 9px; margin-top: 22px; flex-wrap: wrap; }
.eco-chip { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--text); background: rgba(127,127,140,.07); border: 1px solid var(--border); padding: 7px 11px; border-radius: 20px; }
.eco-chip .d { width: 8px; height: 8px; border-radius: 50%; }
.login-right { flex: 1; padding: 44px 38px; display: flex; flex-direction: column; justify-content: center; gap: 15px; }
.lr-head { margin-bottom: 4px; }
.login-sub { color: var(--text-muted); font-size: 13px; margin-top: 5px; }
.login-foot { font-size: 11px; color: var(--text-muted); text-align: center; margin-top: 4px; }
.login-right .field input { width: 100%; }

/* ---- responsivo ---- */
@media (max-width: 980px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s; box-shadow: 0 0 40px rgba(0,0,0,.5); }
  .sidebar.open { transform: translateX(0); }
  .app-main { margin-left: 0; padding: 14px; }
  .hamb { display: inline-flex; }
  .hero-grid { grid-template-columns: 1fr; }
  .login-panel { flex-direction: column; min-height: 0; }
  .login-left { border-right: none; border-bottom: 1px solid var(--border); }
}

/* ============ AJUSTES (feedback) ============ */
/* contraste dos botões secundários (eram azul c/ texto branco, ilegível) */
.btn-secondary { background: rgba(34,211,238,.13); color: #67e8f9; border: 1px solid rgba(34,211,238,.42); }
.btn-secondary:hover { background: rgba(34,211,238,.22); color: #a5f3fc; border-color: rgba(34,211,238,.6); }
[data-theme="light"] .btn-secondary { background: rgba(8,145,178,.10); color: #0e7490; border-color: rgba(8,145,178,.4); }
[data-theme="light"] .btn-secondary:hover { background: rgba(8,145,178,.18); color: #0e7490; }

/* sala 1x1: input e botões alinhados, código legível */
.sala-acoes { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.sala-acoes .btn { margin-top: 0; height: 44px; }
.sala-entrar { display: flex; gap: 8px; align-items: center; }
.sala-entrar .login-input { width: 130px; height: 44px; text-transform: uppercase; letter-spacing: .12em; text-align: center; font-weight: 700; }
.sala-entrar .login-input::placeholder { letter-spacing: .04em; font-weight: 500; }

/* HOVER — apenas DESTAQUE (sem animação/pulsação) */
.btn:not(:disabled):hover, .btn-spectrum:hover, .gen-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(139,92,246,.22); }
.btn-secondary:not(:disabled):hover { box-shadow: 0 6px 18px rgba(34,211,238,.20); }
.card:hover, .promo:hover { border-color: rgba(139,92,246,.45); box-shadow: 0 8px 26px rgba(139,92,246,.10); }

/* área pessoal clicável na sidebar */
.side-foot { cursor: pointer; transition: background .18s; border-radius: 0; }
.side-foot:hover { background: var(--hover-bg); }

/* modal Minha Conta */
.perfil-card { max-width: 560px; width: 100%; text-align: left; }
.perfil-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.perfil-avatar { width: 52px; height: 52px; border-radius: 14px; background: var(--spectrum); display: flex; align-items: center; justify-content: center; font-weight: 800; color: #fff; font-size: 20px; flex-shrink: 0; }
.perfil-sub { font-size: 12.5px; color: var(--text-muted); margin: 2px 0 0; }
.perfil-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.perfil-grid .field { margin: 0; }
.perfil-grid .field input { width: 100%; }
.perfil-sec { font-size: 11px; letter-spacing: 1.3px; text-transform: uppercase; color: var(--text-muted); font-weight: 700; margin: 18px 0 10px; padding-top: 14px; border-top: 1px solid var(--border); }
.perfil-msg { font-size: 13px; margin: 12px 0 0; padding: 9px 12px; border-radius: 8px; }
.perfil-msg.ok { background: var(--success-bg); color: var(--success); }
.perfil-msg.err { background: var(--error-bg); color: var(--error); }
@media (max-width: 560px) { .perfil-grid { grid-template-columns: 1fr; } }

/* ===== MOBILE: Layout Harmonioso ===== */
@media (max-width: 640px) {
  .topbar {
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
  }
  
  .searchbox {
    flex: 1;
    min-width: 0;
  }
  
  .hamb {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    font-size: 18px;
  }
  
  /* Segunda linha: distribuição harmoniosa */
  .top-right {
    width: 100%;
    order: 3;
    margin-left: 0;
    margin-top: 4px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }
  
  /* Esquerda: Aura */
  .aura-pill {
    order: 1;
    flex-shrink: 0;
  }
  
  /* Centro: Nome do usuário */
  .user-greet {
    order: 2;
    flex: 1;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin: 0;
    padding: 0 8px;
  }
  
  /* Quota invisível no mobile */
  .quota-info {
    display: none;
  }
  
  /* Direita: Ícones */
  .icon-pill {
    order: 3;
  }
}

/* User Avatar */
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  border: 2px solid var(--primary);
  font-weight: 800;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: .3s;
  padding: 0;
  margin: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.user-avatar:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.user-avatar[hidden] {
  display: none;
}

@media (max-width: 640px) {
  .user-avatar {
    width: 28px;
    height: 28px;
    font-size: 11px;
  }
}
/* ===================== Conteúdo Salvo ===================== */
.conteudo-salvo-tabs { display: flex; gap: 8px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.conteudo-salvo-tab { padding: 8px 16px; background: none; border: none; cursor: pointer; color: var(--txt-secondary); font-size: 14px; border-bottom: 2px solid transparent; transition: 0.2s; }
.conteudo-salvo-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.conteudo-salvo-tab-content { display: none; }
.conteudo-salvo-tab-content.active { display: block; }

.questao-item, .conteudo-item { padding: 12px; margin-bottom: 8px; background: var(--card-bg); border: 1px solid var(--line); border-radius: 8px; display: flex; justify-content: space-between; align-items: center; }
.questao-item strong { flex: 1; }
.desfixar-btn, .remover-btn { background: none; border: none; cursor: pointer; color: var(--txt-secondary); font-size: 16px; padding: 4px 8px; }
.desfixar-btn:hover, .remover-btn:hover { color: var(--danger); }


/* ===== Eye toggle (pass-wrap) ===== */
.pass-wrap {
  position: relative;
}
.pass-wrap .login-input {
  padding-right: 44px;
}
.toggle-pass-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: 6px;
  line-height: 1;
  transition: color 0.18s;
}
.toggle-pass-btn:hover { color: var(--primary); }

/* ===== QUOTA WHATSAPP BUTTON ===== */
.quota-wpp-btn {
  display: inline-flex; align-items: center; gap: 4px;
  background: #25d366; color: #fff; border-radius: 20px;
  padding: 3px 10px; font-size: 12px; font-weight: 600;
  text-decoration: none; transition: opacity 0.15s;
  white-space: nowrap;
}
.quota-wpp-btn:hover { opacity: 0.85; }

/* ===== ASSIN PILL (crown for non-admin) ===== */
.assin-pill { background: linear-gradient(135deg, #f59e0b, #ef4444) !important; color: #fff !important; }

/* ===== OVERLAY CLOSE X ===== */
.overlay-close-x {
  position: absolute; top: 14px; right: 16px;
  background: none; border: none; color: var(--text-muted);
  font-size: 18px; cursor: pointer; padding: 4px 8px;
  border-radius: 6px; transition: color 0.15s;
}
.overlay-close-x:hover { color: var(--text); }

/* ===== SUBSCRIPTION OVERLAY ===== */
.assin-card {
  position: relative; max-width: 520px; width: 94vw;
  padding: 32px 28px; border-radius: 20px;
  background: var(--surface-bg); border: 1px solid var(--border);
  max-height: 90vh; overflow-y: auto;
}
.assin-header { text-align: center; margin-bottom: 24px; }
.assin-crown { font-size: 48px; margin-bottom: 8px; }
.assin-header h2 { font-size: 22px; font-weight: 700; margin: 0 0 6px; }
.assin-preco { display: flex; align-items: baseline; justify-content: center; gap: 2px; margin: 6px 0; }
.assin-valor { font-size: 36px; font-weight: 800; background: linear-gradient(90deg, #8b5cf6, #22d3ee); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.assin-period { font-size: 16px; color: var(--text-muted); }
.assin-sub { color: var(--text-muted); font-size: 14px; margin: 0; }

.assin-creditos-box { background: var(--card-bg); border-radius: 14px; padding: 18px; margin-bottom: 18px; border: 1px solid var(--border); }
.assin-cred-titulo { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.assin-cred-num { font-size: 28px; font-weight: 800; color: var(--primary); margin-bottom: 6px; }
.assin-cred-desc { font-size: 13px; color: var(--text-muted); margin-bottom: 12px; }
.assin-tabela { display: flex; flex-direction: column; gap: 8px; }
.assin-row { display: flex; justify-content: space-between; align-items: center; font-size: 14px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.assin-row:last-child { border-bottom: none; }
.assin-row-free { opacity: 0.75; }
.assin-custo { font-weight: 600; color: var(--primary); white-space: nowrap; margin-left: 12px; }
.assin-gratis { color: #22c55e !important; }

.assin-rotina { background: var(--card-bg); border-radius: 14px; padding: 18px; margin-bottom: 20px; border: 1px solid var(--border); }
.assin-rot-titulo { font-weight: 700; font-size: 15px; margin-bottom: 14px; }
.assin-rot-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }
.assin-rot-item { text-align: center; background: var(--surface-bg); border-radius: 10px; padding: 12px 8px; }
.assin-rot-num { font-size: 24px; font-weight: 800; color: var(--primary); }
.assin-rot-lbl { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.assin-rot-nota { font-size: 12px; color: var(--text-muted); margin: 0; font-style: italic; }

.assin-footer { text-align: center; }
.assin-btn-wpp {
  display: inline-block; padding: 14px 28px; border-radius: 50px;
  font-weight: 700; font-size: 16px; text-decoration: none;
  background: linear-gradient(90deg, #25d366, #128c7e); color: #fff;
  margin-bottom: 12px; transition: opacity 0.15s;
}
.assin-btn-wpp:hover { opacity: 0.88; }
.assin-nota { font-size: 12px; color: var(--text-muted); margin: 0; }

/* ===== AURA OVERLAY ===== */
.aura-card {
  position: relative; max-width: 480px; width: 94vw;
  padding: 32px 28px; border-radius: 20px;
  background: var(--surface-bg); border: 1px solid var(--border);
  max-height: 90vh; overflow-y: auto;
}
.aura-ov-header { text-align: center; margin-bottom: 20px; }
.aura-ov-orb-big {
  width: 72px; height: 72px; border-radius: 50%; margin: 0 auto 12px;
  background: conic-gradient(#8b5cf6, #22d3ee, #d946ef, #8b5cf6);
  animation: aura-spin 4s linear infinite;
  box-shadow: 0 0 24px rgba(139,92,246,0.5);
}
@keyframes aura-spin { to { transform: rotate(360deg); } }
.aura-ov-header h2 { font-size: 22px; font-weight: 700; margin: 0 0 4px; }
.aura-ov-pts { font-size: 42px; font-weight: 800; background: linear-gradient(90deg,#8b5cf6,#22d3ee); -webkit-background-clip:text; -webkit-text-fill-color:transparent; line-height:1; }
.aura-ov-nivel { font-size: 15px; color: var(--text-muted); margin-top: 4px; }

.aura-ov-progress-wrap { margin-bottom: 22px; }
.aura-ov-progress-bar { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; margin-bottom: 6px; }
.aura-ov-progress-fill { height: 100%; background: linear-gradient(90deg,#8b5cf6,#22d3ee); border-radius: 4px; transition: width 0.6s ease; }
.aura-ov-progress-labels { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-muted); }

.aura-niveis { display: grid; grid-template-columns: repeat(5,1fr); gap: 6px; margin-bottom: 22px; }
.aura-nivel-item { text-align: center; padding: 10px 4px; border-radius: 10px; border: 1px solid var(--border); background: var(--card-bg); font-size: 12px; opacity: 0.5; transition: opacity 0.2s; }
.aura-nivel-item.ativo { opacity: 1; border-color: var(--primary); background: var(--surface-bg); }
.aura-nivel-icon { display: block; font-size: 20px; margin-bottom: 4px; }
.aura-nivel-pts { display: block; color: var(--text-muted); font-size: 11px; margin-top: 2px; }

.aura-como-ganhar { background: var(--card-bg); border-radius: 14px; padding: 16px; margin-bottom: 20px; }
.aura-cg-titulo { font-weight: 700; margin-bottom: 12px; }
.aura-cg-item { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.aura-cg-item:last-child { border-bottom: none; }
.aura-cg-item span:last-child { margin-left: auto; font-weight: 600; color: var(--primary); white-space: nowrap; }

/* aura-pill cursor pointer já setado via JS */

/* ===== X1 ARENA AUDIO ===== */
.sala-audio-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: 12px;
  background: var(--card-bg); border: 1px solid var(--border);
  margin-bottom: 12px;
}
.btn-audio {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 16px; border-radius: 20px; border: none;
  background: linear-gradient(135deg, #8b5cf6, #22d3ee);
  color: #fff; font-weight: 600; font-size: 13px; cursor: pointer;
  transition: opacity 0.15s;
}
.btn-audio:hover { opacity: 0.85; }
.btn-audio-mute {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 16px; border-radius: 20px; border: 1px solid var(--border);
  background: var(--surface-bg); color: var(--text);
  font-size: 13px; cursor: pointer; font-weight: 600;
  transition: opacity 0.15s;
}
.btn-audio-mute:hover { opacity: 0.75; }
.audio-status { font-size: 13px; color: var(--text-muted); margin-left: 4px; }

/* ===== SUBSCRIPTION MODAL UPDATES ===== */
.assin-free-box {
  background: var(--card-bg); border-radius: 14px; padding: 16px;
  margin-bottom: 18px; border: 1px solid var(--border);
}
.assin-free-titulo { font-weight: 700; font-size: 14px; margin-bottom: 10px; color: var(--text-muted); }
.assin-limit { color: #f59e0b !important; }
.assin-free-nota { font-size: 12px; color: var(--text-muted); margin: 10px 0 0; line-height: 1.5; }

.assin-pagamento-titulo { font-weight: 700; font-size: 15px; margin-bottom: 12px; text-align: center; }
.assin-selos {
  display: flex; gap: 8px; justify-content: center; flex-wrap: wrap;
  margin-bottom: 12px;
}
.assin-selo {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 14px; font-size: 12px;
  font-weight: 600; min-width: 72px; text-align: center;
}
.assin-selo span:first-child { font-size: 20px; }
.assin-pagto-desc { font-size: 13px; color: var(--text-muted); text-align: center; margin-bottom: 16px; line-height: 1.5; }
.assin-btn-pagar {
  display: block; width: 100%; text-align: center; padding: 16px;
  border-radius: 50px; font-weight: 700; font-size: 17px;
  text-decoration: none; background: linear-gradient(90deg, #8b5cf6, #22d3ee);
  color: #fff; margin-bottom: 10px; transition: opacity 0.15s;
}
.assin-btn-pagar:hover { opacity: 0.88; }

/* ===== Two-plan grid for subscription modal ===== */
.assin-planos-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
  margin: 18px 0 10px;
}
@media (max-width: 520px) { .assin-planos-grid { grid-template-columns: 1fr; } }

.assin-plano-card {
  border: 1.5px solid var(--border);
  border-radius: 16px; padding: 18px 16px; position: relative;
  display: flex; flex-direction: column; gap: 12px;
  background: var(--bg-card);
}
.assin-plano-destaque {
  border-color: #8b5cf6;
  background: linear-gradient(160deg, rgba(139,92,246,.07) 0%, rgba(34,211,238,.05) 100%);
}
.assin-plano-badge {
  position: absolute; top: -11px; left: 50%; transform: translateX(-50%);
  background: linear-gradient(90deg,#8b5cf6,#22d3ee); color: #fff;
  font-size: 10px; font-weight: 700; letter-spacing: .05em;
  padding: 2px 10px; border-radius: 20px; white-space: nowrap;
}
.assin-plano-nome {
  font-size: 13px; font-weight: 700; color: var(--txt-secondary);
  text-transform: uppercase; letter-spacing: .08em;
}
.assin-plano-preco { display: flex; align-items: baseline; gap: 2px; }
.assin-plano-preco .assin-valor { font-size: 26px; font-weight: 800; }
.assin-plano-preco .assin-period { font-size: 13px; color: var(--txt-secondary); }
.assin-plano-limites { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.assin-lim-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; gap: 6px;
}
.assin-lim-row span:first-child { color: var(--txt-secondary); }
.assin-lim-row span:last-child { font-weight: 600; font-size: 11px; text-align: right; }
.assin-lim-gratis span:last-child { color: #22c55e; }
.assin-plano-card .assin-btn-pagar { margin-top: auto; font-size: 13px; padding: 11px 10px; }

/* ===== Registration modal (.modal-overlay / .modal-card) ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(7, 7, 20, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2500;
  padding: 20px;
  backdrop-filter: blur(3px);
}
.modal-overlay[hidden] { display: none; }

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px 28px;
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0,0,0,.45);
  position: relative;
}

.modal-titulo {
  font-size: 22px;
  font-weight: 800;
  color: var(--txt-primary);
  margin: 0 0 6px;
}
.modal-sub {
  font-size: 13px;
  color: var(--txt-secondary);
  margin: 0 0 20px;
  line-height: 1.5;
}
.modal-link {
  text-align: center;
  font-size: 13px;
  color: var(--txt-secondary);
  margin-top: 14px;
}
.modal-link a { color: var(--primary); text-decoration: none; font-weight: 600; }
.modal-link a:hover { text-decoration: underline; }

.field-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 14px;
}
.field-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--txt-secondary);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.field-group .login-input { width: 100%; }

/* Code boxes (email verification) */
.codigo-boxes {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 20px 0 18px;
}
.cod-box {
  width: 46px;
  height: 54px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--bg-input, var(--bg-card));
  color: var(--txt-primary);
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  transition: border-color .15s;
}
.cod-box:focus {
  border-color: var(--primary);
  outline: none;
}

/* Password eye toggle inside registration form */
.pass-eye {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: var(--txt-secondary);
  padding: 4px;
}
