:root {
            --bg-color: #f8fafc;
            --text-main: #0f172a;
            --text-muted: #64748b;
            --card-bg: #ffffff;
            --border: #e2e8f0;
            --primary: #2563eb;
            --primary-hover: #1d4ed8;
            --danger: #ef4444;
            --danger-hover: #b91c1c;
            --input-bg: #ffffff;
        }

        [data-theme="dark"] {
            --bg-color: #0f172a;
            --text-main: #f8fafc;
            --text-muted: #94a3b8;
            --card-bg: #1e293b;
            --border: #334155;
            --primary: #3b82f6;
            --primary-hover: #60a5fa;
            --danger: #ef4444;
            --danger-hover: #f87171;
            --input-bg: #0f172a;
        }

        body {
            font-family: 'Inter', sans-serif;
            background-color: var(--bg-color);
            color: var(--text-main);
            margin: 0;
            padding: 0;
            display: flex;
            min-height: 100vh;
            transition: background-color 0.4s ease, color 0.4s ease;
        }
        
        .dashboard-layout {
            display: flex;
            width: 100%;
            min-height: 100vh;
        }

        .sidebar {
            width: 260px;
            background: var(--card-bg);
            border-right: 1px solid var(--border);
            display: flex;
            flex-direction: column;
            padding: 2rem 1rem;
            box-sizing: border-box;
            flex-shrink: 0;
        }

        .sidebar-title {
            font-size: 1.25rem;
            font-weight: 700;
            margin-bottom: 2rem;
            padding-left: 1rem;
            color: var(--text-main);
        }

        .sidebar-nav {
            list-style: none;
            padding: 0;
            margin: 0;
            display: flex;
            flex-direction: column;
            gap: 0.5rem;
        }

        .nav-item {
            padding: 0.75rem 1rem;
            border-radius: 8px;
            cursor: pointer;
            font-weight: 500;
            color: var(--text-muted);
            transition: all 0.2s ease;
        }

        .nav-item:hover {
            background: var(--bg-color);
            color: var(--text-main);
        }

        .nav-item.active {
            background: var(--primary);
            color: white;
        }

        .main-content {
            flex: 1;
            padding: 2rem;
            box-sizing: border-box;
            overflow-y: auto;
            height: 100vh;
        }

        .tab-content {
            display: none;
            animation: fadeIn 0.3s ease-in-out;
        }
        .tab-content.active {
            display: block;
        }

        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(5px); }
            to { opacity: 1; transform: translateY(0); }
        }

        .login-container {
            width: 100%;
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 2rem;
        }

        .container {
            max-width: 1200px;
            width: 100%;
        }
        .card {
            background: var(--card-bg);
            border: 1px solid var(--border);
            border-radius: 12px;
            padding: 2rem;
            box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
            margin-bottom: 2rem;
            transition: background-color 0.4s ease, border-color 0.4s ease;
        }
        h1, h2, h3 { margin-top: 0; }
        .header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; }
        .header-actions { display: flex; gap: 1rem; align-items: center; }
        .btn {
            padding: 0.5rem 1rem;
            border-radius: 6px;
            border: none;
            cursor: pointer;
            font-weight: 500;
            text-decoration: none;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            transition: all 0.2s;
            color: white;
        }
        .btn-primary { background: var(--primary); }
        .btn-primary:hover { background: var(--primary-hover); }
        .btn-danger { background: var(--danger); }
        .btn-danger:hover { background: var(--danger-hover); }
        .btn-secondary { background: #64748b; }
        .btn-secondary:hover { background: #475569; }
        .btn-sm { padding: 0.25rem 0.5rem; font-size: 0.875rem; }
        
        .form-group { margin-bottom: 1rem; }
        label { display: block; margin-bottom: 0.5rem; font-weight: 500; color: var(--text-main); }
        input[type="text"], input[type="password"], textarea, select {
            width: 100%;
            padding: 0.75rem;
            background-color: var(--input-bg);
            color: var(--text-main);
            border: 1px solid var(--border);
            border-radius: 6px;
            font-family: inherit;
            box-sizing: border-box;
            transition: all 0.3s;
        }
        input:focus, textarea:focus, select:focus {
            outline: none;
            border-color: var(--primary);
            box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
        }
        
        .table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
        .table th, .table td { padding: 1rem; text-align: left; border-bottom: 1px solid var(--border); color: var(--text-main); }
        .table th { font-weight: 600; color: var(--text-muted); }
        
        .error { color: var(--danger); margin-bottom: 1rem; font-weight: 500; }
        
        .icon-preview {
            width: 32px; height: 32px; display: inline-block; vertical-align: middle;
            color: var(--primary);
        }
        .icon-preview svg { width: 100%; height: 100%; }
        
        .action-btns { display: flex; gap: 0.5rem; }
        
        .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
        @media (max-width: 768px) { 
            .grid-2 { grid-template-columns: 1fr; } 
            .dashboard-layout { flex-direction: column; }
            .sidebar { width: 100%; height: auto; border-right: none; border-bottom: 1px solid var(--border); padding: 1rem; }
            .main-content { height: auto; overflow: visible; padding: 1rem; }
        }

        /* Toggle Switch */
        .switch {
            position: relative;
            display: inline-block;
            width: 44px;
            height: 24px;
        }
        .switch input { 
            opacity: 0;
            width: 0;
            height: 0;
        }
        .slider {
            position: absolute;
            cursor: pointer;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: #cbd5e1;
            transition: .4s;
            border-radius: 24px;
        }
        .slider:before {
            position: absolute;
            content: "";
            height: 18px;
            width: 18px;
            left: 3px;
            bottom: 3px;
            background-color: white;
            transition: .4s;
            border-radius: 50%;
        }
        input:checked + .slider {
            background-color: var(--primary);
        }
        input:checked + .slider:before {
            transform: translateX(20px);
        }
        [data-theme="dark"] .slider {
            background-color: #475569;
        }
        [data-theme="dark"] input:checked + .slider {
            background-color: var(--primary);
        }

        /* Theme Toggle Button */
        .theme-toggle {
            background: transparent;
            border: 1px solid var(--border);
            padding: 0.5rem;
            border-radius: 50%;
            cursor: pointer;
            color: var(--text-main);
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .theme-toggle:hover { background: var(--border); }
        .theme-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
        .sun-icon { display: none; }
        [data-theme="dark"] .sun-icon { display: block; }
        [data-theme="dark"] .moon-icon { display: none; }

        /* Estilos de Drag & Drop para Reordenación */
        .table tbody tr {
            transition: background-color 0.2s ease;
        }
        .table tbody tr[draggable="true"] {
            cursor: grab;
        }
        .table tbody tr[draggable="true"]:active {
            cursor: grabbing;
        }
        .table tbody tr.dragging {
            opacity: 0.5;
            background-color: var(--border) !important;
            border: 2px dashed var(--primary);
        }
        .table tbody tr.drag-over {
            background-color: rgba(59, 130, 246, 0.08);
            border-top: 2px solid var(--primary);
        }

        /* Selector de Iconos y Vista Previa */
        .icon-form-layout {
            display: grid;
            grid-template-columns: 2fr 1fr;
            gap: 1.5rem;
        }
        @media (max-width: 768px) {
            .icon-form-layout {
                grid-template-columns: 1fr;
            }
        }
        .live-preview-box {
            border: 1px dashed var(--border);
            border-radius: 8px;
            background: var(--bg-color);
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            padding: 1.5rem;
            min-height: 120px;
            color: var(--text-muted);
        }
        .live-preview-box .icon-preview {
            width: 48px;
            height: 48px;
            color: var(--primary);
            margin-bottom: 0.5rem;
        }
        .icon-gallery-modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100vw;
            height: 100vh;
            background: rgba(0, 0, 0, 0.5);
            z-index: 1000;
            backdrop-filter: blur(4px);
            align-items: center;
            justify-content: center;
        }
        .icon-gallery-modal.active {
            display: flex;
        }
        .icon-gallery-content {
            background: var(--card-bg);
            border: 1px solid var(--border);
            border-radius: 12px;
            max-width: 500px;
            width: 90%;
            padding: 2rem;
            box-shadow: 0 20px 25px -5px rgba(0,0,0,0.15);
            position: relative;
        }
        .icon-gallery-grid {
            display: grid;
            grid-template-columns: repeat(5, 1fr);
            gap: 1rem;
            margin-top: 1.5rem;
            max-height: 300px;
            overflow-y: auto;
            padding-right: 0.5rem;
        }
        .icon-gallery-item {
            background: var(--bg-color);
            border: 1px solid var(--border);
            border-radius: 8px;
            padding: 0.5rem;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.2s ease;
            color: var(--text-main);
        }
        .icon-gallery-item:hover {
            border-color: var(--primary);
            background: rgba(59, 130, 246, 0.1);
            color: var(--primary);
            transform: scale(1.05);
        }
        .icon-gallery-item svg {
            width: 28px;
            height: 28px;
        }

        /* Estadísticas y Auditoría */
        .stats-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
            gap: 1.5rem;
            margin-bottom: 2rem;
        }
        .stat-card {
            background: var(--card-bg);
            border: 1px solid var(--border);
            border-radius: 12px;
            padding: 1.5rem;
            display: flex;
            align-items: center;
            gap: 1rem;
            box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
        }
        .stat-card-icon {
            width: 48px;
            height: 48px;
            border-radius: 8px;
            background: rgba(59, 130, 246, 0.1);
            color: var(--primary);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.5rem;
        }
        .stat-card.stat-danger .stat-card-icon {
            background: rgba(239, 68, 68, 0.1);
            color: var(--danger);
        }
        .stat-card.stat-success .stat-card-icon {
            background: rgba(34, 197, 94, 0.1);
            color: #22c55e;
        }
        .stat-card-info h3 {
            margin: 0;
            font-size: 0.85rem;
            color: var(--text-muted);
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }
        .stat-card-info .stat-number {
            font-size: 1.8rem;
            font-weight: 700;
            margin-top: 0.25rem;
            color: var(--text-main);
        }
        
        .audit-badge {
            display: inline-block;
            padding: 0.2rem 0.5rem;
            border-radius: 4px;
            font-size: 0.75rem;
            font-weight: 600;
            text-transform: uppercase;
        }
        .audit-badge.login { background: rgba(59, 130, 246, 0.1); color: var(--primary); }
        .audit-badge.create { background: rgba(34, 197, 94, 0.1); color: #22c55e; }
        .audit-badge.update { background: rgba(234, 179, 8, 0.1); color: #ca8a04; }
        .audit-badge.delete { background: rgba(239, 68, 68, 0.1); color: var(--danger); }
        .audit-badge.other { background: rgba(100, 116, 139, 0.1); color: var(--text-muted); }

        /* Estilos de la Galería de Íconos con Pestañas */
        .gallery-tab-btn {
            background: none;
            border: none;
            color: var(--text-muted);
            padding: 0.5rem 1rem;
            cursor: pointer;
            border-bottom: 2px solid transparent;
            font-weight: 500;
            font-size: 0.9rem;
            transition: all 0.2s ease;
        }
        .gallery-tab-btn:hover {
            color: var(--text-main);
        }
        .gallery-tab-btn.active {
            color: var(--primary);
            border-bottom-color: var(--primary);
        }
        .delete-custom-icon-btn {
            position: absolute;
            top: -4px;
            right: -4px;
            background: var(--danger);
            color: white;
            border: none;
            border-radius: 50%;
            width: 18px;
            height: 18px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 11px;
            cursor: pointer;
            opacity: 0;
            transition: opacity 0.2s ease;
            padding: 0;
            line-height: 1;
        }
        .icon-gallery-item:hover .delete-custom-icon-btn {
            opacity: 1;
        }
        .delete-custom-icon-btn:hover {
            transform: scale(1.1);
            background: #dc2626;
        }