/* =====================================================
   BRAND — Entelecy.Academy
   Tokens, temas e componentes portados de Entelecy.Loom.Web (app.css + address-bar.css
   + flow.css) pra manter a identidade do produto que a Academy vende (§1 da spec).
   Este CSS é o ÚNICO carregado nas páginas do app — sem Bootstrap, sem template default.
   As LPs (campanha) usam Layout=null com estilo próprio, então não passam por aqui.
   ===================================================== */

/* ── TEMA CLARO (padrão) — paleta Paper/Ink/Terra da marca ── */
:root {
  --paper:      #FAF7F2;
  --paper-alt:  #F2ECE3;
  --paper-deep: #ECE4D9;

  --ink:        #1C1611;
  --ink-2:      #5C5048;
  --ink-3:      #928678;
  --ink-4:      #C0B8AE;

  --terra:      #E2623E;
  --terra-deep: #A93A1C;
  --terra-soft: rgba(226, 98, 62, .08);

  --night:      #18160F;

  --olive:      #5C7048;
  --ok:         #4C8C5A;  --ok-soft:     rgba(76, 140, 90, .12);
  --info:       #3A6480;  --info-soft:   rgba(58, 100, 128, .10);
  --warn:       #C89C3D;  --warn-soft:   rgba(200, 156, 61, .14);
  --danger:     #A0392B;  --danger-soft: rgba(160, 57, 43, .12);

  --border:     rgba(80, 68, 50, .12);
  --border-s:   rgba(80, 68, 50, .20);
  --border-m:   rgba(80, 68, 50, .30);

  --font-serif: 'Crimson Pro', Georgia, 'Times New Roman', serif;
  --font-sans:  'Manrope', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  --font-mono:  'JetBrains Mono', ui-monospace, 'Cascadia Code', Consolas, monospace;

  --r-sm: 4px;
  --r:    6px;
  --r-md: 8px;
  --r-lg: 12px;

  --header-h:   56px;
  --header-h-m: 52px;

  /* sombras (Loom não tem token; copiadas dos valores literais) */
  --sh-card: 0 2px 10px rgba(28, 22, 17, .06);
  --sh-lift: 0 12px 30px rgba(28, 22, 17, .10);
  --sh-pop:  0 12px 34px rgba(0, 0, 0, .18);

  /* mapeamentos internos → o app usa estes */
  --bg:        var(--paper);
  --bg-soft:   var(--paper-alt);
  --bg-card:   #ffffff;
  --bg-input:  #ffffff;
  --bg-hover:  var(--paper-deep);
  --bg-selected: var(--terra-soft);
  --text:      var(--ink);
  --text-dim:  var(--ink-2);
  --text-faint:var(--ink-3);
  --accent:    var(--terra);
}

/* ── TEMA ESCURO (cinza, Dark+) ── */
html[data-theme="dark"] {
  --bg:        #1e1e1e;
  --bg-soft:   #252526;
  --bg-card:   #252526;
  --bg-input:  #2b2b2c;
  --bg-hover:  #2a2d2e;
  --bg-selected: rgba(0, 122, 204, .14);
  --border:    #3f3f46;
  --border-s:  #4a4a52;
  --border-m:  #56565f;
  --text:      #d4d4d4;
  --text-dim:  #9e9e9e;
  --text-faint:#6f6f6f;
  --ink:       #d4d4d4;
  --ink-2:     #9e9e9e;
  --ink-3:     #6f6f6f;
  --sh-card:   0 2px 10px rgba(0, 0, 0, .30);
  --sh-lift:   0 12px 30px rgba(0, 0, 0, .45);
  --sh-pop:    0 12px 34px rgba(0, 0, 0, .50);
}

