/*
 * AstraNexo Dashboard Design System
 * Identidade visual derivada do site institucional.
 * Escopo: somente páginas administrativas /dashboard.
 */

:root,
html[data-theme="dark"] {
    color-scheme: dark;

    --an-bg-primary: #00000A;
    --an-bg-secondary: #12063A;
    --an-bg-tertiary: #1A0B48;

    --an-card: rgba(18, 6, 58, .78);
    --an-card-hover: rgba(18, 6, 58, .96);
    --an-input: rgba(0, 0, 10, .58);

    --an-text: #DFC1F7;
    --an-text-secondary: rgba(223, 193, 247, .72);
    --an-text-muted: rgba(171, 133, 223, .55);

    --an-border: rgba(103, 76, 186, .22);
    --an-border-hover: rgba(171, 133, 223, .48);

    --an-purple-deep: #321A78;
    --an-purple: #674CBA;
    --an-purple-light: #AB85DF;
    --an-highlight: #DFC1F7;

    --an-success: #34C759;
    --an-warning: #F59E0B;
    --an-danger: #EF4444;
    --an-info: #8B5CF6;

    --an-gradient:
        linear-gradient(
            135deg,
            #12063A 0%,
            #321A78 50%,
            #674CBA 100%
        );

    --an-gradient-soft:
        linear-gradient(
            135deg,
            rgba(18, 6, 58, .94) 0%,
            rgba(50, 26, 120, .82) 100%
        );

    --an-gradient-glow:
        linear-gradient(
            135deg,
            #AB85DF 0%,
            #DFC1F7 100%
        );

    --an-shadow:
        0 12px 36px rgba(0, 0, 0, .42);

    --an-shadow-soft:
        0 8px 28px rgba(0, 0, 0, .26);

    --an-glow:
        0 0 32px rgba(103, 76, 186, .24);

    --an-radius-xl: 24px;
    --an-radius-lg: 18px;
    --an-radius-md: 12px;
    --an-radius-sm: 9px;

    /* Compatibilidade com páginas legadas */
    --bg: var(--an-bg-primary);
    --background: var(--an-bg-primary);
    --bg-primary: var(--an-bg-primary);
    --bg-secondary: var(--an-bg-secondary);

    --card: var(--an-card);
    --card-bg: var(--an-card);
    --input-bg: var(--an-input);

    --text: var(--an-text);
    --text-primary: var(--an-text);
    --text-secondary: var(--an-text-secondary);
    --text-tertiary: var(--an-text-muted);
    --muted: var(--an-text-muted);

    --primary: var(--an-purple);
    --primary-hover: var(--an-purple-light);

    --border: var(--an-border);
    --border-color: var(--an-border);

    --radius: var(--an-radius-lg);
    --radius-sm: var(--an-radius-md);

    --shadow: var(--an-shadow-soft);
}

html[data-theme="light"] {
    color-scheme: light;

    --an-bg-primary: #F5F0FF;
    --an-bg-secondary: #EDE6F7;
    --an-bg-tertiary: #E4DAF4;

    --an-card: rgba(255, 255, 255, .92);
    --an-card-hover: #FFFFFF;
    --an-input: rgba(255, 255, 255, .9);

    --an-text: #1A0A3A;
    --an-text-secondary: rgba(26, 10, 58, .72);
    --an-text-muted: rgba(50, 26, 120, .55);

    --an-border: rgba(103, 76, 186, .17);
    --an-border-hover: rgba(103, 76, 186, .36);

    --an-shadow:
        0 12px 36px rgba(103, 76, 186, .12);

    --an-shadow-soft:
        0 8px 28px rgba(103, 76, 186, .09);

    --an-glow:
        0 0 30px rgba(103, 76, 186, .13);

    --an-gradient-soft:
        linear-gradient(
            135deg,
            rgba(255,255,255,.94) 0%,
            rgba(237,230,247,.96) 100%
        );
}


/* ==========================================================
   BASE
   ========================================================== */

html {
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body.an-dashboard-theme {
    min-height: 100vh;
    font-family:
        'Inter',
        -apple-system,
        BlinkMacSystemFont,
        'Segoe UI',
        sans-serif !important;

    color: var(--an-text) !important;
    background:
        radial-gradient(
            circle at 92% 4%,
            rgba(103, 76, 186, .16),
            transparent 32%
        ),
        radial-gradient(
            circle at 5% 92%,
            rgba(50, 26, 120, .15),
            transparent 36%
        ),
        var(--an-bg-primary) !important;
}

body.an-dashboard-theme::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;

    background-image:
        radial-gradient(
            1px 1px at 24px 32px,
            rgba(171, 133, 223, .20),
            transparent
        ),
        radial-gradient(
            1px 1px at 82px 94px,
            rgba(223, 193, 247, .10),
            transparent
        );

    background-size: 180px 180px;
}

body.an-dashboard-theme h1,
body.an-dashboard-theme h2,
body.an-dashboard-theme h3,
body.an-dashboard-theme .sidebar-brand-copy,
body.an-dashboard-theme .brand {
    font-family:
        'Orbitron',
        'Inter',
        sans-serif !important;
}

body.an-dashboard-theme a {
    transition:
        color .22s ease,
        border-color .22s ease,
        background .22s ease,
        transform .22s ease,
        box-shadow .22s ease;
}


/* ==========================================================
   CONTAINERS / CABEÇALHOS DE PÁGINAS SECUNDÁRIAS
   ========================================================== */

body.an-dashboard-theme > .container,
body.an-dashboard-theme .container {
    max-width: 1280px;
}

body.an-dashboard-theme > .container {
    margin-inline: auto;
}

body.an-dashboard-theme .header {
    padding-bottom: 22px;
    margin-bottom: 26px;

    border-bottom:
        1px solid var(--an-border);
}

body.an-dashboard-theme .header h1 {
    color: var(--an-text) !important;
    letter-spacing: -.02em;
}

body.an-dashboard-theme .badge {
    color: var(--an-purple-light) !important;
    background:
        rgba(103, 76, 186, .12) !important;
    border:
        1px solid var(--an-border) !important;
}

body.an-dashboard-theme .header-actions a {
    color: var(--an-text-secondary) !important;
}

body.an-dashboard-theme .header-actions a:hover {
    color: var(--an-highlight) !important;
}


