/* ---------- Tokens ---------- */
:root, :root[data-theme="dark"] {
  --bg: #050b1a;
  --side: #071127;
  --surface: #0a1530;
  --surface-2: #0f1c3d;
  --line: #1a2a52;
  --text: #f1f5ff;
  --muted: #8b9bc0;
  --primary: #1d6ef5;
  --primary-2: #0ea5e9;
  --accent: #22b8f0;
  --ok: #22c55e;
  --warn: #f59e0b;
  --danger: #ef4444;
  --violet: #8b5cf6;
  --chip: #0d1a38;
  --shadow: 0 10px 30px rgb(0 0 0 / .35);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f3f6fc;
  --side: #ffffff;
  --surface: #ffffff;
  --surface-2: #f1f4fb;
  --line: #e2e8f4;
  --text: #0b1430;
  --muted: #5b6b8f;
  --chip: #eef3ff;
  --shadow: 0 8px 24px rgb(15 30 70 / .08);
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font-family: Manrope, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
[hidden] { display: none !important; }
svg.i { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
.muted { color: var(--muted); }
.error { color: var(--danger); }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-box { width: 100%; max-width: 360px; text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 28px; }
.login-box h1 { margin: 14px 0 4px; font-size: 22px; }
.login-box input { margin: 18px 0 12px; }

/* ---------- Shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 264px; flex: 0 0 264px; background: var(--side); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
  padding: calc(16px + env(safe-area-inset-top)) 0 calc(12px + env(safe-area-inset-bottom));
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 20px 22px; }
.brand b { display: block; font-size: 17px; }
.brand span { font-size: 10px; letter-spacing: 2.5px; color: var(--muted); font-weight: 700; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; font-weight: 800; font-size: 20px;
  background: linear-gradient(135deg, #6d5dfc, #1d6ef5); color: #fff; flex: 0 0 auto;
}
.brand-mark.big { width: 64px; height: 64px; font-size: 30px; margin: 0 auto; border-radius: 18px; }
.nav { display: grid; gap: 6px; padding: 0 12px; overflow-y: auto; }
.nav a {
  display: flex; align-items: center; gap: 14px; padding: 13px 16px; border-radius: 12px;
  color: var(--muted); text-decoration: none; font-weight: 600; font-size: 15px;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--primary); color: #fff; box-shadow: 0 8px 22px rgb(29 110 245 / .35); }
.nav a .badge { margin-left: auto; }
.side-user {
  margin: auto 12px 0; display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--surface);
}
.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, #38bdf8, #1d6ef5); color: #fff; font-weight: 800; flex: 0 0 auto; }
.side-user-text { min-width: 0; flex: 1; }
.side-user-text b, .side-user-text span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user-text span { font-size: 12px; color: var(--muted); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 14px;
  padding: calc(12px + env(safe-area-inset-top)) 28px 12px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.goal { display: flex; align-items: center; gap: 12px; flex: 1; max-width: 560px; min-width: 0; }
.goal-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--chip); color: var(--accent); flex: 0 0 auto; }
.goal-body { flex: 1; min-width: 0; }
.goal-line { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; white-space: nowrap; }
.goal-line span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.goal-line span b { color: var(--text); }
.goal-bar { height: 5px; border-radius: 99px; background: var(--line); margin-top: 6px; overflow: hidden; }
.goal-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 99px; transition: width .5s; }
.top-actions { margin-left: auto; display: flex; gap: 6px; }
.icon-btn {
  width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px;
  background: transparent; border: 1px solid transparent; cursor: pointer; color: var(--text);
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn.ghost { color: var(--muted); }
.menu-btn { display: none; }
.view { padding: 32px 28px 60px; max-width: 1500px; width: 100%; }

@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 30; transform: translateX(-100%); transition: transform .25s; }
  .shell.menu-open .sidebar { transform: none; }
  .scrim { position: fixed; inset: 0; background: rgb(0 0 0 / .5); z-index: 20; display: none; }
  .shell.menu-open .scrim { display: block; }
  .menu-btn { display: grid; }
  .topbar { padding-left: 12px; padding-right: 12px; gap: 8px; }
  .view { padding: 20px 16px 60px; }
}

/* ---------- Page header ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.eyebrow { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 800; letter-spacing: 2px; color: var(--muted); text-transform: uppercase; }
.eyebrow svg.i { width: 13px; height: 13px; color: var(--accent); }
.pill-live { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border: 1px solid var(--line); border-radius: 99px; font-size: 12px; color: var(--muted); }
.page-head h1 { font-size: 32px; margin: 6px 0 4px; letter-spacing: -.5px; }
.page-head p { margin: 0; color: var(--muted); }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Cards / grids ---------- */
.grid { display: grid; gap: 16px; }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-hero { grid-template-columns: 2fr 1.2fr 1.2fr; }
.g-main { grid-template-columns: 1.45fr 1fr; }
@media (max-width: 1200px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-hero { grid-template-columns: 1fr 1fr; } .g-hero > :first-child { grid-column: 1 / -1; } }
@media (max-width: 900px) { .g-main, .g3 { grid-template-columns: 1fr; } }
@media (max-width: 560px) {
  .g2, .g-hero { grid-template-columns: 1fr; }
  .g4 { gap: 10px; }
  .g4 > .card { padding: 14px; }
  .kpi .k-val { font-size: 20px; }
  .kpi .k-top { font-size: 10.5px; letter-spacing: .3px; }
  .kpi .k-top .ico { display: none; }
  .hero .big { font-size: 44px; margin-top: 34px; }
  .page-head h1 { font-size: 26px; }
}
.mt { margin-top: 16px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 20px; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.card-head h3 { margin: 2px 0 0; font-size: 17px; }
.card.flush { padding: 0; }
.card.flush > .card-head { padding: 18px 20px; margin: 0; border-bottom: 1px solid var(--line); }
.card-body { padding: 18px 20px; }
.label { font-size: 11px; font-weight: 800; letter-spacing: 1.8px; color: var(--muted); text-transform: uppercase; }

.hero {
  position: relative; overflow: hidden; border: 0; color: #fff; min-height: 240px;
  background: radial-gradient(120% 140% at 100% 100%, #38bdf8 0%, #2563eb 45%, #1d4ed8 100%);
}
.hero .label { color: rgb(255 255 255 / .85); }
.hero .big { font-size: 56px; font-weight: 800; letter-spacing: -1.5px; margin: 46px 0 6px; line-height: 1; }
.hero .live { position: absolute; top: 18px; right: 20px; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 99px; background: rgb(255 255 255 / .2); }
.hero .live::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #4ade80; margin-right: 6px; vertical-align: 1px; }
.hero .delta { display: inline-block; margin-left: 10px; padding: 2px 9px; border-radius: 99px; background: rgb(255 255 255 / .18); font-size: 12px; font-weight: 700; }
.hero small { display: block; margin-top: 12px; font-size: 13px; }

.stat-card .card-head .ico, .kpi .ico {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--chip); color: var(--accent);
}
.ico.gold { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #fff; }
.stat-big { font-size: 34px; font-weight: 800; margin: 4px 0 2px; color: var(--accent); }
.stat-big.gold { color: var(--text); }
.progress { height: 6px; border-radius: 99px; background: var(--line); margin: 14px 0; overflow: hidden; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); }
.mini-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mini { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.mini b { display: block; font-size: 16px; }
.mini span { font-size: 12px; color: var(--muted); }
.mini.accent b { color: var(--accent); }
.mini.gold b { color: var(--warn); }

.kpi { display: flex; flex-direction: column; gap: 6px; }
.kpi .k-top { display: flex; align-items: center; gap: 10px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
.kpi .k-top .ico { width: 30px; height: 30px; border-radius: 8px; }
.kpi .k-top .ico svg.i { width: 15px; height: 15px; }
.kpi .k-val { font-size: 26px; font-weight: 800; }
.kpi .k-sub { font-size: 12px; color: var(--muted); }
.k-val.blue { color: var(--accent); } .k-val.green { color: var(--ok); } .k-val.gold { color: var(--warn); } .k-val.red { color: var(--danger); }
.ico.green { color: var(--ok); } .ico.gold-t { color: var(--warn); } .ico.red { color: var(--danger); background: rgb(239 68 68 / .12); } .ico.gray { color: var(--muted); }

/* method rows */
.method { display: grid; grid-template-columns: 36px 1fr auto; gap: 12px; align-items: center; margin-bottom: 6px; }
.method .ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--primary); color: #fff; }
.method .ico.cy { background: var(--primary-2); }
.method b { display: block; }
.method span { font-size: 12px; color: var(--muted); }
.method .pct { color: var(--accent); font-weight: 800; }
.method + .progress { margin: 4px 0 18px; }

/* ---------- Forms / controls ---------- */
input, select, textarea {
  width: 100%; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text); font-size: 14px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgb(29 110 245 / .2); }
textarea { min-height: 80px; resize: vertical; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 11px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); }
.field small { color: var(--muted); font-size: 12px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.search { position: relative; }
.search svg.i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { padding-left: 38px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); font-weight: 700; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--primary-2); border-color: var(--primary-2); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); }
.btn.sm { padding: 6px 10px; font-size: 13px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn svg.i { width: 16px; height: 16px; }

.filters { display: grid; grid-template-columns: 2fr repeat(4, minmax(130px, 1fr)); gap: 12px; }
@media (max-width: 1100px) { .filters { grid-template-columns: 1fr 1fr; } .filters .search { grid-column: 1 / -1; } }

.toggle { position: relative; width: 44px; height: 24px; flex: 0 0 auto; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle i { position: absolute; inset: 0; border-radius: 99px; background: var(--line); cursor: pointer; transition: .2s; }
.toggle i::after { content: ''; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: .2s; }
.toggle input:checked + i { background: var(--primary-2); }
.toggle input:checked + i::after { transform: translateX(20px); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }

.tabbar { display: flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow-x: auto; margin-bottom: 18px; }
.tabbar button { padding: 9px 16px; border-radius: 9px; border: 1px solid transparent; background: none; color: var(--muted); font-weight: 600; cursor: pointer; white-space: nowrap; }
.tabbar button.active { background: var(--bg); border-color: var(--line); color: var(--text); font-weight: 800; }
.underline-tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.underline-tabs button { padding: 10px 16px; background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted); cursor: pointer; font-weight: 600; white-space: nowrap; }
.underline-tabs button.active { color: var(--text); border-color: var(--primary); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip-btn { padding: 8px 14px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); cursor: pointer; font-weight: 600; }
.chip-btn.active { border-color: var(--primary-2); color: #fff; background: var(--primary-2); }
.chip-btn:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); font-weight: 800; padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 13px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--surface-2); }
td .sub { display: block; font-size: 12px; color: var(--muted); }
.r { text-align: right; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 99px; font-size: 11px; font-weight: 800; white-space: nowrap; }
.b-paid { background: rgb(34 197 94 / .14); color: var(--ok); }
.b-pending { background: rgb(14 165 233 / .14); color: var(--accent); }
.b-abandoned { background: rgb(245 158 11 / .14); color: var(--warn); }
.b-failed, .b-off { background: rgb(239 68 68 / .14); color: var(--danger); }
.b-refunded { background: rgb(139 92 246 / .16); color: var(--violet); }
.b-started { background: var(--chip); color: var(--muted); }
.b-on { background: rgb(34 197 94 / .14); color: var(--ok); }

