/* ==========================================================================
   FleckMart — Painel administrativo
   Design system: escuro único, acento índigo. Todas as cores vêm dos
   tokens em css/tokens.css — nenhum hex de tema deve nascer aqui.
   ========================================================================== */

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 14px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.015em; }
p { margin: 0; }
code { padding: 1px 6px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* --------------------------------------------------------------------------
   Botões
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-weight: 550;
  font-size: 13.5px;
  line-height: 1.2;
  white-space: nowrap;
  text-decoration: none !important;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.06s;
}
.btn:active { transform: translateY(1px); }
.btn.lg { padding: 12px 18px; font-size: 14.5px; border-radius: 10px; }
.btn.sm { padding: 6px 10px; font-size: 12.5px; gap: 6px; }
.btn.sm .icon { width: 15px; height: 15px; }
.btn.primary { background: var(--primary); color: #fff; box-shadow: var(--shadow-1); }
.btn.primary:hover { background: var(--primary-strong); }
.btn.soft { background: var(--primary-soft); color: var(--primary-soft-ink); }
.btn.soft:hover { background: var(--primary-soft-strong); }
.btn.ghost { background: var(--surface-2); color: var(--ink); border-color: var(--border-strong); }
.btn.ghost:hover { background: var(--surface-3); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.danger:hover { background: var(--danger-strong); }
.btn.danger-text { color: var(--danger); border-color: transparent; background: transparent; }
.btn.danger-text:hover { background: var(--danger-soft); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }
.icon-btn.ghost-dark { color: var(--side-ink); }
.icon-btn.ghost-dark:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }

/* --------------------------------------------------------------------------
   Formulários
   -------------------------------------------------------------------------- */
.field { display: grid; gap: 6px; }
.field > span { font-size: 12.5px; font-weight: 550; color: var(--muted); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.input {
  width: 100%;
  min-width: 0;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus { border-color: var(--primary); box-shadow: var(--ring); }
.input::placeholder { color: var(--faint); }
textarea.input { resize: vertical; min-height: 40px; }
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239aa2b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 32px; }
input[type="file"].input { padding: 7px; }
input[type="file"].input::file-selector-button {
  margin-right: 10px;
  padding: 5px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--ink);
  font: 550 12.5px var(--font);
  cursor: pointer;
}
.input.upper { text-transform: uppercase; }
.hint { color: var(--faint); font-size: 12.5px; }
.check-inline { display: flex; align-items: center; gap: 14px; min-height: 38px; }
.check-inline label { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.check-field > .switch-label { min-height: 38px; }

/* Switch */
.switch { position: relative; display: inline-block; width: 36px; height: 21px; flex: none; }
.switch input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.switch i {
  position: absolute; inset: 0;
  border-radius: 99px;
  background: var(--border-strong);
  transition: background 0.15s;
  pointer-events: none;
}
.switch i::after {
  content: "";
  position: absolute;
  top: 2.5px; left: 2.5px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s;
}
.switch input:checked + i { background: var(--primary); }
.switch input:checked + i::after { transform: translateX(15px); }
.switch-label { display: inline-flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 500; cursor: pointer; }

/* --------------------------------------------------------------------------
   Cartões, badges, chips
   -------------------------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-1); }
.card.pad { padding: 20px; }
.card-title { font-size: 15.5px; }
.card-sub { margin-top: 3px; color: var(--muted); font-size: 13px; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 620;
  letter-spacing: 0.01em;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--border);
}
.badge.green { background: var(--success-soft); color: var(--success); border-color: transparent; }
.badge.amber { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.red { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge.indigo { background: var(--primary-soft); color: var(--primary-soft-ink); border-color: transparent; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 7px 13px;
  border: 1px solid var(--border-strong);
  border-radius: 99px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 550;
  transition: all 0.15s;
}
.chip:hover { color: var(--ink); }
.chip.active { background: var(--ink); border-color: var(--ink); color: var(--bg); }

/* --------------------------------------------------------------------------
   Login
   -------------------------------------------------------------------------- */
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(720px 420px at 15% -5%, oklch(0.52 0.24 277 / 0.3), transparent 60%),
    radial-gradient(600px 380px at 95% 8%, oklch(0.585 0.215 277 / 0.14), transparent 55%),
    var(--side-bg);
}
.login-card {
  width: min(420px, 100%);
  padding: 38px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
}
.login-eyebrow { margin: 18px 0 4px; color: var(--primary); font-size: 12px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; }
.login-card h1 { font-size: 26px; }
.login-sub { margin-top: 6px; color: var(--muted); }
.login-form { display: grid; gap: 14px; margin: 24px 0 4px; }
.login-alt { display: inline-block; margin-top: 16px; font-weight: 550; font-size: 13.5px; }
/* Marca FleckMart (o símbolo #logo-fm vive no sprite do index.html) */
.logo-mark { width: 34px; height: 34px; flex: none; filter: drop-shadow(0 4px 14px oklch(0.585 0.215 277 / 0.45)); }
.logo-mark.lg { width: 52px; height: 52px; }
.brand-word { font-size: 16.5px; font-weight: 750; letter-spacing: -0.02em; color: #fff; white-space: nowrap; }
.brand-word em {
  font-style: normal;
  background: linear-gradient(90deg, var(--primary-bright), var(--accent-violet));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* --------------------------------------------------------------------------
   Estrutura do app — sidebar em 3 estados (Onda 1 / Fase 3):
   - fixada (.side-pinned): entra no grid, 100% da altura, sem raio;
   - solta + aberta (.side-open): painel flutuante de vidro, 80% da altura,
     raio 33px, partículas no canvas;
   - solta + recolhida: filete de ~6px na borda esquerda (hover/clique abre).
   -------------------------------------------------------------------------- */
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 1fr; }
.app-shell.side-pinned { grid-template-columns: 248px 1fr; }

.sidebar {
  display: flex;
  flex-direction: column;
  color: var(--side-ink);
  overflow: hidden;
}
.sidebar-particles { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.sidebar-inner {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  transition: opacity 0.22s ease 0.1s;
}

/* Fixada: parte do grid, altura inteira, sem raio. */
.app-shell.side-pinned .sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--side-bg);
  border-right: 1px solid var(--border);
}

/* Solta: painel flutuante com efeito vidro. */
.app-shell:not(.side-pinned) .sidebar {
  position: fixed;
  z-index: 70;
  left: 14px;
  top: 50%;
  translate: 0 -50%;
  width: 266px;
  height: 80vh;
  height: 80svh;
  border-radius: 33px;
  background: color-mix(in srgb, oklch(0.13 0.012 272) 72%, transparent);
  -webkit-backdrop-filter: blur(24px) saturate(1.5);
  backdrop-filter: blur(24px) saturate(1.5);
  border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transition:
    width 0.3s cubic-bezier(0.22, 1, 0.36, 1),
    height 0.3s cubic-bezier(0.22, 1, 0.36, 1),
    left 0.3s cubic-bezier(0.22, 1, 0.36, 1),
    border-radius 0.3s cubic-bezier(0.22, 1, 0.36, 1),
    background 0.3s ease,
    border-color 0.3s ease,
    box-shadow 0.3s ease;
}

/* Solta + recolhida: o filete. */
.app-shell:not(.side-pinned):not(.side-open) .sidebar {
  left: 0;
  width: 6px;
  height: 72vh;
  height: 72svh;
  border-radius: 0 999px 999px 0;
  border-color: transparent;
  background: linear-gradient(180deg, var(--primary-bright), var(--primary) 45%, var(--accent-violet));
  box-shadow: 0 0 18px oklch(0.585 0.215 277 / 0.5);
  cursor: pointer;
}
.app-shell:not(.side-pinned):not(.side-open) .sidebar-inner { opacity: 0; pointer-events: none; transition-delay: 0s; }

/* Zona quente na borda esquerda: passar o mouse ali abre o painel. */
.sidebar-hotzone { display: none; }
.app-shell:not(.side-pinned) .sidebar-hotzone {
  display: block;
  position: fixed;
  left: 0;
  top: 0;
  width: 18px;
  height: 100vh;
  z-index: 69;
}

.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 2px 4px 16px; }
.pin-btn { margin-left: auto; }
.pin-btn .icon { transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1); }
.pin-btn[aria-pressed="true"] { color: var(--primary-soft-ink); background: var(--primary-soft); }
.pin-btn[aria-pressed="false"] .icon { transform: rotate(38deg); }
.sidebar-nav { display: grid; gap: 2px; overflow-y: auto; align-content: start; }
.nav-label { margin: 14px 10px 6px; font-size: 10.5px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); }
.nav-label:first-child { margin-top: 2px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--side-ink);
  font-weight: 500;
  font-size: 13.5px;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.06); color: #e6e7ea; }
.nav-item.active { background: rgba(99, 102, 241, 0.17); color: var(--side-active); }
.nav-item.active .icon { color: #a5b4fc; }
.nav-badge {
  margin-left: auto;
  min-width: 19px;
  padding: 1px 6px;
  border-radius: 99px;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

/* O último item "em breve" (Relatórios) virou tela de verdade na Onda 3 /
   Fase 4 — o estilo .nav-soon/.soon-badge saiu junto com o último uso. */
.sidebar-bottom {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 6px 2px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.user-chip { display: flex; align-items: center; gap: 9px; min-width: 0; }
.avatar {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent-violet));
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
  flex: none;
}
.user-name { color: var(--ink); font-size: 13px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main-col { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 32px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar-heading { display: flex; align-items: center; gap: 10px; min-width: 0; }
.eyebrow { margin: 0; color: var(--faint); font-size: 11px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; }
.topbar h2 { font-size: 19px; }
.content { padding: 26px 32px 60px; }
/* minmax(0,1fr) e não o 1fr implícito: o track "auto" herda min-width:auto dos
   filhos, então uma tabela larga (Alunos) estica a COLUNA em vez de rolar
   dentro do próprio .table-shell — no 390px isso jogava a página inteira para
   742px de rolagem horizontal. */
.view { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-content: start; }

/* --------------------------------------------------------------------------
   Dashboard
   -------------------------------------------------------------------------- */
.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
.metric-card { padding: 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-1); }
.metric-card span { display: block; color: var(--muted); font-size: 12.5px; font-weight: 550; }
.metric-card strong { display: block; margin-top: 6px; font-size: 27px; font-weight: 680; letter-spacing: -0.02em; }
.metric-card.alert strong { color: var(--warn); }
.metric-hint { display: block; margin-top: 4px; color: var(--faint); font-size: 11.5px; }

/* Bento grid da Visão geral (Fase 4): herói 8 col + métricas 4; embaixo
   avisos 5 + criação rápida 4 + afiliados 3. Tudo colapsa no responsivo. */
.bento-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px; }
.bento-card { min-width: 0; }
.bento-hero { grid-column: span 8; display: flex; flex-direction: column; gap: 14px; }
.bento-label { color: var(--faint); font-size: 11px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; }
.bento-hero-value { display: block; margin-top: 6px; font-size: 36px; font-weight: 700; letter-spacing: -0.025em; }
.bento-hero-hint { margin-top: 4px; color: var(--muted); font-size: 13px; }
.dash-revenue-chart { margin-top: auto; }
.bento-metrics { grid-column: span 4; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-content: stretch; }
.bento-metrics .metric-card { display: flex; flex-direction: column; justify-content: center; }
.bento-alerts { grid-column: span 5; }
.bento-create { grid-column: span 4; }

/* minmax(0,1fr) + min-width:0 no item: sem eles o <strong> nowrap do aviso
   vira piso da track e a página inteira ganha rolagem horizontal em 390px. */
.dash-alert-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; margin-top: 14px; }
.dash-alert {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  text-align: left;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.dash-alert:hover { border-color: var(--primary); box-shadow: var(--ring); }
.dash-alert .alert-ic {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 9px;
  flex: none;
  background: var(--warn-soft);
  color: var(--warn);
}
.dash-alert.ok .alert-ic { background: var(--success-soft); color: var(--success); }
.dash-alert .alert-ic .icon { width: 16px; height: 16px; }
.dash-alert .alert-text { min-width: 0; }
.dash-alert strong { display: block; font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-alert .sub { display: block; color: var(--faint); font-size: 12px; }
.dash-alert .go-ic { margin-left: auto; color: var(--faint); flex: none; }
.dash-alert .go-ic .icon { width: 15px; height: 15px; }
.dash-alert-empty { display: grid; justify-items: start; gap: 4px; padding: 18px 4px; color: var(--muted); font-size: 13px; }
.dash-alert-empty .icon { width: 22px; height: 22px; color: var(--success); }
.dash-alert-empty strong { font-size: 14px; color: var(--ink); }

.quick-create-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.quick-create {
  display: grid;
  gap: 2px;
  justify-items: start;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  text-align: left;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.quick-create:hover { border-color: var(--primary); box-shadow: var(--ring); }
.quick-create .icon { margin-bottom: 6px; color: var(--primary-bright); width: 20px; height: 20px; }
.quick-create strong { font-size: 13.5px; font-weight: 600; }
.quick-create span { color: var(--faint); font-size: 12px; }

/* Afiliados: placeholder elegante até a Onda 3 ligar o módulo de verdade. */
.bento-affiliates {
  grid-column: span 3;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 8px;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 100% 0%, var(--primary-soft) 0%, transparent 55%),
    var(--surface);
}
.affiliate-badge {
  position: absolute;
  top: 14px; right: 14px;
  padding: 3px 9px;
  border: 1px solid var(--primary-soft-strong);
  border-radius: 99px;
  background: var(--primary-soft);
  color: var(--primary-soft-ink);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  white-space: nowrap;
}
.affiliate-ic {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary-bright);
}
.affiliate-ic .icon { width: 20px; height: 20px; }

/* --------------------------------------------------------------------------
   Cursos
   -------------------------------------------------------------------------- */
.courses-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.course-card { display: flex; flex-direction: column; overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-1); transition: box-shadow 0.15s, transform 0.15s; }
.course-card:hover { box-shadow: var(--shadow-2); transform: translateY(-2px); }
.course-cover {
  position: relative;
  height: 110px;
  display: flex;
  align-items: flex-end;
  padding: 14px;
  color: #fff;
}
.course-cover .cover-initials { font-size: 34px; font-weight: 750; letter-spacing: -0.02em; opacity: 0.9; }
.course-cover .badge { position: absolute; top: 12px; right: 12px; backdrop-filter: blur(4px); }
.course-body { display: flex; flex-direction: column; gap: 10px; flex: 1; padding: 16px; }
.course-body h3 { font-size: 16px; }
.course-body .desc { color: var(--muted); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.course-stats { display: flex; gap: 16px; margin-top: auto; padding-top: 8px; color: var(--muted); font-size: 12.5px; }
.course-stats b { color: var(--ink); font-weight: 650; }
.course-actions { display: flex; gap: 8px; padding: 0 16px 16px; }
.course-actions .btn { flex: 1; }

/* --------------------------------------------------------------------------
   Editor de curso
   -------------------------------------------------------------------------- */
.editor-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.editor-head-info { display: grid; gap: 5px; justify-items: start; }
.editor-head-info h3 { font-size: 20px; }
.editor-head-actions { display: flex; gap: 8px; }
.modules-list { display: grid; gap: 14px; }
.module-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-1); }
.module-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; }
.drag-col { display: grid; gap: 2px; }
.module-title-wrap { flex: 1; min-width: 0; display: grid; gap: 1px; }
.module-title-wrap h4 { font-size: 15px; }
.module-title-wrap .module-sub { color: var(--faint); font-size: 12px; }
.module-head-actions { display: flex; align-items: center; gap: 2px; }
/* Capa do módulo (Onda 4 / Fase 5): a miniatura É o botão de enviar. Herdada
   do curso ela aparece esmaecida, para o produtor ver na hora que aquela
   imagem não é deste módulo. */
