@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Lexend:wght@300;400;500;600;700;800&display=swap');

/* ─────────────────────────────────────────────
   1. TOKENS & DESIGN VARIABLES
───────────────────────────────────────────── */
:root {
    /* Brand Gradients */
    --g-primary: linear-gradient(135deg, #00d2ff 0%, #3a7bd5 100%);
    --g-secondary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --g-success: linear-gradient(135deg, #00b09b 0%, #96c93d 100%);
    --g-danger: linear-gradient(135deg, #f85032 0%, #e73827 100%);
    --g-warm: linear-gradient(135deg, #f7971e 0%, #ffd200 100%);

    /* Light Theme Colors (Default) */
    --bg: #f0f4f8;
    --bg-card: rgba(255, 255, 255, 0.90);
    --bg-sidebar: rgba(255, 255, 255, 0.96);
    --bg-input: rgba(0, 0, 0, 0.04);
    --bg-hover: rgba(0, 0, 0, 0.05);

    --text-1: #1c2333;
    --text-2: #4a5568;
    --text-3: #a0aec0;

    --border: rgba(0, 0, 0, 0.09);
    --border-focus: rgba(58, 123, 213, 0.5);

    --bg-surface: #ffffff;

    --glass-blur: blur(28px);
    --glass-shadow: 0 12px 50px rgba(0, 0, 0, 0.55);

    /* Sidebar Blur Fix: Ensure no global blur is leaking */
    --global-blur: 0px;

    /* Spacing Scale */
    --s-1: 4px;
    --s-2: 8px;
    --s-3: 12px;
    --s-4: 16px;
    --s-5: 24px;
    --s-6: 32px;
    --s-7: 48px;
    --s-8: 64px;

    /* Radius */
    --r-sm: 8px;
    --r-md: 14px;
    --r-lg: 20px;
    --r-xl: 28px;
    --r-full: 999px;

    /* Typography */
    --font-heading: 'Lexend', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-mono: 'Courier New', monospace;

    /* Highlight Color */
    --accent-color: #3b82f6;

    /* Component Sizes */
    --sidebar-w: 270px;
    --topbar-h: 72px;
}

/* ─────────────────────────────────────────────
   2. DARK THEME OVERRIDE
───────────────────────────────────────────── */
[data-theme="dark"] {
    --bg: #0d1117;
    --bg-card: rgba(22, 30, 46, 0.82);
    --bg-sidebar: rgba(13, 17, 23, 0.92);
    --bg-input: rgba(255, 255, 255, 0.04);
    --bg-hover: rgba(255, 255, 255, 0.06);

    --text-1: #e6edf3;
    --text-2: #8b949e;
    --text-3: #484f58;

    --border: rgba(255, 255, 255, 0.08);
    --border-focus: rgba(58, 123, 213, 0.6);

    --bg-surface: #1e1e2e;

    --glass-shadow: 0 16px 60px rgba(0, 0, 0, 0.65);
}

/* ─────────────────────────────────────────────
   3. RESET & BASE
───────────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg);
    color: var(--text-1);
    min-height: 100vh;
    overflow-x: hidden;
    background-image:
        radial-gradient(ellipse at 0% 0%, rgba(58, 123, 213, 0.18) 0%, transparent 60%),
        radial-gradient(ellipse at 100% 100%, rgba(106, 17, 203, 0.14) 0%, transparent 60%);
    transition: background-color 0.35s ease, color 0.35s ease;
}


/* ─────────────────────────────────────────────
   3.1 AURORA BACKGROUND (LOGIN)
   ───────────────────────────────────────────── */
.aurora-container {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    background: #ffffff; /* White base as requested */
}

[data-theme="dark"] .aurora-container {
    background: #0a0c10;
}

.aurora-blob {
    position: absolute;
    width: 50vw;
    height: 50vw;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.18; /* Subtle details */
    animation: aurora-move 20s infinite alternate ease-in-out;
}

/* Specific Blobs matching the reference details */
.blob-1 {
    top: -20%;
    left: -10%;
    background: radial-gradient(circle, #3a7bd5, transparent 70%); /* Soft Blue */
}

.blob-2 {
    top: -15%;
    right: -10%;
    background: radial-gradient(circle, #ff00ff, transparent 70%); /* Soft Pink */
    animation-delay: -5s;
}

.blob-3 {
    bottom: -20%;
    right: -5%;
    background: radial-gradient(circle, #ffcc00, transparent 70%); /* Soft Gold */
    animation-delay: -10s;
}

@keyframes aurora-move {
    0% { transform: translate(0, 0) rotate(0deg); }
    100% { transform: translate(10vw, 5vw) rotate(5deg); }
}

.login-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: var(--s-5) var(--s-6);
    display: flex;
    justify-content: flex-end;
    align-items: center;
    font-size: 13px;
    font-weight: 500;
    font-family: var(--font-body);
    color: var(--text-2);
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8), 0 0 10px rgba(255, 255, 255, 0.5);
    pointer-events: none;
    z-index: 10;
}

[data-theme="dark"] .login-footer {
    color: var(--text-1);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8), 0 0 10px rgba(0, 0, 0, 0.5);
}

#client-ip {
    font-weight: 700;
    margin-left: 2px;
}

.login-footer .status-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-right: 15px;
}

.login-footer .dot {
    width: 6px;
    height: 6px;
    background: #00b09b;
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(0, 176, 155, 0.5);
}

[data-theme="dark"] .aurora-blob {
    mix-blend-mode: screen;
    opacity: 0.25;
}

.blob-1 {
    top: -10%;
    left: -10%;
    background: radial-gradient(circle, #00d2ff, transparent);
    animation-delay: 0s;
}

.blob-2 {
    bottom: -10%;
    right: -10%;
    background: radial-gradient(circle, #3a7bd5, transparent);
    animation-delay: -5s;
}

.blob-3 {
    top: 20%;
    right: 10%;
    background: radial-gradient(circle, #f7971e, transparent);
    width: 50vw;
    height: 50vw;
    opacity: 0.35;
    animation-delay: -10s;
}

@keyframes aurora-float {
    0% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(5%, 10%) scale(1.1); }
    66% { transform: translate(-5%, 5%) scale(0.95); }
    100% { transform: translate(0, 0) scale(1); }
}

/* ─────────────────────────────────────────────
   4. LAYOUT STRUCTURE
───────────────────────────────────────────── */
#app {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    grid-template-rows: 1fr;
    height: 100vh;
    height: 100dvh;
    width: 100vw;
    overflow: hidden;
    position: relative;
}

/* ─────────────────────────────────────────────
   5. SIDEBAR
───────────────────────────────────────────── */
.sidebar {
    grid-column: 1;
    grid-row: 1;
    background: var(--bg-sidebar);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: var(--s-5);
    gap: var(--s-4);
    z-index: 100;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.4s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
}

.sidebar::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.sidebar-close {
    display: none;
    position: absolute;
    top: var(--s-4);
    right: var(--s-4);
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    background: var(--bg-hover);
    border-radius: var(--r-md);
    color: var(--text-2);
    cursor: pointer;
    border: 1px solid var(--border);
}

.sidebar-close:hover {
    color: var(--text-1);
    background: var(--bg-input);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: var(--s-3);
    padding: var(--s-3) 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--s-2);
}

/* Em desktop alinhamos a logo com o topbar do main */
@media (min-width: 769px) {
    .sidebar {
        padding-top: 0 !important;
    }
    .logo-container {
        min-height: var(--topbar-h);
        padding: 0;
    }
}

.logo {
    width: 36px;
    height: 36px;
    object-fit: contain;
    flex-shrink: 0;
}

.logo-3d {
    filter: contrast(1.15) brightness(1.05) drop-shadow(0 0 1px rgba(0,0,0,1)) drop-shadow(0 4px 12px rgba(0,0,0,0.3)) !important;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), filter 0.4s ease !important;
    perspective: 1000px;
    z-index: 10;
    image-rendering: -webkit-optimize-contrast;
}

.logo-3d:hover {
    transform: rotateX(12deg) rotateY(-12deg) scale(1.12) !important;
    filter: contrast(1.25) brightness(1.1) drop-shadow(0 0 2px rgba(0,0,0,1)) drop-shadow(0 15px 35px rgba(0,0,0,0.5)) !important;
}

/* Animação de Flutuação */
@keyframes logoFloat {
    0% { transform: translateY(0) rotateX(5deg); }
    50% { transform: translateY(-10px) rotateX(-5deg); }
    100% { transform: translateY(0) rotateX(5deg); }
}

.logo-float {
    animation: logoFloat 4s ease-in-out infinite !important;
}

/* Animação de Entrada (Reveal) */
@keyframes logoReveal {
    0% { transform: scale(0) rotate(-45deg); opacity: 0; }
    70% { transform: scale(1.1) rotate(5deg); opacity: 1; }
    100% { transform: scale(1) rotate(0); opacity: 1; }
}

.logo-reveal {
    animation: logoReveal 1s cubic-bezier(0.34, 1.56, 0.64, 1) forwards !important;
    display: inline-block;
}

.brand-name {
    font-family: var(--font-heading);
    font-size: 22px;
    font-weight: 800;
    background: var(--g-primary);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    white-space: nowrap;
}

/* === Logo refresh — APENAS light mode (dark mantém estado original) === */
.logo-wrap {
    position: relative;
    width: 36px; height: 36px;
    flex-shrink: 0;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.logo-wrap > .logo { display: block; }

/* Light mode: filter F (escurecer/saturar) + pulse + shine */
html:not([data-theme="dark"]) .logo-wrap {
    overflow: hidden;
}
html:not([data-theme="dark"]) .logo-3d {
    filter:
        brightness(0.65) contrast(1.5) saturate(1.8)
        drop-shadow(0 4px 12px rgba(58,123,213,0.18)) !important;
    animation: logoPulseLight 3s ease-in-out infinite !important;
    transition: filter 0.3s ease !important;
}
html:not([data-theme="dark"]) .logo-3d:hover {
    transform: scale(1.06) !important;
    filter:
        brightness(0.7) contrast(1.55) saturate(1.9)
        drop-shadow(0 6px 18px rgba(58,123,213,0.32)) !important;
}
html:not([data-theme="dark"]) .logo-wrap::after {
    content: '';
    position: absolute;
    top: 0; left: -120%;
    width: 60%; height: 100%;
    background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,0.7) 50%, transparent 70%);
    transform: skewX(-25deg);
    animation: logoShineLight 4s ease-in-out infinite;
    pointer-events: none;
    z-index: 2;
}
@keyframes logoPulseLight {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.03); }
}
@keyframes logoShineLight {
    0% { left: -120%; }
    50% { left: 120%; }
    100% { left: 120%; }
}

