/* ═══════════════════════════════════════════════════════════════
   WebNett Provedor — ULTRA MODERN DESIGN SYSTEM v2026
   Deep Obsidian · Cyber Neon · Glassmorphic Hologram
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=IBM+Plex+Mono:wght@400;500;600;700&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
    /* ── Deep Obsidian Core Backgrounds ──────────────────── */
    --d0: #02040a;
    --d1: #050814;
    --d2: #0a0f1d;
    --d3: #0f1628;
    --d4: #141e34;
    --d5: #1a2744;

    /* ── Primary Cyber Neons ────────────────────────────── */
    --teal: #00F2FE;
    --teal-dim: #00B4D8;
    --teal-pale: #70F8FF;

    --violet: #7F00FF;
    --violet-bright: #A100FF;
    --violet-pale: #C77DFF;

    --indigo: #4FACFE;
    --indigo-bright: #00F2FE;
    --indigo-pale: #90E0EF;

    /* ── Legacy Aliases ──────────────────────────────────── */
    --cyan: #00F2FE;
    --cyan-bright: #70F8FF;
    --blue: #0077B6;
    --blue-bright: #0096C7;

    /* ── Accent Colors ───────────────────────────────────── */
    --rose: #FF0844;
    --amber: #FFB703;
    --emerald: #10B981;
    --slate: #64748B;

    /* ── Glow Effects ────────────────────────────────────── */
    --glow-indigo: rgba(79, 172, 254, 0.15);
    --glow-violet: rgba(127, 0, 255, 0.18);
    --glow-cyan: rgba(0, 242, 254, 0.2);
    --glow-rose: rgba(255, 8, 68, 0.15);
    --glow-emerald: rgba(16, 185, 129, 0.18);

    /* ── Ultra Modern Gradients ──────────────────────────── */
    --grad-primary: linear-gradient(135deg, #00F2FE 0%, #4FACFE 50%, #7F00FF 100%);
    --grad-primary-subtle: linear-gradient(135deg, rgba(0, 242, 254, 0.12) 0%, rgba(127, 0, 255, 0.08) 100%);
    --grad-glow: linear-gradient(135deg, #00F2FE 0%, #7F00FF 100%);
    --grad-surface: linear-gradient(135deg, rgba(10, 15, 29, 0.95) 0%, rgba(5, 8, 20, 0.98) 100%);
    --grad-glass: linear-gradient(135deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.01) 100%);

    /* ── Borders ─────────────────────────────────────────── */
    --b0: rgba(255, 255, 255, 0.03);
    --b1: rgba(255, 255, 255, 0.06);
    --b2: rgba(255, 255, 255, 0.1);
    --b3: rgba(255, 255, 255, 0.16);
    --b-indigo: rgba(79, 172, 254, 0.25);
    --b-violet: rgba(127, 0, 255, 0.25);
    --b-cyan: rgba(0, 242, 254, 0.3);

    /* ── Typography Colors ───────────────────────────────── */
    --t0: #F8FAFC;
    --t1: #E2E8F0;
    --t2: #94A3B8;
    --t3: #64748B;
    --t4: #334155;

    /* ── Shadows ─────────────────────────────────────────── */
    --sh-sm: 0 2px 8px rgba(0, 0, 0, 0.7);
    --sh-md: 0 8px 24px rgba(0, 0, 0, 0.75);
    --sh-lg: 0 16px 48px rgba(0, 0, 0, 0.85);
    --sh-xl: 0 24px 72px rgba(0, 0, 0, 0.9);
    --sh-glow: 0 0 30px rgba(0, 242, 254, 0.15);
    --sh-glow-strong: 0 0 45px rgba(0, 242, 254, 0.3);

    /* ── Typography Fonts ────────────────────────────────── */
    --font: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'IBM Plex Mono', monospace;

    /* ── Layout Sizes ────────────────────────────────────── */
    --sidebar-w: 260px;
    --topbar-h: 64px;

    /* ── Border Radius ───────────────────────────────────── */
    --r-xs: 8px;
    --r-sm: 10px;
    --r: 14px;
    --r-md: 18px;
    --r-lg: 22px;
    --r-xl: 28px;
    --r-2xl: 36px;

    /* ── Semantic Aliases ────────────────────────────────── */
    --primary: var(--teal);
    --primary-bright: var(--teal-pale);
    --primary-glow: var(--glow-cyan);
    --primary-grad: var(--grad-primary);
    --danger: var(--rose);
    --warning: var(--amber);
    --info: var(--cyan);
    --success: var(--emerald);
    --bg-app: var(--d0);
    --bg-card: var(--d2);
    --bg-surface: var(--d3);
    --text-main: var(--t1);
    --text-sub: var(--t2);
    --text-muted: var(--t2);
    --border: var(--b1);
    --border-light: var(--b2);
    --border-glow: var(--b-cyan);
    --radius: var(--r);
    --radius-md: var(--r-md);
    --radius-lg: var(--r-lg);
    --shadow-premium: 0 24px 60px rgba(0, 0, 0, .45);
}