.module-cover {
  position: relative;
  flex: 0 0 auto;
  width: 62px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.module-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.module-cover.inherited img { opacity: 0.5; }
.module-cover-initials { font-size: 13px; font-weight: 750; color: rgba(255, 255, 255, 0.92); }
.module-cover-pencil {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(10, 11, 15, 0.5);
  color: #fff;
  opacity: 0;
  transition: opacity 0.16s;
}
.module-cover-pencil .icon { width: 15px; height: 15px; }
.module-cover:hover .module-cover-pencil, .module-cover:focus-visible .module-cover-pencil, .module-cover.open .module-cover-pencil { opacity: 1; }
.module-cover.open { border-color: var(--primary); }
.module-cover-panel { display: grid; gap: 10px; padding: 0 16px 14px; justify-items: start; }
.module-cover-panel .muted { font-size: 12.5px; }
.module-cover-panel .ui-upload { width: 100%; }
@media (max-width: 720px) {
  .module-cover { width: 52px; height: 34px; }
}
.mini-move { width: 22px; height: 18px; display: grid; place-items: center; border: 0; border-radius: 5px; background: transparent; color: var(--faint); padding: 0; }
.mini-move:hover { background: var(--surface-2); color: var(--ink); }
.mini-move .icon { width: 13px; height: 13px; }
.module-release {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 12.5px;
}
.module-release .release-label { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 550; }
.module-release select.input, .module-release input.input { width: auto; padding: 6px 10px; font-size: 12.5px; }
.module-release select.input { padding-right: 30px; }
.lessons-rows { border-top: 1px solid var(--border); }
.lesson-row-admin { display: flex; align-items: center; gap: 12px; padding: 11px 16px; border-bottom: 1px solid var(--border); }
.lesson-row-admin:last-child { border-bottom: 0; }
.lesson-num { width: 24px; color: var(--faint); font-size: 12px; font-weight: 600; text-align: center; flex: none; }
.lesson-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.lesson-main strong { font-weight: 570; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lesson-tags { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.lesson-actions { display: flex; align-items: center; gap: 2px; }
.add-lesson { display: flex; gap: 9px; padding: 12px 16px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.add-lesson .input { flex: 1; background: var(--surface); }
.add-module { display: flex; align-items: center; gap: 12px; border-style: dashed; box-shadow: none; background: transparent; }
.add-module .input { flex: 1; background: var(--surface); }
.muted-ic { color: var(--faint); width: 20px; height: 20px; }
.upload-progress { display: grid; gap: 5px; flex: 1; min-width: 160px; }
.upload-progress .track { height: 6px; border-radius: 99px; background: var(--border); overflow: hidden; }
.upload-progress .fill { height: 100%; width: 0; border-radius: 99px; background: var(--primary); transition: width 0.2s; }
.upload-progress small { color: var(--muted); font-size: 11.5px; }
.lesson-detail { padding: 4px 16px 14px 52px; display: grid; gap: 10px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.lesson-detail-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.material-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 550;
}
.material-chip .icon { width: 13px; height: 13px; }

/* --------------------------------------------------------------------------
   Toolbar, busca, tabelas
   -------------------------------------------------------------------------- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.search-box {
  display: flex;
  align-items: center;
  gap: 9px;
  width: min(360px, 100%);
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--faint);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-box:focus-within { border-color: var(--primary); box-shadow: var(--ring); }
.search-box input { flex: 1; padding: 9px 0; border: 0; outline: none; background: transparent; color: var(--ink); }
.table-shell { overflow-x: auto; }
.table-shell table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table-shell th {
  padding: 11px 16px;
  text-align: left;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  white-space: nowrap;
}
.table-shell td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table-shell tbody tr:last-child td { border-bottom: 0; }
.table-shell tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.cell-main { font-weight: 570; }
.cell-sub { display: block; color: var(--muted); font-size: 12.5px; }

/* CSV */
.csv-panel { display: grid; gap: 14px; }
.csv-form { display: grid; grid-template-columns: minmax(170px, 0.6fr) minmax(220px, 1fr) auto; gap: 10px; align-items: center; }
.csv-result { display: grid; gap: 8px; }
.csv-result details { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 14px; background: var(--surface-2); }
.csv-result summary { cursor: pointer; font-weight: 570; font-size: 13px; }
.credential-list { display: grid; gap: 5px; max-height: 220px; overflow: auto; margin-top: 10px; }
.credential-list code, .credential-list span { padding: 7px 10px; border-radius: 6px; background: var(--surface); border: 1px solid var(--border); font-size: 12px; }

/* --------------------------------------------------------------------------
   Comentários (Fase 4: avatar, deep link, resposta aninhada e coração)
   -------------------------------------------------------------------------- */
.stack-list { display: grid; gap: 12px; }
.comment-admin-card { display: grid; gap: 10px; padding: 16px 18px; }
.comment-admin-head { display: flex; align-items: flex-start; gap: 11px; }
.comment-admin-id { display: grid; gap: 3px; min-width: 0; }
.comment-admin-who { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.comment-context { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; color: var(--faint); font-size: 12.5px; }
.comment-context small { color: var(--faint); }
.context-sep { opacity: 0.6; }
.context-link {
  display: inline-flex; align-items: center; gap: 5px;
  border: 0; background: none; padding: 0; cursor: pointer;
  color: var(--muted); font: inherit; font-size: 12.5px;
}
.context-link .icon { width: 13px; height: 13px; }
.context-link:hover { color: var(--primary-soft-ink); text-decoration: underline; text-underline-offset: 3px; }
.comment-admin-card p.body { white-space: pre-wrap; color: var(--ink); }
.comment-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.like-comment .icon { transition: transform 0.15s ease; }
.like-comment.liked { color: var(--danger); }
.like-comment.liked .icon { fill: currentColor; transform: scale(1.08); }
.comment-replies { display: grid; gap: 10px; padding-left: 16px; border-left: 2px solid var(--border); }
.comment-reply { display: flex; align-items: flex-start; gap: 10px; }
.comment-reply.is-hidden { opacity: 0.55; }
.comment-reply .avatar.sm, .comment-reply .avatar-img.sm { width: 28px; height: 28px; font-size: 11px; flex: none; }
.comment-reply-body { display: grid; gap: 4px; min-width: 0; }
.comment-reply-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.comment-reply-head small { color: var(--faint); font-size: 12px; }
.comment-reply-body p.body { font-size: 13.5px; color: var(--muted); }
.link-quiet { border: 0; background: none; padding: 0; cursor: pointer; color: var(--faint); font: inherit; font-size: 12px; }
.link-quiet:hover { color: var(--danger); text-decoration: underline; text-underline-offset: 3px; }
.comment-reply-form { display: grid; gap: 8px; }
.comment-reply-form textarea { resize: vertical; min-height: 60px; }
.comment-reply-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* --------------------------------------------------------------------------
   Ofertas (aba Ofertas da página do curso — a view Comercial foi desmontada
   na Onda 2: Fase 1 levou as ofertas para o curso, Fase 5 deu tela aos cupons)
   -------------------------------------------------------------------------- */
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; width: fit-content; }
.tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-weight: 550;
  font-size: 13.5px;
  transition: all 0.15s;
}
.tab .icon { width: 15px; height: 15px; }
.tab.active { background: var(--surface-3); color: var(--ink); box-shadow: var(--shadow-1); }
.offer-card { padding: 18px 20px; display: grid; gap: 12px; }
.offer-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.offer-top h3 { font-size: 16.5px; margin: 4px 0 2px; }
.offer-top .offer-product { color: var(--muted); font-size: 13px; }
.offer-price-box { text-align: right; }
.offer-price { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; color: var(--ink); white-space: nowrap; }
.offer-price-box small { display: block; color: var(--faint); font-size: 12px; }
.offer-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.offer-config { border-top: 1px solid var(--border); padding-top: 12px; }
.offer-config summary { cursor: pointer; color: var(--primary); font-weight: 570; font-size: 13px; list-style: none; display: inline-flex; align-items: center; gap: 6px; }
.offer-config summary::-webkit-details-marker { display: none; }
.offer-config[open] summary { margin-bottom: 12px; }
.offer-config-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.mini-form { display: grid; align-content: start; gap: 8px; padding: 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.mini-form > strong { font-size: 13px; }
.mini-form .input { background: var(--surface); }
.check-line { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); cursor: pointer; }
/* Multi-seleção (bumps da simulação, ofertas do wizard de cupom): o padrão da
   reforma proíbe input nativo cru — este é o checkbox da casa, na mesma
   linguagem do switch e do select custom. */
.check-line input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 16px;
  height: 16px;
  margin: 0;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  background: var(--surface);
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}
.check-line input[type="checkbox"]:hover { border-color: var(--primary-bright); }
.check-line input[type="checkbox"]:checked {
  border-color: var(--primary);
  background-color: var(--primary);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23fff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.5 8.4l3 3 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 12px 12px;
}
.check-line input[type="checkbox"]:focus-visible { outline: none; box-shadow: var(--ring); }
.preview-result { display: grid; gap: 3px; font-size: 13px; color: var(--muted); }
.preview-result strong { color: var(--ink); font-size: 15px; }
.error-text { color: var(--danger); font-weight: 620; font-size: 12.5px; }

/* --------------------------------------------------------------------------
   Pedidos (Onda 2 / Fase 5: gráficos, tabela visual, drawer e Recuperação)
   -------------------------------------------------------------------------- */
.orders-metrics { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.provider-badge { display: flex; align-items: center; gap: 8px; padding: 8px 13px; border-radius: 99px; font-size: 12px; font-weight: 620; }
.provider-badge.local { background: var(--warn-soft); color: var(--warn); }
.provider-badge.live { background: var(--success-soft); color: var(--success); }
.orders-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.orders-pane { display: grid; gap: 16px; align-content: start; }
.orders-charts { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 14px; align-items: stretch; }
.orders-charts .card-sub { margin-bottom: 12px; }
.chart-empty { padding: 26px 0; text-align: center; font-size: 13px; }
.orders-toolbar-side { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.orders-toolbar-side .search-box { min-width: 220px; }
.orders-toolbar-side .ui-select { min-width: 150px; }
.order-offer-cell, .order-customer-cell { display: flex; align-items: center; gap: 11px; min-width: 0; }
.order-offer-id { min-width: 0; display: grid; gap: 1px; }
.order-offer-id .cell-main { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.order-cover { position: relative; overflow: hidden; flex: none; width: 56px; height: 34px; border-radius: 7px; display: flex; align-items: center; justify-content: center; color: #fff; }
.order-cover-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.order-cover-initials { font-size: 12px; font-weight: 750; opacity: 0.9; }
.order-when { white-space: nowrap; }

/* Recuperação */
.stalled { display: block; font-weight: 650; font-variant-numeric: tabular-nums; }
.stalled.late { color: var(--danger); }
.recovery-done { display: inline-flex; align-items: center; gap: 6px; color: var(--success); font-size: 12.5px; font-weight: 600; }
.recovery-done .icon { width: 14px; height: 14px; }

/* Drawer de detalhe do pedido */
dialog.drawer {
  width: min(480px, 100%);
  max-width: 100%;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0 0 0 auto;
  border: 0;
  border-left: 1px solid var(--border-strong);
  border-radius: 0;
  padding: 0;
  background: var(--surface);
  color: var(--ink);
}
dialog.drawer[open] { animation: drawer-in 0.24s cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes drawer-in { from { transform: translateX(46px); opacity: 0.4; } }
.drawer-body { display: grid; gap: 18px; align-content: start; height: 100%; overflow-y: auto; padding: 20px 22px 30px; }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.drawer-head strong { font-size: 15.5px; }
.drawer-status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.drawer-total { margin-left: auto; font-size: 21px; font-weight: 700; letter-spacing: -0.02em; }
.drawer-section { display: grid; gap: 10px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.drawer-section h4 { font-size: 12px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.drawer-customer { display: flex; align-items: center; gap: 11px; }
.drawer-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.drawer-items { display: grid; gap: 7px; }
.drawer-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13.5px; }
.drawer-item em.badge { font-style: normal; margin-left: 6px; }
.drawer-item.discount { color: var(--success); }
.drawer-item.total { border-top: 1px dashed var(--border); padding-top: 8px; font-weight: 650; }
.order-timeline { display: grid; }
.timeline-item { position: relative; display: grid; gap: 2px; padding: 0 0 13px 22px; font-size: 13px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before { content: ''; position: absolute; left: 4px; top: 5px; width: 9px; height: 9px; border-radius: 50%; background: var(--border-strong); }
.timeline-item::after { content: ''; position: absolute; left: 8px; top: 17px; bottom: 2px; width: 1px; background: var(--border); }
.timeline-item:last-child::after { display: none; }
.timeline-item small { color: var(--faint); font-size: 11.5px; }
.timeline-item.ok::before { background: var(--success); }
.timeline-item.bad::before { background: var(--danger); }
.timeline-item.warn::before { background: var(--warn); }

/* --------------------------------------------------------------------------
   Cupons (Onda 2 / Fase 5)
   -------------------------------------------------------------------------- */
.coupons-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 14px; align-items: start; }
.coupon-code { font-family: var(--font-mono, ui-monospace, monospace); letter-spacing: 0.04em; }
.coupon-off td { opacity: 0.6; }
.coupon-off td:last-child { opacity: 1; }
.coupon-usage { display: grid; gap: 5px; min-width: 96px; }
.coupon-usage-track { display: block; height: 5px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.coupon-usage-track i { display: block; height: 100%; border-radius: 99px; background: var(--primary); }
.coupon-expired { margin-left: 8px; }
.coupons-top-card { display: grid; gap: 4px; align-content: start; }
.coupon-top-row { display: grid; gap: 6px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.coupon-top-row:last-child { border-bottom: 0; }
.coupon-top-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.coupon-top-head strong { font-size: 13.5px; letter-spacing: 0.03em; }
.coupon-top-head span { color: var(--muted); font-size: 12px; white-space: nowrap; }
.coupon-offer-list { display: grid; gap: 8px; max-height: 240px; overflow-y: auto; padding: 4px 2px; }

@media (max-width: 900px) {
  .orders-charts, .coupons-grid { grid-template-columns: 1fr; }
}

/* --------------------------------------------------------------------------
   Páginas e funis
   -------------------------------------------------------------------------- */
.page-card, .funnel-card { padding: 18px 20px; display: grid; gap: 13px; }
.page-card-top, .funnel-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.page-card-top h3, .funnel-card-top h3 { font-size: 16.5px; margin: 4px 0 2px; }
.page-url { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; }
.page-url code { font-size: 12px; }
/* `flex: none` sozinho estourava a linha: com a ação de Excluir são quatro
   botões, e a 390px eles somam mais que a largura do cartão — a tela de
   Páginas passou a rolar na horizontal, que é justamente o que o brief proíbe.
   Quebrar em duas linhas resolve sem esconder nada. */
.page-top-actions { display: flex; flex-wrap: wrap; gap: 8px; flex: none; min-width: 0; }
.version-history { display: grid; gap: 0; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.version-history > strong { padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); font-size: 12px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.page-version-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 14px; border-bottom: 1px solid var(--border); font-size: 13px; }
.page-version-row:last-child { border-bottom: 0; }
.page-version-row .v-meta { color: var(--muted); }
.page-version-row .v-meta b { color: var(--ink); }
.page-version-row > div { display: flex; flex-wrap: wrap; gap: 5px; }
.editor-details { border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.editor-details > summary { padding: 12px 14px; cursor: pointer; font-weight: 570; font-size: 13.5px; color: var(--primary); list-style: none; display: flex; align-items: center; gap: 8px; }
.editor-details > summary::-webkit-details-marker { display: none; }
.builder-version-form, .zip-version-form { display: grid; gap: 9px; padding: 0 14px 16px; }
.builder-version-form .input { background: var(--surface); }
.zip-version-form { grid-template-columns: 1fr auto; align-items: center; }
.zip-version-form .input { background: var(--surface); }
.split-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }

.funnel-metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.funnel-metric-grid > div { padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.funnel-metric-grid span { display: block; color: var(--muted); font-size: 11px; font-weight: 650; letter-spacing: 0.05em; text-transform: uppercase; }
.funnel-metric-grid strong { display: block; margin-top: 3px; font-size: 19px; font-weight: 680; }
.funnel-version-form { padding: 0 14px 16px; display: grid; gap: 12px; }
.funnel-editor-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.funnel-editor-toolbar > label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; font-weight: 550; }
.funnel-editor-toolbar select.input { width: auto; background: var(--surface); }
.funnel-editor-toolbar > div { display: flex; flex-wrap: wrap; gap: 6px; }
.funnel-builder { display: grid; gap: 0; }
.funnel-node { padding: 14px 16px; border: 1px solid var(--border); border-left: 4px solid var(--primary); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-1); display: grid; gap: 10px; }
.funnel-node[data-type="question"] { border-left-color: var(--warn); }
.funnel-node[data-type="capture"] { border-left-color: var(--accent-cyan); }
.funnel-node[data-type="destination"] { border-left-color: var(--accent-violet); }
.funnel-node-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.node-type { padding: 4px 9px; border-radius: 99px; background: var(--primary-soft); color: var(--primary-soft-ink); font-size: 10.5px; font-weight: 750; letter-spacing: 0.05em; text-transform: uppercase; }
.node-type.question { background: var(--warn-soft); color: var(--warn); }
.node-type.capture { background: color-mix(in srgb, var(--accent-cyan) 16%, transparent); color: var(--accent-cyan); }
.node-type.destination { background: color-mix(in srgb, var(--accent-violet) 16%, transparent); color: var(--accent-violet); }
.node-metrics { display: flex; gap: 5px; margin-left: auto; }
.node-metrics span { padding: 4px 8px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); font-size: 11px; white-space: nowrap; }
.start-node { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 12px; font-weight: 550; }
.funnel-node-common { display: grid; grid-template-columns: 0.55fr 1.2fr 1.4fr 0.8fr; gap: 9px; }
.funnel-node label { display: grid; gap: 4px; color: var(--muted); font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.04em; }
.funnel-node .input { background: var(--surface); font-size: 13px; }
.funnel-node textarea.input { min-height: 54px; }
.funnel-node-settings { display: grid; gap: 9px; padding-top: 10px; border-top: 1px dashed var(--border); }
.funnel-node-settings small { color: var(--faint); font-weight: 400; text-transform: none; letter-spacing: 0; }
.capture-field-picker { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; }
.capture-field-picker > span { color: var(--muted); font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.04em; }
.capture-field-picker label { display: flex; flex-direction: row; align-items: center; gap: 6px; font-size: 12.5px; text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--ink); }
.flow-arrow { height: 30px; display: grid; place-items: center; color: var(--faint); font-size: 17px; }

/* --------------------------------------------------------------------------
   Modais, toast, vazios
   -------------------------------------------------------------------------- */
dialog.modal {
  width: min(520px, calc(100% - 32px));
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 0;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}
dialog.modal.narrow { width: min(420px, calc(100% - 32px)); }
dialog::backdrop { background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(2px); }
.modal-body { display: grid; gap: 14px; padding: 22px 24px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal-head h3 { font-size: 17px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.modal-actions .btn.danger-text { margin-right: auto; }
.confirm-message { color: var(--muted); }

/* .toast vive na biblioteca de componentes (css/ui.css). */

.courses-grid .empty { grid-column: 1 / -1; }
.empty {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 48px 24px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  text-align: center;
  color: var(--muted);
}
.empty .icon { width: 30px; height: 30px; color: var(--faint); margin-bottom: 4px; }
.empty strong { color: var(--ink); font-size: 15px; }
.empty span { font-size: 13px; max-width: 380px; }
.empty .btn { margin-top: 10px; }

/* Skeleton simples enquanto carrega */
.loading-block { height: 120px; border-radius: var(--radius); background: linear-gradient(100deg, var(--surface) 40%, var(--surface-2) 50%, var(--surface) 60%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border: 1px solid var(--border); }
@keyframes shimmer { to { background-position: -200% 0; } }

/* --------------------------------------------------------------------------
   Navegação mobile: bottom-nav estilo app + sheet "Mais"
   -------------------------------------------------------------------------- */
/* No desktop os dois não existem: a sidebar navega e o botão do topo cria.
   `.hidden` é !important, então segue mandando quando a view não tem ação
   primária — inclusive dentro do @media que liga o FAB. */
.bottom-nav, .fab-quick { display: none; }

dialog.sheet {
  width: 100%;
  max-width: 100%;
  margin: auto 0 0;
  border: 0;
  border-top: 1px solid var(--border-strong);
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -24px 80px rgba(0, 0, 0, 0.55);
}
dialog.sheet[open] { animation: sheet-up 0.28s cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes sheet-up { from { transform: translateY(28px); opacity: 0.4; } }
.sheet-body { display: grid; gap: 2px; padding: 8px 14px calc(16px + env(safe-area-inset-bottom)); }
.sheet-grab { width: 42px; height: 4px; margin: 6px auto 10px; border-radius: 99px; background: var(--border-strong); }
.sheet-sep { height: 1px; margin: 8px 0; background: var(--border); }
.sheet .nav-item { padding: 12px; font-size: 14px; color: var(--muted); }
.sheet .nav-item:hover { background: var(--surface-2); color: var(--ink); }
.sheet .nav-item.active { background: var(--primary-soft); color: var(--primary-soft-ink); }
.sheet-user { display: flex; align-items: center; gap: 10px; padding: 8px 10px 2px; }
.sheet-user .user-name { flex: 1; }

/* --------------------------------------------------------------------------
   Responsivo
   -------------------------------------------------------------------------- */
@media (max-width: 1120px) {
  .bento-hero, .bento-metrics, .bento-alerts, .bento-create, .bento-affiliates { grid-column: span 12; }
  .bento-metrics { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 980px) {
  .offer-config-grid { grid-template-columns: 1fr; }
  .funnel-node-common { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 800px) {
  .app-shell, .app-shell.side-pinned { display: block; }
  .sidebar, .sidebar-hotzone { display: none !important; }
  .bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 80;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 2px;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--side-bg) 88%, transparent);
    -webkit-backdrop-filter: blur(18px) saturate(1.4);
    backdrop-filter: blur(18px) saturate(1.4);
    border-top: 1px solid var(--border);
  }
  .bottom-nav .nav-item {
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    width: auto;
    padding: 7px 2px 6px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    text-align: center;
  }
  .bottom-nav .nav-item .icon { width: 21px; height: 21px; }
  .bottom-nav .nav-item.active { background: transparent; color: var(--primary-bright); }
  .bottom-nav .nav-item.active .icon { color: var(--primary-bright); }
  /* Editores em tela cheia têm a própria barra: a bottom-nav sai da frente. */
  .app-shell:has(.fullscreen-editor) .bottom-nav { display: none; }
  .topbar { padding: 12px 16px; }
  .content { padding: 18px 16px calc(88px + env(safe-area-inset-bottom)); }
  .csv-form { grid-template-columns: 1fr; }
  .field-row, .split-fields, .funnel-node-common { grid-template-columns: 1fr; }
  .bento-metrics, .quick-create-grid { grid-template-columns: 1fr 1fr; }
  .funnel-metric-grid { grid-template-columns: repeat(2, 1fr); }
  .offer-top, .page-card-top, .funnel-card-top { flex-direction: column; }
  .offer-price-box { text-align: left; }
  .page-version-row { flex-direction: column; align-items: flex-start; }
  .editor-head { flex-direction: column; align-items: flex-start; }
  .lesson-row-admin { flex-wrap: wrap; }
  .lesson-detail { padding-left: 16px; }
  .add-lesson, .add-module { flex-wrap: wrap; }
  .module-release { align-items: flex-start; }
  .zip-version-form { grid-template-columns: 1fr; }
}
@media (max-width: 470px) {
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .quick-create-grid { grid-template-columns: 1fr; }
  .bento-hero-value { font-size: 30px; }
  .login-card { padding: 28px 22px; }
  .course-actions { flex-direction: column; }
}

/* A seção "CELULAR: O PAINEL INTEIRO OPERÁVEL" (Onda 5 / Fase 1) mora no FIM
   deste arquivo, de propósito — ver o comentário lá. */

/* ==========================================================================
   Editores visuais (página de venda e funil)
   Barra de ações no topo, paleta à esquerda, canvas no meio, propriedades
   à direita. Ocupam a tela inteira: sem topbar, sem respiro do conteúdo.
   ========================================================================== */

.app-shell:has(.fullscreen-editor) { height: 100vh; overflow: hidden; }
.main-col.fullscreen-editor { height: 100vh; overflow: hidden; }
.editor-fullscreen { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--bg); }

/* ⚠ DAQUI ATÉ `.fe-advanced` É CASCA MORTA — não escreva `.pe-*` nem `.fe-*`
   em código novo.

   Era a casca de três colunas dos dois editores. A Fase 2 (página) e a Fase 4
   (quiz) trocaram as duas pelo dock (`.ed-*`) e pelo canvas (`.fq-*`). Sobram
   VIVOS só três nomes desta região, reusados de propósito pelo editor do quiz:
   `.fe-issues`, `.fe-map-errors` e os ids `#pe-canvas-inner/#pe-frame/#pe-ctx/
   #pe-fmt/#pe-draft` (que já são estilizados pelas classes `.ed-*`).

   O resto foi conferido por varredura e não aparece em nenhum .js. Varrer isto
   daqui é limpeza de duas fases juntas, com risco de regressão visual e nenhum
   ganho para quem usa — fica para o QA da Fase 7, onde há lente de tela para
   provar que nada mudou. */

/* --- barra do topo --- */
.pe-bar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  height: 60px;
  padding: 0 14px 0 10px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.pe-bar-left, .pe-bar-right { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pe-title { min-width: 0; }
.pe-title strong { display: block; font-size: 14.5px; font-weight: 620; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pe-title span { display: block; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pe-title code { font-size: 11px; padding: 0 4px; }
.pe-dirty {
  padding: 4px 9px;
  border-radius: 99px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

/* segmentado (dispositivo, abas do funil) */
.pe-device, .pe-seg { display: inline-flex; padding: 3px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--border); gap: 2px; }
.pe-device button, .pe-seg button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 570;
  transition: background 0.14s, color 0.14s;
}
.pe-device button:hover, .pe-seg button:hover { color: var(--ink); }
.pe-device button.active, .pe-seg button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.pe-device .icon, .pe-seg .icon { width: 16px; height: 16px; }
.fe-warn-dot {
  min-width: 17px;
  padding: 0 5px;
  border-radius: 99px;
  background: var(--danger);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 17px;
  text-align: center;
}

/* --- corpo em três colunas --- */
.pe-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 274px minmax(0, 1fr) 330px; }
.pe-side { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--surface); }
.pe-left { border-right: 1px solid var(--border); }
.pe-right { border-left: 1px solid var(--border); }
.pe-side-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 12px; display: grid; gap: 9px; align-content: start; }
.pe-side-hint { margin: 2px 2px 0; color: var(--faint); font-size: 11.5px; line-height: 1.45; }
.pe-tabs { flex: none; display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--border); }
.pe-tab {
  padding: 12px 8px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 570;
}
.pe-tab:hover { color: var(--ink); }
.pe-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* --- paleta de componentes --- */
.pe-palette, .fe-add { display: grid; gap: 7px; }
.pe-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  text-align: left;
  transition: border-color 0.14s, box-shadow 0.14s, transform 0.14s;
}
.pe-chip:hover { border-color: var(--primary); box-shadow: var(--shadow-1); transform: translateY(-1px); }
.pe-chip:active { cursor: grabbing; }
.pe-chip-grip { display: grid; place-items: center; color: var(--faint); cursor: grab; }
.pe-chip-grip .icon { width: 15px; height: 15px; }
.pe-chip-ic {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 8px;
  background: var(--primary-soft);
  /* --kind chega em hex "de tema claro" dos editores: clarear para legibilidade no escuro */
  color: color-mix(in srgb, var(--kind, var(--primary)) 55%, white);
}
.pe-chip-ic .icon { width: 16px; height: 16px; }
.pe-chip-text { min-width: 0; }
.pe-chip-text strong { display: block; font-size: 13px; font-weight: 600; }
.pe-chip-text small { display: block; color: var(--muted); font-size: 11px; line-height: 1.35; }

/* --- estrutura (lista de blocos) --- */
.pe-outline { display: grid; gap: 5px; }
.pe-outline-item {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: "grip name" "grip sub";
  gap: 0 9px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  cursor: pointer;
}
.pe-outline-item:hover { border-color: var(--border-strong); background: var(--surface-2); }
.pe-outline-item.active { border-color: var(--primary); background: var(--primary-soft); }
.pe-outline-item .pe-chip-grip { grid-area: grip; }
.pe-outline-name { grid-area: name; font-size: 12.5px; font-weight: 600; }
.pe-outline-sub { grid-area: sub; color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pe-outline-item.dragging, .fe-step.dragging { opacity: 0.4; }
.pe-outline-item.drop-target, .fe-step.drop-target { border-color: var(--primary); box-shadow: 0 -2px 0 var(--primary); }

/* --- canvas --- */
.pe-canvas-wrap {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: flex;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.055) 1px, transparent 0) 0 0 / 18px 18px,
    var(--bg);
  overflow: hidden;
}
.pe-canvas {
  width: 100%;
  max-width: 1180px;
  height: 100%;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  transition: max-width 0.22s ease;
}
.pe-canvas.mobile { max-width: 402px; }
.pe-canvas iframe { display: block; width: 100%; height: 100%; border: 0; }

/* barra flutuante do bloco selecionado */
.pe-float {
  position: absolute;
  z-index: 6;
  display: flex;
  gap: 1px;
  padding: 3px;
  border-radius: 9px;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
}
.pe-float button {
  display: grid;
  place-items: center;
  width: 30px;
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}
.pe-float button:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
.pe-float button.danger:hover { background: var(--danger); color: #fff; }
.pe-float .icon { width: 15px; height: 15px; }

/* --- painel de propriedades --- */
.pe-insp-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-bottom: 4px; border-bottom: 1px solid var(--border); }
.pe-insp-kind { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 620; color: color-mix(in srgb, var(--kind, var(--ink)) 55%, white); }
.pe-insp-kind .icon { width: 16px; height: 16px; }
.pe-fields { display: grid; gap: 12px; padding-top: 4px; }
.pe-fields .input { font-size: 13px; }
.pe-hint { color: var(--faint); font-size: 11px; line-height: 1.4; }
.pe-insp-foot { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 12px; margin-top: 4px; border-top: 1px solid var(--border); }
.pe-list, .pe-pairs { display: grid; gap: 6px; }
.pe-list-row { display: grid; grid-template-columns: 1fr auto; gap: 5px; align-items: center; }
.pe-pair { display: grid; gap: 5px; padding: 8px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); }
.pe-pair-head { display: flex; align-items: center; justify-content: space-between; }
.pe-pair-head b { color: var(--muted); font-size: 11px; }
.icon-btn.sm { width: 26px; height: 26px; }
.icon-btn.sm .icon { width: 14px; height: 14px; }
.pe-swatches { display: flex; flex-wrap: wrap; gap: 7px; }
.pe-swatches button {
  width: 26px;
  height: 26px;
  border: 2px solid transparent;
  border-radius: 50%;
  background: var(--sw);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}
.pe-swatches button.active { border-color: var(--ink); }
.pe-note { padding: 10px 11px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--border); }
.pe-note strong { display: block; font-size: 12px; margin-bottom: 3px; }
.pe-note p { color: var(--muted); font-size: 11.5px; line-height: 1.45; }

/* --- editor do funil --- */
.fe-steps { display: grid; gap: 6px; }
.fe-step {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
}
.fe-step:hover { border-color: var(--border-strong); background: var(--surface-2); }
.fe-step.active { border-color: var(--primary); background: var(--primary-soft); }
.fe-step-ic {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 8px;
  background: color-mix(in srgb, var(--kind) 16%, transparent);
  color: color-mix(in srgb, var(--kind) 55%, white);
}
.fe-step-ic .icon { width: 15px; height: 15px; }
.fe-step-text { min-width: 0; flex: 1; }
.fe-step-text strong { display: block; font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fe-step-text small { display: block; color: var(--muted); font-size: 11px; }
.fe-step-warn { display: grid; place-items: center; color: var(--danger); }
.fe-step-warn .icon { width: 16px; height: 16px; }

.fe-canvas-wrap { flex-direction: column; align-items: center; gap: 12px; overflow-y: auto; }
.fe-preview-frame {
  width: 100%;
  max-width: 720px;
  flex: 1;
  min-height: 420px;
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}
.fe-preview-frame iframe { display: block; width: 100%; height: 100%; border: 0; }
.fe-preview-note { flex: none; color: var(--muted); font-size: 12px; }

.fe-map { width: 100%; overflow: auto; padding: 4px; }
.fe-map svg { display: block; margin: 0 auto; overflow: visible; }
.fe-node rect { fill: var(--surface); stroke: var(--border-strong); stroke-width: 1; cursor: pointer; }
.fe-node:hover rect { stroke: var(--primary); }
.fe-node.active rect:first-child { stroke: var(--primary); stroke-width: 2; }
.fe-node.broken rect:first-child { stroke: var(--danger); }
.fe-node .fe-node-bar { stroke: none; }
.fe-node text { pointer-events: none; }
.fe-node-kind { fill: var(--faint); font: 700 9.5px var(--font); letter-spacing: 0.08em; }
.fe-node-title { fill: var(--ink); font: 600 13px var(--font); }
.fe-node-metric { fill: var(--muted); font: 500 10.5px var(--font); }
.fe-node-warn { fill: var(--danger); }
.fe-node-warn-ic { fill: #fff; font: 700 12px var(--font); }
.fe-edge path { fill: none; stroke: var(--border-strong); stroke-width: 1.6; }
.fe-edge text { fill: var(--muted); font: 500 10.5px var(--font); }
#fe-arrow path { fill: var(--border-strong); }
.fe-map-errors {
  width: min(100%, 720px);
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
  border-radius: 10px;
  background: var(--danger-soft);
}
.fe-map-errors strong { display: flex; align-items: center; gap: 7px; color: var(--danger); font-size: 13px; }
.fe-map-errors ul { margin: 8px 0 0; padding-left: 18px; display: grid; gap: 4px; }
.fe-map-errors li { font-size: 12.5px; color: var(--ink); }
.fe-map-errors p { margin-top: 8px; color: var(--muted); font-size: 11.5px; }

.fe-issues { display: grid; gap: 5px; padding: 9px 10px; border-radius: 9px; background: var(--danger-soft); }
.fe-issues span { display: flex; align-items: flex-start; gap: 7px; color: var(--danger); font-size: 11.5px; line-height: 1.4; }
.fe-issues .icon { width: 14px; height: 14px; margin-top: 1px; }
.fe-check-row { display: flex; flex-wrap: wrap; gap: 6px; }
.fe-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 99px;
  font-size: 12.5px;
  cursor: pointer;
}
.fe-check.on { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-soft-ink); font-weight: 570; }
.fe-check input { margin: 0; accent-color: var(--primary); }
.fe-options { display: grid; gap: 8px; }
.fe-option { display: grid; gap: 6px; padding: 9px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.fe-option-head { display: flex; align-items: center; justify-content: space-between; }
.fe-option-head b { color: var(--muted); font-size: 11px; }
.fe-option-next { display: flex; align-items: center; gap: 7px; }
.fe-option-next .icon { width: 15px; height: 15px; color: var(--faint); flex: none; }
.fe-option-next .input { flex: 1; min-width: 0; }
.fe-start { padding-top: 4px; }
.fe-advanced summary { color: var(--muted); font-size: 12px; cursor: pointer; }
.fe-advanced .field { margin-top: 8px; }

/* escolha do ZIP: converter em blocos ou manter em caixa de vidro (Onda 4/F3) */
.radio-row {
  display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 10px; align-items: start;
  padding: 11px 13px; border: 1px solid var(--border); border-radius: 12px; cursor: pointer;
  background: var(--surface-2); transition: border-color .15s, background .15s;
}
.radio-row + .radio-row { margin-top: 8px; }
.radio-row:hover { border-color: var(--brand); }
.radio-row:has(input:checked) { border-color: var(--brand); background: color-mix(in oklab, var(--brand) 10%, transparent); }
.radio-row input { margin-top: 3px; accent-color: var(--brand); }
.radio-row b { display: block; font-size: 13.5px; font-weight: 600; }
.radio-row small { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.zip-import-summary { display: grid; gap: 6px; margin-top: 10px; }
.zip-import-summary li { list-style: none; color: var(--muted); font-size: 12.5px; }
.zip-import-summary li b { color: var(--ink); }

/* chamada para abrir o editor, nos cards de página e funil */
.page-editor-cta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 14px; border-top: 1px solid var(--border); }
.page-editor-cta span { color: var(--muted); font-size: 12.5px; }

@media (max-width: 1180px) {
  .pe-body { grid-template-columns: 232px minmax(0, 1fr) 288px; }
}
/* A casca de altura LIVRE é para a gaveta do celular, e a gaveta nasce em
   `max-width: 860px` (a `MOBILE_QUERY` de `public/js/core/editor-dock.js`).
   Enquanto esta regra vivia em 940px, a faixa de 861 a 940 ficava com casca
   solta e dock de computador ao mesmo tempo: o `iframe` do canvas perdia a
   altura de referência e crescia até a altura da página carregada. Medido a
   900×900: documento com 1399px, e o rodapé com "Salvar versão" e "Publicar"
   414px ABAIXO da dobra. As duas larguras têm que ser a MESMA — mexeu numa,
   mexa na outra. */
@media (max-width: 860px) {
  .app-shell:has(.fullscreen-editor), .main-col.fullscreen-editor { height: auto; overflow: visible; }
  .editor-fullscreen { min-height: 100vh; }
}
@media (max-width: 940px) {
  .pe-body { grid-template-columns: 1fr; }
  .pe-side { border: 0; border-bottom: 1px solid var(--border); }
  .pe-side-scroll { max-height: 260px; }
  .pe-canvas-wrap { min-height: 460px; padding: 12px; }
  .pe-bar { height: auto; flex-wrap: wrap; padding: 10px; }
  .pe-float { display: none; }
}

/* Link copiável (acesso do aluno) e ações por linha da tabela */
.copy-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 4px; }
.copy-row .input { font-family: ui-monospace, monospace; font-size: 12px; }
.row-actions { text-align: right; white-space: nowrap; }
@media (max-width: 640px) {
  .copy-row { grid-template-columns: 1fr; }
  .copy-row .btn { min-height: 44px; justify-content: center; }
}

/* --------------------------------------------------------------------------
   Movimento reduzido: sidebar e sheet sem animação (as partículas param no JS)
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .sidebar, .sidebar-inner, .pin-btn .icon { transition: none !important; }
  dialog.sheet[open] { animation: none; }
}

/* ==========================================================================
   Onda 2 / Fase 1 — Cursos: lista (grade/lista), página do curso e ofertas
   ========================================================================== */
/* Toolbar da lista + alternador grade/lista */
.courses-toolbar { margin-bottom: 14px; min-height: 32px; }
.courses-count { font-size: 13px; }
.view-switch { display: flex; gap: 2px; padding: 3px; background: var(--surface); border: 1px solid var(--border); border-radius: 9px; }
.view-mode { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 26px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; }
.view-mode .icon { width: 15px; height: 15px; }
.view-mode:hover { color: var(--ink); }
.view-mode.active { background: var(--ink); color: var(--bg); }

/* Card de curso: capa por upload + mini-relatório + rodapé com toggle */
.course-card.is-link, .course-row.is-link { cursor: pointer; }
.course-card.is-link:focus-visible, .course-row.is-link:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.course-cover .cover-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.course-cover .badge { z-index: 1; }
.course-cover .cover-initials { position: relative; }
.course-report { display: flex; gap: 18px; margin-top: auto; padding-top: 10px; border-top: 1px dashed var(--border); }
.report-item { display: grid; gap: 1px; }
.report-item small { color: var(--faint); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
.report-item b { font-size: 13.5px; color: var(--ink); font-weight: 650; white-space: nowrap; }
.course-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--border); }
.course-foot .switch-label, .course-row .switch-label { font-size: 12.5px; color: var(--muted); }
.course-open { display: inline-flex; align-items: center; gap: 6px; color: var(--primary); font-size: 12.5px; font-weight: 570; }
.course-open .icon { width: 14px; height: 14px; }

/* Modo lista compacta */
.courses-grid.list-mode { grid-template-columns: 1fr; gap: 8px; }
.course-row { display: flex; align-items: center; gap: 14px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-1); transition: box-shadow 0.15s; }
.course-row:hover { box-shadow: var(--shadow-2); }
.course-row-cover { position: relative; overflow: hidden; flex: none; width: 72px; height: 42px; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: #fff; }
.course-row-cover .cover-img.sm { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.course-row-cover .cover-initials.sm { font-size: 15px; font-weight: 750; opacity: 0.9; }
.course-row-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.course-row-main strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.course-row-main span { color: var(--muted); font-size: 12.5px; }
.course-row-revenue { display: grid; gap: 1px; text-align: right; }
.course-row-revenue small { color: var(--faint); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
.course-row-revenue b { font-size: 13.5px; white-space: nowrap; }
@media (max-width: 640px) {
  .course-row-revenue, .course-row .badge { display: none; }
}

/* Página do curso (hero + abas) */
.course-page { display: grid; gap: 16px; }
.course-hero { display: flex; align-items: flex-start; gap: 20px; padding: 20px; flex-wrap: wrap; }
.course-hero-cover { position: relative; overflow: hidden; flex: none; width: 216px; aspect-ratio: 16 / 9; border-radius: 12px; display: flex; align-items: center; justify-content: center; color: #fff; }
.course-hero-cover .cover-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.course-hero-cover .cover-initials { font-size: 30px; font-weight: 750; opacity: 0.9; }
.course-hero-main { flex: 1; min-width: 240px; display: grid; gap: 6px; align-content: start; }
.course-hero-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12.5px; }
.course-hero-title { font-size: 21px; letter-spacing: -0.01em; }
.course-hero-desc { color: var(--muted); font-size: 13.5px; max-width: 640px; }
.course-hero-side { display: grid; gap: 10px; justify-items: end; align-content: start; }
.course-tabs .tab-count { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--primary-soft); color: var(--primary-soft-ink); font-size: 11px; font-weight: 700; }
.course-tab-body { display: grid; gap: 14px; }

/* Aba Dados */
.course-data-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; align-items: start; }
.data-field { display: grid; gap: 8px; align-content: start; padding: 16px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-1); }
.data-field .muted { font-size: 12.5px; }
.data-label { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 650; color: var(--ink); }
.data-label .icon { width: 15px; height: 15px; color: var(--muted); }
.data-inline { font-size: 15px; font-weight: 600; }
.data-field.danger-zone { border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.data-field.danger-zone .data-label .icon { color: var(--danger); }
.data-field .btn { justify-self: start; }

/* Aba Ofertas: preço/condições editáveis na própria linha */
.offer-controls { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding-top: 4px; }
.offer-installments { display: inline-flex; align-items: center; gap: 8px; }
.offer-installments > small { color: var(--faint); font-size: 12px; }
.offer-controls-actions { display: inline-flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }

/* Wizard em modal (Novo curso / Nova oferta) */
.wizard-modal .modal-body { width: min(560px, 94vw); }
.wizard-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.wizard-row .field-label { font-size: 12.5px; font-weight: 550; color: var(--muted); min-width: 120px; }
.wizard-summary { list-style: none; display: grid; gap: 8px; margin: 0 0 14px; padding: 14px 16px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; }
.wizard-summary li { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.wizard-summary small { color: var(--faint); font-size: 12px; }
.optional { color: var(--faint); font-style: normal; font-weight: 400; }

/* Cupons (placeholder até a Fase 5) */
.coupons-soon { min-height: 260px; }

@media (max-width: 720px) {
  .course-hero { padding: 16px; }
  .course-hero-cover { width: 100%; }
  .course-hero-side { justify-items: start; }
  .offer-config-grid { grid-template-columns: 1fr; }
  .offer-controls-actions { margin-left: 0; }
}

/* --------------------------------------------------------------------------
   Editor de conteúdo (Onda 2 / Fase 2): estrutura + preview do aluno
   -------------------------------------------------------------------------- */
/* minmax(0,1fr): sem isso a coluna estoura no mobile quando há conteúdo largo. */
.content-editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 30rem); gap: 16px; align-items: start; }
.content-structure { display: grid; gap: 14px; min-width: 0; }
.content-preview {
  position: sticky;
  top: 16px;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  overflow: hidden;
}
.preview-head { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--border); }
.preview-head-info { flex: 1; min-width: 0; display: grid; gap: 1px; }
.preview-head-info .eyebrow { font-size: 10.5px; }
.preview-head-info strong { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preview-shell { min-height: 420px; height: calc(100vh - 216px); background: #0c0d11; display: grid; }
.preview-shell iframe { width: 100%; height: 100%; border: 0; display: block; }
.preview-shell .empty { align-self: center; }
.preview-shell .ui-skeleton.block { margin: 14px; height: calc(100% - 28px) !important; }

/* Alça de arrasto e estados do drag-and-drop */
.drag-handle {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--faint);
  border-radius: 7px;
  cursor: grab;
  flex: none;
  touch-action: none;
}
.drag-handle:hover { background: var(--surface-2); color: var(--ink); }
.drag-handle .icon { width: 15px; height: 15px; }
.module-card.dragging, .lesson-row-admin.dragging { opacity: 0.45; }
.module-card.drop-target { outline: 2px dashed var(--primary); outline-offset: 2px; }
.lesson-row-admin.drop-target { box-shadow: inset 0 2px 0 var(--primary); }

/* Linha da aula: clique seleciona (preview + edição inline abaixo) */
.lesson-row-admin { cursor: pointer; }
.lesson-row-admin:hover { background: var(--surface-2); }
.lesson-row-admin.selected { background: var(--primary-soft); }
.lesson-row-admin .chev .icon { transition: transform 0.15s; }
.lesson-row-admin.selected .chev .icon { transform: rotate(180deg); }
.lesson-title { min-width: 60px; }

/* Regra de liberação em linguagem simples */
.module-release .ui-select-trigger { padding: 6px 10px; font-size: 12.5px; min-width: 170px; }
.module-release input.release-value { width: 150px; }
.release-summary { color: var(--muted); font-size: 12.5px; flex: 1; min-width: 160px; }

/* Painel de edição inline da aula selecionada */
.lesson-editor {
  display: grid;
  gap: 14px;
  padding: 14px 16px 16px 54px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  border-left: 2px solid var(--primary);
}
.le-label { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.le-label .icon { width: 14px; height: 14px; }
.le-label .badge { text-transform: none; letter-spacing: normal; }
.le-field { display: grid; gap: 6px; }
.le-inline { font-size: 13.5px; }
.le-cta-row { display: flex; gap: 16px; flex-wrap: wrap; }
.le-cta-row .le-inline { min-width: 180px; }
.le-uploads { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; align-items: start; }
.le-upload-block { display: grid; gap: 8px; align-content: start; }
.le-upload-block .ui-upload-drop { padding: 14px; }

@media (max-width: 1100px) {
  .content-editor { grid-template-columns: minmax(0, 1fr); }
  .content-preview { position: static; }
  .preview-shell { height: 480px; min-height: 320px; }
  .lesson-editor { padding-left: 16px; }
}

/* ==========================================================================
   Onda 2 / Fase 3 — Alunos: CRM (lista, ficha e esteira)
   ========================================================================== */
.students-tabs { margin-bottom: 18px; }

/* Lista: avatar na célula, último acesso e paginação */
.student-cell { display: flex; align-items: center; gap: 11px; min-width: 0; }
.student-cell-id { display: grid; min-width: 0; }
.avatar-img { object-fit: cover; }
.avatar.lg, .avatar-img.lg { width: 56px; height: 56px; font-size: 20px; }
#students-table tr.is-link { cursor: pointer; }
.last-seen { font-size: 13px; color: var(--muted); }
.last-seen.late { color: var(--danger); font-weight: 600; }
.last-seen.never { color: var(--faint); font-style: italic; }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 14px; }
.pager .muted { font-size: 12.5px; }

/* Esteira: lista arrastável + distribuição */
.ladder-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.ladder-list { display: grid; gap: 8px; margin-top: 14px; }
.ladder-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}
.ladder-row.dragging { opacity: 0.45; }
.ladder-row.drop-target { outline: 2px dashed var(--primary); outline-offset: 2px; }
.ladder-step {
  display: grid; place-items: center;
  width: 24px; height: 24px; flex: none;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-soft-ink);
  font-size: 12px; font-weight: 700;
}
.ladder-info { display: grid; min-width: 0; flex: 1; }
.ladder-info strong { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ladder-count { flex: none; color: var(--muted); font-size: 12.5px; font-weight: 600; }

/* Ficha do aluno */
.student-page { display: grid; gap: 18px; }
.student-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  padding: 22px 24px;
  flex-wrap: wrap;
}
.student-hero-id { display: flex; align-items: center; gap: 16px; min-width: 0; }
.student-hero-main { display: grid; gap: 4px; min-width: 0; }
.student-hero-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.student-hero-name { font-size: 21px; letter-spacing: -0.015em; }
.student-hero-side { display: grid; gap: 10px; justify-items: end; }
.student-contact { display: grid; gap: 2px; justify-items: end; }
.student-contact small { color: var(--faint); font-size: 11px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; }
.student-hero-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.student-metrics .metric-card strong { font-size: 22px; }
.metric-last-seen .last-seen { font-size: inherit; color: inherit; }
.metric-last-seen .last-seen.late { color: var(--danger); }
.metric-last-seen .last-seen.never { color: var(--faint); }
.student-section { display: grid; gap: 14px; }
.student-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.enrollment-list { display: grid; gap: 10px; }
.enrollment-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  flex-wrap: wrap;
}
.enrollment-main { display: grid; gap: 5px; flex: 1; min-width: 220px; }
.progress-track { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress-track i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), var(--accent-violet)); }
.enrollment-expiry { display: grid; gap: 2px; }
.enrollment-expiry small { color: var(--faint); font-size: 11px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; }
.enrollment-actions { flex: none; }

