/* ============================================================
   Direção Pro — Design System (estilo Memberkit)
   Tema claro/escuro via [data-theme] no <html>.
   ============================================================ */

:root {
  --sidebar-from: #6d28d9;
  --sidebar-to: #4c1d95;
  --sidebar-text: rgba(255, 255, 255, 0.82);
  --sidebar-text-active: #ffffff;
  --sidebar-active-bg: rgba(255, 255, 255, 0.16);

  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #f0f1f6;
  --border: #e7e8ef;
  --text: #1a1c23;
  --text-muted: #6b7180;
  --text-soft: #9aa0ad;
  --primary: #6d28d9;
  --primary-hover: #5b21b6;
  --primary-soft: #f1ebfd;
  --danger: #e11d48;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 3px rgba(16, 18, 33, 0.06), 0 8px 24px rgba(16, 18, 33, 0.05);
  --shadow-sm: 0 1px 2px rgba(16, 18, 33, 0.08);
  --sidebar-w: 256px;
}

html[data-theme='dark'] {
  --bg: #0f1117;
  --surface: #171923;
  --surface-2: #1f2230;
  --border: #272a38;
  --text: #eef0f6;
  --text-muted: #9aa0ad;
  --text-soft: #6b7180;
  --primary-soft: #241a3a;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.3);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* Tamanho PADRÃO de segurança: todo SVG inline tem 20px salvo override abaixo.
   Evita o bug do ícone gigante quando o SVG não tem classe/contêiner com tamanho. */
svg { width: 20px; height: 20px; flex-shrink: 0; }
.brand-logo svg, .auth-logo svg { width: 22px; height: 22px; }
.lesson-index svg { width: 16px; height: 16px; }
.course-thumb > svg { width: 46px; height: 46px; color: rgba(255,255,255,.5); }
.empty svg { width: 54px; height: 54px; }           /* reforça o tamanho do estado vazio */
.pane-hero svg { width: 44px; height: 44px; }        /* ícone grande das abas Arquivos/Quiz */

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
svg { display: block; }

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

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--sidebar-from), var(--sidebar-to));
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 18px 14px;
}

.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); border-radius: 99px; }

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px 18px;
}
.brand-logo {
  width: 38px; height: 38px;
  background: rgba(255,255,255,.14);
  border-radius: 11px;
  display: grid; place-items: center;
  color: #fff;
}
.brand-name { font-weight: 700; font-size: 16px; color: #fff; letter-spacing: .2px; }
.brand-img { max-width: 180px; max-height: 46px; width: auto; height: auto; object-fit: contain; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-size: 14.5px; font-weight: 500;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(255,255,255,.10); color: #fff; }
.nav-item.active { background: var(--sidebar-active-bg); color: var(--sidebar-text-active); font-weight: 600; }
.nav-item svg { width: 20px; height: 20px; flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  background: rgba(255,255,255,.22);
  color: #fff; font-size: 11px; font-weight: 700;
  padding: 1px 8px; border-radius: 99px;
}
.nav-divider { height: 1px; background: rgba(255,255,255,.12); margin: 12px 6px; }

/* ---------------- Main column ---------------- */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: 68px;
  display: flex; align-items: center; gap: 16px;
  padding: 0 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.search {
  flex: 1; max-width: 420px;
  display: flex; align-items: center; gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 9px 16px;
  color: var(--text-muted);
}
.search input {
  border: 0; background: transparent; outline: none;
  color: var(--text); font-size: 14px; width: 100%;
}
.search svg { width: 18px; height: 18px; }
.topbar-spacer { flex: 1; }
.icon-btn {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer; position: relative;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn .dot {
  position: absolute; top: 6px; right: 6px;
  min-width: 17px; height: 17px; padding: 0 4px;
  background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700;
  border-radius: 99px; display: grid; place-items: center;
}
/* Bandeiras (SVG) */
.flag { width: 22px; height: 15px; border-radius: 3px; flex-shrink: 0; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); display: block; }

/* Seletor de idioma */
.lang-select { position: relative; }
.lang-trigger .flag { width: 24px; height: 16px; }
.lang-select summary { list-style: none; cursor: pointer; }
.lang-select summary::-webkit-details-marker { display: none; }
.lang-menu {
  position: absolute; right: 0; top: 52px; z-index: 50;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow);
  padding: 6px; min-width: 200px;
}
.lang-opt {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px; font-size: 14px; color: var(--text);
}
.lang-opt:hover { background: var(--surface-2); }
.lang-opt.active { color: var(--primary); font-weight: 600; }
.lang-code {
  font-size: 11px; font-weight: 700; color: var(--text-muted);
  background: var(--surface-2); border-radius: 5px; padding: 2px 6px; min-width: 30px; text-align: center;
}
.lang-opt.active .lang-code { background: var(--primary-soft); color: var(--primary); }
.lang-check { margin-left: auto; color: var(--primary); }
.lang-check svg { width: 16px; height: 16px; }

.avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--primary-soft); color: var(--primary);
  display: grid; place-items: center; font-weight: 700;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.content { padding: 28px; max-width: 1400px; width: 100%; }