/* ==========================================================
   CARDS
   ========================================================== */

body.an-dashboard-theme .card,
body.an-dashboard-theme .stat-card-modern,
body.an-dashboard-theme .chart-panel,
body.an-dashboard-theme .leads-card,
body.an-dashboard-theme .mobile-lead-card,
body.an-dashboard-theme .sidebar-workspace {
    background:
        var(--an-card) !important;

    border:
        1px solid var(--an-border) !important;

    box-shadow:
        var(--an-shadow-soft) !important;

    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

body.an-dashboard-theme .card {
    border-radius:
        var(--an-radius-lg) !important;
}

body.an-dashboard-theme .card:hover,
body.an-dashboard-theme .stat-card-modern:hover {
    border-color:
        var(--an-border-hover) !important;

    box-shadow:
        var(--an-glow) !important;
}

body.an-dashboard-theme .card h2,
body.an-dashboard-theme .card h3 {
    color: var(--an-text) !important;
}

body.an-dashboard-theme .card h3 i {
    color:
        var(--an-purple-light) !important;
}


/* ==========================================================
   INPUTS
   ========================================================== */

body.an-dashboard-theme input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),
body.an-dashboard-theme select,
body.an-dashboard-theme textarea {
    color:
        var(--an-text) !important;

    background:
        var(--an-input) !important;

    border:
        1px solid var(--an-border) !important;

    border-radius:
        var(--an-radius-md) !important;

    font-family:
        'Inter',
        sans-serif !important;

    transition:
        border-color .2s ease,
        box-shadow .2s ease,
        background .2s ease;
}

body.an-dashboard-theme input:focus,
body.an-dashboard-theme select:focus,
body.an-dashboard-theme textarea:focus {
    outline: none !important;

    border-color:
        var(--an-purple) !important;

    box-shadow:
        0 0 0 4px
        rgba(103, 76, 186, .14) !important;
}

body.an-dashboard-theme input::placeholder,
body.an-dashboard-theme textarea::placeholder {
    color:
        var(--an-text-muted) !important;
}

body.an-dashboard-theme label,
body.an-dashboard-theme small,
body.an-dashboard-theme .muted {
    color:
        var(--an-text-secondary) !important;
}


/* ==========================================================
   BOTÕES
   ========================================================== */

body.an-dashboard-theme .btn-save:not(.btn-danger):not(.btn-warning),
body.an-dashboard-theme .unifi-button,
body.an-dashboard-theme .hero-action,
body.an-dashboard-theme button.primary,
body.an-dashboard-theme a.primary {
    color: #FFFFFF !important;
    background:
        var(--an-gradient) !important;

    border:
        1px solid
        var(--an-border-hover) !important;

    box-shadow:
        var(--an-glow) !important;

    font-weight: 700;
}

body.an-dashboard-theme .btn-save:not(.btn-danger):not(.btn-warning):hover,
body.an-dashboard-theme .unifi-button:hover,
body.an-dashboard-theme .hero-action:hover,
body.an-dashboard-theme button.primary:hover,
body.an-dashboard-theme a.primary:hover {
    transform:
        translateY(-2px);

    border-color:
        var(--an-purple-light) !important;

    box-shadow:
        0 10px 34px
        rgba(103, 76, 186, .34) !important;
}

body.an-dashboard-theme .btn-danger,
body.an-dashboard-theme button.danger {
    background:
        linear-gradient(
            135deg,
            #991B1B,
            #EF4444
        ) !important;

    color: #FFFFFF !important;
}

body.an-dashboard-theme .btn-warning {
    background:
        linear-gradient(
            135deg,
            #B45309,
            #F59E0B
        ) !important;

    color: #FFFFFF !important;
}


/* ==========================================================
   THEME TOGGLE
   ========================================================== */

body.an-dashboard-theme .theme-toggle,
body.an-dashboard-theme .theme-button,
body.an-dashboard-theme .refresh-button {
    color:
        var(--an-text) !important;

    background:
        var(--an-card) !important;

    border:
        1px solid var(--an-border) !important;

    box-shadow:
        var(--an-shadow-soft) !important;
}

body.an-dashboard-theme .theme-toggle:hover,
body.an-dashboard-theme .theme-button:hover,
body.an-dashboard-theme .refresh-button:hover {
    border-color:
        var(--an-purple-light) !important;

    box-shadow:
        var(--an-glow) !important;
}


/* ==========================================================
   DASHBOARD PRINCIPAL
   ========================================================== */

body.an-dashboard-theme .an-app,
body.an-dashboard-theme .an-main,
body.an-dashboard-theme .an-page {
    background:
        transparent !important;
}

body.an-dashboard-theme .an-sidebar {
    background:
        rgba(0, 0, 10, .96) !important;

    border-right:
        1px solid var(--an-border) !important;

    box-shadow:
        12px 0 36px
        rgba(0, 0, 0, .18) !important;
}

html[data-theme="light"]
body.an-dashboard-theme
.an-sidebar {
    background:
        rgba(245, 240, 255, .97) !important;
}

body.an-dashboard-theme .sidebar-brand-copy,
body.an-dashboard-theme .sidebar-org-name {
    color:
        var(--an-text) !important;
}

body.an-dashboard-theme .sidebar-workspace-label,
body.an-dashboard-theme .an-nav-label {
    color:
        var(--an-text-muted) !important;
}

body.an-dashboard-theme .an-nav-link {
    color:
        var(--an-text-secondary) !important;

    border:
        1px solid transparent;
}

body.an-dashboard-theme .an-nav-link:hover {
    color:
        var(--an-highlight) !important;

    background:
        rgba(103, 76, 186, .10) !important;

    border-color:
        var(--an-border) !important;
}

body.an-dashboard-theme .an-nav-link.is-active {
    color:
        #FFFFFF !important;

    background:
        var(--an-gradient) !important;

    border-color:
        var(--an-border-hover) !important;

    box-shadow:
        var(--an-glow) !important;
}

body.an-dashboard-theme .an-topbar {
    background:
        rgba(0, 0, 10, .82) !important;

    border-bottom:
        1px solid var(--an-border) !important;

    backdrop-filter:
        blur(18px);
}

html[data-theme="light"]
body.an-dashboard-theme
.an-topbar {
    background:
        rgba(245, 240, 255, .88) !important;
}