/* ── TEMA QUENTE — escuro terroso (dark + data-warm), a referência do Loom ── */
html[data-theme="dark"][data-warm] {
  --bg:        #16110E;
  --bg-soft:   #1E1813;
  --bg-card:   #1B1510;
  --bg-input:  #211A14;
  --bg-hover:  #29211A;
  --bg-selected: rgba(240, 135, 90, .14);
  --border:    #2D241D;
  --border-s:  #3A2F26;
  --border-m:  #4A3C30;
  --text:      #ECE7DF;
  --text-dim:  #B0A698;
  --text-faint:#7E7264;
  --ink:       #ECE7DF;
  --ink-2:     #B0A698;
  --ink-3:     #7E7264;
  --terra:     #F0875A;
  --terra-deep:#E2623E;
  --terra-soft:rgba(240, 135, 90, .10);
}

/* ── RESET ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
body, h1, h2, h3, h4, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img { max-width: 100%; display: block; }
button { font: inherit; }

/* ── BASE ─────────────────────────────────────────────────────────────── */
html { font-size: 16px; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background .2s, color .2s;
}

h1, h2, h3, h4 { font-family: var(--font-serif); font-weight: 600; color: var(--text); line-height: 1.15; letter-spacing: -.01em; }

a { color: var(--terra); text-decoration: none; }
a:hover { color: var(--terra-deep); }

hr { border: none; border-top: 1px solid var(--border); margin: 28px 0; }

/* Coluna de conteúdo centrada — mesmo espírito do .kode-page-inner do Loom (840px). */
.page { min-height: calc(100vh - var(--header-h) - 52px); }
.page-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 40px 40px 72px;
}
.page-inner--wide { max-width: 1040px; }
@media (max-width: 720px) { .page-inner { padding: 28px 20px 56px; } }

.app-footer {
  border-top: 1px solid var(--border);
  color: var(--text-faint);
  font-size: .8rem;
}
.app-footer .page-inner { padding: 16px 40px; max-width: 860px; }

/* ── CABEÇALHO DE PÁGINA (eyebrow mono + título serif + lead) ──────────── */
.page-crumb {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: .68rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--text-faint); margin-bottom: 12px;
}
.page-crumb:hover { color: var(--terra); }
.page-eyebrow {
  font-family: var(--font-mono); font-size: .68rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--terra); display: block; margin-bottom: 10px;
}
.page-title { font-size: 2.1rem; margin: 0 0 12px; }
.page-lead { color: var(--text-dim); font-size: 1.02rem; max-width: 60ch; }

/* ── BOTÕES (kode-btn do Loom) ─────────────────────────────────────────── */
.btn-terra, .btn-ghost, .btn-outline {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 20px; border-radius: var(--r);
  font-family: var(--font-sans); font-size: .92rem; font-weight: 600;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  border: 1px solid transparent; transition: background .15s, border-color .15s, color .15s, transform .1s;
}
.btn-terra { background: var(--terra); color: #fff; }
.btn-terra:hover { background: var(--terra-deep); color: #fff; }
.btn-terra:active { transform: translateY(1px); }
.btn-ghost { background: transparent; color: var(--text-dim); border-color: var(--border-s); }
.btn-ghost:hover { color: var(--terra); border-color: var(--terra); }
.btn-outline { background: var(--bg-input); color: var(--text); border-color: var(--border-m); }
.btn-outline:hover { color: var(--terra); border-color: var(--terra); }
.btn-sm { height: 32px; padding: 0 14px; font-size: .82rem; }

/* Chip de ícone terra-soft — motivo recorrente do Loom (.fl-empty-mark / .pp-badge) */
.icon-badge {
  width: 42px; height: 42px; border-radius: 10px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg-selected); color: var(--terra); font-size: 1.1rem;
  border: 1px solid var(--border-s);
}

/* Pills / badges de status ─────────────────────────────────────────────── */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font-mono); font-size: .64rem; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 99px; white-space: nowrap; line-height: 1.5;
}
.pill-accent { background: var(--terra-soft); color: var(--terra); }
.pill-ok     { background: var(--ok-soft); color: var(--ok); }
.pill-warn   { background: var(--warn-soft); color: var(--warn); }
.pill-danger { background: var(--danger-soft); color: var(--danger); }
.pill-mute   { background: var(--bg-soft); color: var(--text-dim); border: 1px solid var(--border); }

