/* Vely — camada "glass" do PAINEL (/app, /app/admin) e das telas de login/cadastro.
   Carregada DEPOIS de app.css, só nessas páginas (render.layout). Landing e checkout não carregam.
   Tom corporativo: vidro fosco, cantos bem arredondados, brilho discreto (sem neon), grade alinhada.
   Regras duras herdadas: só transform/opacity em transição, nunca transition:all, sem inline.
   Os tokens de superfície/borda/raio são trocados aqui; o resto do app.css continua valendo. */

/* ===================== TOKENS — escuro ===================== */
html:not([data-theme="light"]) body.is-app,
body.is-auth {
  --bg-deep: #07070F;
  --surface: rgba(9, 7, 22, 0.46);
  --surface-2: rgba(255, 255, 255, 0.058);
  --surface-3: rgba(255, 255, 255, 0.09);
  --surface-4: rgba(255, 255, 255, 0.135);
  --border: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.19);
  --border-soft: rgba(255, 255, 255, 0.06);
  --sh-md: 0 12px 32px -10px rgba(2, 0, 12, 0.60);
  --sh-lg: 0 28px 64px -14px rgba(2, 0, 12, 0.70);
  --sh-inset: inset 0 1px 0 rgba(255, 255, 255, 0.10), inset 0 0 0 1px rgba(255, 255, 255, 0.015);
  --glow-sm: 0 0 0 3px rgba(139, 63, 232, 0.26);
  --glow-md: 0 10px 30px -12px rgba(100, 16, 201, 0.55);
  --grad-surface: linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0) 55%);
  --glass-fill: linear-gradient(180deg, rgba(255, 255, 255, 0.082), rgba(255, 255, 255, 0.036));
  --glass-pop: rgba(22, 17, 44, 0.80);
  --glass-hi: rgba(255, 255, 255, 0.14);
  --glass-tint: rgba(139, 63, 232, 0.20);
  --glass-tint-line: rgba(160, 100, 245, 0.42);
}
/* ===================== TOKENS — claro ===================== */
html[data-theme="light"] body.is-app {
  --bg-deep: #ECEEF6;
  --surface: rgba(255, 255, 255, 0.55);
  --surface-2: rgba(255, 255, 255, 0.58);
  --surface-3: rgba(255, 255, 255, 0.78);
  --surface-4: rgba(255, 255, 255, 0.92);
  --border: rgba(96, 84, 150, 0.16);
  --border-strong: rgba(96, 84, 150, 0.28);
  --border-soft: rgba(96, 84, 150, 0.09);
  --sh-md: 0 12px 30px -12px rgba(52, 40, 110, 0.20);
  --sh-lg: 0 28px 60px -16px rgba(52, 40, 110, 0.30);
  --sh-inset: inset 0 1px 0 rgba(255, 255, 255, 0.85), inset 0 0 0 1px rgba(255, 255, 255, 0.25);
  --glow-sm: 0 0 0 3px rgba(100, 16, 201, 0.18);
  --glow-md: 0 10px 26px -12px rgba(100, 16, 201, 0.35);
  --grad-surface: linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0) 55%);
  --glass-fill: linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.50));
  --glass-pop: rgba(255, 255, 255, 0.90);
  --glass-hi: rgba(255, 255, 255, 0.9);
  --glass-tint: rgba(100, 16, 201, 0.10);
  --glass-tint-line: rgba(100, 16, 201, 0.30);
}
/* Raios maiores em tudo (inputs, botões, cards, modais usam estes tokens). */
body.is-app, body.is-auth {
  --r-xs: 8px; --r-sm: 11px; --r-md: 14px; --r-lg: 20px; --r-xl: 28px;
  --glass-blur: blur(20px) saturate(155%);
  --ease-glide: cubic-bezier(0.3, 0.1, 0.1, 1);       /* arranque macio, pouso longo */
  --ease-soft: cubic-bezier(0.4, 0, 0.2, 1);           /* fades */
}