/* Wordmark light mode: HEMN preto + SYSTEM gradient azul */
html:not([data-theme="dark"]) .brand-name {
    background: none !important;
    -webkit-text-fill-color: initial !important;
    color: var(--text-1);
    letter-spacing: 0.5px;
}
html:not([data-theme="dark"]) .brand-name .hemn-part {
    color: #0f1729;
}
html:not([data-theme="dark"]) .brand-name .system-part {
    background: linear-gradient(135deg, #00d2ff 0%, #3a7bd5 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}
html:not([data-theme="dark"]) .brand-name #display-version {
    display: none !important;
}

/* Dark mode: força gradient inteiro nos spans (mantém visual original) */
[data-theme="dark"] .brand-name .hemn-part,
[data-theme="dark"] .brand-name .system-part {
    background: var(--g-primary);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}
[data-theme="dark"] .logo-wrap {
    overflow: visible;
}

/* ============================================================
   SIDEBAR COLLAPSE / EXPAND (desktop only — mobile mantém drawer)
============================================================ */
@media (min-width: 769px) {
    :root {
        --ease-sidebar: cubic-bezier(0.16, 1, 0.3, 1);
        --dur-sidebar: 480ms;
        --sidebar-w-collapsed: 68px;
    }

    /* App grid já tem grid-template-columns: var(--sidebar-w) 1fr */
    #app {
        transition: grid-template-columns var(--dur-sidebar) var(--ease-sidebar);
    }
    body.sidebar-collapsed #app {
        grid-template-columns: var(--sidebar-w-collapsed) 1fr !important;
    }

    .sidebar {
        transition: padding var(--dur-sidebar) var(--ease-sidebar);
        contain: layout style;
    }
    body.sidebar-collapsed .sidebar {
        padding: var(--s-5) var(--s-2);
    }

    /* Pausar animações da logo durante a transição */
    body.is-sidebar-transitioning .logo-wrap img,
    body.is-sidebar-transitioning .logo-wrap::after {
        animation-play-state: paused !important;
    }

    /* Logo container — centraliza quando collapse */
    .logo-container {
        transition: padding var(--dur-sidebar) var(--ease-sidebar),
                    justify-content var(--dur-sidebar) var(--ease-sidebar);
    }
    body.sidebar-collapsed .logo-container {
        padding: var(--s-3) 0;
        justify-content: center;
    }

    /* Brand name — fade out + max-width 0 */
    .brand-name {
        overflow: hidden;
        max-width: 220px;
        opacity: 1;
        transition: opacity var(--dur-sidebar) var(--ease-sidebar),
                    max-width var(--dur-sidebar) var(--ease-sidebar);
        will-change: opacity, max-width;
    }
    body.sidebar-collapsed .brand-name {
        opacity: 0;
        max-width: 0;
        pointer-events: none;
    }

    /* (regra do botão movida pra escopo global — fora do media query) */

    /* Nav eyebrows (.nav-label = PLATAFORMA, INTELIGÊNCIA, ADMINISTRAÇÃO etc — descendente pra pegar dentro de #admin-menu também) */
    .nav-menu .nav-label {
        overflow: hidden;
        max-height: 40px;
        opacity: 1;
        transition: max-height var(--dur-sidebar) var(--ease-sidebar),
                    opacity var(--dur-sidebar) var(--ease-sidebar),
                    margin var(--dur-sidebar) var(--ease-sidebar),
                    padding var(--dur-sidebar) var(--ease-sidebar);
        will-change: max-height, opacity;
    }
    body.sidebar-collapsed .nav-menu .nav-label {
        opacity: 0;
        max-height: 0;
        margin-top: 0 !important;
        margin-bottom: 0 !important;
        padding-top: 0 !important;
        padding-bottom: 0 !important;
    }

    /* Nav items (nav-link) — labels colapsam */
    .nav-link {
        transition: padding var(--dur-sidebar) var(--ease-sidebar),
                    justify-content var(--dur-sidebar) var(--ease-sidebar),
                    background-color 0.15s ease,
                    color 0.15s ease;
        position: relative;
    }
    body.sidebar-collapsed .nav-link {
        justify-content: center;
        padding-left: 10px;
        padding-right: 10px;
    }

    /* Span de texto dentro do nav-link (Início, Busca Unitária, etc) */
    .nav-link > span {
        overflow: hidden;
        white-space: nowrap;
        max-width: 200px;
        opacity: 1;
        transition: opacity var(--dur-sidebar) var(--ease-sidebar),
                    max-width var(--dur-sidebar) var(--ease-sidebar);
        will-change: opacity, max-width;
    }
    body.sidebar-collapsed .nav-link > span {
        opacity: 0;
        max-width: 0;
    }

    /* Tooltip nos itens quando colapsada */
    body.sidebar-collapsed .nav-link[data-tooltip]::after {
        content: attr(data-tooltip);
        position: absolute;
        left: calc(100% + 14px);
        top: 50%;
        transform: translateY(-50%);
        background: #1c2333;
        color: white;
        padding: 7px 12px;
        border-radius: 8px;
        font-size: 12.5px;
        font-weight: 600;
        white-space: nowrap;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.15s ease;
        z-index: 200;
        box-shadow: 0 4px 12px rgba(0,0,0,0.18);
    }
    body.sidebar-collapsed .nav-link[data-tooltip]::before {
        content: '';
        position: absolute;
        left: calc(100% + 8px);
        top: 50%;
        transform: translateY(-50%);
        width: 0; height: 0;
        border-top: 5px solid transparent;
        border-bottom: 5px solid transparent;
        border-right: 6px solid #1c2333;
        opacity: 0;
        transition: opacity 0.15s ease;
        z-index: 201;
    }
    body.sidebar-collapsed .nav-link[data-tooltip]:hover::after,
    body.sidebar-collapsed .nav-link[data-tooltip]:hover::before {
        opacity: 1;
    }

    /* System status badge (rodapé sidebar) */
    .system-status-badge {
        transition: padding var(--dur-sidebar) var(--ease-sidebar),
                    background-color var(--dur-sidebar) var(--ease-sidebar),
                    border-color var(--dur-sidebar) var(--ease-sidebar);
    }
    body.sidebar-collapsed .system-status-badge {
        padding: var(--s-2) 0;
        background: transparent;
        border-color: transparent;
        text-align: center;
    }
    body.sidebar-collapsed .system-status-badge > div:not(:first-child),
    body.sidebar-collapsed .system-status-badge .status-text-wrap,
    body.sidebar-collapsed .system-status-badge .status-badge-label,
    body.sidebar-collapsed .system-status-badge .status-badge-ip {
        display: none !important;
    }
}

/* Botão sidebar-collapse-btn — escopo global pra garantir renderização */
.sidebar-collapse-btn {
    position: fixed;
    top: 18px;
    left: calc(var(--sidebar-w) + 18px);
    width: 38px; height: 38px;
    border-radius: 10px;
    background: white;
    border: 1px solid rgba(15, 23, 41, 0.12);
    box-shadow: 0 2px 8px rgba(15, 23, 41, 0.08);
    display: flex !important;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-2);
    transition: background-color 0.15s ease,
                color 0.15s ease,
                border-color 0.15s ease,
                box-shadow 0.15s ease,
                left var(--dur-sidebar, 480ms) var(--ease-sidebar, cubic-bezier(0.16, 1, 0.3, 1));
    z-index: 9999;
    margin: 0;
    padding: 0;
    font-family: inherit;
}
.sidebar-collapse-btn:hover {
    color: var(--accent-color);
    border-color: rgba(58, 123, 213, 0.4);
    background: rgba(58, 123, 213, 0.04);
    box-shadow: 0 4px 12px rgba(58, 123, 213, 0.15);
}
.sidebar-collapse-btn svg { width: 16px; height: 16px; }
body.sidebar-collapsed .sidebar-collapse-btn {
    left: calc(var(--sidebar-w-collapsed, 68px) + 18px);
}
[data-theme="dark"] .sidebar-collapse-btn {
    background: var(--bg-card);
    border-color: var(--border);
    color: var(--text-2);
}

/* Em mobile esconder o botão collapse */
@media (max-width: 768px) {
    .sidebar-collapse-btn { display: none !important; }
}

/* Em desktop: dar espaço no header do main pra não sobrepor o botão de collapse */
@media (min-width: 769px) {
    .greeting-container {
        padding-left: 60px;
    }
}

.nav-menu {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--s-1);
}

.nav-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-3);
    font-weight: 600;
    padding: var(--s-3) var(--s-3) var(--s-2);
    margin-top: var(--s-3);
}

.nav-link {
    display: flex;
    align-items: center;
    gap: var(--s-3);
    padding: 11px var(--s-4);
    border-radius: var(--r-md);
    text-decoration: none;
    color: var(--text-2);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    position: relative;
    border-left: 3px solid transparent;
}

.nav-link .icon {
    font-size: 18px;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
}

.nav-link:hover {
    background: var(--bg-hover);
    color: var(--text-1);
}

.nav-link.active {
    background: linear-gradient(135deg, rgba(0, 210, 255, 0.1), rgba(58, 123, 213, 0.08));
    color: var(--text-1);
    border-left-color: #3a7bd5;
    font-weight: 600;
}

.nav-link.active .icon {
    opacity: 1;
}

/* ---------------------------------------------
   5. PROFESSIONAL HORIZONTAL PROFILE
   --------------------------------------------- */
.user-profile-premium {
    margin: var(--s-2) 2px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--r-md);
    display: flex;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: relative;
    min-height: 56px;
}

.profile-main {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: var(--g-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(58, 123, 213, 0.3);
}

.user-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.user-meta .name {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-1);
    line-height: 1.2;
    white-space: nowrap;
}

.role-balance {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-3);
    margin-top: 2px;
}

.role-balance .sep {
    font-size: 8px;
    opacity: 0.5;
}

#credits-display {
    color: #10b981;
}

/* Balance Menu Styles */
.balance-menu-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    margin-right: var(--s-4);
}

.balance-menu-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    background: rgba(58, 123, 213, 0.06);
    border: 1px solid rgba(58, 123, 213, 0.18);
    border-radius: 999px;
    color: var(--accent-color, #3a7bd5);
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    height: 40px;
}

.balance-menu-trigger:hover {
    background: rgba(58, 123, 213, 0.1);
    border-color: rgba(58, 123, 213, 0.3);
}

.balance-menu-trigger i {
    color: var(--accent-color);
    font-size: 13px;
}

.balance-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 240px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-2xl);
    padding: var(--s-4);
    display: none;
    flex-direction: column;
    gap: var(--s-4);
    z-index: 1000;
    animation: slideIn 0.2s ease-out;
}

.balance-menu-wrapper.open .balance-dropdown {
    display: flex;
}

.balance-dropdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.balance-dropdown-item .label {
    color: var(--text-3);
    font-size: 14px;
}

.balance-dropdown-item .value {
    color: var(--text-1);
    font-weight: 700;
    font-size: 16px;
}

.balance-dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: var(--s-1) 0;
}

.btn-recharge-dropdown {
    background: var(--accent-color);
    color: white !important;
    border: none;
    border-radius: var(--radius-lg);
    padding: var(--s-3);
    font-weight: 700;
    cursor: pointer;
    transition: filter 0.2s;
    display: block !important;
    width: 100%;
    margin-top: var(--s-2);
}

.btn-recharge-dropdown:hover {
    filter: brightness(1.1);
}

.profile-btns {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-left: auto;
    flex-shrink: 0;
}

.profile-btns button {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 12px;
}

.profile-btns button:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
    color: var(--text-1);
}

.profile-btns button.logout:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
    color: #ef4444;
}

/* ─────────────────────────────────────────────
   6. CONTENT AREA
───────────────────────────────────────────── */
.content-area {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ─────────────────────────────────────────────
   7. TOP BAR
───────────────────────────────────────────── */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--topbar-h);
    padding: 0 var(--s-6);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    gap: var(--s-4);
}

.mobile-brand,
.mobile-greeting {
    display: none;
}

.search-bar {
    display: flex;
    align-items: center;
    gap: var(--s-3);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--r-full);
    padding: 9px var(--s-5);
    flex: 1;
    max-width: 420px;
    transition: border-color 0.2s;
}

.search-bar:focus-within {
    border-color: var(--border-focus);
}

.search-icon {
    color: var(--text-3);
    font-size: 15px;
}

.search-bar input {
    background: none;
    border: none;
    outline: none;
    color: var(--text-1);
    font-size: 14px;
    width: 100%;
    padding: 0;
}

.search-bar input::placeholder {
    color: var(--text-3);
}