body.an-dashboard-theme .dashboard-hero {
    background:
        var(--an-gradient-soft) !important;

    border:
        1px solid var(--an-border) !important;

    box-shadow:
        var(--an-shadow) !important;
}

body.an-dashboard-theme .dashboard-hero h1,
body.an-dashboard-theme .section-heading-copy h2,
body.an-dashboard-theme .chart-title h3,
body.an-dashboard-theme .leads-header h3 {
    color:
        var(--an-text) !important;
}

body.an-dashboard-theme .dashboard-hero-eyebrow,
body.an-dashboard-theme .chart-badge {
    color:
        var(--an-purple-light) !important;
}

body.an-dashboard-theme .dashboard-hero p,
body.an-dashboard-theme .section-heading-copy p,
body.an-dashboard-theme .chart-title span,
body.an-dashboard-theme .leads-header p {
    color:
        var(--an-text-secondary) !important;
}

body.an-dashboard-theme .stat-value {
    color:
        var(--an-highlight) !important;
}

body.an-dashboard-theme .stat-label,
body.an-dashboard-theme .stat-meta {
    color:
        var(--an-text-secondary) !important;
}


/* ==========================================================
   TABELAS
   ========================================================== */

body.an-dashboard-theme table {
    color:
        var(--an-text);
}

body.an-dashboard-theme .dashboard-table th,
body.an-dashboard-theme table th {
    color:
        var(--an-text-secondary) !important;

    background:
        rgba(50, 26, 120, .16) !important;

    border-color:
        var(--an-border) !important;
}

body.an-dashboard-theme .dashboard-table td,
body.an-dashboard-theme table td {
    color:
        var(--an-text-secondary) !important;

    border-color:
        var(--an-border) !important;
}

body.an-dashboard-theme .dashboard-table tbody tr:hover td,
body.an-dashboard-theme table tbody tr:hover td {
    background:
        rgba(103, 76, 186, .08) !important;
}


/* ==========================================================
   SEGURANÇA
   ========================================================== */

body.an-dashboard-theme .layout {
    background:
        transparent !important;
}

body.an-dashboard-theme .layout > .sidebar {
    background:
        rgba(0, 0, 10, .96) !important;

    color:
        var(--an-text) !important;

    border-right:
        1px solid var(--an-border);

    box-shadow:
        12px 0 36px
        rgba(0, 0, 0, .18);
}

html[data-theme="light"]
body.an-dashboard-theme
.layout > .sidebar {
    background:
        rgba(245, 240, 255, .97) !important;
}

body.an-dashboard-theme .layout .nav-link {
    color:
        var(--an-text-secondary) !important;
}

body.an-dashboard-theme .layout .nav-link:hover {
    color:
        var(--an-highlight) !important;

    background:
        rgba(103, 76, 186, .10) !important;
}

body.an-dashboard-theme .layout .nav-link.active {
    color: #FFFFFF !important;

    background:
        var(--an-gradient) !important;

    box-shadow:
        var(--an-glow);
}

body.an-dashboard-theme .status.off {
    color:
        #FBBF24 !important;

    background:
        rgba(245, 158, 11, .12) !important;

    border:
        1px solid rgba(245, 158, 11, .25);
}

body.an-dashboard-theme .status.on {
    color:
        #4ADE80 !important;

    background:
        rgba(52, 199, 89, .12) !important;

    border:
        1px solid rgba(52, 199, 89, .24);
}

body.an-dashboard-theme .secret-box {
    color:
        var(--an-highlight) !important;

    background:
        var(--an-input) !important;

    border:
        1px solid var(--an-border);
}


/* ==========================================================
   INTEGRAÇÕES / MODAIS
   ========================================================== */

body.an-dashboard-theme .unifi-modal,
body.an-dashboard-theme .pix-auth-modal {
    background:
        rgba(0, 0, 10, .76) !important;

    backdrop-filter:
        blur(10px);
}

body.an-dashboard-theme .unifi-dialog,
body.an-dashboard-theme .pix-auth-modal > div {
    color:
        var(--an-text) !important;

    background:
        var(--an-card-hover) !important;

    border:
        1px solid var(--an-border) !important;

    box-shadow:
        var(--an-shadow) !important;
}

body.an-dashboard-theme .unifi-kicker,
body.an-dashboard-theme .unifi-meta,
body.an-dashboard-theme .unifi-help {
    color:
        var(--an-text-secondary) !important;
}


/* ==========================================================
   MODAL 2FA DA DASHBOARD
   Regras com especificidade maior que o style runtime.
   ========================================================== */

body.an-dashboard-theme
#astranexo-2fa-overlay {
    background:
        rgba(0, 0, 10, .70) !important;

    backdrop-filter:
        blur(12px) !important;
}

body.an-dashboard-theme
#astranexo-2fa-card {
    color:
        var(--an-text) !important;

    background:
        var(--an-card-hover) !important;

    border:
        1px solid
        var(--an-border-hover) !important;

    box-shadow:
        var(--an-shadow),
        var(--an-glow) !important;
}

body.an-dashboard-theme
#astranexo-2fa-card
.an-2fa-icon {
    color:
        var(--an-purple-light) !important;

    background:
        rgba(103, 76, 186, .14) !important;
}

body.an-dashboard-theme
#astranexo-2fa-card h2,
body.an-dashboard-theme
#astranexo-2fa-card p strong {
    color:
        var(--an-text) !important;
}

body.an-dashboard-theme
#astranexo-2fa-card p {
    color:
        var(--an-text-secondary) !important;
}

body.an-dashboard-theme
#astranexo-2fa-card a {
    color:
        var(--an-purple-light) !important;
}

body.an-dashboard-theme
#astranexo-2fa-actions
.primary {
    background:
        var(--an-gradient) !important;

    color:
        #FFFFFF !important;
}

body.an-dashboard-theme
#astranexo-2fa-actions
.secondary {
    color:
        var(--an-text-secondary) !important;

    background:
        var(--an-input) !important;

    border:
        1px solid var(--an-border) !important;
}


/* ==========================================================
   TOASTS / INFO
   ========================================================== */

body.an-dashboard-theme .info-box,
body.an-dashboard-theme .unifi-help {
    background:
        rgba(103, 76, 186, .08) !important;

    border-color:
        var(--an-border) !important;
}

body.an-dashboard-theme .info-box a {
    color:
        var(--an-purple-light) !important;
}