/* O PREVIEW do checkout dentro do editor tem que continuar IDÊNTICO ao checkout real (tokens originais). */
html:not([data-theme="light"]) body.is-app .checkout-page {
  --surface: #0E0A1A; --surface-2: #141026; --surface-3: #1B1630; --surface-4: #221B3D;
  --border: #241F38; --border-strong: #2E2850; --border-soft: rgba(255, 255, 255, 0.04);
  --r-xs: 6px; --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 22px;
  --sh-md: 0 6px 20px rgba(0, 0, 0, 0.45); --sh-lg: 0 18px 50px rgba(0, 0, 0, 0.55);
  --sh-inset: inset 0 1px 0 rgba(255, 255, 255, 0.05), inset 0 -1px 0 rgba(0, 0, 0, 0.30);
  --glow-sm: 0 0 0 3px var(--brand-20); --glow-md: 0 8px 28px -8px var(--glow);
  --grad-surface: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0) 40%);
}
html[data-theme="light"] body.is-app .checkout-page {
  --surface: #FFFFFF; --surface-2: #FFFFFF; --surface-3: #F7F6FB; --surface-4: #EFEDF6;
  --border: #E6E3F0; --border-strong: #D6D1E6; --border-soft: rgba(20, 16, 40, 0.05);
  --r-xs: 6px; --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 22px;
  --sh-md: 0 6px 20px rgba(23, 19, 38, 0.08); --sh-lg: 0 18px 50px rgba(23, 19, 38, 0.12);
  --sh-inset: inset 0 1px 0 rgba(255, 255, 255, 0.6), inset 0 -1px 0 rgba(23, 19, 38, 0.04);
  --glow-sm: 0 0 0 3px var(--brand-20); --glow-md: 0 8px 28px -8px var(--glow);
  --grad-surface: linear-gradient(180deg, rgba(20, 16, 40, 0.03), rgba(20, 16, 40, 0) 40%);
}

/* ===================== FUNDO ===================== */
/* Duas luzes suaves (violeta e índigo) sobre azul-noite: dão o que o vidro "refrata". Sem neon. */
html:not([data-theme="light"]) body.is-app::before,
body.is-auth::before {
  background:
    radial-gradient(900px 620px at 88% -6%, rgba(100, 16, 201, 0.34), transparent 62%),
    radial-gradient(820px 600px at -4% 104%, rgba(54, 70, 196, 0.26), transparent 60%),
    radial-gradient(520px 380px at 46% 48%, rgba(120, 60, 220, 0.07), transparent 70%),
    var(--bg-deep);
  background-attachment: fixed;
}
html[data-theme="light"] body.is-app::before {
  background:
    radial-gradient(900px 620px at 90% -8%, rgba(139, 92, 246, 0.26), transparent 62%),
    radial-gradient(820px 600px at -6% 106%, rgba(99, 112, 241, 0.20), transparent 60%),
    radial-gradient(520px 380px at 46% 48%, rgba(180, 160, 250, 0.16), transparent 70%),
    var(--bg-deep);
  background-attachment: fixed;
}

/* ===================== BARRAS DE ROLAGEM (finas, no tom do vidro) ===================== */
html:not([data-theme="light"]):has(body.is-app), html:has(body.is-auth) { color-scheme: dark; }
html:not([data-theme="light"]) body.is-app, html:not([data-theme="light"]) body.is-app * { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.24) transparent; }
html[data-theme="light"] body.is-app, html[data-theme="light"] body.is-app * { scrollbar-width: thin; scrollbar-color: rgba(52, 40, 110, 0.30) transparent; }
/* ===================== TIPOGRAFIA (sóbria) ===================== */
body.is-app .page-title { font-size: 24px; letter-spacing: -0.022em; font-weight: 640; }
body.is-app .card-title { font-size: 17px; letter-spacing: -0.012em; font-weight: 620; }
body.is-app .eyebrow { letter-spacing: 0.09em; }