.empty { border: 1px dashed var(--line); border-radius: 14px; padding: 46px 20px; text-align: center; color: var(--muted); }
.empty .e-ico { width: 48px; height: 48px; margin: 0 auto 12px; border-radius: 12px; background: var(--chip); display: grid; place-items: center; color: var(--accent); }
.empty b { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }

/* ---------- Accordion (gateways) ---------- */
.acc { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--surface); }
.acc-item + .acc-item { border-top: 1px solid var(--line); }
.acc-head { display: flex; align-items: center; gap: 14px; padding: 16px 18px; cursor: pointer; }
.acc-head b { font-size: 16px; }
.acc-head .chev { margin-left: auto; color: var(--muted); transition: transform .2s; }
.acc-item.open .chev { transform: rotate(180deg); }
.acc-body { padding: 4px 18px 20px; display: none; }
.acc-item.open .acc-body { display: block; }
.logo-sq { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; background: var(--bg); border: 1px solid var(--line); font-weight: 800; font-size: 12px; color: var(--accent); flex: 0 0 auto; }
.logo-sq.lg { width: 56px; height: 56px; border-radius: 14px; font-size: 15px; }

.integration { position: relative; overflow: hidden; }
.integration::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--bar, var(--primary)); }
.int-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 16px; }
.int-head h3 { margin: 0; font-size: 17px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.int-head p { margin: 4px 0 0; color: var(--muted); }
.tag { font-size: 11px; padding: 2px 8px; border: 1px solid var(--line); border-radius: 99px; font-weight: 600; color: var(--muted); }
.note { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.note b { color: var(--text); }
.code-box { display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; }
.code-box code { flex: 1; overflow-x: auto; white-space: nowrap; }
.row-list { display: grid; gap: 8px; }
.row-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.row-item code { font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 700; }

/* diagnostics */
.diag { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; }
@media (max-width: 760px) { .diag { grid-template-columns: 1fr; } }
.diag-item { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.diag-item b { display: block; font-weight: 700; }
.diag-item small { color: var(--muted); }
.diag-item .st { margin-left: auto; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: var(--bg); color: var(--muted); }
.diag-item.ok svg.i { color: var(--accent); }
.diag-item.warn svg.i { color: var(--warn); }
.diag-item.err svg.i { color: var(--danger); }

/* ---------- Product cards ---------- */
.prod { display: flex; flex-direction: column; gap: 12px; }
.prod-top { display: flex; gap: 12px; align-items: center; }
.prod-img { width: 56px; height: 56px; border-radius: 12px; object-fit: cover; background: var(--chip); flex: 0 0 auto; display: grid; place-items: center; color: var(--accent); }
.prod-top b { display: block; font-size: 16px; }
.prod-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Charts ---------- */
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font-size: 11px; font-family: inherit; }
.chart .grid-line { stroke: var(--line); stroke-dasharray: 3 4; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.hbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; margin-bottom: 12px; }
.hbar .bar { grid-column: 1 / -1; height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; }
.hbar .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); }
.hbar span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Modal / toast ---------- */
.modal-bg { position: fixed; inset: 0; z-index: 50; background: rgb(2 6 20 / .65); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; }
.modal { width: 100%; max-width: 640px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; }
.modal-body { padding: 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60; background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 12px; font-weight: 700; box-shadow: var(--shadow); max-width: calc(100% - 32px); }
.toast.err { background: var(--danger); color: #fff; }
.section-title { display: flex; align-items: center; gap: 8px; font-size: 16px; margin: 0 0 14px; }

/* Abandonos */
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; flex: 0 0 auto; }
.dot.ok { background: var(--ok); }
.dot.no { background: var(--danger); }
.dot.live { background: var(--warn); box-shadow: 0 0 0 0 rgb(245 158 11 / .6); animation: pulse 1.6s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgb(245 158 11 / 0); } 100% { box-shadow: 0 0 0 0 rgb(245 158 11 / 0); } }