/* ==========================================================
   RESPONSIVO
   ========================================================== */

@media (max-width: 768px) {
    body.an-dashboard-theme {
        background:
            var(--an-bg-primary) !important;
    }

    body.an-dashboard-theme .card {
        border-radius:
            var(--an-radius-md) !important;
    }

    body.an-dashboard-theme .header {
        gap: 16px;
    }
}


/* ==========================================================
   ASTRA NEXO — REFINAMENTO GLOBAL ADMINISTRATIVO
   Login + Dashboard + PIX Admin + PIX Nativo Admin + Leads Admin
   ========================================================== */


/* ==========================================================
   DARK MAIS SUAVE
   ========================================================== */

:root,
html[data-theme="dark"] {
    --an-bg-primary: #0D0918;
    --an-bg-secondary: #151024;
    --an-bg-tertiary: #1C1530;

    --an-card: rgba(28, 20, 49, .78);
    --an-card-hover: rgba(34, 24, 58, .92);
    --an-input: rgba(18, 13, 31, .78);

    --an-text: #D9CDEA;
    --an-text-secondary: rgba(217, 205, 234, .72);
    --an-text-muted: rgba(190, 171, 216, .52);

    --an-border: rgba(171, 133, 223, .14);
    --an-border-hover: rgba(171, 133, 223, .28);

    --an-shadow:
        0 14px 38px rgba(0, 0, 0, .25);

    --an-shadow-soft:
        0 8px 26px rgba(0, 0, 0, .18);

    --an-glow:
        0 0 26px rgba(103, 76, 186, .13);

    /* compatibilidade com login/base */
    --an-bg: var(--an-bg-primary);
    --an-surface: rgba(29, 21, 49, .86);
    --an-surface-secondary: rgba(35, 26, 58, .80);
    --an-surface-tertiary: rgba(43, 32, 68, .72);

    --an-primary: #765EC0;
    --an-primary-hover: #9276CF;
    --an-primary-soft: rgba(118, 94, 192, .15);
}


/* ==========================================================
   LIGHT — LEGIBILIDADE
   ========================================================== */

html[data-theme="light"] {
    --an-bg-primary: #F7F3FC;
    --an-bg-secondary: #F0EAF7;
    --an-bg-tertiary: #E8DFF2;

    --an-card: rgba(255, 255, 255, .94);
    --an-card-hover: #FFFFFF;
    --an-input: rgba(255, 255, 255, .96);

    --an-text: #251735;
    --an-text-secondary: rgba(37, 23, 53, .74);
    --an-text-muted: rgba(61, 39, 87, .55);

    --an-border: rgba(103, 76, 186, .15);
    --an-border-hover: rgba(103, 76, 186, .30);

    --an-bg: var(--an-bg-primary);
    --an-surface: #FFFFFF;
    --an-surface-secondary: #FAF8FD;
    --an-surface-tertiary: #F3EEF8;

    --an-primary: #674CBA;
    --an-primary-hover: #563CA4;
    --an-primary-soft: rgba(103, 76, 186, .10);
}


html[data-theme="light"]
body.an-dashboard-theme {
    color: var(--an-text) !important;
}


html[data-theme="light"]
body.an-dashboard-theme
:is(
    .card,
    .filters,
    .table-container,
    .chart-panel,
    .leads-card,
    .mobile-lead-card,
    .login-card,
    .content,
    .wrap
) {
    color: var(--an-text) !important;
}


html[data-theme="light"]
body.an-dashboard-theme
:is(
    h1,
    h2,
    h3,
    h4,
    th,
    td,
    label
) {
    color: var(--an-text);
}


html[data-theme="light"]
body.an-dashboard-theme
:is(
    .an-nav-link,
    .sidebar-org-name,
    .stat-value
) {
    color: var(--an-text) !important;
}


/* áreas deliberadamente coloridas mantêm texto claro */

html[data-theme="light"]
body.an-dashboard-theme
:is(
    .header,
    .dashboard-hero
)
:is(
    h1,
    h2,
    h3,
    p,
    span,
    div
) {
    color: inherit;
}


/* ==========================================================
   CÉU ESTRELADO — SOMENTE DARK
   Sem imagens e sem requisições adicionais
   ========================================================== */

html[data-theme="dark"]
body.an-dashboard-theme {
    position: relative;
    isolation: isolate;

    background-color:
        #0D0918 !important;

    background-image:
        radial-gradient(
            circle at 11% 18%,
            rgba(223,193,247,.34) 0 1px,
            transparent 1.3px
        ),
        radial-gradient(
            circle at 72% 12%,
            rgba(171,133,223,.24) 0 1px,
            transparent 1.4px
        ),
        radial-gradient(
            circle at 37% 68%,
            rgba(223,193,247,.20) 0 1px,
            transparent 1.3px
        ),
        radial-gradient(
            circle at 84% 76%,
            rgba(171,133,223,.25) 0 1px,
            transparent 1.5px
        ),
        radial-gradient(
            circle at 52% 39%,
            rgba(255,255,255,.14) 0 1px,
            transparent 1.2px
        ),
        radial-gradient(
            circle at 19% 83%,
            rgba(255,255,255,.12) 0 1px,
            transparent 1.2px
        ),
        radial-gradient(
            ellipse at top,
            rgba(50,26,120,.12),
            transparent 58%
        ) !important;

    background-size:
        180px 180px,
        250px 250px,
        320px 320px,
        410px 410px,
        145px 145px,
        290px 290px,
        100% 100% !important;

    background-attachment:
        fixed !important;
}


html[data-theme="dark"]
body.an-dashboard-theme::before {
    content: "";

    position: fixed;
    inset: 0;

    pointer-events: none;

    z-index: -2;

    background:
        radial-gradient(
            ellipse at 18% 8%,
            rgba(103,76,186,.07),
            transparent 36%
        ),
        radial-gradient(
            ellipse at 90% 84%,
            rgba(171,133,223,.045),
            transparent 38%
        );

    opacity: .85;
}


/* uma estrela cadente muito discreta e rara */