/* ── HEADER (barra do topo) ────────────────────────────────────────────── */
.app-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: blur(12px) saturate(1.4);
          backdrop-filter: blur(12px) saturate(1.4);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px; height: var(--header-h);
  font-family: var(--font-sans); color: var(--text);
}
@media (max-width: 720px) { .app-header { height: var(--header-h-m); padding: 0 16px; } }

.app-header .brand { display: inline-flex; align-items: center; gap: 9px; flex-shrink: 0; text-decoration: none; }
.app-header .brand:hover { text-decoration: none; }
.app-header .brand-mk { width: 26px; height: 26px; flex-shrink: 0; }
.app-header .brand-mk svg { width: 100%; height: 100%; display: block; }
.app-header .brand-text { display: flex; flex-direction: row; align-items: baseline; gap: 10px; line-height: 1; }
.app-header .brand-name { font-family: 'Fraunces', Georgia, serif; font-weight: 500; font-size: 22px; letter-spacing: -.01em; line-height: 1; color: var(--text); }
.app-header .brand-by { font-family: var(--font-mono); font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--text-faint); line-height: 1; }

/* ── LOGIN MENU ────────────────────────────────────────────────────────── */
.login-actions { display: flex; align-items: center; gap: 12px; }
.login-entrar {
  font-size: 11px; font-weight: 500; letter-spacing: .04em;
  text-decoration: none; color: inherit; opacity: .75;
  padding: 5px 12px; border: 1px solid var(--border); border-radius: 6px;
  transition: opacity .15s, border-color .15s, color .15s;
}
.login-entrar:hover { opacity: 1; color: var(--terra); border-color: var(--terra); text-decoration: none; }

.login-menu { position: relative; display: inline-flex; }
.login-menu > summary { list-style: none; cursor: pointer; }
.login-menu > summary::-webkit-details-marker { display: none; }
.login-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; color: #fff;
  background: linear-gradient(135deg, #F39468 0%, #E2623E 52%, #C0421F 100%);
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px color-mix(in srgb, var(--terra) 45%, transparent);
  user-select: none;
}
.login-dropdown {
  position: absolute; right: 0; top: calc(100% + 8px);
  min-width: 200px; z-index: 50;
  display: flex; flex-direction: column; gap: 8px; padding: 12px;
  background: var(--bg-card); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--r-md);
  box-shadow: var(--sh-pop);
}
.login-dropdown form { margin: 0; }
.login-email { font-size: 11px; color: var(--text-dim); word-break: break-all; }
.login-item, .login-logout {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-size: 12px; font-weight: 500; cursor: pointer; text-decoration: none;
  padding: 7px 10px; width: 100%;
  color: inherit; background: transparent;
  border: 1px solid var(--border); border-radius: 6px;
  transition: color .15s, border-color .15s;
  font-family: var(--font-sans);
}
.login-item:hover { color: var(--terra); border-color: var(--terra); text-decoration: none; }
.login-logout:hover { color: var(--danger); border-color: var(--danger); }
.login-item .login-item-val { font-size: 11px; opacity: .85; display: inline-flex; align-items: center; gap: 6px; }
.theme-ico { width: 15px; height: 15px; }

/* ── DASHBOARD (/app) ──────────────────────────────────────────────────── */
.dash-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px; margin-bottom: 26px; }
.dash-head .page-title { margin: 0; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 18px; }
.course-card {
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: var(--r-lg); overflow: hidden; text-decoration: none; color: inherit;
  display: flex; flex-direction: column; transition: transform .14s, box-shadow .14s, border-color .14s;
}
.course-card:hover { transform: translateY(-2px); box-shadow: var(--sh-lift); border-color: var(--border-m); text-decoration: none; }
.course-card .cc-cover { position: relative; aspect-ratio: 16 / 9; background: var(--bg-hover); }
.course-card .cc-cover img { width: 100%; height: 100%; object-fit: cover; }
.course-card .cc-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 10px; }
.course-card h3 { margin: 0; font-size: 1.2rem; }