.header-tools {
    display: flex;
    align-items: center;
    gap: var(--s-2);
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--r-md);
    border: 1px solid var(--border);
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    color: var(--text-2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    transition: all 0.2s ease;
}

.icon-btn:hover {
    border-color: var(--border-focus);
    color: var(--text-1);
    transform: translateY(-1px);
}

.icon-btn:active {
    transform: scale(0.96);
}

/* ─────────────────────────────────────────────
   8. PAGE CONTAINER
───────────────────────────────────────────── */
.page-container {
    flex: 1;
    overflow-y: auto;
    padding: var(--s-6);
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* ─────────────────────────────────────────────
   9. CARDS & GLASS
───────────────────────────────────────────── */
.glass-effect,
.glass-card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border);
    box-shadow: var(--glass-shadow);
    border-radius: var(--r-lg);
    padding: var(--s-5);
    transition: border-color 0.25s ease, transform 0.25s ease, background-color 0.35s ease;
}

.glass-card:hover {
    border-color: rgba(58, 123, 213, 0.35);
    transform: translateY(-4px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.gtask-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
}

/* ─────────────────────────────────────────────
   10. BUTTONS
───────────────────────────────────────────── */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: var(--s-2);
    background: var(--g-primary);
    color: #fff;
    border: none;
    border-radius: var(--r-full);
    padding: 10px 22px;
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font-body);
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(58, 123, 213, 0.3);
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-primary:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: scale(0.97);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: var(--s-2);
    background: var(--bg-input);
    color: var(--text-1);
    border: 1px solid var(--border);
    border-radius: var(--r-full);
    padding: 10px 22px;
    font-size: 13px;
    font-weight: 500;
    font-family: var(--font-body);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--border-focus);
}

.btn-danger {
    display: inline-flex;
    align-items: center;
    gap: var(--s-2);
    background: rgba(239, 68, 68, 0.12);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: var(--r-full);
    padding: 10px 22px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
}

/* ─────────────────────────────────────────────
   11. FORMS
───────────────────────────────────────────── */
.password-field-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-toggle-btn {
    position: absolute;
    right: 14px;
    background: none;
    border: none;
    color: var(--text-3);
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
    padding: 4px;
    z-index: 5;
}

.password-toggle-btn:hover {
    color: var(--accent);
}

.password-toggle-btn:active {
    opacity: 0.7;
}

input[type="password"],
input[type="text"],
input[type="number"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 10px 14px;
    padding-right: 42px; /* Espaço para o ícone */
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    color: var(--text-1);
    font-family: var(--font-body);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(58, 123, 213, 0.12);
}

select option {
    background-color: var(--bg-card);
    color: var(--text-1);
}

input::placeholder {
    color: var(--text-3);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--s-2);
}

.form-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--s-4);
}

.manual-search-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--s-4);
    margin-top: var(--s-5);
}

@media (max-width: 600px) {
    .manual-search-actions {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

.mobile-text {
    display: none !important;
}

.hemn-toggle-container {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 12px;
    background: var(--bg-hover);
    border-radius: 20px;
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}

@media (max-width: 600px) {
    .desktop-text { display: none !important; }
    .mobile-text { display: inline !important; }
    .hemn-toggle-container {
        gap: 6px !important;
        padding: 4px 8px !important;
    }
}

/* ─────────────────────────────────────────────
   12. TABLES
───────────────────────────────────────────── */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--r-md);
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
    min-width: 600px;
    table-layout: auto;
}

.data-table thead th {
    background: var(--bg-card) !important;
    color: var(--text-2) !important; /* Slightly darker than text-3 for headers */
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 14px 20px;
    text-align: left;
    border-bottom: 2px solid var(--border) !important;
    position: sticky !important;
    top: -1px !important;
    z-index: 1000 !important;
    background-clip: padding-box;
}

.data-table tbody tr {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.data-table tbody tr:hover {
    background: var(--bg-hover) !important;
    transform: scale(1.002);
    box-shadow: inset 4px 0 0 var(--accent);
}

.data-table tbody td {
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    color: var(--text-1);
    vertical-align: middle;
    transition: color 0.2s ease;
}

.data-table tbody tr:hover td {
    color: var(--text-1); /* Use theme variable instead of hardcoded white */
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* ─────────────────────────────────────────────
   13. BADGES & STATUS
───────────────────────────────────────────── */
.badge {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px;
    padding: 2px 8px !important;
    border-radius: 4px !important;
    font-size: 10px !important;
    font-weight: 800 !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-width: 32px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05); /* Softer shadow */
    border: 1px solid transparent;
}

.badge-green {
    background: rgba(16, 185, 129, 0.12);
    color: #059669;
    border-color: rgba(16, 185, 129, 0.3);
}

.badge-yellow {
    background: rgba(217, 119, 6, 0.12); /* Saturated orange for legibility */
    color: #d97706;
    border-color: rgba(245, 158, 11, 0.3);
}

.badge-red {
    background: rgba(220, 38, 38, 0.12);
    color: #dc2626;
    border-color: rgba(239, 68, 68, 0.3);
}

.badge-blue {
    background: rgba(37, 99, 235, 0.12);
    color: #2563eb;
    border-color: rgba(59, 130, 246, 0.4);
}

.badge-purple {
    background: rgba(124, 58, 237, 0.12);
    color: #7c3aed;
    border-color: rgba(139, 92, 246, 0.4);
}

.badge-warm {
    background: rgba(234, 88, 12, 0.12);
    color: #ea580c;
    border-color: rgba(247, 151, 30, 0.4);
}

/* Legacy - keep compatibility */
.badge.green {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge.yellow {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge.red {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge.blue {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

/* ─────────────────────────────────────────────
   14. MODALS
───────────────────────────────────────────── */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: var(--s-4);
    overflow-y: auto;
}

.modal.open,
.modal[style*="flex"] {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    padding: var(--s-6);
    width: 100%;
    max-width: 680px;
    max-height: 90vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
    animation: modalIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.94) translateY(10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--s-5);
    padding-bottom: var(--s-4);
    border-bottom: 1px solid var(--border);
}

.modal-header h2,
.modal-header h3 {
    font-family: var(--font-heading);
    font-size: 20px;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-3);
    font-size: 22px;
    cursor: pointer;
    padding: var(--s-2);
    border-radius: var(--r-sm);
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--text-1);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--s-3);
    margin-top: var(--s-5);
    padding-top: var(--s-4);
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

/* ─────────────────────────────────────────────
   15. PAGE HEADERS
───────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--s-4);
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 32px;
}

.page-title {
    font-family: var(--font-heading);
    font-size: clamp(24px, 3.4vw, 32px);
    font-weight: 800;
    letter-spacing: -0.6px;
    line-height: 1.1;
    color: var(--text-1);
    margin: 0;
}

.page-subtitle {
    font-size: 15px;
    font-weight: 400;
    line-height: 1.55;
    color: var(--text-2);
    max-width: 580px;
    margin: 6px 0 0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--s-3);
    flex-wrap: wrap;
}

/* ─────────────────────────────────────────────
   16. DASHBOARD
───────────────────────────────────────────── */
.welcome-header {
    margin-bottom: var(--s-6);
}

.welcome-header h1 {
    font-family: var(--font-heading);
    font-size: clamp(28px, 5vw, 42px);
    line-height: 1.1;
}

.welcome-header p {
    color: var(--text-2);
    margin-top: var(--s-2);
    font-size: 15px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--s-4);
    margin-bottom: var(--s-6);
}

.stat-card {
    display: flex;
    flex-direction: column;
    gap: var(--s-2);
}

.stat-label {
    font-size: 12px;
    color: var(--text-2);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-family: var(--font-heading);
    font-size: 34px;
    font-weight: 800;
    line-height: 1;
}

.stat-trend {
    font-size: 12px;
}

.stat-trend.up {
    color: #10b981;
}

.stat-trend.down {
    color: #ef4444;
}

/* ─────────────────────────────────────────────
   17. DRAG & DROP ZONES
───────────────────────────────────────────── */
.drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--r-lg);
    padding: var(--s-6);
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--bg-input);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--s-3);
    position: relative;
    overflow: hidden;
}

.drop-zone:hover {
    border-color: var(--border-focus);
    background: var(--bg-hover);
}

.drop-zone.drag-over {
    border-color: #3a7bd5;
    background: rgba(58, 123, 213, 0.12);
    transform: scale(1.02);
    box-shadow: 0 0 30px rgba(58, 123, 213, 0.2);
}

.drop-zone i {
    font-size: 32px;
    background: var(--g-primary);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    transition: transform 0.3s ease;
}

.drop-zone.drag-over i {
    transform: translateY(-5px) scale(1.1);
}

.drop-zone p {
    font-size: 14px;
    color: var(--text-2);
    font-weight: 500;
}

.positive {
    color: #10b981;
}

.negative {
    color: #ef4444;
}

.main-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--s-5);
}

.chart-placeholder {
    height: 260px;
    border-radius: var(--r-md);
    overflow: hidden;
    background: linear-gradient(to top, rgba(58, 123, 213, 0.08), transparent);
    margin-top: var(--s-4);
}

.bar-chart-container {
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    height: 100%;
    padding: var(--s-4);
    gap: var(--s-3);
}

.bar {
    flex: 1;
    max-width: 40px;
    background: var(--g-primary);
    border-radius: var(--r-sm) var(--r-sm) 0 0;
    position: relative;
    transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    animation: growUp 1s ease-out;
}

@keyframes growUp {
    from {
        transform: scaleY(0);
        transform-origin: bottom;
    }

    to {
        transform: scaleY(1);
    }
}

.bar:hover {
    filter: brightness(1.2);
}

.bar-label {
    position: absolute;
    bottom: -22px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    color: var(--text-3);
    white-space: nowrap;
}

.alert-list {
    list-style: none;
    display: flex;
    flex-direction: column;
}

.alert-item {
    display: flex;
    align-items: flex-start;
    gap: var(--s-3);
    padding: var(--s-3) 0;
    border-bottom: 1px solid var(--border);
}

.alert-item:last-child {
    border-bottom: none;
}

.bullet {
    width: 8px;
    height: 8px;
    border-radius: var(--r-full);
    flex-shrink: 0;
    margin-top: 4px;
}

.warning .bullet {
    background: #f59e0b;
}

.info .bullet {
    background: #3b82f6;
}

.danger .bullet {
    background: #ef4444;
}

/* ─────────────────────────────────────────────
   17. EMPLOYEE MANAGEMENT
───────────────────────────────────────────── */
.emp-info-cell {
    display: flex;
    align-items: center;
    gap: var(--s-3);
}

.emp-thumbnail {
    width: 38px;
    height: 38px;
    border-radius: var(--r-full);
    object-fit: cover;
    border: 2px solid var(--border);
    flex-shrink: 0;
}

.emp-name {
    font-weight: 600;
    font-size: 14px;
}

.emp-sub {
    font-size: 12px;
    color: var(--text-2);
}

/* ─────────────────────────────────────────────
   18. NOTIFICATIONS / TOAST
───────────────────────────────────────────── */
.notification-container {
    position: fixed;
    top: var(--s-5);
    right: var(--s-5);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: var(--s-3);
    pointer-events: none;
}

