/* ============================================================
   Painel de Afiliados — design system
   ============================================================ */
:root {
  --violet: #7c3aed;
  --violet-dark: #5b21b6;
  --violet-deep: #2e1065;
  --pink: #ec4899;
  --orange: #fb7185;
  --amber: #f59e0b;
  --lime: #84cc16;
  --cyan: #06b6d4;
  --blue: #3b82f6;
  --ink: #1b1136;
  --ink-soft: #6b6285;
  --line: #ece8f7;
  --bg: #f7f5ff;
  --white: #fff;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 10px 30px -12px rgba(46, 16, 101, .22);
  --shadow-lg: 0 24px 60px -20px rgba(46, 16, 101, .35);
  --grad-main: linear-gradient(135deg, #7c3aed 0%, #ec4899 55%, #f97316 100%);
  --grad-side: linear-gradient(165deg, #2e1065 0%, #4c1d95 45%, #831843 100%);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -.02em; }
p { margin: 0; }
a { color: inherit; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
::selection { background: #ddd6fe; }

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

.sidebar {
  width: 258px; flex: 0 0 258px;
  background: var(--grad-side);
  color: #ede9fe;
  padding: 26px 18px;
  display: flex; flex-direction: column; gap: 26px;
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 0 6px; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 13px;
  background: var(--grad-main);
  display: grid; place-items: center;
  font-weight: 800; font-size: 19px; color: #fff;
  box-shadow: 0 8px 20px -6px rgba(236, 72, 153, .8);
}
.brand-name { font-weight: 800; font-size: 16px; color: #fff; letter-spacing: -.02em; }
.brand-sub { font-size: 11px; color: #c4b5fd; letter-spacing: .09em; text-transform: uppercase; }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-label { font-size: 10.5px; letter-spacing: .13em; text-transform: uppercase; color: #a78bfa; padding: 10px 12px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 13px; border-radius: 12px;
  background: transparent; border: 0; color: #ddd6fe;
  font-size: 14px; font-weight: 600; text-align: left; width: 100%;
  transition: .18s;
}
.nav-item:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.nav-item.active {
  background: rgba(255, 255, 255, .14);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18);
}
.nav-item .ico { font-size: 15px; width: 18px; text-align: center; }

.side-card {
  margin-top: auto;
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 16px; padding: 15px;
  backdrop-filter: blur(6px);
}
.side-card h4 { font-size: 13px; color: #fff; margin-bottom: 5px; }
.side-card p { font-size: 11.5px; color: #ddd6fe; line-height: 1.5; margin-bottom: 11px; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 4px 6px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--grad-main); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
  flex: 0 0 34px;
}
.side-user .who { font-size: 12.5px; font-weight: 700; color: #fff; line-height: 1.3; }
.side-user .mail { font-size: 11px; color: #c4b5fd; }

/* ---------------- main ---------------- */
.main { flex: 1; min-width: 0; max-width: 100%; padding: 30px 34px 60px; overflow-x: hidden; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 26px; }
.page-title { font-size: 27px; font-weight: 800; }
.page-sub { font-size: 13.5px; color: var(--ink-soft); margin-top: 5px; }
.topbar-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------------- menu da conta (topo direito) ---------------- */
.app-header {
  min-height: 40px; display: flex; align-items: flex-start; justify-content: flex-end;
  margin: -8px 0 12px; position: relative; z-index: 45;
}
.profile-menu { position: relative; }
.profile-trigger {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 6px 3px 3px;
  color: var(--ink); background: transparent; border: 0; border-radius: 24px;
  transition: background .16s, transform .16s;
}
.profile-trigger:hover, .profile-trigger[aria-expanded="true"] { background: rgba(127, 127, 127, .13); }
.profile-trigger:focus-visible, .profile-menu-item:focus-visible, .account-photo-copy button:focus-visible {
  outline: 3px solid rgba(99, 102, 241, .55); outline-offset: 2px;
}
.profile-avatar, .profile-summary-avatar, .account-photo-preview {
  position: relative; overflow: hidden; display: grid; place-items: center; flex: 0 0 auto;
  border-radius: 50%; color: #fff; font-weight: 800; background: var(--grad-main);
}
.profile-avatar { width: 36px; height: 36px; font-size: 14px; }
.profile-summary-avatar { width: 48px; height: 48px; font-size: 18px; }
.profile-avatar img, .profile-summary-avatar img, .account-photo-preview img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: inherit;
}
.profile-avatar img[hidden], .profile-summary-avatar img[hidden], .account-photo-preview img[hidden] { display: none; }
.profile-chevron { font-size: 16px; line-height: 1; opacity: .72; transform: translateY(-2px); }
.profile-dropdown {
  position: absolute; top: calc(100% + 9px); right: 0; z-index: 90; width: min(340px, calc(100vw - 32px));
  padding: 9px; border: 1px solid var(--line); border-radius: 17px;
  background: var(--white); color: var(--ink); box-shadow: var(--shadow-lg);
  transform-origin: top right; animation: profile-pop .15s ease;
}
.profile-dropdown[hidden] { display: none; }
@keyframes profile-pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.profile-summary { display: flex; align-items: center; gap: 12px; padding: 9px 8px 13px; margin-bottom: 5px; border-bottom: 1px solid var(--line); }
.profile-summary-text { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.profile-summary-text strong { font-size: 14px; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-summary-text span { font-size: 12px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-menu-item {
  width: 100%; display: flex; align-items: center; gap: 11px; padding: 9px 8px; border: 0; border-radius: 11px;
  background: transparent; text-align: left; color: var(--ink); transition: background .15s;
}
.profile-menu-item:hover { background: rgba(127, 127, 127, .11); }
.profile-menu-item > span:last-child { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.profile-menu-item b { font-size: 13px; }
.profile-menu-item small { color: var(--ink-soft); font-size: 11.5px; }
.profile-menu-icon {
  width: 35px; height: 35px; flex: 0 0 35px; display: grid; place-items: center;
  border-radius: 50%; background: var(--bg); font-size: 16px;
}
.profile-divider { height: 1px; margin: 5px 5px; background: var(--line); }
.profile-logout .profile-menu-icon { color: #ef4444; font-size: 19px; }
.account-photo-row { display: flex; align-items: center; gap: 14px; padding: 0 0 18px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.account-photo-preview { width: 72px; height: 72px; font-size: 23px; }
.account-photo-copy { display: flex; align-items: flex-start; flex-direction: column; gap: 5px; font-size: 13px; }
.account-photo-copy .muted { font-size: 11.5px; }
.account-photo-copy button { margin-top: 3px; }

/* ---------------- buttons ---------------- */
.btn {
  border: 0; border-radius: 12px; padding: 11px 18px;
  font-weight: 700; font-size: 13.5px;
  display: inline-flex; align-items: center; gap: 7px;
  transition: .18s; text-decoration: none;
}
.btn-primary { background: var(--grad-main); color: #fff; box-shadow: 0 10px 24px -12px rgba(124, 58, 237, .9); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 16px 30px -14px rgba(124, 58, 237, 1); }
.btn-ghost { background: #fff; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.btn-ghost:hover { box-shadow: inset 0 0 0 1px #d9d1f2; background: #fdfcff; }
.btn-danger { background: #fee2e2; color: #b91c1c; }
.btn-danger:hover { background: #fecaca; }
.btn-sm { padding: 7px 12px; font-size: 12px; border-radius: 9px; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .72; cursor: not-allowed; filter: grayscale(.25); transform: none !important; box-shadow: none; }
.btn-primary:disabled { background: #536171; color: #fff; }
.btn[hidden] { display: none !important; }
.icon-btn {
  border: 0; background: #f4f1fd; color: var(--violet);
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  font-size: 13px; transition: .15s;
}
.icon-btn:hover { background: #e9e2fb; }

/* ---------------- cards ---------------- */
.card {
  min-width: 0;
  background: #fff; border-radius: var(--radius);
  box-shadow: var(--shadow); border: 1px solid #f2effc;
  padding: 20px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-title { font-size: 15px; font-weight: 800; }
.card-sub { font-size: 12px; color: var(--ink-soft); margin-top: 3px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpis.kpi5 { grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); }
.kpi { position: relative; overflow: hidden; border-radius: var(--radius); padding: 17px 18px; color: #fff; box-shadow: var(--shadow); }
.kpi::after {
  content: ""; position: absolute; right: -30px; top: -35px;
  width: 110px; height: 110px; border-radius: 50%;
  background: rgba(255, 255, 255, .16);
}
.kpi.v1 { background: linear-gradient(135deg, #7c3aed, #a855f7); }
.kpi.v2 { background: linear-gradient(135deg, #ec4899, #f43f5e); }
.kpi.v3 { background: linear-gradient(135deg, #f59e0b, #f97316); }
.kpi.v4 { background: linear-gradient(135deg, #06b6d4, #3b82f6); }
.kpi.v5 { background: linear-gradient(135deg, #16a34a, #84cc16); }
.kpi-label { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; opacity: .9; }
.kpi-value { font-size: clamp(19px, 1.7vw, 26px); font-weight: 800; margin-top: 8px; letter-spacing: -.03em; }
.kpi-foot { display: flex; align-items: center; gap: 6px; font-size: 11.5px; margin-top: 7px; opacity: .95; flex-wrap: wrap; }
.delta { background: rgba(255, 255, 255, .25); padding: 2px 7px; border-radius: 20px; font-weight: 800; white-space: nowrap; }

.grid-2 { display: grid; grid-template-columns: 1.55fr 1fr; gap: 16px; }
.grid-2b { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 16px; }

/* ---------------- chart ---------------- */
.chart-wrap { position: relative; }
.chart-svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-legend { display: flex; gap: 16px; font-size: 11.5px; color: var(--ink-soft); font-weight: 600; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 5px; }
.dot[data-dot="cliques"] { background: #7c3aed; }
.dot[data-dot="vendas"] { background: #ec4899; }

.bars { display: flex; flex-direction: column; gap: 13px; }
.bar-row { font-size: 12.5px; }
.bar-top { display: flex; justify-content: space-between; margin-bottom: 5px; font-weight: 600; }
.bar-track { height: 9px; border-radius: 20px; background: #f3f0fb; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 20px; transition: width .5s ease; }

/* ---------------- badges ---------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 800; letter-spacing: .02em;
  padding: 4px 10px; border-radius: 20px; white-space: nowrap;
}
.b-hotmart { background: #ffe4e6; color: #be123c; }
.b-monetizze { background: #dbeafe; color: #1d4ed8; }
.b-braip { background: #ffedd5; color: #c2410c; }
.b-kiwify { background: #ede9fe; color: #6d28d9; }
.b-eduzz { background: #ccfbf1; color: #0f766e; }
.b-outros { background: #f1f5f9; color: #475569; }
.b-ativo { background: #dcfce7; color: #15803d; }
.b-pausado { background: #fef3c7; color: #b45309; }
.b-rascunho { background: #f1f5f9; color: #475569; }
.b-aprovada { background: #dcfce7; color: #15803d; }
.b-pendente { background: #fef3c7; color: #b45309; }
.b-cancelada { background: #fee2e2; color: #b91c1c; }

/* ---------------- table ---------------- */
.table-wrap { overflow-x: auto; }
.table-wrap.scroll-y { max-height: 600px; overflow-y: auto; }
.table-wrap.scroll-y thead th { position: sticky; top: 0; background: #fff; z-index: 2; padding-top: 4px; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
thead th {
  text-align: left; font-size: 10px; letter-spacing: .09em; text-transform: uppercase;
  color: var(--ink-soft); font-weight: 800; padding: 0 12px 10px; white-space: nowrap;
}
tbody td { padding: 11px 10px; border-top: 1px solid var(--line); vertical-align: middle; }
tbody tr:hover { background: #fbfaff; }
.cell-title { font-weight: 700; font-size: 13.5px; }
.cell-sub { font-size: 11.5px; color: var(--ink-soft); margin-top: 3px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.num { font-variant-numeric: tabular-nums; font-weight: 700; }
th:last-child, td.col-actions { width: 1%; white-space: nowrap; }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.col-actions .icon-btn { width: 27px; height: 27px; font-size: 12px; border-radius: 8px; }
.muted { color: var(--ink-soft); font-weight: 500; }

/* ---------------- form ---------------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; font-weight: 700; color: #4b3f6b; margin-bottom: 6px; }
.input, select.input, textarea.input {
  width: 100%; padding: 11px 13px; border-radius: 11px;
  border: 1px solid #e6e1f5; background: #fdfcff; font-size: 13.5px;
  transition: .15s; outline: none;
}
.input:focus { border-color: var(--violet); background: #fff; box-shadow: 0 0 0 3px #ede9fe; }
textarea.input { min-height: 78px; resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hint { font-size: 11.5px; color: var(--ink-soft); margin-top: 5px; }

/* ---------------- modal ---------------- */
.overlay {
  position: fixed; inset: 0; background: rgba(27, 17, 54, .48);
  backdrop-filter: blur(3px); display: none; place-items: center; padding: 20px; z-index: 60;
}
.overlay.open { display: grid; }
.modal {
  background: #fff; border-radius: 22px; width: min(620px, 100%);
  max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg);
  animation: pop .18s ease;
}
@keyframes pop { from { transform: scale(.97) translateY(6px); opacity: 0; } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 22px 0;
}
.modal-body { padding: 18px 22px 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 0 22px 22px; }

/* ---------------- misc ---------------- */
.empty { text-align: center; padding: 46px 20px; color: var(--ink-soft); }
.empty .emoji { font-size: 34px; display: block; margin-bottom: 10px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: #fff; color: var(--ink-soft);
  padding: 7px 14px; border-radius: 20px; font-size: 12.5px; font-weight: 700;
}
.chip.active { background: var(--violet); border-color: var(--violet); color: #fff; }
.seg { display: inline-flex; background: #f3f0fb; border-radius: 11px; padding: 3px; }
.seg button { border: 0; background: transparent; padding: 6px 13px; border-radius: 9px; font-size: 12px; font-weight: 700; color: var(--ink-soft); }
.seg button.active { background: #fff; color: var(--violet); box-shadow: 0 2px 8px -3px rgba(46, 16, 101, .3); }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 20px);
  background: var(--ink); color: #fff; padding: 13px 22px; border-radius: 14px;
  font-size: 13.5px; font-weight: 600; opacity: 0; pointer-events: none;
  transition: .25s; z-index: 90; box-shadow: var(--shadow-lg); max-width: 90vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: #b91c1c; }

.copy-row { display: flex; gap: 8px; align-items: center; }
.copy-row .input { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; }

.view { display: none; }
.view.active { display: block; animation: fade .22s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }

/* ---------------- mobile ---------------- */
@media (max-width: 940px) {
  .shell { flex-direction: column; }
  .sidebar {
    width: 100%; flex: none; height: auto; position: relative;
    padding: 16px; gap: 14px;
  }
  .nav { flex-direction: row; overflow-x: auto; padding-bottom: 4px; }
  .nav-label, .side-card { display: none; }
  .nav-item { white-space: nowrap; }
  .main { padding: 20px 16px 50px; }
  .grid-2, .grid-2b, .form-row { grid-template-columns: 1fr; }
  .page-title { font-size: 22px; }
}

/* ============================================================
   TEMAS — aplicados como classe no <html> via data-theme
   ============================================================ */

/* ---------- MIDNIGHT (escuro sofisticado) — padrão novo ---------- */
html[data-theme="midnight"] {
  --ink: #eef0ff;
  --ink-soft: #9aa2c8;
  --line: #262b47;
  --bg: #0d1020;
  --white: #161a30;
  --shadow: 0 12px 34px -16px rgba(0, 0, 0, .85);
  --shadow-lg: 0 26px 60px -22px rgba(0, 0, 0, .9);
  --grad-main: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #22d3ee 100%);
  --grad-side: linear-gradient(180deg, #12152a 0%, #171b33 100%);
}
html[data-theme="midnight"] body { background: #0d1020; color: #eef0ff; }
html[data-theme="midnight"] .sidebar {
  background: #12152a;
  border-right: 1px solid #232842;
  color: #b9c0e0;
}
html[data-theme="midnight"] .brand-name { color: #fff; }
html[data-theme="midnight"] .brand-sub { color: #6c76a8; }
html[data-theme="midnight"] .nav-label { color: #5c6699; }
html[data-theme="midnight"] .nav-item { color: #a9b1d6; }
html[data-theme="midnight"] .nav-item:hover { background: #1c2140; color: #fff; }
html[data-theme="midnight"] .nav-item.active {
  background: linear-gradient(90deg, #6366f1 0%, #8b5cf6 100%);
  color: #fff; box-shadow: 0 8px 20px -10px #6366f1;
}
html[data-theme="midnight"] .side-card {
  background: #181d36; border: 1px solid #262c4a;
}
html[data-theme="midnight"] .side-card h4 { color: #fff; }
html[data-theme="midnight"] .side-card p { color: #9aa2c8; }
html[data-theme="midnight"] .side-user .who { color: #fff; }
html[data-theme="midnight"] .side-user .mail { color: #7c86b8; }
html[data-theme="midnight"] .card {
  background: #161a30; border-color: #242a45;
}
html[data-theme="midnight"] .card-sub,
html[data-theme="midnight"] .page-sub,
html[data-theme="midnight"] .hint,
html[data-theme="midnight"] .muted { color: #8b93ba; }
html[data-theme="midnight"] .btn-ghost {
  background: #1c2138; color: #dfe3ff; box-shadow: inset 0 0 0 1px #2c3350;
}
html[data-theme="midnight"] .btn-ghost:hover { background: #232946; box-shadow: inset 0 0 0 1px #3b4370; }
html[data-theme="midnight"] .seg { background: #1b2038; }
html[data-theme="midnight"] .seg button { color: #98a0c8; }
html[data-theme="midnight"] .seg button.active { background: #2b3152; color: #fff; box-shadow: none; }
html[data-theme="midnight"] .input {
  background: #12162b; border-color: #2a3050; color: #eef0ff;
}
html[data-theme="midnight"] .input:focus { background: #171c34; border-color: #6366f1; box-shadow: 0 0 0 3px #2a2f66; }
html[data-theme="midnight"] .input::placeholder { color: #5f6893; }
html[data-theme="midnight"] thead th { color: #7c85b3; }
html[data-theme="midnight"] tbody td { border-top-color: #232842; }
html[data-theme="midnight"] tbody tr:hover { background: #1a1f38; }
html[data-theme="midnight"] .table-wrap.scroll-y thead th { background: #161a30; }
html[data-theme="midnight"] .chip { background: #1b2038; border-color: #2a3050; color: #9aa2c8; }
html[data-theme="midnight"] .chip.active { background: #6366f1; border-color: #6366f1; color: #fff; }
html[data-theme="midnight"] .icon-btn { background: #232946; color: #a5b4fc; }
html[data-theme="midnight"] .icon-btn:hover { background: #2e3560; }
html[data-theme="midnight"] .modal { background: #161a30; }
html[data-theme="midnight"] .bar-track { background: #232842; }
html[data-theme="midnight"] .kpi.v1 { background: linear-gradient(135deg, #4f46e5, #7c3aed); }
html[data-theme="midnight"] .kpi.v2 { background: linear-gradient(135deg, #db2777, #e11d48); }
html[data-theme="midnight"] .kpi.v3 { background: linear-gradient(135deg, #d97706, #ea580c); }
html[data-theme="midnight"] .kpi.v4 { background: linear-gradient(135deg, #0891b2, #2563eb); }
html[data-theme="midnight"] .kpi.v5 { background: linear-gradient(135deg, #059669, #65a30d); }
html[data-theme="midnight"] .empty { color: #8b93ba; }
html[data-theme="midnight"] ::selection { background: #4338ca; }
html[data-theme="midnight"] .toast { background: #eef0ff; color: #12152a; }
html[data-theme="midnight"] code { color: #a5b4fc; }
html[data-theme="midnight"] .cell-title { color: #eef0ff; }

/* ---------- GRAFITE (escuro neutro) ---------- */
html[data-theme="grafite"] {
  --ink: #ececec;
  --ink-soft: #a0a0a0;
  --line: #2e2e2e;
  --bg: #1b1b1b;
  --white: #232323;
  --shadow: 0 12px 30px -18px rgba(0, 0, 0, .9);
  --shadow-lg: 0 24px 56px -24px rgba(0, 0, 0, .95);
  --grad-main: linear-gradient(135deg, #4b4b4b 0%, #6b6b6b 100%);
  --grad-side: linear-gradient(180deg, #191919 0%, #1d1d1d 100%);
}
html[data-theme="grafite"] body { background: #1b1b1b; color: #ececec; }
html[data-theme="grafite"] .sidebar {
  background: #191919; border-right: 1px solid #2b2b2b; color: #b0b0b0;
}
html[data-theme="grafite"] .brand-name { color: #f5f5f5; }
html[data-theme="grafite"] .brand-sub { color: #7a7a7a; }
html[data-theme="grafite"] .brand-mark {
  background: #2f2f2f; box-shadow: inset 0 0 0 1px #3d3d3d; color: #e8e8e8;
}
html[data-theme="grafite"] .nav-label { color: #6e6e6e; }
html[data-theme="grafite"] .nav-item { color: #a8a8a8; }
html[data-theme="grafite"] .nav-item:hover { background: #262626; color: #f0f0f0; }
html[data-theme="grafite"] .nav-item.active {
  background: #2e2e2e; color: #fff; box-shadow: inset 0 0 0 1px #3a3a3a;
}
html[data-theme="grafite"] .side-card {
  background: #202020; border: 1px solid #2e2e2e;
}
html[data-theme="grafite"] .side-card h4 { color: #f0f0f0; }
html[data-theme="grafite"] .side-card p { color: #9a9a9a; }
html[data-theme="grafite"] .side-user .who { color: #f0f0f0; }
html[data-theme="grafite"] .side-user .mail { color: #808080; }
html[data-theme="grafite"] .card {
  background: #232323; border-color: #2f2f2f; box-shadow: var(--shadow);
}
html[data-theme="grafite"] .card-sub,
html[data-theme="grafite"] .page-sub,
html[data-theme="grafite"] .hint,
html[data-theme="grafite"] .muted { color: #9c9c9c; }
html[data-theme="grafite"] .btn-ghost {
  background: #272727; color: #e4e4e4; box-shadow: inset 0 0 0 1px #363636;
}
html[data-theme="grafite"] .btn-ghost:hover { background: #2f2f2f; box-shadow: inset 0 0 0 1px #454545; }
html[data-theme="grafite"] .btn-primary {
  background: #ededed; color: #1b1b1b; box-shadow: 0 10px 24px -14px rgba(255, 255, 255, .35);
}
html[data-theme="grafite"] .btn-primary:hover { background: #fff; }
html[data-theme="grafite"] .seg { background: #232323; }
html[data-theme="grafite"] .seg button { color: #9c9c9c; }
html[data-theme="grafite"] .seg button.active { background: #3a3a3a; color: #fff; box-shadow: none; }
html[data-theme="grafite"] .input {
  background: #1e1e1e; border-color: #343434; color: #ececec;
}
html[data-theme="grafite"] .input:focus {
  background: #232323; border-color: #6b6b6b; box-shadow: 0 0 0 3px #333;
}
html[data-theme="grafite"] .input::placeholder { color: #707070; }
html[data-theme="grafite"] .field label { color: #b4b4b4; }
html[data-theme="grafite"] .field label,
html[data-theme="grafite"] label { color: #b4b4b4; }
html[data-theme="grafite"] .field label { color: #a8a8a8; }
html[data-theme="grafite"] .theme-name { color: #f0f0f0; }
html[data-theme="grafite"] .theme-desc { color: #8a8a8a; }
html[data-theme="grafite"] .theme-card { background: #202020; border-color: #323232; }
html[data-theme="grafite"] .dot[data-dot="cliques"] { background: #e6e6e6 !important; }
html[data-theme="grafite"] .dot[data-dot="vendas"] { background: #8a8a8a !important; }
html[data-theme="grafite"] textarea.input { background: #1e1e1e; color: #ececec; }
html[data-theme="grafite"] select.input { background: #1e1e1e; color: #ececec; }
html[data-theme="grafite"] select.input option { background: #232323; color: #ececec; }
html[data-theme="grafite"] thead th { color: #8f8f8f; }
html[data-theme="grafite"] tbody td { border-top-color: #2c2c2c; }
html[data-theme="grafite"] tbody tr:hover { background: #272727; }
html[data-theme="grafite"] .table-wrap.scroll-y thead th { background: #232323; }
html[data-theme="grafite"] .chip { background: #272727; border-color: #363636; color: #a8a8a8; }
html[data-theme="grafite"] .chip.active { background: #ededed; border-color: #ededed; color: #1b1b1b; }
html[data-theme="grafite"] .icon-btn { background: #2d2d2d; color: #d4d4d4; }
html[data-theme="grafite"] .icon-btn:hover { background: #383838; }
html[data-theme="grafite"] .modal { background: #232323; }
html[data-theme="grafite"] .bar-track { background: #2f2f2f; }
html[data-theme="grafite"] .kpi.v1 { background: linear-gradient(135deg, #3f3f3f, #565656); }
html[data-theme="grafite"] .kpi.v2 { background: linear-gradient(135deg, #4a4a4a, #636363); }
html[data-theme="grafite"] .kpi.v3 { background: linear-gradient(135deg, #555, #6f6f6f); }
html[data-theme="grafite"] .kpi.v4 { background: linear-gradient(135deg, #353535, #4d4d4d); }
html[data-theme="grafite"] .kpi.v5 { background: linear-gradient(135deg, #5f5f5f, #7a7a7a); }
html[data-theme="grafite"] .kpi { box-shadow: inset 0 0 0 1px #444, var(--shadow); }
html[data-theme="grafite"] .empty { color: #9c9c9c; }
html[data-theme="grafite"] ::selection { background: #4a4a4a; }
html[data-theme="grafite"] .toast { background: #ededed; color: #1b1b1b; }
html[data-theme="grafite"] code { color: #d8d8d8; }
html[data-theme="grafite"] .cell-title { color: #f0f0f0; }
html[data-theme="grafite"] .overlay { background: rgba(8, 8, 8, .68); }
html[data-theme="grafite"] .theme-card.sel { box-shadow: 0 0 0 2px #ededed; }
html[data-theme="grafite"] .badge.b-ativo { background: #2c2c2c; color: #d8d8d8; }
html[data-theme="grafite"] .net-slug { color: #b8b8b8; }
html[data-theme="grafite"] a { color: #dcdcdc; }

/* ---------- CLEAN (claro, minimalista) ---------- */
html[data-theme="clean"] {
  --ink: #14231c;
  --ink-soft: #5f7269;
  --line: #e6ece8;
  --bg: #f7faf8;
  --shadow: 0 6px 20px -12px rgba(16, 40, 30, .18);
  --grad-main: linear-gradient(135deg, #0f766e 0%, #16a34a 100%);
  --grad-side: linear-gradient(180deg, #ffffff 0%, #f2f7f4 100%);
}
html[data-theme="clean"] body { background: #f7faf8; color: #14231c; }
html[data-theme="clean"] .sidebar {
  background: #fff; border-right: 1px solid #e6ece8; color: #3f5349;
}
html[data-theme="clean"] .brand-name { color: #14231c; }
html[data-theme="clean"] .brand-sub { color: #8fa197; }
html[data-theme="clean"] .brand-mark { background: linear-gradient(135deg, #0f766e, #16a34a); box-shadow: none; }
html[data-theme="clean"] .nav-label { color: #a0b0a7; }
html[data-theme="clean"] .nav-item { color: #4a6156; }
html[data-theme="clean"] .nav-item:hover { background: #f0f6f2; color: #14231c; }
html[data-theme="clean"] .nav-item.active {
  background: #e8f5ee; color: #0f766e; box-shadow: inset 3px 0 0 #0f766e;
}
html[data-theme="clean"] .side-card { background: #f4f9f6; border: 1px solid #e0ebe4; }
html[data-theme="clean"] .side-card h4 { color: #14231c; }
html[data-theme="clean"] .side-card p { color: #5f7269; }
html[data-theme="clean"] .side-user .who { color: #14231c; }
html[data-theme="clean"] .side-user .mail { color: #8fa197; }
html[data-theme="clean"] .card { border-color: #ebf1ed; }
html[data-theme="clean"] .kpi { box-shadow: none; }
html[data-theme="clean"] .kpi.v1 { background: linear-gradient(135deg, #0e7490, #0891b2); }
html[data-theme="clean"] .kpi.v2 { background: linear-gradient(135deg, #0f766e, #14b8a6); }
html[data-theme="clean"] .kpi.v3 { background: linear-gradient(135deg, #15803d, #22c55e); }
html[data-theme="clean"] .kpi.v4 { background: linear-gradient(135deg, #4338ca, #6366f1); }
html[data-theme="clean"] .kpi.v5 { background: linear-gradient(135deg, #475569, #64748b); }
html[data-theme="clean"] .chip.active { background: #0f766e; border-color: #0f766e; }
html[data-theme="clean"] .seg button.active { color: #0f766e; }
html[data-theme="clean"] .icon-btn { background: #eef6f1; color: #0f766e; }
html[data-theme="clean"] .nav-item .ico { opacity: .85; }

/* ---------- SUNSET (quente, terroso) ---------- */
html[data-theme="sunset"] {
  --ink: #3b2417;
  --ink-soft: #8a6a55;
  --line: #f0e2d5;
  --bg: #fdf8f3;
  --shadow: 0 10px 28px -16px rgba(120, 60, 20, .28);
  --grad-main: linear-gradient(135deg, #dc2626 0%, #f97316 55%, #f59e0b 100%);
  --grad-side: linear-gradient(180deg, #fdf1e6 0%, #fbe6d6 100%);
}
html[data-theme="sunset"] body { background: #fdf8f3; color: #3b2417; }
html[data-theme="sunset"] .sidebar {
  background: #fdf1e6; border-right: 1px solid #f2ddc9; color: #6b4227;
}
html[data-theme="sunset"] .brand-name { color: #3b2417; }
html[data-theme="sunset"] .brand-sub { color: #b5855c; }
html[data-theme="sunset"] .brand-mark { background: linear-gradient(135deg, #dc2626, #f59e0b); box-shadow: 0 8px 18px -8px #f97316; }
html[data-theme="sunset"] .nav-label { color: #c19a72; }
html[data-theme="sunset"] .nav-item { color: #7a5233; }
html[data-theme="sunset"] .nav-item:hover { background: #fbe3cf; color: #3b2417; }
html[data-theme="sunset"] .nav-item.active {
  background: linear-gradient(90deg, #f97316, #dc2626); color: #fff;
  box-shadow: 0 8px 18px -10px #ea580c;
}
html[data-theme="sunset"] .side-card { background: #fbe9d8; border: 1px solid #f2d8bf; }
html[data-theme="sunset"] .side-card h4 { color: #3b2417; }
html[data-theme="sunset"] .side-card p { color: #8a6a55; }
html[data-theme="sunset"] .side-user .who { color: #3b2417; }
html[data-theme="sunset"] .side-user .mail { color: #a97c56; }
html[data-theme="sunset"] .card { border-color: #f6e9dc; }
html[data-theme="sunset"] .kpi.v1 { background: linear-gradient(135deg, #dc2626, #f43f5e); }
html[data-theme="sunset"] .kpi.v2 { background: linear-gradient(135deg, #ea580c, #fb923c); }
html[data-theme="sunset"] .kpi.v3 { background: linear-gradient(135deg, #d97706, #fbbf24); }
html[data-theme="sunset"] .kpi.v4 { background: linear-gradient(135deg, #a16207, #ca8a04); }
html[data-theme="sunset"] .kpi.v5 { background: linear-gradient(135deg, #7c2d12, #b45309); }
html[data-theme="sunset"] .chip.active { background: #ea580c; border-color: #ea580c; }
html[data-theme="sunset"] .seg button.active { color: #c2410c; }
html[data-theme="sunset"] .icon-btn { background: #fdeee0; color: #c2410c; }

/* ---------- OCEAN (azul profundo, corporativo) ---------- */
html[data-theme="ocean"] {
  --ink: #0f2540;
  --ink-soft: #5b7492;
  --line: #e1eaf3;
  --bg: #f4f8fc;
  --shadow: 0 10px 28px -18px rgba(12, 45, 80, .3);
  --grad-main: linear-gradient(135deg, #0c4a6e 0%, #0284c7 55%, #06b6d4 100%);
  --grad-side: linear-gradient(180deg, #0c3350 0%, #12496e 100%);
}
html[data-theme="ocean"] body { background: #f4f8fc; color: #0f2540; }
html[data-theme="ocean"] .sidebar {
  background: linear-gradient(180deg, #0c3350 0%, #12496e 100%); color: #cfe4f5;
}
html[data-theme="ocean"] .brand-name { color: #fff; }
html[data-theme="ocean"] .brand-sub { color: #7fb2d6; }
html[data-theme="ocean"] .brand-mark { background: linear-gradient(135deg, #0284c7, #22d3ee); box-shadow: 0 8px 18px -8px #0ea5e9; }
html[data-theme="ocean"] .nav-label { color: #6ba3c9; }
html[data-theme="ocean"] .nav-item { color: #bcd8ec; }
html[data-theme="ocean"] .nav-item:hover { background: rgba(255, 255, 255, .09); color: #fff; }
html[data-theme="ocean"] .nav-item.active {
  background: rgba(255, 255, 255, .16); color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .2);
}
html[data-theme="ocean"] .side-card { background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .16); }
html[data-theme="ocean"] .side-card h4 { color: #fff; }
html[data-theme="ocean"] .side-card p { color: #bcd8ec; }
html[data-theme="ocean"] .side-user .who { color: #fff; }
html[data-theme="ocean"] .side-user .mail { color: #8fbcdb; }
html[data-theme="ocean"] .card { border-color: #e8f0f8; }
html[data-theme="ocean"] .kpi.v1 { background: linear-gradient(135deg, #075985, #0284c7); }
html[data-theme="ocean"] .kpi.v2 { background: linear-gradient(135deg, #0e7490, #06b6d4); }
html[data-theme="ocean"] .kpi.v3 { background: linear-gradient(135deg, #1d4ed8, #3b82f6); }
html[data-theme="ocean"] .kpi.v4 { background: linear-gradient(135deg, #4338ca, #6366f1); }
html[data-theme="ocean"] .kpi.v5 { background: linear-gradient(135deg, #155e75, #0891b2); }
html[data-theme="ocean"] .chip.active { background: #0284c7; border-color: #0284c7; }
html[data-theme="ocean"] .seg button.active { color: #0284c7; }
html[data-theme="ocean"] .icon-btn { background: #eaf4fb; color: #0284c7; }
html[data-theme="ocean"] .nav-item .ico { filter: saturate(.9); }

/* ---------- seletor de tema (Configurações) ---------- */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.theme-card {
  border: 2px solid var(--line); border-radius: 14px; padding: 10px; cursor: pointer;
  background: var(--white); transition: .18s; text-align: left;
}
.theme-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.theme-card.sel { border-color: #7c3aed; box-shadow: 0 0 0 3px rgba(124, 58, 237, .18); }
.theme-preview { height: 62px; border-radius: 9px; overflow: hidden; display: flex; margin-bottom: 8px; }
.theme-preview .tp-side { width: 30%; }
.theme-preview .tp-main { flex: 1; padding: 7px; display: flex; flex-direction: column; gap: 5px; }
.theme-preview .tp-bar { height: 7px; border-radius: 3px; }
.theme-name { font-size: 12.5px; font-weight: 800; color: var(--ink); }
.theme-desc { font-size: 10.5px; color: var(--ink-soft); margin-top: 2px; }

/* ---------- plataformas (lista em coluna única) ---------- */
.net-list { display: flex; flex-direction: column; gap: 7px; }
.net-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: 12px; cursor: pointer;
  background: var(--bg); border: 1px solid var(--line); transition: .15s;
}
.net-row:hover { border-color: #d7cdf0; transform: translateX(2px); }
.net-row.sel { border-color: var(--violet); box-shadow: inset 3px 0 0 var(--violet); }
.net-dot { width: 11px; height: 11px; border-radius: 50%; flex: 0 0 11px; }
.net-name {
  font-size: 13.5px; font-weight: 800; color: var(--ink);
  flex: 1; min-width: 130px; display: flex; align-items: center; gap: 7px;
}
.net-fixed {
  font-size: 9px; text-transform: uppercase; letter-spacing: .07em; font-weight: 700;
  color: var(--ink-soft); background: var(--white); border: 1px solid var(--line);
  padding: 1px 6px; border-radius: 20px;
}
.net-stats { font-size: 11.5px; color: var(--ink-soft); white-space: nowrap; }
.net-stats b { color: var(--ink); font-weight: 800; }
.net-sep { margin: 0 4px; opacity: .5; }
.net-slug {
  font-family: ui-monospace, Menlo, monospace; font-size: 10px; color: var(--ink-soft);
  background: var(--white); padding: 2px 7px; border-radius: 6px; border: 1px solid var(--line);
  white-space: nowrap;
}
.net-actions { display: flex; gap: 4px; }
.net-actions .icon-btn { width: 28px; height: 28px; font-size: 12px; border-radius: 8px; }
.net-colors { display: flex; gap: 5px; flex-wrap: wrap; }
.net-color-btn {
  width: 24px; height: 24px; border-radius: 7px; border: 2px solid transparent;
  cursor: pointer; transition: .15s;
}
.net-color-btn:hover { transform: scale(1.12); border-color: var(--ink); }
.net-badge { border: 0; }
html[data-theme="midnight"] .net-row { background: #12162b; border-color: #262b47; }
html[data-theme="midnight"] .net-row:hover { border-color: #3b4370; }
html[data-theme="midnight"] .net-fixed,
html[data-theme="midnight"] .net-slug { background: #1b2038; border-color: #2a3050; }

@media (max-width: 700px) {
  .net-row { flex-wrap: wrap; }
  .net-slug { display: none; }
}

/* ---------- cofre de credenciais ---------- */
.pass-mask {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 12px; letter-spacing: .06em;
  min-width: 76px; display: inline-block;
}
html[data-theme="midnight"] .pass-mask { color: #c7cdf0; }

/* ===== Seção de página de presell dentro do formulário de produto ===== */
.form-section {
  margin: 18px 0 4px;
  padding: 15px 16px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2, rgba(124, 58, 237, .045));
}
.fs-head { margin-bottom: 12px; }
.fs-title { font-size: 13.5px; font-weight: 800; color: var(--ink); }
.fs-opt { font-weight: 600; font-size: 11.5px; color: var(--ink-soft); }
.fs-sub { font-size: 11.8px; color: var(--ink-soft); line-height: 1.5; margin-top: 3px; }
.check-row { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 10px; }
.checkline {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12.5px; font-weight: 600; color: var(--ink-soft); cursor: pointer;
}
.checkline input { width: 15px; height: 15px; accent-color: var(--violet); cursor: pointer; }
.page-live {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 12px; color: var(--ink-soft);
}
.page-live a { color: var(--violet); font-weight: 700; }
html[data-theme="midnight"] .form-section {
  background: rgba(124, 58, 237, .1);
  border-color: rgba(148, 163, 184, .18);
}

/* seletor de tipo dentro da tabela de páginas */
.kind-select {
  font-size: 11.5px; padding: 6px 8px; min-width: 168px;
  background: var(--surface, rgba(255, 255, 255, .04));
}

/* ---------- página Planos (rascunho Kiwify) ---------- */
.plans-notice {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 13px 15px; margin-bottom: 16px;
  border: 1px solid var(--line); border-radius: 14px;
  background: var(--white); color: var(--ink);
}
.plans-notice p { font-size: 12.5px; line-height: 1.55; color: var(--ink-soft); }
.plans-notice strong { color: var(--ink); }
.plans-notice-icon {
  width: 22px; height: 22px; flex: 0 0 22px; display: grid; place-items: center;
  border-radius: 50%; border: 1px solid var(--line); background: var(--bg);
  color: var(--ink); font-size: 12px; font-weight: 800;
}
.plan-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch; gap: 16px;
}
.plan-card {
  display: flex; flex-direction: column; min-width: 0; overflow: hidden;
  padding: 0; border-color: var(--line); transition: transform .18s, box-shadow .18s;
}
.plan-card:hover { transform: translateY(-2px); }
.plan-card::before { content: ""; display: block; height: 4px; flex: 0 0 4px; background: var(--grad-main); }
.plan-card-featured { box-shadow: inset 0 0 0 1px var(--ink-soft), var(--shadow); }
.plan-card-featured::before { height: 5px; flex-basis: 5px; }
.plan-card-head { padding: 18px 19px 16px; background: var(--white); }
.plan-card-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.plan-kicker { color: var(--ink-soft); font-size: 10.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.plan-draft-badge {
  display: inline-flex; align-items: center; min-height: 23px; padding: 3px 8px;
  border: 1px solid var(--line); border-radius: 20px; background: var(--bg);
  color: var(--ink-soft); font-size: 9.5px; font-weight: 800; white-space: nowrap;
}
.plan-name { margin-top: 13px; color: var(--ink); font-size: 24px; font-weight: 900; }
.plan-description { min-height: 61px; margin-top: 7px; color: var(--ink-soft); font-size: 12.5px; line-height: 1.55; }
.plan-price { margin-top: 15px; color: var(--ink); font-size: 18px; font-weight: 900; }
.plan-price span { color: var(--ink-soft); font-size: 10.5px; font-weight: 600; }
.plan-card-body {
  display: flex; flex: 1; flex-direction: column;
  padding: 15px 19px 19px; border-top: 1px solid var(--line); background: var(--white);
}
.plan-includes { margin-bottom: 12px; color: var(--ink); font-size: 11.5px; font-weight: 800; }
.plan-feature-list { display: grid; gap: 10px; margin: 0 0 20px; padding: 0; list-style: none; }
.plan-feature-list li { display: flex; align-items: flex-start; gap: 9px; color: var(--ink-soft); font-size: 11.8px; line-height: 1.45; }
.plan-feature-list li::before {
  content: "✓"; flex: 0 0 18px; width: 18px; height: 18px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 50%; background: var(--bg);
  color: var(--ink); font-size: 10px; font-weight: 900;
}
.plan-card .plan-checkout {
  width: 100%; justify-content: center; margin-top: auto; text-align: center;
}
.plan-card .plan-checkout:disabled {
  background: var(--bg); color: var(--ink-soft);
  box-shadow: inset 0 0 0 1px var(--line); opacity: 1; filter: none; cursor: not-allowed;
}
@media (max-width: 1020px) {
  .plan-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .plan-grid { grid-template-columns: 1fr; }
  .plan-description { min-height: 0; }
}