/* ══════════════════════════════════════════════════════════════
   RESET & BASE
   ══════════════════════════════════════════════════════════════ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
    background: var(--d0);
}

body {
    font-family: var(--font);
    background: var(--d0);
    color: var(--t1);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font-family: var(--font);
    cursor: pointer;
    border: none;
    outline: none;
}

input, select, textarea {
    font-family: var(--font);
}

/* Correção de contraste no popup nativo de <select> — o app é todo escuro
   (texto claro em fundo escuro), mas sem isso o navegador abre a lista de
   opções com fundo claro padrão do sistema, deixando o texto claro invisível
   (\"letra da mesma cor da janela\"). color-scheme avisa o navegador pra
   desenhar o próprio popup nativo já no esquema escuro; o background/color
   explícito em option é o reforço pra quando o navegador não respeita isso. */
select {
    color-scheme: dark;
}
select option {
    background-color: #0c0c0c;
    color: #e2e2e2;
}

code, pre, kbd, .mono {
    font-family: var(--font-mono);
}

/* ══════════════════════════════════════════════════════════════
   ANIMATIONS
   ══════════════════════════════════════════════════════════════ */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }
@keyframes modalIn { from { opacity: 0; transform: translateY(30px) scale(0.95); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes pageEnter { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes glowPulse { 0%, 100% { opacity: 0.4; transform: scale(1); } 50% { opacity: 0.8; transform: scale(1.05); } }
@keyframes borderGlow { 0%, 100% { border-color: rgba(0, 242, 254, 0.2); } 50% { border-color: rgba(127, 0, 255, 0.5); } }
@keyframes floatY { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes gradientFlow { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }
@keyframes dotPulse { 0% { box-shadow: 0 0 0 0 rgba(0, 242, 254, 0.8); } 70% { box-shadow: 0 0 0 10px rgba(0, 242, 254, 0); } 100% { box-shadow: 0 0 0 0 rgba(0, 242, 254, 0); } }
@keyframes hudScanSweep { 0% { top: -4%; opacity: 0; } 8% { opacity: .65; } 92% { opacity: .65; } 100% { top: 104%; opacity: 0; } }
@keyframes hudGridDrift { 0% { background-position: 0 0; } 100% { background-position: 44px 44px; } }
@keyframes hudRadarSpin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════════════════════════
   HUD SYSTEM — Corner Frames · Scanlines · Grid Overlay · Radar
   Reusable futuristic chrome layered on top of the existing dark
   glassmorphic design. Additive only: decorative pseudo-elements,
   pointer-events: none, never touches layout/colors of content.
   ══════════════════════════════════════════════════════════════ */
.hud-frame, .card, .glass-card, .kpi-card, .card-kpi, .table-card,
.sidebar-avatar, .sidebar-user, .topbar-btn,
.sidebar-logo > div:first-child {
    position: relative;
}
/* Marcações de canto (4 tracinhos em cada quina) removidas a pedido — davam
   uma sensação de "quina"/canto reto em cima de cards, avatar, botões da
   topbar e a logo, mesmo com o border-radius arredondado por baixo. */

/* Scanline sweep — add .hud-scan to any position:relative + overflow:hidden panel */
.hud-scan { overflow: hidden; }
.hud-scan::before {
    content: '';
    position: absolute;
    left: 6%; right: 6%; height: 1px;
    background: linear-gradient(90deg, transparent, var(--hud-accent, var(--teal)), transparent);
    box-shadow: 0 0 12px 1px var(--hud-accent, var(--teal));
    animation: hudScanSweep 5s linear infinite;
    pointer-events: none;
    z-index: 1;
}

/* HUD tag chip — small monospace readout label */
.hud-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: var(--font-mono);
    font-size: .58rem;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--hud-accent, var(--teal));
    padding: 3px 9px;
    border: 1px solid rgba(0, 242, 254, .3);
    border-radius: 4px;
    background: rgba(0, 242, 254, .06);
}
.hud-tag::before { content: '▹'; opacity: .7; }

/* Radar ping — replaces a plain status dot with a rotating sweep ring */
.hud-radar { position: relative; display: inline-block; width: 8px; height: 8px; }
.hud-radar::before {
    content: '';
    position: absolute; inset: 0;
    border-radius: 50%;
    background: var(--hud-accent, var(--teal));
    box-shadow: 0 0 10px var(--hud-accent, var(--teal));
}
.hud-radar::after {
    content: '';
    position: absolute; inset: -6px;
    border-radius: 50%;
    border: 1px solid var(--hud-accent, var(--teal));
    border-top-color: transparent;
    border-left-color: transparent;
    opacity: .6;
    animation: hudRadarSpin 2.4s linear infinite;
}

/* Ambient grid overlay — apply to any positioned full-bleed container */
.hud-grid-bg { position: relative; }
.hud-grid-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(0, 242, 254, .05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 242, 254, .05) 1px, transparent 1px);
    background-size: 44px 44px;
    -webkit-mask-image: radial-gradient(ellipse 75% 60% at 50% 20%, black 30%, transparent 100%);
    mask-image: radial-gradient(ellipse 75% 60% at 50% 20%, black 30%, transparent 100%);
    animation: hudGridDrift 26s linear infinite;
}

