:root {
    /* UTM Branding Colors */
    --primary: #0cba55;
    --primary-hover: #005c26;
    --warning: #f2c811;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --success: #10b981;

    /* Light Theme (Default CSS Variables) */
    --bg-dark: #f8f9fa;
    --bg-card: rgba(255, 255, 255, 0.8);
    --secondary: #e2e8f0;
    --secondary-hover: #cbd5e1;
    --text-main: #1b262c;
    --text-muted: #64748b;
    --border-color: rgba(0, 0, 0, 0.1);
    --shadow-glass: 0 4px 16px rgba(0, 0, 0, 0.05);

    /* Globals */
    --font-family: 'Inter', sans-serif;
    --radius-md: 12px;
    --radius-lg: 16px;
    --transition-fast: 0.2s ease;
}

/* ---- Utility Classes ---- */
.d-flex {
    display: flex;
}

.flex-col {
    display: flex;
    flex-direction: column;
}

.align-center {
    align-items: center;
}

.align-start {
    align-items: flex-start;
}

.justify-between {
    justify-content: space-between;
}

.justify-center {
    justify-content: center;
}

.justify-end {
    justify-content: flex-end;
}

.gap-2 {
    gap: 8px;
}

.gap-3 {
    gap: 12px;
}

.gap-4 {
    gap: 16px;
}

.gap-6 {
    gap: 24px;
}

