:root {
  --bg: #ffffff;
  --panel: #ffffff;
  --soft: #f6f7f9;
  --line: #eceef1;
  --text: #0f1115;
  --muted: #6b7280;
  --faint: #9ca3af;
  --accent: #3b9bff;
  --accent-2: #63b0ff;
  --accent-dark: #2687e6;
  --accent-bg: rgba(59, 155, 255, .08);
  --accent-soft: rgba(99, 176, 255, .45);
  --good: #16a34a;
  --good-bg: #effcf3;
  --warn: #b45309;
  --warn-bg: #fff8eb;
  --bad: #dc2626;
  --bad-bg: #fef2f2;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(15, 17, 21, .04), 0 8px 24px -12px rgba(15, 17, 21, .12);
  --shadow-lift: 0 2px 4px rgba(15, 17, 21, .04), 0 18px 40px -16px rgba(15, 17, 21, .22);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--bg); color: var(--text); }
body { font: 14px/1.5 "Inter", system-ui, -apple-system, sans-serif; -webkit-font-smoothing: antialiased; min-height: 100vh; }
a { color: var(--accent-dark); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--accent-soft); }

/* ---------- estrutura ---------- */
.top {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 20px;
  padding: 14px 28px;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 900; letter-spacing: -.02em; font-size: 16px; color: var(--text); }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  box-shadow: 0 6px 16px -6px rgba(59, 155, 255, .8);
}
.brand-mark svg { width: 14px; height: 14px; fill: #fff; margin-left: 2px; }
.brand small { font-weight: 600; color: var(--faint); font-size: 12px; letter-spacing: 0; }
.nav { display: flex; gap: 4px; margin-left: 12px; }
.nav a { padding: 8px 14px; border-radius: 10px; color: var(--muted); font-weight: 600; transition: background .2s, color .2s; }
.nav a:hover { background: var(--soft); color: var(--text); }
.nav a.on { background: var(--accent-bg); color: var(--accent-dark); }
.top .grow { flex: 1; }
.page { max-width: 1240px; margin: 0 auto; padding: 32px 28px 80px; animation: pageIn .6s var(--ease-out); }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 26px; flex-wrap: wrap; }
.page-head h1 { font-size: 28px; font-weight: 900; letter-spacing: -.035em; line-height: 1.1; }
.page-head p { color: var(--muted); margin-top: 6px; }
.page-head .grow { flex: 1; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 600; margin-bottom: 12px; font-size: 13px; }
.back:hover { color: var(--text); }