/* HEMN Hero Toast — premium notification card */
.toast {
    position: relative;
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border);
    border-radius: 18px;
    min-width: 320px;
    max-width: 420px;
    min-height: 80px;
    padding: 0;
    display: flex;
    align-items: stretch;
    overflow: hidden;
    box-shadow: 0 20px 48px rgba(15,23,41,0.14), 0 4px 12px rgba(15,23,41,0.06);
    pointer-events: all;
    animation: toastIn 0.55s cubic-bezier(0.16, 1, 0.3, 1) both;
}
[data-theme="dark"] .toast {
    box-shadow: 0 20px 48px rgba(0,0,0,0.5), 0 4px 12px rgba(0,0,0,0.3);
}
.toast .toast-icon {
    width: 80px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 26px;
    background: var(--g-primary);
}
.toast.info    .toast-icon { background: var(--g-primary); }
.toast.success .toast-icon { background: var(--g-success); }
.toast.error   .toast-icon { background: var(--g-danger);  }
.toast.warning .toast-icon { background: var(--g-warm);    }
.toast .toast-content {
    flex: 1;
    padding: 14px 18px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.toast .toast-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 14px;
    color: var(--text-1);
    margin: 0 0 3px;
    line-height: 1.3;
}
.toast .toast-msg {
    font-size: 12.5px;
    color: var(--text-2);
    margin: 0 0 4px;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.toast .toast-meta {
    font-size: 10.5px;
    color: var(--text-3);
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    margin-top: 2px;
}
.toast .toast-meta i { font-size: 9px; }
.toast .toast-close {
    position: absolute;
    top: 8px;
    right: 10px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-3);
    font-size: 12px;
    padding: 0;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}
.toast .toast-close:hover {
    background: var(--bg-hover);
    color: var(--text-1);
}
@keyframes toastIn {
    from { opacity: 0; transform: translateX(28px) scale(0.96); }
    to   { opacity: 1; transform: translateX(0) scale(1); }
}

/* ─────────────────────────────────────────────
   19. HOLERITE / PAYSLIP
───────────────────────────────────────────── */
.payslip-modal-content {
    max-width: 820px;
}

.holerite-container {
    background: #fff;
    color: #111;
    padding: 32px;
    border-radius: var(--r-sm);
    font-family: var(--font-mono);
    border: 2px solid #222;
    margin-top: var(--s-5);
}

.holerite-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 2px solid #222;
    padding-bottom: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: var(--s-3);
}

.holerite-employee-info {
    border: 1px solid #aaa;
    padding: 10px;
    margin-bottom: 14px;
    border-radius: 2px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
    font-size: 12px;
    flex-wrap: wrap;
    gap: var(--s-2);
}

.holerite-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #aaa;
}

.holerite-table th,
.holerite-table td {
    border: 1px solid #aaa;
    padding: 7px 10px;
    text-align: left;
    font-size: 12px;
}

.holerite-table tfoot td {
    font-weight: 700;
    background: #f5f5f5;
}

.holerite-footer {
    margin-top: 20px;
}

.net-salary-box {
    border: 2px solid #222;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 800;
    font-size: 18px;
    background: #f9f9f9;
    flex-wrap: wrap;
    gap: var(--s-2);
}

.net-value {
    color: #16a34a;
    font-family: var(--font-heading);
}

.signatures {
    display: flex;
    justify-content: space-between;
    margin-top: 50px;
    flex-wrap: wrap;
    gap: var(--s-5);
}

.signature-line {
    border-top: 1px solid #555;
    flex: 1;
    min-width: 180px;
    text-align: center;
    padding-top: 6px;
    font-size: 11px;
}

/* ─────────────────────────────────────────────
   20. EMPTY STATE
───────────────────────────────────────────── */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--s-3);
    padding: var(--s-7) var(--s-5);
    color: var(--text-3);
    text-align: center;
}

.empty-state .icon {
    font-size: 52px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-2);
}

.empty-state small {
    font-size: 13px;
}

/* ─────────────────────────────────────────────
   21. ANIMATIONS
───────────────────────────────────────────── */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.fade-in {
    animation: fadeIn 0.4s ease-out forwards;
}

.fade-in-up {
    animation: fadeInUp 0.4s ease-out forwards;
}

.slide-in-left {
    animation: slideInLeft 0.4s ease-out forwards;
}

/* ─────────────────────────────────────────────
   22. GRADIENT TEXT
───────────────────────────────────────────── */
.gradient-text {
    background: var(--g-primary);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
}

/* ─────────────────────────────────────────────
   23. MOBILE DRAWER
───────────────────────────────────────────── */
.drawer-toggle {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 1100;
    width: 42px;
    height: 42px;
    border-radius: var(--r-md);
    font-size: 20px;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

.close-sidebar-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-2);
    cursor: pointer;
    font-size: 20px;
    padding: var(--s-2);
    border-radius: var(--r-sm);
    margin-left: auto;
    transition: color 0.2s;
}

.close-sidebar-btn:hover {
    color: var(--text-1);
}

/* ─────────────────────────────────────────────
   24. PRINT STYLES
───────────────────────────────────────────── */
@media print {
    body * {
        visibility: hidden;
    }

    .print-area,
    .print-area * {
        visibility: visible;
    }

    .print-area {
        position: absolute;
        left: 0;
        top: 0;
        width: 210mm;
        padding: 0;
        margin: 0;
    }

    .no-print,
    .payslip-header-tools {
        display: none !important;
    }

    .holerite-container {
        border: 1px solid #000 !important;
        box-shadow: none !important;
        margin: 0;
    }
}

/* ─────────────────────────────────────────────
   25. UTILITY GRID CLASSES (used by JS components)
───────────────────────────────────────────── */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--s-5);
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--s-5);
}

.grid-auto {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--s-4);
}

/* Top-bar always stays on one line with wrapping on content not the bar */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--topbar-h);
    padding: 0 var(--s-6);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    gap: var(--s-4);
    min-height: var(--topbar-h);
}

/* ─────────────────────────────────────────────
   26. RESPONSIVE BREAKPOINTS
───────────────────────────────────────────── */

/* ── Auto UI Scale (HD laptops) ──
   Aplica zoom progressivo entre 769px e 1440px pra que o app caiba inteiro
   em monitores HD (1366x768) e similares sem o usuário precisar dar Ctrl+-.
   Acima de 1440px e abaixo de 769px (mobile drawer), nada muda. */
@media (min-width: 1281px) and (max-width: 1440px) {
    body { zoom: 0.92; }
}
@media (min-width: 1101px) and (max-width: 1280px) {
    body { zoom: 0.85; }
}
@media (min-width: 769px) and (max-width: 1100px) {
    body { zoom: 0.80; }
}

/* ── Large Desktop ≤ 1280px ── */
@media (max-width: 1280px) {
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ── Tablet ≤ 1024px ── */
@media (max-width: 1024px) {
    :root {
        --sidebar-w: 230px;
    }

    .main-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Collapse 2-column utility grids */
    .grid-2,
    [style*="grid-template-columns: 1fr 1fr"],
    [style*="grid-template-columns:1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }

    .page-container {
        padding: var(--s-5);
    }
}

/* ── Mobile ≤ 768px ── */
@media (max-width: 768px) {
    :root {
        --sidebar-w: 285px;
        --topbar-h: 64px;
    }

    /* ·· App Layout ·· */
    #app {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr;
    }

    /* ·· Sidebar → Drawer ·· */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0 !important;
        height: 100dvh !important;
        width: var(--sidebar-w);
        transform: translateX(-110%);
        border-radius: 0 !important;
        box-shadow: 16px 0 56px rgba(0, 0, 0, 0.6);
        z-index: 5000 !important;
        margin: 0;
        border-right: 1px solid var(--border);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .drawer-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .close-sidebar-btn {
        display: flex;
    }

    /* ·· Content Area ·· */
    .content-area {
        grid-column: 1;
        width: 100%;
        min-width: 0;
    }

    /* ·· Top Bar ·· */
    .top-bar {
        padding: 0 var(--s-3) 0 68px;
        height: var(--topbar-h);
        gap: var(--s-2);
    }

    .search-bar {
        max-width: none;
        flex: 1;
        min-width: 0;
    }

    /* ·· Page Container ·· */
    .page-container {
        padding: var(--s-3);
    }

    /* ·· Stats & Grids ·· */
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .main-grid {
        grid-template-columns: 1fr;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .grid-2,
    .grid-3 {
        grid-template-columns: 1fr;
    }

    /* ·· Inline style grid overrides ·· */
    [style*="grid-template-columns: 1fr 1fr"],
    [style*="grid-template-columns:1fr 1fr"],
    [style*="grid-template-columns: 2fr 1fr"],
    [style*="grid-template-columns:2fr 1fr"] {
        grid-template-columns: 1fr !important;
    }

    /* ·· Card hover transforms off on touch ·· */
    .glass-card:hover {
        transform: none;
    }

    /* ·· Tables: horizontal scroll ·· */
    .glass-card {
        overflow-x: auto;
    }

    .data-table {
        min-width: 520px;
    }

    /* ·· Modals ·· */
    .modal {
        padding: var(--s-2);
        align-items: flex-end;
        /* sheet from bottom on mobile */
    }

    .modal-content {
        padding: var(--s-4);
        border-radius: var(--r-xl) var(--r-xl) var(--r-md) var(--r-md);
        max-height: 90vh;
        max-width: 100%;
        width: 100%;
    }

    .payslip-modal-content {
        max-width: 100%;
        border-radius: var(--r-xl) var(--r-xl) 0 0;
    }

    /* ·· Page Header ·· */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--s-3);
        margin-bottom: var(--s-4);
    }

    .header-actions {
        width: 100%;
        justify-content: flex-start;
    }

    /* ·· Payroll table actions ·· */
    .data-table td:last-child>div {
        flex-direction: column;
        gap: 4px;
    }

    /* ·· Attendance module two-panel layout ·· */
    #att-main-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: var(--s-4) !important;
    }

    /* ·· Status picker repositioning ·· */
    #status-picker {
        position: fixed !important;
        left: var(--s-3) !important;
        right: var(--s-3) !important;
        bottom: var(--s-5) !important;
        top: auto !important;
        width: auto !important;
    }

    /* ·· Payroll form grid ·· */
    #payroll-modal .form-grid {
        grid-template-columns: 1fr 1fr;
    }

    /* ·· Toast notifications ·· */
    .notification-container {
        top: auto;
        bottom: var(--s-4);
        right: var(--s-3);
        left: var(--s-3);
        align-items: stretch;
    }

    .toast {
        min-width: 0;
        max-width: none;
        width: 100%;
    }

    /* ·· Holerite ·· */
    .holerite-container {
        padding: 16px;
        overflow-x: auto;
    }

    .holerite-table {
        min-width: 480px;
    }
}

/* ── Small Mobile ≤ 480px ── */
@media (max-width: 480px) {
    :root {
        --topbar-h: 56px;
    }

    .top-bar {
        padding: 0 var(--s-2) 0 60px;
    }

    .drawer-toggle {
        top: 8px;
        left: 8px;
        width: 38px;
        height: 38px;
    }

    .page-title {
        font-size: 20px !important;
    }

    .stat-value {
        font-size: 26px;
    }

    .stat-label {
        font-size: 11px;
    }

    .btn-primary,
    .btn-secondary,
    .btn-danger {
        padding: 8px 14px;
        font-size: 12px;
    }

    /* Compact nav links */
    .nav-link {
        padding: 9px var(--s-3);
        font-size: 13px;
    }

    .modal-content {
        padding: var(--s-3);
    }

    .page-container {
        padding: var(--s-2);
    }

    /* Stack form actions */
    .modal-footer {
        flex-direction: column;
    }

    .modal-footer button {
        width: 100%;
        justify-content: center;
    }

    .glass-card {
        padding: var(--s-3);
    }

    /* Payroll form grid → single col on small screens */
    #payroll-modal .form-grid {
        grid-template-columns: 1fr;
    }

    .search-bar {
        padding: 7px var(--s-3);
    }

    .search-bar input {
        font-size: 13px;
    }

    /* Employee list compact */
    .emp-info-cell {
        gap: var(--s-2);
    }

    .emp-thumbnail {
        width: 32px;
        height: 32px;
    }
}