/* ===================== SHELL FLUTUANTE (desktop) ===================== */
@media (min-width: 861px) {
  body.is-app .shell { padding: 16px; gap: 16px; align-items: start; }
  body.is-app .sidebar {
    top: 16px; height: calc(100vh - 32px);
    border: 1px solid var(--border); border-radius: var(--r-xl);
    background: var(--glass-fill);
    -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
    box-shadow: var(--sh-lg), var(--sh-inset);
  }
  body.is-app .main { gap: 16px; }
  body.is-app .topbar {
    top: 16px; border: 1px solid var(--border); border-radius: var(--r-xl);
    padding: 12px 20px; background: var(--glass-fill);
    -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
    box-shadow: var(--sh-md), var(--sh-inset);
  }
  /* Topo e conteúdo compartilham a MESMA largura máxima (no .main), então a margem direita sempre alinha. */
  body.is-app .main { width: 100%; max-width: 1760px; margin-inline: auto; }
  body.is-app .content { padding: 4px 4px 32px; max-width: none; }
}
/* Mobile: a gaveta lateral e a barra do topo ficam em vidro mais opaco (precisa ler por cima de tudo). */
@media (max-width: 860px) {
  /* Barra do topo compacta: só avatar (sem nome/seta) e título que encolhe com reticências. */
  body.is-app .topbar { padding: 10px 12px; gap: 8px; }
  body.is-app .topbar-left { min-width: 0; flex: 1 1 auto; }
  body.is-app .page-title { font-size: 18px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  body.is-app .topbar-right { gap: 2px; flex: none; }
  body.is-app .profile-name, body.is-app .profile-chevron { display: none; }
  body.is-app .profile { padding: 3px; }
  body.is-app .sidebar {
    background: var(--glass-pop); border-right: 1px solid var(--border-strong);
    border-radius: 0 var(--r-xl) var(--r-xl) 0;
    -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  }
  body.is-app .topbar { background: var(--glass-pop); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); }
  body.is-app .nav-backdrop { -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); }
}
html[data-theme="light"] body.is-app .sidebar,
html[data-theme="light"] body.is-app .topbar { background: var(--glass-fill); border-color: var(--border); }
@media (max-width: 860px) {
  html[data-theme="light"] body.is-app .sidebar,
  html[data-theme="light"] body.is-app .topbar { background: var(--glass-pop); }
}

/* ===================== BARRA LATERAL RECOLHIDA (desktop) =====================
   Por padrão a barra fica fora da tela e desliza para dentro quando o mouse chega na borda esquerda
   (a 44 px da borda, com uma "aba" discreta). O alfinete (html[data-side="pinned"]) volta ao
   modo fixo. No celular nada muda: continua a gaveta. */
.side-hot { display: none; }
@media (min-width: 861px) {
  html:not([data-side="pinned"]) body.is-app:not(.is-builder) .shell { grid-template-columns: minmax(0, 1fr); }
  html:not([data-side="pinned"]) body.is-app .sidebar {
    position: fixed; top: 16px; left: 16px; width: 256px; height: calc(100vh - 32px); z-index: 70;
    transform: translateX(calc(-100% - 40px)); opacity: 0; visibility: hidden; will-change: transform, opacity;
    transition: transform 480ms var(--ease-glide), opacity 360ms var(--ease-soft), visibility 0s linear 480ms;
  }
  html:not([data-side="pinned"]) body.is-app .shell:is(.side-hover, .nav-open) .sidebar {
    transform: translateX(0); opacity: 1; visibility: visible;
    transition: transform 680ms var(--ease-glide), opacity 480ms var(--ease-soft), visibility 0s;
  }
  html:not([data-side="pinned"]) body.is-app .menu-btn { display: inline-flex; }

  html:not([data-side="pinned"]) body.is-app .side-hot { display: block; position: fixed; top: 0; bottom: 0; left: 0; width: 44px; z-index: 69; }
  html:not([data-side="pinned"]) body.is-app .side-hot::after {
    content: ""; position: absolute; left: 6px; top: 50%; width: 4px; height: 72px; border-radius: 999px;
    transform: translateY(-50%); background: var(--glass-hi); border: 1px solid var(--border-strong);
    box-shadow: var(--sh-inset); opacity: 0.85; transition: opacity 200ms var(--ease-out), transform 200ms var(--ease-out);
  }
  html:not([data-side="pinned"]) body.is-app .side-hot:hover::after { opacity: 1; transform: translateY(-50%) scaleY(1.25); }
  html:not([data-side="pinned"]) body.is-app .shell:is(.side-hover, .nav-open) .side-hot::after { opacity: 0; }
}
/* Movimento ao abrir: os itens entram em cascata (só transform/opacity). Fechada, ficam levemente
   deslocados; ao abrir, cada um chega 28 ms depois do anterior. A animação de entrada de página
   (.stagger) é desligada nesse modo para não brigar com a transição. */