.fee-grid { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; margin-top: 8px; }
@media (max-width: 760px) { .fee-grid { grid-template-columns: 1fr 1fr !important; } }

/* Produtos (tabela estilo Lowify) */
.prod-table td { padding: 14px 16px; }
.prod-table .radio { display: inline-block; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--muted); opacity: .7; }
.prod-cell { display: flex; align-items: center; gap: 12px; min-width: 220px; max-width: 420px; }
.prod-cell img, .prod-cell .ph { width: 46px; height: 46px; border-radius: 9px; object-fit: cover; flex: 0 0 auto; background: var(--chip); display: grid; place-items: center; color: var(--accent); }
.prod-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.id-badge { display: inline-block; margin-top: 4px; padding: 1px 8px; border-radius: 6px; background: rgb(96 165 250 / .18); color: #93c5fd; font-size: 11px; font-weight: 700; }
:root[data-theme="light"] .id-badge { background: #dbeafe; color: #1d4ed8; }
.prod-table .sub svg.i { width: 12px; height: 12px; vertical-align: -2px; }
.pill-on, .pill-off { display: inline-block; padding: 5px 14px; border-radius: 9px; font-size: 12px; font-weight: 700; }
.pill-on { background: #bbf7d0; color: #166534; }
.pill-off { background: var(--chip); color: var(--muted); }
.link-cell { display: inline-flex; align-items: center; gap: 4px; max-width: 220px; padding: 4px 4px 4px 12px; border-radius: 9px; background: var(--bg); border: 1px solid var(--line); }
.link-cell code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-family: inherit; }
.prod-table .icon-btn { width: 34px; height: 34px; display: inline-grid; }

/* Período personalizado */
.period-custom { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.period-custom select { width: auto; min-width: 150px; }
.period-custom input[type="date"] { width: auto; padding: 9px 10px; color-scheme: dark; }
:root[data-theme="light"] .period-custom input[type="date"] { color-scheme: light; }
.filters .period-custom { grid-column: 1 / -1; }
.lt-products { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; max-height: 260px; overflow-y: auto; }
.lt-products .switch-row { justify-content: flex-start; gap: 10px; padding: 9px 12px; font-size: 13px; }

/* ===== Phone app (estilo app Lowify) ===== */
.m-app { min-height: 100vh; background: #0d1117; color: #f5f7fb; }
:root[data-theme="light"] .m-app { background: #f6f8fb; color: #0b1430; }
.m-main { padding: calc(env(safe-area-inset-top) + 24px) 0 calc(env(safe-area-inset-bottom) + 96px); }
.m-main > :not(.m-chart-wrap) { margin-left: 20px; margin-right: 20px; }
.m-title { font-size: 36px; font-weight: 800; letter-spacing: -.5px; margin: 8px 0 2px; }
.m-sub { color: #8b93a7; font-size: 17px; margin: 0 0 22px; }
.m-filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 30px; }
.m-chip { display: inline-flex; align-items: center; gap: 10px; height: 52px; padding: 0 18px; border-radius: 16px; background: #161b24; border: 1px solid #222a37; color: #f5f7fb; font-size: 17px; font-weight: 600; }
:root[data-theme="light"] .m-chip { background: #fff; border-color: #e2e8f4; color: #0b1430; }
.m-chip svg.i { width: 20px; height: 20px; color: #8b93a7; }
.m-select { position: relative; padding-right: 14px; }
.m-select select { appearance: none; -webkit-appearance: none; background: transparent; border: 0; color: inherit; font: inherit; padding: 0 22px 0 0; width: auto; box-shadow: none; }
.m-select > svg.i:last-of-type { position: absolute; right: 14px; pointer-events: none; width: 16px; height: 16px; }
.m-select .period-custom { gap: 6px; }
.m-select .period-custom input[type="date"] { background: transparent; border: 0; color: inherit; padding: 4px 0; font-size: 14px; width: 128px; }
.m-select .period-custom .muted { font-size: 13px; }
.m-big { text-align: center; font-size: clamp(44px, 14vw, 64px); font-weight: 800; letter-spacing: -1.5px; line-height: 1.05; }
.m-count { text-align: center; color: #8b93a7; font-size: 20px; margin-top: 8px; }
.m-chart-wrap { margin-top: 36px; height: 300px; }
.m-chart { width: 100%; height: 100%; display: block; }
.m-tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(4, 1fr); padding: 14px 0 calc(env(safe-area-inset-bottom) + 14px); background: #0d1117; border-top: 1px solid #1f2633; }
:root[data-theme="light"] .m-tabs { background: #fff; border-color: #e2e8f4; }
.m-tabs button { background: none; border: 0; color: #7d869a; display: grid; place-items: center; cursor: pointer; padding: 6px 0; }
.m-tabs button svg.i { width: 32px; height: 32px; stroke-width: 1.8; }
.m-tabs button.active { color: #3b82f6; }
.m-list { display: grid; gap: 10px; }
.m-item { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 16px; background: #161b24; border: 1px solid #222a37; cursor: pointer; }
:root[data-theme="light"] .m-item { background: #fff; border-color: #e2e8f4; }
.m-item-ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: rgb(59 130 246 / .15); color: #3b82f6; flex: 0 0 auto; }
.m-item-img { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; flex: 0 0 auto; }
.m-item-main { flex: 1; min-width: 0; }
.m-item-main b, .m-item-main span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-item-main b { font-size: 16px; }
.m-item-main span, .m-item-val span { color: #8b93a7; font-size: 13px; }
.m-item-val { text-align: right; flex: 0 0 auto; }
.m-item-val b { display: block; font-size: 16px; }
.m-item-val span svg.i { width: 16px; height: 16px; }
.m-empty { text-align: center; color: #8b93a7; padding: 40px 0; }

/* ---------- Product editor (tabs) + "Personalizar aparência" ---------- */
.modal.wide { max-width: 780px; }
.pe-box { background: var(--surface-2); margin-bottom: 14px; padding: 16px; }
.pe-box-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.pe-box-head b { display: flex; gap: 8px; align-items: center; }
.pe-box .switch-row { background: var(--surface); }
.pe-box textarea { resize: vertical; }
.img-pick { display: flex; gap: 12px; align-items: flex-start; }
.img-pick > img, .img-ph { width: 76px; height: 76px; border-radius: 10px; object-fit: cover; border: 1px solid var(--line); background: var(--surface); flex: 0 0 auto; display: grid; place-items: center; color: var(--muted); }
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.img-cell { position: relative; aspect-ratio: 16 / 10; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--surface); }
.img-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-cell b { position: absolute; left: 6px; top: 6px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: rgb(0 0 0 / .65); color: #fff; font-size: 11px; display: grid; place-items: center; }
.img-cell .icon-btn { position: absolute; right: 4px; top: 4px; width: 28px; height: 28px; background: rgb(0 0 0 / .6); color: #fff; border: 0; }
.img-add { aspect-ratio: 16 / 10; border: 1.5px dashed var(--line); border-radius: 10px; background: none; color: var(--muted); display: grid; place-content: center; justify-items: center; gap: 4px; cursor: pointer; font-weight: 600; font-size: 12px; }
.img-add:hover { border-color: var(--primary); color: var(--text); }
.color-list { display: grid; gap: 8px; margin-bottom: 14px; }
.color-row { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; margin-bottom: 8px; }
.color-list .color-row { margin-bottom: 0; }
.color-row input[type=color] { width: 30px; height: 30px; padding: 0; border: 1px solid var(--line); border-radius: 7px; background: none; cursor: pointer; flex: 0 0 auto; }
.color-row span { flex: 1; font-size: 13px; font-weight: 600; }
.color-row code { font-size: 12px; color: var(--muted); }
body.no-scroll { overflow: hidden; }
.styler { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; background: var(--bg); color: var(--text); }
.st-top { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--surface); flex-wrap: wrap; }
.st-title { display: grid; line-height: 1.25; min-width: 0; }
.st-title small { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.st-main { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 380px; }
.st-stage { min-height: 0; overflow: auto; display: flex; justify-content: center; padding: 22px; background: color-mix(in srgb, var(--bg) 85%, #000); }
.st-device { width: 420px; max-width: 100%; height: 100%; min-height: 560px; border-radius: 18px; overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow); background: #fff; transition: width .2s; }
.st-device.desktop { width: 100%; }
.st-device iframe { width: 100%; height: 100%; border: 0; display: block; }
.st-side { min-height: 0; display: flex; flex-direction: column; border-left: 1px solid var(--line); background: var(--surface); }
.st-side .tabbar { margin: 12px 12px 0; }
.st-side .tabbar { overflow: visible; }
.st-side .tabbar button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 6px; }
#st-panel { flex: 1; overflow-y: auto; padding: 12px; }
@media (max-width: 900px) {
  .st-main { grid-template-columns: 1fr; grid-template-rows: 46vh 1fr; }
  .st-side { border-left: 0; border-top: 1px solid var(--line); }
  .st-stage { padding: 10px; }
  .st-device { min-height: 0; }
}

/* ---------- Order Bumps / Upsells pages ---------- */
.card-head-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-head-row b { display: flex; align-items: center; gap: 8px; }
.form-grid.three { grid-template-columns: 1fr 1fr 1fr; }
.offer-editor { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.field-label { display: block; font-size: 11px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.bump-preview { padding: 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.bp-card { display: grid; grid-template-columns: 52px 1fr; gap: 12px; padding: 14px; border-radius: 12px; background: #f8fafc; border: 1px solid #cbd5e1; color: #0f172a; }
.bp-card img, .bp-ph { width: 52px; height: 52px; border-radius: 9px; object-fit: cover; background: #e2e8f0; display: grid; place-items: center; color: #64748b; }
.bp-card b { font-size: 14px; }
.bp-card p { margin: 4px 0 10px; font-size: 12.5px; color: #64748b; }
.bp-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.bp-foot > span:first-child { color: #16a34a; font-weight: 800; font-size: 14px; white-space: nowrap; }
.bp-btn { white-space: nowrap; }
.bp-btn { display: inline-flex; align-items: center; gap: 4px; padding: 6px 10px; border-radius: 8px; border: 1px solid #e2e8f0; background: #fff; font-size: 12px; font-weight: 700; }
.bp-btn svg.i { width: 13px; height: 13px; }
.trig-box { max-height: 168px; overflow-y: auto; display: grid; gap: 2px; padding: 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.trig { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 7px; cursor: pointer; font-size: 13px; }
.trig:hover { background: var(--surface); }
.trig input { width: 16px; height: 16px; flex: 0 0 auto; }
.pill-btn { border: 0; cursor: pointer; font: inherit; }
@media (max-width: 860px) {
  .offer-editor { grid-template-columns: 1fr; }
  .form-grid.three { grid-template-columns: 1fr; }
}
#upeditor .st-side .tabbar { margin: 12px 12px 0; overflow: visible; }
#upeditor .st-side .tabbar button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 6px; }