html[data-theme="dark"]
body.an-dashboard-theme::after {
    content: "";

    position: fixed;

    top: 13vh;
    left: -18vw;

    width: 115px;
    height: 1px;

    pointer-events: none;

    z-index: -1;

    opacity: 0;

    border-radius: 999px;

    background:
        linear-gradient(
            90deg,
            transparent,
            rgba(223,193,247,.42),
            rgba(255,255,255,.62),
            transparent
        );

    filter:
        drop-shadow(
            0 0 3px
            rgba(171,133,223,.28)
        );

    transform:
        rotate(-24deg);

    animation:
        astranexo-shooting-star
        22s
        ease-in-out
        5s
        infinite;
}


@keyframes astranexo-shooting-star {
    0%,
    72% {
        opacity: 0;

        transform:
            translate3d(0, 0, 0)
            rotate(-24deg);
    }

    74% {
        opacity: 0;
    }

    76% {
        opacity: .23;
    }

    80% {
        opacity: .12;
    }

    83% {
        opacity: 0;

        transform:
            translate3d(
                138vw,
                54vh,
                0
            )
            rotate(-24deg);
    }

    100% {
        opacity: 0;

        transform:
            translate3d(
                138vw,
                54vh,
                0
            )
            rotate(-24deg);
    }
}


/* ==========================================================
   SIDEBAR / TOPBAR DARK MENOS AGRESSIVOS
   ========================================================== */

html[data-theme="dark"]
body.an-dashboard-theme
.an-sidebar {
    background:
        rgba(16, 11, 29, .91) !important;

    border-right:
        1px solid
        rgba(171,133,223,.11) !important;
}


html[data-theme="dark"]
body.an-dashboard-theme
.an-topbar {
    background:
        rgba(15, 10, 27, .78) !important;

    border-bottom:
        1px solid
        rgba(171,133,223,.10) !important;
}


html[data-theme="dark"]
body.an-dashboard-theme
.dashboard-hero {
    background:
        linear-gradient(
            135deg,
            rgba(29,20,52,.90),
            rgba(49,34,82,.72)
        ) !important;
}


/* ==========================================================
   ADMINS GERADOS PELOS ROUTERS
   ========================================================== */

body.an-admin-surface {
    min-height: 100vh;
    padding: 24px !important;
}


body.an-admin-surface
:is(.container, .wrap) {
    position: relative;
    z-index: 1;

    max-width: 1400px;

    margin-left: auto;
    margin-right: auto;
}


body.an-admin-surface
.header {
    position: relative;

    overflow: hidden;

    color: #F5EEFC !important;

    background:
        linear-gradient(
            135deg,
            rgba(45,29,82,.97) 0%,
            rgba(76,54,126,.95) 52%,
            rgba(103,76,186,.88) 100%
        ) !important;

    border:
        1px solid
        rgba(171,133,223,.20) !important;

    box-shadow:
        0 14px 34px
        rgba(13,9,24,.22) !important;
}


body.an-admin-surface
.header h1 {
    color: #F5EEFC !important;

    font-family:
        'Orbitron',
        'Inter',
        sans-serif !important;
}


body.an-admin-surface
.header .stat-number {
    color: #FFFFFF !important;
}


body.an-admin-surface
.header .stat-label {
    color:
        rgba(245,238,252,.72) !important;
}


body.an-admin-surface
.stat-card {
    background:
        rgba(255,255,255,.08) !important;

    border:
        1px solid
        rgba(255,255,255,.10) !important;
}


body.an-admin-surface
.filters,
body.an-admin-surface
.table-container,
body.an-admin-surface
.card {
    background:
        var(--an-card) !important;

    color:
        var(--an-text) !important;

    border:
        1px solid
        var(--an-border) !important;

    box-shadow:
        var(--an-shadow-soft) !important;

    backdrop-filter:
        blur(14px);
}


body.an-admin-surface
.filters {
    border-radius:
        var(--an-radius-lg) !important;
}


body.an-admin-surface
.table-container {
    border-radius:
        var(--an-radius-lg) !important;
}


body.an-admin-surface
table {
    color:
        var(--an-text) !important;
}


body.an-admin-surface
th {
    color:
        var(--an-text-secondary) !important;

    background:
        rgba(103,76,186,.075) !important;

    border-color:
        var(--an-border) !important;
}


body.an-admin-surface
td {
    color:
        var(--an-text-secondary) !important;

    border-color:
        var(--an-border) !important;
}


body.an-admin-surface
tbody tr:hover td {
    background:
        rgba(103,76,186,.055) !important;
}


/* PIX Nativo */

body.an-admin-pix-nativo
.top h1 {
    color:
        var(--an-text) !important;

    font-family:
        'Orbitron',
        'Inter',
        sans-serif !important;
}


body.an-admin-pix-nativo
.top a {
    color:
        var(--an-purple-light) !important;
}


body.an-admin-pix-nativo
.card {
    border-radius:
        var(--an-radius-lg) !important;
}


/* Leads */

body.an-admin-leads
.hero-title {
    color: #FFFFFF !important;

    font-family:
        'Orbitron',
        'Inter',
        sans-serif !important;
}


body.an-admin-leads
.hero-kicker {
    color:
        #D8C6F1 !important;
}


body.an-admin-leads
.hero-subtitle {
    color:
        rgba(255,255,255,.76) !important;
}


/* ==========================================================
   LOGIN
   ========================================================== */

body.an-login-global
.login-panel {
    background:
        transparent !important;
}


body.an-login-global
.login-card {
    background:
        var(--an-card) !important;

    border:
        1px solid
        var(--an-border) !important;

    box-shadow:
        var(--an-shadow) !important;

    backdrop-filter:
        blur(18px);
}


html[data-theme="light"]
body.an-login-global
.login-card {
    background:
        rgba(255,255,255,.92) !important;
}


body.an-login-global
.login-header h2 {
    font-family:
        'Orbitron',
        'Inter',
        sans-serif !important;
}


body.an-login-global
.login-brand {
    background:
        linear-gradient(
            150deg,
            #12063A 0%,
            #321A78 54%,
            #674CBA 100%
        ) !important;
}


/* ==========================================================
   TOGGLE FLUTUANTE PARA ADMINS SEM CONTROLE PRÓPRIO
   ========================================================== */

.an-global-theme-toggle {
    position: fixed;

    top: 18px;
    right: 18px;

    z-index: 10000;

    width: 44px;
    height: 44px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    border-radius: 999px;

    border:
        1px solid
        var(--an-border);

    color:
        var(--an-text);

    background:
        var(--an-card);

    box-shadow:
        var(--an-shadow-soft);

    cursor: pointer;

    backdrop-filter:
        blur(14px);

    font-size: 17px;
}