@media (max-width: 900px) {
  .ladder-grid { grid-template-columns: minmax(0, 1fr); }
  .student-hero-side { justify-items: start; }
  .student-contact { justify-items: start; }
}

/* --------------------------------------------------------------------------
   Configuração (Onda 3 / Fase 1)
   Toda grade daqui usa minmax(0,1fr): o track implícito herda min-width:auto e
   já causou rolagem lateral neste projeto (corrigido em d069aef).
   -------------------------------------------------------------------------- */
/* Barra de rolagem FINA, não escondida: no 390px a faixa tem mais abas do que
   cabe, e sem nenhum indício ninguém descobre que dá para rolar. */
.settings-tabs { max-width: 100%; overflow-x: auto; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.settings-tabs .tab { white-space: nowrap; }
.settings-pane { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-content: start; }
.settings-card { display: grid; gap: 14px; align-content: start; min-width: 0; }
.settings-rows { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; }
.settings-row {
  display: grid;
  grid-template-columns: minmax(0, 260px) minmax(0, 1fr);
  gap: 10px 20px;
  align-items: center;
  padding: 13px 0;
  border-top: 1px solid var(--border);
}
.settings-rows > .settings-row:first-child { border-top: 0; }
.settings-row-head { display: grid; gap: 3px; min-width: 0; }
.settings-row-head strong { font-size: 13.5px; font-weight: 600; }
.settings-row-head span { color: var(--faint); font-size: 12.5px; line-height: 1.45; }
.settings-row-value { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.settings-row-value code { font-size: 12.5px; word-break: break-all; }

.settings-note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--primary-soft);
  color: var(--primary-soft-ink);
  font-size: 12.8px;
  line-height: 1.5;
}
.settings-note .icon { width: 17px; height: 17px; flex: none; margin-top: 1px; }
.settings-note.subtle { background: var(--surface-2); color: var(--muted); }