/* ---------------- Alert / flash banner ---------------- */
.banner-demo {
  background: linear-gradient(90deg, #ef4444, #dc2626);
  color: #fff; text-align: center; font-size: 13.5px;
  padding: 9px 16px; font-weight: 500;
}
.banner-demo a { text-decoration: underline; font-weight: 700; }

.flash { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 18px; font-size: 14px; font-weight: 500; }
.flash.success { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.flash.error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
html[data-theme='dark'] .flash.success { background: #052e22; color: #6ee7b7; border-color: #065f46; }
html[data-theme='dark'] .flash.error { background: #3b0a0a; color: #fca5a5; border-color: #7f1d1d; }

/* ---------------- Page header ---------------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 26px; flex-wrap: wrap; }
.page-title { font-size: 22px; font-weight: 700; }
.page-sub { color: var(--text-muted); font-size: 14.5px; margin-top: 4px; }
.head-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 18px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  transition: all .15s; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { background: transparent; }
.btn-block { width: 100%; justify-content: center; }

.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px; border-radius: var(--radius-sm);
  background: var(--primary); color: #fff;
  font-size: 14px; font-weight: 600;
}
.chip-ghost { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.chip-ghost:hover { background: var(--surface-2); }

/* Comentários (moderação estilo Memberkit) */
.cmt-tabs { display: flex; gap: 26px; border-bottom: 1px solid var(--border); margin-bottom: 22px; overflow-x: auto; }
.cmt-tab { padding: 12px 2px; font-size: 14.5px; font-weight: 600; color: var(--text-muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.cmt-tab:hover { color: var(--text); }
.cmt-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.cmt-count { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--surface-2); color: var(--text-muted); font-size: 12px; font-weight: 700; margin-left: 4px; }
.cmt-tab.active .cmt-count { background: var(--primary-soft); color: var(--primary); }

.cmt-list { display: flex; flex-direction: column; }
.cmt-item { display: flex; gap: 14px; padding: 18px 4px; border-bottom: 1px solid var(--border); align-items: flex-start; }
.cmt-item .avatar { flex-shrink: 0; }
.cmt-content { flex: 1; min-width: 0; }
.cmt-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.cmt-who { font-size: 14.5px; color: var(--text); }
.cmt-who a { color: var(--primary); font-weight: 600; }
.cmt-who .tag { margin-left: 6px; }
.cmt-date { font-size: 13px; color: var(--text-soft); white-space: nowrap; }
.cmt-text { font-size: 14.5px; color: var(--text-muted); margin: 6px 0 10px; }
.cmt-actions { display: flex; align-items: center; gap: 6px; }
.cmt-actions form { margin: 0; }
.cmt-act { display: inline-flex; align-items: center; gap: 6px; background: transparent; border: 0; color: var(--text-soft); cursor: pointer; font-size: 13.5px; font-weight: 600; padding: 6px 8px; border-radius: 7px; }
.cmt-act:hover { background: var(--surface-2); color: var(--text); }
.cmt-act svg { width: 16px; height: 16px; }
.cmt-act.on-up { color: #16a34a; }
.cmt-act.on-down { color: var(--danger); }
.cmt-act.danger:hover { color: var(--danger); }

/* Respostas (admin) */
.avatar-sm { width: 32px; height: 32px; font-size: 13px; }
.cmt-reply { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0 0 8px; padding: 10px 12px; border-left: 2px solid var(--border); }
.reply-badge { font-size: 11px; font-weight: 700; color: var(--primary); background: var(--primary-soft); padding: 1px 7px; border-radius: 99px; margin-left: 4px; }
.reply-box { display: none; gap: 8px; margin-top: 12px; }
.reply-box.open { display: flex; }
.reply-box input { flex: 1; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text); outline: none; font-size: 14px; }
.reply-box input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

/* Resposta / botão responder (aluno) */
.comment-reply-btn { background: transparent; border: 0; color: var(--primary); font-weight: 600; font-size: 13px; cursor: pointer; padding: 4px 0; margin-top: 4px; }
.comment-reply-btn:hover { text-decoration: underline; }

/* Moderação de comentários (legado) */
.comment-mod-list { display: flex; flex-direction: column; gap: 14px; }
.comment-mod { display: flex; gap: 14px; align-items: flex-start; padding: 18px; }
.comment-mod .avatar { flex-shrink: 0; }
.comment-mod-body { flex: 1; min-width: 0; }
.comment-mod-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.comment-mod-loc { font-size: 13px; color: var(--text-muted); }
.comment-mod-text { font-size: 14.5px; color: var(--text); }
.comment-mod-actions { display: flex; gap: 8px; flex-shrink: 0; }
.comment-mod-actions form { margin: 0; }
.comment-mod-actions .btn { padding: 9px 14px; }

/* ---------------- Section ---------------- */
.section-title { font-size: 18px; font-weight: 700; margin: 8px 0 18px; }

/* ---------------- Course grid ---------------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 24px;
}
.course-card { display: flex; flex-direction: column; }
.course-thumb {
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius);
  overflow: hidden;
  background: linear-gradient(135deg, #1f1430, #0d0a16);
  box-shadow: var(--shadow);
  display: grid; place-items: center;
  transition: transform .2s, box-shadow .2s;
}
.course-card:hover .course-thumb { transform: translateY(-3px); box-shadow: 0 10px 30px rgba(16,18,33,.16); }
.course-thumb img { width: 100%; height: 100%; object-fit: cover; }
.course-badge {
  font-size: 30px; font-weight: 800; letter-spacing: 1px;
  color: rgba(255,255,255,.92); text-shadow: 0 2px 12px rgba(0,0,0,.4);
}
.course-progress {
  position: absolute; left: 0; right: 0; bottom: 0; height: 5px;
  background: rgba(255,255,255,.18);
}
.course-progress > span { display: block; height: 100%; background: var(--primary); }
.course-meta { padding: 14px 4px 0; }
.course-name { font-size: 15.5px; font-weight: 700; }
.course-desc {
  color: var(--text-muted); font-size: 13.5px; margin-top: 6px;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}

/* ---------------- Forms / cards ---------------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow-sm);
}
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 7px; }
.form-control {
  width: 100%; padding: 11px 14px; font-size: 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text); outline: none;
  transition: border .15s, box-shadow .15s;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
textarea.form-control { resize: vertical; min-height: 96px; }

/* ---------------- Table ---------------- */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 14px 16px; border-bottom: 1px solid var(--border); font-size: 14px; }
.table th { color: var(--text-muted); font-weight: 600; font-size: 12.5px; text-transform: uppercase; letter-spacing: .4px; }
.tag { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--text-muted); }
.tag-admin { background: var(--primary-soft); color: var(--primary); }
.member-search { display: flex; align-items: center; gap: 10px; }
.member-search .search { flex: 1; }

/* ---------------- Modal ---------------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(10,12,20,.55);
  display: none; place-items: center; z-index: 100; padding: 20px;
}
.modal-overlay.open { display: grid; }
.modal {
  background: var(--surface); border-radius: var(--radius);
  width: 100%; max-width: 460px; padding: 26px; box-shadow: var(--shadow);
}
.modal h3 { font-size: 18px; font-weight: 700; margin-bottom: 18px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }

/* ---------------- Empty state ---------------- */
.empty { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty svg { width: 54px; height: 54px; margin: 0 auto 14px; color: var(--text-soft); }

/* ---------------- Player (área do aluno) ---------------- */
.player-wrap { display: grid; grid-template-columns: 1fr 340px; gap: 24px; align-items: start; }
.player {
  aspect-ratio: 16 / 9; width: 100%;
  border-radius: var(--radius); overflow: hidden; background: #000; box-shadow: var(--shadow);
}
.player iframe, .player video { width: 100%; height: 100%; border: 0; }
/* Player incorporado (VTurb/Panda): deixa o próprio script controlar o tamanho */
.player-embed { aspect-ratio: auto; height: auto; background: transparent; box-shadow: none; border-radius: 0; overflow: visible; }
.player-embed > * { width: 100%; }
.lesson-list { display: flex; flex-direction: column; gap: 8px; }
.lesson-item {
  display: flex; gap: 12px; align-items: center;
  padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border); transition: background .15s;
}
.lesson-item:hover { background: var(--surface-2); }
.lesson-item.active { border-color: var(--primary); background: var(--primary-soft); }
.lesson-index {
  width: 30px; height: 30px; flex-shrink: 0; border-radius: 8px;
  background: var(--surface-2); display: grid; place-items: center;
  font-size: 13px; font-weight: 700; color: var(--text-muted);
}
.lesson-item.active .lesson-index { background: var(--primary); color: #fff; }
.lesson-info { min-width: 0; }
.lesson-info strong { font-size: 14px; font-weight: 600; display: block; }
.lesson-info span { font-size: 12.5px; color: var(--text-muted); }

/* ---------------- Lista de aulas do aluno (por módulo) ---------------- */
.s-modules { display: flex; flex-direction: column; gap: 14px; }
.s-lesson-row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px; border-bottom: 1px solid var(--border);
  font-size: 14px; color: var(--text); transition: background .15s;
}
.s-lesson-row:last-child { border-bottom: 0; }
.s-lesson-row:hover { background: var(--surface-2); }
.s-lesson-row.active { background: var(--primary-soft); }
.s-lesson-ic {
  width: 34px; height: 34px; flex-shrink: 0; border-radius: 50%;
  background: var(--surface-2); color: var(--primary);
  display: grid; place-items: center;
}
.s-lesson-row.active .s-lesson-ic { background: var(--primary); color: #fff; }
.s-lesson-ic svg { width: 16px; height: 16px; }
.s-lesson-name { flex: 1; min-width: 0; font-weight: 500; }
.s-lesson-name em { color: var(--text-soft); font-style: normal; font-size: 13px; }
.s-lesson-star { color: var(--text-soft); cursor: pointer; }
.s-lesson-star:hover { color: #f59e0b; }
.s-lesson-star svg { width: 18px; height: 18px; }

/* ---------------- Página de aula do aluno ---------------- */
.lesson-layout { display: grid; grid-template-columns: 1fr 360px; gap: 28px; align-items: start; }
.lesson-main { min-width: 0; }
.lesson-aside { display: flex; flex-direction: column; gap: 18px; position: sticky; top: 92px; }

.lesson-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 18px 0 10px; flex-wrap: wrap; }
.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-muted); }
.breadcrumb svg { width: 18px; height: 18px; }
.breadcrumb a { color: var(--primary); font-weight: 600; }
.breadcrumb span { color: var(--text-soft); }
.lesson-nav { display: flex; gap: 8px; }
.lesson-nav .icon-btn { width: 38px; height: 38px; }

.lesson-h1 { font-size: 24px; font-weight: 700; margin: 6px 0 18px; }
.lesson-text { font-size: 15px; line-height: 1.7; color: var(--text); margin-bottom: 24px; }
.lesson-text a { color: var(--primary); text-decoration: underline; }

/* Materiais complementares */
.materials { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 24px; }
.materials h3 { font-size: 16px; font-weight: 700; margin-bottom: 14px; }
.material-row { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); transition: background .15s; }
.material-row:hover { background: var(--primary-soft); }
.material-ic { color: var(--primary); }
.material-ic svg { width: 22px; height: 22px; }
.material-name { flex: 1; min-width: 0; font-size: 14px; font-weight: 500; }
.material-dl { color: var(--text-muted); }

/* Comentários */
.comments h3 { font-size: 18px; font-weight: 700; margin-bottom: 16px; }
.comment-form { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.comment-form input { flex: 1; padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text); outline: none; font-size: 14px; }
.comment-form input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.comment-list { display: flex; flex-direction: column; gap: 18px; }
.comment { display: flex; gap: 12px; }
.comment .avatar { flex-shrink: 0; }
.comment-body strong { font-size: 14px; font-weight: 600; }
.comment-body p { font-size: 14px; color: var(--text-muted); margin-top: 2px; }

/* Card de avaliação / conclusão */
.rate-card { padding: 22px; text-align: center; }
.rate-title { font-size: 15px; font-weight: 600; margin-bottom: 14px; }
.rate-faces { display: flex; justify-content: center; gap: 8px; margin-bottom: 18px; }
.rate-face { border: 0; background: transparent; color: var(--text-soft); cursor: pointer; padding: 2px; border-radius: 50%; transition: transform .12s, color .12s; }
.rate-face svg { width: 30px; height: 30px; }
.rate-face:hover { transform: scale(1.18); color: var(--primary); }
.rate-face.sel { color: #f59e0b; }
.done-btn { gap: 8px; }
.done-btn svg { width: 18px; height: 18px; }
.done-btn.done { background: #16a34a; border-color: #16a34a; color: #fff; }
.s-lesson-star.on { color: #16a34a; }

@media (max-width: 980px) {
  .lesson-layout { grid-template-columns: 1fr; }
  .lesson-aside { position: static; }
}

/* ---------------- Perfil do aluno ---------------- */
.profile-page { max-width: 680px; margin: 0 auto; }
.profile-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); margin-bottom: 18px;
}
.profile-banner {
  height: 120px;
  background: linear-gradient(120deg, var(--sidebar-from), var(--sidebar-to));
}
.profile-top {
  display: flex; align-items: flex-end; gap: 18px;
  padding: 14px 24px 22px;
}
.profile-avatar-lg {
  width: 96px; height: 96px; border-radius: 50%; flex-shrink: 0;
  background: var(--primary); color: #fff;
  display: grid; place-items: center; font-size: 40px; font-weight: 800;
  border: 4px solid var(--surface); box-shadow: var(--shadow);
  margin-top: -60px;   /* só o avatar sobe para dentro da capa */
}
.profile-id { flex: 1; min-width: 0; padding-bottom: 4px; }
.profile-name-lg { font-size: 22px; font-weight: 800; line-height: 1.2; }
.profile-email-lg { color: var(--text-muted); font-size: 14px; margin-top: 3px; }
.profile-role {
  align-self: flex-end; margin-bottom: 6px;
  background: var(--primary-soft); color: var(--primary);
  font-size: 12.5px; font-weight: 700; padding: 6px 14px; border-radius: 99px; white-space: nowrap;
}
.profile-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 18px; }
.pstat {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm);
}
.pstat-ic {
  width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0;
  background: var(--primary-soft); color: var(--primary);
  display: grid; place-items: center;
}
.pstat-ic svg { width: 22px; height: 22px; }
.pstat strong { display: block; font-size: 18px; font-weight: 800; }
.pstat span { font-size: 13px; color: var(--text-muted); }
.profile-form { max-width: none; }
@media (max-width: 620px) { .profile-stats { grid-template-columns: 1fr; } }

