:root {
    --primary: #3498db;
    --primary-hover: #2980b9;
    --primary-light: rgba(52, 152, 219, 0.1);
    --bg-body: #f4f7f6;
    --bg-card: #ffffff;
    --text-main: #2c3e50;
    --text-muted: #7f8c8d;
    --border: #e2e8f0;
    --success: #2ecc71;
    --danger: #e74c3c;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* LAYOUT */
.app-container {
    min-height: 100vh;
    display: flex;
    position: relative;
    overflow-x: hidden;
}

.view {
    width: 100%;
    min-height: 100vh;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ----------------- LOGIN VIEW ----------------- */
.login-view {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f4f7f6 0%, #e2e8f0 100%);
}

.login-card {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    z-index: 10;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-main);
}

.login-header p {
    color: var(--text-muted);
    font-size: 14px;
}

/* Form Elements */
.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-main);
}

.input-group input[type="text"],
.input-group input[type="password"],
select.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.2s ease;
    background: #fff;
    font-family: inherit;
}

.input-group input:focus,
select.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    position: relative;
}

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

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-block {
    width: 100%;
}

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 20px;
    font-weight: 500;
}

.alert-danger {
    background-color: rgba(231, 76, 60, 0.1);
    color: var(--danger);
    border: 1px solid rgba(231, 76, 60, 0.2);
}

/* Background Blobs for Login */
.blob {
    position: absolute;
    filter: blur(60px);
    z-index: 1;
    border-radius: 50%;
    animation: float 8s ease-in-out infinite;
}

.blob-1 {
    top: 10%;
    left: 20%;
    width: 300px;
    height: 300px;
    background: rgba(52, 152, 219, 0.3);
}

.blob-2 {
    bottom: 10%;
    right: 20%;
    width: 400px;
    height: 400px;
    background: rgba(155, 89, 182, 0.2);
    animation-delay: -4s;
}

@keyframes float {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-20px) scale(1.05); }
}

/* ----------------- DASHBOARD VIEW ----------------- */
.dashboard-view {
    display: flex;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

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

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon {
    width: 36px;
    height: 36px;
    background: var(--primary);
    color: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 16px;
}

.brand-text {
    font-weight: 700;
    font-size: 18px;
    letter-spacing: -0.5px;
}

.sidebar-nav {
    padding: 24px 16px;
    flex: 1;
}

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

.sidebar-nav li {
    margin-bottom: 8px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.sidebar-nav li.active a {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

.sidebar-nav a:hover:not(.text-danger) {
    background: rgba(0,0,0,0.03);
    color: var(--text-main);
}

.text-danger {
    color: var(--danger) !important;
}
.text-danger:hover {
    background: rgba(231, 76, 60, 0.1) !important;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: calc(100vw - 260px);
}

.topbar {
    height: 72px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
}

.page-title h1 {
    font-size: 20px;
    font-weight: 600;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    font-size: 14px;
}

.user-role {
    font-size: 12px;
    color: var(--text-muted);
}

.content-wrapper {
    padding: 32px;
    max-width: 1000px;
    margin: 0 auto;
    width: 100%;
    flex: 1;
    overflow-y: auto;
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    margin-bottom: 24px;
    overflow: hidden;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    background: rgba(0,0,0,0.01);
}

.card-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.card-body {
    padding: 24px;
}

.status-card {
    border-left: 4px solid var(--text-muted);
    transition: all 0.3s ease;
}

.status-card.active {
    border-left-color: var(--success);
}

.status-card h3 {
    font-size: 18px;
    margin-bottom: 4px;
}

/* Switch Toggle */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
    flex-shrink: 0;
}

.switch-sm {
    width: 40px;
    height: 22px;
}

.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;
}

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

.switch-sm .slider:before {
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
}

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

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

.switch-sm input:checked + .slider:before {
    transform: translateX(18px);
}

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

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

/* Grid Layout for Forms */
.config-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

input[type="color"] {
    -webkit-appearance: none;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    padding: 0;
    background: none;
}
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch { border: 1px solid var(--border); border-radius: 8px; }

.color-hex {
    font-family: monospace;
    font-size: 14px;
    color: var(--text-muted);
}

.text-xs { font-size: 12px; }
.mb-2 { margin-bottom: 8px; }
.mt-4 { margin-top: 24px; }
.d-flex { display: flex; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }

.toggle-group {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--bg-body);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.toggle-info label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 2px;
}