/* ══════════════════════════════════════════════════════════════
   LOADER
   ══════════════════════════════════════════════════════════════ */
.loader-container {
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--d0);
    position: relative;
    overflow: hidden;
}

.loader-container::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 50%, rgba(0, 242, 254, 0.06) 0%, transparent 70%);
}

.loader-spinner {
    width: 44px;
    height: 44px;
    border: 3px solid rgba(255, 255, 255, 0.08);
    border-top-color: var(--teal);
    border-right-color: var(--violet);
    border-radius: 50%;
    animation: spin 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
    position: relative;
    z-index: 1;
    box-shadow: 0 0 25px rgba(0, 242, 254, 0.3);
}

/* ══════════════════════════════════════════════════════════════
   APP LAYOUT
   ══════════════════════════════════════════════════════════════ */
.app-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
    background: var(--d0);
}

/* ══════════════════════════════════════════════════════════════
   SIDEBAR — Ultra Modern Glass
   ══════════════════════════════════════════════════════════════ */
.sidebar {
    width: var(--sidebar-w);
    height: 100vh;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 200;
    overflow: hidden;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    background: linear-gradient(180deg, #050814 0%, #02040a 100%);
    border-right: 1px solid var(--b1);
    position: relative;
}

.sidebar::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 1px;
    height: 100%;
    background: linear-gradient(180deg, transparent 0%, rgba(0, 242, 254, 0.2) 30%, rgba(127, 0, 255, 0.15) 70%, transparent 100%);
    pointer-events: none;
}

.sidebar-logo {
    height: var(--topbar-h);
    padding: 0 20px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--b1);
    gap: 12px;
    flex-shrink: 0;
    position: relative;
}

.sidebar-logo::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0, 242, 254, 0.3), transparent);
    pointer-events: none;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 16px 0;
}

.sidebar-nav::-webkit-scrollbar {
    width: 0;
}