/* ---------------- Auth ---------------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: linear-gradient(135deg, var(--sidebar-from), var(--sidebar-to)); }
.auth-card { background: var(--surface); border-radius: 18px; padding: 36px; width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,.25); position: relative; }
.auth-lang { position: absolute; top: 14px; right: 14px; }
.auth-lang .icon-btn { width: 38px; height: 38px; }
.auth-logo { width: 52px; height: 52px; border-radius: 14px; background: var(--primary); color:#fff; display: grid; place-items: center; margin: 0 auto 18px; }
.auth-card h1 { text-align: center; font-size: 21px; margin-bottom: 6px; }
.auth-card p.muted { text-align: center; color: var(--text-muted); font-size: 14px; margin-bottom: 24px; }
.auth-foot { text-align: center; margin-top: 18px; font-size: 14px; color: var(--text-muted); }
.auth-foot a { color: var(--primary); font-weight: 600; }

/* ---------------- Formulário em seções (estilo Memberkit) ---------------- */
.settings-section {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 32px;
  padding: 30px 0;
  border-top: 1px solid var(--border);
}
.settings-section:first-of-type { border-top: 0; padding-top: 8px; }
.settings-label h3 { font-size: 17px; font-weight: 700; margin-bottom: 8px; }
.settings-label p { font-size: 14px; color: var(--text-muted); line-height: 1.6; }
.field-row { display: grid; grid-template-columns: 1fr 130px; gap: 16px; }