.an-global-theme-toggle:hover {
    border-color:
        var(--an-border-hover);

    box-shadow:
        var(--an-glow);

    transform:
        translateY(-1px);
}


/* ==========================================================
   REDUCED MOTION
   ========================================================== */

@media (prefers-reduced-motion: reduce) {
    html[data-theme="dark"]
    body.an-dashboard-theme::after {
        animation: none !important;
        display: none !important;
    }

    body.an-dashboard-theme *,
    body.an-dashboard-theme *::before,
    body.an-dashboard-theme *::after {
        scroll-behavior: auto !important;
    }
}


@media (max-width: 768px) {
    body.an-admin-surface {
        padding:
            12px !important;
    }

    .an-global-theme-toggle {
        top: 12px;
        right: 12px;
    }
}


/* ==========================================================
   ASTRA NEXO — REFINAMENTO VISUAL 2
   Light legível + dark suave + starfield funcional
   ========================================================== */


/* ==========================================================
   LIGHT — SIDEBAR DA DASHBOARD
   ========================================================== */

html[data-theme="light"]
body.an-dashboard-theme
.an-sidebar-brand,
html[data-theme="light"]
body.an-dashboard-theme
.an-sidebar-brand * {
    color: #251735 !important;
}


html[data-theme="light"]
body.an-dashboard-theme
.sidebar-brand-copy,
html[data-theme="light"]
body.an-dashboard-theme
.sidebar-org-name {
    color: #251735 !important;
}


/* Item selecionado precisa permanecer branco sobre roxo */

html[data-theme="light"]
body.an-dashboard-theme
.an-nav-link.is-active,
html[data-theme="light"]
body.an-dashboard-theme
.an-nav-link.is-active * {
    color: #FFFFFF !important;
}


html[data-theme="light"]
body.an-dashboard-theme
.an-nav-link.is-active {
    background:
        linear-gradient(
            135deg,
            #321A78 0%,
            #674CBA 100%
        ) !important;

    text-shadow:
        0 1px 1px
        rgba(0,0,0,.15);
}


/* Footer da sidebar não pode continuar cinza escuro no light */

html[data-theme="light"]
body.an-dashboard-theme
.an-sidebar-footer {
    color:
        var(--an-text-secondary) !important;

    background:
        rgba(103,76,186,.045) !important;

    border-top:
        1px solid
        rgba(103,76,186,.12) !important;
}


html[data-theme="light"]
body.an-dashboard-theme
.an-sidebar-footer > div {
    background:
        transparent !important;
}


html[data-theme="light"]
body.an-dashboard-theme
.an-sidebar-footer,
html[data-theme="light"]
body.an-dashboard-theme
.an-sidebar-footer a,
html[data-theme="light"]
body.an-dashboard-theme
.an-sidebar-footer span {
    color:
        var(--an-text-secondary) !important;
}


html[data-theme="light"]
body.an-dashboard-theme
.an-sidebar-footer strong {
    color:
        var(--an-text) !important;
}


/* Avatar continua com identidade AstraNexo */

html[data-theme="light"]
body.an-dashboard-theme
.an-sidebar-footer
[class*="avatar"] {
    color: #FFFFFF !important;
}


/* ==========================================================
   LIGHT — HERO
   ========================================================== */

html[data-theme="light"]
body.an-dashboard-theme
.dashboard-hero
.hero-side,
html[data-theme="light"]
body.an-dashboard-theme
.dashboard-hero
.hero-side * {
    color:
        #312140 !important;
}


html[data-theme="light"]
body.an-dashboard-theme
.dashboard-hero
.hero-action,
html[data-theme="light"]
body.an-dashboard-theme
.dashboard-hero
.hero-action * {
    color:
        #FFFFFF !important;
}


html[data-theme="light"]
body.an-dashboard-theme
.dashboard-hero
.hero-pill {
    color:
        #312140 !important;
}


/* ==========================================================
   LOGIN LIGHT
   Painel roxo = conteúdo obrigatoriamente claro
   ========================================================== */

html[data-theme="light"]
body.an-login-global
.login-brand,
html[data-theme="light"]
body.an-login-global
.login-brand * {
    color:
        rgba(245,238,252,.82) !important;
}


html[data-theme="light"]
body.an-login-global
.login-brand h1,
html[data-theme="light"]
body.an-login-global
.login-brand h2,
html[data-theme="light"]
body.an-login-global
.login-brand h3,
html[data-theme="light"]
body.an-login-global
.login-brand .brand-name {
    color:
        #FFFFFF !important;
}


html[data-theme="light"]
body.an-login-global
.login-brand
.brand-eyebrow {
    color:
        #E4D4F5 !important;
}


html[data-theme="light"]
body.an-login-global
.login-brand
.brand-feature,
html[data-theme="light"]
body.an-login-global
.login-brand
.brand-feature * {
    color:
        rgba(255,255,255,.82) !important;
}


html[data-theme="light"]
body.an-login-global
.login-brand
.brand-footer {
    color:
        rgba(255,255,255,.50) !important;
}


/* ==========================================================
   DARK — CONTRASTE MAIS CALMO
   ========================================================== */

html[data-theme="dark"] {
    --an-bg-primary: #100B1B;
    --an-bg-secondary: #171124;
    --an-bg-tertiary: #20172E;

    --an-card:
        rgba(31,23,46,.74);

    --an-card-hover:
        rgba(37,27,54,.88);

    --an-input:
        rgba(20,15,30,.74);

    --an-text:
        #CFC2DD;

    --an-text-secondary:
        rgba(207,194,221,.68);

    --an-text-muted:
        rgba(187,169,205,.48);

    --an-border:
        rgba(171,133,223,.11);

    --an-border-hover:
        rgba(171,133,223,.23);

    --an-glow:
        0 0 22px
        rgba(103,76,186,.10);
}


/* ==========================================================
   STARFIELD DARK
   Camada agora fica NA FRENTE do fundo, não atrás dele
   ========================================================== */

html[data-theme="dark"]
body.an-dashboard-theme {
    position: relative;
    isolation: isolate;

    background:
        #100B1B !important;
}


/* Faz os wrappers principais continuarem transparentes
   para o céu poder aparecer */