.settings-tool-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 14px; }
.settings-tool-head { display: flex; align-items: flex-start; gap: 12px; }
.settings-tool-head > div { flex: 1; min-width: 0; }
.settings-tool-head strong { display: block; font-size: 15px; }
.settings-tool-head .badge { flex: none; }
.settings-tool-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 10px;
  background: var(--surface-3);
  color: var(--primary-bright);
}
.settings-tool-mark .icon { width: 18px; height: 18px; }
.settings-tool .settings-row { grid-template-columns: minmax(0, 1fr); border-top: 1px solid var(--border); }
.settings-surfaces { display: grid; gap: 8px; }
.settings-surfaces-label { color: var(--faint); font-size: 11px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; }
.settings-surfaces > div { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }

.settings-secret { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.settings-secret-state { display: inline-flex; align-items: center; gap: 7px; color: var(--success); font-size: 12.8px; font-weight: 550; }
.settings-secret-state.off { color: var(--warn); }
.settings-secret-state .icon { width: 15px; height: 15px; }
.settings-secret-state code { color: var(--ink); letter-spacing: 0.08em; }
.settings-copy { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.settings-test { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.settings-test .cell-sub.ok { color: var(--success); }
.settings-test .cell-sub.bad { color: var(--danger); }

.brand-preview { --brand-accent: var(--primary); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.brand-preview-bar { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--surface-2); }
.brand-preview-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 10px;
  background: var(--brand-accent);
  color: #fff;
  overflow: hidden;
}
.brand-preview-mark img { width: 100%; height: 100%; object-fit: cover; }
.brand-preview-mark .icon { width: 18px; height: 18px; }
.brand-preview-name { display: grid; gap: 1px; flex: 1; min-width: 0; }
.brand-preview-name strong { font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-preview-name span { color: var(--faint); font-size: 11.5px; }
.brand-preview-cta { flex: none; padding: 7px 13px; border-radius: 999px; background: var(--brand-accent); color: #fff; font-size: 12.5px; font-weight: 600; }

/* --------------------------------------------------------------------------
   Caixa de saída de e-mail (Onda 3 / Fase 2)
   Lista de <details>: o corpo inteiro fica a um clique, e o <pre> rola DENTRO
   do próprio bloco — texto longo de e-mail não pode empurrar a página.
   -------------------------------------------------------------------------- */
.outbox-metrics { display: flex; flex-wrap: wrap; gap: 8px 16px; color: var(--muted); font-size: 12.5px; }
.outbox-metric b { color: var(--ink); font-size: 13.5px; }
.outbox-metric.warn b { color: var(--warn); }
.outbox-metric.bad b { color: var(--danger); }
.outbox-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.outbox-item { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); overflow: hidden; }
.outbox-item > summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 11px 13px;
  cursor: pointer;
  list-style: none;
}
.outbox-item > summary::-webkit-details-marker { display: none; }
.outbox-item > summary:hover { background: var(--surface-3); }
.outbox-item .badge { flex: none; }
.outbox-item-id { display: grid; gap: 2px; min-width: 0; }
.outbox-item-id .cell-main { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.outbox-item-id .cell-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.outbox-item-when { white-space: nowrap; }
.outbox-error { display: flex; gap: 8px; align-items: flex-start; padding: 0 13px 10px; color: var(--danger); font-size: 12.5px; }
.outbox-error .icon { width: 15px; height: 15px; flex: none; margin-top: 1px; }
.outbox-body {
  margin: 0;
  padding: 12px 13px 14px;
  border-top: 1px solid var(--border);
  max-height: 320px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.3px;
  line-height: 1.6;
}

@media (max-width: 760px) {
  .settings-row { grid-template-columns: minmax(0, 1fr); align-items: start; }
  .brand-preview-cta { display: none; }
  .outbox-item > summary { grid-template-columns: auto minmax(0, 1fr); }
  .outbox-item-when { grid-column: 2; }
}

/* --------------------------------------------------------------------------
   Afiliados (Onda 3 / Fase 3)
   Toda grade daqui usa minmax(0,1fr): o track implícito (1fr) já causou
   rolagem horizontal em 390px neste projeto — ver d069aef.
   -------------------------------------------------------------------------- */
#affiliates-view { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.affiliate-metrics { margin: 0; }
.affiliate-note { margin: 0; }
.affiliate-code {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--primary-soft-ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.affiliate-page { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.affiliate-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  padding: 22px 24px;
}
.affiliate-hero-main { display: grid; gap: 5px; min-width: 0; }
.affiliate-hero-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.affiliate-hero-name { font-size: 21px; letter-spacing: -0.015em; margin: 0; overflow-wrap: anywhere; }
.affiliate-hero-side { display: grid; gap: 12px; align-content: start; }
.affiliate-field { display: grid; gap: 3px; min-width: 0; }
.affiliate-field small { color: var(--faint); font-size: 11px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; }
.affiliate-field [data-slot] { overflow-wrap: anywhere; }

.affiliate-section { display: grid; gap: 14px; }
.affiliate-section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.affiliate-section-head .card-sub { max-width: 62ch; }

.affiliate-product-list { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
.affiliate-product {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 14px;
  padding: 13px 15px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}
.affiliate-product-main { display: grid; gap: 4px; min-width: 0; }
.affiliate-product-commission { display: grid; gap: 2px; justify-items: end; text-align: right; }
.affiliate-product-commission small { color: var(--faint); font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; }
.affiliate-product-commission .ui-inline { font-size: 17px; font-weight: 700; }
.affiliate-product-actions { display: flex; gap: 8px; }
.affiliate-links {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr);
  border-top: 1px solid var(--border);
  padding-top: 10px;
}
.affiliate-link {
  display: grid;
  grid-template-columns: minmax(0, 160px) minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.affiliate-link-label { color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }
.affiliate-link code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: var(--primary-soft-ink);
  overflow-wrap: anywhere;
  word-break: break-all;
  min-width: 0;
}

/* Cartão de Afiliados do dashboard (item 14) */
.dash-affiliates { display: grid; gap: 12px; width: 100%; min-width: 0; margin-top: 4px; }
.dash-affiliate-figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 120px), 1fr)); gap: 10px; }
.dash-affiliate-figures span { display: grid; gap: 2px; color: var(--muted); font-size: 12px; min-width: 0; }
.dash-affiliate-figures b { color: var(--ink); font-size: 17px; overflow-wrap: anywhere; }
.dash-affiliate-rank { display: grid; gap: 10px; }
.dash-affiliate-row { display: grid; gap: 5px; min-width: 0; }
.dash-affiliate-head { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; flex-wrap: wrap; }
.dash-affiliate-head span { color: var(--muted); }
.dash-affiliate-empty {
  display: grid;
  gap: 4px;
  text-align: left;
  width: 100%;
  padding: 12px 14px;
  border: 1px dashed var(--border-strong);
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
}
.dash-affiliate-empty strong { color: var(--ink); font-size: 14px; }
.dash-affiliate-empty:hover { border-color: var(--primary); background: var(--primary-soft); }