/* Checkbox em formato de card */
.check-row {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 16px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); margin-top: 14px; cursor: pointer;
  transition: border .15s, background .15s;
}
.check-row:hover { background: var(--surface-2); }
.check-row input { margin-top: 3px; width: 17px; height: 17px; accent-color: var(--primary); cursor: pointer; flex-shrink: 0; }
.check-row .ctext strong { display: block; font-size: 14px; font-weight: 600; }
.check-row .ctext span { font-size: 13px; color: var(--text-muted); }

/* Cards de preferência de layout */
.layout-options { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.layout-card {
  border: 2px solid var(--border); border-radius: var(--radius);
  padding: 16px; cursor: pointer; transition: border .15s, box-shadow .15s;
  background: var(--surface);
}
.layout-card:hover { border-color: var(--text-soft); }
.layout-card.selected { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.layout-card .lc-head { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; }
.layout-card .lc-radio {
  width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--text-soft);
  display: grid; place-items: center; flex-shrink: 0;
}
.layout-card.selected .lc-radio { border-color: var(--primary); }
.layout-card.selected .lc-radio::after { content: ''; width: 9px; height: 9px; border-radius: 50%; background: var(--primary); }
.layout-card .lc-title { font-size: 14.5px; font-weight: 600; }
.lc-mock { background: var(--surface-2); border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.lc-bar { height: 7px; border-radius: 4px; background: var(--border); }
.lc-list-row { display: flex; gap: 8px; }
.lc-list-row .lc-bar { flex: 1; }
.lc-thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 4px; }
.lc-thumb { aspect-ratio: 1; border-radius: 5px; background: var(--border); }

/* Área de upload (dropzone) */
.dropzone {
  border: 2px dashed var(--border); border-radius: var(--radius);
  min-height: 200px; display: grid; place-items: center; text-align: center;
  padding: 24px; cursor: pointer; color: var(--text-muted);
  transition: border .15s, background .15s; position: relative; overflow: hidden;
}
.dropzone:hover, .dropzone.drag { border-color: var(--primary); background: var(--primary-soft); }
.dropzone svg { width: 40px; height: 40px; margin: 0 auto 12px; color: var(--text-soft); }
.dropzone .dz-hint { font-size: 13.5px; }
.dropzone img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.dz-or { text-align: center; color: var(--text-soft); font-size: 13px; margin: 12px 0; }

/* Editor de texto simples (onboarding) */
.rte { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); }
.rte-toolbar { display: flex; gap: 2px; padding: 8px; border-bottom: 1px solid var(--border); flex-wrap: wrap; background: var(--surface); }
.rte-btn { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 7px; border: 0; background: transparent; color: var(--text-muted); cursor: pointer; }
.rte-btn:hover { background: var(--surface-2); color: var(--text); }
.rte-btn svg { width: 17px; height: 17px; }
.rte-content { min-height: 160px; padding: 14px 16px; outline: none; font-size: 14px; color: var(--text); }
.rte-content:empty::before { content: attr(data-placeholder); color: var(--text-soft); }