/* ---------------------------------------------
   17. DRAG & DROP ZONES
--------------------------------------------- */
.drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--r-lg);
    padding: var(--s-6);
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--bg-input);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--s-3);
    position: relative;
    overflow: hidden;
}

.drop-zone:hover {
    border-color: var(--border-focus);
    background: var(--bg-hover);
}

.drop-zone.drag-over {
    border-color: #3a7bd5;
    background: rgba(58, 123, 213, 0.12);
    transform: scale(1.02);
    box-shadow: 0 0 30px rgba(58, 123, 213, 0.2);
}

.drop-zone i {
    font-size: 32px;
    background: var(--g-primary);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    transition: transform 0.3s ease;
}

.drop-zone.drag-over i {
    transform: translateY(-5px) scale(1.1);
}

.drop-zone p {
    font-size: 14px;
    color: var(--text-2);
    font-weight: 500;
}

/* ---------------------------------------------
   18. GREETING & PERSONALIZATION
--------------------------------------------- */
.greeting-container {
    flex: 1;
}

.greeting-text {
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: 500;
    color: var(--text-1);
    letter-spacing: -0.2px;
}

/* ─────────────────────────────────────────────
   20. MOBILE RESPONSIVENESS (MEDIA QUERIES)
───────────────────────────────────────────── */
@media (max-width: 992px) {
    :root {
        --sidebar-w: 260px;
    }

    #app {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: var(--sidebar-w);
        transform: translateX(-100%);
        box-shadow: 20px 0 50px rgba(0, 0, 0, 0.4);
        padding: var(--s-4);
        z-index: 1600 !important;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .content-area {
        grid-column: 1;
    }

    .top-bar {
        padding: 0 var(--s-4);
    }

    .menu-toggle {
        display: flex !important;
    }

    .greeting-container {
        display: none;
    }

    .page-container {
        padding: var(--s-4);
    }

    .glass-card {
        padding: var(--s-4);
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .btn-primary {
        padding: 10px 16px;
        font-size: 12px;
    }

    .header-tools {
        gap: var(--s-2);
    }

    .user-profile {
        margin-top: var(--s-6);
        background: var(--bg-input);
        padding: var(--s-3);
        border-radius: var(--r-md);
    }
}

@media (max-width: 480px) {
    :root {
        --topbar-h: 64px;
    }

    .brand-name {
        font-size: 18px;
    }

    .btn-primary i {
        display: none;
    }

    .header-tools .btn-primary {
        padding: 8px 12px;
        font-size: 11px;
    }

    .page-title {
        font-size: 20px;
    }

    .stat-value {
        font-size: 28px;
    }

    .data-table {
        font-size: 12px;
    }
}

/* Helper classes for mobile */
/* Consolidated Menu Toggle and Overlay logic moved to media queries */

/* Live Indicator Animation */
@keyframes pulse-live {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.2);
        opacity: 0.7;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--status-green);
    box-shadow: 0 0 10px var(--status-green);
}

.live-indicator {
    animation: pulse-live 2s infinite;
}

.badge-monitor {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    background: rgba(16, 185, 129, 0.1);
    color: var(--status-green);
}

/* ---------------------------------------------
   19. IN�CIO / HOME LANDING PAGE
   --------------------------------------------- */
.welcome-hero {
    background-color: #f7971e;
    background-image:
        radial-gradient(at 0% 0%, rgba(255, 255, 255, 0.3) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(255, 200, 80, 0.2) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(255, 100, 30, 0.25) 0px, transparent 50%),
        radial-gradient(at 0% 100%, rgba(255, 200, 80, 0.2) 0px, transparent 50%),
        linear-gradient(135deg, #f7971e 0%, #ea580c 100%);
    border-radius: var(--r-xl);
    padding: var(--s-8) var(--s-7);
    margin-bottom: var(--s-6);
    color: #fff;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 25px 60px rgba(234, 88, 12, 0.45);
}

.welcome-hero::before {
    content: """";
    position: absolute;
    top: -50%;
    left: -10%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.15) 0%, transparent 70%);
    filter: blur(40px);
    animation: pulseGlow 8s infinite alternate;
    pointer-events: none;
}

.welcome-hero::after {
    content: """";
    position: absolute;
    top: -50%;
    right: -10%;
    width: 300px;
    height: 300px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    filter: blur(60px);
    pointer-events: none;
}

@keyframes pulseGlow {
    0% { transform: scale(1); opacity: 0.5; }
    100% { transform: scale(1.2); opacity: 0.9; }
}

.welcome-hero h1 {
    font-family: var(--font-heading);
    font-size: clamp(32px, 6vw, 52px);
    font-weight: 800;
    margin-bottom: var(--s-3);
    letter-spacing: -1.5px;
    color: #ffffff;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    position: relative;
    z-index: 1;
}

.welcome-hero p {
    font-size: 18px;
    opacity: 1;
    color: rgba(255, 255, 255, 0.95);
    max-width: 750px;
    line-height: 1.7;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 1;
}

.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--s-5);
    margin-top: var(--s-6);
    animation: fadeIn 0.8s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.action-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: var(--s-6);
    display: flex;
    flex-direction: column;
    gap: var(--s-4);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    min-height: 200px;
    justify-content: center;
}

.action-card:hover {
    border-color: var(--border-focus);
    transform: translateY(-8px);
    background: var(--bg-hover);
    box-shadow: var(--glass-shadow);
}

.action-card .icon-box {
    width: 60px;
    height: 60px;
    border-radius: var(--r-md);
    background: var(--bg-input);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: #3a7bd5;
    transition: all 0.3s ease;
    margin-bottom: var(--s-2);
}

.action-card:hover .icon-box {
    background: var(--g-primary);
    color: #fff;
    transform: rotate(-5deg) scale(1.1);
}

.action-card h3 {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 700;
    color: var(--text-1);
}

.action-card p {
    font-size: 14px;
    color: var(--text-2);
    line-height: 1.5;
}

.action-card .arrow {
    position: absolute;
    bottom: var(--s-6);
    right: var(--s-6);
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.3s ease;
    color: #3a7bd5;
    font-size: 18px;
}

.action-card:hover .arrow {
    opacity: 1;
    transform: translateX(0);
}



/* ─────────────────────────────────────────────
   20. SISTEMA STATUS CARDS & PREMIUM ACTIONS
   ───────────────────────────────────────────── */

/* Row of status summary cards below the hero */
.system-status-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--s-5);
    margin-top: var(--s-5);
    margin-bottom: var(--s-6);
    padding: 0;
    z-index: 10;
    position: relative;
}

.status-summary-card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: var(--s-5);
    display: flex;
    align-items: center;
    gap: var(--s-4);
    box-shadow: var(--glass-shadow);
    transition: all 0.3s ease;
}

.status-summary-card:hover {
    transform: translateY(-4px);
    border-color: rgba(247, 151, 30, 0.4);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.35);
}

.status-summary-card .icon-circ {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(247, 151, 30, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #f7971e;
    flex-shrink: 0;
    border: 1px solid rgba(247, 151, 30, 0.2);
}

.status-summary-card .details {
    display: flex;
    flex-direction: column;
}

.status-summary-card .label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-2);
    margin-bottom: 4px;
}

.status-summary-card .value {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
    color: var(--text-1);
}

/* Premium action cards stagger animation */
.stagger-in .action-card {
    opacity: 0;
    transform: translateY(30px);
    animation: staggerFadeUp 0.5s ease forwards;
}

.stagger-in .action-card:nth-child(1) { animation-delay: 0.05s; }
.stagger-in .action-card:nth-child(2) { animation-delay: 0.15s; }
.stagger-in .action-card:nth-child(3) { animation-delay: 0.25s; }
.stagger-in .action-card:nth-child(4) { animation-delay: 0.35s; }
.stagger-in .action-card:nth-child(5) { animation-delay: 0.45s; }
.stagger-in .action-card:nth-child(6) { animation-delay: 0.55s; }

@keyframes staggerFadeUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Enhanced action card hover effect */
.action-card:hover .icon-box {
    background: linear-gradient(135deg, #f7971e 0%, #ea580c 100%);
    color: #fff;
    transform: rotate(-5deg) scale(1.1);
}

/* Explore section title */
.explore-title {
    font-family: var(--font-heading);
    font-size: 26px;
    font-weight: 700;
    color: var(--text-1);
    margin-bottom: var(--s-2);
}

.explore-subtitle {
    font-size: 14px;
    color: var(--text-2);
    margin-bottom: var(--s-5);
}

/* ─────────────────────────────────────────────
   14. RESPONSIVE DESIGN (MOBILE & TABLET)
───────────────────────────────────────────── */

@media (max-width: 992px) {
    :root {
        --sidebar-w: 240px;
    }
}

@media (max-width: 768px) {
    #app {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 280px;
        transform: translateX(-100%);
        z-index: 5000;
        box-shadow: 20px 0 50px rgba(0,0,0,0.5);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .sidebar-overlay {
        position: fixed !important;
        inset: 0 !important;
        background: rgba(0,0,0,0.6) !important;
        backdrop-filter: blur(12px) !important;
        -webkit-backdrop-filter: blur(12px) !important;
        z-index: 1500 !important;
        display: none !important;
        animation: fadeIn 0.3s ease;
        visibility: hidden;
        pointer-events: none;
    }

    .sidebar.active + .sidebar-overlay,
    .sidebar.active ~ .sidebar-overlay,
    .sidebar-overlay.active {
        display: block !important;
        visibility: visible !important;
        pointer-events: auto !important;
    }

    .content-area {
        grid-column: 1;
    }

    .top-bar {
        padding: 0 var(--s-4);
        height: 60px;
    }

    .menu-toggle {
        display: flex !important;
        width: 40px;
        height: 40px;
        align-items: center;
        justify-content: center;
        background: var(--bg-hover);
        border: 1px solid var(--border);
        border-radius: var(--r-md);
        color: var(--text-1);
        cursor: pointer;
    }

    .greeting-container {
        display: none;
    }

    .header-tools .btn-primary {
        padding: 8px 12px;
        font-size: 11px;
    }

    .header-tools .btn-primary i {
        margin: 0;
    }

    .header-tools .btn-primary span,
    .header-tools .btn-primary .text {
        display: none;
    }

    .page-container {
        padding: var(--s-4);
        padding-bottom: calc(var(--s-6) + env(safe-area-inset-bottom, 20px));
    }

    .welcome-hero {
        padding: var(--s-4);
    }

    .welcome-hero h1 {
        font-size: 22px;
    }

    .system-status-row {
        grid-template-columns: 1fr;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    /* Modal adjustments */
    .modal-overlay > div,
    #login-overlay > div,
    #password-modal > div {
        width: 92% !important;
        margin: 15px auto;
        padding: var(--s-5) !important;
    }

    .glass-card {
        padding: var(--s-4);
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .header-actions {
        width: 100%;
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 5px;
    }
}

@media (max-width: 480px) {
    .brand-name {
        font-size: 18px;
    }

    .top-bar {
        gap: var(--s-2);
    }

    .modal {
        align-items: flex-start !important;
        padding-top: 40px !important;
        padding-bottom: 40px !important;
    }

    .icon-btn {
        width: 36px;
        height: 36px;
    }

    .btn-primary {
        padding: 8px 14px;
        font-size: 12px;
    }

    /* Modal scaling for small vertical screens */
    #password-modal .glass-card,
    #login-overlay .glass-card {
        padding: var(--s-4) !important;
    }

    #password-modal .glass-card > div:first-child {
        margin-bottom: 15px !important;
    }

    #password-modal .glass-card i.fas.fa-key {
        font-size: 18px !important;
    }

    #password-modal .glass-card div[style*="width: 60px"] {
        width: 44px !important;
        height: 44px !important;
    }

    /* Form spacing on small screens */
    .form-group {
        gap: 4px;
    }

    .form-group label {
        font-size: 10px;
    }

    /* Force 16px font to prevent iOS auto-zoom on focus */
    input, select, textarea {
        font-size: 16px !important;
    }

    /* Multi-column grid fixes */
    #fields-card div[style*="grid-template-columns: 1fr 1fr 1fr"],
    #fields-card div[style*="grid-template-columns: 1fr 1fr"],
    #fields-card div[style*="grid-template-columns: 1fr 2fr"] {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    /* Recharge Modal Compacting */
    #modal-recharge .modal-content {
        padding: var(--s-4) !important;
        max-height: 95vh !important;
    }

    #modal-recharge .modal-header {
        margin-bottom: 12px !important;
        padding-bottom: 10px !important;
    }

    #modal-recharge label {
        margin-bottom: 4px !important;
        font-size: 10px !important;
    }

    #modal-recharge input {
        height: 40px !important;
        padding: 0 12px !important;
    }

    #fields-card > div[style*="grid-template-columns"] {
        gap: 8px !important;
        margin-bottom: 12px !important;
    }

    #fields-card > div {
        margin-bottom: 12px !important;
    }

    #recharge-submit-btn {
        height: 44px !important;
        margin-top: 5px !important;
    }
}