@media (min-width: 900px) {
  .affiliate-hero { grid-template-columns: minmax(0, 1fr) minmax(0, 300px); align-items: start; }
  .affiliate-hero-side { justify-items: start; }
}
@media (max-width: 760px) {
  .affiliate-product { grid-template-columns: minmax(0, 1fr) auto; }
  .affiliate-product-commission { justify-items: start; text-align: left; grid-column: 1; }
  .affiliate-product-actions { grid-column: 1 / -1; }
  .affiliate-link { grid-template-columns: minmax(0, 1fr); }
}

/* --------------------------------------------------------------------------
   Relatórios (Onda 3 / Fase 4)

   Duas coisas rolam DENTRO do próprio contêiner e nunca na página: a fita de
   seis abas (não cabe em 390px) e a tabela larga (o relatório de alunos tem
   nove colunas). Por isso toda grade daqui é minmax(0,1fr) — o track implícito
   herda min-width:auto dos filhos e joga a PÁGINA para a rolagem lateral, que
   é exatamente o bug que mordeu Alunos na Onda 2.
   -------------------------------------------------------------------------- */
#reports-view { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.reports-pane { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); align-content: start; }
.reports-tabs {
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}
.reports-tabs .tab { flex: 0 0 auto; }
.reports-toolbar { align-items: flex-start; gap: 10px; }
.reports-period { min-width: 0; }
.reports-toolbar-side { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
/* Link de download desativado: continua clicável de propósito (o clique
   explica por que não há o que baixar) — nada de pointer-events:none. */
#reports-csv.disabled { opacity: 0.5; }
.reports-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}
.reports-period-badge { justify-self: start; }
.reports-metrics { grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); }
.reports-table th.num, .reports-table td.num { text-align: right; white-space: nowrap; }
.reports-table td { white-space: nowrap; }
.reports-table td:first-child, .reports-table th:first-child { white-space: normal; min-width: 150px; }