@media (min-width: 861px) {
  html:not([data-side="pinned"]) body.is-app .sidebar .nav-item,
  html:not([data-side="pinned"]) body.is-app .sidebar .nav-section-label,
  html:not([data-side="pinned"]) body.is-app .sidebar .side-foot {
    animation: none; opacity: 0; transform: translateX(-22px);
    transition: opacity 260ms var(--ease-soft), transform 320ms var(--ease-soft), background var(--d-hover) var(--ease-out), color var(--d-hover) var(--ease-out);
  }
  html:not([data-side="pinned"]) body.is-app .shell:is(.side-hover, .nav-open) .sidebar .nav-item,
  html:not([data-side="pinned"]) body.is-app .shell:is(.side-hover, .nav-open) .sidebar .nav-section-label,
  html:not([data-side="pinned"]) body.is-app .shell:is(.side-hover, .nav-open) .sidebar .side-foot {
    opacity: 1; transform: translateX(0);
    transition: opacity 460ms var(--ease-soft), transform 680ms var(--ease-glide), background var(--d-hover) var(--ease-out), color var(--d-hover) var(--ease-out);
  }
  html:not([data-side="pinned"]) body.is-app .shell:is(.side-hover, .nav-open) .sidebar .nav > :nth-child(1) { transition-delay: 70ms, 70ms, 0s, 0s; }
  html:not([data-side="pinned"]) body.is-app .shell:is(.side-hover, .nav-open) .sidebar .nav > :nth-child(2) { transition-delay: 98ms, 98ms, 0s, 0s; }
  html:not([data-side="pinned"]) body.is-app .shell:is(.side-hover, .nav-open) .sidebar .nav > :nth-child(3) { transition-delay: 126ms, 126ms, 0s, 0s; }
  html:not([data-side="pinned"]) body.is-app .shell:is(.side-hover, .nav-open) .sidebar .nav > :nth-child(4) { transition-delay: 154ms, 154ms, 0s, 0s; }
  html:not([data-side="pinned"]) body.is-app .shell:is(.side-hover, .nav-open) .sidebar .nav > :nth-child(5) { transition-delay: 182ms, 182ms, 0s, 0s; }
  html:not([data-side="pinned"]) body.is-app .shell:is(.side-hover, .nav-open) .sidebar .nav > :nth-child(6) { transition-delay: 210ms, 210ms, 0s, 0s; }
  html:not([data-side="pinned"]) body.is-app .shell:is(.side-hover, .nav-open) .sidebar .nav > :nth-child(7) { transition-delay: 238ms, 238ms, 0s, 0s; }
  html:not([data-side="pinned"]) body.is-app .shell:is(.side-hover, .nav-open) .sidebar .nav > :nth-child(8) { transition-delay: 266ms, 266ms, 0s, 0s; }
  html:not([data-side="pinned"]) body.is-app .shell:is(.side-hover, .nav-open) .sidebar .nav > :nth-child(n+9) { transition-delay: 294ms, 294ms, 0s, 0s; }
  html:not([data-side="pinned"]) body.is-app .shell:is(.side-hover, .nav-open) .sidebar .side-foot { transition-delay: 320ms, 320ms, 0s, 0s; }
}
/* "Reduzir movimento" (ex.: Windows com efeitos de animação desligados): em vez de cortar tudo, a barra
   faz um fade com deslize curto (56 px), sem o percurso longo nem a cascata. O app.css zera as
   transições com !important, por isso estas regras também usam !important. */