.text-muted {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.text-primary {
    color: var(--primary);
}

.text-success {
    color: var(--success);
}

.text-danger {
    color: var(--danger);
}

.text-warning {
    color: var(--warning);
}

.fw-500 {
    font-weight: 500;
}

.fw-600 {
    font-weight: 600;
}

.mt-2 {
    margin-top: 8px;
}

.mt-4 {
    margin-top: 16px;
}

.mt-6 {
    margin-top: 24px;
}

.mt-8 {
    margin-top: 32px;
}

.mb-2 {
    margin-bottom: 8px;
}

.mb-4 {
    margin-bottom: 16px;
}

.mb-6 {
    margin-bottom: 24px;
}

.w-full {
    width: 100%;
}

body.dark-theme {
    /* Dark Theme Variants (Oxford logic) */
    --bg-dark: #1b262c;
    --bg-card: rgba(18, 25, 30, 0.7);
    --secondary: #2d3e48;
    --secondary-hover: #3b505c;
    --text-main: #ffffff;
    --text-muted: #a0aec0;
    --border-color: rgba(255, 255, 255, 0.1);
    --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    /* Firefox support */
    scrollbar-width: thin;
    scrollbar-color: rgba(124, 124, 124, 0.3) transparent;
}

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

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

::-webkit-scrollbar-thumb {
    background: rgba(124, 124, 124, 0.2);
    border-radius: 20px;
    border: 2px solid transparent;
    background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(124, 124, 124, 0.4);
    background-clip: content-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    overflow: hidden;
    background-image:
        radial-gradient(circle at 15% 50%, rgba(0, 122, 51, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 85% 30%, rgba(0, 122, 51, 0.03) 0%, transparent 50%);
}

.app-container {
    display: flex;
    height: 100vh;
}

/* Glassmorphism utility */
.glass-panel {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-glass);
}


/* Mobile elements hidden on desktop */
.mobile-navbar {
    display: none !important;
}
.sidebar-overlay {
    display: none !important;
}

/* Sidebar */
.sidebar {
    width: 260px;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 24px 0;
    border-right: 1px solid var(--border-color);
    z-index: 10;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (min-width: 769px) {
    .sidebar.collapsed {
        width: 80px;
    }

    .sidebar.collapsed .sidebar-title,
    .sidebar.collapsed .nav-section-title span,
    .sidebar.collapsed .table-search-li,
    .sidebar.collapsed .table-name-text,
    .sidebar.collapsed .user-details,
    .sidebar.collapsed .btn-text-label {
        display: none;
        pointer-events: none;
    }

    .sidebar.collapsed .sidebar-header {
        padding: 0 0 32px 0;
        justify-content: center;
    }

    .sidebar.collapsed .sidebar-bottom-actions {
        flex-direction: column;
        align-items: center;
        gap: 12px;
    }

    .sidebar.collapsed .sidebar-bottom-actions .btn {
        width: 45px;
        height: 45px;
        padding: 0;
        justify-content: center;
        border-radius: 50%;
    }


    .sidebar.collapsed .logo-icon {
        display: none;
        /* Hide logo to show only toggle button centered, or keep logo and hide toggle? Let's hide logo and center toggle */
    }

    .sidebar.collapsed .nav-link {
        justify-content: center;
        padding: 12px;
    }

    .sidebar.collapsed .nav-link i {
        margin: 0;
    }

    .sidebar.collapsed .user-avatar-container {
        justify-content: center;
        margin-bottom: 16px;
    }

    .sidebar.collapsed .sidebar-bottom-actions {
        flex-direction: column;
    }

    .sidebar.collapsed .sidebar-edit-mode-container {
        justify-content: center !important;
        padding: 0 !important;
    }
}

.sidebar-toggle-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.sidebar-toggle-btn:hover {
    color: var(--primary);
}

.sidebar.collapsed .sidebar-toggle-btn {
    margin: 0 auto;
}

.user-details,
.btn-text-label,
.table-name-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 24px 32px 24px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.5px;
    color: var(--primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

.logo-icon {
    color: var(--primary);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 24px 12px;
}

.sidebar-nav ul {
    list-style: none;
}

.nav-section-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 1px;
    padding: 0 12px 12px 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    font-weight: 500;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.nav-link:hover,
.nav-link.active {
    background: var(--secondary);
    color: var(--text-main);
    transform: translateX(4px);
    box-shadow: -4px 0 0 var(--primary);
}

.nav-link i {
    width: 18px;
    height: 18px;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 32px;
    overflow: hidden;
    position: relative;
}

.audits-container {
    flex: 1;
    padding: 40px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.top-header {
    margin-bottom: 24px;
}

.top-header h1 {
    font-size: 1.8rem;
    font-weight: 400;
    letter-spacing: -0.5px;
}

.welcome-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--text-muted);
    animation: fadeIn 0.5s ease;
}

.welcome-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    color: var(--primary);
    opacity: 0.5;
}

/* Table Container Area */
.table-container {
    flex: 1;
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.4s ease;
}

.table-actions {
    padding: 16px 24px;
    display: flex;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
    background: var(--secondary);
}

.table-scroll-area {
    flex: 1;
    overflow: auto;
    padding: 0;
}

/* Base Data Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.data-table th,
.data-table td {
    padding: 12px 24px;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background: var(--secondary);
    font-weight: 500;
    color: var(--text-muted);
    position: sticky;
    top: 0;
    z-index: 2;
    white-space: nowrap;
}

.data-table tbody tr {
    transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
    background: var(--secondary);
}

.cell-input {
    width: 100%;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    padding: 6px 8px;
    border-radius: 4px;
    transition: border-color var(--transition-fast), background var(--transition-fast);
    outline: none;
}

.cell-input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.1);
    border-bottom: 2px solid var(--primary);
}

.cell-input.locked-input {
    background: transparent !important;
    border-bottom: 2px solid transparent !important;
    cursor: default;
    color: var(--text-main);
}

.cell-input.locked-input:focus {
    background: transparent !important;
    border-bottom: 2px solid transparent !important;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    cursor: pointer;
    border: none;
    transition: all var(--transition-fast);
    outline: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: var(--success-hover);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.btn-secondary {
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--border-glass);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s;
}

#custom-confirm-modal {
    z-index: 9999;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(15px);
}

body.dark-theme #custom-confirm-modal {
    background: rgba(0, 0, 0, 0.9);
}


.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal {
    width: 400px;
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
}

#custom-confirm-modal .modal {
    width: 450px;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

body.dark-theme #custom-confirm-modal .modal {
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 30px 70px rgba(0, 0, 0, 1);
}

.confirm-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.confirm-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.confirm-title i {
    color: var(--warning);
    width: 24px;
    height: 24px;
}

.confirm-body {
    padding: 30px 24px;
}

#custom-confirm-message {
    color: var(--text-main);
    font-size: 1.1rem;
    font-weight: 500;
    line-height: 1.6;
    margin: 0;
}

.confirm-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.02);
}

body.dark-theme .confirm-footer {
    background: rgba(255, 255, 255, 0.03);
}

.confirm-btn-cancel {
    padding: 10px 20px;
}

.confirm-btn-accept {
    padding: 10px 30px;
    font-weight: 600;
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
}

.close-btn:hover {
    color: white;
}

.modal-body {
    padding: 24px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 1rem;
    color: var(--text-muted);
    font-weight: 500;
}

.input-neumorphic {
    width: 100%;
    padding: 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-glass);
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
}

.input-neumorphic::placeholder {
    font-size: 0.95rem;
    opacity: 0.7;
}

.input-neumorphic:focus {
    outline: none;
    border-color: var(--border-highlight);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

/* Fix para select y options en modo oscuro */
select.input-neumorphic {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23a0aec0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

body.dark-theme select option {
    background-color: #1b262c;
    color: #ffffff;
}

body.dark-theme select {
    color-scheme: dark;
    /* Ayuda a que algunos navegadores usen el estilo oscuro nativo */
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-glass);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.delete-row-btn {
    background: transparent;
    border: none;
    color: var(--danger);
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.delete-row-btn:hover {
    opacity: 1;
}

/* Empty Cell Placeholder */
.empty-cell {
    background: rgba(255, 100, 100, 0.05);
    /* Slight tint to denote empty */
    border: 1px dashed rgba(255, 255, 255, 0.2) !important;
}

.empty-placeholder {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.8rem;
    pointer-events: none;
    /* Let clicks pass through to input */
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Auth Pages */
.auth-bg {
    display: flex;
    align-items: center;
    justify-content: center;
    background-image: radial-gradient(circle at center, rgba(0, 122, 51, 0.15) 0%, transparent 70%);
    overflow-y: auto;
}

.auth-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.auth-card {
    padding: 32px 40px;
    border-radius: var(--radius-lg);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.logo-large {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    color: var(--primary);
}

.auth-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 24px;
}

.btn-block {
    width: 100%;
    justify-content: center;
    padding: 12px;
    font-size: 1rem;
    margin-top: 16px;
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.auth-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.auth-footer a:hover {
    text-decoration: underline;
}

.btn-link {
    background: none;
    border: none;
    color: var(--primary-hover);
    cursor: pointer;
    font-family: inherit;
}

.btn-link:hover {
    text-decoration: underline;
}

/* Ajustes responsivos para la tarjeta de registro vertical y compacta */
.register-container {
    width: 100%;
    max-width: 420px;
}

.register-card {
    padding: 16px 28px 20px 28px;
}

.register-card .auth-header {
    margin-bottom: 16px;
}

.register-card .auth-header h2 {
    font-size: 1.5rem;
}

.register-card .form-group {
    margin-bottom: 10px;
}

.register-card .form-group label {
    margin-bottom: 4px;
    font-size: 0.85rem;
}

.register-card .input-neumorphic {
    padding: 8px 12px;
    font-size: 0.9rem;
}

.register-card .btn-block {
    padding: 10px;
    font-size: 0.95rem;
    margin-top: 12px;
}

.register-card .auth-footer {
    margin-top: 16px;
}

/* Animación de temblor (shake) y resaltado en negrita para el paso de confirmación */
@keyframes shake-gentle {
    0%, 100% { transform: translate(0, 0); }
    15%, 45%, 75% { transform: translate(-4px, 0); }
    30%, 60%, 90% { transform: translate(4px, 0); }
}

.highlight-shake {
    font-weight: 700 !important;
    color: var(--text-main) !important;
    display: inline-block;
    animation: shake-gentle 0.5s ease-in-out;
}

/* Dashboard Cards */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}

.stat-card {
    border-radius: var(--radius-md);
    overflow: hidden;
}

.stat-header {
    padding: 12px 16px;
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

.stat-body {
    padding: 20px;
    color: var(--text-muted);
    font-size: 1.05rem;
}

.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
}

.template-card {
    padding: 24px;
    text-align: center;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: transform var(--transition-fast), background var(--transition-fast);
}

.template-card:hover {
    transform: translateY(-4px);
    background: rgba(255, 255, 255, 0.05);
}

.template-icon {
    margin-bottom: 12px;
}

.template-icon i {
    width: 32px;
    height: 32px;
}

/* Settings 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: var(--secondary-hover);
    border: 1px solid var(--border-color);
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    transition: .4s;
}

input:checked+.slider {
    background-color: var(--primary);
}

input:checked+.slider:before {
    transform: translateX(20px);
}

.slider.round {
    border-radius: 24px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Side Panel */
.side-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.3);
    transition: right 0.3s ease;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.side-panel.open {
    right: 0;
}

.panel-header {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.panel-body {
    padding: 20px;
    flex: 1;
    overflow-y: auto;
}

.panel-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.search-results {
    margin-top: 10px;
    max-height: 200px;
    overflow-y: auto;
}

.search-item {
    padding: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
}

.search-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    margin-bottom: 8px;
}

.qty-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.qty-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    cursor: pointer;
}

.qty-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* --- Builder Styles --- */
.builder-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 24px;
    height: calc(100vh - 120px);
    margin-top: 20px;
}

.builder-toolbox {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.draggable-item {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    padding: 12px 16px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: grab;
    transition: all 0.2s;
    user-select: none;
}

.draggable-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--primary);
    transform: translateY(-2px);
}