.toggle-info span {
    font-size: 12px;
    color: var(--text-muted);
}

.form-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
    padding-top: 20px;
}

/* Overlay */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: 0.3s ease;
}
.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* User Dropdown */
.user-profile {
    position: relative;
    cursor: pointer;
}
.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 10px;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    min-width: 180px;
    z-index: 100;
    padding: 8px 0;
    transition: all 0.2s ease;
}
.user-dropdown.hidden {
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
}
.user-dropdown a {
    display: block;
    padding: 10px 20px;
    color: #495057;
    text-decoration: none;
    font-size: 0.95rem;
    transition: 0.2s;
}
.user-dropdown a:hover {
    background: #f8f9fa;
}
.user-dropdown a.text-danger {
    color: #dc3545;
}

/* Backups Grid */
.backups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}
.backup-card {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: all 0.2s;
}
.backup-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
.backup-card .backup-icon {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 15px;
}
.backup-card .backup-title {
    font-weight: 600;
    margin-bottom: 5px;
    color: #333;
}
.backup-card .backup-date {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 15px;
}
.backup-card.empty .backup-icon {
    color: #ccc;
}
.backup-card.empty .backup-title {
    color: #999;
}

.btn-lg {
    padding: 14px 32px;
    font-size: 16px;
}

.shop-link-container {
    padding: 16px 24px;
    background: rgba(46, 204, 113, 0.1);
    border-top: 1px solid rgba(46, 204, 113, 0.2);
    font-size: 14px;
    color: #27ae60;
    font-weight: 500;
}

.shop-url {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
}

.shop-url:hover {
    text-decoration: underline;
}

/* Spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.8s linear infinite;
    position: absolute;
}

.btn.loading .btn-text {
    opacity: 0;
}
.btn.loading .spinner {
    display: block !important;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Toast */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--bg-card);
    border-left: 4px solid var(--success);
    box-shadow: var(--shadow-lg);
    border-radius: 8px;
    padding: 16px 24px;
    z-index: 1000;
    animation: slideIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toast-icon {
    color: var(--success);
    font-weight: bold;
    font-size: 18px;
}

.toast-message {
    font-weight: 500;
    font-size: 14px;
}

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

/* Responsive */
@media (max-width: 768px) {
    .config-grid {
        grid-template-columns: 1fr;
    }
    .sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        height: 100vh;
        z-index: 1001; /* Sobre el overlay */
        transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    }
    .sidebar.open {
        left: 0;
    }
    .main-content {
        max-width: 100%;
        margin-left: 0 !important;
    }
    .topbar {
        padding: 0 15px; /* Menos padding en celular */
        gap: 10px;
    }
    .page-title h1 {
        font-size: 16px; /* Letra un poco más chica */
        white-space: normal; /* Permite 2 renglones */
        line-height: 1.2;
        margin: 0;
    }
    .user-profile {
        gap: 8px;
    }
    .user-name {
        max-width: 90px !important; /* Evita que el nombre empuje demasiado */
    }
    .btn-menu-mobile {
        display: block !important;
    }
    .btn-close-sidebar {
        display: block !important;
    }
    #shop-link-container {
        flex-direction: column !important;
        text-align: center;
    }
    #shop-link-container > div:last-child {
        border-left: none !important;
        padding-left: 0 !important;
        border-top: 1px dashed #bbf7d0;
        padding-top: 20px;
        margin-top: 10px;
        width: 100%;
    }
}

/* Sidebar Dropdown & Separators */
.has-dropdown > .nav-link { justify-content: space-between; }
.dropdown-menu {
    list-style: none;
    padding-left: 0;
    margin: 5px 15px 5px 15px;
    border-radius: 8px;
    overflow: hidden;
}
.dropdown-menu li a {
    display: block;
    padding: 10px 15px;
    font-size: 0.95em;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}