.progress-track { height: 6px; background: var(--bg-hover); border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--terra); border-radius: 99px; transition: width .3s; }
.progress-label { font-family: var(--font-mono); font-size: .72rem; color: var(--text-faint); letter-spacing: .02em; }

.empty-state {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 6px; padding: 48px 32px;
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--r-lg);
}
.empty-state .icon-badge { margin-bottom: 8px; }
.empty-state h2 { font-size: 1.2rem; }
.empty-state p { color: var(--text-dim); margin: 0; max-width: 42ch; }
.empty-state .btn-terra, .empty-state .btn-ghost { margin-top: 14px; }

/* ── CURSO (/app/curso/{slug}) ─────────────────────────────────────────── */
.course-hero { margin-bottom: 22px; }
.course-progress {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 14px 18px; margin-bottom: 30px;
}
.course-progress .progress-track { flex: 1; min-width: 160px; max-width: 360px; }
.course-progress .btn-terra { margin-left: auto; }

.section-label {
  font-family: var(--font-mono); font-size: .68rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--text-faint); margin: 0 0 14px;
}

/* Módulo = grupo com cabeçalho + timeline numerada (spine do Loom) */
.module { margin-bottom: 26px; }
.module-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.module-head h2 { margin: 0; font-size: 1.3rem; }
.module-head .mod-num {
  width: 26px; height: 26px; border-radius: 8px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: .78rem; font-weight: 600;
  background: var(--bg-selected); color: var(--terra);
}
.module.locked .module-head h2 { color: var(--text-faint); }
.module.locked .module-head .mod-num { background: var(--bg-soft); color: var(--text-faint); }

/* Spine: linha vertical + nós numerados por aula */
.spine { position: relative; padding-left: 4px; }
.spine::before {
  content: ""; position: absolute; left: 18px; top: 14px; bottom: 14px;
  width: 2px; background: var(--border-s);
}
.lesson-row {
  position: relative; display: flex; align-items: center; gap: 14px;
  padding: 11px 16px 11px 48px; margin-bottom: 6px;
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--r-md);
  text-decoration: none; color: var(--text);
  transition: border-color .12s, transform .1s, box-shadow .12s;
}
a.lesson-row:hover { border-color: var(--terra); transform: translateX(2px); box-shadow: var(--sh-card); text-decoration: none; }
.lesson-node {
  position: absolute; left: 6px; top: 50%; transform: translateY(-50%);
  width: 26px; height: 26px; border-radius: 50%; z-index: 1;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: .72rem; font-weight: 600;
  background: var(--bg-card); border: 2px solid var(--border-m); color: var(--text-faint);
}
.lesson-row.done .lesson-node { background: var(--ok); border-color: var(--ok); color: #fff; }
.lesson-title { flex: 1; font-size: .96rem; font-weight: 500; }
.lesson-meta { display: inline-flex; align-items: center; gap: 8px; color: var(--text-faint); }
.lesson-dur { font-family: var(--font-mono); font-size: .72rem; }
.lesson-arrow { color: var(--text-faint); font-family: var(--font-mono); font-size: .8rem; }
a.lesson-row:hover .lesson-arrow { color: var(--terra); }
.lesson-row.is-locked { background: transparent; border-style: dashed; color: var(--text-faint); }
.lesson-row.is-locked .lesson-title { font-weight: 400; }

/* ── AULA (/app/aula/{slug}) ───────────────────────────────────────────── */
.lesson-wrap { max-width: 720px; margin: 0 auto; }
.video-frame {
  aspect-ratio: 16/9; width: 100%; border-radius: var(--r-lg);
  background: var(--night); color: #EDE9E2;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: .8rem; letter-spacing: .06em;
  margin: 4px 0 26px; border: 1px solid var(--border);
}
.prose { color: var(--text); font-size: 1.04rem; line-height: 1.75; }
.prose h2, .prose h3 { margin: 1.5em 0 .5em; }
.prose p { color: var(--text); margin: 0 0 1em; }
.prose img { border-radius: var(--r); margin: 1em 0; }
.prose pre { background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--r); padding: 14px; overflow-x: auto; font-family: var(--font-mono); font-size: .85rem; }
.prose code { font-family: var(--font-mono); font-size: .9em; }