/* Responsive Header Icon Control */
@media (min-width: 768px) {
    .responsive-icon {
        display: none !important;
    }
}
@media (max-width: 767px) {
    html.is-logged-in .aurora-container,
    html.is-logged-in #login-overlay {
        display: none !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }

    #login-overlay {
        background: #ffffff !important; /* Solid white background for mobile login */
    }
    
    /* Softening the 'Square' feel */
    .glass-card {
        border-radius: 32px !important; /* Softer, more modern corners */
        padding: var(--s-7) var(--s-5) !important;
    }

    input[type="text"], 
    input[type="password"], 
    select,
    textarea,
    .form-control,
    button:not(.password-toggle-btn) {
        border-radius: 16px !important; /* Softer/Consistent inputs */
    }
}

/* Premium On/Off Switch Toggle */
.hemn-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 30px;
}

.hemn-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.hemn-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #e0e0e0;
    transition: .4s;
    border-radius: 34px;
    box-shadow: inset 2px 2px 5px #bcbcbc, inset -2px -2px 5px #ffffff;
}

.hemn-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
    box-shadow: 2px 2px 5px #bcbcbc;
    z-index: 2;
}

.hemn-slider:after {
    display: none;
}

input:checked + .hemn-slider {
    background-color: #3a7bd5;
    box-shadow: inset 2px 2px 5px rgba(0,0,0,0.2), inset -2px -2px 5px rgba(255,255,255,0.1);
}

input:checked + .hemn-slider:before {
    transform: translateX(30px);
}


/* Responsive Extraction Filters */
.extract-filters-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: var(--s-5);
    flex-wrap: nowrap;
    gap: 25px;
}

@media (max-width: 768px) {
    .extract-filters-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
}

/* --- PREMIUM CHECKOUT REDESIGN --- */
.checkout-premium-container {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 30px;
    margin-top: 20px;
    align-items: start;
}

@media (max-width: 992px) {
    .checkout-premium-container {
        grid-template-columns: 1fr;
    }
}

.checkout-summary-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 0;
    overflow: hidden;
    position: sticky;
    top: 20px;
    box-shadow: var(--shadow-lg);
    z-index: 10;
}

@media (max-width: 992px) {
    .checkout-summary-card {
        position: relative !important;
        top: 0 !important;
        z-index: 1;
        margin-bottom: 20px;
    }
}

.summary-header {
    background: var(--bg-1);
    padding: 30px 25px;
    border-bottom: 1px solid var(--border-color);
    text-align: center;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    position: relative;
    overflow: hidden;
}

/* Subtle background pattern for header */
.summary-header::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle at top right, rgba(255,255,255,0.05), transparent);
    pointer-events: none;
}

.summary-plan-icon {
    width: 80px;
    height: 80px;
    background: var(--accent-gradient);
    border-radius: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 18px;
    font-size: 36px;
    color: white;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
    border: 4px solid rgba(255,255,255,0.3);
    transition: all 0.4s ease;
    z-index: 2;
    position: relative;
}

.summary-header.theme-platinum .summary-plan-icon {
    box-shadow: 0 15px 35px rgba(0,0,0,0.3);
}

.summary-title {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 5px;
}

.summary-subtitle {
    font-size: 13px;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.summary-body {
    padding: 25px;
}

.summary-features {
    list-style: none;
    padding: 0;
    margin: 0 0 25px 0;
}

.summary-features li {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    font-size: 14px;
    color: var(--text-2);
    padding: 8px 0;
    border-bottom: 1px solid rgba(0,0,0,0.03);
}

.summary-features li:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.summary-features li i {
    color: var(--status-green);
    font-size: 14px;
    width: 20px;
}

.summary-total-box {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 25px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
    margin-top: 10px;
}

html[data-theme="dark"] .summary-total-box {
    background: rgba(255, 255, 255, 0.03) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4) !important;
}

.summary-total-label {
    font-size: 12px;
    color: var(--text-3);
    font-weight: 700;
    margin-bottom: 5px;
}

.summary-total-value {
    font-size: 32px;
    font-weight: 900;
    color: var(--text-1);
}

.checkout-main-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-x: hidden;
}

.payment-method-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 35px;
    box-shadow: var(--shadow-sm);
}

@media (max-width: 768px) {
    .payment-method-card {
        padding: 20px;
        border-radius: 20px;
        overflow-x: hidden;
    }
    
    .payment-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
        margin-bottom: 20px;
    }

    .payment-title-group h3 {
        font-size: 18px;
    }
}

.payment-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
}

.payment-title-group h3 {
    font-size: 22px;
    margin-bottom: 5px;
}

.payment-title-group p {
    color: var(--text-3);
    font-size: 14px;
}

.pix-badge {
    background: #e6f7f6;
    color: #32bcad;
    padding: 8px 16px;
    border-radius: 100px;
    font-weight: 800;
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 6px;
    border: 1px solid rgba(50, 188, 173, 0.2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pix-input-group {
    margin-bottom: 25px;
}

.pix-input-group label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-2);
    margin-bottom: 10px;
}

.pix-input-group .input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.pix-input-group .input-wrapper i {
    position: absolute;
    left: 16px;
    color: var(--text-3);
}

.pix-input-group input {
    width: 100%;
    height: 56px;
    background: var(--bg-1);
    border: 2px solid var(--border-color);
    border-radius: 14px;
    padding: 0 16px 0 45px;
    font-size: 16px;
    color: var(--text-1);
    transition: all 0.3s;
}

.pix-input-group input:focus {
    border-color: var(--accent-color);
    background: var(--bg-surface);
}

.trust-signals-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 30px;
    padding-top: 25px;
    border-top: 1px solid var(--border-color);
}

.trust-signal-item {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-3);
    font-size: 12px;
    font-weight: 600;
}

.trust-signal-item i {
    font-size: 18px;
    color: var(--status-green);
}

.qr-code-premium-frame {
    background: white;
    padding: 20px;
    border-radius: 20px;
    border: 1px solid rgba(0,0,0,0.08);
    display: inline-block;
    margin: 20px auto;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
}

html[data-theme="dark"] .qr-code-premium-frame {
    background: #ffffff !important;
    box-shadow: 0 0 25px rgba(255, 255, 255, 0.15) !important;
}

.pix-copy-premium {
    background: var(--bg-1);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 15px;
    transition: all 0.3s ease;
}

@media (max-width: 768px) {
    .pix-copy-premium {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 12px;
    }
    
    .pix-copy-premium code {
        text-align: center;
        padding: 8px;
        background: rgba(0,0,0,0.03);
        border-radius: 8px;
        width: 100%;
        box-sizing: border-box;
    }
    
    .pix-copy-btn {
        width: 100%;
        height: 48px;
        font-size: 14px;
    }
}

.pix-copy-premium code {
    flex: 1;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--text-2);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.pix-copy-btn {
    background: var(--accent-color, #3b82f6);
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.pix-copy-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
    box-shadow: 0 4px 12px rgba(0, 136, 204, 0.3);
}

/* Bottom Grid for Secondary Info */
.checkout-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 25px;
}

@media (max-width: 768px) {
    .checkout-info-grid {
        grid-template-columns: 1fr;
    }
}

.info-help-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.04);
}

html[data-theme="dark"] .info-help-card {
    background: #1e1e2e !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3) !important;
}