/* Barra de ações fixa do formulário */
.form-footer { display: flex; justify-content: flex-end; gap: 12px; padding-top: 24px; border-top: 1px solid var(--border); margin-top: 8px; }

@media (max-width: 760px) {
  .settings-section { grid-template-columns: 1fr; gap: 16px; }
  .field-row { grid-template-columns: 1fr; }
}

/* ---------------- Aparência ---------------- */
.color-field { display: inline-flex; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 12px 6px 6px; background: var(--surface-2); }
.color-field input[type=color] { width: 34px; height: 34px; border: 0; border-radius: 7px; background: none; cursor: pointer; padding: 0; }
.color-field input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
.color-field input[type=color]::-webkit-color-swatch { border: 0; border-radius: 7px; }
.color-field b { font-size: 13.5px; font-weight: 600; text-transform: uppercase; color: var(--text-muted); }
.theme-card { padding: 12px; }
.img-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.img-dz img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: var(--surface-2); padding: 8px; }
@media (max-width: 700px) { .img-grid { grid-template-columns: 1fr; } }

/* ---------------- Integrações (Stripe) ---------------- */
.stripe-card { margin-bottom: 18px; }
.stripe-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.stripe-head h3 { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.stripe-head h3 svg { width: 18px; height: 18px; color: var(--primary); }
.stripe-webhook { font-size: 12.5px; color: var(--text-muted); margin-top: 8px; }
.stripe-webhook code { display: inline-block; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 3px 8px; font-size: 12px; margin-top: 4px; word-break: break-all; }
.wh-form { display: flex; gap: 8px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.wh-form .form-control { max-width: 360px; font-size: 13px; }
.wh-status { font-size: 12.5px; color: var(--text-muted); }
.map-list { display: flex; flex-direction: column; gap: 8px; padding: 16px 0; }
.map-row { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.map-when code { background: var(--surface-2); border-radius: 5px; padding: 2px 6px; font-size: 12.5px; }
.map-arrow svg { width: 16px; height: 16px; color: var(--text-soft); }
.map-course { font-weight: 600; color: var(--primary); }
.map-lang { display: inline-flex; align-items: center; }
.map-lang .flag { width: 20px; height: 14px; }
.map-form { display: flex; gap: 10px; flex-wrap: wrap; padding-top: 14px; border-top: 1px solid var(--border); }
.map-form .form-control { flex: 1; min-width: 120px; }

/* ---------------- Configurações ---------------- */
.code-area { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.email-tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 20px; }
.email-tpl { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.email-tpl-cover { aspect-ratio: 16/10; background: linear-gradient(135deg, #1f2937, #0b0f1a); display: grid; place-items: center; padding: 16px; }
.email-tpl-cover span { color: #fff; font-size: 20px; font-weight: 700; text-align: center; }
.email-tpl-body { padding: 14px 16px; }
.email-tpl-body p { font-size: 13.5px; color: var(--text-muted); margin-top: 10px; }

/* ---------------- Gestão de conteúdo (detalhe do curso) ---------------- */
.content-manage { display: grid; grid-template-columns: 320px 1fr; gap: 28px; align-items: start; }
.cm-course { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); position: sticky; top: 92px; }
.cm-thumb {
  aspect-ratio: 16/10; border-radius: var(--radius-sm); overflow: hidden;
  background: linear-gradient(135deg, #1f1430, #0d0a16); display: grid; place-items: center; margin-bottom: 16px;
}
.cm-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cm-thumb > svg { width: 44px; height: 44px; color: rgba(255,255,255,.5); }
.cm-title { font-size: 18px; font-weight: 700; }
.cm-desc { font-size: 13.5px; color: var(--text-muted); margin: 8px 0 14px; line-height: 1.55; }
.cm-meta { font-size: 12.5px; color: var(--text-soft); font-weight: 600; }

.cm-modules { display: flex; flex-direction: column; gap: 14px; }
.module-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.module-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px; cursor: pointer; user-select: none; }
.module-head:hover { background: var(--surface-2); }
.module-caret { color: var(--text-muted); display: grid; place-items: center; transition: transform .2s; transform: rotate(-90deg); }
.module-card.collapsed .module-caret { transform: rotate(0deg); }
.module-caret svg { width: 18px; height: 18px; }
.module-titles { flex: 1; min-width: 0; }
.module-titles strong { font-size: 15px; font-weight: 700; display: block; }
.module-titles span { font-size: 13px; color: var(--text-muted); }
.module-add { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; color: var(--primary); background: var(--primary-soft); }
.module-add svg { width: 18px; height: 18px; }
.module-add:hover { background: var(--primary); color: #fff; }
.module-body { border-top: 1px solid var(--border); }
.module-card.collapsed .module-body { display: none; }
.lesson-row { display: flex; align-items: center; gap: 12px; padding: 13px 18px 13px 46px; border-bottom: 1px solid var(--border); font-size: 14px; }
.lesson-row:last-child { border-bottom: 0; }
.lesson-row:hover { background: var(--surface-2); }
.lesson-row.empty-row { color: var(--text-soft); font-style: italic; padding-left: 46px; }
.lesson-ic { color: var(--primary); display: grid; place-items: center; }
.lesson-ic svg { width: 18px; height: 18px; }
.lesson-name { flex: 1; min-width: 0; }
.lesson-name em { color: var(--text-soft); font-style: normal; font-size: 13px; }
.lesson-edit { color: var(--text-soft); opacity: 0; transition: opacity .15s; }
.lesson-row:hover .lesson-edit { opacity: 1; }
.lesson-edit svg { width: 16px; height: 16px; }

/* Botões de ação do módulo (editar/excluir) */
.module-act { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; border: 0; background: transparent; color: var(--text-muted); cursor: pointer; }
.module-act:hover { background: var(--surface-2); color: var(--text); }
.module-act.danger:hover { background: #fef2f2; color: var(--danger); }
html[data-theme='dark'] .module-act.danger:hover { background: #3b0a0a; }
.module-act svg { width: 17px; height: 17px; }

/* iframe do player incorporado (VTurb/Panda) */
.embed-frame { width: 100%; height: 100%; border: 0; }
/* Player incorporado com altura automática (sem cortar / sem bordas pretas) */
.player-embed-box { width: 100%; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); background: #000; }
.player-embed-box .embed-frame { width: 100%; height: 56.25vw; max-height: 78vh; min-height: 220px; display: block; }
@media (min-width: 1100px) { .player-embed-box .embed-frame { height: 460px; } }

/* Abas de tipo de conteúdo (Nova aula) */
.content-tabs { display: flex; gap: 4px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 4px; background: var(--surface-2); width: fit-content; margin-bottom: 16px; }
.content-tab { display: inline-flex; align-items: center; gap: 7px; padding: 8px 16px; border-radius: 8px; font-size: 14px; font-weight: 600; color: var(--text-muted); cursor: pointer; border: 0; background: transparent; }
.content-tab svg { width: 16px; height: 16px; }
.content-tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.content-pane { display: none; }
.content-pane.active { display: block; }
.lesson-cover-box { border: 2px dashed var(--border); border-radius: var(--radius); aspect-ratio: 16/9; display: grid; place-items: center; text-align: center; color: var(--text-soft); font-size: 13px; padding: 16px; cursor: pointer; overflow: hidden; position: relative; }
.lesson-cover-box:hover { border-color: var(--primary); }
.lesson-cover-box img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

@media (max-width: 880px) {
  .content-manage { grid-template-columns: 1fr; }
  .cm-course { position: static; }
}

/* ---------------- Responsivo ---------------- */
.menu-toggle { display: none; }
@media (max-width: 980px) {
  .player-wrap { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .sidebar {
    position: fixed; z-index: 60; transform: translateX(-100%);
    transition: transform .25s; box-shadow: 0 0 40px rgba(0,0,0,.3);
  }
  .sidebar.open { transform: translateX(0); }
  .menu-toggle { display: grid; }
  .content { padding: 18px; }
  .scrim { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 55; display: none; }
  .scrim.open { display: block; }
}