@media (prefers-reduced-motion: reduce) and (min-width: 861px) {
  html:not([data-side="pinned"]) body.is-app .sidebar {
    transform: translateX(-56px);
    transition: transform 420ms var(--ease-glide), opacity 420ms var(--ease-soft), visibility 0s linear 420ms !important;
  }
  html:not([data-side="pinned"]) body.is-app .shell:is(.side-hover, .nav-open) .sidebar {
    transform: translateX(0);
    transition: transform 560ms var(--ease-glide), opacity 560ms var(--ease-soft), visibility 0s !important;
  }
  html:not([data-side="pinned"]) body.is-app .sidebar .nav-item,
  html:not([data-side="pinned"]) body.is-app .sidebar .nav-section-label,
  html:not([data-side="pinned"]) body.is-app .sidebar .side-foot {
    transform: none; opacity: 0; transition: opacity 220ms var(--ease-soft), background var(--d-hover) var(--ease-out) !important;
  }
  html:not([data-side="pinned"]) body.is-app .shell:is(.side-hover, .nav-open) .sidebar .nav-item,
  html:not([data-side="pinned"]) body.is-app .shell:is(.side-hover, .nav-open) .sidebar .nav-section-label,
  html:not([data-side="pinned"]) body.is-app .shell:is(.side-hover, .nav-open) .sidebar .side-foot {
    transform: none; opacity: 1; transition: opacity 480ms var(--ease-soft) 120ms, background var(--d-hover) var(--ease-out) !important;
    transition-delay: 120ms, 0s !important;
  }
}
body.is-app .side-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
body.is-app .side-pin { width: 34px; height: 34px; flex: none; color: var(--text-3); }
body.is-app .side-pin[aria-pressed="true"] { color: var(--brand-soft); background: var(--glass-tint); border-color: var(--glass-tint-line); }
html[data-theme="light"] body.is-app .side-pin[aria-pressed="true"] { color: var(--brand); }
@media (hover: hover) and (pointer: fine) { body.is-app .side-pin:hover { color: var(--text); background: var(--surface-3); border-color: var(--border); } }
@media (max-width: 860px) { body.is-app .side-pin { display: none; } }
/* Navegação */
body.is-app .side-top { padding: 22px 20px 14px; }
body.is-app .nav { padding: 8px 12px; gap: 3px; }
body.is-app .nav-item { padding: 10px 13px; border-radius: var(--r-md); border: 1px solid transparent; }
body.is-app .nav-item::before { display: none; }
body.is-app .nav-item.is-active {
  background: linear-gradient(90deg, var(--glass-tint), transparent 130%);
  border-color: var(--glass-tint-line); color: var(--text);
  box-shadow: inset 0 1px 0 var(--glass-hi);
}
html[data-theme="light"] body.is-app .nav-item.is-active { color: var(--brand-strong); background: linear-gradient(90deg, var(--glass-tint), rgba(255,255,255,0.4) 130%); }
@media (hover: hover) and (pointer: fine) {
  body.is-app .nav-item:not(.is-active):not(.is-soon):hover { background: var(--surface-3); color: var(--text); }
}
body.is-app .side-foot { border-top: 1px solid var(--border-soft); padding: 14px; }
body.is-app .plan-mini { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--sh-inset); }

/* Topbar */
body.is-app .topbar-goal { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--sh-inset); }
body.is-app .icon-btn { border-radius: var(--r-md); }
@media (hover: hover) and (pointer: fine) {
  body.is-app .icon-btn:hover { background: var(--surface-3); border-color: var(--border); color: var(--text); }
  body.is-app .profile:hover { background: var(--surface-3); border-color: var(--border); }
}
body.is-app .profile { border-radius: var(--r-md); }
body.is-app .avatar { box-shadow: 0 0 0 2px var(--glass-hi), 0 4px 12px -4px rgba(100, 16, 201, 0.6); }
body.is-app .profile-menu {
  background: var(--glass-pop); border: 1px solid var(--border-strong); border-radius: var(--r-lg);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  box-shadow: var(--sh-lg), var(--sh-inset); padding: 6px;
}
@media (hover: hover) and (pointer: fine) {
  body.is-app .profile-menu a:hover, body.is-app .profile-menu button:hover { background: var(--surface-3); color: var(--text); }
}

/* ===================== CARDS (vidro) ===================== */
body.is-app .card, body.is-auth .auth-card {
  background: var(--glass-fill); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--sh-md), var(--sh-inset);
}
body.is-app .card::before { height: 38%; opacity: 0.55; }
body.is-app .card-head { padding: 18px var(--gutter); border-bottom: 1px solid var(--border-soft); }
body.is-app .card-danger { border-color: rgba(251, 113, 133, 0.34); }
body.is-app .card-metric { padding: 20px 22px; }
@media (hover: hover) and (pointer: fine) {
  body.is-app .card-metric:hover, body.is-app .integration-card:hover, body.is-app .plan-card:hover {
    transform: translateY(-2px); border-color: var(--border-strong);
    box-shadow: var(--sh-lg), var(--sh-inset);
  }
}
body.is-app .metric-icon {
  display: inline-grid; place-items: center; width: 36px; height: 36px; opacity: 1;
  border-radius: 12px; background: var(--glass-tint); border: 1px solid var(--glass-tint-line);
  color: var(--brand-soft);
}
html[data-theme="light"] body.is-app .metric-icon { color: var(--brand); }
body.is-app .metric-value { font-weight: 680; }
body.is-app .integration-card, body.is-app .plan-card, body.is-app .row-notice, body.is-app .offer-item {
  background: var(--glass-fill); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--sh-md), var(--sh-inset);
}
body.is-app .plan-card.is-popular { border-color: var(--glass-tint-line); box-shadow: var(--sh-lg), var(--glow-md), var(--sh-inset); }
body.is-app .row-notice { border-radius: var(--r-md); }
body.is-app .empty-icon { border-radius: 18px; background: var(--glass-tint); box-shadow: inset 0 0 0 1px var(--glass-tint-line); color: var(--brand-soft); }
html[data-theme="light"] body.is-app .empty-icon { color: var(--brand); }