/* ---------- componentes ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line);
  background: #fff; font-weight: 700; cursor: pointer; white-space: nowrap;
  transition: transform .15s, box-shadow .2s, background .2s, border-color .2s;
}
.btn:hover { border-color: #dfe2e7; box-shadow: var(--shadow); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  border: 0; color: #fff;
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  box-shadow: 0 4px 0 var(--accent-dark), 0 12px 24px -10px rgba(59, 155, 255, .8);
}
.btn.primary:hover { box-shadow: 0 4px 0 var(--accent-dark), 0 16px 30px -10px rgba(59, 155, 255, .9); }
.btn.primary:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--accent-dark); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--soft); color: var(--text); box-shadow: none; }
.btn.danger { color: var(--bad); }
.btn.sm { height: 32px; padding: 0 12px; border-radius: 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 22px; }
.card h2 { font-size: 16px; font-weight: 800; letter-spacing: -.02em; }
.card .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.card-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.card-head .grow { flex: 1; }

.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1000px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 680px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } .page { padding: 22px 16px 60px; } .top { padding: 12px 16px; } }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .01em; }
.field small { color: var(--faint); font-size: 12px; }
.input, select.input, textarea.input {
  height: 40px; padding: 0 12px; border-radius: 11px; border: 1px solid var(--line); background: #fff;
  outline: none; transition: border-color .2s, box-shadow .2s; width: 100%;
}
textarea.input { height: auto; min-height: 76px; padding: 10px 12px; resize: vertical; line-height: 1.45; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-bg); }
.input.color { padding: 4px; width: 56px; cursor: pointer; }
.row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.row > .field { flex: 1; min-width: 140px; }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; font-weight: 600; }
.switch input { display: none; }
.switch i {
  width: 38px; height: 22px; border-radius: 99px; background: #e5e7eb; position: relative; transition: background .25s; flex: none;
}
.switch i::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transition: transform .35s var(--ease-spring);
}
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(16px); }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; background: var(--soft); color: var(--muted); }
.pill.good { background: var(--good-bg); color: var(--good); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.blue { background: var(--accent-bg); color: var(--accent-dark); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.dot.live { animation: livePulse 1.6s ease-in-out infinite; }

.tabs { display: flex; gap: 4px; padding: 4px; background: var(--soft); border-radius: 14px; width: fit-content; margin-bottom: 24px; flex-wrap: wrap; }
.tabs button { border: 0; background: transparent; padding: 8px 16px; border-radius: 10px; font-weight: 700; color: var(--muted); cursor: pointer; transition: background .2s, color .2s, box-shadow .2s; }
.tabs button.on { background: #fff; color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 4px 12px -6px rgba(0, 0, 0, .15); }

.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty h3 { color: var(--text); font-size: 18px; font-weight: 800; margin-bottom: 6px; }
.empty .btn { margin-top: 18px; }

table.t { width: 100%; border-collapse: collapse; }
.t th { text-align: left; font-size: 11px; font-weight: 800; color: var(--faint); text-transform: uppercase; letter-spacing: .06em; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.t td { padding: 11px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.t tr:last-child td { border-bottom: 0; }
.t td.num, .t th.num { text-align: right; font-variant-numeric: tabular-nums; }
.t tbody tr { transition: background .15s; }
.t tbody tr.click { cursor: pointer; }
.t tbody tr.click:hover { background: var(--soft); }
.t .bar-cell { position: relative; }
.t .bar-bg { position: absolute; inset: 6px auto 6px 0; background: var(--accent-bg); border-radius: 6px; z-index: 0; }
.t .bar-cell span { position: relative; }
.table-wrap { overflow-x: auto; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 100;
  background: #0f1115; color: #fff; padding: 12px 18px; border-radius: 14px; font-weight: 600;
  box-shadow: 0 18px 40px -12px rgba(0, 0, 0, .5); animation: toastIn .5s var(--ease-spring);
}
.toast.bad { background: var(--bad); }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(60% 50% at 50% 0%, rgba(99, 176, 255, .18), transparent 70%), #fff; }
.login .card { width: 100%; max-width: 380px; padding: 34px 30px; text-align: center; animation: pop .8s var(--ease-spring); }
.login .brand { justify-content: center; font-size: 20px; margin-bottom: 8px; }
.login .brand-mark { width: 40px; height: 40px; border-radius: 12px; }
.login p { color: var(--muted); margin-bottom: 22px; }
.login form { display: flex; flex-direction: column; gap: 12px; }
.login .err { color: var(--bad); font-weight: 600; font-size: 13px; }

/* ---------- lista de VSLs ---------- */
.vsl-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 18px; }
.vsl-card { overflow: hidden; cursor: pointer; transition: transform .35s var(--ease-out), box-shadow .35s; animation: fadeUp .6s var(--ease-out) both; }
.vsl-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lift); }
.vsl-thumb { height: 150px; background: #0b0b0c center/cover no-repeat; position: relative; }
.vsl-thumb::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 40%, rgba(0, 0, 0, .55)); }
.vsl-thumb .pill { position: absolute; top: 12px; left: 12px; z-index: 1; background: rgba(255, 255, 255, .9); backdrop-filter: blur(8px); }
.vsl-body { padding: 16px 18px 18px; }
.vsl-body h3 { font-size: 16px; font-weight: 800; letter-spacing: -.02em; }
.vsl-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px; }
.vsl-stats div { background: var(--soft); border-radius: 10px; padding: 8px 10px; }
.vsl-stats b { display: block; font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; }
.vsl-stats small { color: var(--muted); font-size: 11px; font-weight: 600; }