.nav-section {
    padding: 20px 18px 8px;
    font-size: 0.62rem;
    font-weight: 800;
    color: var(--t3);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    font-family: var(--font-mono);
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-section::before {
    content: '▹';
    color: var(--teal);
    opacity: .55;
    font-size: .7rem;
}

.nav-section::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--b1), transparent);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    margin: 2px 12px;
    border-radius: var(--r-sm);
    color: var(--t2);
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid transparent;
    background: transparent;
    width: calc(100% - 24px);
    text-align: left;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0;
    background: var(--grad-primary);
    border-radius: 4px;
    transition: width 0.25s ease;
    opacity: 0;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--t0);
    border-color: var(--b2);
    transform: translateX(2px);
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(0, 242, 254, 0.08) 0%, rgba(127, 0, 255, 0.03) 100%);
    color: var(--teal);
    border-color: var(--b-cyan);
    font-weight: 800;
    box-shadow: 0 4px 20px rgba(0, 242, 254, 0.08);
}

.nav-item.active::before {
    width: 3.5px;
    opacity: 1;
}

.nav-item .material-icons {
    font-size: 19px;
    flex-shrink: 0;
}

.nav-item .nav-arrow {
    margin-left: auto;
    font-size: 17px;
    transition: transform 0.2s;
}

.nav-group.open .nav-arrow {
    transform: rotate(180deg);
}

.nav-group {
    overflow: hidden;
}

.nav-submenu {
    display: none;
    padding-bottom: 4px;
    padding-left: 1rem;
    margin-left: 26px;
    border-left: 1px dashed rgba(0, 242, 254, .18);
}

.nav-group.open .nav-submenu {
    display: block;
}

.nav-subitem, .nav-sublink {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px 8px 38px;
    margin: 2px 12px;
    border-radius: var(--r-sm);
    color: var(--t2);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.18s;
    text-decoration: none;
    width: calc(100% - 24px);
    border: 1px solid transparent;
    position: relative;
}

.nav-subitem::before, .nav-sublink::before {
    content: '';
    position: absolute;
    left: -1rem;
    top: 50%;
    width: 10px;
    height: 1px;
    background: rgba(0, 242, 254, .22);
}

.nav-subitem:hover, .nav-sublink:hover {
    background: rgba(255, 255, 255, 0.035);
    color: var(--t0);
}

.nav-subitem.active, .nav-sublink.active {
    color: var(--teal);
    background: rgba(0, 242, 254, 0.05);
    border-color: var(--b-cyan);
    font-weight: 700;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--b1);
    flex-shrink: 0;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--r);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--b1);
    transition: all 0.2s;
    cursor: pointer;
}

.sidebar-user:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--b2);
}

.sidebar-avatar {
    width: 38px;
    height: 38px;
    border-radius: var(--r-sm);
    background: var(--grad-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
    font-weight: 900;
    color: #02040a;
    flex-shrink: 0;
    box-shadow: 0 0 16px rgba(0, 242, 254, 0.3);
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user-name {
    font-size: 0.82rem;
    font-weight: 800;
    color: var(--t0);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--r-sm);
    border: 1px solid var(--b1);
    background: transparent;
    color: var(--t3);
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.sidebar-logout:hover {
    background: rgba(255, 8, 68, 0.1);
    color: var(--rose);
    border-color: rgba(255, 8, 68, 0.3);
}

/* ══════════════════════════════════════════════════════════════
   MAIN CONTENT & TOPBAR
   ══════════════════════════════════════════════════════════════ */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--d0);
}

.topbar {
    height: var(--topbar-h);
    border-bottom: 1px solid var(--b1);
    display: flex;
    align-items: center;
    padding: 0 28px;
    gap: 16px;
    flex-shrink: 0;
    background: rgba(5, 8, 20, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    position: relative;
    z-index: 10;
}

.topbar::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0, 242, 254, 0.2), transparent);
    pointer-events: none;
}

.topbar-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--b1);
    border-radius: var(--r-sm);
    background: transparent;
    color: var(--t2);
    cursor: pointer;
    transition: all 0.2s;
}

.topbar-menu-btn:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--t0);
}

.topbar-breadcrumb {
    flex: 1;
    font-size: 0.78rem;
    color: var(--t3);
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
}