/* ===================== BOTÕES ===================== */
body.is-app .btn, body.is-auth .btn { border-radius: var(--r-md); }
body.is-app .btn-primary, body.is-auth .btn-primary {
  background: linear-gradient(180deg, #7C30E4 0%, #5C0FC0 100%);
  border-color: rgba(255, 255, 255, 0.20);
  box-shadow: 0 8px 20px -8px rgba(100, 16, 201, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}
body.is-app .btn-secondary, body.is-auth .btn-secondary {
  background: var(--surface-3); border-color: var(--border-strong); box-shadow: var(--sh-inset);
}
body.is-app .btn-danger { background: var(--err-bg); border-color: rgba(251, 113, 133, 0.38); }
@media (hover: hover) and (pointer: fine) {
  body.is-app .btn-primary:hover, body.is-auth .btn-primary:hover { background: linear-gradient(180deg, #8B3FE8 0%, #6410C9 100%); box-shadow: 0 12px 26px -8px rgba(100, 16, 201, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.32); }
  body.is-app .btn-secondary:hover, body.is-auth .btn-secondary:hover { background: var(--surface-4); }
  body.is-app .btn-ghost:hover { background: var(--surface-3); color: var(--text); }
}

/* ===================== FORMULÁRIOS ===================== */
body.is-app .input, body.is-auth .input {
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-md);
  padding: 11px 14px; box-shadow: inset 0 1px 2px rgba(2, 0, 12, 0.18);
}
html[data-theme="light"] body.is-app .input { box-shadow: inset 0 1px 2px rgba(52, 40, 110, 0.08); background: rgba(255, 255, 255, 0.7); }
body.is-app .input:focus, body.is-auth .input:focus { border-color: var(--brand-bright); box-shadow: var(--glow-sm), inset 0 1px 2px rgba(2, 0, 12, 0.12); }
body.is-app .pref-card, body.is-app .pref-static-value { border-radius: var(--r-md); background: var(--surface); border-color: var(--border-strong); }
body.is-app .pref-card:has(input:checked), body.is-app .pref-static-value { background: var(--glass-tint); border-color: var(--glass-tint-line); box-shadow: none; }

/* ===================== TABELAS ===================== */
body.is-app .table th { border-bottom: 1px solid var(--border); padding: 12px 16px; }
body.is-app .table td { padding: 15px 16px; border-bottom: 1px solid var(--border-soft); }
body.is-app .table tbody .row:nth-child(odd) { background: transparent; }
body.is-app .table tbody .row:last-child td { border-bottom: 0; }
@media (hover: hover) and (pointer: fine) {
  body.is-app .table tbody .row:hover { background: var(--surface-2); }
}
body.is-app .table-wrap { border-radius: var(--r-md); }

/* ===================== BADGES / ABAS ===================== */
body.is-app .badge { padding: 4px 11px; backdrop-filter: none; }
body.is-app .tab-bar { gap: 4px; padding: 5px; width: fit-content; max-width: 100%; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface-2); box-shadow: var(--sh-inset); }
body.is-app .tab, body.is-app a.tab { border-bottom: 0; border-radius: var(--r-md); padding: 8px 16px; }
body.is-app .tab.is-active, body.is-app a.tab.is-active { color: var(--text); background: var(--surface-4); box-shadow: var(--sh-inset); border-bottom: 0; }
@media (hover: hover) and (pointer: fine) {
  body.is-app .tab:not(.is-active):hover, body.is-app a.tab:not(.is-active):hover { color: var(--text); background: var(--surface-2); }
}
body.is-app .pager .btn { min-width: 38px; }

/* ===================== MODAL / TOAST ===================== */
body.is-app .modal-backdrop { background: rgba(4, 3, 12, 0.55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
html[data-theme="light"] body.is-app .modal-backdrop { background: rgba(40, 32, 80, 0.28); }
body.is-app .modal {
  background: var(--glass-pop); border: 1px solid var(--border-strong); border-radius: var(--r-xl);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  box-shadow: var(--sh-lg), var(--sh-inset); padding: 28px;
}
body.is-app .toast {
  background: var(--glass-pop); border: 1px solid var(--border-strong); border-radius: var(--r-lg);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); box-shadow: var(--sh-lg), var(--sh-inset);
}

/* ===================== PAINEL: VISÃO GERAL ===================== */
/* Cabeçalho: seletor de período (segmentado) + atalho "Novo produto". */
body.is-app .dash-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); margin: 0 0 var(--sp-5); flex-wrap: wrap; }
body.is-app .range-bar { display: inline-flex; gap: 4px; padding: 5px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface-2); box-shadow: var(--sh-inset); }
body.is-app .range-chip { padding: 7px 16px; border-radius: var(--r-md); font-size: var(--fs-sm); font-weight: var(--fw-med); color: var(--text-3); white-space: nowrap; transition: background var(--d-hover) var(--ease-out), color var(--d-hover) var(--ease-out); }
body.is-app .range-chip.is-active { color: var(--text); background: var(--surface-4); box-shadow: var(--sh-inset); }
@media (hover: hover) and (pointer: fine) { body.is-app .range-chip:not(.is-active):hover { color: var(--text); background: var(--surface-3); } }