html[data-theme="dark"]
body.an-dashboard-theme
:is(
    .an-app,
    .an-main,
    .an-page,
    .layout,
    .login-shell
) {
    background:
        transparent !important;
}


/* Conteúdo real fica acima do céu */

html[data-theme="dark"]
body.an-dashboard-theme
> :not(script):not(style):not(.login-theme) {
    position: relative;
    z-index: 2;
}


/* Estrelas pequenas em várias profundidades */

html[data-theme="dark"]
body.an-dashboard-theme::before {
    content: "";

    position: fixed;
    inset: 0;

    z-index: 0;

    pointer-events: none;

    opacity: .58;

    background-image:
        radial-gradient(
            circle,
            rgba(255,255,255,.50) 0 1px,
            transparent 1.25px
        ),
        radial-gradient(
            circle,
            rgba(223,193,247,.38) 0 1px,
            transparent 1.3px
        ),
        radial-gradient(
            circle,
            rgba(171,133,223,.30) 0 1px,
            transparent 1.2px
        ),
        radial-gradient(
            circle,
            rgba(255,255,255,.18) 0 .7px,
            transparent 1px
        ),
        radial-gradient(
            ellipse at 50% 0%,
            rgba(103,76,186,.10),
            transparent 58%
        );

    background-size:
        173px 181px,
        251px 239px,
        337px 311px,
        119px 137px,
        100% 100%;

    background-position:
        13px 17px,
        91px 43px,
        41px 127px,
        67px 23px,
        center;

    animation:
        astranexo-stars-breathe
        11s
        ease-in-out
        infinite alternate;
}


@keyframes astranexo-stars-breathe {
    from {
        opacity: .42;
    }

    to {
        opacity: .63;
    }
}


/* ==========================================================
   ESTRELA CADENTE
   Rara, curta e deliberadamente discreta
   ========================================================== */

html[data-theme="dark"]
body.an-dashboard-theme::after {
    content: "";

    position: fixed;

    top: 11vh;
    left: -170px;

    z-index: 1;

    width: 150px;
    height: 1px;

    pointer-events: none;

    opacity: 0;

    border-radius: 999px;

    background:
        linear-gradient(
            90deg,
            transparent 0%,
            rgba(171,133,223,.08) 22%,
            rgba(223,193,247,.42) 72%,
            rgba(255,255,255,.66) 94%,
            transparent 100%
        );

    box-shadow:
        45px 0 12px
        rgba(171,133,223,.08);

    transform:
        rotate(-18deg);

    transform-origin:
        right center;

    animation:
        astranexo-shooting-star-v2
        19s
        linear
        4s
        infinite;
}


@keyframes astranexo-shooting-star-v2 {
    0%,
    67% {
        opacity: 0;

        transform:
            translate3d(
                0,
                0,
                0
            )
            rotate(-18deg);
    }

    69% {
        opacity: 0;
    }

    70% {
        opacity: .28;
    }

    72% {
        opacity: .52;
    }

    75% {
        opacity: .22;
    }

    78% {
        opacity: 0;

        transform:
            translate3d(
                calc(100vw + 330px),
                34vh,
                0
            )
            rotate(-18deg);
    }

    100% {
        opacity: 0;

        transform:
            translate3d(
                calc(100vw + 330px),
                34vh,
                0
            )
            rotate(-18deg);
    }
}


/* ==========================================================
   LOGIN DARK
   Permite que o starfield apareça no painel direito
   ========================================================== */

html[data-theme="dark"]
body.an-login-global
.login-panel {
    background:
        transparent !important;
}


/* A lateral institucional continua sendo um painel próprio,
   sem comprometer a leitura */

html[data-theme="dark"]
body.an-login-global
.login-brand {
    position: relative;

    background:
        linear-gradient(
            145deg,
            rgba(25,14,61,.96),
            rgba(50,26,120,.90),
            rgba(103,76,186,.74)
        ) !important;
}


/* ==========================================================
   REDUCED MOTION
   ========================================================== */

@media (prefers-reduced-motion: reduce) {

    html[data-theme="dark"]
    body.an-dashboard-theme::before {
        animation:
            none !important;
    }

    html[data-theme="dark"]
    body.an-dashboard-theme::after {
        display:
            none !important;

        animation:
            none !important;
    }
}


/* ==========================================================
   ASTRA NEXO — REFINAMENTO VISUAL 3
   Correções de text-fill + sidebar + starfield animado
   ========================================================== */


/* ==========================================================
   LOGIN LIGHT
   "Gestão inteligente para experiências conectadas."
   Neutraliza gradient/text-fill antigo.
   ========================================================== */

html[data-theme="light"]
body.an-login-global
.login-brand
.brand-main h1,
html[data-theme="light"]
body.an-login-global
.login-brand
.brand-main h1 *,
html[data-theme="light"]
body.an-login-global
.login-brand
.brand-main h2,
html[data-theme="light"]
body.an-login-global
.login-brand
.brand-main h2 * {
    color: #FFFFFF !important;

    -webkit-text-fill-color:
        #FFFFFF !important;

    background:
        none !important;

    background-image:
        none !important;

    -webkit-background-clip:
        border-box !important;

    background-clip:
        border-box !important;

    text-shadow:
        0 2px 18px
        rgba(0,0,0,.18) !important;

    opacity: 1 !important;
}


/* textos auxiliares do painel institucional */

html[data-theme="light"]
body.an-login-global
.login-brand
.brand-main p,
html[data-theme="light"]
body.an-login-global
.login-brand
.brand-main p *,
html[data-theme="light"]
body.an-login-global
.login-brand
.brand-main .brand-eyebrow,
html[data-theme="light"]
body.an-login-global
.login-brand
.brand-main .brand-eyebrow * {
    color:
        rgba(255,255,255,.82) !important;

    -webkit-text-fill-color:
        rgba(255,255,255,.82) !important;

    opacity: 1 !important;
}


/* ==========================================================
   DASHBOARD LIGHT — ITEM ATIVO
   ========================================================== */

html[data-theme="light"]
body.an-dashboard-theme
.an-sidebar
.an-nav-link.is-active,
html[data-theme="light"]
body.an-dashboard-theme
.an-sidebar
.an-nav-link.is-active *,
html[data-theme="light"]
body.an-dashboard-theme
.an-sidebar
.an-nav-link[aria-current="page"],
html[data-theme="light"]
body.an-dashboard-theme
.an-sidebar
.an-nav-link[aria-current="page"] * {
    color:
        #FFFFFF !important;

    -webkit-text-fill-color:
        #FFFFFF !important;

    opacity:
        1 !important;
}


