/* ============================================================================
   UI PREMIUM 2026 - Utility Classes Globais
   Extraido de base.html em 08/02/2026
   Versao 1.0 - Janeiro 2026
   Conteudo: Glassmorphism, Skeleton, Spotlight, Toggle Switches, Cards,
   Inputs Focus, Buttons, Scrollbar, Tables, Badges, Radio, Range, Progress
   ============================================================================ */

    /* ============================================================================
       UI PREMIUM 2026 - UTILITY CLASSES
       Versao 1.0 - Janeiro 2026
       SEGURO: Todas as classes sao novas, nenhuma sobrescreve estilos existentes
       ============================================================================ */

    /* ============================================
       GLASSMORPHISM (Liquid Glass Effect)
       Uso: <div class="glass-card">...</div>
    ============================================ */
    .glass-card {
        background: rgba(255, 255, 255, 0.7);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        border: 1px solid rgba(255, 255, 255, 0.3);
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    }

    .dark .glass-card {
        background: rgba(30, 41, 59, 0.7);
        border: 1px solid rgba(255, 255, 255, 0.1);
    }

    /* ============================================
       SKELETON LOADING (Shimmer Effect)
       Uso: <div class="skeleton h-4 w-32 rounded"></div>
    ============================================ */
    .skeleton {
        background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
        background-size: 200% 100%;
        animation: erp-shimmer 1.5s infinite;
    }

    .dark .skeleton {
        background: linear-gradient(90deg, #374151 25%, #4b5563 50%, #374151 75%);
        background-size: 200% 100%;
    }

    .skeleton-text {
        height: 1rem;
        border-radius: 0.25rem;
    }

    .skeleton-avatar {
        border-radius: 9999px;
    }

    @keyframes erp-shimmer {
        0% { background-position: -200% 0; }
        100% { background-position: 200% 0; }
    }

    /* ============================================
       SPOTLIGHT HOVER EFFECT - AUTOMATICO
       Aplica automaticamente em cards com shadow-lg
       O JavaScript global (erp-spotlight-init) faz o tracking do mouse
    ============================================ */

    /* Classe explicita para spotlight */
    .spotlight-card {
        position: relative;
        /* NÃO usar overflow:hidden — corta dropdowns absolutos (pessoa/produto search) */
    }

    .spotlight-card::before {
        content: '';
        position: absolute;
        top: var(--mouse-y, 50%);
        left: var(--mouse-x, 50%);
        width: 400px;
        height: 400px;
        background: radial-gradient(circle, rgba(var(--primary-rgb, 59, 130, 246), 0.15) 0%, transparent 70%);
        transform: translate(-50%, -50%);
        opacity: 0;
        transition: opacity 0.3s ease;
        pointer-events: none;
        z-index: 0;
        border-radius: inherit;
        clip-path: inset(0 round inherit);
    }

    .spotlight-card:hover::before {
        opacity: 1;
    }

    .spotlight-card > * {
        position: relative;
        z-index: 1;
    }

    /* SPOTLIGHT AUTOMATICO em cards com shadow (sm, md, lg, ou sem sufixo)
       Usa a classe .erp-spotlight que o JS adiciona automaticamente */
    .shadow-sm.erp-spotlight,
    .shadow-md.erp-spotlight,
    .shadow-lg.erp-spotlight,
    .shadow.erp-spotlight {
        position: relative;
        overflow: hidden;
    }

    .shadow-sm.erp-spotlight::before,
    .shadow-md.erp-spotlight::before,
    .shadow-lg.erp-spotlight::before,
    .shadow.erp-spotlight::before {
        content: '';
        position: absolute;
        top: var(--mouse-y, 50%);
        left: var(--mouse-x, 50%);
        width: 350px;
        height: 350px;
        background: radial-gradient(circle, rgba(var(--primary-rgb, 59, 130, 246), 0.12) 0%, transparent 70%);
        transform: translate(-50%, -50%);
        opacity: 0;
        transition: opacity 0.4s ease;
        pointer-events: none;
        z-index: 0;
        border-radius: inherit;
    }

    .shadow-sm.erp-spotlight:hover::before,
    .shadow-md.erp-spotlight:hover::before,
    .shadow-lg.erp-spotlight:hover::before,
    .shadow.erp-spotlight:hover::before {
        opacity: 1;
    }

    .shadow-sm.erp-spotlight > *,
    .shadow-md.erp-spotlight > *,
    .shadow-lg.erp-spotlight > *,
    .shadow.erp-spotlight > * {
        position: relative;
        z-index: 1;
    }

    /* Dark mode - efeito mais sutil */
    .dark .shadow-sm.erp-spotlight::before,
    .dark .shadow-md.erp-spotlight::before,
    .dark .shadow-lg.erp-spotlight::before,
    .dark .shadow.erp-spotlight::before {
        background: radial-gradient(circle, rgba(var(--primary-rgb, 96, 165, 250), 0.15) 0%, transparent 70%);
    }

    /* Desabilitar spotlight em elementos especificos */
    .no-spotlight::before {
        display: none !important;
    }

    /* ============================================
       PREMIUM GRADIENT CARDS
       Cards com gradientes premium que nao podem ser sobrescritos
    ============================================ */
    .bg-gradient-nfse-premium {
        background: linear-gradient(135deg, #10b981 0%, #14b8a6 50%, #06b6d4 100%) !important;
    }

    .bg-gradient-nfe-premium {
        background: linear-gradient(135deg, var(--color-primary-600) 0%, var(--color-primary-600) 50%, #a855f7 100%) !important;
    }

    .bg-gradient-financeiro-premium {
        background: linear-gradient(135deg, #f59e0b 0%, #f97316 50%, #ef4444 100%) !important;
    }

    .bg-gradient-dashboard-premium {
        background: linear-gradient(135deg, var(--color-primary-500, #3b82f6) 0%, var(--color-primary-600) 50%, var(--color-primary-600) 100%) !important;
    }

    /* Fundos para elementos em cards premium */
    .bg-dark-glass {
        background: rgba(0,0,0,0.15) !important;
        backdrop-filter: blur(4px);
    }

    .bg-light-glass {
        background: rgba(255,255,255,0.18) !important;
        backdrop-filter: blur(4px);
    }

    .bg-light-glass-subtle {
        background: rgba(255,255,255,0.12) !important;
        backdrop-filter: blur(4px);
    }

    /* ════════════════════════════════════════════════════════════════════════════
       ICONES BRANCOS - CARD NFS-e PREMIUM (SIMPLES E DIRETO)
       ════════════════════════════════════════════════════════════════════════════ */

    /* Classe utilitaria para forcar branco */
    .icon-white,
    .icon-white::before,
    i.icon-white,
    i.bi.icon-white,
    .icon-white-solid,
    .icon-white-solid::before,
    i.icon-white-solid,
    i.bi.icon-white-solid {
        color: #ffffff !important;
        opacity: 1 !important;
        -webkit-text-fill-color: #ffffff !important;
    }

    /* CARD NFS-e PREMIUM - Icones brancos DIRETO */
    .bg-gradient-nfse-premium .bi,
    .bg-gradient-nfse-premium i.bi,
    .bg-gradient-nfse-premium i[class*="bi-"],
    .bg-gradient-nfse-premium .bi::before {
        color: #ffffff !important;
        opacity: 1 !important;
        -webkit-text-fill-color: #ffffff !important;
        filter: drop-shadow(0 1px 2px rgba(0,0,0,0.2)) !important;
    }

    /* Glass dentro do card NFS-e premium */
    .bg-gradient-nfse-premium .bg-dark-glass .bi,
    .bg-gradient-nfse-premium .bg-light-glass .bi,
    .bg-gradient-nfse-premium .bg-light-glass-subtle .bi,
    .bg-gradient-nfse-premium .bg-dark-glass i.bi,
    .bg-gradient-nfse-premium .bg-light-glass i.bi,
    .bg-gradient-nfse-premium .bg-light-glass-subtle i.bi {
        color: #ffffff !important;
        opacity: 1 !important;
        -webkit-text-fill-color: #ffffff !important;
        filter: drop-shadow(0 1px 2px rgba(0,0,0,0.2)) !important;
    }

    /* ctx-gradient para uso futuro (opcional) */
    .ctx-gradient .bi,
    .ctx-gradient i.bi {
        color: #ffffff !important;
        opacity: 1 !important;
        -webkit-text-fill-color: #ffffff !important;
    }

    /* ============================================
       CHIP INTERACTIVE (Tags/Badges clicaveis)
       Uso: <button class="chip-interactive">Tag</button>
    ============================================ */
    .chip-interactive {
        transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .chip-interactive:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

    .chip-interactive:active {
        transform: scale(0.95);
    }

    .chip-interactive.selected {
        animation: erp-chip-select 0.3s ease;
    }

    @keyframes erp-chip-select {
        0% { transform: scale(1); }
        50% { transform: scale(1.1); }
        100% { transform: scale(1); }
    }

    /* ============================================
       SELECTION CARD (Cards de selecao)
       Uso: <div class="selection-card">...</div>
    ============================================ */
    .selection-card {
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        cursor: pointer;
    }

    .selection-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
    }

    .selection-card.selected {
        transform: scale(1.02);
        box-shadow: 0 0 0 3px var(--primary, #3b82f6);
    }

    /* ============================================
       FLOATING LABELS (Material Design Style)
       Uso: <div class="floating-label-group">
              <input placeholder=" ">
              <label>Label</label>
            </div>
    ============================================ */
    .floating-label-group {
        position: relative;
    }

    .floating-label-group input,
    .floating-label-group textarea {
        padding-top: 1.5rem;
    }

    .floating-label-group label {
        position: absolute;
        top: 50%;
        left: 1rem;
        transform: translateY(-50%);
        transition: all 0.2s ease;
        pointer-events: none;
        color: #9ca3af;
    }

    .floating-label-group input:focus + label,
    .floating-label-group input:not(:placeholder-shown) + label,
    .floating-label-group textarea:focus + label,
    .floating-label-group textarea:not(:placeholder-shown) + label {
        top: 0.5rem;
        transform: translateY(0);
        font-size: 0.75rem;
        color: var(--primary, #3b82f6);
    }

    /* ============================================
       MICROINTERACTIONS
       Uso: <button class="micro-bounce">...</button>
    ============================================ */
    .micro-bounce:hover {
        animation: erp-micro-bounce 0.5s ease;
    }

    @keyframes erp-micro-bounce {
        0%, 100% { transform: translateY(0); }
        50% { transform: translateY(-5px); }
    }

    .micro-shake:hover {
        animation: erp-micro-shake 0.5s ease;
    }

    @keyframes erp-micro-shake {
        0%, 100% { transform: rotate(0deg); }
        25% { transform: rotate(-5deg); }
        75% { transform: rotate(5deg); }
    }

    .micro-scale {
        transition: transform 0.2s ease;
    }

    .micro-scale:hover {
        transform: scale(1.05);
    }

    .micro-scale:active {
        transform: scale(0.95);
    }

    /* ============================================
       GRADIENT BACKGROUNDS
       Uso: <div class="gradient-bg-primary">...</div>
    ============================================ */
    .gradient-bg-primary {
        background: var(--gradient-primary);
    }

    .gradient-bg-success {
        background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    }

    .gradient-bg-warning {
        background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    }

    .gradient-bg-info {
        background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    }

    .gradient-bg-dark {
        background: linear-gradient(135deg, #434343 0%, #000000 100%);
    }

    /* ============================================
       NEUMORPHISM 2.0 (Soft UI)
       Uso: <button class="neu-button">...</button>
    ============================================ */
    .neu-button {
        background: linear-gradient(145deg, #f0f0f0, #cacaca);
        box-shadow: 5px 5px 10px #bebebe, -5px -5px 10px #ffffff;
        transition: all 0.2s ease;
    }

    .neu-button:hover {
        box-shadow: 3px 3px 6px #bebebe, -3px -3px 6px #ffffff;
    }

    .neu-button:active {
        box-shadow: inset 3px 3px 6px #bebebe, inset -3px -3px 6px #ffffff;
    }

    .dark .neu-button {
        background: linear-gradient(145deg, #2d3748, #1a202c);
        box-shadow: 5px 5px 10px #151a23, -5px -5px 10px #3f4a5d;
    }

    .dark .neu-button:active {
        box-shadow: inset 3px 3px 6px #151a23, inset -3px -3px 6px #3f4a5d;
    }

    /* ============================================
       NEUMORPHISM 2.0 TOGGLE SWITCHES - AUTOMATICO
       Aplica automaticamente a TODOS os checkboxes do sistema
       Transforma checkboxes padrao em toggle switches modernos
       Compativel com Alpine.js x-model
    ============================================ */

    /* Container label para checkbox - visual melhorado automatico */
    label:has(> input[type="checkbox"]),
    label:has(> input[type="checkbox"].rounded) {
        position: relative;
    }

    /* Toggle Switch - Checkboxes com classes w-4, w-5 (padrao do projeto) */
    input[type="checkbox"].rounded,
    input[type="checkbox"][class*="w-4"],
    input[type="checkbox"][class*="w-5"] {
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        position: relative;
        width: 44px !important;
        height: 24px !important;
        background: linear-gradient(145deg, #e2e8f0, #cbd5e1);
        border-radius: 12px !important;
        cursor: pointer;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow:
            inset 2px 2px 4px rgba(0, 0, 0, 0.1),
            inset -2px -2px 4px rgba(255, 255, 255, 0.7),
            0 2px 4px rgba(0, 0, 0, 0.05);
        border: none !important;
        flex-shrink: 0;
    }

    /* Knob do toggle (circulo que move) */
    input[type="checkbox"].rounded::before,
    input[type="checkbox"][class*="w-4"]::before,
    input[type="checkbox"][class*="w-5"]::before {
        content: '';
        position: absolute;
        top: 2px;
        left: 2px;
        width: 20px;
        height: 20px;
        background: linear-gradient(145deg, #ffffff, #f1f5f9);
        border-radius: 50%;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow:
            2px 2px 4px rgba(0, 0, 0, 0.15),
            -1px -1px 2px rgba(255, 255, 255, 0.8);
    }

    /* Estado checked - move o knob para direita */
    input[type="checkbox"].rounded:checked,
    input[type="checkbox"][class*="w-4"]:checked,
    input[type="checkbox"][class*="w-5"]:checked {
        background: linear-gradient(145deg, #22c55e, #16a34a);
        box-shadow:
            inset 2px 2px 4px rgba(0, 0, 0, 0.15),
            inset -2px -2px 4px rgba(255, 255, 255, 0.1),
            0 2px 8px rgba(34, 197, 94, 0.4);
    }

    input[type="checkbox"].rounded:checked::before,
    input[type="checkbox"][class*="w-4"]:checked::before,
    input[type="checkbox"][class*="w-5"]:checked::before {
        transform: translateX(20px);
        background: linear-gradient(145deg, #ffffff, #f0fdf4);
        box-shadow:
            2px 2px 4px rgba(0, 0, 0, 0.2),
            -1px -1px 2px rgba(255, 255, 255, 0.9);
    }

    /* Cores especificas quando checked - baseado nas classes text-* */
    input[type="checkbox"].rounded[class*="text-green"]:checked,
    input[type="checkbox"][class*="w-"][class*="text-green"]:checked {
        background: linear-gradient(145deg, #22c55e, #16a34a);
        box-shadow: inset 2px 2px 4px rgba(0,0,0,0.15), 0 2px 8px rgba(34, 197, 94, 0.4);
    }

    input[type="checkbox"].rounded[class*="text-blue"]:checked,
    input[type="checkbox"][class*="w-"][class*="text-blue"]:checked {
        background: linear-gradient(145deg, #3b82f6, #2563eb);
        box-shadow: inset 2px 2px 4px rgba(0,0,0,0.15), 0 2px 8px rgba(59, 130, 246, 0.4);
    }

    input[type="checkbox"].rounded[class*="text-purple"]:checked,
    input[type="checkbox"][class*="w-"][class*="text-purple"]:checked {
        background: linear-gradient(145deg, #a855f7, #9333ea);
        box-shadow: inset 2px 2px 4px rgba(0,0,0,0.15), 0 2px 8px rgba(168, 85, 247, 0.4);
    }

    input[type="checkbox"].rounded[class*="text-red"]:checked,
    input[type="checkbox"][class*="w-"][class*="text-red"]:checked {
        background: linear-gradient(145deg, #ef4444, #dc2626);
        box-shadow: inset 2px 2px 4px rgba(0,0,0,0.15), 0 2px 8px rgba(239, 68, 68, 0.4);
    }

    input[type="checkbox"].rounded[class*="text-indigo"]:checked,
    input[type="checkbox"][class*="w-"][class*="text-indigo"]:checked {
        background: linear-gradient(145deg, var(--color-primary-600), #4f46e5);
        box-shadow: inset 2px 2px 4px rgba(0,0,0,0.15), 0 2px 8px rgba(99, 102, 241, 0.4);
    }

    /* Hover effect */
    input[type="checkbox"].rounded:hover,
    input[type="checkbox"][class*="w-4"]:hover,
    input[type="checkbox"][class*="w-5"]:hover {
        box-shadow:
            inset 2px 2px 4px rgba(0, 0, 0, 0.12),
            inset -2px -2px 4px rgba(255, 255, 255, 0.8),
            0 4px 8px rgba(0, 0, 0, 0.1);
    }

    /* Focus ring para acessibilidade */
    input[type="checkbox"].rounded:focus,
    input[type="checkbox"][class*="w-4"]:focus,
    input[type="checkbox"][class*="w-5"]:focus {
        outline: none;
        box-shadow:
            inset 2px 2px 4px rgba(0, 0, 0, 0.1),
            inset -2px -2px 4px rgba(255, 255, 255, 0.7),
            0 0 0 3px rgba(var(--primary-rgb, 59, 130, 246), 0.3);
    }

    /* Dark Mode */
    .dark input[type="checkbox"].rounded,
    .dark input[type="checkbox"][class*="w-4"],
    .dark input[type="checkbox"][class*="w-5"] {
        background: linear-gradient(145deg, #374151, #1f2937);
        box-shadow:
            inset 2px 2px 4px rgba(0, 0, 0, 0.3),
            inset -2px -2px 4px rgba(255, 255, 255, 0.05),
            0 2px 4px rgba(0, 0, 0, 0.2);
    }

    .dark input[type="checkbox"].rounded::before,
    .dark input[type="checkbox"][class*="w-4"]::before,
    .dark input[type="checkbox"][class*="w-5"]::before {
        background: linear-gradient(145deg, #6b7280, #4b5563);
        box-shadow:
            2px 2px 4px rgba(0, 0, 0, 0.3),
            -1px -1px 2px rgba(255, 255, 255, 0.1);
    }

    .dark input[type="checkbox"].rounded:checked,
    .dark input[type="checkbox"][class*="w-4"]:checked,
    .dark input[type="checkbox"][class*="w-5"]:checked {
        background: linear-gradient(145deg, #22c55e, #16a34a);
    }

    .dark input[type="checkbox"].rounded:checked::before,
    .dark input[type="checkbox"][class*="w-4"]:checked::before,
    .dark input[type="checkbox"][class*="w-5"]:checked::before {
        background: linear-gradient(145deg, #ffffff, #e5e7eb);
    }

    /* ============================================
       MELHORIAS AUTOMATICAS DE CARDS - Hover Sutil
       Aplica automaticamente em cards com shadow (sm, md, lg)
       Adiciona transicao suave e elevacao no hover
    ============================================ */

    /* Cards com shadow ganham hover sutil automatico */
    .shadow-sm,
    .shadow-md,
    .shadow-lg,
    .shadow {
        transition: transform 0.2s ease, box-shadow 0.2s ease;
    }

    .shadow-sm:hover,
    .shadow-md:hover,
    .shadow-lg:hover,
    .shadow:hover {
        transform: translateY(-2px);
        box-shadow:
            0 20px 25px -5px rgba(0, 0, 0, 0.1),
            0 10px 10px -5px rgba(0, 0, 0, 0.04);
    }

    /* Desabilita hover em elementos que nao devem ter (tabelas, etc) */
    table .shadow-sm:hover,
    table .shadow-md:hover,
    table .shadow-lg:hover,
    table .shadow:hover,
    .no-hover-lift:hover {
        transform: none;
        box-shadow: inherit;
    }

    /* ============================================
       MELHORIAS AUTOMATICAS DE INPUTS - Focus Premium
       Aplica automaticamente em .form-control
    ============================================ */

    .form-control {
        transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.1s ease;
    }

    .form-control:focus {
        border-color: var(--primary, #3b82f6) !important;
        box-shadow: 0 0 0 3px rgba(var(--primary-rgb, 59, 130, 246), 0.15), 0 2px 4px rgba(0, 0, 0, 0.05) !important;
        transform: scale(1.01);
    }

    .dark .form-control:focus {
        border-color: var(--primary, #60a5fa) !important;
        box-shadow: 0 0 0 3px rgba(var(--primary-rgb, 96, 165, 250), 0.2), 0 2px 4px rgba(0, 0, 0, 0.2) !important;
    }

    /* Select com visual melhorado */
    select.form-control {
        background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
        background-position: right 0.75rem center;
        background-repeat: no-repeat;
        background-size: 1.25rem;
        padding-right: 2.5rem;
    }

    /* ============================================
       MELHORIAS AUTOMATICAS DE BOTOES - Microinteractions
       Aplica em botoes primarios e secundarios
    ============================================ */

    .btn-primary,
    .btn-success,
    .btn-danger,
    .btn-warning,
    .btn-info {
        transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .btn-primary:hover,
    .btn-success:hover,
    .btn-danger:hover,
    .btn-warning:hover,
    .btn-info:hover {
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

    .btn-primary:active,
    .btn-success:active,
    .btn-danger:active,
    .btn-warning:active,
    .btn-info:active {
        transform: scale(0.98);
    }

    /* ============================================
       SCROLLBAR GLOBAL BONITA - Automatico
       Aplica em todo o sistema
    ============================================ */

    /* Firefox */
    * {
        scrollbar-width: thin;
        scrollbar-color: #cbd5e1 transparent;
    }

    .dark * {
        scrollbar-color: #475569 transparent;
    }

    /* Chrome, Edge, Safari */
    ::-webkit-scrollbar {
        width: 8px;
        height: 8px;
    }

    ::-webkit-scrollbar-track {
        background: transparent;
    }

    ::-webkit-scrollbar-thumb {
        background: linear-gradient(180deg, #cbd5e1 0%, #94a3b8 100%);
        border-radius: 4px;
        border: 2px solid transparent;
        background-clip: padding-box;
    }

    ::-webkit-scrollbar-thumb:hover {
        background: linear-gradient(180deg, #94a3b8 0%, #64748b 100%);
        background-clip: padding-box;
    }

    .dark ::-webkit-scrollbar-thumb {
        background: linear-gradient(180deg, #475569 0%, #334155 100%);
        background-clip: padding-box;
    }

    .dark ::-webkit-scrollbar-thumb:hover {
        background: linear-gradient(180deg, #64748b 0%, #475569 100%);
        background-clip: padding-box;
    }

    /* Scrollbar minima em areas de conteudo */
    ::-webkit-scrollbar-corner {
        background: transparent;
    }

    /* ============================================
       TABELAS - Hover Automatico
       Em @layer base para nao conflitar com Tailwind v4 @layer utilities
    ============================================ */
    @layer base {
        table tbody tr {
            transition: background-color 0.15s ease;
        }

        table tbody tr:hover {
            background-color: rgba(var(--primary-rgb, 59, 130, 246), 0.04);
        }

        .dark table tbody tr:hover,
        html.theme-dark table tbody tr:hover {
            background-color: rgba(var(--primary-rgb, 96, 165, 250), 0.08);
        }

        /* Linha selecionada */
        table tbody tr.selected,
        table tbody tr[data-selected="true"] {
            background-color: rgba(var(--primary-rgb, 59, 130, 246), 0.1) !important;
        }

        .dark table tbody tr.selected,
        .dark table tbody tr[data-selected="true"],
        html.theme-dark table tbody tr.selected,
        html.theme-dark table tbody tr[data-selected="true"] {
            background-color: rgba(var(--primary-rgb, 96, 165, 250), 0.15) !important;
        }
    }

    /* ============================================
       TABELAS EM FUNDO ESCURO - Classe utilitaria
       Uso: <table class="dark-bg-table"> em qualquer tabela sobre bg escuro.
       Reseta cores globais de theme-styles.css para texto claro.
       Cores especificas por celula: usar style="color:..." ou Tailwind classes.
    ============================================ */
    .dark-bg-table td {
        color: rgba(255,255,255,0.8);
        background: transparent;
        border-bottom: 1px solid rgba(255,255,255,0.05);
        padding: 0.25rem 0.5rem;
    }
    .dark-bg-table th {
        color: rgba(255,255,255,0.7);
        background: transparent;
        border-bottom: 1px solid rgba(255,255,255,0.05);
        padding: 0.375rem 0.5rem;
        text-align: left;
    }
    .dark-bg-table tr:hover td {
        background: rgba(255,255,255,0.03);
    }

    /* ============================================
       BADGES/CHIPS - Animacoes Automaticas
       Aplica em .badge do Bootstrap e spans com bg-*
    ============================================ */

    .badge,
    span[class*="bg-"][class*="rounded"] {
        transition: all 0.2s ease;
    }

    .badge:hover,
    span[class*="bg-"][class*="rounded"]:hover {
        transform: scale(1.05);
        filter: brightness(1.1);
    }

    /* ============================================
       LINKS - Transicoes Suaves
       Aplica em todos os links
    ============================================ */

    a {
        transition: color 0.15s ease, opacity 0.15s ease;
    }

    a:hover {
        opacity: 0.85;
    }

    /* Links com icones */
    a > i,
    a > svg {
        transition: transform 0.2s ease;
    }

    a:hover > i,
    a:hover > svg {
        transform: translateX(2px);
    }

    /* ============================================
       AVATARES E IMAGENS DE PERFIL - Automatico
       Aplica em imagens com rounded-full
    ============================================ */

    img.rounded-full,
    img[class*="rounded-full"] {
        transition: transform 0.2s ease, box-shadow 0.2s ease;
    }

    img.rounded-full:hover,
    img[class*="rounded-full"]:hover {
        transform: scale(1.1);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

    /* ============================================
       MODAIS - Animacoes Melhoradas
       Aplica automaticamente
    ============================================ */

    .modal.show .modal-dialog {
        animation: erp-modal-enter 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    @keyframes erp-modal-enter {
        from {
            opacity: 0;
            transform: scale(0.95) translateY(-20px);
        }
        to {
            opacity: 1;
            transform: scale(1) translateY(0);
        }
    }

    /* ============================================
       ICONES - Hover Automatico
       Aplica em icones Bootstrap Icons clicaveis
    ============================================ */

    button > .bi,
    a > .bi,
    [role="button"] > .bi {
        transition: transform 0.2s ease;
    }

    button:hover > .bi,
    a:hover > .bi,
    [role="button"]:hover > .bi {
        transform: scale(1.15);
    }

    /* ============================================
       TEXTAREA - Auto Resize Visual
       Aplica em todos os textareas
    ============================================ */

    textarea {
        transition: height 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    }

    textarea:focus {
        border-color: var(--primary, #3b82f6) !important;
        box-shadow: 0 0 0 3px rgba(var(--primary-rgb, 59, 130, 246), 0.15) !important;
    }

    .dark textarea:focus {
        border-color: var(--primary, #60a5fa) !important;
        box-shadow: 0 0 0 3px rgba(var(--primary-rgb, 96, 165, 250), 0.2) !important;
    }

    /* ============================================
       SMOOTH SCROLL - Automatico
       Scroll suave para ancoras e navegacao
    ============================================ */

    html {
        scroll-behavior: smooth;
    }

    @media (prefers-reduced-motion: reduce) {
        html {
            scroll-behavior: auto;
        }
    }

    /* ============================================
       SELECTION COLOR - Automatico
       Cor de selecao de texto customizada
    ============================================ */

    ::selection {
        background: rgba(var(--primary-rgb, 59, 130, 246), 0.3);
        color: inherit;
    }

    ::-moz-selection {
        background: rgba(var(--primary-rgb, 59, 130, 246), 0.3);
        color: inherit;
    }

    .dark ::selection {
        background: rgba(var(--primary-rgb, 96, 165, 250), 0.4);
    }

    .dark ::-moz-selection {
        background: rgba(var(--primary-rgb, 96, 165, 250), 0.4);
    }

    /* ============================================
       FOCUS VISIBLE - Acessibilidade Melhorada
       Outline bonito apenas quando necessario
    ============================================ */

    :focus-visible {
        outline: 2px solid var(--primary, #3b82f6);
        outline-offset: 2px;
    }

    .dark :focus-visible {
        outline-color: var(--primary, #60a5fa);
    }

    /* Remove outline em cliques de mouse, mantém para teclado */
    :focus:not(:focus-visible) {
        outline: none;
    }

    /* ============================================
       DISABLED STATES - Automatico
       Elementos desabilitados mais elegantes
    ============================================ */

    [disabled],
    .disabled,
    [aria-disabled="true"] {
        opacity: 0.6;
        cursor: not-allowed;
        pointer-events: none;
        filter: grayscale(30%);
    }

    button[disabled],
    input[disabled],
    select[disabled],
    textarea[disabled] {
        background-color: #f3f4f6 !important;
    }

    .dark button[disabled],
    .dark input[disabled],
    .dark select[disabled],
    .dark textarea[disabled] {
        background-color: #374151 !important;
    }

    /* ============================================
       REQUIRED FIELD INDICATOR - Automatico
       Asterisco vermelho em campos obrigatorios
    ============================================ */

    label:has(+ input[required])::after,
    label:has(+ select[required])::after,
    label:has(+ textarea[required])::after,
    label[for]:has(~ input[required])::after {
        content: ' *';
        color: #ef4444;
        font-weight: 600;
    }

    /* ============================================
       PLACEHOLDER STYLING - Automatico
       Placeholders mais sutis e elegantes
    ============================================ */

    ::placeholder {
        color: #4b5563;
        opacity: 1;
        font-style: italic;
    }

    .dark ::placeholder {
        color: #d1d5db;
    }

    /* Templates de mensagem - placeholder precisa ser bem legivel */
    .tmpl-textarea::placeholder {
        color: #374151;
        font-style: normal;
    }
    .dark .tmpl-textarea::placeholder {
        color: #e5e7eb;
    }

    /* ============================================
       NUMBER INPUT - Esconder Spinners
       Remove spinners feios do input number
    ============================================ */

    input[type="number"]::-webkit-outer-spin-button,
    input[type="number"]::-webkit-inner-spin-button {
        -webkit-appearance: none;
        margin: 0;
    }

    input[type="number"] {
        -moz-appearance: textfield;
        appearance: textfield;
    }

    /* ============================================
       RADIO BUTTONS - Estilo Moderno
       Similar aos toggle switches
    ============================================ */

    input[type="radio"] {
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        width: 20px;
        height: 20px;
        border: 2px solid #d1d5db;
        border-radius: 50%;
        background: white;
        cursor: pointer;
        transition: all 0.2s ease;
        position: relative;
    }

    input[type="radio"]:checked {
        border-color: var(--primary, #3b82f6);
        background: white;
    }

    input[type="radio"]:checked::after {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 10px;
        height: 10px;
        background: var(--primary, #3b82f6);
        border-radius: 50%;
        animation: erp-radio-pop 0.2s ease;
    }

    @keyframes erp-radio-pop {
        0% { transform: translate(-50%, -50%) scale(0); }
        50% { transform: translate(-50%, -50%) scale(1.2); }
        100% { transform: translate(-50%, -50%) scale(1); }
    }

    input[type="radio"]:hover {
        border-color: var(--primary, #3b82f6);
        box-shadow: 0 0 0 3px rgba(var(--primary-rgb, 59, 130, 246), 0.1);
    }

    .dark input[type="radio"] {
        background: #374151;
        border-color: #4b5563;
    }

    .dark input[type="radio"]:checked {
        border-color: var(--primary, #60a5fa);
    }

    .dark input[type="radio"]:checked::after {
        background: var(--primary, #60a5fa);
    }

    /* ============================================
       RANGE/SLIDER - Estilo Moderno
       Input range com visual premium
    ============================================ */

    input[type="range"] {
        -webkit-appearance: none;
        appearance: none;
        width: 100%;
        height: 6px;
        background: linear-gradient(to right, var(--primary, #3b82f6) 0%, var(--primary, #3b82f6) var(--range-progress, 50%), #e5e7eb var(--range-progress, 50%), #e5e7eb 100%);
        border-radius: 3px;
        cursor: pointer;
    }

    input[type="range"]::-webkit-slider-thumb {
        -webkit-appearance: none;
        appearance: none;
        width: 20px;
        height: 20px;
        background: white;
        border: 2px solid var(--primary, #3b82f6);
        border-radius: 50%;
        cursor: pointer;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
        transition: all 0.2s ease;
    }

    input[type="range"]::-webkit-slider-thumb:hover {
        transform: scale(1.1);
        box-shadow: 0 4px 12px rgba(var(--primary-rgb, 59, 130, 246), 0.3);
    }

    input[type="range"]::-moz-range-thumb {
        width: 20px;
        height: 20px;
        background: white;
        border: 2px solid var(--primary, #3b82f6);
        border-radius: 50%;
        cursor: pointer;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    }

    .dark input[type="range"] {
        background: linear-gradient(to right, var(--primary, #60a5fa) 0%, var(--primary, #60a5fa) var(--range-progress, 50%), #4b5563 var(--range-progress, 50%), #4b5563 100%);
    }

    .dark input[type="range"]::-webkit-slider-thumb {
        background: #1f2937;
        border-color: var(--primary, #60a5fa);
    }

    /* ============================================
       PROGRESS BARS - Animacao Gradiente
       Progress bars com shimmer animado
    ============================================ */

    progress {
        -webkit-appearance: none;
        appearance: none;
        width: 100%;
        height: 8px;
        border-radius: 4px;
        overflow: hidden;
    }

    progress::-webkit-progress-bar {
        background: #e5e7eb;
        border-radius: 4px;
    }

    progress::-webkit-progress-value {
        background: linear-gradient(90deg, var(--primary, #3b82f6) 0%, var(--color-primary-400, #60a5fa) 50%, var(--primary, #3b82f6) 100%);
        background-size: 200% 100%;
        animation: erp-progress-shimmer 2s linear infinite;
        border-radius: 4px;
    }

    progress::-moz-progress-bar {
        background: linear-gradient(90deg, var(--primary, #3b82f6) 0%, var(--color-primary-400, #60a5fa) 50%, var(--primary, #3b82f6) 100%);
        background-size: 200% 100%;
        animation: erp-progress-shimmer 2s linear infinite;
        border-radius: 4px;
    }

    @keyframes erp-progress-shimmer {
        0% { background-position: 200% 0; }
        100% { background-position: -200% 0; }
    }

    .dark progress::-webkit-progress-bar {
        background: #374151;
    }

    /* ============================================
       LOADING CURSOR - Automatico
       Cursor de loading quando processando
    ============================================ */

    [aria-busy="true"],
    .loading,
    .is-loading {
        cursor: wait !important;
    }

    [aria-busy="true"] *,
    .loading *,
    .is-loading * {
        pointer-events: none;
    }

    /* ============================================
       DROPZONE UPLOAD
       Uso: <div class="dropzone">...</div>
    ============================================ */
    .dropzone {
        border: 2px dashed #d1d5db;
        transition: all 0.3s ease;
    }

    .dropzone.dragover {
        border-color: var(--primary, #3b82f6);
        background: rgba(var(--primary-rgb, 59, 130, 246), 0.05);
        transform: scale(1.02);
    }

    .dark .dropzone {
        border-color: #4b5563;
    }

    .dark .dropzone.dragover {
        border-color: var(--primary, #60a5fa);
        background: rgba(var(--primary-rgb, 96, 165, 250), 0.1);
    }

    /* ============================================
       PROGRESS STEPPER
       Uso: Ver documentacao em template_baseCadastro.txt
    ============================================ */
    .step-connector {
        transition: all 0.5s ease;
    }

    .step-circle {
        transition: all 0.3s ease;
    }

    .step-circle.active {
        animation: erp-pulse-ring 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
    }

    @keyframes erp-pulse-ring {
        0%, 100% { box-shadow: 0 0 0 0 rgba(var(--primary-rgb, 59, 130, 246), 0.4); }
        50% { box-shadow: 0 0 0 8px rgba(var(--primary-rgb, 59, 130, 246), 0); }
    }

    /* ============================================
       ANIMATED COUNTER (CSS @property)
       Uso: Ver documentacao em template_baseCadastro.txt
    ============================================ */
    @property --erp-counter-num {
        syntax: "<integer>";
        initial-value: 0;
        inherits: false;
    }

    .counter-animate {
        animation: erp-counter 2s ease-out forwards;
        counter-reset: num var(--erp-counter-num);
    }

    .counter-animate::after {
        content: counter(num);
    }

    @keyframes erp-counter {
        from { --erp-counter-num: 0; }
        to { --erp-counter-num: var(--target, 100); }
    }

    /* ============================================
       TOAST NOTIFICATION CONTAINER
       Usado pelo sistema global de toasts
    ============================================ */
    #erp-toast-container {
        position: fixed;
        top: 1rem;
        right: 1rem;
        z-index: 99999;
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        pointer-events: none;
    }

    #erp-toast-container > * {
        pointer-events: auto;
    }

    .erp-toast {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        padding: 0.875rem 1rem;
        border-radius: 0.75rem;
        min-width: 300px;
        max-width: 400px;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
        animation: erp-toast-in 0.3s ease-out;
    }

    .erp-toast.removing {
        animation: erp-toast-out 0.2s ease-in forwards;
    }

    .erp-toast-success { background: #10b981; color: white; }
    .erp-toast-error { background: #ef4444; color: white; }
    .erp-toast-warning { background: #f59e0b; color: white; }
    .erp-toast-info { background: #3b82f6; color: white; }

    @keyframes erp-toast-in {
        from { opacity: 0; transform: translateX(100%); }
        to { opacity: 1; transform: translateX(0); }
    }

    @keyframes erp-toast-out {
        from { opacity: 1; transform: translateX(0); }
        to { opacity: 0; transform: translateX(100%); }
    }

    /* ============================================
       COMMAND PALETTE (Ctrl+K)
       Container e estilos do modal de busca global
    ============================================ */
    #erp-command-palette {
        position: fixed;
        inset: 0;
        z-index: 99998;
        display: none;
        align-items: flex-start;
        justify-content: center;
        padding-top: 15vh;
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(4px);
    }

    #erp-command-palette.active {
        display: flex;
    }

    #erp-command-palette .palette-content {
        width: 100%;
        max-width: 32rem;
        background: white;
        border-radius: 1rem;
        box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
        overflow: hidden;
    }

    .dark #erp-command-palette .palette-content {
        background: #1f2937;
    }

    /* ============================================================================
       GRADIENT HEADER BUTTONS - Botoes sobre fundo escuro (headers de dashboard)
       Contraste garantido: branco semi-transparente sobre gradiente escuro.
       Uso: class="gradient-header-btn" em <a> ou <button> dentro de headers premium.
       Ref: Especialista_UX_UI.md S3.5 Decoracoes Premium
       ============================================================================ */
    .gradient-header-btn {
        display: inline-flex !important;
        align-items: center !important;
        gap: 0.375rem !important;
        min-height: 44px !important;
        padding: 0.625rem 0.875rem !important;
        font-size: 0.875rem !important;
        font-weight: 600 !important;
        color: #fff !important;
        background: rgba(255, 255, 255, 0.25) !important;
        border: 1px solid rgba(255, 255, 255, 0.40) !important;
        border-radius: 0.75rem !important;
        -webkit-backdrop-filter: blur(4px);
        backdrop-filter: blur(4px);
        transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
        cursor: pointer !important;
        text-decoration: none !important;
    }

    .gradient-header-btn:hover {
        background: rgba(255, 255, 255, 0.35) !important;
        border-color: rgba(255, 255, 255, 0.55) !important;
        color: #fff !important;
        text-decoration: none !important;
    }

    .gradient-header-btn:active {
        transform: scale(0.97);
    }

    .gradient-header-btn:disabled,
    .gradient-header-btn.disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }

    /* Variante accent (dourada) - para CTAs destaque como DotFood */
    .gradient-header-btn--accent {
        background: var(--color-accent, #d4a825) !important;
        border-color: rgba(255, 255, 255, 0.30) !important;
        font-weight: 700 !important;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15) !important;
    }

    .gradient-header-btn--accent:hover {
        filter: brightness(0.92);
        background: var(--color-accent, #d4a825) !important;
        border-color: rgba(255, 255, 255, 0.45) !important;
    }

    /* ============================================================================
       FIM - UI PREMIUM 2026 UTILITIES
       ============================================================================ */