/* Faixa de destaque tipo "composer-hint" do Loom (aula-ponte pro Loom) */
.hint-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 14px 16px; color: var(--text-dim); font-size: .92rem; margin: 22px 0;
}
.hint-row .icon-badge { width: 34px; height: 34px; font-size: .95rem; }

.downloads { border-top: 1px solid var(--border); margin-top: 30px; padding-top: 20px; }
.downloads .section-label { margin-bottom: 12px; }
.download-row {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; margin-bottom: 8px; text-decoration: none;
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--r); color: var(--text);
  transition: border-color .12s;
}
.download-row:hover { border-color: var(--terra); text-decoration: none; }

.lesson-foot {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  border-top: 1px solid var(--border); margin-top: 30px; padding-top: 22px;
}

/* ── BIBLIOTECA + PACK ─────────────────────────────────────────────────── */
.pack-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.pack-card {
  display: flex; flex-direction: column; text-decoration: none; color: inherit;
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--r-lg);
  overflow: hidden; transition: transform .14s, box-shadow .14s, border-color .14s;
}
.pack-card:hover { transform: translateY(-2px); box-shadow: var(--sh-lift); border-color: var(--border-m); text-decoration: none; }
.pack-card .pk-cover { position: relative; aspect-ratio: 4 / 3; background: var(--bg-hover); }
.pack-card .pk-cover img { width: 100%; height: 100%; object-fit: cover; }
.pack-card .pk-cover .pill { position: absolute; top: 10px; left: 10px; }
.pack-card .pk-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; }
.pack-card h3 { margin: 0; font-size: 1.12rem; }
.pack-card .pk-meta { font-family: var(--font-mono); font-size: .72rem; color: var(--text-faint); }
.pack-card.locked { cursor: default; }
.pack-card.locked:hover { transform: none; box-shadow: none; border-color: var(--border); }

/* Prompt cards (dentro do pack) */
.prompt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.prompt-card {
  display: flex; flex-direction: column;
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden;
}
.prompt-card .pr-cover { aspect-ratio: 3 / 2; background: var(--bg-hover); }
.prompt-card .pr-cover img { width: 100%; height: 100%; object-fit: cover; }
.prompt-card .pr-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 10px; }
.prompt-card h3 { margin: 0; font-size: 1.05rem; display: flex; align-items: center; gap: 8px; }
.prompt-card .pr-cat { font-family: var(--font-mono); font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; color: var(--text-faint); }
.prompt-text {
  width: 100%; resize: vertical; min-height: 92px;
  background: var(--bg-input); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--r); padding: 10px 12px;
  font-family: var(--font-mono); font-size: .82rem; line-height: 1.55;
}
.prompt-text:focus { outline: none; border-color: var(--terra); }

/* ── CONTA (/app/conta) ────────────────────────────────────────────────── */
.info-card {
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 18px 20px; margin-bottom: 30px;
}
.info-row { display: flex; gap: 10px; padding: 6px 0; font-size: .95rem; }
.info-row .info-k { color: var(--text-faint); min-width: 90px; }
.info-row .info-v { color: var(--text); font-weight: 500; }

.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: .9rem; }
.data-table thead th { font-family: var(--font-mono); font-size: .66rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-faint); font-weight: 500; }
.data-table tbody tr:hover { background: var(--bg-soft); }
.status-pill { display: inline-block; font-family: var(--font-mono); font-size: .64rem; font-weight: 600; padding: 3px 9px; border-radius: 99px; text-transform: uppercase; letter-spacing: .04em; }
.status-paid { background: var(--ok-soft); color: var(--ok); }
.status-pending { background: var(--warn-soft); color: var(--warn); }
.status-refunded, .status-chargeback { background: var(--danger-soft); color: var(--danger); }