.draggable-item:active {
    cursor: grabbing;
}

.draggable-item.dragging {
    opacity: 0.5;
    border-style: dashed;
}

.builder-canvas {
    overflow-y: auto;
    padding-right: 12px;
}

.drop-zone {
    min-height: 400px;
    border: 2px dashed rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: all 0.3s;
    background: rgba(0, 0, 0, 0.05);
}

.drop-zone-active {
    border-color: var(--primary);
    background: rgba(59, 130, 246, 0.05);
    box-shadow: inset 0 0 20px rgba(59, 130, 246, 0.1);
}

.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    gap: 12px;
}

.field-config-card {
    display: grid;
    grid-template-columns: 40px 1fr 40px;
    align-items: center;
    padding: 20px;
    gap: 16px;
    animation: slideIn 0.3s ease-out;
}

.field-options-group {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field-options-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.field-hint {
    font-size: 0.95rem;
    color: var(--text-muted);
    background: rgba(12, 186, 85, 0.05);
    padding: 10px 14px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px dashed rgba(12, 186, 85, 0.2);
    margin-top: 8px;
}

.field-hint i {
    color: var(--primary);
    opacity: 0.8;
}


@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.field-drag-handle {
    cursor: grab;
    color: var(--text-muted);
    display: flex;
    justify-content: center;
}

.field-type-badge {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--primary);
    background: rgba(59, 130, 246, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

.field-name-input {
    width: 100%;
}

.spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* ---- Dashboard Templates Panel ---- */
#template-suggestion-panel {
    padding: 40px 30px !important;
    border-radius: 20px !important;
    background: rgba(255, 255, 255, 0.03) !important;
    backdrop-filter: blur(15px);
    border: 1px solid var(--border-glass) !important;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2) !important;
}