.topbar-breadcrumb span {
    color: var(--t0);
    font-weight: 800;
    font-family: var(--font);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

/* ══════════════════════════════════════════════════════════════
   DROPDOWN — Account menu (was unstyled: no positioning existed,
   so it rendered inline in the page flow instead of floating).
   ══════════════════════════════════════════════════════════════ */
.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 220px;
    background: rgba(10, 15, 29, 0.98);
    border: 1px solid var(--b2);
    border-radius: var(--r-md);
    box-shadow: var(--sh-xl);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 400;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.97);
    transform-origin: top right;
    transition: opacity 0.18s ease, transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.18s;
    overflow: hidden;
    pointer-events: none;
}

.dropdown-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 18px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--t1);
    text-decoration: none;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.dropdown-item .material-icons {
    font-size: 17px;
    color: var(--t3);
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--t0);
}

.dropdown-danger {
    color: var(--rose);
}

.dropdown-danger .material-icons {
    color: var(--rose);
}

.dropdown-danger:hover {
    background: rgba(255, 8, 68, 0.1);
}

.dropdown-divider {
    height: 1px;
    background: var(--b1);
    margin: 4px 0;
}

.page-content {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
    position: relative;
    background: var(--d0);
}

.page-content::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(0, 242, 254, .035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 242, 254, .035) 1px, transparent 1px);
    background-size: 46px 46px;
    -webkit-mask-image: radial-gradient(ellipse 90% 55% at 50% 0%, black 30%, transparent 100%);
    mask-image: radial-gradient(ellipse 90% 55% at 50% 0%, black 30%, transparent 100%);
}

.page-content > * {
    position: relative;
    z-index: 1;
    animation: pageEnter 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.page-content::-webkit-scrollbar {
    width: 6px;
}

.page-content::-webkit-scrollbar-track {
    background: transparent;
}

.page-content::-webkit-scrollbar-thumb {
    background: var(--b2);
    border-radius: 6px;
}

.page-content::-webkit-scrollbar-thumb:hover {
    background: var(--b3);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(2, 4, 10, 0.88);
    backdrop-filter: blur(8px);
    z-index: 199;
}

.sidebar-overlay.active {
    display: block;
    animation: fadeIn 0.2s ease;
}

/* ══════════════════════════════════════════════════════════════
   CARDS & GLASSMORPHISM
   ══════════════════════════════════════════════════════════════ */
.card, .glass-card {
    background: rgba(10, 15, 29, 0.92);
    border: 1px solid var(--b1);
    border-radius: var(--r-md);
    padding: 24px;
    box-shadow: var(--sh-sm);
    transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.card::before, .glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
    pointer-events: none;
}

.card:hover, .glass-card:hover {
    border-color: var(--b2);
    box-shadow: var(--sh-md);
    transform: translateY(-2px);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 16px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--b1);
}

.card-title {
    font-size: 0.88rem;
    font-weight: 800;
    color: var(--t0);
    letter-spacing: -0.01em;
}

/* KPI Cards */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 18px;
    margin-bottom: 28px;
}

.kpi-card, .card-kpi {
    background: rgba(10, 15, 29, 0.94);
    border: 1px solid var(--b1);
    border-radius: var(--r-md);
    padding: 24px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border-top: 2px solid transparent;
    backdrop-filter: blur(16px);
}

.kpi-card:hover, .card-kpi:hover {
    transform: translateY(-4px);
    border-color: var(--b-cyan);
    border-top-color: var(--teal);
    box-shadow: var(--sh-md), var(--sh-glow);
}

.kpi-label, .kpi-header {
    font-size: 0.66rem;
    font-weight: 800;
    color: var(--t3);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-family: var(--font-mono);
}

.kpi-value {
    font-size: 2.2rem;
    font-weight: 900;
    color: var(--t0);
    letter-spacing: -0.04em;
    margin-bottom: 10px;
    line-height: 1;
}

.kpi-badge {
    font-size: 0.64rem;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: var(--r-xs);
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: var(--font-mono);
    text-transform: uppercase;
}