/* ---------- vídeos ---------- */
.drop {
  border: 2px dashed #dbe3ee; border-radius: var(--radius); padding: 34px 20px; text-align: center; cursor: pointer;
  transition: border-color .2s, background .2s, transform .3s var(--ease-out); background: #fbfcfe;
}
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-bg); }
.drop.over { transform: scale(1.01); }
.drop b { display: block; font-size: 16px; font-weight: 800; margin: 10px 0 4px; }
.drop span { color: var(--muted); }
.drop .ico { width: 52px; height: 52px; margin: 0 auto; border-radius: 16px; display: grid; place-items: center; background: linear-gradient(135deg, var(--accent-2), var(--accent)); box-shadow: 0 10px 24px -8px rgba(59, 155, 255, .8); }
.drop .ico svg { width: 24px; height: 24px; stroke: #fff; }
.vid-row { display: flex; align-items: center; gap: 16px; padding: 14px 18px; border-bottom: 1px solid var(--line); animation: fadeUp .5s var(--ease-out) both; }
.vid-row:last-child { border-bottom: 0; }
.vid-poster { width: 54px; height: 72px; border-radius: 10px; background: #0b0b0c center/cover; flex: none; }
.vid-row .grow { flex: 1; min-width: 0; }
.vid-row h4 { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vid-row .meta { color: var(--muted); font-size: 12px; margin-top: 2px; }
.prog { height: 6px; border-radius: 99px; background: var(--soft); overflow: hidden; margin-top: 8px; max-width: 360px; }
.prog i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent)); background-size: 200% 100%; animation: shimmer 2s linear infinite; transition: width .4s var(--ease-out); }