.suggestion-item {
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    overflow: visible !important;
}

.suggestion-item:hover {
    transform: translateY(-4px);
    background: var(--secondary) !important;
    border-color: var(--primary) !important;
    z-index: 5;
}

.column-tag {
    display: inline-block;
    background: rgba(var(--primary-rgb), 0.1);
    color: var(--primary);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    margin-right: 4px;
    margin-top: 4px;
}

.columns-preview {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 0;
    width: 100%;
    background: var(--secondary);
    border: 1px solid var(--border-glass);
    padding: 12px;
    border-radius: 12px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
    display: none;
    z-index: 100;
    animation: slideInUp 0.2s ease;
}

.suggestion-item:hover .columns-preview {
    display: block;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---- Toast Notifications ---- */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 9999;
}

.toast {
    padding: 16px 24px;
    border-radius: 12px;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    color: var(--text-main);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    animation: slideInRight 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transition: all 0.3s ease;
}

.toast.hiding {
    transform: translateX(120%);
    opacity: 0;
}

.toast-success {
    border-left: 4px solid var(--success);
}

.toast-error {
    border-left: 4px solid var(--danger);
}

.toast-info {
    border-left: 4px solid var(--primary);
}

.toast-warning {
    border-left: 4px solid var(--warning);
}

.toast-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-content {
    flex: 1;
    font-size: 0.9rem;
    line-height: 1.4;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ---- Mobile Responsiveness ---- */
@media (max-width: 768px) {
    body {
        overflow-y: auto !important;
    }

    .app-container {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
        overflow: visible;
    }

    .mobile-navbar {
        display: flex !important;
        align-items: center;
        height: 60px;
        padding: 0 20px;
        border-bottom: 1px solid var(--border-color);
        z-index: 99;
        flex-shrink: 0;
        position: sticky;
        top: 0;
    }

    .mobile-menu-btn {
        background: transparent;
        border: none;
        color: var(--primary);
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 8px;
        margin-right: 12px;
        border-radius: 8px;
        transition: background 0.2s;
    }

    .mobile-menu-btn:hover {
        background: rgba(255, 255, 255, 0.05);
    }

    .mobile-logo {
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .mobile-logo i {
        color: var(--primary);
        width: 24px;
        height: 24px;
    }

    .mobile-title {
        font-size: 1.25rem;
        font-weight: 600;
        color: var(--text-main);
        letter-spacing: -0.5px;
    }

    .sidebar-overlay {
        display: block !important;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.4);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        z-index: 999;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }

    .sidebar-overlay.active {
        opacity: 1;
        visibility: visible;
        pointer-events: all;
    }

    .sidebar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 280px !important;
        height: 100% !important;
        height: 100dvh !important;
        border-right: 1px solid var(--border-color) !important;
        border-bottom: none !important;
        padding: 24px 0 !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 20px !important;
        z-index: 1000 !important;
        transform: translateX(-100%) !important;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    }

    .sidebar.mobile-open {
        transform: translateX(0) !important;
    }

    .sidebar-header {
        border-bottom: 1px solid var(--border-color);
        padding-bottom: 24px;
    }

    .sidebar-footer {
        padding: 16px 20px calc(16px + env(safe-area-inset-bottom, 16px)) 20px !important;
    }

    .main-content {
        padding: 20px 16px;
        flex: 1;
        min-height: auto;
        overflow-y: visible;
        -webkit-overflow-scrolling: touch;
    }

    .audits-container {
        padding: 20px 16px !important;
        overflow-y: visible !important;
        height: auto !important;
    }

    .table-actions {
        flex-direction: column;
        align-items: stretch;
    }

    /* Builder Layout Mobile */
    .builder-layout {
        grid-template-columns: 1fr !important;
        height: auto !important;
        gap: 16px !important;
    }

    .builder-toolbox {
        height: auto !important;
        padding: 16px !important;
    }

    .builder-canvas {
        padding-right: 0 !important;
    }

    /* Tablas con scroll horizontal en móvil */
    .data-table {
        min-width: 750px !important;
    }
}