.info-help-card i {
    width: 48px;
    height: 48px;
    background: var(--bg-1);
    color: var(--accent-color);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.info-help-text h4 {
    font-size: 15px;
    margin: 0 0 4px 0;
    color: var(--text-1);
}

.info-help-text p {
    font-size: 13px;
    margin: 0;
    color: var(--text-3);
}

/* Specific Plan Themes for Checkout Header - Premium Improvements */
.summary-header.theme-essential .summary-plan-icon { background: linear-gradient(135deg, #0088cc, #00d2ff); box-shadow: 0 15px 35px rgba(0, 136, 204, 0.3); }
.summary-header.theme-plus .summary-plan-icon { background: linear-gradient(135deg, #7928CA, #FF0080); box-shadow: 0 15px 35px rgba(121, 40, 202, 0.3); }
.summary-header.theme-premium .summary-plan-icon { background: linear-gradient(135deg, #F9B233, #FFDF00); color: #1d1d1f; box-shadow: 0 15px 35px rgba(249, 178, 51, 0.3); }
.summary-header.theme-platinum .summary-plan-icon { background: linear-gradient(135deg, #111111, #434343); box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4); }
.summary-header.theme-clinicas .summary-plan-icon { background: linear-gradient(135deg, #3b82f6, #2563eb); box-shadow: 0 15px 35px rgba(59, 130, 246, 0.3); }
.summary-header.theme-recharge { background: rgba(16, 185, 129, 0.05); }
.summary-header.theme-recharge .summary-plan-icon { background: linear-gradient(135deg, #10b981, #059669); box-shadow: 0 15px 35px rgba(16, 185, 129, 0.3); }

/* Premium Range Slider for Checkout */
.checkout-premium-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    background: var(--bg-1);
    border-radius: 10px;
    outline: none;
    margin: 25px 0;
    border: 1px solid var(--border-color);
}

.checkout-premium-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, #10b981, #059669);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
    border: 3px solid #fff;
    transition: transform 0.2s;
}

.checkout-premium-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.recharge-stats-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    background: var(--bg-1);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    margin-bottom: 25px;
    position: relative;
    overflow: hidden;
}

.recharge-stats-box::after {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 60px; height: 60px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), transparent);
    border-radius: 0 0 0 100%;
}

/* ─────────────────────────────────────────────
   21. MOBILE RESPONSIVENESS (COMPREHENSIVE)
   ───────────────────────────────────────────── */

/* --- Universal Breakpoints --- */

/* Tablet & Large Mobile (≤ 1024px) */
@media (max-width: 1024px) {
    :root {
        --sidebar-w: 280px;
        --topbar-h: 70px;
        --s-6: 28px;
        --s-8: 48px;
    }

    #app {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: var(--sidebar-w);
        transform: translateX(-100%);
        box-shadow: 25px 0 60px rgba(0, 0, 0, 0.4);
        visibility: hidden;
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.4s;
        z-index: 9999;
    }

    .sidebar.active {
        transform: translateX(0);
        visibility: visible;
    }

    .content-area {
        grid-column: 1;
    }

    .top-bar {
        padding: 0 var(--s-4) !important;
        gap: var(--s-3) !important;
    }

    .menu-toggle {
        display: flex !important;
        margin-right: 10px;
    }

    /* Hide less important header elements on smaller screens */
    .greeting-container {
        display: none !important;
    }

    .header-tools {
        gap: 8px !important;
    }

    /* Sidebar Role Label might be too long */
    #sidebar-role-display {
        max-width: 80px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* Mobile (≤ 768px) */
@media (max-width: 768px) {
    :root {
        --topbar-h: 65px;
        --s-5: 20px;
        --s-6: 24px;
    }

    .page-container {
        padding: var(--s-4) !important;
        overflow-x: hidden !important;
        max-width: 100vw !important;
        box-sizing: border-box !important;
    }

    /* Adjust cards for mobile */
    .glass-card {
        padding: var(--s-4) !important;
    }

    .welcome-hero {
        padding: var(--s-6) var(--s-5) !important;
        margin-bottom: var(--s-4) !important;
    }

    .welcome-hero h1 {
        font-size: 28px !important;
        letter-spacing: -1px !important;
    }

    .system-status-row {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    .quick-actions-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    .action-card {
        padding: var(--s-4) !important;
        min-height: 160px !important;
    }

    /* Table Responsiveness */
    .table-wrapper {
        margin: 0 -15px !important;
        border-radius: 0 !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    .data-table {
        min-width: 0 !important;
        width: 100% !important;
    }

    /* Admin table: força layout de card (sem min-width fixo) */
    #admin-users-table {
        min-width: 0 !important;
        width: 100% !important;
        table-layout: auto !important;
    }

    /* Mobile Header Specifics */
    .user-menu-name {
        display: none !important; /* Hide name, show only avatar on mobile */
    }

    .user-menu-trigger {
        padding: 4px !important;
        border-radius: 50% !important;
        width: 42px;
        height: 42px;
        justify-content: center;
    }

    .balance-menu-trigger {
        padding: 0 10px !important;
        font-size: 13px !important;
    }

    #header-balance-amount {
        font-size: 12px !important;
    }
}

/* Extra Small Devices (≤ 480px) */
@media (max-width: 480px) {
    .header-tools .icon-btn:not(#btn-notifications) {
        display: none !important; /* Hide peripheral tools */
    }

    .balance-menu-trigger span {
        display: none !important; /* Hide "Cr" or text */
    }

    .balance-menu-trigger {
        width: 40px;
        height: 40px;
        padding: 0 !important;
        border-radius: 50% !important;
        justify-content: center;
    }

    .balance-menu-trigger i {
        margin: 0 !important;
    }

    .premium-status-card {
        min-width: 100% !important;
        flex-direction: column !important;
        gap: 20px !important;
        padding: 20px !important;
        align-items: flex-start !important;
    }

    .status-details-grid {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 10px !important;
    }

    .details-grid {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }
}

/* Utilities */
.table-scroll-indicator {
    display: none;
    text-align: center;
    font-size: 11px;
    color: var(--text-3);
    margin-top: 8px;
    font-weight: 600;
}

@media (max-width: 768px) {
    .table-scroll-indicator {
        display: block;
    }
}

/* ═══════════════════════════════════════════════════════════════
   22. MOBILE-FIRST COMPREHENSIVE OVERHAUL
   Cobrindo: touch targets, modais, tabela admin, assinatura,
   drop zones, busca unitária, safe areas iOS/Android
═══════════════════════════════════════════════════════════════ */

/* ── Touch Targets Mínimos (Apple HIG: 44x44px) ── */
@media (max-width: 1024px) {
    .nav-link {
        min-height: 44px !important;
        display: flex;
        align-items: center;
    }

    .icon-btn,
    .btn-primary,
    .btn-secondary,
    .btn-outline,
    .btn-danger {
        min-height: 44px !important;
    }

    /* Evitar hover-only feedback em touch */
    .action-card:hover {
        transform: none;
    }

    .premium-status-card:hover {
        transform: none;
    }

    /* Sidebar drawer mais largo em tablet */
    .sidebar {
        padding: var(--s-5) var(--s-4) !important;
    }
}

/* ── Menu Toggle & Top Bar Mobile (v1.5.9 Premium Reset) ── */
@media (max-width: 1024px) {
    .top-bar {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        padding: 0 16px !important;
        height: 64px !important;
        background: rgba(255, 255, 255, 0.8) !important;
        -webkit-backdrop-filter: blur(16px) saturate(180%) !important;
        backdrop-filter: blur(16px) saturate(180%) !important;
        border-bottom: 1px solid rgba(0, 0, 0, 0.06) !important;
        z-index: 1000 !important;
    }

    .menu-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        background: transparent !important;
        border: none !important;
        color: var(--text-1);
        font-size: 20px;
        cursor: pointer;
    }

    .mobile-brand {
        display: none !important;
    }

    .mobile-greeting {
        display: flex !important;
        align-items: center;
        gap: 10px;
        margin-right: auto;
        padding-left: 0;
        margin-left: -15px;
        flex: 1;
        overflow: hidden;
    }

    .mg-icon {
        width: 36px;
        height: 36px;
        background: rgba(0, 0, 0, 0.03);
        border: 1px solid rgba(0, 0, 0, 0.05);
        border-radius: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        color: var(--accent);
        font-size: 14px;
        flex-shrink: 0;
    }

    [data-theme="dark"] .mg-icon {
        background: rgba(255, 255, 255, 0.04);
        border-color: rgba(255, 255, 255, 0.1);
    }

    .mg-text {
        display: flex;
        flex-direction: column;
        justify-content: center;
        overflow: hidden;
    }

    .mg-subtitle {
        font-size: 8px;
        font-weight: 800;
        text-transform: uppercase;
        color: var(--text-3);
        letter-spacing: 0.5px;
        line-height: 1;
        margin-bottom: 2px;
        opacity: 0.8;
    }

    .mg-greeting {
        font-size: 14px;
        font-weight: 700;
        color: var(--text-1);
        margin: 0;
        line-height: 1.2;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .mg-greeting b {
        background: var(--g-primary);
        -webkit-background-clip: text;
        background-clip: text;
        -webkit-text-fill-color: transparent;
        font-weight: 800;
    }

    .mobile-logo-img {
        display: none !important;
    }

    /* O greeting some em mobile */
    .greeting-container {
        display: none !important;
    }

    .header-tools {
        display: flex !important;
        align-items: center !important;
        gap: 4px !important;
    }

    /* Ícones limpos e profissionais */
    .header-tools .icon-btn, 
    .header-tools .user-profile-trigger,
    .notification-wrapper button,
    .user-menu-trigger {
        background: rgba(255, 255, 255, 0.05) !important;
        border: 1px solid rgba(0, 0, 0, 0.05) !important;
        width: 38px !important;
        height: 38px !important;
        border-radius: 50% !important; /* Todos circulares */
        padding: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        color: var(--text-2) !important;
        box-shadow: none !important;
    }

    .user-menu-avatar {
        width: 36px !important;
        height: 36px !important;
        border-radius: 50% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 15px !important;
        font-weight: 800 !important;
        background: var(--g-primary) !important;
        color: #fff !important;
        margin: 0 !important;
        padding: 0 !important;
        aspect-ratio: 1/1 !important;
        flex-shrink: 0 !important;
        overflow: hidden !important;
    }

    /* Remove seta e nome no mobile */
    .user-menu-name,
    .user-menu-caret {
        display: none !important;
    }

    .header-tools .icon-btn i {
        font-size: 17px;
    }
}

/* ── User Modal como Bottom Sheet em mobile ── */
@media (max-width: 768px) {
    #user-modal {
        align-items: flex-end !important;
        padding: 0 !important;
    }

    #user-modal > .glass-card {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 92dvh;
        overflow-y: auto;
        border-radius: 24px 24px 0 0 !important;
        padding: var(--s-5) var(--s-4) !important;
        padding-bottom: calc(var(--s-5) + env(safe-area-inset-bottom, 0px)) !important;
    }

    /* Rodapé do modal em coluna no mobile */
    #modal-footer-actions {
        flex-direction: column-reverse !important;
        gap: 10px !important;
    }

    #modal-footer-actions > div:last-child {
        flex-direction: column !important;
        width: 100%;
    }

    #modal-footer-actions > div:last-child button {
        width: 100% !important;
        justify-content: center !important;
        min-height: 48px;
    }

    #modal-danger-actions {
        width: 100%;
        justify-content: center !important;
        gap: 12px !important;
    }

    #modal-danger-actions button {
        flex: 1;
        min-height: 48px;
        border-radius: 14px !important;
    }

    /* Form grid do user-modal colapsa em coluna */
    #user-modal .form-grid,
    #user-modal [style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }
}

/* ── Tabela Admin — card view em mobile ── */
@media (max-width: 768px) {
    /* Container da tabela admite scroll */
    .glass-card:has(#users-table-body),
    .glass-card:has(.data-table) {
        overflow-x: hidden !important;
        padding: 0 !important;
    }

    /* Esconde o <thead> — substitui por labels nos cards */
    #users-table-body ~ * thead,
    .data-table thead {
        display: none !important;
    }

    /* Cada <tr> vira um card */
    .data-table tbody tr {
        display: block !important;
        border: 1px solid var(--border) !important;
        border-radius: 12px !important;
        margin: 10px 10px !important;
        padding: 12px !important;
        background: var(--bg-card) !important;
        position: relative;
        box-shadow: 0 1px 4px rgba(0,0,0,0.05);
        overflow: hidden !important;
        box-sizing: border-box !important;
    }

    /* Cada <td> ocupa linha inteira */
    .data-table tbody td {
        display: flex !important;
        align-items: center;
        justify-content: flex-start !important;
        padding: 6px 0 !important;
        border: none !important;
        font-size: 13px;
        min-height: 0 !important;
        gap: 8px;
        width: 100% !important;
        overflow: hidden;
    }

    /* Valor (conteúdo depois do label) */
    .data-table tbody td > *:not(:first-child),
    .data-table tbody td > div:last-child {
        flex: 1;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* Primeira coluna (nome/usuário) — destaque */
    .data-table tbody td:first-child {
        margin-bottom: 8px;
        padding-bottom: 10px !important;
        border-bottom: 1px solid var(--border) !important;
    }

    .data-table tbody td:first-child .admin-user-info-wrapper {
        flex: 1;
    }

    .data-table tbody td:first-child .emp-name {
        font-size: 15px !important;
        font-weight: 700;
    }

    /* Colunas do meio: label automática via data-label */
    .data-table tbody td::before {
        content: attr(data-label);
        font-size: 9px;
        font-weight: 800;
        text-transform: uppercase;
        color: var(--text-dim);
        letter-spacing: 0.6px;
        flex-shrink: 0;
        width: 85px;
        opacity: 0.7;
    }

    /* Ultima coluna (ações) — ocupa toda a largura */
    .data-table tbody td:last-child {
        margin-top: 10px;
        padding-top: 10px !important;
        border-top: 1px solid var(--border) !important;
        justify-content: flex-start !important;
    }

    .data-table tbody td:last-child > div {
        width: 100%;
        display: flex !important;
        flex-direction: row !important;
        justify-content: space-evenly !important;
        gap: 10px !important;
    }

    /* Botões pill — ocupam espaço igual */
    .data-table tbody td:last-child button {
        flex: 1 !important;
        justify-content: center !important;
        padding: 10px 8px !important;
        font-size: 14px !important;
        border-radius: 50px !important;
        aspect-ratio: 1/1;
        max-width: 44px;
    }

    /* Esconde o texto pill em mobile, mantém ícone */
    .data-table td .pill-action-text {
        display: none !important;
    }

    /* Tabela com min-width normal para garantir scroll em telas tablets */
    .data-table {
        min-width: 0 !important;
        width: 100% !important;
    }
}

/* Wrapper universal para qualquer tabela de gestão */
@media (max-width: 768px) {
    /* Admin module: garantir que nenhum filho ultrapasse o viewport */
    #module-admin {
        overflow-x: hidden !important;
        max-width: 100% !important;
    }
    #module-admin .glass-card,
    .admin-table-wrapper,
    .glass-card:has(.data-table) {
        overflow-x: hidden !important;
        max-width: 100% !important;
        -webkit-overflow-scrolling: touch;
    }

    /* Admin stats grid colapsa */
    [id^="admin-stat"] {
        font-size: 20px !important;
    }
}

/* ── Drop Zones — Feedback Touch ── */
@media (max-width: 1024px) {
    .drop-zone {
        /* Em touch, não tem hover, então o estado padrão precisa ser mais claro */
        border-width: 2px;
        padding: var(--s-6) var(--s-4) !important;
        cursor: pointer;
    }

    .drop-zone::after {
        content: "Toque para selecionar o arquivo";
        font-size: 11px;
        color: var(--text-dim);
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        display: block;
        margin-top: 4px;
    }

    /* Esconder o texto de drag & drop padrão em mobile e mostrar touch text */
    .drop-zone p {
        display: none;
    }
}

/* ── Tela de Assinatura — Cards empilhados ── */
@media (max-width: 768px) {
    /* Card do Meu Plano */
    .premium-status-card {
        flex-direction: column !important;
        padding: 20px !important;
        gap: 16px !important;
    }

    .status-details-grid {
        flex-direction: column !important;
        gap: 12px !important;
        width: 100%;
    }

    .pague-fatura-btn {
        width: 100% !important;
        justify-content: center !important;
    }

    /* Grid de planos disponíveis */
    .plans-grid,
    [id*="plano"] [style*="grid-template-columns"] {
        grid-template-columns: 1fr 1fr !important;
        gap: 12px !important;
    }

    /* Checkout page layout */
    .checkout-layout,
    [style*="grid-template-columns: 1fr 340px"],
    [style*="grid-template-columns: 1fr 360px"] {
        grid-template-columns: 1fr !important;
        gap: var(--s-4) !important;
    }

    .checkout-summary-sidebar {
        order: -1; /* Resumo acima no mobile */
    }

    .payment-method-card {
        padding: 20px !important;
    }
}

/* ── Busca Unitária — Resultado empilha ── */
@media (max-width: 768px) {
    /* Resultado da busca em coluna */
    .search-result-layout,
    #manual-result-grid {
        grid-template-columns: 1fr !important;
        flex-direction: column !important;
    }

    /* Campos de busca em coluna */
    #busca-form-grid,
    .busca-form-row {
        flex-direction: column !important;
        gap: var(--s-3) !important;
    }

    #busca-form-grid input,
    #busca-form-grid select,
    .busca-form-row input,
    .busca-form-row select {
        width: 100% !important;
    }
}

/* ── Notificações — Posição correta com safe area ── */
@media (max-width: 768px) {
    .notification-container {
        bottom: calc(var(--s-4) + env(safe-area-inset-bottom, 0px)) !important;
        left: var(--s-3) !important;
        right: var(--s-3) !important;
        top: auto !important;
    }

    /* Dropdowns Flutuantes Compactos (v1.6.4 Standard) */
    #notification-dropdown {
        position: fixed !important;
        top: 65px !important;
        right: 16px !important;
        left: auto !important;
        width: 320px !important;
        max-width: calc(100vw - 32px) !important;
        max-height: 70vh;
        overflow-y: auto;
        border-radius: 16px !important;
        border: 1px solid var(--border) !important;
        box-shadow: 0 15px 45px rgba(0,0,0,0.15) !important;
        z-index: 10002 !important;
    }

    #user-dropdown {
        position: fixed !important;
        top: 65px !important;
        right: 16px !important;
        left: auto !important;
        width: 220px !important;
        border-radius: 16px !important;
        border: 1px solid var(--border) !important;
        box-shadow: 0 15px 45px rgba(0,0,0,0.15) !important;
        z-index: 10002 !important;
    }

    #balance-dropdown {
        position: fixed !important;
        top: 65px !important;
        right: 16px !important;
        left: auto !important;
        width: 200px !important;
        border-radius: 16px !important;
        border: 1px solid var(--border) !important;
        box-shadow: 0 15px 45px rgba(0,0,0,0.15) !important;
        z-index: 10002 !important;
    }
}