@media (min-width: 900px) {
  .reports-head { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
  .reports-period-badge { justify-self: end; }
}

/* ==========================================================================
   Onda 4 / Fase 2 — Dock dos editores em tela cheia (`js/core/editor-dock.js`)

   Editor em tela cheia é tela cheia MESMO: dentro de um editor, o menu do
   painel sai de cena (o dock traz o "Voltar"), e a coluna que a sidebar
   fixada ocupava no grid vai junto — senão sobraria uma faixa vazia de 248px.

   Estas classes são compartilhadas: a Fase 4 (quiz) e a Fase 6 (checkout)
   montam a mesma casca. As classes `pe-*` acima continuam vivas porque o
   editor de funil ainda as usa; elas saem quando ele migrar.
   ========================================================================== */
.app-shell:has(.fullscreen-editor) .sidebar,
.app-shell:has(.fullscreen-editor) .sidebar-hotzone { display: none !important; }
.app-shell.side-pinned:has(.fullscreen-editor) { grid-template-columns: minmax(0, 1fr); }
/* As views normais moram dentro de `main.content`; os editores são IRMÃOS
   dela. Com todas as views escondidas, o `main` continuava reservando os
   86px do próprio respiro — uma faixa morta no topo do editor (MEDIDA no
   Chrome, não deduzida). Em tela cheia ele sai da conta. */
.main-col.fullscreen-editor > .content { display: none; }

.ed-shell {
  position: relative;
  flex: 1;
  min-height: 0;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}
.ed-shell.pinned { grid-template-columns: 312px minmax(0, 1fr); }

/* --- o dock --- */
.ed-dock {
  z-index: 40;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  color: var(--ink);
}
/* SOLTO: painel de vidro flutuando sobre o canvas (a linguagem da sidebar). */
.ed-shell:not(.pinned):not(.mobile) .ed-dock {
  position: absolute;
  left: 16px;
  top: 50%;
  translate: 0 -50%;
  width: 312px;
  height: min(88%, 820px);
  border-radius: 26px;
  background: color-mix(in srgb, oklch(0.13 0.012 272) 76%, transparent);
  -webkit-backdrop-filter: blur(24px) saturate(1.5);
  backdrop-filter: blur(24px) saturate(1.5);
  border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transition: width 0.28s cubic-bezier(0.22, 1, 0.36, 1), height 0.28s cubic-bezier(0.22, 1, 0.36, 1), border-radius 0.28s ease;
}
/* FIXADO: entra no grid, o canvas encolhe e nada fica escondido. */
.ed-shell.pinned .ed-dock {
  position: relative;
  height: 100%;
  background: var(--side-bg);
  border-right: 1px solid var(--border);
}
/* SOLTO + RECOLHIDO: trilho estreito só com os ícones das abas.
   O seletor repete `:not(.pinned):not(.mobile)` por ESPECIFICIDADE, não por
   enfeite: a regra do dock solto acima vale (0,4,0) e esta valia (0,3,0), então
   o `width: 62px` perdia sempre. Medido pelo QA da Onda 4: recolhido, o dock
   continuava 312×792 e o canvas não ganhava um pixel — sobrava um painel de
   vidro VAZIO por cima do canvas, porque os painéis já estavam em
   `display:none`. `collapsed` só existe junto de solto (ver `apply()` em
   editor-dock.js), então estas quatro declarações eram código morto em 100%
   dos casos. */
.ed-shell.collapsed:not(.pinned):not(.mobile) .ed-dock { width: 62px; height: min(70%, 520px); border-radius: 20px; }
.ed-shell.collapsed .ed-titles,
.ed-shell.collapsed .ed-status,
.ed-shell.collapsed .ed-panels,
.ed-shell.collapsed .ed-foot,
.ed-shell.collapsed .ed-badge,
.ed-shell.collapsed .ed-tab span { display: none; }
.ed-shell.collapsed .ed-tabs { grid-template-columns: minmax(0, 1fr); gap: 4px; }
.ed-shell.collapsed .ed-dock-top { flex-wrap: wrap; justify-content: center; }

.ed-dock-top { flex: none; display: flex; align-items: center; gap: 8px; padding: 12px 12px 8px; }
.ed-titles { min-width: 0; flex: 1; }
.ed-title { display: block; font-size: 13.5px; font-weight: 640; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ed-subtitle { display: block; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ed-collapse .icon { transform: rotate(90deg); }
.ed-shell.collapsed .ed-collapse .icon { transform: rotate(-90deg); }

.ed-status { flex: none; display: grid; gap: 7px; padding: 0 12px 10px; }
.ed-status-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ed-note { color: var(--faint); font-size: 11px; }
.ed-dirty {
  padding: 2px 8px; border-radius: 99px;
  background: var(--warn-soft); color: var(--warn);
  font-size: 11px; font-weight: 600;
}
.ed-seg { display: inline-flex; padding: 3px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--border); gap: 2px; }
.ed-seg button {
  display: grid; place-items: center; width: 30px; height: 26px;
  border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer;
}
.ed-seg button:hover:not(:disabled) { color: var(--ink); }
.ed-seg button:disabled { opacity: 0.35; cursor: default; }
.ed-seg button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.ed-seg .icon { width: 15px; height: 15px; }

.ed-tabs { flex: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2px; padding: 0 10px 8px; }
.ed-tab {
  display: grid; justify-items: center; gap: 3px;
  padding: 8px 4px; border: 0; border-radius: 10px;
  background: transparent; color: var(--muted);
  font-size: 10.5px; font-weight: 600; cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.ed-tab span { overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.ed-tab .icon { width: 16px; height: 16px; }
.ed-tab:hover { background: rgba(255, 255, 255, 0.06); color: var(--ink); }
.ed-tab.active { background: var(--primary-soft); color: var(--primary-soft-ink); }

.ed-panels { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 12px 12px; }
.ed-panel { display: grid; gap: 10px; align-content: start; }
.ed-foot { flex: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 12px; border-top: 1px solid rgba(255, 255, 255, 0.08); }
.ed-foot .btn { flex: 1 1 auto; justify-content: center; }
.ed-grip { display: none; }

/* --- o canvas --- */
.ed-canvas {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: flex;
  justify-content: center;
  padding: 18px;
  background:
    radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.055) 1px, transparent 0) 0 0 / 18px 18px,
    var(--bg);
  overflow: hidden;
}
/* Solto, o dock cobre a esquerda: o canvas respira para não ficar por baixo. */
.ed-shell:not(.pinned):not(.mobile) .ed-canvas { padding-left: 348px; }
.ed-shell.collapsed:not(.pinned):not(.mobile) .ed-canvas { padding-left: 96px; }
.ed-canvas-inner {
  width: 100%;
  max-width: 1180px;
  height: 100%;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  transition: max-width 0.22s ease;
}
.ed-canvas-inner.mobile { max-width: 402px; }
.ed-canvas-inner iframe { display: block; width: 100%; height: 100%; border: 0; }

/* barra de contexto (colada ao elemento) e barra de formatação do texto */
.ed-ctx, .ed-fmt {
  position: absolute;
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 10px;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}
.ed-ctx button {
  display: grid; place-items: center; width: 30px; height: 28px;
  border: 0; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer;
}
/* O atalho para as propriedades só existe onde a gaveta está fechada por
   padrão; no computador o painel já está aberto do lado. */
.ed-shell:not(.mobile) .ed-ctx-props { display: none; }
.ed-ctx button:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
.ed-ctx button.danger:hover { background: var(--danger); color: #fff; }
.ed-ctx .icon { width: 15px; height: 15px; }
.ed-ctx-up .icon { transform: rotate(180deg); }
.ed-fmt button {
  min-width: 28px; height: 26px; padding: 0 7px;
  border: 0; border-radius: 7px; background: transparent; color: var(--muted);
  font-size: 12px; font-weight: 650; cursor: pointer;
}
.ed-fmt button:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
.ed-fmt-b { font-weight: 800; }
.ed-fmt-i { font-style: italic; }
.ed-fmt-sep { width: 1px; height: 18px; background: var(--border-strong); margin: 0 2px; }
.ed-fmt-hl.hl { box-shadow: inset 0 -6px 0 var(--primary-soft-strong); }
.ed-fmt-hl.hl-1 { color: var(--primary-bright); }
.ed-fmt-hl.hl-2 { background: var(--primary); color: #fff; }
.ed-fmt-hl.hl-3 { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 2px; }
.ed-fmt-clear { font-size: 11px; font-weight: 550; color: var(--faint); }

/* faixa do rascunho local */
.ed-draft {
  position: absolute;
  z-index: 9;
  left: 50%;
  bottom: 16px;
  translate: -50% 0;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: min(560px, calc(100% - 32px));
  padding: 9px 10px 9px 14px;
  border-radius: 12px;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-2);
  font-size: 12.5px;
}

/* --- conteúdo dos painéis --- */
.ed-hint { color: var(--faint); font-size: 11.5px; line-height: 1.45; }
.ed-warn {
  margin-top: 6px; padding: 8px 10px; border-radius: 9px;
  background: var(--warn-soft); color: var(--warn);
  font-size: 11.5px; line-height: 1.45;
}
.ed-group { display: grid; gap: 6px; }
.ed-group-title { font-size: 10.5px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--faint); }
.ed-palette { display: grid; gap: 6px; }
.ed-chip {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 9px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  cursor: grab;
}
.ed-chip:hover { border-color: var(--primary); box-shadow: var(--shadow-1); }
.ed-chip:active { cursor: grabbing; }
.ed-chip-ic {
  display: grid; place-items: center; width: 28px; height: 28px;
  border-radius: 8px; background: var(--primary-soft); color: var(--primary-soft-ink);
}
.ed-chip-ic .icon { width: 15px; height: 15px; }
.ed-chip-text { min-width: 0; }
.ed-chip-text strong { display: block; font-size: 12.5px; font-weight: 600; }
.ed-chip-text small { display: block; color: var(--muted); font-size: 10.5px; line-height: 1.35; }

.ed-tree { display: grid; gap: 3px; }
.ed-tree-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  padding: 7px 8px;
  margin-left: calc(var(--depth, 0) * 14px);
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  cursor: grab;
}
.ed-tree-row:hover { border-color: var(--border-strong); background: var(--surface-2); }
.ed-tree-row.active { border-color: var(--primary); background: var(--primary-soft); }
.ed-tree-row.dragging { opacity: 0.4; }
.ed-tree-row.drop-before { box-shadow: 0 -2px 0 var(--primary); }
.ed-tree-row.drop-after { box-shadow: 0 2px 0 var(--primary); }
.ed-tree-row.drop-inside { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.ed-tree-ic { display: grid; place-items: center; color: var(--faint); }
.ed-tree-ic .icon { width: 14px; height: 14px; }
.ed-tree-name { font-size: 12.5px; font-weight: 580; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ed-tree-sub { color: var(--faint); font-size: 10.5px; max-width: 96px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.ed-sel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.ed-sel-kind { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 620; }
.ed-sel-kind .icon { width: 16px; height: 16px; color: var(--primary-soft-ink); }
.ed-sel-foot { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 10px; border-top: 1px solid var(--border); }
.ed-sec { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); overflow: hidden; }
.ed-sec > summary {
  padding: 9px 11px; font-size: 12px; font-weight: 620; color: var(--muted);
  cursor: pointer; list-style: none;
}
.ed-sec > summary::-webkit-details-marker { display: none; }
.ed-sec > summary::after { content: "+"; float: right; color: var(--faint); }
.ed-sec[open] > summary { color: var(--ink); border-bottom: 1px solid var(--border); }
.ed-sec[open] > summary::after { content: "−"; }
.ed-sec-body { display: grid; gap: 10px; padding: 11px; }
.ed-field { display: grid; gap: 5px; min-width: 0; }
.ed-field-label { font-size: 11.5px; font-weight: 570; color: var(--muted); }
.ed-field .input { font-size: 12.5px; }
.ed-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px; align-items: center; }
.ed-list { display: grid; gap: 6px; }
.ed-card { display: grid; gap: 5px; padding: 8px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); }
.ed-card-head { display: flex; align-items: center; justify-content: space-between; }
.ed-card-head b { color: var(--muted); font-size: 11px; }
.ed-image-control { display: grid; gap: 7px; }
.ed-swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.ed-swatch {
  width: 24px; height: 24px;
  border: 2px solid transparent; border-radius: 50%;
  background: var(--sw, transparent);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
  cursor: pointer;
}
.ed-swatch.active { border-color: var(--ink); }
.ed-swatch-none { display: grid; place-items: center; color: var(--faint); background: var(--surface-2); }
.ed-swatch-none .icon { width: 12px; height: 12px; }
.ed-icon-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(30px, 1fr)); gap: 4px; }
.ed-icon-option {
  display: grid; place-items: center; height: 30px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--muted); cursor: pointer;
}
.ed-icon-option svg { width: 15px; height: 15px; }
.ed-icon-option:hover { border-color: var(--border-strong); color: var(--ink); }
.ed-icon-option.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-soft-ink); }
.ed-note { padding: 10px 11px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--border); }
.ed-note strong { display: block; font-size: 12px; margin-bottom: 3px; }
.ed-note p { color: var(--muted); font-size: 11.5px; line-height: 1.45; }

