/* Identidade visual dos paineis: menu lateral claro, destaque indigo, cartoes com borda fina, numeros em destaque. */
:root {
  --bg: #f6f7f9; --surface: #fff; --ink: #0f172a; --ink-2: #334155; --muted: #64748b; --faint: #94a3b8; --line: #e6e8ec;
  --accent: #4a2fbd; --accent-2: #6d4be0; --accent-soft: #eef0ff;
  --ok: #059669; --ok-soft: #e4f6ee; --warn: #b45309; --warn-soft: #fdf3e1; --bad: #dc2626; --bad-soft: #fdeceb;
  --radius: 14px; --side: 248px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--ink); font: 14.5px/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.grow { flex: 1; }
button { font: inherit; }

/* ---------- entrada (login) */
.gate { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.gate-art { background: radial-gradient(120% 90% at 0% 0%, #6d4be0 0%, #4a2fbd 40%, #3b2a8c 100%); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.gate-art h2 { font-size: 2rem; line-height: 1.15; margin: 0 0 12px; letter-spacing: -.02em; max-width: 14ch; }
.gate-art p { opacity: .85; max-width: 38ch; margin: 0; }
.gate-form { display: grid; place-items: center; padding: 32px 20px; background: var(--surface); }
.gate-box { width: 100%; max-width: 360px; }
.gate-box h1 { margin: 0 0 6px; font-size: 1.6rem; letter-spacing: -.02em; }
.gate-box .btn { width: 100%; padding: 12px; margin-top: 20px; }
@media (max-width: 820px) { .gate { grid-template-columns: 1fr; } .gate-art { display: none; } }

.gate-box form .btn { width: 100%; padding: 12px; margin-top: 8px; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font-weight: 500; }
.linkbtn:hover { text-decoration: underline; }

/* ---------- tela de abertura e carregamento */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes breathe { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(.94); opacity: .85; } }
.spin { width: 28px; height: 28px; border-radius: 50%; border: 3px solid #e3e6ec; border-top-color: var(--accent); animation: spin .8s linear infinite; }
.splash { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; }
.splash .brandmark { width: 54px; height: 54px; border-radius: 16px; animation: breathe 1.6s ease-in-out infinite; }
.splash .brandmark svg { width: 28px; height: 28px; }
.splash.dark { background: #0b0f19; }
.splash.dark .brandmark { background: linear-gradient(135deg, #f59e0b, #d97706); color: #1a1202; }
.splash.dark .spin { border-color: #273044; border-top-color: #f59e0b; }
body.boot-dark { background: #0b0f19; }
.pageload { display: grid; place-items: center; min-height: 55vh; }
@media (prefers-reduced-motion: reduce) { .spin, .splash .brandmark { animation-duration: 3s; } }

/* ---------- login master: escuro, centralizado, destaque dourado */
.gate-master {
  --surface: #121826; --ink: #f1f5f9; --muted: #94a3b8; --line: #2a3447; --accent: #f59e0b; --accent-2: #fbbf24;
  min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; color: var(--ink);
  background: radial-gradient(70% 55% at 50% 0%, rgba(245,158,11,.14) 0%, rgba(11,15,25,0) 70%), #0b0f19;
}
.gm-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 34px 30px; box-shadow: 0 24px 80px rgba(0,0,0,.55); }
.gm-chip { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; background: rgba(245,158,11,.14); color: #fbbf24; margin-bottom: 16px; }
.gm-chip svg { width: 22px; height: 22px; }
.gm-label { font-size: .68rem; letter-spacing: .16em; color: #fbbf24; font-weight: 700; margin-bottom: 6px; }
.gate-master h1 { margin: 0 0 6px; font-size: 1.55rem; letter-spacing: -.02em; color: #fff; }
.gm-card form .btn, .gm-card > div > .btn { width: 100%; padding: 12px; margin-top: 8px; }
.gm-card .muted { color: var(--muted); }
.gate-master .field label { color: var(--muted); }
.gate-master input { background: #0d1320; color: var(--ink); border-color: var(--line); }
.gate-master input::placeholder { color: #5b6677; }
.gate-master input:focus { outline: 2px solid var(--accent); }
.gate-master .btn { background: var(--accent); color: #1a1202; }
.gate-master .btn:hover { background: var(--accent-2); }
.gate-master .btn.sec { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.gate-master .btn.sec:hover { background: rgba(255,255,255,.05); }
.gate-master .linkbtn { color: #fbbf24; }
.gate-master .err { background: rgba(220,38,38,.14); color: #fca5a5; }
.gate-master .note { background: rgba(245,158,11,.12); color: #fde68a; }

/* ---------- casca */
.brandrow { display: flex; align-items: center; gap: 11px; padding: 2px 8px 14px; }
.brandmark { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, var(--accent-2), #7c3aed); display: grid; place-items: center; color: #fff; flex: none; }
.brandmark svg { width: 19px; height: 19px; }
.brandname { font-weight: 700; letter-spacing: -.01em; line-height: 1.15; }
.brandname small { display: block; font-weight: 500; color: var(--muted); font-size: .74rem; }
.side { position: fixed; inset: 0 auto 0 0; width: var(--side); background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 18px 12px 14px; z-index: 30; overflow-y: auto; }
.navgroup { font-size: .66rem; letter-spacing: .09em; text-transform: uppercase; color: var(--faint); padding: 16px 10px 6px; font-weight: 600; }
.navlink { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 9px; color: var(--ink-2); text-decoration: none; font-weight: 500; margin-bottom: 2px; }
.navlink svg { width: 18px; height: 18px; flex: none; color: var(--faint); }
.navlink:hover { background: #f1f5f9; }
.navlink.active { background: var(--accent-soft); color: var(--accent); }
.navlink.active svg { color: var(--accent); }
.sidefoot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 12px; display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; display: grid; place-items: center; flex: none; font-size: .8rem; }
.who { min-width: 0; flex: 1; line-height: 1.25; }
.who b { display: block; font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who span { font-size: .75rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.signout { background: none; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; cursor: pointer; color: var(--ink-2); font-size: .8rem; }
.signout:hover { background: #f1f5f9; }
.mtop { display: none; position: sticky; top: 0; z-index: 20; height: 56px; background: var(--surface); border-bottom: 1px solid var(--line); align-items: center; gap: 12px; padding: 0 14px; }
.burger { background: none; border: 0; cursor: pointer; color: var(--ink); padding: 4px; display: grid; }
.burger svg { width: 24px; height: 24px; }
.main { margin-left: var(--side); min-height: 100vh; }
.page { max-width: 1440px; margin: 0 auto; padding: 30px clamp(16px, 3vw, 44px) 72px; }
@media (max-width: 900px) {
  .mtop { display: flex; }
  .side { transform: translateX(-100%); transition: transform .22s; }
  body.side-open .side { transform: none; box-shadow: 0 0 0 100vmax rgba(15,23,42,.45); }
  .main { margin-left: 0; min-height: 0; }
  .page { padding-top: 20px; }
}

/* ---------- cabecalho de pagina */
.head { display: flex; flex-wrap: wrap; gap: 14px 18px; align-items: flex-end; margin-bottom: 22px; }
.head .titles { margin-right: auto; }
.head h1 { margin: 0; font-size: 1.65rem; letter-spacing: -.025em; line-height: 1.2; }
.head .sub { color: var(--muted); margin-top: 2px; font-size: .9rem; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.seg { display: inline-flex; background: #eceef2; border-radius: 10px; padding: 3px; gap: 2px; max-width: 100%; overflow-x: auto; }
.seg button { border: 0; background: none; padding: 6px 13px; border-radius: 8px; cursor: pointer; color: var(--muted); font-weight: 600; font-size: .82rem; white-space: nowrap; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(15,23,42,.12); }
select, input, textarea { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; min-width: 0; }
select:focus, input:focus, textarea:focus { outline: 2px solid var(--accent-2); outline-offset: -1px; border-color: transparent; }

/* ---------- cartoes e blocos */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: 18px; }
.card h2 { margin: 0; font-size: 1rem; letter-spacing: -.01em; }
.card .cardhead { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card .cardhead span { color: var(--muted); font-size: .82rem; }
.grid { display: grid; gap: 18px; margin-bottom: 18px; }
.grid > .card { margin-bottom: 0; }
.g-hero { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-kpi { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-bottom { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 1100px) { .g-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) { .g-hero, .g-bottom { grid-template-columns: 1fr; } }
@media (max-width: 480px) { .g-kpi { grid-template-columns: 1fr; } }
.stack { display: grid; gap: 18px; align-content: start; }
.stack > .card { margin-bottom: 0; }

.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.kpi .top { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: .84rem; font-weight: 500; }
.kpi .chip { width: 32px; height: 32px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; }
.kpi .chip svg { width: 17px; height: 17px; }
.kpi .val { font-size: 1.75rem; font-weight: 700; letter-spacing: -.03em; margin: 8px 0 2px; line-height: 1.15; }
.kpi .foot { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .8rem; min-height: 20px; flex-wrap: wrap; }
.delta { font-weight: 600; font-size: .76rem; padding: 1px 7px; border-radius: 99px; background: #eceef2; color: var(--muted); }
.delta.up { background: var(--ok-soft); color: var(--ok); }
.delta.down { background: var(--bad-soft); color: var(--bad); }
.bignum { font-size: 2.3rem; font-weight: 700; letter-spacing: -.035em; line-height: 1.1; }

.chart { width: 100%; height: 230px; display: block; overflow: visible; }
.chart text { fill: var(--faint); font-size: 10.5px; }
.chart .grid-line { stroke: #eef0f3; stroke-width: 1; }
.chart .area { fill: url(#areaFill); }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.chart .pt rect { fill: transparent; }
.chart .pt circle { fill: var(--surface); stroke: var(--accent); stroke-width: 2.4; opacity: 0; }
.chart .pt:hover circle { opacity: 1; }
.chart .pt:hover rect { fill: rgba(74,47,189,.05); }
.chart-empty { text-align: center; color: var(--faint); font-size: .85rem; margin-top: -122px; height: 122px; pointer-events: none; }

.meter { margin-bottom: 14px; }
.meter:last-child { margin-bottom: 0; }
.meter .row { display: flex; justify-content: space-between; gap: 10px; font-size: .88rem; margin-bottom: 6px; }
.meter .row b { font-weight: 600; }
.meter .row span { color: var(--muted); }
.meter .track { height: 8px; border-radius: 99px; background: #eef0f3; overflow: hidden; }
.meter .fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent-2), var(--accent)); min-width: 2px; }
.rank { list-style: none; margin: 0; padding: 0; }
.rank li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.rank li:last-child { border-bottom: 0; padding-bottom: 0; }
.rank .n { width: 24px; height: 24px; border-radius: 7px; background: #f1f5f9; color: var(--muted); display: grid; place-items: center; font-size: .75rem; font-weight: 700; flex: none; }
.rank .t { flex: 1; min-width: 0; line-height: 1.3; }
.rank .t b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank .t span { color: var(--muted); font-size: .8rem; }
.rank .v { font-weight: 600; }
.emptybox { text-align: center; color: var(--faint); padding: 18px 8px; font-size: .88rem; }

.g-kpi5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1250px) { .g-kpi5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 900px) { .g-kpi5 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-2, .g-3 { grid-template-columns: 1fr; } }
@media (max-width: 480px) { .g-kpi5 { grid-template-columns: 1fr; } }
.grid + .card, .card + .grid, .grid + .grid { margin-top: 0; }

/* ---------- seletor de periodo */
.drp { position: relative; }
.drp-btn { display: flex; align-items: center; gap: 9px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; cursor: pointer; color: var(--ink); }
.drp-btn:hover { border-color: #cbd5e1; }
.drp-btn svg { width: 17px; height: 17px; color: var(--accent); }
.drp-name { font-weight: 600; font-size: .86rem; }
.drp-dates { color: var(--muted); font-size: .82rem; }
.drp-chev { color: var(--faint); font-size: .75rem; }
.drp-pop { position: absolute; right: 0; top: calc(100% + 8px); z-index: 50; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 18px 50px rgba(15,23,42,.18); display: flex; width: 640px; max-width: calc(100vw - 24px); }
.drp-presets { display: flex; flex-direction: column; gap: 2px; padding: 12px; border-right: 1px solid var(--line); min-width: 168px; }
.drp-presets button { text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 8px; cursor: pointer; color: var(--ink-2); font-size: .86rem; }
.drp-presets button:hover { background: #f1f5f9; }
.drp-presets button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.drp-cal { padding: 14px 16px; flex: 1; min-width: 0; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-size: .85rem; }
.cal-nav { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 1.1rem; line-height: 1; color: var(--ink-2); }
.cal-nav:hover { background: #f1f5f9; }
.cal-two { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.cal-title { text-align: center; font-weight: 600; text-transform: capitalize; margin-bottom: 6px; font-size: .9rem; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); row-gap: 2px; }
.cal-grid .dow { text-align: center; font-size: .7rem; color: var(--faint); padding: 4px 0; }
.day { border: 0; background: none; height: 32px; cursor: pointer; font-size: .82rem; color: var(--ink-2); border-radius: 0; padding: 0; }
.day:hover:not(:disabled) { background: var(--accent-soft); border-radius: 8px; }
.day:disabled { color: #cbd5e1; cursor: default; }
.day.today { font-weight: 700; color: var(--accent); }
.day.in { background: var(--accent-soft); color: var(--accent); }
.day.edge { background: var(--accent); color: #fff; border-radius: 8px; font-weight: 600; }
@media (max-width: 700px) { .drp-pop { flex-direction: column; width: 340px; right: auto; left: 0; } .drp-presets { flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--line); } .cal-two { grid-template-columns: 1fr; } }

/* ---------- graficos novos */
.combo .legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 8px; justify-content: center; }
.combo .lg { background: none; border: 0; cursor: pointer; display: flex; align-items: center; gap: 7px; font-size: .8rem; color: var(--ink-2); padding: 2px 4px; }
.combo .lg i, .tip i, .dlegend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; flex: none; }
.combo .lg.off { opacity: .4; text-decoration: line-through; }
.combo .stage { position: relative; }
.combo-svg { height: 300px; }
.tip { position: absolute; background: var(--ink); color: #fff; border-radius: 10px; padding: 10px 12px; font-size: .78rem; width: 180px; pointer-events: none; z-index: 5; box-shadow: 0 8px 24px rgba(15,23,42,.3); }
.tip b:first-child { display: block; margin-bottom: 6px; }
.tip .tr { display: flex; align-items: center; gap: 6px; padding: 1px 0; }
.tip .tr span { flex: 1; color: #cbd5e1; }
.totals { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; background: #f7f8fa; border-radius: 12px; padding: 14px 16px; margin-top: 14px; }
.totals .k { display: block; font-size: .74rem; color: var(--muted); }
.totals b { font-size: 1.02rem; }
@media (max-width: 1100px) { .totals { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 560px) { .totals { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.donutbox { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; justify-content: center; }
.donut { width: 168px; height: 168px; flex: none; }
.donut-n { font-size: 26px; font-weight: 700; fill: var(--ink); }
.donut-l { font-size: 10px; fill: var(--muted); }
.dlegend { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 150px; font-size: .84rem; }
.dlegend li { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.dlegend li span { flex: 1; color: var(--ink-2); }
.dlegend small { width: 46px; text-align: right; }
.minis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 900px) { .minis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.mini { background: #f7f8fa; border-radius: 12px; padding: 14px 16px; }
.mini .k { font-size: .82rem; color: var(--muted); }
.mini .v { font-size: 1.6rem; font-weight: 700; color: var(--accent); letter-spacing: -.02em; margin: 2px 0; }
.mini .s { font-size: .76rem; color: var(--muted); }
.drawer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
@media (max-width: 600px) { .drawer-grid { grid-template-columns: 1fr; } }
.badge { display: inline-block; min-width: 18px; padding: 0 6px; border-radius: 99px; background: var(--accent); color: #fff; font-size: .72rem; font-weight: 700; margin-left: 4px; text-align: center; }
.countpill { background: #eceef2; border-radius: 99px; padding: 3px 11px; font-size: .78rem; color: var(--muted); }
@media print {
  .side, .mtop, .noprint, .drp-pop { display: none !important; }
  .main { margin-left: 0 !important; }
  body { background: #fff; }
  .card, .kpi, .mini { break-inside: avoid; box-shadow: none; }
}

/* ---------- tabelas */
.tablewrap { overflow-x: auto; margin: 0 -6px; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th { text-align: left; color: var(--muted); font-weight: 600; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; }
th, td { padding: 12px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbfc; }
tr.click { cursor: pointer; }
td.num, th.num { text-align: right; white-space: nowrap; }
td .muted { font-size: .8rem; }
.empty { text-align: center; color: var(--faint); padding: 36px 8px; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: .74rem; font-weight: 600; background: #eceef2; color: var(--ink-2); white-space: nowrap; }
.pill.paid, .pill.active, .pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.pending { background: var(--warn-soft); color: var(--warn); }
.pill.failed, .pill.canceled, .pill.chargeback, .pill.blocked, .pill.off { background: var(--bad-soft); color: var(--bad); }
.pill.refunded { background: var(--accent-soft); color: var(--accent); }

/* ---------- botoes e formularios */
.btn { background: var(--accent); color: #fff; border: 0; border-radius: 10px; padding: 9px 18px; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-block; text-align: center; }
.btn:hover { background: #3b24a0; }
.btn.sec { background: var(--surface); color: var(--ink-2); border: 1px solid var(--line); }
.btn.sec:hover { background: #f8fafc; }
.btn.danger { background: var(--surface); color: var(--bad); border: 1px solid #f5c6c3; }
.btn.sm { padding: 5px 11px; font-size: .8rem; border-radius: 8px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; vertical-align: -3px; margin-right: 2px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: .78rem; color: var(--muted); margin-bottom: 5px; font-weight: 500; }
.field input, .field select, .field textarea { width: 100%; }
.cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.cols3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 600px) { .cols2, .cols3 { grid-template-columns: 1fr; } }
.checkrow { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.checkrow input { width: auto; }
.err { color: var(--bad); background: var(--bad-soft); border-radius: 10px; padding: 10px 12px; margin: 10px 0; font-size: .88rem; }
.note { background: var(--accent-soft); color: #3b2a8c; border-radius: 12px; padding: 12px 16px; font-size: .88rem; margin-bottom: 18px; }
.note.warn { background: var(--warn-soft); color: var(--warn); }
.actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }

dialog { border: 0; border-radius: 16px; padding: 0; width: min(700px, calc(100vw - 24px)); max-height: calc(100vh - 32px); box-shadow: 0 24px 64px rgba(15,23,42,.28); color: var(--ink); background: var(--surface); }
dialog::backdrop { background: rgba(15,23,42,.5); }
dialog .dh { display: flex; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line); }
dialog .dh h2 { margin: 0; font-size: 1.1rem; flex: 1; }
dialog .db { padding: 22px; overflow-y: auto; max-height: calc(100vh - 140px); }
.x { background: none; border: 0; cursor: pointer; color: var(--muted); font-size: 1.5rem; line-height: 1; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 14px; font-size: .9rem; margin: 0 0 12px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; word-break: break-word; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 10px; z-index: 100; font-size: .88rem; }
.linkbox { display: flex; gap: 8px; align-items: center; }
.linkbox input { flex: 1; min-width: 160px; font-size: .8rem; }

/* ---------- portal inicial */
.portal { min-height: 100vh; display: grid; place-items: center; padding: 28px 16px; background: radial-gradient(80% 60% at 50% 0%, #e9eaff 0%, var(--bg) 70%); }
.portal .wrap { max-width: 720px; width: 100%; text-align: center; }
.portal .brandmark { width: 52px; height: 52px; border-radius: 15px; margin: 0 auto 18px; }
.portal .brandmark svg { width: 28px; height: 28px; }
.portal h1 { margin: 0 0 6px; font-size: 2rem; letter-spacing: -.03em; }
.portal .tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 30px; text-align: left; }
@media (max-width: 600px) { .portal .tiles { grid-template-columns: 1fr; } }
.tile { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 24px; text-decoration: none; color: var(--ink); transition: .15s; }
.tile:hover { border-color: var(--accent-2); box-shadow: 0 8px 28px rgba(74,47,189,.14); transform: translateY(-2px); }
.tile .chip { width: 42px; height: 42px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; margin-bottom: 16px; }
.tile .chip svg { width: 22px; height: 22px; }
.tile h2 { margin: 0 0 4px; font-size: 1.1rem; }
.tile p { margin: 0; color: var(--muted); font-size: .9rem; }

/* =====================================================================
   TEMA v2: roxo profundo, cartoes suaves, indicadores coloridos
   (vem por ultimo para sobrescrever os valores anteriores)
   ===================================================================== */
:root {
  --bg: #f4f5fa; --ink: #1b1740; --ink-2: #403c66; --muted: #6f6c92; --faint: #a3a0c0; --line: #e8e9f1;
  --accent: #4a2fbd; --accent-2: #6d4be0; --accent-soft: #efeafd; --side: 240px;
}
body { background: var(--bg); color: var(--ink); }

/* menu lateral roxo */
.side { background: linear-gradient(185deg, #3b2596 0%, #2a1a74 100%); border-right: 0; padding: 20px 12px 14px; }
.brandname { color: #fff; }
.brandname small { color: #c3b8f2; }
.brandmark { background: linear-gradient(135deg, #8f6bff, #5b34d6); box-shadow: 0 4px 12px rgba(0,0,0,.25); }
.navgroup { color: #a395e6; }
.navlink { color: #e9e4ff; border-radius: 10px; padding: 10px 12px; }
.navlink svg { color: #b9adf0; }
.navlink:hover { background: rgba(255,255,255,.09); }
.navlink.active { background: rgba(255,255,255,.17); color: #fff; box-shadow: inset 3px 0 0 #c9baff; }
.navlink.active svg { color: #fff; }
.sidefoot { border-top: 1px solid rgba(255,255,255,.15); }
.avatar { background: rgba(255,255,255,.17); color: #fff; }
.who b { color: #fff; }
.who span { color: #c3b8f2; }
.signout { border-color: rgba(255,255,255,.28); color: #fff; }
.signout:hover { background: rgba(255,255,255,.12); }
.mtop { background: #2a1a74; border-bottom: 0; }
.mtop .brandname, .burger { color: #fff; }

/* area de conteudo */
.page { max-width: 1640px; padding: 26px clamp(16px, 2.4vw, 38px) 72px; }
.head { margin-bottom: 20px; align-items: center; }
.head h1 { font-size: 1.5rem; }
.head h1::before { content: ''; display: block; width: 26px; height: 3px; border-radius: 3px; background: var(--accent); margin-bottom: 9px; }
.card, .kpi, .mini { border: 1px solid #ececf4; box-shadow: 0 1px 2px rgba(30,20,80,.04), 0 8px 22px rgba(30,20,80,.045); }
.card { border-radius: 16px; }
.kpi { border-radius: 16px; padding: 18px 20px; }
.card h2 { font-size: 1.02rem; }

/* indicadores coloridos */
.kpi .top span { font-weight: 600; }
.kpi.t-purple .top span { color: #4a2fbd; } .kpi.t-purple .chip { background: #efeafd; color: #4a2fbd; }
.kpi.t-green .top span { color: #15803d; } .kpi.t-green .chip { background: #e3f6ea; color: #15803d; }
.kpi.t-orange .top span { color: #c2570c; } .kpi.t-orange .chip { background: #fdeede; color: #c2570c; }
.kpi.t-teal .top span { color: #0e7490; } .kpi.t-teal .chip { background: #e0f5fa; color: #0e7490; }
.kpi.t-red .top span { color: #c81e3a; } .kpi.t-red .chip { background: #fde8ec; color: #c81e3a; }
.kpi .chip { border-radius: 50%; width: 34px; height: 34px; }
.kpi .val { font-size: 1.7rem; }

/* controles do cabecalho: chips suaves, PDF verde e atualizar redondo */
.filters { gap: 10px; }
.drp-btn { background: #fff; border: 1px solid #e3e4ef; border-radius: 99px; padding: 9px 15px; box-shadow: 0 1px 2px rgba(30,20,80,.04); }
.drp-btn:hover { border-color: #cfcbea; }
.filters select { border-radius: 99px; border: 1px solid #e3e4ef; background: #fff; padding: 9px 16px; box-shadow: 0 1px 2px rgba(30,20,80,.04); font-weight: 500; color: var(--ink-2); cursor: pointer; }
.btn.green { background: #1f8f4d; color: #fff; border-radius: 99px; padding: 9px 18px; box-shadow: 0 2px 8px rgba(31,143,77,.28); }
.btn.green:hover { background: #187a40; }
.btn.round { width: 40px; height: 40px; border-radius: 50%; padding: 0; display: inline-grid; place-items: center; }
.btn.round svg { margin: 0; width: 17px; height: 17px; vertical-align: 0; }
.btn.sec { border-radius: 99px; }

/* abas (Produtos | Cupons) */
.tabsbar { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabsbar button { background: none; border: 0; padding: 11px 18px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabsbar button:hover { color: var(--ink); }
.tabsbar button.on { color: var(--accent); border-bottom-color: var(--accent); }
.toolbar { display: flex; justify-content: flex-end; margin-bottom: 14px; }

/* estado vazio dos graficos */
.empty-chart { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 6px; padding: 38px 16px; color: var(--muted); min-height: 190px; }
.empty-chart .ec-ico { width: 54px; height: 54px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; margin-bottom: 6px; }
.empty-chart .ec-ico svg { width: 26px; height: 26px; }
.empty-chart b { color: var(--ink-2); font-weight: 600; }
.empty-chart span { font-size: .84rem; max-width: 34ch; }

/* login e detalhes na nova paleta */
.gate-art { background: radial-gradient(120% 90% at 0% 0%, #6d4be0 0%, #4a2fbd 42%, #261765 100%); }
.note { background: var(--accent-soft); color: #3b2a8c; }
.pill.refunded { background: var(--accent-soft); color: var(--accent); }
.tr b:first-child { color: #fff; }
tbody tr:hover { background: #faf9ff; }
th { color: var(--muted); }
.tabsbar { overflow-y: hidden; }

/* formulario de produto: secoes e parcelas */
.fsec { font-size: .74rem; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); font-weight: 700; margin: 22px 0 12px; padding-top: 16px; border-top: 1px solid var(--line); }
.fsec:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.pchips { display: flex; flex-wrap: wrap; gap: 8px; }
.pchip { padding: 6px 13px; border: 1px solid var(--line); border-radius: 99px; background: #fff; color: var(--muted); font-weight: 600; font-size: .82rem; cursor: pointer; }
.pchip:hover:not(:disabled) { border-color: var(--accent-2); }
.pchip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.pchip:disabled { cursor: default; opacity: .85; }
dialog { width: min(760px, calc(100vw - 24px)); }
/* 2FA: QR Code e chave */
.mfa-steps { margin: 0 0 6px; padding-left: 20px; color: var(--muted); font-size: .86rem; line-height: 1.7; }
.qrbox { display: grid; place-items: center; background: #fff; border-radius: 14px; padding: 10px; margin: 12px auto; width: fit-content; }
.qrbox img { display: block; image-rendering: pixelated; }
.keybox { font: .8rem/1.4 ui-monospace, Consolas, monospace; background: #0d1320; border: 1px solid var(--line); color: #fde68a; padding: 9px 12px; border-radius: 10px; margin-bottom: 14px; cursor: copy; word-break: break-all; text-align: center; letter-spacing: .06em; }
/* taxa de juros com calculadora e janela de simulacao (modelo do Pagar.me) */
.ratebox { display: flex; gap: 10px; align-items: center; }
.ratebox input { flex: 1; min-width: 0; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.calcbtn { width: 42px; height: 42px; flex: none; border-radius: 50%; border: 1px solid var(--line); background: var(--accent-soft); color: var(--accent); cursor: pointer; display: grid; place-items: center; }
.calcbtn:hover { background: var(--accent); color: #fff; }
.calcbtn svg { width: 19px; height: 19px; }
dialog.dlg-purple { width: min(640px, calc(100vw - 24px)); }
dialog.dlg-purple .dh { background: #3b2494; color: #fff; border: 0; justify-content: center; position: relative; padding: 20px 24px; }
dialog.dlg-purple .dh h2 { flex: none; color: #fff; font-size: 1.05rem; }
dialog.dlg-purple .dh .x { position: absolute; right: 18px; top: 50%; transform: translateY(-50%); color: #fff; }
.simgrid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 22px; align-items: start; }
@media (max-width: 600px) { .simgrid { grid-template-columns: 1fr; } }
.simbox { background: #f4f5f8; border-radius: 14px; padding: 12px 18px; }
.simtable th { text-transform: none; letter-spacing: 0; font-size: .92rem; color: var(--ink); font-weight: 700; border-bottom: 1px solid #e3e5ec; }
.simtable td { border-bottom: 1px solid #e9ebf1; padding: 9px 8px; font-variant-numeric: tabular-nums; }
.simtable tbody tr:last-child td { border-bottom: 0; }
.simtable tbody tr:hover { background: transparent; }
.simlabel { display: block; font-size: .8rem; color: var(--accent); font-weight: 600; margin-bottom: 4px; }
dialog.dlg-purple .actions { align-items: center; gap: 16px; }
/* regra de comissao dos afiliados */
.rulecard { border-left: 4px solid var(--accent); margin-bottom: 18px; }
.rulegrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 700px) { .rulegrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.rulecalc { background: #f7f8fa; border-radius: 12px; padding: 12px 16px; margin-top: 4px; }
.rulerow { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px dashed #e1e3ea; font-size: .9rem; }
.rulerow:last-of-type { border-bottom: 0; }
.rulerow.ok { color: #15803d; }
/* configuracao dos afiliados: interruptores */
.switches { display: grid; gap: 14px; margin-top: 8px; }
.switch { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { flex: none; width: 40px; height: 22px; border-radius: 99px; background: #cfd3de; position: relative; transition: background .15s; margin-top: 1px; }
.switch .track::after { content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .15s; }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.swtext { display: flex; flex-direction: column; gap: 2px; font-weight: 500; }
.swtext small { color: var(--muted); font-weight: 400; font-size: .8rem; }
.subfield { margin-left: 52px; max-width: 220px; }
/* pagina publica de cadastro de afiliado */
body.applybody { background: radial-gradient(80% 50% at 50% 0%, #e9e4ff 0%, var(--bg) 70%); min-height: 100vh; }
.apply { max-width: 760px; margin: 0 auto; padding: 32px 16px 64px; }
.apply-head { text-align: center; margin-bottom: 22px; }
.apply-head .brandmark { width: 48px; height: 48px; border-radius: 14px; margin: 0 auto 12px; }
.apply-head .brandmark svg { width: 26px; height: 26px; }
.apply-head h1 { margin: 0 0 4px; font-size: 1.6rem; letter-spacing: -.02em; }
.apply-card { padding: 26px; }
.apply-card.center { text-align: center; }
.apply-card.center h2 { margin: 0 0 8px; font-size: 1.3rem; }
.apply-card.center .btn { display: inline-block; min-width: 220px; }
.apply-card.center .linkbox { max-width: 520px; margin: 14px auto 0; }
.apply-sec { font-size: .74rem; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); font-weight: 700; margin: 24px 0 12px; padding-top: 18px; border-top: 1px solid var(--line); }
.apply-sec:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.apply form > .btn, .apply-card form .btn[type=submit] { width: 100%; padding: 13px; margin-top: 8px; }
/* afiliados: cartao do link de cadastro e etiqueta nas abas */
.linkcard { display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.linkcard .linkbox { flex: 1; min-width: 260px; max-width: 520px; }
.tabsbar .badge { margin-left: 6px; }
/* cadastro de afiliado: erros por campo e quadro de agencia/conta */
.field input.invalid, .field select.invalid { border-color: #dc2626; background: #fff6f6; }
.field input.invalid:focus, .field select.invalid:focus { outline-color: #dc2626; }
.ferr { display: block; color: #dc2626; font-size: .78rem; margin-top: 4px; font-weight: 500; }
.errlist { margin: 8px 0 0; padding-left: 18px; }
.errlist li { margin: 2px 0; }
.pair { display: grid; grid-template-columns: minmax(0, 1fr) 118px; gap: 10px; align-items: start; }
@media (max-width: 600px) { .pair { grid-template-columns: minmax(0, 1fr) 100px; } }
/* esqueleto de carregamento (formato da pagina enquanto os dados chegam) */
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.skel > div { border-radius: 14px; background: linear-gradient(90deg, #eceef5 25%, #f7f8fc 45%, #eceef5 65%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
.skel-h { height: 34px; width: 220px; margin-bottom: 22px; }
.skel-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; background: none !important; animation: none !important; }
.skel-row > div { height: 104px; border-radius: 16px; background: linear-gradient(90deg, #eceef5 25%, #f7f8fc 45%, #eceef5 65%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
.skel-block { height: 300px; margin-bottom: 18px; }
.skel-block.short { height: 180px; }
@media (max-width: 900px) { .skel-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (prefers-reduced-motion: reduce) { .skel > div, .skel-row > div { animation: none; } }
/* navegador que ja entrou antes: o painel aparece direto, sem tela escura nem circulo de carregamento */
.has-hint body.boot-dark { background: var(--bg); }
.has-hint .splash { visibility: hidden; }
/* imagem do produto: caixa de previa + botoes */
.imgpick { display: flex; gap: 14px; align-items: center; }
.imgbox { width: 120px; height: 120px; flex: none; border: 1px dashed var(--line, #d8d6e8); border-radius: 12px; background: #faf9ff; display: grid; place-items: center; overflow: hidden; }
.imgbox img { width: 100%; height: 100%; object-fit: cover; }
.imgpick-side { display: grid; gap: 8px; min-width: 0; }
@media (max-width: 520px) { .imgpick { flex-direction: column; align-items: stretch; } .imgbox { width: 100%; height: 180px; } }
.prodname { display: inline-flex; align-items: center; gap: 10px; }
.prodthumb { width: 36px; height: 36px; border-radius: 8px; object-fit: cover; }

/* detalhe da venda */
.crumbs { display: flex; align-items: center; gap: 8px; margin: 0 0 14px; font-size: .85rem; color: var(--muted); }
.crumb { background: var(--soft, #f1f2f8); border: 0; border-radius: 999px; padding: 4px 12px; color: var(--accent); font-weight: 600; cursor: pointer; font: inherit; font-size: .8rem; }
.crumb.on { cursor: default; color: var(--ink); }
.dcard { margin-bottom: 16px; }
.dcard-h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.dcard-h h3 { margin: 0; font-size: 1.05rem; position: relative; padding-top: 12px; }
.dcard-h h3::before { content: ''; position: absolute; top: 0; left: 0; width: 22px; height: 3px; border-radius: 2px; background: var(--accent); }
.fgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px 28px; }
.fld { padding: 10px 0 8px; border-bottom: 1px solid var(--line); min-width: 0; }
.fld.wide { grid-column: span 2; }
.fld-l { font-size: .8rem; color: var(--accent); font-weight: 500; margin-bottom: 2px; }
.fld-v { display: flex; align-items: center; gap: 8px; min-height: 28px; }
.fld-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.iconbtn { flex: none; width: 30px; height: 30px; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--soft, #f1f2f8); color: var(--accent); cursor: pointer; }
.iconbtn:hover { background: #e4e2f6; }
.iconbtn svg { width: 15px; height: 15px; }
@media (max-width: 900px) { .fgrid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .fgrid { grid-template-columns: 1fr; } .fld.wide { grid-column: auto; } }

/* detalhe da venda: enquadramento compacto e centralizado */
#view .detwrap, .detwrap { max-width: 1040px; margin: 0 auto; }
.detwrap .fld-v { font-size: .86rem; min-height: 26px; }
.detwrap .fld-l { font-size: .76rem; }
.detwrap .dcard { padding: 18px 22px; border-radius: 14px; }
.detwrap .dcard-h h3 { font-size: .98rem; }
.detwrap .fgrid { gap: 2px 32px; }
.detwrap .fld { padding: 8px 0 6px; }
.detwrap .fld-sp { display: block; }
.fld-sp { display: none; }
.detwrap .fld-sp { border: 0; }
.detwrap .tabsbar { margin-bottom: 14px; }
.backbtn { width: 32px; height: 32px; flex: none; display: grid; place-items: center; border: 0; border-radius: 50%; background: #fff; color: var(--accent); cursor: pointer; box-shadow: 0 1px 3px rgba(20,16,60,.12); }
.backbtn:hover { background: #ece9fb; }
.backbtn svg { width: 17px; height: 17px; }
@media (max-width: 900px) { .detwrap .fld-sp { display: none; } }

/* configuracoes */
.notice { padding: 12px 14px; border-radius: 10px; font-size: .9rem; margin-bottom: 14px; }
.notice.warn { background: #fff4e5; color: #8a4b08; }
.notice.ok { background: #e8f7ee; color: #12683a; }
.card.notice.warn p { margin: 6px 0 0; }
.mono { font: .82rem/1.3 ui-monospace, Consolas, monospace; word-break: break-all; }
.trunc { display: inline-block; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.card h3 { margin: 0 0 6px; font-size: 1.05rem; }

/* integracoes e webhooks */
.provgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin-top: 12px; }
.provcard { display: grid; gap: 8px; justify-items: start; text-align: left; padding: 18px; background: #fff; border: 1px solid var(--line); border-radius: 14px; cursor: pointer; font: inherit; color: inherit; transition: box-shadow .15s, border-color .15s; }
.provcard:hover { border-color: var(--accent); box-shadow: 0 4px 14px rgba(74,47,189,.12); }
.provlogo { height: 44px; display: flex; align-items: center; font-weight: 800; font-size: 1.5rem; letter-spacing: -.02em; }
.provlogo.meta { color: #0866ff; } .provlogo.google { color: #4285f4; } .provlogo.tiktok { color: #111; }
.backlink { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; padding: 4px 0; }
.backlink svg { width: 16px; height: 16px; }
.pilltabs { display: inline-flex; background: #ebeaf5; border-radius: 999px; padding: 3px; }
.pilltabs button { border: 0; background: none; padding: 7px 18px; border-radius: 999px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; }
.pilltabs button.on { background: #fff; color: var(--accent); box-shadow: 0 1px 3px rgba(20,16,60,.15); }
.tgl { position: relative; display: inline-block; width: 42px; height: 24px; }
.tgl input { opacity: 0; width: 0; height: 0; position: absolute; }
.tgl span { position: absolute; inset: 0; background: #c9c7d8; border-radius: 999px; transition: background .15s; cursor: pointer; }
.tgl span::before { content: ''; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform .15s; }
.tgl input:checked + span { background: var(--accent); }
.tgl input:checked + span::before { transform: translateX(18px); }
.scopebox { max-height: 160px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; margin-top: 6px; }

/* lista de produtos */
.prodname { display: flex; align-items: center; gap: 12px; min-width: 0; }
.prodthumb { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; flex: none; border: 1px solid var(--line); }
.prodthumb.ph { display: grid; place-items: center; background: #ece9fb; color: var(--accent); font-weight: 800; border: 0; }
.prodtxt { display: grid; gap: 1px; min-width: 0; }
.prodtxt b { font-size: .95rem; }
.prodtxt .muted { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-prod { width: 34%; }
th.c-right, td.c-right { text-align: right; white-space: nowrap; }
th.c-center, td.c-center { text-align: center; white-space: nowrap; }
th.c-actions, td.c-actions { text-align: right; white-space: nowrap; }
.rowbtns { display: inline-flex; gap: 8px; justify-content: flex-end; }
@media (max-width: 900px) { .c-prod { width: auto; } .prodtxt .muted { max-width: 160px; } }

/* produtos com ofertas */
.pgroup { padding: 0; overflow: hidden; margin-bottom: 18px; }
.pg-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 22px; background: #faf9ff; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.pg-title { font-size: 1.1rem; }
.prodthumb.big { width: 56px; height: 56px; border-radius: 12px; }
.pgroup .tablewrap { margin: 0; padding: 0 14px 8px; }
.pgroup .prodtxt .muted { max-width: none; }

/* relatorios: tabelas ordenaveis */
.cardhead .grow { flex: 1; }
.sortth button { border: 0; background: none; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; padding: 0; }
.sortth.on button, .sortth button:hover { color: var(--accent); }
.sorti { font-style: normal; font-size: .7rem; opacity: .6; }
.sharebadge { margin-left: 6px; padding: 1px 6px; border-radius: 6px; background: #f0f0f6; color: var(--muted); font-size: .68rem; }
tr.totalrow td { border-top: 2px solid var(--line); border-bottom: 0; }

/* links de pagamento no cadastro da oferta */
.linkbox2 { display: grid; gap: 4px; margin-bottom: 8px; }
.linkrow { display: flex; align-items: center; gap: 10px; padding: 8px 0 10px; border-bottom: 1px solid var(--line); }
.linkrow-main { flex: 1; min-width: 0; }
.linkval { font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 3px 0; }
.linkrow .hint { color: var(--muted); font-size: .75rem; }
.linkrow-btns { display: flex; gap: 6px; flex: none; }

/* pagina da oferta */
.offerpage { max-width: 1060px; margin: 0 auto; }
.offergrid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
@media (max-width: 860px) { .offergrid { grid-template-columns: 1fr; } }
.offerpage .dcard-h.sub { margin-top: 22px; }
.offerpage .field { margin-bottom: 4px; }
.offerpage .hint { color: var(--muted); font-size: .78rem; margin: 2px 0 8px; }
.badge-soft { padding: 4px 12px; border-radius: 999px; background: #ece9fb; color: var(--accent); font-size: .78rem; font-weight: 600; }
.imgcard .imgbox { width: 100%; height: 220px; margin: 10px 0; }
.imgbtns { display: flex; justify-content: center; gap: 10px; margin-top: 6px; }
.iconbtn.danger { background: #fde8e8; color: #d92d20; }
.pageactions { display: flex; justify-content: flex-end; gap: 10px; margin: 16px 0 40px; }
.switch small { display: block; color: var(--muted); font-weight: 400; }

/* pagina da oferta: ocupa a largura toda */
.offerpage { max-width: none; width: 100%; margin: 0; }
.offergrid { grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; }
.offerpage .card { margin-bottom: 18px; }
.offerpage .linkbox2 { grid-template-columns: 1fr 1fr; gap: 0 28px; }
@media (max-width: 860px) { .offerpage .linkbox2 { grid-template-columns: 1fr; } }
.offerpage .linkrow { border-bottom: 0; }
.imgcard .imgbox { height: 300px; }

/* links de pagamento: um por linha, em caixas separadas */
.offerpage .linkbox2 { grid-template-columns: 1fr; gap: 14px; }
.offerpage .linkrow { align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: #faf9ff; }
.offerpage .linkrow .fld-l { font-weight: 600; margin-bottom: 6px; }
.offerpage .linkval { padding: 9px 12px; background: #fff; border: 1px solid var(--line); border-radius: 8px; font-size: .9rem; user-select: all; }
.offerpage .linkrow .hint { margin: 8px 0 0; }
.offerpage .linkrow-btns { align-self: center; }
.offerpage .linkrow-btns .iconbtn { width: 38px; height: 38px; background: #fff; border: 1px solid var(--line); }
.offerpage .linkrow-btns .iconbtn:hover { background: #ece9fb; }

/* ---------- celular: tudo responsivo ---------- */
dialog { max-height: calc(100dvh - 24px); }
dialog .db { max-height: calc(100dvh - 130px); }
.mtop { padding-top: env(safe-area-inset-top); }
.page { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
@media (max-width: 700px) {
  /* campos com 16px: o iPhone nao da zoom ao tocar */
  select, input, textarea { font-size: 16px; }
  .head h1 { font-size: 1.4rem; }
  .head .filters { width: 100%; }
  .head .filters > select, .head .filters > .drp { flex: 1 1 100%; }
  .toolbar { display: flex; gap: 10px; flex-wrap: wrap; }
  .toolbar > select { flex: 1 1 100%; }
  .toolbar > .btn { flex: 1 1 auto; }
  .page { padding-left: 14px; padding-right: 14px; }
  .card { padding: 16px; border-radius: 14px; }
  .g-kpi, .g-kpi5 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .kpi { padding: 14px; }
  .kpi .val { font-size: 1.3rem; }
  .kpi .foot { font-size: .72rem; }
  .totals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .minis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .pg-head { padding: 14px 16px; }
  .pg-head .rowbtns { width: 100%; }
  .pg-head .rowbtns .btn { flex: 1 1 auto; }
  .offerpage .dcard { padding: 16px; }
  .pageactions { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg, #f4f5fb) 30%); padding: 14px 0 calc(14px + env(safe-area-inset-bottom)); margin: 8px 0 0; }
  .pageactions .btn { flex: 1; }
  .imgcard .imgbox { height: 200px; }
  .cardhead { flex-wrap: wrap; }
  .tabsbar button { padding: 11px 14px; }
  .pilltabs button { padding: 7px 14px; }

  /* tabelas viram cartoes: cada linha e um bloco, cada celula mostra o nome da coluna */
  .tablewrap { overflow: visible; margin: 0; }
  .tablewrap table { display: block; }
  .tablewrap thead { display: none; }
  .tablewrap tbody { display: grid; gap: 10px; }
  .tablewrap tr { display: block; border: 1px solid var(--line); border-radius: 12px; padding: 6px 14px; background: var(--surface); }
  .tablewrap tr.click { cursor: pointer; }
  .tablewrap td, .tablewrap td.num { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 9px 0; border-bottom: 1px solid #eef0f4; text-align: right; white-space: normal; width: auto; }
  .tablewrap td:last-child { border-bottom: 0; }
  .tablewrap td[data-label]:not([data-label=""])::before { content: attr(data-label); color: var(--muted); font-size: .74rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; text-align: left; flex: none; max-width: 45%; }
  .tablewrap td[data-label=""] { justify-content: flex-end; }
  .tablewrap td.c-prod { display: block; text-align: left; }
  .tablewrap td.c-prod::before { display: none; }
  .tablewrap td.empty { display: block; text-align: center; border: 0; }
  .tablewrap td .rowbtns { width: 100%; justify-content: flex-end; flex-wrap: wrap; }
  .tablewrap tr.totalrow { background: #f7f8fa; }
  .tablewrap .prodname, .tablewrap .prodtxt { text-align: left; }
  .trunc { max-width: 100%; }
  .simtable { display: table; }
  .simtable thead { display: table-header-group; }
  .simtable tbody { display: table-row-group; }
  .simtable tr { display: table-row; border: 0; padding: 0; }
  .simtable td, .simtable th { display: table-cell; }
}
@media (max-width: 420px) {
  .kpi .top { font-size: .76rem; }
  .kpi .chip { width: 28px; height: 28px; }
}
@media (max-width: 860px) { .offergrid { grid-template-columns: minmax(0, 1fr); } .imgcard { order: -1; } }
.offerpage .linkbox2 { grid-template-columns: minmax(0, 1fr); }
.offerpage .linkrow, .offerpage .linkrow-main { min-width: 0; }
.offerpage .dcard, .offerpage .offergrid > * { min-width: 0; }
.linkbox input { min-width: 0; flex: 1 1 140px; }
@media (max-width: 700px) { .linkbox { flex-wrap: wrap; } .linkbox .btn { flex: 1 1 auto; } }
@media (max-width: 700px) { .linkbox input { font-size: 16px; } }

/* editor do checkout */
.crumbs .grow { flex: 1; }
.poscard { display: grid; gap: 4px; justify-items: center; text-align: center; padding: 14px; background: #fff; border: 2px solid var(--line); border-radius: 14px; cursor: pointer; font: inherit; color: inherit; }
.poscard.on { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(74,47,189,.12); }
.poscard small { color: var(--muted); }
.posgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 8px 0 18px; }
.posart { width: 96px; height: 60px; background: #f4f5f8; border-radius: 8px; display: grid; gap: 4px; padding: 6px; margin-bottom: 6px; }
.posart i { background: #dfe2e8; border-radius: 3px; }
.posart.top { grid-template-rows: 14px 1fr; } .posart.top i:first-child { border: 1.5px dashed var(--accent); background: transparent; } .posart.top i:nth-child(3) { display: none; }
.posart.side { grid-template-columns: 1fr 30px; } .posart.side i:nth-child(2) { border: 1.5px dashed var(--accent); background: transparent; } .posart.side i:nth-child(3) { display: none; }
.bnrform { display: grid; gap: 14px; border-top: 1px solid var(--line); padding-top: 14px; }
.bnrform h4 { margin: 0; font-size: 1.05rem; }
.bnrbox { min-height: 90px; border: 1px dashed var(--line); border-radius: 10px; background: repeating-linear-gradient(135deg, #f3f1fd 0 10px, #ece9fb 10px 20px); display: grid; place-items: center; overflow: hidden; margin: 8px 0; }
.bnrbox img { display: block; max-width: 100%; height: auto; }
.imgfield .imgbtns { display: flex; justify-content: center; gap: 10px; }
.swatches { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 6px; }
.swatch { width: 38px; height: 38px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; display: grid; place-items: center; color: #fff; font-weight: 700; }
.swatch.on { box-shadow: 0 0 0 3px var(--accent); }
.swatch.custom { position: relative; background: conic-gradient(#f43f5e, #f59e0b, #22c55e, #3b82f6, #a855f7, #f43f5e); overflow: hidden; }
.swatch.custom input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.switch.off { opacity: .55; }