/* ── iOS Safe Area (notch/home indicator) ── */
@supports (padding: max(0px)) {
    @media (max-width: 768px) {
        .top-bar {
            padding-top: max(0px, env(safe-area-inset-top)) !important;
            height: calc(var(--topbar-h) + env(safe-area-inset-top)) !important;
        }

        /* Sidebar cobre a notch */
        .sidebar {
            padding-top: max(var(--s-5), env(safe-area-inset-top)) !important;
        }

        /* Bottom sheets com home indicator */
        #user-modal > .glass-card {
            padding-bottom: max(var(--s-6), env(safe-area-inset-bottom)) !important;
        }
    }
}

/* ── Tamanho mínimo de inputs em iOS (evita zoom automático) ── */
@media (max-width: 768px) {
    input,
    select,
    textarea {
        font-size: 16px !important; /* iOS não aplica zoom se ≥ 16px */
    }
}

/* ── Página de Monitoramento — Tabelas compactas ── */
@media (max-width: 768px) {
    #monitor-section .glass-card {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    #monitor-section table {
        min-width: 500px;
    }
}

/* ── Welcome Hero — Ajustes para tela pequena ── */
@media (max-width: 480px) {
    .welcome-hero {
        padding: 24px 20px !important;
        border-radius: 16px !important;
    }

    .welcome-hero h1 {
        font-size: 26px !important;
        letter-spacing: -0.5px !important;
    }

    .welcome-hero p {
        font-size: 14px !important;
        line-height: 1.5 !important;
    }

    /* Quick actions em 2 colunas pequenas */
    .quick-actions-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 10px !important;
    }

    .action-card {
        min-height: 130px !important;
        padding: 16px !important;
    }

    .action-card h3 {
        font-size: 15px !important;
    }

    .action-card p {
        display: none; /* Esconde descrição em tela muito pequena */
    }

    /* Logo na sidebar menor */
    .logo {
        width: 36px !important;
        height: 36px !important;
    }

    .brand-name {
        font-size: 16px !important;
    }

    /* Premium modal full-width bottom */
    .modal {
        padding: 0 !important;
        align-items: flex-end !important;
    }

    .modal-content {
        border-radius: 20px 20px 0 0 !important;
        max-width: 100% !important;
        width: 100% !important;
        max-height: 85dvh;
        overflow-y: auto;
    }

    /* ═══════════════════════════════════════════════════════════════
       V1.6.5 - PRECISE "EXPLORE SYSTEM" STYLE FOR PLANS
    ═══════════════════════════════════════════════════════════════ */
    .plans-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 12px !important;
        padding: 4px 0 !important;
        margin-top: 15px !important;
    }

    .plan-card {
        min-height: 160px !important;
        padding: 15px !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
        border-radius: 26px !important;
        gap: 6px !important;
        background: var(--bg-card) !important;
        border: 1px solid var(--border) !important;
        position: relative !important;
        overflow: hidden !important;
        box-shadow: 0 4px 15px rgba(0,0,0,0.05) !important;
        transform: none !important;
    }

    /* Small Icon Box Top-Center (Centralized Style) */
    .plan-icon-wrapper {
        position: relative !important;
        top: 0 !important;
        left: 0 !important;
        width: 38px !important;
        height: 38px !important;
        border-radius: 12px !important;
        font-size: 16px !important;
        margin: 0 0 5px 0 !important;
        background: var(--bg-input) !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        box-shadow: none !important;
        border: 1px solid var(--border) !important;
    }

    .plan-name {
        font-size: 11px !important;
        font-weight: 800 !important;
        text-transform: none !important;
        letter-spacing: 0px !important;
        color: var(--text-1) !important;
        margin-top: 5px !important;
        margin-bottom: 0px !important;
        line-height: 1.2 !important;
        width: 100% !important;
        text-align: center !important;
    }

    .plan-credits {
        font-size: 9px !important;
        padding: 3px 10px !important;
        background: rgba(0, 0, 0, 0.05) !important;
        color: var(--text-2) !important;
        border: none !important;
        border-radius: 8px !important;
        font-weight: 700 !important;
        margin: 0 !important;
        display: inline-block !important;
        width: fit-content !important;
    }

    [data-theme="dark"] .plan-credits {
        background: rgba(255, 255, 255, 0.08) !important;
    }

    .plan-price {
        font-size: 18px !important;
        font-weight: 900 !important;
        margin: 2px 0 !important;
        color: var(--text-1) !important;
        display: flex !important;
        align-items: baseline !important;
        justify-content: center !important;
        gap: 2px !important;
        width: 100% !important;
    }

    .plan-price .currency {
        font-size: 10px !important;
        font-weight: 700 !important;
        color: var(--text-3) !important;
    }

    .plan-validity,
    .recommended-badge,
    .plan-card::before {
        display: none !important; /* Hide elements that clutter the compact view */
    }

    /* Premium Theme Color Adaptations for Compact view */
    .plan-card.premium-gold {
        background: linear-gradient(135deg, #FFDF00 0%, #D4AF37 100%) !important;
        border: none !important;
    }
    .plan-card.premium-gold .plan-icon-wrapper {
        background: rgba(255, 255, 255, 0.2) !important;
        color: #fff !important;
        border: 1px solid rgba(255, 255, 255, 0.3) !important;
    }
    .plan-card.premium-gold .plan-name,
    .plan-card.premium-gold .plan-price,
    .plan-card.premium-gold .plan-credits {
        color: #fff !important;
    }
    .plan-card.premium-gold .plan-credits {
        background: rgba(0,0,0,0.1) !important;
    }

    .plan-card.platinum-gold {
        background: linear-gradient(135deg, #111 0%, #000 100%) !important;
    }
    .plan-card.platinum-gold .plan-icon-wrapper {
        background: rgba(255, 255, 255, 0.1) !important;
        color: #fff !important;
    }

    /* Selected state */
    .plan-card.selected {
        border: 2px solid var(--accent) !important;
        box-shadow: 0 10px 30px rgba(58, 123, 213, 0.25) !important;
    }
}

/* ═══════════════════════════════════════════════════════════════
   V1.6.7 - REPOSITIONED STATEMENT HEADER (MOBILE OPTIMIZATION)
   Reposiciona título e filtro para fora do card no mobile
═══════════════════════════════════════════════════════════════ */
.statement-header-mobile {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding: 0 5px;
}

.statement-header-mobile h3 {
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 700;
    margin: 0;
    color: var(--text-1);
}

@media (max-width: 768px) {
    .statement-header-mobile {
        margin-bottom: 15px;
        padding: 0 4px;
        margin-top: 5px;
        width: 100% !important;
    }
    
    .statement-header-mobile h3 {
        font-size: 14px !important;
        white-space: nowrap !important;
    }
    
    .statement-header-mobile .header-actions {
        margin-left: auto !important;
    }

    .statement-header-mobile .header-actions select {
        height: 34px !important;
        width: auto !important;
        max-width: 140px !important;
        border-radius: 10px !important;
        background: var(--bg-card) !important;
        border: 1px solid var(--border) !important;
        font-size: 13px !important;
        padding: 0 8px !important;
        color: var(--text-1) !important;
    }
}