/* --- celular: o dock vira gaveta de baixo --- */
@media (max-width: 860px) {
  .ed-shell, .ed-shell.pinned { grid-template-columns: minmax(0, 1fr); }
  .ed-shell .ed-canvas { padding: 10px 10px 64px; }
  .ed-shell.mobile .ed-dock {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    translate: none;
    width: auto;
    height: auto;
    max-height: 62svh;
    border-radius: 20px 20px 0 0;
    background: color-mix(in srgb, oklch(0.13 0.012 272) 92%, transparent);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 -18px 50px rgba(0, 0, 0, 0.6);
    z-index: 60;
  }
  .ed-shell.mobile .ed-grip {
    display: block;
    order: -1;
    width: 52px;
    height: 5px;
    margin: 8px auto 2px;
    padding: 0;
    border: 0;
    border-radius: 99px;
    background: var(--border-strong);
  }
  /* Espiando: só o cabeçalho, o estado e as abas. Aberta: o painel inteiro. */
  .ed-shell.mobile:not(.drawer) .ed-panels,
  .ed-shell.mobile:not(.drawer) .ed-foot { display: none; }
  .ed-shell.mobile .ed-panels { max-height: 42svh; }
  .ed-shell.mobile .ed-pin, .ed-shell.mobile .ed-collapse { display: none; }
  .ed-shell.mobile .ed-canvas-inner { max-width: 100%; }
  .ed-draft { bottom: auto; top: 12px; }
}

/* ==========================================================================
   Canvas do quiz — estilo N8N (Onda 4 / Fase 4)
   O nó tem tamanho FIXO (236 × 96): é o que deixa a aresta cair sempre no meio
   da borda sem medir o DOM a cada quadro do arrasto. Mudar aqui exige mudar
   NODE_W / NODE_H em `funnel-editor.js` no mesmo commit.
   ========================================================================== */
.fq-stage {
  position: relative;
  width: 100%;
  height: 100%;
  min-width: 0;
  border-radius: 12px;
  overflow: hidden;
  background:
    radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.075) 1px, transparent 0) 0 0 / 18px 18px,
    var(--bg);
  cursor: grab;
  /* sem isto o gesto de rolar do trackpad rola a página em vez de dar zoom */
  touch-action: none;
  overscroll-behavior: contain;
}
.fq-stage.panning { cursor: grabbing; }
.fq-world { position: absolute; left: 0; top: 0; width: 0; height: 0; transform-origin: 0 0; }

.fq-edges { position: absolute; overflow: visible; pointer-events: none; }
.fq-edge path { fill: none; stroke: var(--border-strong); stroke-width: 1.8; }
.fq-edge.active path { stroke: var(--primary); }
.fq-edges marker path { fill: var(--border-strong); stroke: none; }
.fq-edge text { fill: var(--muted); font: 500 11px var(--font); }