.dropdown-menu li a:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--primary);
}
.dropdown-menu li a.active {
    color: var(--primary);
    font-weight: 600;
    border-left-color: var(--primary);
    background: var(--primary-light);
}
.has-dropdown.open > .nav-link { background: transparent; color: var(--text-main); }
.has-dropdown.open > .nav-link:hover { background: rgba(0,0,0,0.03); }

/* Subtle Separators for Sidebar */
.sidebar-nav ul li.nav-item {
    border-bottom: 1px solid rgba(0,0,0,0.04);
}
.sidebar-nav ul li.nav-item:last-child {
    border-bottom: none;
}
.dropdown-menu li {
    border-bottom: 1px solid rgba(0,0,0,0.04);
}
.dropdown-menu li:last-child {
    border-bottom: none;
}

/* ----------------- PRECIOS VIEW ----------------- */
.table-precios { width: 100%; border-collapse: collapse; margin-top: 20px; }
.table-precios th, .table-precios td { padding: 12px; text-align: left; }
.table-precios th { background: #f8f9fa; font-weight: 600; color: #555; border-bottom: 2px solid #ddd; }
.precio-input { width: 100%; max-width: 120px; padding: 8px; border: 1px solid #ddd; border-radius: 4px; text-align: right; }
.precio-input:focus { border-color: var(--primary); outline: none; }

.dataTables_wrapper .dataTables_filter input { border: 1px solid #ddd; border-radius: 4px; padding: 6px; margin-left: 8px; }
.dataTables_wrapper .dataTables_length select { border: 1px solid #ddd; border-radius: 4px; padding: 4px; }

.precios-header {
    display: flex; flex-direction: column; gap: 15px;
}
.header-actions {
    display: flex; flex-direction: column; gap: 10px; width: 100%;
}
.header-actions-top { display: flex; justify-content: flex-start; }
.header-actions-bottom { display: flex; gap: 10px; }

.header-actions .btn {
    padding: 8px 16px; font-weight: 500; font-size: 0.95rem; display: flex; align-items: center; gap: 8px; border-radius: 6px; justify-content: center; flex: 1;
}
.header-actions select {
    padding: 8px 12px; border-radius: 6px; border: 1px solid #ddd; outline: none; font-size: 0.95rem; width: 100%;
}
.header-actions select:focus {
    border-color: var(--primary);
}
@media (min-width: 768px) {
    .precios-header { flex-direction: row; justify-content: space-between; align-items: center; }
    .header-actions { width: auto; align-items: flex-end; }
    .header-actions-top { justify-content: flex-end; }
    .header-actions select { width: auto; min-width: 200px; }
    .header-actions .btn { flex: none; }
}

/* Modal Styles */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); display: flex; justify-content: center; align-items: center;
    z-index: 1000; opacity: 0; visibility: hidden; transition: 0.3s;
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal-box {
    background: white; padding: 25px; border-radius: 8px; width: 90%; max-width: 400px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2); transform: translateY(-20px); transition: 0.3s;
}
.modal-overlay.active .modal-box { transform: translateY(0); }

/* ----------------- CAJA VIEW ----------------- */
.table-custom { width: 100%; border-collapse: collapse; margin-top: 20px; }
.table-custom th, .table-custom td { padding: 12px; text-align: left; border-bottom: 1px solid #ddd; }
.table-custom th { background: #f8f9fa; font-weight: 600; color: #555; border-bottom: 2px solid #ddd; }

.dt-buttons { margin-bottom: 15px; }
.dt-button { background: #28a745 !important; color: white !important; border: none !important; border-radius: 4px !important; padding: 6px 12px !important; }

.badge { padding: 4px 8px; border-radius: 12px; font-size: 12px; font-weight: 600; }
.badge-ingreso { background: #d4edda; color: #155724; }
.badge-egreso { background: #f8d7da; color: #721c24; }
.badge-pendiente { background: #fff3cd; color: #856404; }
.badge-completada { background: #d4edda; color: #155724; }
.badge-cancelada { background: #f8d7da; color: #721c24; }
.badge-activo { background: #d4edda; color: #155724; }
.badge-inactivo { background: #f8d7da; color: #721c24; }

.filter-bar { background: #f8f9fa; padding: 15px; border-radius: 8px; margin-bottom: 20px; display: flex; gap: 15px; align-items: center; border: 1px solid #ddd; }
.filter-bar label { font-weight: 600; margin-right: 5px; }
.filter-bar input[type="date"] { padding: 8px; border: 1px solid #ccc; border-radius: 4px; }
.filter-bar button { padding: 8px 15px; background: var(--primary); color: white; border: none; border-radius: 4px; cursor: pointer; font-weight: bold; }

.btn-hoy { padding: 8px 15px; background: #6c757d; color: white; border: none; border-radius: 4px; cursor: pointer; font-weight: bold; text-decoration: none; display: inline-block; }
.btn-hoy:hover { background: #5a6268; color: white; }

/* ----------------- PRODUCTOS VIEW ----------------- */
.table-productos { width: 100%; border-collapse: collapse; margin-top: 20px; }
.table-productos th, .table-productos td { padding: 12px; text-align: left; vertical-align: middle; }
.table-productos th { background: #f8f9fa; font-weight: 600; color: #555; border-bottom: 2px solid #ddd; }

.img-preview {
    width: 60px; height: 60px; object-fit: cover; border-radius: 8px; border: 1px solid #ddd;
    background: #f8f9fa; display: flex; justify-content: center; align-items: center;
}
.img-preview img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.img-preview i { color: #ccc; font-size: 24px; }

.btn-upload { background: var(--primary); color: white; border: none; padding: 6px 12px; border-radius: 4px; cursor: pointer; font-size: 0.9em; font-weight: 500; }
.btn-upload:hover { background: var(--primary-hover); }

/* ----------------- SUSCRIPCIONES VIEW ----------------- */
.subs-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; margin-top: 20px; }
.sub-card { background: white; border: 1px solid #ddd; border-radius: 12px; padding: 25px; text-align: center; box-shadow: 0 4px 6px rgba(0,0,0,0.05); }
.sub-card h3 { color: var(--primary); margin-bottom: 10px; font-size: 1.5rem; }
.sub-card .price { font-size: 2rem; font-weight: 700; color: #333; margin: 15px 0; }
.sub-card ul { list-style: none; padding: 0; text-align: left; margin-bottom: 20px; color: #555; }
.sub-card ul li { padding: 8px 0; border-bottom: 1px solid #eee; font-size: 0.95rem; }
.sub-card ul li i { color: #28a745; margin-right: 8px; }
.btn-pay { background: var(--primary); color: white; border: none; padding: 12px; width: 100%; border-radius: 6px; font-weight: bold; cursor: pointer; font-size: 1rem; transition: background 0.3s; }
.btn-pay:hover { background: var(--primary-hover); }
.btn-pay-web { background: #28a745; }
.btn-pay-web:hover { background: #218838; }
.disclaimer { background: #fff3cd; color: #856404; padding: 15px; border-radius: 8px; font-size: 0.9rem; margin-top: 25px; border: 1px solid #ffeeba; }

.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); z-index: 1000; align-items: center; justify-content: center; }
.modal.active { display: flex; }
.modal-content { background: white; padding: 30px; border-radius: 12px; width: 400px; max-width: 90%; text-align: center; }
.modal-content h3 { margin-bottom: 15px; }
.modal-content select { width: 100%; padding: 10px; border-radius: 6px; border: 1px solid #ccc; margin-bottom: 20px; font-size: 1rem; }

/* ----------------- PERFIL & GENERAL FORMS ----------------- */
.profile-container { max-width: 600px; margin: 0 auto; padding: 20px; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 500; color: #333; }
.form-control { width: 100%; padding: 12px; border: 1px solid #ddd; border-radius: 6px; box-sizing: border-box; }
.form-control:focus { outline: none; border-color: var(--primary); }
.alert-box { padding: 12px; border-radius: 6px; margin-bottom: 20px; }
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-danger { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

/* ----------------- 404 ERROR PAGE ----------------- */
body.error-page { display: flex; align-items: center; justify-content: center; height: 100vh; margin: 0; text-align: center; }
.error-container { max-width: 500px; padding: 40px; background: white; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.05); }
.error-container h1 { font-size: 80px; margin: 0; color: var(--primary); }
.error-container h2 { font-size: 24px; margin-top: 10px; color: #2c3e50; }
.error-container p { color: #7f8c8d; margin-bottom: 30px; }
.error-container a { display: inline-block; background-color: var(--primary); color: white; text-decoration: none; padding: 12px 25px; border-radius: 6px; font-weight: 500; transition: background-color 0.3s; }
.error-container a:hover { background-color: var(--primary-hover); }

/* ----------------- DATATABLES RESPONSIVE STYLES ----------------- */
table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control, 
table.dataTable.dtr-inline.collapsed > tbody > tr > th.dtr-control {
    position: relative !important;
    padding-left: 45px !important;
}

table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control::before, 
table.dataTable.dtr-inline.collapsed > tbody > tr > th.dtr-control::before {
    content: '+' !important;
    background-color: var(--primary) !important;
    border: none !important;
    border-radius: 50% !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
    color: white !important;
    font-family: 'Inter', sans-serif !important;
    font-size: 14px !important;
    font-weight: bold !important;
    line-height: 16px !important;
    width: 24px !important;
    height: 24px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin-right: 0 !important;
    position: absolute !important;
    left: 10px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    transition: transform 0.2s ease, background-color 0.2s ease !important;
}

table.dataTable.dtr-inline.collapsed > tbody > tr.parent > td.dtr-control::before, 
table.dataTable.dtr-inline.collapsed > tbody > tr.parent > th.dtr-control::before {
    content: '-' !important;
    background-color: #dc3545 !important;
    transform: translateY(-50%) !important;
}

/* DataTables Inputs */
.dataTables_wrapper .dataTables_filter input {
    border: 1px solid #ced4da !important;
    border-radius: 6px !important;
    padding: 6px 12px !important;
    margin-left: 8px !important;
    outline: none !important;
    transition: border-color 0.2s, box-shadow 0.2s !important;
}
.dataTables_wrapper .dataTables_filter input:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(0, 158, 227, 0.2) !important;
}
.dataTables_wrapper .dataTables_length select {
    border: 1px solid #ced4da !important;
    border-radius: 6px !important;
    padding: 6px 30px 6px 12px !important;
    outline: none !important;
    transition: border-color 0.2s !important;
    appearance: none;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center/10px;
}
.dataTables_wrapper .dataTables_length select:focus {
    border-color: var(--primary) !important;
}

/* Child Row Styling */
table.dataTable > tbody > tr.child ul.dtr-details {
    display: block;
    width: 100%;
    padding: 10px 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #eef0f2;
    margin: 5px 0;
}

table.dataTable > tbody > tr.child ul.dtr-details > li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px dashed #ddd;
}

table.dataTable > tbody > tr.child ul.dtr-details > li:last-child {
    border-bottom: none;
}

table.dataTable > tbody > tr.child span.dtr-title {
    font-weight: 600;
    color: #495057;
    margin-right: 15px;
    flex-shrink: 0;
}

table.dataTable > tbody > tr.child span.dtr-data {
    color: #333;
    text-align: right;
    word-break: break-word;
}

/* Fix for buttons in child rows */
table.dataTable > tbody > tr.child span.dtr-data button {
    margin-left: 5px;
    margin-bottom: 0 !important;
}

/* Custom DataTables styling */
.dataTables_wrapper .dataTables_length, .dataTables_wrapper .dataTables_filter { margin-bottom: 20px; }
table.dataTable { margin-top: 10px !important; margin-bottom: 20px !important; }

/* --- Toggle Switch --- */
.switch input:checked + .slider {
    background-color: var(--primary, #3498db);
}
.switch input:disabled + .slider {
    background-color: #e0e0e0;
    cursor: not-allowed;
}
.switch input:disabled + .slider:before {
    background-color: #999;
}

/* --- Filter Bar --- */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
    margin-bottom: 15px;
}
.filter-bar > div {
    display: flex;
    flex-direction: column;
}
.filter-bar label {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 5px;
}
.filter-bar input, .filter-bar select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: white;
    font-size: 14px;
}
.filter-bar button, .filter-bar .btn-hoy {
    padding: 8px 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    height: 38px;
    display: inline-flex;
    align-items: center;
}
.filter-bar .btn-hoy {
    background: #64748b;
}
.filter-bar .btn-hoy:hover {
    background: #475569;
}
