/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --sidebar-bg: #0f172a;
  --sidebar-text: #94a3b8;
  --sidebar-hover: #1e293b;
  --sidebar-active: #6366f1;
  --sidebar-active-bg: rgba(99,102,241,.15);
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --sidebar-w: 240px;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
}

html, body { height: 100%; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 14px; color: var(--text); background: var(--bg); }

/* ===== LAYOUT ===== */
#app { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
}

.main-content {
  flex: 1;
  overflow-y: auto;
  background: var(--bg);
}

/* ===== SIDEBAR ===== */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.brand-icon { font-size: 24px; }
.brand-text strong { display: block; color: #f8fafc; font-size: 15px; }
.brand-text small { color: var(--sidebar-text); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }

.sidebar-nav { list-style: none; padding: 12px 8px; flex: 1; }
.sidebar-nav li { margin-bottom: 2px; }

.nav-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  background: none;
  border: none;
  border-radius: 8px;
  color: var(--sidebar-text);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background .15s, color .15s;
}
.nav-btn svg { width: 18px; height: 18px; fill: currentColor; flex-shrink: 0; }
.nav-btn:hover { background: var(--sidebar-hover); color: #e2e8f0; }
.nav-btn.active { background: var(--sidebar-active-bg); color: var(--sidebar-active); }

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,.06);
}
.streak-mini { color: var(--sidebar-text); font-size: 13px; }
.streak-mini span { font-weight: 700; color: #fbbf24; }

/* ===== PAGES ===== */
.page { display: none; padding: 28px 32px; min-height: 100%; }
.page.active { display: block; }

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
}
.page-header h1 { font-size: 22px; font-weight: 700; color: var(--text); }
.subtitle { color: var(--text-muted); margin-top: 3px; font-size: 13px; }