.fq-node {
  position: absolute;
  width: 236px;
  height: 96px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 3px;
  padding: 10px 13px;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-1);
  cursor: grab;
  user-select: none;
  touch-action: none;
}
.fq-node::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: var(--kind, var(--primary));
}
.fq-node:hover { border-color: var(--primary); }
.fq-node.active { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft), var(--shadow-2); }
.fq-node.broken { border-color: var(--danger); }
.fq-node.dragging { cursor: grabbing; box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5); }
.fq-port {
  position: absolute;
  top: 50%;
  width: 9px;
  height: 9px;
  margin-top: -5px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--border-strong);
}
.fq-port-in { left: -6px; }
.fq-port-out { right: -6px; background: var(--kind, var(--primary)); border-color: var(--kind, var(--primary)); }
.fq-node-head { display: flex; align-items: center; gap: 6px; min-width: 0; }
.fq-node-ic {
  display: grid;
  place-items: center;
  width: 19px;
  height: 19px;
  flex: none;
  border-radius: 6px;
  background: color-mix(in srgb, var(--kind, var(--primary)) 24%, transparent);
  color: var(--kind, var(--primary));
}
.fq-node-ic .icon { width: 12px; height: 12px; }
.fq-node-kind { font-size: 9.5px; font-weight: 700; letter-spacing: 0.09em; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fq-node-warn { margin-left: auto; display: grid; place-items: center; color: var(--danger); }
.fq-node-warn .icon { width: 14px; height: 14px; }
.fq-node-title { font-size: 13px; font-weight: 620; line-height: 1.25; overflow: hidden; }
.fq-node-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-width: 0; }
.fq-node-metric { font-size: 10.5px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fq-node-badges { display: flex; gap: 4px; flex: none; }
.fq-node-badge { display: grid; place-items: center; width: 19px; height: 19px; border-radius: 6px; background: var(--surface-2); color: var(--muted); }
.fq-node-badge .icon { width: 11px; height: 11px; }

.fq-zoom {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border-radius: 12px;
  background: color-mix(in srgb, oklch(0.13 0.012 272) 84%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.09);
}
.fq-zoom button {
  display: grid;
  place-items: center;
  min-width: 28px;
  height: 26px;
  padding: 0 7px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font: 600 14px var(--font);
  cursor: pointer;
}
.fq-zoom button:hover { background: rgba(255, 255, 255, 0.1); color: var(--ink); }
.fq-zoom .icon { width: 14px; height: 14px; }
.fq-zoom-value { min-width: 46px; font-size: 11.5px; }

.fq-preview { display: flex; flex-direction: column; align-items: center; gap: 12px; width: 100%; height: 100%; min-height: 0; }
.fq-preview-frame {
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 760px;
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}
.fq-preview-frame iframe { display: block; width: 100%; height: 100%; border: 0; }
.fq-preview-note { flex: none; color: var(--muted); font-size: 12px; }
.fq-warn { background: var(--danger-soft); color: var(--danger); }

@media (max-width: 860px) {
  /* a gaveta do dock come a parte de baixo: o controle de zoom sobe */
  .fq-zoom { bottom: 76px; }
  .fq-preview-frame { max-width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .ed-dock, .ed-canvas-inner { transition: none !important; }
}

/* ==========================================================================
   CELULAR: O PAINEL INTEIRO OPERÁVEL (Onda 5 / Fase 1)

   Cakto e Kiwify tratam o celular como VISOR. Aqui o produtor OPERA: cria
   curso, publica, abre pedido e responde comentário sem uma rolagem lateral e
   sem precisar de dedo de agulha. Quatro regras carregam a seção:

   1. ALVO DE TOQUE nunca menor que 44×44px. Não é estética: abaixo disso o
      erro de toque explode e a tela vira "só de olhar".
   2. NADA ESSENCIAL a menos de 16px da borda de baixo — é onde mora a barra
      do sistema, que engole o toque antes de a página ver.
   3. TABELA VIRA CARTÃO EMPILHADO. Rolar a tabela para o lado ESCONDE coluna
      (o `.table-shell` tinha `overflow-x:auto`, então a página não rolava e a
      informação sumia calada). Aqui cada `<tr>` é um cartão e cada `<td>` uma
      linha rotulada pelo cabeçalho, via `td[data-label]` — nada desaparece.
   4. FORMULÁRIO E WIZARD OCUPAM A TELA. Modal de 520px flutuando em 390px é
      caixa dentro de caixa; em pé, com respiro de safe-area no rodapé.

   ⚠ ESTA SEÇÃO É A ÚLTIMA DO ARQUIVO DE PROPÓSITO. Ela fala dos MESMOS
   seletores dos componentes (`.btn`, `.icon-btn`, `.drag-handle`, `.tab`…) com
   a MESMA especificidade — quem vem depois vence. Escrita no meio do arquivo,
   ela perdia calada: o medidor acusava `.drag-handle` com 26px de largura
   enquanto a regra de 44px estava lá, escrita e ignorada. Regra nova de
   celular entra AQUI, no fim, não lá em cima.
   ========================================================================== */
@media (max-width: 800px) {
  /* ---------- 1. alvo de toque ---------- */
  .btn, .btn.sm, .tab, .chip, .ui-select-trigger, .view-mode, .drag-handle,
  .switch-label, .context-link, .link-quiet, .module-cover, .quick-create,
  .input, textarea.input, .search-box, .search-box input { min-height: 44px; }
  .btn.sm { padding: 8px 12px; }
  .view-mode, .link-quiet, .context-link { min-width: 44px; justify-content: center; }
  .drag-handle { width: 44px; height: 44px; }
  /* `flex: none` não é enfeite: dentro de um flex apertado (cabeçalho do
     drawer) o botão de fechar encolhia para 43,6px e o medidor arredondava
     para 44 — alvo reprovado que parecia aprovado. */
  .icon-btn, .icon-btn.sm { width: 44px; height: 44px; flex: none; }
  .icon-btn.sm .icon { width: 16px; height: 16px; }
  .module-release .ui-select-trigger { padding: 8px 12px; }
  /* Edição inline: o texto continua do tamanho que era, a faixa clicável é
     que cresce (é ela o alvo). */
  .ui-inline { display: flex; align-items: center; min-height: 44px; }
  .ui-inline.editing { display: block; }
  .switch-label, .context-link, .link-quiet { align-items: center; }

  /* Faixa de abas: em vez de rolar para o lado (escondendo aba), ela QUEBRA
     em duas linhas. `scrollTabIntoView` vira no-op sozinho — a faixa deixa de
     ter rolagem para dentro. */
  .tabs { width: auto; flex-wrap: wrap; }
  .tab { flex: 1 1 auto; justify-content: center; }

  /* ---------- 2. barra de baixo, FAB e borda ---------- */
  .bottom-nav {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    padding: 4px 4px calc(16px + env(safe-area-inset-bottom));
  }
  .bottom-nav .nav-item {
    position: relative;
    min-height: 44px;
    padding: 5px 1px 4px;
    font-size: 9.5px;
    letter-spacing: -0.01em;
  }
  .bottom-nav .nav-item span:not(.nav-badge) {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .bottom-nav .nav-item .nav-badge { position: absolute; top: 1px; right: 18%; }

  /* FAB: a ação primária da tela ao alcance do polegar, acima da barra e
     longe da borda. Some junto com a barra nos editores em tela cheia. */
  .fab-quick {
    position: fixed;
    right: 16px;
    bottom: calc(84px + env(safe-area-inset-bottom));
    z-index: 79;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 52px;
    min-width: 52px;
    padding: 0 18px;
    border: 0;
    border-radius: 99px;
    background: var(--primary);
    color: #fff;
    font-size: 13.5px;
    font-weight: 600;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  }
  .fab-quick:active { transform: translateY(1px); }
  .fab-quick .icon { width: 20px; height: 20px; }
  /* Com o FAB no ar, o botão do topo é o MESMO comando duas vezes na tela —
     e ele comia metade do cabeçalho em 390px. Some; o título fica com a
     largura inteira. O clique continua existindo: os dois disparam o mesmo
     `onPrimary` (js/core/views.js). */
  #primary-action { display: none; }
  .app-shell:has(.fullscreen-editor) .fab-quick { display: none; }
  /* O respiro do conteúdo conta barra (~74) + FAB (52) + folga: sem isto o
     último cartão da lista nasce embaixo da barra. */
  .content { padding-bottom: calc(160px + env(safe-area-inset-bottom)); }
  .drawer-body { padding-bottom: calc(30px + env(safe-area-inset-bottom)); }

  /* ---------- 3. tabela vira cartão empilhado ---------- */
  .table-shell { overflow-x: visible; }
  .table-shell table, .table-shell thead, .table-shell tbody,
  .table-shell tr, .table-shell td { display: block; width: auto; }
  .table-shell thead { display: none; }              /* o cabeçalho virou rótulo */
  .table-shell tr {
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
  }
  .table-shell tr + tr { margin-top: 10px; }
  .table-shell tbody tr:hover { background: var(--surface-2); }
  .table-shell td {
    padding: 8px 0;
    border-bottom: 1px dashed var(--border);
    overflow-wrap: anywhere;
  }
  .table-shell tr td:first-child { padding-top: 0; }
  .table-shell tr td:last-child { padding-bottom: 0; border-bottom: 0; }
  .table-shell td:empty { display: none; }
  /* Célula com rótulo: nome do cabeçalho à esquerda, valor à direita, e o que
     não couber cai para a linha de baixo DENTRO do cartão. */
  .table-shell td[data-label] {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 2px 10px;
  }
  .table-shell td[data-label]::before {
    content: attr(data-label);
    flex: 0 0 auto;
    width: 6.4rem;
    color: var(--muted);
    font-size: 12px;
    font-weight: 550;
  }
  .table-shell td[data-label] > * { min-width: 0; max-width: 100%; }
  /* A primeira célula é o título do cartão: sem rótulo e com destaque. */
  .table-shell tr > td:first-child .cell-main { font-size: 14.5px; font-weight: 600; }
  .table-shell td.num, .table-shell .reports-table td.num { text-align: left; }
  .reports-table td, .reports-table td:first-child { white-space: normal; }
  .table-shell td.row-actions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 10px; }
  .table-shell td.row-actions .btn { flex: 1 1 auto; }

  /* ---------- 4. formulário e wizard em tela cheia ---------- */
  dialog.modal:not(.sheet):not(.drawer) {
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
    overflow-y: auto;
  }
  dialog.modal:not(.sheet):not(.drawer) .modal-body {
    min-height: 100%;
    align-content: start;
    padding: 18px 16px calc(24px + env(safe-area-inset-bottom));
  }
  .modal-actions { flex-wrap: wrap; }
  .modal-actions .btn { flex: 1 1 auto; }
  .ui-wizard-rail { flex-wrap: wrap; }
  .ui-wizard-actions .btn { flex: 1 1 auto; }
  .sheet .nav-item { min-height: 48px; }
}

/* ==========================================================================
   CELULAR: OS TRÊS EDITORES (Onda 5 / Fase 2)

   Página, quiz e checkout montam o MESMO `editor-dock.js`. Esta seção conserta
   os três de uma vez — e é por isso que ela também os quebra de uma vez, se
   estiver errada. Cada regra abaixo nasceu de um número medido em 390×844 com
   Chrome de verdade (`tmp/onda5-medir-editores.mjs`), não de olho:

   1. A GAVETA ESPIANDO COMIA 229px DE CANVAS. O rodapé do canvas estava
      chumbado em 64px: 165px de tela ficavam POR BAIXO da gaveta, e o medidor
      ingênuo aprovava ("existe um canvas, ele tem 844px"). Agora a gaveta
      publica a própria altura em `--ed-peek` (editor-dock.js) e o canvas
      reserva exatamente isso. Espiando, ela mostra só o que serve para navegar
      — puxador, título e as 4 abas; estado e rodapé de ações aparecem quando a
      gaveta abre.
   2. ALVO DE TOQUE ≥ 44×44 dentro do editor também. O puxador media 52×5, o
      seletor computador/celular 30×26, o zoom do quiz 28×26, a amostra de cor
      24×24 e a linha da árvore 366×35,4 — todos reprovados, todos aqui.
   3. BARRA DE CONTEXTO NO POLEGAR. No computador ela cola no elemento (lá o
      ponteiro alcança tudo). No celular, um elemento no topo da página punha a
      barra fora do alcance de quem segura o telefone com uma mão: ela desce
      para logo acima da gaveta, onde o polegar mora. Quem posiciona limpa o
      `top`/`left` inline no celular (`positionBars`, page-editor.js) — senão o
      estilo inline venceria esta regra em silêncio.
   4. TECLADO VIRTUAL. `bottom: var(--ed-kb)` levanta a gaveta onde o navegador
      não encolhe a viewport de layout sozinho. Ver o cabeçalho do
      editor-dock.js: onde ele encolhe, `--ed-kb` dá zero e não há compensação
      dobrada.

   ⚠ Como a seção da Fase 1, esta mora no FIM do arquivo de propósito: ela fala
   dos mesmos seletores `.ed-*` escritos lá em cima, com a mesma especificidade.
   Escrita antes, perderia calada.
   ========================================================================== */
@media (max-width: 860px) {
  /* ---------- 1. a gaveta e o canvas ---------- */
  .ed-shell.mobile .ed-dock {
    bottom: var(--ed-kb, 0px);
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
  }
  .ed-shell.mobile:not(.drawer) .ed-dock { max-height: none; }
  .ed-shell.mobile.drawer .ed-dock { max-height: 78svh; }
  /* Espiando, estado e ações não cabem: eles custam ~85px de canvas para dizer
     o que só interessa a quem já abriu a gaveta. */
  .ed-shell.mobile:not(.drawer) .ed-status { display: none; }
  /* Digitando, o teclado leva metade da tela: a faixa de estado sai para o
     painel respirar (editor-dock.js liga a classe no foco do campo). */
  .ed-shell.mobile.typing .ed-status { display: none; }
  .ed-shell.mobile .ed-panels { max-height: none; padding-bottom: 16px; }
  .ed-shell.mobile .ed-canvas { padding: 10px 10px calc(var(--ed-peek, 172px) + 10px); }
  /* O controle de zoom volta para o canto do canvas: o canvas já termina ACIMA
     da gaveta, então o desvio de 76px da Onda 4 agora sobraria no vazio. */
  .ed-shell.mobile .fq-zoom { bottom: 14px; }

  /* ---------- 2. alvo de toque ---------- */
  /* O puxador é a faixa inteira, não o risquinho: o risco é o desenho
     (`::before`), a faixa é o alvo. */
  .ed-shell.mobile .ed-grip {
    position: relative;
    display: block;
    order: -1;
    /* `flex: none` não é enfeite: com a gaveta no teto de altura, o puxador é
       um item flexível como os outros e encolhia para 13px — alvo reprovado
       que a régua mostrava ora com 44, ora com 21, conforme a aba. */
    flex: none;
    width: 100%;
    height: 44px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
  }
  .ed-shell.mobile .ed-grip::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 16px;
    width: 52px;
    height: 5px;
    margin-left: -26px;
    border-radius: 99px;
    background: var(--border-strong);
  }
  .ed-shell.mobile .ed-dock-top { padding: 0 10px 8px; }
  .ed-shell.mobile .ed-tab { min-height: 52px; font-size: 11px; }
  .ed-shell.mobile .ed-seg { padding: 2px; }
  .ed-shell.mobile .ed-seg button { min-width: 46px; height: 44px; }
  .ed-shell.mobile .ed-tree-row { min-height: 44px; padding: 8px 10px; }
  .ed-shell.mobile .ed-chip { min-height: 52px; }
  .ed-shell.mobile .ed-swatch { width: 44px; height: 44px; }
  .ed-shell.mobile .ed-icon-picker { grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); }
  .ed-shell.mobile .ed-icon-option { height: 44px; }
  .ed-shell.mobile .ed-sec > summary { display: flex; align-items: center; justify-content: space-between; min-height: 44px; }
  .ed-shell.mobile .ed-sec > summary::after { float: none; }
  .ed-shell.mobile .btn, .ed-shell.mobile .btn.sm { min-height: 44px; }
  .ed-shell.mobile .icon-btn, .ed-shell.mobile .icon-btn.sm { width: 44px; height: 44px; flex: none; }
  .ed-shell.mobile .input, .ed-shell.mobile textarea.input,
  .ed-shell.mobile .ui-select-trigger, .ed-shell.mobile .switch-label { min-height: 44px; }
  .ed-shell.mobile .ed-field .input { font-size: 14px; }
  .ed-shell.mobile .fq-zoom button { min-width: 46px; height: 44px; }

  /* ---------- 3. barra de contexto e de formatação no polegar ---------- */
  .ed-shell.mobile .ed-ctx, .ed-shell.mobile .ed-fmt {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: calc(var(--ed-peek, 172px) + var(--ed-kb, 0px) + 10px);
    z-index: 61;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
    padding: 5px;
    border-radius: 14px;
  }
  .ed-shell.mobile .ed-ctx button { width: 48px; height: 44px; }
  .ed-shell.mobile .ed-fmt button { min-width: 46px; height: 44px; }
  /* Com a gaveta ABERTA as duas barras ficariam por baixo dela: quem abriu a
     gaveta está no painel, não no canvas. */
  .ed-shell.mobile.drawer .ed-ctx, .ed-shell.mobile.drawer .ed-fmt { display: none; }
}