/* ---------- métricas ---------- */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 20px; }
.filters .input { height: 36px; width: auto; min-width: 130px; font-size: 13px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 6px 0 12px; border-radius: 99px; background: var(--accent-bg); color: var(--accent-dark); font-weight: 700; font-size: 12px; }
.chip button { border: 0; background: transparent; cursor: pointer; width: 20px; height: 20px; border-radius: 50%; color: inherit; display: grid; place-items: center; }
.chip button:hover { background: rgba(59, 155, 255, .15); }
.seg { display: inline-flex; background: var(--soft); border-radius: 12px; padding: 3px; }
.seg button { border: 0; background: transparent; height: 30px; padding: 0 12px; border-radius: 9px; font-weight: 700; font-size: 12px; color: var(--muted); cursor: pointer; }
.seg button.on { background: #fff; color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }

.kpi { padding: 18px 20px; position: relative; overflow: hidden; animation: fadeUp .6s var(--ease-out) both; }
.kpi small { color: var(--muted); font-weight: 700; font-size: 12px; display: flex; align-items: center; gap: 6px; }
.kpi b { display: block; font-size: 28px; font-weight: 900; letter-spacing: -.035em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi .foot { color: var(--muted); font-size: 12px; margin-top: 2px; }
.kpi .foot strong { color: var(--text); }
.kpi.hero { background: linear-gradient(160deg, #fff 30%, rgba(99, 176, 255, .12)); }
.kpi.hero b { color: var(--accent-dark); }

.funnel { display: flex; flex-direction: column; gap: 10px; }
.funnel-row { display: grid; grid-template-columns: 170px 1fr 120px; gap: 14px; align-items: center; }
.funnel-row .label { font-weight: 700; font-size: 13px; }
.funnel-row .track { height: 30px; background: var(--soft); border-radius: 10px; overflow: hidden; }
.funnel-row .fill { height: 100%; border-radius: 10px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transform-origin: left; animation: growX 1s var(--ease-out) both; min-width: 3px; }
.funnel-row .val { text-align: right; font-variant-numeric: tabular-nums; font-weight: 800; }
.funnel-row .val small { display: block; color: var(--muted); font-weight: 600; font-size: 11px; }
@media (max-width: 680px) { .funnel-row { grid-template-columns: 1fr 90px; } .funnel-row .track { grid-column: 1 / -1; order: 3; } }

.chart-box { position: relative; height: 320px; }
.chart-box.sm { height: 240px; }
.drops { display: flex; flex-direction: column; gap: 8px; }
.drop-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--soft); }
.drop-item .t { font-variant-numeric: tabular-nums; font-weight: 800; width: 90px; }
.drop-item .grow { flex: 1; color: var(--muted); font-size: 13px; }

/* ---------- configurar ---------- */
.cfg-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; align-items: start; }
@media (max-width: 1100px) { .cfg-layout { grid-template-columns: 1fr; } .preview { position: static !important; } }
.cfg-nav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.cfg-nav button { border: 1px solid var(--line); background: #fff; height: 32px; padding: 0 12px; border-radius: 99px; font-weight: 700; font-size: 12px; color: var(--muted); cursor: pointer; transition: all .2s; }
.cfg-nav button:hover { color: var(--text); border-color: #dfe2e7; }
.cfg-nav button.on { background: var(--text); border-color: var(--text); color: #fff; }
.section { margin-bottom: 16px; animation: fadeUp .5s var(--ease-out) both; }
.section .card-pad { display: flex; flex-direction: column; gap: 16px; }
.variant { border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 12px; background: #fcfcfd; position: relative; }
.variant-head { display: flex; align-items: center; gap: 10px; }
.variant-head .tag { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; font-weight: 900; font-size: 13px; background: var(--accent-bg); color: var(--accent-dark); }
.variant-head .grow { flex: 1; }
.list-add { border: 1.5px dashed #dbe3ee; background: transparent; border-radius: 14px; height: 44px; font-weight: 700; color: var(--muted); cursor: pointer; transition: all .2s; }
.list-add:hover { border-color: var(--accent); color: var(--accent-dark); background: var(--accent-bg); }
.help { color: var(--muted); font-size: 13px; line-height: 1.5; }
.help b { color: var(--text); }
.savebar {
  position: sticky; bottom: 18px; z-index: 20; display: flex; align-items: center; gap: 12px; margin-top: 18px;
  padding: 12px 14px 12px 18px; border-radius: 16px; background: #0f1115; color: #fff;
  box-shadow: 0 20px 40px -14px rgba(0, 0, 0, .5); animation: toastIn .45s var(--ease-spring);
}
.savebar .grow { flex: 1; font-weight: 600; }
.savebar .btn:not(.primary) { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .2); }
.preview { position: sticky; top: 90px; }
.preview .frame-wrap { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: #fff; height: 720px; box-shadow: var(--shadow); }
.preview iframe { width: 100%; height: 100%; border: 0; display: block; }
.preview-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-weight: 800; }
.preview-head .grow { flex: 1; }

/* ---------- testes ---------- */
.test-card { margin-bottom: 16px; animation: fadeUp .5s var(--ease-out) both; }
.winner-row td { background: var(--good-bg); }
.conf { display: inline-flex; align-items: center; gap: 8px; }
.conf .track { width: 70px; height: 6px; border-radius: 99px; background: var(--soft); overflow: hidden; }
.conf .track i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }

/* ---------- incorporar ---------- */
pre.code {
  background: #0f1115; color: #e5e7eb; border-radius: 14px; padding: 16px 18px; overflow-x: auto;
  font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; word-break: break-all;
}
pre.code .k { color: #63b0ff; }
.code-wrap { position: relative; }
.code-wrap .btn { position: absolute; top: 10px; right: 10px; background: rgba(255, 255, 255, .1); color: #fff; border-color: rgba(255, 255, 255, .15); }

.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--soft); border-top-color: var(--accent); animation: spin .8s linear infinite; margin: 60px auto; }

@keyframes pageIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(.94) translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 16px) scale(.96); } to { opacity: 1; transform: translate(-50%, 0); } }
.savebar { animation-name: fadeUp; }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes growX { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes livePulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