/* ===== CARDS ===== */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.card-header h3 { font-size: 14px; font-weight: 600; color: var(--text); }
.card-body { padding: 16px 20px; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all .15s;
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: none; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg); }
.btn-outline { background: none; color: var(--primary); border: 1px solid var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #d97706; }
.btn-lg { padding: 12px 28px; font-size: 15px; border-radius: 10px; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-xs { padding: 3px 8px; font-size: 11px; border-radius: 5px; }
.w-full { width: 100%; }
.icon-btn { background: none; border: none; cursor: pointer; padding: 4px 6px; border-radius: 6px; font-size: 14px; color: var(--text-muted); transition: background .15s; }
.icon-btn:hover { background: var(--bg); }
.icon-btn.text-danger:hover { color: var(--danger); background: #fef2f2; }
.icon-btn-sm { background: none; border: none; cursor: pointer; padding: 2px 5px; border-radius: 4px; font-size: 13px; color: var(--text-muted); }
.icon-btn-sm:hover { color: var(--danger); background: #fef2f2; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .4px; }
.input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--text);
  background: var(--card);
  outline: none;
  transition: border-color .15s;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,.1); }
.input-color { width: 48px; height: 36px; padding: 2px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; }
.input-sm { padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 12px; color: var(--text); background: var(--card); outline: none; }
.input-sm:focus { border-color: var(--primary); }
.input-min { width: 64px; }

/* ===== MODALS ===== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 100;
  backdrop-filter: blur(2px);
}
.modal-overlay.show { display: block; }

.modal {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(480px, calc(100vw - 32px));
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  z-index: 101;
  overflow: hidden;
}
.modal.show { display: block; }
.modal-lg { width: min(560px, calc(100vw - 32px)); }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 16px; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text-muted); line-height: 1; padding: 0 4px; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 20px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 20px; border-top: 1px solid var(--border); background: var(--bg); }

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  z-index: 200;
  opacity: 0;
  transform: translateY(8px);
  transition: all .25s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); pointer-events: auto; }
.toast-success { background: #052e16; color: #4ade80; border: 1px solid #166534; }
.toast-error { background: #450a0a; color: #f87171; border: 1px solid #991b1b; }

/* ===== STATS ROW ===== */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--card); border-radius: var(--radius); padding: 16px; display: flex; align-items: center; gap: 14px; box-shadow: var(--shadow); border: 1px solid var(--border); }
.stat-icon { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.stat-value { font-size: 20px; font-weight: 700; color: var(--text); line-height: 1.1; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ===== PROGRESS BAR ===== */
.progress-bar { height: 6px; background: #f1f5f9; border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 99px; transition: width .4s; }

/* ===== DASHBOARD ===== */
.goals-list { display: flex; flex-direction: column; gap: 12px; }
.goal-item { padding: 12px 0; border-bottom: 1px solid var(--border); }
.goal-item:last-child { border-bottom: none; padding-bottom: 0; }
.goal-item.completed .goal-name { color: var(--text-muted); text-decoration: line-through; }
.goal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.goal-name { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.goal-check { color: var(--success); font-size: 14px; }
.goal-progress-text { font-size: 12px; color: var(--text-muted); }
.materia-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
.materia-dot-lg { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; }

.sessions-list { display: flex; flex-direction: column; gap: 6px; }
.session-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.session-item:last-child { border-bottom: none; }
.session-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.session-info { flex: 1; }
.session-info strong { font-size: 13px; display: block; }
.session-topico { font-size: 11px; color: var(--text-muted); }
.session-meta { display: flex; align-items: center; gap: 8px; }
.session-duration { font-weight: 600; font-size: 13px; }
.session-time { color: var(--text-muted); font-size: 12px; }
.session-tipo.pomodoro { color: #ef4444; }
.session-tipo.manual { color: var(--text-muted); }

.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state p { margin-bottom: 8px; }
.empty-state .btn { margin-top: 12px; }

/* ===== MATERIAS ===== */
.materias-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 20px; }
.materia-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--border); overflow: hidden; }
.materia-card-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; }
.materia-card-title { display: flex; align-items: center; gap: 10px; }
.materia-card-title h3 { font-size: 14px; font-weight: 600; }
.materia-card-actions { display: flex; gap: 4px; }
.materia-card-body { padding: 14px 16px; }
.materia-stats { display: flex; gap: 0; margin-bottom: 12px; }
.materia-stat { flex: 1; text-align: center; border-right: 1px solid var(--border); }
.materia-stat:last-child { border-right: none; }
.materia-stat-value { display: block; font-size: 15px; font-weight: 700; color: var(--text); }
.materia-stat-label { display: block; font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.topicos-section { margin-top: 12px; }
.topicos-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.topicos-title { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .4px; }
.topicos-list { display: flex; flex-direction: column; gap: 4px; max-height: 180px; overflow-y: auto; }
.topico-item { display: flex; align-items: center; justify-content: space-between; padding: 5px 0; border-bottom: 1px solid #f8fafc; }
.topico-item:last-child { border-bottom: none; }
.topico-item.concluido .topico-nome { color: var(--text-muted); text-decoration: line-through; }
.topico-check { display: flex; align-items: center; gap: 8px; cursor: pointer; flex: 1; font-size: 13px; }
.topico-check input[type=checkbox] { display: none; }
.checkmark {
  width: 16px; height: 16px; border-radius: 4px; border: 2px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: all .15s; background: var(--card);
}
.topico-check input:checked ~ .checkmark { background: var(--cor, var(--primary)); border-color: var(--cor, var(--primary)); }
.topico-check input:checked ~ .checkmark::after { content: '✓'; font-size: 10px; color: #fff; font-weight: 700; }
.topico-nome { user-select: none; }
.topico-actions { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.topico-recursos-btn {
  position: relative;
  background: none; border: none; cursor: pointer;
  padding: 2px 5px; border-radius: 4px; font-size: 12px;
  color: var(--text-muted); opacity: .45; transition: opacity .15s, background .15s;
}
.topico-recursos-btn:hover { opacity: 1; background: var(--bg); }
.topico-recursos-btn.has-recursos { opacity: 1; color: var(--primary); }
.recursos-count {
  position: absolute; top: -4px; right: -4px;
  background: var(--primary); color: #fff;
  font-size: 9px; font-weight: 700; line-height: 1;
  min-width: 13px; height: 13px; border-radius: 99px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 2px;
}

/* ===== RECURSOS (links e arquivos por tópico) ===== */
.recursos-tabs { display: flex; gap: 4px; margin-bottom: 14px; background: var(--bg); padding: 4px; border-radius: 9px; }
.recursos-tab {
  flex: 1; padding: 7px 10px; border: none; border-radius: 6px; background: none;
  font-size: 12.5px; font-weight: 600; color: var(--text-muted); cursor: pointer; transition: all .15s;
}
.recursos-tab.active { background: var(--card); color: var(--text); box-shadow: var(--shadow); }
.recurso-form { margin-bottom: 16px; }
.recurso-form-row { display: flex; gap: 8px; }
.recurso-form-row .input { flex: 1; }
.recurso-dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; padding: 22px 12px; border: 2px dashed var(--border); border-radius: 10px;
  cursor: pointer; text-align: center; transition: border-color .15s, background .15s;
}
.recurso-dropzone:hover { border-color: var(--primary); background: rgba(99,102,241,.04); }
.recurso-dropzone-icon { font-size: 22px; }
.recurso-dropzone-text { font-size: 13px; font-weight: 500; color: var(--text); }
.recursos-list { display: flex; flex-direction: column; gap: 6px; max-height: 280px; overflow-y: auto; }
.recursos-empty { text-align: center; padding: 18px 0 4px; }
.recurso-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border: 1px solid var(--border); border-radius: 9px;
  transition: background .15s;
}
.recurso-item:hover { background: var(--bg); }
.recurso-icon { font-size: 17px; flex-shrink: 0; }
.recurso-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; cursor: pointer; }
.recurso-nome { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recurso-meta { font-size: 11px; color: var(--text-muted); }

/* ===== PLANO SEMANAL ===== */
.plano-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 12px; }
@media (max-width: 1300px) { .plano-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 900px) { .plano-grid { grid-template-columns: repeat(2, 1fr); } }
.plano-day { background: var(--card); border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; }
.plano-day-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; background: var(--bg); border-bottom: 1px solid var(--border); }
.plano-day-name { font-weight: 600; font-size: 13px; }
.plano-day-total { font-size: 11px; color: var(--text-muted); background: var(--border); padding: 2px 7px; border-radius: 99px; }
.plano-slots { display: flex; flex-direction: column; gap: 6px; padding: 10px; min-height: 60px; }
.plano-slot { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 7px; }
.plano-slot-info { flex: 1; min-width: 0; }
.plano-slot-nome { display: block; font-size: 12px; font-weight: 500; }
.plano-slot-topico { display: block; font-size: 10.5px; color: var(--text-muted); margin-top: 1px; }
.plano-slot-min { font-size: 11px; color: var(--text-muted); }
.plano-slot.done .plano-slot-nome { text-decoration: line-through; color: var(--text-muted); }
.plano-slot-check {
  width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0; padding: 0;
  border: 2px solid rgba(0,0,0,.18); background: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff; transition: all .15s;
}
.plano-slot-check:hover { border-color: var(--primary); }
.plano-slot.done .plano-slot-check { background: var(--success); border-color: var(--success); }
.plano-slot-check-disabled { width: 20px; height: 20px; border-radius: 50%; border: 2px solid transparent; flex-shrink: 0; }
.plano-add { padding: 8px 10px; border-top: 1px solid var(--border); background: var(--bg); display: flex; flex-direction: column; gap: 6px; }

.pomo-meta-item { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 7px; transition: filter .15s; }
.pomo-meta-item:hover { filter: brightness(0.97); }
.pomo-meta-item + .pomo-meta-item { margin-top: 6px; }
.pomo-meta-info { flex: 1; min-width: 0; }
.pomo-meta-nome { display: block; font-size: 12px; font-weight: 500; }
.pomo-meta-topico { display: block; font-size: 10.5px; color: var(--text-muted); margin-top: 1px; }
.pomo-meta-min { font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.pomo-meta-item.done .pomo-meta-nome { text-decoration: line-through; color: var(--text-muted); }
.pomo-meta-check { width: 18px; height: 18px; border-radius: 50%; background: var(--success); color: #fff; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; }
.plano-add select.input-sm { width: 100%; }
.plano-add-row { display: flex; gap: 4px; align-items: center; }
.plano-add-row .input-min { flex: 1; min-width: 0; }
.btn-add-slot { width: 26px; height: 26px; border-radius: 6px; border: none; background: var(--primary); color: #fff; font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.btn-add-slot:hover { background: var(--primary-dark); }

/* ===== POMODORO ===== */
.pomodoro-layout { display: grid; grid-template-columns: 1fr 300px; gap: 24px; align-items: start; }
@media (max-width: 800px) { .pomodoro-layout { grid-template-columns: 1fr; } }
.pomodoro-main { padding: 32px 24px; text-align: center; }
.pomodoro-mode { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 20px; }
.pomodoro-ring-container { position: relative; display: inline-block; margin-bottom: 20px; }
.pomodoro-time { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 44px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -2px; color: var(--text); }
.pomodoro-sessions { display: flex; justify-content: center; gap: 8px; margin-bottom: 24px; }
.session-dot-timer { width: 10px; height: 10px; border-radius: 50%; background: var(--border); border: 2px solid var(--border); }
.session-dot-timer.done { background: var(--primary); border-color: var(--primary); }
.pomodoro-controls { display: flex; align-items: center; justify-content: center; gap: 12px; }
.pomodoro-sidebar { display: flex; flex-direction: column; gap: 16px; }
.session-item-sm { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--border); font-size: 12px; }
.session-item-sm:last-child { border-bottom: none; }
.session-dot-sm { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.ml-auto { margin-left: auto; font-weight: 600; color: var(--text-muted); }

/* ===== STATISTICS ===== */
.charts-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 800px) { .charts-row { grid-template-columns: 1fr; } }
.chart-container { height: 260px; display: flex; align-items: center; justify-content: center; }
.chart-container canvas { max-height: 240px; }
.materias-stats-list { display: flex; flex-direction: column; gap: 10px; }
.materia-stat-row { display: flex; align-items: center; gap: 10px; }
.materia-stat-nome { width: 180px; font-size: 13px; flex-shrink: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.materia-stat-bar-container { flex: 1; height: 8px; background: var(--bg); border-radius: 99px; overflow: hidden; }
.materia-stat-bar { height: 100%; border-radius: 99px; transition: width .6s; }
.materia-stat-pct { width: 36px; text-align: right; font-size: 12px; color: var(--text-muted); }
.materia-stat-time { width: 60px; text-align: right; font-size: 12px; font-weight: 600; color: var(--text-muted); }

/* ===== CONFIG ===== */
.config-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }

/* ===== UTILITIES ===== */
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }
.text-center { text-align: center; }
.text-danger { color: var(--danger); }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #cbd5e1; }

/* ===== ESTUDO: Hoje, Trilha, Aula, Revisão ===== */
.ea-hoje, .ea-wrap { max-width: 820px; }
.ea-hoje { display: flex; flex-direction: column; gap: 16px; }
.ea-chip { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.ea-inc { display: inline-block; padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; margin-left: 6px; }
.ea-inc-alta { background: #fee2e2; color: #b91c1c; }
.ea-inc-media { background: #fef3c7; color: #92400e; }
.ea-inc-baixa { background: #e2e8f0; color: #475569; }
.ea-inc-geral { background: #e0f2fe; color: #0369a1; }

.ea-dia { background: var(--card); border-radius: var(--radius); padding: 14px 18px; box-shadow: var(--shadow); }
.ea-dia-txt { margin-bottom: 8px; display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline; }
.ea-dia-txt span { color: var(--text-muted); }
.ea-dia.ganho strong { color: #15803d; }

.ea-agora { padding: 24px; }
.ea-agora-label { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--primary); font-weight: 700; margin-bottom: 10px; }
.ea-agora-titulo { font-size: 24px; line-height: 1.25; margin: 10px 0 6px; }
.ea-agora-info { color: var(--text-muted); margin-bottom: 18px; }
.ea-agora-acoes { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.ea-rev { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 20px; }
.ea-rev p { margin-top: 2px; }
.ea-rodape { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: var(--text-muted); font-size: 13px; padding: 0 4px; }

.ea-trilha { display: flex; flex-direction: column; gap: 8px; }
.ea-trilha-item { display: flex; align-items: center; gap: 14px; background: var(--card); border-radius: 10px; padding: 12px 16px; box-shadow: var(--shadow); }
.ea-trilha-item.proxima { box-shadow: 0 0 0 2px var(--primary); }
.ea-trilha-item.feita { opacity: .65; }
.ea-trilha-n { width: 28px; height: 28px; border-radius: 50%; background: var(--bg); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: var(--text-muted); flex-shrink: 0; }
.ea-trilha-item.feita .ea-trilha-n { background: #dcfce7; color: #15803d; }
.ea-trilha-info { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ea-trilha-top { margin-bottom: 2px; }

.ea-aula-top { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.ea-aula-tit { flex: 1; min-width: 0; }
.ea-aula-tit h1 { font-size: 20px; margin-top: 6px; line-height: 1.3; }
.ea-timer { display: flex; align-items: center; gap: 8px; background: var(--card); border-radius: 999px; padding: 6px 8px 6px 14px; box-shadow: var(--shadow); font-variant-numeric: tabular-nums; font-weight: 700; }
.ea-timer.pausado { color: var(--text-muted); }
.ea-timer-b { border: none; background: var(--bg); border-radius: 50%; width: 28px; height: 28px; cursor: pointer; }
.ea-passos { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.ea-passo { border: 1px solid var(--border); background: var(--card); border-radius: 999px; padding: 6px 14px; font-size: 13px; cursor: pointer; color: var(--text-muted); }
.ea-passo.ativo { background: var(--primary); border-color: var(--primary); color: #fff; }
.ea-passo.feito { color: #15803d; border-color: #bbf7d0; }

.ea-resumo { padding: 24px 28px; }
.ea-fcc { background: #eef2ff; border-left: 4px solid var(--primary); border-radius: 8px; padding: 12px 14px; margin-bottom: 20px; font-size: 14px; line-height: 1.55; }
.ea-fcc strong { display: block; margin-bottom: 2px; color: var(--primary-dark); }
.ea-texto { font-size: 15.5px; line-height: 1.7; }
.ea-texto h3 { font-size: 17px; margin: 22px 0 8px; }
.ea-texto h3:first-child { margin-top: 0; }
.ea-texto p { margin-bottom: 10px; }
.ea-texto ul, .ea-texto ol { margin: 0 0 12px 22px; }
.ea-texto li { margin-bottom: 4px; }
.ea-texto table { width: 100%; border-collapse: collapse; margin: 8px 0 14px; font-size: 14px; display: block; overflow-x: auto; }
.ea-texto th, .ea-texto td { border: 1px solid var(--border); padding: 7px 9px; text-align: left; vertical-align: top; }
.ea-texto th { background: var(--bg); }
.ea-texto .pegadinha { background: #fff7ed; border-left: 4px solid #f97316; border-radius: 8px; padding: 10px 14px; margin: 12px 0; }
.ea-texto .pegadinha::before { content: 'Pegadinha: '; font-weight: 700; color: #c2410c; }
.ea-texto .lembrar { background: #f0fdf4; border-left: 4px solid #22c55e; border-radius: 8px; padding: 10px 14px; margin: 12px 0; }
.ea-texto .lembrar::before { content: 'Para lembrar: '; font-weight: 700; color: #15803d; }
.ea-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 22px; gap: 10px; }

.ea-q { padding: 22px 26px; }
.ea-q-cont { font-size: 12px; color: var(--text-muted); font-weight: 600; margin-bottom: 10px; }
.ea-enunciado { font-size: 15.5px; line-height: 1.6; margin-bottom: 16px; }
.ea-enunciado p { margin-bottom: 8px; }
.ea-alts { display: flex; flex-direction: column; gap: 8px; }
.ea-alt { display: flex; gap: 12px; align-items: flex-start; text-align: left; border: 1px solid var(--border); background: var(--card); border-radius: 10px; padding: 10px 14px; font-size: 14.5px; line-height: 1.5; cursor: pointer; color: var(--text); }
.ea-alt:hover:not([disabled]) { border-color: var(--primary); background: #f5f7ff; }
.ea-alt-l { font-weight: 700; color: var(--text-muted); flex-shrink: 0; width: 16px; }
.ea-alt.certa { border-color: #22c55e; background: #f0fdf4; }
.ea-alt.errada { border-color: #ef4444; background: #fef2f2; }
.ea-alt.apagada { opacity: .55; }
.ea-alt[disabled] { cursor: default; }
.ea-coment { margin-top: 14px; border-radius: 10px; padding: 12px 14px; font-size: 14.5px; line-height: 1.6; }
.ea-coment.ok { background: #f0fdf4; }
.ea-coment.nok { background: #fef2f2; }

.ea-card { position: relative; background: var(--card); border-radius: 14px; box-shadow: var(--shadow-md); min-height: 220px; cursor: pointer; padding: 28px; display: flex; flex-direction: column; justify-content: center; font-size: 17px; line-height: 1.55; }
.ea-card-f small { display: block; margin-top: 18px; font-size: 12px; color: var(--text-muted); }
.ea-card-v { display: none; border-top: 1px dashed var(--border); margin-top: 18px; padding-top: 18px; color: #1e3a8a; }
.ea-card.virado .ea-card-v { display: block; }
.ea-card.virado .ea-card-f small { display: none; }
.ea-card-acoes { display: flex; gap: 10px; justify-content: flex-end; margin-top: 14px; }

.ea-fim { text-align: center; padding: 34px 24px; }
.ea-fim-ico { font-size: 40px; }
.ea-fim h2 { margin: 8px 0; }
.ea-fim p { margin-bottom: 8px; }

/* celular */
@media (max-width: 760px) {
  #app { flex-direction: column; height: auto; min-height: 100vh; overflow: visible; }
  .sidebar { width: 100%; flex-direction: row; align-items: center; overflow-x: auto; position: sticky; top: 0; z-index: 50; }
  .sidebar-brand { display: none; }
  .sidebar-nav { display: flex; padding: 6px; gap: 2px; }
  .sidebar-nav li { margin: 0; }
  .nav-btn { white-space: nowrap; padding: 8px 10px; font-size: 12.5px; }
  .sidebar-footer { display: none; }
  .main-content { overflow: visible; }
  .page { padding: 16px !important; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .ea-agora-titulo { font-size: 20px; }
  .ea-resumo, .ea-q { padding: 18px 16px; }
  .ea-aula-top { flex-wrap: wrap; }
  .ea-aula-tit { order: 3; flex-basis: 100%; }
  .ea-timer { margin-left: auto; }
  .ea-rev { flex-direction: column; align-items: flex-start; }
}

/* ===== Antes de começar e glossário ===== */
.ea-antes { background: #fffbeb; border-left: 4px solid #f59e0b; border-radius: 8px; padding: 12px 16px; margin-bottom: 14px; font-size: 15px; line-height: 1.65; }
.ea-antes > strong { display: block; margin-bottom: 4px; color: #b45309; }
.ea-antes p { margin-bottom: 8px; }
.ea-antes p:last-child { margin-bottom: 0; }
.ea-antes ul { margin: 0 0 8px 20px; }
.ea-dica-termo { font-size: 12.5px; color: var(--text-muted); margin: -4px 0 16px; }
.ea-termo, .ea-termo-exemplo { font: inherit; color: inherit; background: none; border: none; padding: 0; margin: 0; cursor: help; text-decoration: underline dotted #6366f1; text-decoration-thickness: 2px; text-underline-offset: 3px; display: inline; text-align: inherit; }
.ea-termo:hover, .ea-termo.ativo { background: #eef2ff; border-radius: 3px; }
.ea-pop { position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 20px); width: min(520px, calc(100vw - 32px)); background: #1e293b; color: #f8fafc; border-radius: 14px; padding: 16px 44px 16px 18px; box-shadow: 0 12px 32px rgba(0,0,0,.28); z-index: 300; opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s; font-size: 15px; line-height: 1.55; }
.ea-pop.aberto { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); }
.ea-pop strong { display: block; margin-bottom: 4px; color: #c7d2fe; }
.ea-pop-x { position: absolute; top: 8px; right: 10px; width: 30px; height: 30px; border: none; border-radius: 50%; background: rgba(255,255,255,.1); color: #f8fafc; font-size: 18px; cursor: pointer; }

/* "Caiu e não estava na aula" */
.ea-lacuna-link { text-align: center; margin: 4px 0 14px; }
.ea-fim .ea-lacuna-link { margin: 16px 0 0; }
.ea-lacunas { padding: 16px 20px; }
.ea-lacunas-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.ea-lacunas-top p { margin-top: 2px; }
.ea-lacunas-lista { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.ea-lacunas-lista li { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; padding: 8px 10px; background: var(--bg); border-radius: 8px; font-size: 13px; line-height: 1.45; }
#lacuna-texto { resize: vertical; min-height: 90px; font-family: inherit; }
@media (max-width: 760px) {
  .ea-lacunas-top { flex-direction: column; align-items: flex-start; }
  .ea-nav .btn-sm { white-space: normal; text-align: left; }
}

/* Aula didática: subtítulos, figuras, exemplos e quadro final de revisão */
.ea-texto h4 { font-size: 15.5px; margin: 18px 0 6px; color: var(--text); }
.ea-texto .ea-fig { margin: 18px auto; max-width: 480px; }
.ea-texto .ea-fig svg { width: 100%; height: auto; display: block; }
.ea-texto .ea-fig figcaption { font-size: 13px; color: var(--text-muted); text-align: center; margin-top: 6px; line-height: 1.5; }
.ea-texto .exemplo { background: #eff6ff; border-left: 4px solid #3b82f6; border-radius: 8px; padding: 10px 14px; margin: 12px 0; }
.ea-texto .exemplo::before { content: 'Na prática: '; font-weight: 700; color: #1d4ed8; }
.ea-texto .revisar { border: 1px solid var(--border); background: #f8fafc; border-radius: 10px; padding: 14px 16px 6px; margin: 26px 0 8px; }
.ea-texto .revisar h4 { margin-top: 0; text-transform: uppercase; letter-spacing: .04em; font-size: 13px; color: var(--primary-dark); }
.ea-texto .revisar table { background: var(--card); }
/* Figura larga em tela estreita: rola para o lado em vez de encolher o texto */
.ea-texto .ea-fig-rolar { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.ea-texto .ea-fig-rolar figcaption { position: sticky; left: 0; }
.ea-texto .ea-fig-rolar figcaption::before { content: '↔ Arraste a figura para o lado. '; font-weight: 600; color: var(--primary-dark); }

/* Login e sincronização */
.ea-sync-codigo { display: none; }
#ea-login { position: fixed; inset: 0; z-index: 9999; background: #0f172a; display: flex; align-items: center; justify-content: center; padding: 16px; overflow-y: auto; }
.ea-login-caixa { background: #fff; color: #1e293b; width: 100%; max-width: 360px; border-radius: 16px; padding: 28px 24px; box-shadow: 0 20px 50px rgba(0,0,0,.35); display: flex; flex-direction: column; gap: 14px; }
.ea-login-marca { font-size: 26px; font-weight: 800; color: #4338ca; }
.ea-login-sub { color: #64748b; font-size: 14px; margin: -6px 0 4px; line-height: 1.5; }
.ea-login-caixa label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: #475569; }
.ea-login-caixa .btn { width: 100%; padding: 12px; font-size: 15px; margin-top: 4px; }
.ea-login-erro { background: #fef2f2; color: #b91c1c; border-radius: 8px; padding: 8px 10px; font-size: 13px; margin: 0; }
body.ea-sem-login { overflow: hidden; }
