:root {
  --bg: #f5f5f7; --panel: rgb(255 255 255 / .78); --panel-solid: #ffffff; --text: #1d1d1f; --muted: #6e6e73; --line: rgb(0 0 0 / .08); --line-strong: rgb(0 0 0 / .14);
  --accent: #0071e3; --accent-soft: #e8f1fd;
  --good: #1a7f37; --good-soft: #e3f4e8;
  --warn: #a05a00; --warn-soft: #fdf0dc;
  --bad: #d70015; --bad-soft: #fde7e9;
  --neutral-soft: #ececef;
  --radius: 16px;
  --shadow: 0 1px 2px rgb(0 0 0 / .04), 0 4px 16px rgb(0 0 0 / .04);
  --font-text: "SF Pro Text", -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  --font-display: "SF Pro Display", -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  font-family: var(--font-text);
  font-optical-sizing: auto;
  color-scheme: light;
  /* Cor da marca: um azul só, sem degradê */
  --brand: #0071e3;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000000; --panel: rgb(28 28 30 / .66); --panel-solid: #1c1c1e; --text: #f5f5f7; --muted: #8e8e93; --line: rgb(255 255 255 / .09); --line-strong: rgb(255 255 255 / .16);
  --accent: #0a84ff; --accent-soft: rgb(10 132 255 / .16);
  --good: #30d158; --good-soft: rgb(48 209 88 / .14);
  --warn: #ffb340; --warn-soft: rgb(255 179 64 / .14);
  --bad: #ff6961; --bad-soft: rgb(255 105 97 / .15);
  --neutral-soft: rgb(255 255 255 / .07);
  --shadow: none;
  --brand: #0a84ff;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; letter-spacing: -.008em; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -.022em; font-family: var(--font-display); }
h2 { font-size: 1.08rem; font-weight: 600; }
h3 { font-size: .9rem; font-weight: 600; }
p { margin: 0; }
code { font-size: .88em; }
a { color: var(--accent); }
.num, .value, td.n, .moneybig, .rate { font-variant-numeric: tabular-nums; }

/* ---------- Topo ---------- */
.topbar { position: sticky; top: 0; z-index: 5; background: var(--panel); backdrop-filter: blur(16px) saturate(1.4); -webkit-backdrop-filter: blur(16px) saturate(1.4); border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 1400px; margin: 0 auto; padding: .7rem 1.5rem; display: flex; flex-wrap: wrap; align-items: center; gap: .75rem .9rem; }
.brand { display: flex; align-items: center; gap: .55rem; }
.brand .logo { width: 30px; height: 30px; display: block; }
.brand .wordmark { font-family: var(--font-display); font-size: 1.18rem; font-weight: 600; letter-spacing: -.03em; }
.brand .wordmark b { font-weight: inherit; }
.group { display: flex; align-items: center; gap: .4rem; }
.spacer { flex: 1; }
.check { display: flex; gap: .35rem; align-items: center; color: var(--muted); font-size: .82rem; cursor: pointer; }

button, select, input { font: inherit; color: inherit; }
select, input { background: var(--panel-solid); border: 1px solid var(--line-strong); border-radius: 10px; padding: .42rem .6rem; }
select:focus, input:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button { border: 1px solid var(--line-strong); background: var(--panel-solid); border-radius: 980px; padding: .42rem .85rem; cursor: pointer; font-weight: 500; transition: background .2s, border-color .2s, color .2s, transform .15s; }
button:active { transform: scale(.98); }
button:hover { background: var(--neutral-soft); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.primary:hover { filter: brightness(1.08); background: var(--accent); }
button.primary:disabled { opacity: .6; cursor: wait; }
button.ghost { background: transparent; border-color: transparent; color: var(--muted); }
button.ghost:hover { background: var(--neutral-soft); color: var(--text); }
button.danger { color: var(--bad); }
#offerSelect { min-width: 220px; font-weight: 600; }
@media (max-width: 1400px) and (min-width: 641px) { #offerSelect { min-width: 0; max-width: 170px; } .topbar-inner { gap: .75rem .45rem; } }

/* ---------- Abas ---------- */
.nav { max-width: 1280px; margin: 0 auto; padding: 0 1.5rem; display: flex; gap: .25rem; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; padding: .65rem .85rem; color: var(--muted); white-space: nowrap; transition: color .2s, border-color .25s; }
.nav button:active { transform: none; }
.nav button:hover { color: var(--text); background: none; }
.nav button.on { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.nav .badge { display: inline-block; min-width: 18px; padding: 0 .35rem; margin-left: .35rem; border-radius: 99px; background: var(--bad-soft); color: var(--bad); font-size: .72rem; font-weight: 700; text-align: center; }

main { max-width: 1280px; margin: 0 auto; padding: 1.5rem; }
.empty { max-width: 600px; margin: 5rem auto; text-align: center; color: var(--muted); }
.empty h1 { color: var(--text); font-size: clamp(1.7rem, 3.5vw, 2.4rem); font-weight: 700; letter-spacing: -.035em; margin-bottom: .7rem; }

.meta-line { color: var(--muted); font-size: .82rem; margin-bottom: 1rem; }
.tab { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.5rem; }
.tab > *, .grid > *, .split > * { min-width: 0; }
.tab[hidden] { display: none; }

/* ---------- Blocos ---------- */
.grid { display: grid; gap: 1rem; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); }
.panel { backdrop-filter: blur(14px) saturate(1.3); -webkit-backdrop-filter: blur(14px) saturate(1.3); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.15rem 1.25rem; box-shadow: var(--shadow); }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: .75rem; }
.section-title .sub { margin: 0; }
.sub { color: var(--muted); font-size: .82rem; }
.eyebrow { font-size: .8rem; font-weight: 600; color: var(--muted); letter-spacing: -.005em; }

/* Diagnóstico principal */
.verdict { border-left: 4px solid var(--bad); display: grid; gap: .5rem; }
.verdict.ok { border-left-color: var(--good); }
.verdict .big { font-family: var(--font-display); font-size: 1.35rem; font-weight: 700; letter-spacing: -.02em; }
.verdict .first { background: var(--neutral-soft); border-radius: 8px; padding: .6rem .8rem; }
.verdict .first strong { display: block; font-size: .78rem; color: var(--muted); font-weight: 600; margin-bottom: .1rem; }

/* Notas por área */
.scores { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
@media (max-width: 900px) { .scores { grid-template-columns: repeat(2, 1fr); } }
.score { cursor: pointer; transition: border-color .15s; }
.score:hover { border-color: var(--line-strong); }
.score .top { display: flex; justify-content: space-between; align-items: baseline; }
.score .label { font-weight: 600; }
.score .num { font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; }
.score .num small { font-size: .8rem; color: var(--muted); font-weight: 500; }
.score.weakest { border-color: var(--bad); box-shadow: 0 0 0 1px var(--bad); }
.bar { height: 6px; background: var(--neutral-soft); border-radius: 99px; overflow: hidden; margin-top: .5rem; }
.bar > span { display: block; height: 100%; border-radius: 99px; }

/* Indicadores agrupados */
.kpi-group { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .75rem; }
.kpi { backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); padding: 1rem 1.15rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.kpi .label { color: var(--muted); font-size: .78rem; font-weight: 500; }
.kpi .value { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; letter-spacing: -.03em; margin-top: .2rem; }
.kpi .note { font-size: .75rem; margin-top: .15rem; }
.kpi-title { margin-bottom: .5rem; }

.c-bom { color: var(--good); } .bg-bom { background: var(--good); }
.c-atencao { color: var(--warn); } .bg-atencao { background: var(--warn); }
.c-fraco { color: var(--bad); } .bg-fraco { background: var(--bad); }
.c-sem_dados { color: var(--muted); } .bg-sem_dados { background: var(--muted); }

.chip { display: inline-block; padding: .12rem .55rem; border-radius: 99px; font-size: .72rem; font-weight: 600; white-space: nowrap; }
.chip.bom, .chip.escalar { background: var(--good-soft); color: var(--good); }
.chip.atencao, .chip.otimizar, .chip.media { background: var(--warn-soft); color: var(--warn); }
.chip.fraco, .chip.pausar, .chip.alta { background: var(--bad-soft); color: var(--bad); }
.chip.manter, .chip.aprendendo, .chip.baixa, .chip.sem_dados { background: var(--neutral-soft); color: var(--muted); }

/* Funil */
.funnel .step { display: grid; grid-template-columns: 160px 1fr 190px; gap: 1rem; align-items: center; padding: .5rem 0; border-top: 1px solid var(--line); }
.funnel .step:first-child { border-top: 0; }
.funnel .name { font-weight: 500; }
.funnel .track { background: var(--neutral-soft); border-radius: 6px; height: 30px; position: relative; }
.funnel .fill { background: color-mix(in srgb, var(--accent) 38%, transparent); height: 100%; border-radius: 6px; min-width: 2px; }
.funnel .track .count { position: absolute; left: .6rem; top: 50%; transform: translateY(-50%); font-size: .82rem; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text); }
.funnel .rate { font-size: .85rem; display: flex; flex-wrap: wrap; gap: .2rem .5rem; align-items: center; }
.funnel .rate .sub { width: 100%; font-size: .75rem; }
.funnel .step.leak .track { box-shadow: 0 0 0 2px var(--bad); }
@media (max-width: 760px) { .funnel .step { grid-template-columns: 1fr; gap: .3rem; } }

/* Prioridades */
.issue-group + .issue-group { margin-top: 1.25rem; }
.issue-group h3 { margin-bottom: .5rem; display: flex; gap: .5rem; align-items: center; }
.issues { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.issues li { border: 1px solid var(--line); border-radius: 10px; padding: .8rem 1rem; display: grid; gap: .25rem; }
.issues li.alta { border-left: 3px solid var(--bad); }
.issues li.media { border-left: 3px solid var(--warn); }
.issues li.baixa { border-left: 3px solid var(--line-strong); }
.issues .head { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.issues .t { font-weight: 600; }
.issues .d { color: var(--muted); font-size: .85rem; }
.issues .a { font-size: .87rem; background: var(--neutral-soft); border-radius: 6px; padding: .4rem .6rem; margin-top: .2rem; }
.issues .a b { font-weight: 600; }
.area-tag { font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }

/* Tabela */
table { width: 100%; border-collapse: collapse; font-size: .85rem; }
th, td { text-align: left; padding: .6rem .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:hover { background: var(--neutral-soft); }
th { color: var(--muted); font-weight: 600; font-size: .75rem; cursor: pointer; user-select: none; white-space: nowrap; text-transform: uppercase; letter-spacing: .03em; }
td.n, th.n { text-align: right; white-space: nowrap; }
td .parent { color: var(--muted); font-size: .75rem; }
.table-wrap { overflow-x: auto; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 9px; padding: 2px; gap: 2px; }
.seg button { border: 0; border-radius: 7px; padding: .3rem .8rem; font-size: .85rem; background: none; color: var(--muted); }
.seg button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

/* Verba */
.budget-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
@media (max-width: 760px) { .budget-summary { grid-template-columns: 1fr; } }
.moneybig { font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; }
.moves { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.moves li { display: flex; justify-content: space-between; gap: 1rem; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: .65rem .9rem; }
.moves .amt { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Listas de verificação */
.checks { list-style: none; margin: 0; padding: 0; }
.checks li { display: flex; justify-content: space-between; gap: 1rem; padding: .55rem 0; border-top: 1px solid var(--line); }
.checks li:first-child { border-top: 0; }
.checks .k { color: var(--muted); }
.checks .v { text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }
.checks-title { margin: 1rem 0 .25rem; }

/* Gráfico */
.chart svg { width: 100%; height: auto; display: block; }
.chart svg text { font-family: inherit; }
.legend { display: flex; gap: 1rem; font-size: .8rem; color: var(--muted); }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: .3rem; vertical-align: -1px; }
.tooltip { position: fixed; pointer-events: none; background: var(--text); color: var(--bg); padding: .4rem .6rem; border-radius: 6px; font-size: .78rem; z-index: 20; }

.warnings { background: var(--warn-soft); color: var(--warn); border-radius: var(--radius); padding: .7rem 1rem; font-size: .85rem; }
.warnings ul { margin: .2rem 0 0; padding-left: 1.1rem; }

.ai-out { line-height: 1.65; max-width: 820px; }
.ai-out h2 { font-size: 1rem; margin: 1.3rem 0 .4rem; }
.ai-out p { margin: .4rem 0; }
.ai-out ul, .ai-out ol { padding-left: 1.3rem; }
.loading { color: var(--muted); font-style: italic; }

/* Janelas */
dialog { border: 1px solid var(--line); border-radius: 14px; padding: 0; background: var(--panel-solid); color: var(--text); width: min(640px, 94vw); }
dialog::backdrop { background: rgb(0 0 0 / .45); }
dialog form { padding: 1.4rem 1.5rem; display: grid; gap: .8rem; }
dialog h2 { font-size: 1.1rem; }
dialog label { display: grid; gap: .3rem; font-size: .82rem; color: var(--muted); font-weight: 500; }
dialog input, dialog select { width: 100%; color: var(--text); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .8rem; }
@media (max-width: 560px) { .row2, .row3 { grid-template-columns: 1fr; } }
.actions { display: flex; gap: .5rem; margin-top: .4rem; }
.hint { color: var(--muted); font-size: .8rem; }
.fieldset-title { margin-top: .4rem; }

/* ---------- Fundo 3D ---------- */
#bg3d { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: -1; display: block; pointer-events: none; }
body { background: var(--bg); }

/* ---------- Dashboard ---------- */
.dcards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
@media (max-width: 1000px) { .dcards { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .dcards { grid-template-columns: 1fr; } }
.dcard { position: relative; overflow: hidden; padding: 1rem 1.15rem .9rem; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel); backdrop-filter: blur(14px) saturate(1.3); -webkit-backdrop-filter: blur(14px) saturate(1.3); box-shadow: var(--shadow); min-height: 128px; }
.dcard .dlabel { color: var(--muted); font-size: .78rem; font-weight: 500; }
.dcard .dvalue { font-family: var(--font-display); font-size: 1.7rem; font-weight: 700; letter-spacing: -.035em; margin-top: .15rem; font-variant-numeric: tabular-nums; position: relative; z-index: 1; }
.dcard .dfoot { font-size: .75rem; min-height: 1.1rem; position: relative; z-index: 1; display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.dcard .spark { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 40px; }
.delta { font-weight: 600; font-variant-numeric: tabular-nums; }
.delta.up { color: var(--good); } .delta.down { color: var(--bad); }

svg.xy { width: 100%; height: auto; display: block; }
svg .ax { font-size: 11px; fill: var(--muted); font-family: inherit; font-variant-numeric: tabular-nums; }
svg.xy rect[data-tip]:hover { fill: rgb(127 127 127 / .08); }
.split { display: grid; grid-template-columns: 220px 1fr; gap: 1.5rem; align-items: center; }
@media (max-width: 760px) { .split { grid-template-columns: 1fr; } }
.donut-wrap { max-width: 220px; margin: 0 auto; }
svg.donut { width: 100%; height: auto; }
svg.donut path { transition: opacity .15s; cursor: default; }
svg.donut path:hover { opacity: .8; }
.donut-v { font-size: 17px; font-weight: 700; fill: var(--text); font-family: inherit; }
.minibar { height: 4px; background: var(--neutral-soft); border-radius: 99px; margin-top: .3rem; overflow: hidden; }
.minibar span { display: block; height: 100%; border-radius: 99px; }
td .sw { margin-right: .5rem; }
.linkbtn { border: 0; background: none; color: var(--accent); font-weight: 600; padding: 0; font-size: .85rem; }
.linkbtn:hover { background: none; text-decoration: underline; }
.legend { flex-wrap: wrap; }

/* ---------- Carregamento ---------- */
body.booting #app, body.booting #authScreen { visibility: hidden; }
[hidden] { display: none !important; }

/* ---------- Login ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 2rem 1rem; }
.auth-card { width: min(420px, 100%); background: var(--panel-solid); border: 1px solid var(--line); border-radius: 18px; padding: 2rem 1.8rem; box-shadow: 0 30px 80px rgb(0 0 0 / .35); display: grid; gap: 1rem; }
.auth-brand { display: flex; align-items: center; gap: .8rem; margin-bottom: .3rem; }

.wordmark.big { font-family: var(--font-display); font-size: 1.8rem; font-weight: 700; letter-spacing: -.04em; line-height: 1.1; }
.wordmark.big b { font-weight: inherit; }
.auth-seg { display: flex; width: 100%; }
.auth-seg button { flex: 1; }
#authMain { display: grid; gap: .9rem; }
.auth-form { display: grid; gap: .75rem; }
.auth-form label { display: grid; gap: .3rem; font-size: .82rem; color: var(--muted); font-weight: 500; }
.auth-form input { width: 100%; padding: .6rem .7rem; color: var(--text); caret-color: var(--accent); line-height: 1.4; font-size: .9rem; font-weight: 400; }
.google-btn { display: flex; align-items: center; justify-content: center; gap: .6rem; padding: .62rem; font-weight: 600; width: 100%; }
.divider { display: flex; align-items: center; gap: .7rem; color: var(--muted); font-size: .78rem; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line-strong); }
button.wide { width: 100%; padding: .65rem; }
.linkbtn.center { justify-self: center; }
.auth-msg { font-size: .85rem; min-height: 1.2em; margin: 0; text-align: center; }
.auth-msg.err { color: var(--bad); } .auth-msg.ok { color: var(--good); }
.invite-banner { background: var(--accent-soft); color: var(--accent); border-radius: 10px; padding: .6rem .8rem; font-size: .85rem; font-weight: 500; }

/* ---------- Menu da conta ---------- */
.user-menu { position: relative; }
.avatar { width: 36px; height: 36px; border-radius: 50%; padding: 0; font-weight: 700; color: #fff; border: 0; background: var(--brand); }
.avatar:hover { filter: brightness(1.1); background: var(--brand); }
.menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 240px; background: var(--panel-solid); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 40px rgb(0 0 0 / .22); padding: .4rem; z-index: 30; display: grid; }
.menu-head { padding: .6rem .7rem .7rem; border-bottom: 1px solid var(--line); margin-bottom: .3rem; display: grid; gap: .35rem; justify-items: start; }
.menu-email { font-weight: 600; font-size: .85rem; word-break: break-all; }
.menu button { border: 0; background: none; text-align: left; padding: .55rem .7rem; border-radius: 8px; font-weight: 500; }
.menu button:hover { background: var(--neutral-soft); }
.chip.plan-gratuito { background: var(--neutral-soft); color: var(--muted); }
.chip.plan-premium { background: var(--accent-soft); color: var(--accent); }
.chip.plan-master { background: var(--brand); color: #fff; }

.empty img { margin: 0 auto 1.4rem; }
.empty p { margin-top: .4rem; }
.empty-actions { display: flex; gap: .6rem; justify-content: center; margin-top: 1.2rem; }

/* ---------- Administração ---------- */
dialog.wide-dialog { width: min(980px, 96vw); }
.dialog-body { padding: 1.4rem 1.5rem; }
code.code { font-size: .78rem; word-break: break-all; }

/* ---------- Guia ---------- */
dialog.guide { width: min(940px, 96vw); border-radius: 18px; overflow: hidden; }
.guide-body { display: grid; grid-template-rows: auto auto auto; position: relative; }
.guide-skip { position: absolute; top: .7rem; right: .7rem; z-index: 2; background: rgb(0 0 0 / .45) !important; color: #fff !important; backdrop-filter: blur(6px); }
.guide-shot { background: #111113; padding: 1.4rem 1.4rem 0; display: grid; place-items: center; max-height: 52vh; overflow: hidden; }
.guide-shot img { width: 100%; max-height: calc(52vh - 1.4rem); object-fit: cover; object-position: top center; border-radius: 10px 10px 0 0; box-shadow: 0 -2px 30px rgb(0 0 0 / .35); display: block; }
.guide-shot img.in { animation: guideIn .35s ease; }
@keyframes guideIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .guide-shot img.in { animation: none; } }
.guide-text { padding: 1.2rem 1.6rem .4rem; display: grid; gap: .4rem; }
.guide-text h2 { font-size: 1.3rem; letter-spacing: -.02em; }
.guide-text p, .guide-text li { line-height: 1.55; }
.guide-text p + p { margin-top: .4rem; }
.guide-text ul, .guide-text ol { margin: .3rem 0; padding-left: 1.2rem; }
.guide-foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.6rem 1.3rem; }
.guide-foot button:disabled { opacity: .4; cursor: default; }
.dots { display: flex; gap: .4rem; }
.dot { width: 8px; height: 8px; padding: 0; border-radius: 99px; border: 0; background: var(--line-strong); transition: width .2s, background .2s; }
.dot.on { width: 22px; background: var(--accent); }
.dot:hover { background: var(--accent); }
.guide-body { grid-template-columns: minmax(0, 1fr); }
.guide-foot button { white-space: nowrap; }
/* Guia no celular: tudo cabe na largura, print ampliado no canto, bolinhas numa linha própria */
@media (max-width: 640px) {
  dialog.guide { width: calc(100vw - 1rem); max-width: none; max-height: calc(100dvh - 1rem); overflow-y: auto; border-radius: 16px; }
  .guide-shot { padding: .8rem .8rem 0; max-height: 30vh; place-items: start; }
  .guide-shot img { width: 185%; max-width: none; max-height: none; object-fit: initial; border-radius: 8px 0 0 0; }
  .guide-shot img[data-focus="center"] { margin-left: -42.5%; border-radius: 0; }
  .guide-skip { top: .5rem; right: .5rem; padding: .35rem .75rem; font-size: .85rem; }
  .guide-text { padding: 1rem 1.1rem .2rem; }
  .guide-text h2 { font-size: 1.15rem; }
  .guide-text p, .guide-text li { font-size: .95rem; line-height: 1.5; }
  .guide-foot { flex-wrap: wrap; padding: .8rem 1.1rem 1.1rem; gap: .8rem; }
  .guide-foot .dots { order: -1; flex-basis: 100%; justify-content: center; gap: .35rem; }
  .guide-foot button:not(.dot) { flex: 1; justify-content: center; }
}

/* ---------- Avisos ---------- */
#toasts { position: fixed; bottom: 1.2rem; right: 1.2rem; display: grid; gap: .5rem; z-index: 100; }
.toast { background: var(--panel-solid); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 10px; padding: .7rem 1rem; box-shadow: 0 10px 30px rgb(0 0 0 / .2); font-size: .88rem; max-width: 360px; transition: opacity .3s, transform .3s; }
.toast.ok { border-left-color: var(--good); } .toast.err { border-left-color: var(--bad); }
.toast.out { opacity: 0; transform: translateY(6px); }
.auth-legal { margin: 1rem 0 0; text-align: center; font-size: .78rem; color: var(--muted); }
.auth-legal a { color: var(--muted); }

/* ---------- Tema Dia / Noite ---------- */
.theme-switch { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); }
.theme-switch button { display: inline-flex; align-items: center; gap: .35rem; border: 0; border-radius: 999px; padding: .3rem .65rem; font-size: .8rem; font-weight: 500; background: transparent; color: var(--muted); cursor: pointer; }
.theme-switch button:hover { color: var(--text); background: transparent; }
.theme-switch button.on { background: var(--accent); color: #fff; }
.theme-switch svg { width: 14px; height: 14px; }
.auth-card { position: relative; }
.auth-theme { display: flex; justify-content: center; margin-top: 1rem; }
@media (max-width: 1500px) { .topbar .theme-switch .t-label { display: none; } .topbar .theme-switch button { padding: .35rem .5rem; } }

/* ---------- Conectar dados / importar relatório ---------- */
.empty.wide { max-width: 760px; }
.connect-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; margin-top: 1rem; text-align: left; }
.connect-card { position: relative; display: grid; gap: .5rem; align-content: start; padding: 1.1rem 1.2rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.connect-card h3 { font-size: 1rem; color: var(--text); }
.connect-card p { color: var(--muted); font-size: .85rem; }
.connect-card button { justify-self: start; margin-top: .3rem; }
.connect-card .tag { justify-self: start; font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--accent); background: var(--accent-soft); padding: .15rem .5rem; border-radius: 999px; }
.connect-panel h2 { margin-bottom: .2rem; }
.empty-actions.left { justify-content: flex-start; margin-top: .8rem; }
#importDialog { width: min(720px, 96vw); }
.import-steps { margin: 0; padding-left: 1.2rem; display: grid; gap: .35rem; font-size: .85rem; color: var(--text); }
.import-steps a { font-weight: 600; }
.dropzone { position: relative; display: grid !important; place-items: center; gap: .2rem; padding: 1.4rem; border: 2px dashed var(--line-strong); border-radius: var(--radius); background: var(--accent-soft); text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone strong { color: var(--accent); font-size: .95rem; }
.dropzone span { color: var(--muted); font-size: .8rem; }
.dropzone:hover, .dropzone.drag { border-color: var(--accent); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.import-preview { display: grid; gap: .25rem; padding: .8rem 1rem; border-radius: var(--radius); border: 1px solid var(--line); font-size: .85rem; color: var(--text); }
.import-preview.err { border-color: var(--bad); background: var(--bad-soft); color: var(--bad); }
.import-preview .warn-line { color: var(--warn); margin-top: .3rem; }
dialog label.check { display: flex; align-items: center; gap: .45rem; color: var(--muted); }
dialog label.check input { width: auto; }

/* ---------- Planos ---------- */
.nav button.locked { opacity: .7; }
.nav button.locked::after { content: ""; display: inline-block; width: 11px; height: 11px; margin-left: .35rem; vertical-align: -1px; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'%3E%3Crect x='4' y='11' width='16' height='10' rx='2'/%3E%3Cpath d='M8 11V7a4 4 0 0 1 8 0v4'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'%3E%3Crect x='4' y='11' width='16' height='10' rx='2'/%3E%3Cpath d='M8 11V7a4 4 0 0 1 8 0v4'/%3E%3C/svg%3E") center / contain no-repeat; }
.locked-panel { text-align: center; padding: 2.5rem 1.5rem; }
.locked-panel h2 { margin: .6rem 0 .4rem; }
.locked-panel .sub { max-width: 520px; margin: .3rem auto; }
.locked-panel .empty-actions { justify-content: center; margin-top: 1rem; }
.lock-ico { width: 48px; height: 48px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.lock-ico svg { width: 22px; height: 22px; }
#plansDialog { width: min(860px, 96vw); }
.plans-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .8rem; margin: 1rem 0; }
.plan-card { position: relative; border: 1px solid var(--border); border-radius: 12px; padding: 1rem; background: var(--panel); }
.plan-card.current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.plan-card .tag { position: absolute; top: .7rem; right: .7rem; font-size: .72rem; font-weight: 700; padding: .1rem .5rem; border-radius: 99px; background: var(--accent-soft); color: var(--accent); }
.plan-card h3 { margin: 0 0 .3rem; }
.plan-card .plan-lp { margin: 0 0 .6rem; color: var(--accent); }
.plan-card ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .35rem; font-size: .9rem; }
.plan-card li { display: flex; gap: .5rem; }
.plan-card li span { width: 1rem; flex: none; font-weight: 700; }
.plan-card li.yes span { color: var(--good, #16a34a); }
.plan-card li.no { color: var(--muted); }

.plan-price { margin: 0 0 .2rem; display: flex; align-items: baseline; gap: .25rem; flex-wrap: wrap; }
.plan-price strong { font-size: 1.5rem; }
.plan-price span { color: var(--muted); }
.plan-price em { flex-basis: 100%; font-style: normal; font-size: .82rem; color: var(--muted); }
.plan-card { display: flex; flex-direction: column; }
.plan-buy { display: grid; gap: .45rem; margin-top: auto; padding-top: 1rem; }
a.btn { display: inline-flex; justify-content: center; align-items: center; gap: .4rem; padding: .55rem .9rem; border-radius: 10px; border: 1px solid var(--border); background: var(--panel); color: var(--text); text-decoration: none; font-weight: 600; font-size: .9rem; }
a.btn:not(.primary) { border-color: var(--accent); color: var(--accent); background: transparent; }
a.btn:hover { filter: brightness(1.1); }
a.btn.primary { background: var(--accent); border-color: transparent; color: #fff; }
a.btn small { font-weight: 500; opacity: .8; }
.billing-form h3 { margin: 1.1rem 0 .4rem; font-size: 1rem; }
.billing-grid { display: grid; grid-template-columns: 130px 1fr 110px; gap: .45rem .6rem; align-items: center; }
.billing-grid > strong { font-size: .8rem; color: var(--muted); font-weight: 600; }
.copy-row { display: flex; gap: .5rem; }
.copy-row input { flex: 1; }

/* Lucro real */
.sales-setup { border-top: 1px solid var(--line, rgba(127,127,127,.2)); margin-top: 1rem; padding-top: 1rem; display: grid; gap: .4rem; }
.product-pick { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; }
.product-pick small { opacity: .7; margin-left: .3rem; }
.kpi .label .linkbtn { font-size: .75rem; margin-left: .3rem; }

/* Alertas */
.bell { position: relative; padding: .45rem .55rem; }
.bell svg { width: 18px; height: 18px; display: block; }
.bell .badge { position: absolute; top: -4px; right: -4px; min-width: 18px; padding: 0 .3rem; border-radius: 99px; background: var(--bad); color: #fff; font-size: .7rem; font-weight: 700; line-height: 18px; text-align: center; }
.eye .eye-closed { display: none; }
.hide-values .eye .eye-open { display: none; }
.hide-values .eye .eye-closed { display: block; }
.hide-values .eye { color: var(--accent); }
/* Valores escondidos (olho fechado) */
#report :is(.dvalue, .kpi .value, td.n, .moneybig, .amt, .donut-v, .minibar, svg.xy text[text-anchor="end"]) { transition: filter .3s ease; }
.hide-values #report :is(.dvalue, .kpi .value, td.n, .moneybig, .amt, .donut-v, .minibar, svg.xy text[text-anchor="end"]) { filter: blur(.45em); user-select: none; }
.hide-values .tooltip { display: none !important; }
.preview-banner h2 { font-size: 1.25rem; letter-spacing: -.02em; margin: .25rem 0 .35rem; }
.preview-banner .empty-actions { margin-top: 1rem; }
.alerts-list { max-height: 60vh; overflow: auto; }
.alerts-list h3 { margin: 1rem 0 .4rem; font-size: .9rem; color: var(--muted); }

/* Código de confirmação */
.code-input { font-size: 1.6rem; letter-spacing: .5em; text-align: center; font-variant-numeric: tabular-nums; }
#codeForm .center { text-align: center; }

.open-signup { display: flex; gap: .6rem; align-items: flex-start; background: var(--accent-soft); border-radius: var(--radius); padding: .7rem .9rem; margin-bottom: 1rem; font-size: .88rem; }
.open-signup input { margin-top: .2rem; }

/* ---------- Movimento (estilo Apple) ---------- */
/* Conteúdo da aba entra subindo de leve; títulos aparecem da esquerda para a direita */
@keyframes nv-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes nv-write { from { clip-path: inset(-.3em 100% -.3em 0); opacity: .2; } to { clip-path: inset(-.3em -.2em -.3em 0); opacity: 1; } }
.tab:not([hidden]) > * { animation: nv-rise .6s cubic-bezier(.22,.61,.36,1) both; }
.tab:not([hidden]) > *:nth-child(2) { animation-delay: .05s; }
.tab:not([hidden]) > *:nth-child(3) { animation-delay: .1s; }
.tab:not([hidden]) > *:nth-child(4) { animation-delay: .15s; }
.tab:not([hidden]) > *:nth-child(n+5) { animation-delay: .2s; }
.verdict .big, .empty h1, .auth-card .wordmark.big { animation: nv-write .9s cubic-bezier(.22,.61,.36,1) both; }
@media (prefers-reduced-motion: reduce) {
  .tab:not([hidden]) > *, .verdict .big, .empty h1, .auth-card .wordmark.big { animation: none; }
}

/* ---------- Celular: topo em 3 linhas organizadas ---------- */
@media (max-width: 640px) {
  .topbar-inner { display: grid; grid-template-columns: 1fr auto auto auto auto; align-items: center; gap: .6rem .5rem; padding: .65rem 1rem; }
  .topbar-inner > .spacer { display: none; }
  .topbar-inner > .brand { grid-row: 1; grid-column: 1; }
  .topbar-inner > .theme-switch { grid-row: 1; grid-column: 2; }
  .topbar-inner > .eye { grid-row: 1; grid-column: 3; }
  .topbar-inner > #alertsBtn { grid-row: 1; grid-column: 4; }
  .topbar-inner > .user-menu { grid-row: 1; grid-column: 5; }
  #offerGroup { grid-row: 2; grid-column: 1 / -1; min-width: 0; }
  #offerSelect { flex: 1; min-width: 0; }
  #offerGroup .ghost { padding-left: .55rem; padding-right: .55rem; }
  #analyzeGroup { grid-row: 3; grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
  #periodSelect { width: 100%; min-width: 0; }
  #analyzeGroup .check { justify-content: flex-end; }
  #analyzeGroup button { width: 100%; }
  /* No celular só as abas ficam presas no topo; o resto do cabeçalho rola junto */
  .topbar { display: contents; }
  .topbar-inner { background: var(--panel); border-bottom: 1px solid var(--line); }
  .nav { padding: 0 .5rem; position: sticky; top: 0; z-index: 5; background: var(--panel); backdrop-filter: blur(20px) saturate(1.6); -webkit-backdrop-filter: blur(20px) saturate(1.6); border-bottom: 1px solid var(--line); }
  .section-title { flex-wrap: wrap; }
  /* Gráficos de linha: ficam legíveis e rolam para o lado com o dedo */
  .panel:has(> svg.xy) { overflow-x: auto; }
  svg.xy { min-width: 620px; }
  main { padding: 1rem; }
  .g2 { grid-template-columns: 1fr; }
}

.captcha-box:empty { display: none; }