html[data-theme="light"]
body.an-dashboard-theme
.an-sidebar
.an-nav-link.is-active svg,
html[data-theme="light"]
body.an-dashboard-theme
.an-sidebar
.an-nav-link[aria-current="page"] svg {
    color:
        #FFFFFF !important;

    fill:
        currentColor !important;
}


/* Visão geral: label da seção continua legível */

html[data-theme="light"]
body.an-dashboard-theme
.an-sidebar
.an-nav-label {
    color:
        #674CBA !important;

    -webkit-text-fill-color:
        #674CBA !important;

    opacity:
        .85 !important;
}


/* ==========================================================
   DASHBOARD LIGHT — BLOCO DA CONTA
   H / Hudson / Conta AstraNexo / Sair da conta
   ========================================================== */

html[data-theme="light"]
body.an-dashboard-theme
.an-sidebar-footer {
    background:
        #F2ECF8 !important;

    border-top:
        1px solid
        rgba(103,76,186,.14) !important;

    box-shadow:
        none !important;
}


html[data-theme="light"]
body.an-dashboard-theme
.an-sidebar-footer
:is(
    div,
    span,
    p,
    small,
    strong,
    a,
    button,
    i
) {
    color:
        #342247 !important;

    -webkit-text-fill-color:
        #342247 !important;

    opacity:
        1 !important;
}


/* remove barras internas escuras herdadas */

html[data-theme="light"]
body.an-dashboard-theme
.an-sidebar-footer
:is(
    div,
    a,
    button
) {
    border-color:
        rgba(103,76,186,.12) !important;
}


/* avatar H */

html[data-theme="light"]
body.an-dashboard-theme
.an-sidebar-footer
[class*="avatar"],
html[data-theme="light"]
body.an-dashboard-theme
.an-sidebar-footer
[class*="Avatar"] {
    color:
        #FFFFFF !important;

    -webkit-text-fill-color:
        #FFFFFF !important;

    background:
        linear-gradient(
            135deg,
            #321A78,
            #674CBA
        ) !important;
}


/* logout fica claramente clicável */

html[data-theme="light"]
body.an-dashboard-theme
.an-sidebar-footer
a:hover,
html[data-theme="light"]
body.an-dashboard-theme
.an-sidebar-footer
button:hover {
    color:
        #674CBA !important;

    -webkit-text-fill-color:
        #674CBA !important;

    background:
        rgba(103,76,186,.07) !important;
}


/* ==========================================================
   DARK — STARFIELD VISÍVEL E ANIMADO
   ========================================================== */

html[data-theme="dark"]
body.an-dashboard-theme::before {
    display:
        block !important;

    content:
        "" !important;

    z-index:
        0 !important;

    opacity:
        .68;

    will-change:
        background-position,
        opacity;

    animation:
        astranexo-stars-drift-v3
        34s
        linear
        infinite,
        astranexo-stars-twinkle-v3
        6s
        ease-in-out
        infinite alternate
        !important;
}


@keyframes astranexo-stars-drift-v3 {
    0% {
        background-position:
            13px 17px,
            91px 43px,
            41px 127px,
            67px 23px,
            center;
    }

    50% {
        background-position:
            34px 31px,
            72px 64px,
            61px 111px,
            51px 41px,
            center;
    }

    100% {
        background-position:
            55px 45px,
            53px 85px,
            81px 95px,
            35px 59px,
            center;
    }
}


@keyframes astranexo-stars-twinkle-v3 {
    0% {
        opacity: .48;
        filter: brightness(.92);
    }

    100% {
        opacity: .76;
        filter: brightness(1.14);
    }
}


/* ==========================================================
   ESTRELA CADENTE V3
   ========================================================== */

html[data-theme="dark"]
body.an-dashboard-theme::after {
    display:
        block !important;

    content:
        "" !important;

    top:
        8vh !important;

    left:
        -190px !important;

    width:
        175px !important;

    height:
        2px !important;

    z-index:
        1 !important;

    opacity:
        0;

    pointer-events:
        none !important;

    will-change:
        transform,
        opacity;

    background:
        linear-gradient(
            90deg,
            transparent 0%,
            rgba(171,133,223,.08) 18%,
            rgba(223,193,247,.50) 68%,
            rgba(255,255,255,.82) 94%,
            transparent 100%
        ) !important;

    filter:
        drop-shadow(
            0 0 4px
            rgba(223,193,247,.30)
        ) !important;

    animation:
        astranexo-shooting-star-v3
        12s
        linear
        2s
        infinite
        !important;
}


@keyframes astranexo-shooting-star-v3 {
    0%,
    58% {
        opacity: 0;

        transform:
            translate3d(0,0,0)
            rotate(-18deg);
    }

    60% {
        opacity: 0;
    }

    61% {
        opacity: .35;
    }

    63% {
        opacity: .72;
    }

    67% {
        opacity: .52;
    }

    72% {
        opacity: 0;

        transform:
            translate3d(
                calc(100vw + 390px),
                38vh,
                0
            )
            rotate(-18deg);
    }

    100% {
        opacity: 0;

        transform:
            translate3d(
                calc(100vw + 390px),
                38vh,
                0
            )
            rotate(-18deg);
    }
}


/* interface permanece acima da animação */

html[data-theme="dark"]
body.an-dashboard-theme
> :not(script):not(style) {
    position:
        relative;

    z-index:
        2;
}


/* ==========================================================
   ACCESSIBILITY
   ========================================================== */

@media (prefers-reduced-motion: reduce) {

    html[data-theme="dark"]
    body.an-dashboard-theme::before {
        animation:
            none !important;

        opacity:
            .55 !important;
    }

    html[data-theme="dark"]
    body.an-dashboard-theme::after {
        display:
            none !important;

        animation:
            none !important;
    }
}

/* Login: o toggle deve permanecer fora do fluxo em qualquer tema */
body.an-login-global > .login-theme {
    position: fixed !important;
    top: 18px !important;
    right: 18px !important;
    left: auto !important;
    bottom: auto !important;
    z-index: 10000 !important;
}