.kpi-badge.green { background: rgba(16, 185, 129, 0.1); color: #34D399; border: 1px solid rgba(16, 185, 129, 0.25); }
.kpi-badge.red { background: rgba(255, 8, 68, 0.1); color: #FF4D6D; border: 1px solid rgba(255, 8, 68, 0.25); }
.kpi-badge.amber { background: rgba(255, 183, 3, 0.1); color: #FFC300; border: 1px solid rgba(255, 183, 3, 0.25); }
.kpi-badge.blue { background: rgba(0, 242, 254, 0.1); color: var(--teal-pale); border: 1px solid rgba(0, 242, 254, 0.25); }

/* ══════════════════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 22px;
    border-radius: var(--r-sm);
    font-size: 0.84rem;
    font-weight: 800;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid transparent;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.btn .material-icons {
    font-size: 18px;
}

.btn-sm { padding: 7px 14px; font-size: 0.76rem; }
.btn-lg { padding: 14px 28px; font-size: 0.92rem; }
.btn-full { width: 100%; justify-content: center; }

.btn-primary {
    background: var(--grad-primary);
    color: #02040a;
    font-weight: 900;
    box-shadow: 0 4px 20px rgba(0, 242, 254, 0.28);
    border: none;
    background-size: 200% 200%;
}

.btn-primary:hover {
    box-shadow: 0 8px 32px rgba(0, 242, 254, 0.45);
    transform: translateY(-2px);
    filter: brightness(1.1);
}

.btn-primary:active {
    transform: translateY(0) scale(0.98);
}

.btn-outline, .btn-secondary {
    background: rgba(255, 255, 255, 0.03);
    color: var(--t1);
    border: 1px solid var(--b2);
}

.btn-outline:hover, .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--b3);
    color: var(--t0);
    transform: translateY(-1.5px);
}

.btn-danger {
    background: rgba(255, 8, 68, 0.1);
    color: var(--rose);
    border: 1px solid rgba(255, 8, 68, 0.25);
}

.btn-danger:hover {
    background: rgba(255, 8, 68, 0.2);
    transform: translateY(-1.5px);
    box-shadow: 0 4px 20px rgba(255, 8, 68, 0.2);
}

/* ══════════════════════════════════════════════════════════════
   FORMS & INPUTS
   ══════════════════════════════════════════════════════════════ */
.form-group {
    margin-bottom: 22px;
}

.form-label, .form-label-premium {
    display: block;
    font-size: 0.66rem;
    font-weight: 800;
    color: var(--t3);
    margin-bottom: 9px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-family: var(--font-mono);
}

.form-input, .form-input-premium {
    width: 100%;
    padding: 13px 18px;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid var(--b2);
    border-radius: var(--r-sm);
    color: var(--t0);
    font-family: var(--font);
    font-size: 0.88rem;
    transition: all 0.2s ease;
    outline: none;
}

.form-input:hover, .form-input-premium:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--b3);
}

.form-input:focus, .form-input-premium:focus {
    background: rgba(0, 242, 254, 0.03);
    border-color: var(--teal);
    box-shadow: 0 0 0 3.5px rgba(0, 242, 254, 0.12);
}

.form-input::placeholder, .form-input-premium::placeholder {
    color: var(--t4);
}

/* ══════════════════════════════════════════════════════════════
   TABLES
   ══════════════════════════════════════════════════════════════ */
.table-card {
    background: rgba(10, 15, 29, 0.94);
    border: 1px solid var(--b1);
    border-radius: var(--r-md);
    overflow: hidden;
    box-shadow: var(--sh-sm);
    backdrop-filter: blur(16px);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.84rem;
}

thead tr {
    border-bottom: 1px solid var(--b1);
    background: rgba(255, 255, 255, 0.015);
}

thead th {
    padding: 14px 18px;
    text-align: left;
    font-size: 0.66rem;
    font-weight: 800;
    color: var(--t3);
    white-space: nowrap;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-family: var(--font-mono);
}

tbody tr {
    border-bottom: 1px solid var(--b0);
    transition: background 0.15s ease;
}

tbody tr:hover {
    background: rgba(0, 242, 254, 0.03);
}

tbody td {
    padding: 14px 18px;
    color: var(--t1);
    vertical-align: middle;
}

/* ══════════════════════════════════════════════════════════════
   BADGES & STATUS
   ══════════════════════════════════════════════════════════════ */
.badge, .status-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: var(--r-xs);
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-family: var(--font-mono);
}