/* Sidebar Badge */
.sidebar-badge {
    background-color: var(--danger);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 12px;
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
    animation: pulseBadge 2s infinite;
}

@keyframes pulseBadge {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Modo Edicion (Admin) */
.admin-edit-element {
    display: none !important;
}

body.edit-mode-active .admin-edit-element {
    display: inline-flex !important;
}

body.edit-mode-active td .admin-edit-element {
    display: inline-block !important; /* For buttons inside table cells */
}

body.edit-mode-active .welcome-screen .admin-edit-element {
    display: inline-flex !important; /* For the "Crear Mi Propia Tabla" button */
}

/* Superuser Role Switcher */
.superuser-switcher-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(243, 156, 18, 0.35);
    border-radius: 10px;
    padding: 8px 10px;
    margin-top: 4px;
    box-shadow: 0 4px 12px rgba(243, 156, 18, 0.08);
    transition: all 0.2s ease;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.superuser-switcher-card:hover {
    border-color: rgba(243, 156, 18, 0.6);
    box-shadow: 0 4px 16px rgba(243, 156, 18, 0.15);
}

.superuser-switcher-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.superuser-switcher-header-text {
    font-size: 0.68rem;
    font-weight: 700;
    color: #f39c12;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.su-crown-icon {
    width: 14px;
    height: 14px;
    color: #f39c12;
    flex-shrink: 0;
}

.superuser-role-selector {
    display: flex;
    gap: 4px;
    width: 100%;
}

.su-role-btn {
    flex: 1;
    min-width: 0;
    padding: 5px 2px;
    font-size: 0.7rem;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-muted, #94a3b8);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.su-role-btn:hover {
    background: rgba(243, 156, 18, 0.15);
    color: #f39c12;
    border-color: rgba(243, 156, 18, 0.4);
}

.su-role-btn.active {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: #ffffff;
    border-color: #f39c12;
    box-shadow: 0 2px 6px rgba(243, 156, 18, 0.4);
}

.su-btn-label-full {
    display: inline;
}

.su-btn-label-short {
    display: none;
}

/* Centered role for non-superusers in expanded sidebar */
.user-sidebar-section.non-superuser .user-details-row {
    justify-content: center;
}

/* Collapsed Sidebar Adjustments */
@media (min-width: 769px) {
    .sidebar.collapsed .user-details-row,
    .sidebar.collapsed .user-details {
        display: none !important;
        pointer-events: none;
    }

    .sidebar.collapsed .user-sidebar-section {
        padding: 6px 8px 10px !important;
        align-items: center;
    }

    .sidebar.collapsed .superuser-switcher-card {
        padding: 6px 4px;
        margin-top: 2px;
        border-color: rgba(243, 156, 18, 0.25);
    }

    .sidebar.collapsed .superuser-switcher-header {
        justify-content: center;
        margin-bottom: 6px;
    }

    .sidebar.collapsed .superuser-switcher-header-text {
        display: none !important;
    }

    .sidebar.collapsed .superuser-role-selector {
        flex-direction: column;
        gap: 4px;
        align-items: center;
    }

    .sidebar.collapsed .su-role-btn {
        width: 100%;
        max-width: 36px;
        height: 28px;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 0.75rem;
    }

    .sidebar.collapsed .su-btn-label-full {
        display: none !important;
    }

    .sidebar.collapsed .su-btn-label-short {
        display: inline-block !important;
        font-weight: 700;
    }
}