/* Cards de métricas: 3 por linha (6 cards = 2 linhas cheias), 2 em tela média, 1 no celular. */
body.is-app .metric-grid.dash-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-5); margin-bottom: var(--sp-6); }
@media (max-width: 1000px) { body.is-app .metric-grid.dash-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { body.is-app .metric-grid.dash-kpis { grid-template-columns: minmax(0, 1fr); } }
body.is-app .metric-delta { display: flex; align-items: center; gap: 8px; min-height: 22px; }
body.is-app .delta-chip { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: var(--fw-semi); font-variant-numeric: tabular-nums; background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border); }
body.is-app .delta-up .delta-chip { color: var(--ok); background: var(--ok-bg); border-color: rgba(52, 211, 153, 0.30); }
body.is-app .delta-down .delta-chip { color: var(--err); background: var(--err-bg); border-color: rgba(251, 113, 133, 0.30); }
body.is-app .delta-vs, body.is-app .delta-foot { font-size: 12px; color: var(--text-3); }

/* Gráfico com eixo, grade e tooltip. Plano de 160 px = altura máxima das barras (bar-h-160). */
body.is-app .chart-total { font-size: var(--fs-sm); color: var(--text-2); font-weight: var(--fw-med); }
body.is-app .chart-pro { position: relative; padding: 14px 0 32px 40px; }
body.is-app .chart-plot { position: relative; height: 160px; }
body.is-app .chart-grid { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
body.is-app .chart-grid i { display: block; height: 0; border-top: 1px dashed var(--border-soft); }
body.is-app .chart-grid i:last-child { border-top: 1px solid var(--border); }
body.is-app .chart-axis { position: absolute; left: 0; top: 14px; height: 160px; width: 32px; display: flex; flex-direction: column; justify-content: space-between; align-items: flex-end; font-size: 11px; line-height: 1; color: var(--text-3); font-variant-numeric: tabular-nums; transform: translateY(-5px); }
body.is-app .chart-pro .bar-chart { position: absolute; inset: 0; height: auto; padding: 0; gap: 8px; overflow: visible; align-items: stretch; }
body.is-app .chart-pro .bar-col { position: relative; height: 100%; justify-content: flex-end; gap: 0; outline: none; border-radius: var(--r-sm); }
body.is-app .chart-pro .bar { max-width: 34px; border-radius: 9px 9px 3px 3px; transition: filter var(--d-hover) var(--ease-out), transform var(--d-hover) var(--ease-out); }
body.is-app .chart-pro .bar.is-peak { background: linear-gradient(180deg, #A66BFF 0%, #6410C9 100%); box-shadow: 0 0 22px -6px rgba(139, 63, 232, 0.85); }
body.is-app .chart-pro .bar-label { position: absolute; top: 100%; margin-top: 10px; left: 50%; transform: translateX(-50%); }
body.is-app .chart-pro .bar-tip {
  position: absolute; left: 50%; bottom: calc(100% + 6px); z-index: 5; transform: translate(-50%, 4px); opacity: 0; pointer-events: none;
  padding: 6px 11px; border-radius: var(--r-md); white-space: nowrap; font-size: 12px; font-weight: var(--fw-med); color: var(--text);
  background: var(--glass-pop); border: 1px solid var(--border-strong); box-shadow: var(--sh-md), var(--sh-inset);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  transition: opacity var(--d-hover) var(--ease-out), transform var(--d-hover) var(--ease-out);
}
body.is-app .chart-pro .bar-col:hover .bar-tip, body.is-app .chart-pro .bar-col:focus-visible .bar-tip { opacity: 1; transform: translate(-50%, 0); }
body.is-app .chart-pro .bar-col:hover { background: var(--surface-2); }
body.is-app .chart-pro .bar-col:hover .bar { filter: brightness(1.25); }
body.is-app .chart-pro .bar-col:focus-visible { box-shadow: var(--glow-sm); }
@media (max-width: 600px) { body.is-app .chart-pro { padding-left: 30px; } body.is-app .chart-pro .bar-chart { gap: 4px; } }

/* "Primeiros passos" */
body.is-app .setup-card { margin-bottom: var(--sp-6); }
body.is-app .setup-count { font-size: var(--fs-sm); color: var(--text-2); font-weight: var(--fw-med); }
body.is-app .setup-bar { margin-bottom: var(--sp-4); }
body.is-app .setup-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 1000px) { body.is-app .setup-steps { grid-template-columns: minmax(0, 1fr); } }
body.is-app .setup-step { display: flex; align-items: center; gap: var(--sp-3); padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); }
body.is-app .setup-step.is-done { opacity: 0.72; }
body.is-app .setup-check { flex: none; display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 10px; font-size: 13px; font-weight: var(--fw-semi); color: var(--text-2); background: var(--surface-3); border: 1px solid var(--border-strong); }
body.is-app .setup-step.is-done .setup-check { color: var(--ok); background: var(--ok-bg); border-color: rgba(52, 211, 153, 0.35); }
body.is-app .setup-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
body.is-app .setup-text strong { font-size: var(--fs-body); font-weight: var(--fw-semi); }
body.is-app .setup-text span { font-size: var(--fs-sm); color: var(--text-3); }
@media (max-width: 560px) { body.is-app .setup-step { flex-wrap: wrap; } body.is-app .setup-step .btn, body.is-app .setup-step .badge { margin-left: 46px; } }

/* Meta de faturamento (barra do topo): rótulo + percentual; os valores completos ficam no tooltip. */
body.is-app .topbar-goal { width: 250px; gap: 7px; padding: 9px 14px; }
body.is-app .topbar-goal-head { align-items: center; }
body.is-app .topbar-goal .eyebrow { white-space: nowrap; letter-spacing: 0.08em; }
body.is-app .topbar-goal-pct { font-size: 14px; font-weight: var(--fw-bold); color: var(--text); }
body.is-app .topbar-goal .fee-progress { height: 7px; }
/* ===================== LOGIN / CADASTRO ===================== */
body.is-auth .auth-card {
  width: min(448px, 100%); padding: 40px; border-radius: var(--r-xl);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  box-shadow: var(--sh-lg), var(--sh-inset);
}
body.is-auth .auth-card-wide { width: min(640px, 100%); }
body.is-auth .auth-card::before { height: 34%; opacity: 0.6; }
body.is-auth .auth-title { font-size: 26px; letter-spacing: -0.022em; font-weight: 640; }
body.is-auth .auth-sub { color: var(--text-2); }
body.is-auth .auth-wrap { gap: 28px; }
body.is-auth .alert { border-radius: var(--r-md); }
body.is-auth .step-now .step-dot { box-shadow: 0 0 0 4px rgba(139, 63, 232, 0.25); }

/* Sem blur onde o navegador não suporta: sobe a opacidade para manter a leitura.
   (Não usamos prefers-reduced-transparency: com os efeitos de transparência do Windows desligados o
   Chrome reportaria "reduce" e o painel perderia o vidro; o preenchimento é leve e o texto segue legível.) */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  body.is-app .sidebar, body.is-app .topbar, body.is-app .modal, body.is-app .toast, body.is-app .profile-menu, body.is-auth .auth-card { background: var(--glass-pop); }
}