.badge-green, .status-tag.success { background: rgba(16, 185, 129, 0.1); color: #34D399; border: 1px solid rgba(16, 185, 129, 0.25); }
.badge-red, .status-tag.danger { background: rgba(255, 8, 68, 0.1); color: #FF4D6D; border: 1px solid rgba(255, 8, 68, 0.25); }
.badge-amber, .status-tag.warning { background: rgba(255, 183, 3, 0.1); color: #FFC300; border: 1px solid rgba(255, 183, 3, 0.25); }
.badge-cyan { background: rgba(0, 242, 254, 0.1); color: var(--teal); border: 1px solid rgba(0, 242, 254, 0.25); }

/* Status Dot */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.status-dot.green { background: var(--emerald); box-shadow: 0 0 10px rgba(16, 185, 129, 0.6); }
.status-dot.red { background: var(--rose); box-shadow: 0 0 10px rgba(255, 8, 68, 0.6); }
.status-dot.amber { background: var(--amber); box-shadow: 0 0 10px rgba(255, 183, 3, 0.6); }

/* ══════════════════════════════════════════════════════════════
   TOAST
   ══════════════════════════════════════════════════════════════ */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 20px;
    border-radius: var(--r);
    min-width: 300px;
    max-width: 420px;
    background: rgba(15, 22, 40, 0.96);
    border: 1px solid var(--b2);
    box-shadow: var(--sh-xl);
    pointer-events: all;
    animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(20px);
}

.toast.out {
    animation: toastOut 0.25s ease forwards;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(60px) scale(0.95); }
    to { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(60px); }
}

/* ══════════════════════════════════════════════════════════════
   DASHBOARD QUADRANTS — HUD framing applied structurally so the
   dashboard panels get the sci-fi treatment without needing a
   class on every generated card.
   ══════════════════════════════════════════════════════════════ */
.dash-kpi-grid { counter-reset: quadCounter; }
.dash-kpi-grid > div { counter-increment: quadCounter; }

.dash-kpi-grid > div,
.dash-main-grid > div:first-child,
.dash-main-grid > div:last-child > div,
.dash-bottom-grid > div {
    position: relative;
}

/* Marcações de canto dos quadrantes do Dashboard (mesmos 4 tracinhos por
   quina, versão própria daqui) removidas a pedido — igual ao resto do sistema. */

.dash-kpi-grid > div::after {
    content: 'Q.' counter(quadCounter, decimal-leading-zero);
    position: absolute;
    top: 7px;
    left: 14px;
    font-family: var(--font-mono);
    font-size: .54rem;
    font-weight: 800;
    letter-spacing: .1em;
    color: rgba(0, 242, 254, .4);
    z-index: 3;
    pointer-events: none;
}

.dash-main-grid > div:first-child,
.dash-main-grid > div:last-child > div:first-child {
    overflow: hidden;
}
.dash-main-grid > div:first-child::after,
.dash-main-grid > div:last-child > div:first-child::after {
    content: '';
    position: absolute;
    left: 6%; right: 6%; height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0, 242, 254, .9), transparent);
    box-shadow: 0 0 10px rgba(0, 242, 254, .6);
    animation: hudScanSweep 6s linear infinite;
    pointer-events: none;
    z-index: 1;
}

/* Responsive */
@media (max-width: 900px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        transform: translateX(-100%);
        z-index: 200;
    }
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 12px 0 40px rgba(0, 0, 0, 0.8);
    }
    .topbar-menu-btn {
        display: flex;
    }
    .page-content {
        padding: 20px;
        overflow-x: auto;
    }
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .kpi-grid {
        grid-template-columns: 1fr;
    }
    .page-content {
        padding: 16px;
    }
}

/* PWA/Responsivo — colapsa QUALQUER grid inline (style="display:grid;...") pra
   1 coluna em telas estreitas, sem editar os ~30 arquivos de componente que
   usam estilo inline em vez de classes CSS.
   Primeira versão desta regra tentava casar cada valor literal de
   grid-template-columns um por um (ex: [style*="grid-template-columns:1fr 1fr"])
   — se mostrou frágil na prática (usuário confirmou telas ainda quebradas no
   celular): qualquer variação de espaçamento/valor não prevista no CSS não
   colapsava. Esta versão casa só pela PRESENÇA de "display:grid" no atributo
   style (em ambas as grafias, com/sem espaço) e força 1 coluna sempre — não
   precisa mais adivinhar o valor original de grid-template-columns.
   Usos que já têm "!important" inline não podem ser sobrepostos por regra
   nenhuma de stylesheet externa — inline !important sempre vence no cascade —
   e por isso ficam de fora (gap conhecido, não tem solução em CSS puro). */
@media (max-width: 640px) {
    [style*="display:grid"],
    [style*="display: grid"] {
        grid-template-columns: 1fr !important;
    }

    /* Mesma lógica pra flex: qualquer linha inline (busca + botão, ações de
       tabela, cabeçalhos com filtro) que não caiba na largura da tela agora
       quebra pra linha de baixo em vez de estourar/cortar. Não afeta nada que
       já cabia numa linha só — flex-wrap só entra em ação quando precisa. */
    [style*="display:flex"],
    [style*="display: flex"] {
        flex-wrap: wrap;
    }
}

/* ─── Cantos dos cards — o padrão de card usado em quase todo componente
   (background:#0f0f0f;border:1px solid #1a1a1a;...) tinha border-radius:8px,
   um arredondamento bem sutil perto de outros elementos da mesma tela (modais
   a 24px, badges em pílula a 999px) — lado a lado dava a sensação de "quina",
   cantos quase retos. Sobe pra 14px só nesse padrão específico (os dois
   trechos precisam bater no mesmo elemento), sem mexer em botões/badges/
   inputs pequenos que usam border-radius baixo de propósito. */
[style*="background:#0f0f0f"][style*="border:1px solid #1a1a1a"][style*="border-radius:8px"],
[style*="background: #0f0f0f"][style*="border: 1px solid #1a1a1a"][style*="border-radius: 8px"] {
    border-radius: 14px !important;
}

/* ─── Modal genérico (.modal / .modal-header / .modal-body / .modal-footer /
   .modal-title / .modal-close) — usado em Companies.js e Settings.js, mas
   nunca teve definição em lugar nenhum (nem aqui, nem em <style> local de
   componente) — renderizava como bloco solto sem cartão/posicionamento,
   "fora do layout". O overlay (position:fixed;inset:0;...) que centraliza
   isso já existe inline em cada modal; só faltava o cartão em si. ────────── */
.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: var(--shadow-premium);
    max-height: 90vh;
    overflow-y: auto;
    animation: modalIn .25s ease;
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 1.75rem;
    border-bottom: 1px solid var(--border);
}
.modal-title {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-main);
}
.modal-close {
    background: var(--bg-app);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .15s;
    flex-shrink: 0;
}
.modal-close:hover {
    background: rgba(239, 68, 68, .1);
    color: #ef4444;
}
.modal-body {
    padding: 1.75rem;
}
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1.25rem 1.75rem;
    border-top: 1px solid var(--border);
}

/* ─── Table row action buttons (icon-only, with hover tooltip) ─────────── */
.tbl-action {
    width: 30px;
    height: 30px;
    border-radius: 5px;
    border: 1px solid #1e1e1e;
    background: #0c0c0c;
    color: #666;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
    transition: all .15s;
}
.tbl-action:hover {
    border-color: rgba(79, 143, 250, .4);
    color: #79b0ff;
}
.tbl-action.danger {
    color: #ef4444;
}
.tbl-action.danger:hover {
    border-color: rgba(239, 68, 68, .4);
    background: rgba(239, 68, 68, .06);
    color: #ef4444;
}
[data-tooltip] {
    position: relative;
}
[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 130%;
    left: 50%;
    transform: translateX(-50%);
    background: #0a0a0a;
    border: 1px solid #1e1e1e;
    color: #ccc;
    font-size: .65rem;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .15s;
    z-index: 30;
}
[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
}