@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

:root {
    --primary: #6366f1;
    --primary-light: #eef2ff;
    --primary-dark: #4f46e5;
    --secondary: #10b981;
    --secondary-light: #ecfdf5;
    --accent: #f59e0b;
    --accent-light: #fffbeb;
    --danger: #ef4444;
    --danger-light: #fef2f2;
    --info: #3b82f6;
    --info-light: #eff6ff;
    --dark-bg: #0f172a;
    --darker-bg: #020617;
    --light-bg: #f8fafc;
    --card-bg: #ffffff;
    --border: #e2e8f0;
    --text: #0f172a;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.03);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --navbar-h: 60px;
    --sidebar-w: 240px;
    --sidebar-collapsed-w: 64px;
}

[data-bs-theme="dark"] {
    --primary: #818cf8;
    --primary-light: #1e1b4b;
    --primary-dark: #6366f1;
    --secondary: #34d399;
    --secondary-light: #022c22;
    --accent: #fbbf24;
    --accent-light: #451a03;
    --danger: #f87171;
    --danger-light: #450a0a;
    --info: #60a5fa;
    --info-light: #172554;
    --dark-bg: #0f172a;
    --darker-bg: #020617;
    --light-bg: #0f172a;
    --card-bg: #1e293b;
    --border: #334155;
    --text: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-light: #64748b;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
}

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--light-bg);
    color: var(--text);
    margin: 0;
    padding-top: var(--navbar-h);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========== LAYOUT ========== */
#layoutSidenav {
    display: flex;
    min-height: calc(100vh - var(--navbar-h));
}

#layoutSidenav_nav {
    width: var(--sidebar-w);
    flex-shrink: 0;
    transition: width var(--transition);
}

    #layoutSidenav_nav.collapsed {
        width: var(--sidebar-collapsed-w);
    }

#layoutSidenav_content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

main {
    flex: 1;
    padding: 1.25rem;
}

.page-content {
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* ========== NAVBAR ========== */
.planifi-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--navbar-h);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
    z-index: 1000;
}

[data-bs-theme="dark"] .planifi-navbar {
    background: rgba(15, 23, 42, 0.85);
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-toggle {
    width: 38px;
    height: 38px;
    border: none;
    background: transparent;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all var(--transition);
}

    .nav-toggle:hover {
        background: var(--primary-light);
        color: var(--primary);
    }

    .nav-toggle i {
        font-size: 1.35rem;
    }

.navbar-brand {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--primary), #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
    white-space: nowrap;
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.nav-option {
    position: relative;
}

.option-btn {
    width: 38px;
    height: 38px;
    border: none;
    background: transparent;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all var(--transition);
    position: relative;
}

    .option-btn:hover {
        background: var(--primary-light);
        color: var(--primary);
    }

    .option-btn i {
        font-size: 1.2rem;
    }

.notification-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 18px;
    height: 18px;
    background: var(--danger);
    color: #fff;
    border-radius: 50%;
    font-size: 0.6rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--card-bg);
}

.user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
}

.option-btn .user-avatar {
    border: 2px solid transparent;
    transition: border-color var(--transition);
}

.option-btn:hover .user-avatar {
    border-color: var(--primary);
}

.dropdown-menu-custom {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 280px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    z-index: 2000;
    overflow: hidden;
    animation: dropdownIn 0.15s ease-out;
}

@keyframes dropdownIn {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(0.96);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.dropdown-menu-custom.active {
    display: block;
}

.dropdown-header-custom {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

    .dropdown-header-custom h6 {
        margin: 0;
        font-size: 0.85rem;
        font-weight: 600;
        color: var(--text);
    }

.dropdown-body-custom {
    max-height: 320px;
    overflow-y: auto;
}

.dropdown-item-custom {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    color: var(--text);
    text-decoration: none;
    transition: background var(--transition);
    cursor: pointer;
}

    .dropdown-item-custom:hover {
        background: var(--primary-light);
    }

    .dropdown-item-custom i {
        width: 20px;
        text-align: center;
        color: var(--text-secondary);
        font-size: 1rem;
    }

    .dropdown-item-custom.danger {
        color: var(--danger);
    }

        .dropdown-item-custom.danger i {
            color: var(--danger);
        }

.dropdown-divider-custom {
    height: 1px;
    background: var(--border);
    margin: 0;
}

.dropdown-footer-custom {
    padding: 0.75rem 1.25rem;
    text-align: center;
    border-top: 1px solid var(--border);
}

.user-dropdown {
    min-width: 260px;
}

.user-dropdown-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem;
}

.user-dropdown-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
}

.user-dropdown-info {
    flex: 1;
    min-width: 0;
}

.user-dropdown-name {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-dropdown-email {
    margin: 2px 0 0;
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ========== SIDEBAR ========== */
.sidebar {
    position: fixed;
    top: var(--navbar-h);
    left: 0;
    width: var(--sidebar-w);
    height: calc(100vh - var(--navbar-h));
    background: var(--card-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width var(--transition);
    z-index: 100;
}

#layoutSidenav_nav.collapsed .sidebar {
    width: var(--sidebar-collapsed-w);
}

.sidebar-header {
    padding: 1rem 1rem 0.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.sidebar-toggle-close {
    display: none;
}

.sidebar-menu {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0.75rem;
}

    .sidebar-menu::-webkit-scrollbar {
        width: 3px;
    }

    .sidebar-menu::-webkit-scrollbar-thumb {
        background: var(--border);
        border-radius: 2px;
    }

.sidebar-section {
    margin-bottom: 0.25rem;
}

.sidebar-section-title {
    display: block;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-light);
    padding: 0.75rem 0.75rem 0.5rem;
}

#layoutSidenav_nav.collapsed .sidebar-section-title {
    display: none;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    margin-bottom: 2px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 10px;
    transition: all var(--transition);
    font-size: 0.875rem;
    font-weight: 500;
    position: relative;
    white-space: nowrap;
    overflow: hidden;
}

    .sidebar-item i {
        font-size: 1.1rem;
        width: 22px;
        text-align: center;
        flex-shrink: 0;
    }

    .sidebar-item:hover {
        background: var(--primary-light);
        color: var(--primary);
    }

    .sidebar-item.active {
        background: var(--primary-light);
        color: var(--primary);
        font-weight: 600;
    }

        .sidebar-item.active::before {
            content: '';
            position: absolute;
            left: 0;
            top: 50%;
            transform: translateY(-50%);
            width: 3px;
            height: 20px;
            background: var(--primary);
            border-radius: 0 3px 3px 0;
        }

.sidebar-item-text {
    overflow: hidden;
    text-overflow: ellipsis;
}

#layoutSidenav_nav.collapsed .sidebar-item-text,
#layoutSidenav_nav.collapsed .sidebar-badge {
    display: none;
}

#layoutSidenav_nav.collapsed .sidebar-item {
    justify-content: center;
    padding: 0.6rem;
}

    #layoutSidenav_nav.collapsed .sidebar-item i {
        font-size: 1.15rem;
        width: auto;
    }

.sidebar-badge {
    font-size: 0.6rem;
    font-weight: 700;
    padding: 0.15rem 0.4rem;
    background: var(--accent-light);
    color: var(--accent);
    border-radius: 4px;
    margin-left: auto;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 0.75rem;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.sidebar-footer-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user-name {
    margin: 0;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-status {
    margin: 1px 0 0;
    font-size: 0.65rem;
    color: var(--text-light);
}

#layoutSidenav_nav.collapsed .sidebar-user-info,
#layoutSidenav_nav.collapsed .sidebar-version {
    display: none;
}

#layoutSidenav_nav.collapsed .sidebar-footer {
    padding: 0.5rem;
}

#layoutSidenav_nav.collapsed .sidebar-footer-user {
    justify-content: center;
}

#layoutSidenav_nav.collapsed .sidebar-user-avatar {
    width: 28px;
    height: 28px;
}

.sidebar-version {
    display: block;
    text-align: center;
    font-size: 0.65rem;
    color: var(--text-light);
    margin-top: 0.5rem;
}

.sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition);
    pointer-events: none;
}

    .sidebar-overlay.active {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

/* ========== PAGE HEADER ========== */
.page-header-section {
    margin-bottom: 1.5rem;
}

    .page-header-section h1 {
        font-size: 1.5rem;
        font-weight: 700;
        color: var(--text);
        margin: 0;
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

        .page-header-section h1 i {
            color: var(--primary);
        }

    .page-header-section p {
        margin: 0.25rem 0 0;
        color: var(--text-secondary);
        font-size: 0.875rem;
    }

/* ========== CARDS ========== */
.card-planifi {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
    overflow: hidden;
}

    .card-planifi:hover {
        box-shadow: var(--shadow-lg);
    }

    .card-planifi .card-header {
        background: transparent;
        border-bottom: 1px solid var(--border);
        padding: 1.25rem 1.5rem;
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 0.75rem;
    }

        .card-planifi .card-header h5 {
            margin: 0;
            font-size: 1rem;
            font-weight: 600;
            color: var(--text);
        }

    .card-planifi .card-body {
        padding: 1.5rem;
    }

    .card-planifi .dataTables_wrapper .dt-layout-row:first-child,
    .card-planifi .dataTables_wrapper .dt-layout-row:last-child {
        background: transparent;
        border-color: var(--border);
    }

    .card-planifi .dataTables_wrapper .dt-layout-row:first-child {
        border-bottom: 1px solid var(--border);
    }

    .card-planifi .dataTables_wrapper .dt-layout-row:last-child {
        border-top: 1px solid var(--border);
    }

/* ========== DASHBOARD WIDGETS ========== */
.widget-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

    .widget-card:hover {
        box-shadow: var(--shadow-lg);
        transform: translateY(-2px);
    }

    .widget-card .widget-icon {
        width: 44px;
        height: 44px;
        border-radius: var(--radius);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.25rem;
        margin-bottom: 0.75rem;
    }

    .widget-card .widget-label {
        font-size: 0.8rem;
        font-weight: 500;
        color: var(--text-secondary);
        margin: 0 0 0.25rem;
    }

    .widget-card .widget-value {
        font-size: 1.5rem;
        font-weight: 700;
        color: var(--text);
        margin: 0;
    }

    .widget-card .widget-footer {
        margin-top: 0.75rem;
        padding-top: 0.75rem;
        border-top: 1px solid var(--border);
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

        .widget-card .widget-footer a {
            font-size: 0.8rem;
            font-weight: 600;
            color: var(--primary);
            text-decoration: none;
        }

            .widget-card .widget-footer a:hover {
                opacity: 0.8;
            }

/* Icon variants */
.widget-icon.primary {
    background: var(--primary-light);
    color: var(--primary);
}

.widget-icon.success {
    background: var(--secondary-light);
    color: var(--secondary);
}

.widget-icon.danger {
    background: var(--danger-light);
    color: var(--danger);
}

.widget-icon.accent {
    background: var(--accent-light);
    color: var(--accent);
}

.widget-icon.info {
    background: var(--info-light);
    color: var(--info);
}

/* ========== BUTTONS ========== */
.btn-planifi {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    padding: 0.625rem 1.25rem;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    line-height: 1;
}

    .btn-planifi:active {
        transform: scale(0.97);
    }

.btn-planifi-primary {
    background: var(--primary);
    color: #fff;
}

    .btn-planifi-primary:hover {
        background: var(--primary-dark);
        box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
        color: #fff;
    }

.btn-planifi-secondary {
    background: var(--border);
    color: var(--text);
}

    .btn-planifi-secondary:hover {
        background: #cbd5e1;
    }

[data-bs-theme="dark"] .btn-planifi-secondary:hover {
    background: #475569;
}

.btn-planifi-danger {
    background: var(--danger);
    color: #fff;
}

    .btn-planifi-danger:hover {
        background: #dc2626;
        box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35);
        color: #fff;
    }

.btn-planifi-ghost {
    background: transparent;
    color: var(--text-secondary);
}

    .btn-planifi-ghost:hover {
        background: var(--primary-light);
        color: var(--primary);
    }

.btn-planifi-sm {
    padding: 0.4rem 0.875rem;
    font-size: 0.8rem;
    border-radius: 8px;
}

.btn-planifi-lg {
    padding: 0.75rem 1.75rem;
    font-size: 1rem;
    border-radius: var(--radius);
}

.btn-planifi-icon {
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 10px;
}

/* ========== ACTION BUTTONS GROUP (MEJORADO) ========== */
.action-group {
    display: flex;
    gap: 0.375rem;
    justify-content: center;
}

.action-buttons {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: flex-start;
}

/* Base style para todos los botones de acción */
.btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1.5px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
    font-family: inherit;
}

    .btn-action i {
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 0.95rem;
    }

    /* Efecto hover universal (brillo de fondo) */
    .btn-action::before {
        content: '';
        position: absolute;
        inset: 0;
        background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
        opacity: 0;
        transition: opacity var(--transition);
        pointer-events: none;
    }

    .btn-action:hover::before {
        opacity: 1;
    }

/* ---- Botón VIEW (Azul/Info) ---- */
.btn-action-view, .btn-view {
    background: linear-gradient(135deg, var(--info) 0%, #1d4ed8 100%);
    border-color: #1d4ed8;
    color: #fff;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.25);
}

    .btn-action-view:hover, .btn-view:hover {
        background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
        border-color: #1e40af;
        box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
        transform: translateY(-2px);
    }

    .btn-action-view:active, .btn-view:active {
        transform: translateY(0);
        box-shadow: 0 2px 4px rgba(59, 130, 246, 0.25);
    }

    .btn-action-view i, .btn-view i {
        color: #fff;
    }

/* ---- Botón EDIT (Naranja/Warning) ---- */
.btn-action-edit, .btn-edit {
    background: linear-gradient(135deg, var(--accent) 0%, #d97706 100%);
    border-color: #b45309;
    color: #fff;
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.25);
}

    .btn-action-edit:hover, .btn-edit:hover {
        background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
        border-color: #92400e;
        box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
        transform: translateY(-2px);
    }

    .btn-action-edit:active, .btn-edit:active {
        transform: translateY(0);
        box-shadow: 0 2px 4px rgba(245, 158, 11, 0.25);
    }

    .btn-action-edit i, .btn-edit i {
        color: #fff;
    }

/* ---- Botón DELETE (Rojo/Danger) ---- */
.btn-action-delete, .btn-delete {
    background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
    border-color: #b91c1c;
    color: #fff;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.25);
}

    .btn-action-delete:hover, .btn-delete:hover {
        background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
        border-color: #7f1d1d;
        box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
        transform: translateY(-2px);
    }

    .btn-action-delete:active, .btn-delete:active {
        transform: translateY(0);
        box-shadow: 0 2px 4px rgba(239, 68, 68, 0.25);
    }

    .btn-action-delete i, .btn-delete i {
        color: #fff;
    }

/* ---- Botón LIST/SECONDARY (Verde) ---- */
.btn-action-list, .btn-list, .btn-action-secondary {
    background: linear-gradient(135deg, var(--secondary) 0%, #059669 100%);
    border-color: #047857;
    color: #fff;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.25);
}

    .btn-action-list:hover, .btn-list:hover, .btn-action-secondary:hover {
        background: linear-gradient(135deg, #059669 0%, #047857 100%);
        border-color: #065f46;
        box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
        transform: translateY(-2px);
    }

    .btn-action-list:active, .btn-list:active, .btn-action-secondary:active {
        transform: translateY(0);
        box-shadow: 0 2px 4px rgba(16, 185, 129, 0.25);
    }

    .btn-action-list i, .btn-list i, .btn-action-secondary i {
        color: #fff;
    }

    /* ---- Estados deshabilitados ---- */
    .btn-action:disabled, .btn-view:disabled, .btn-edit:disabled, .btn-delete:disabled, .btn-list:disabled {
        opacity: 0.5;
        cursor: not-allowed;
        transform: none !important;
    }

        .btn-action:disabled:hover, .btn-view:disabled:hover, .btn-edit:disabled:hover,
        .btn-delete:disabled:hover, .btn-list:disabled:hover {
            transform: none !important;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
        }

    /* ---- Tooltip mejorado ---- */
    .btn-action[title], .btn-view[title], .btn-edit[title], .btn-delete[title], .btn-list[title] {
        position: relative;
    }

        .btn-action[title]:hover::after, .btn-view[title]:hover::after, .btn-edit[title]:hover::after,
        .btn-delete[title]:hover::after, .btn-list[title]:hover::after {
            content: attr(title);
            position: absolute;
            bottom: -32px;
            left: 50%;
            transform: translateX(-50%);
            background: var(--text);
            color: var(--card-bg);
            padding: 0.4rem 0.8rem;
            border-radius: 6px;
            white-space: nowrap;
            font-size: 0.75rem;
            z-index: 10;
            font-weight: 600;
            pointer-events: none;
        }

/* ---- Dark mode adjustments ---- */
[data-bs-theme="dark"] .btn-action-view, [data-bs-theme="dark"] .btn-view {
    background: linear-gradient(135deg, var(--info) 0%, #1d4ed8 100%);
    box-shadow: 0 2px 4px rgba(96, 165, 250, 0.4);
}

    [data-bs-theme="dark"] .btn-action-view:hover, [data-bs-theme="dark"] .btn-view:hover {
        box-shadow: 0 4px 12px rgba(96, 165, 250, 0.6);
    }

[data-bs-theme="dark"] .btn-action-edit, [data-bs-theme="dark"] .btn-edit {
    background: linear-gradient(135deg, var(--accent) 0%, #d97706 100%);
    box-shadow: 0 2px 4px rgba(251, 191, 36, 0.4);
}

    [data-bs-theme="dark"] .btn-action-edit:hover, [data-bs-theme="dark"] .btn-edit:hover {
        box-shadow: 0 4px 12px rgba(251, 191, 36, 0.6);
    }

[data-bs-theme="dark"] .btn-action-delete, [data-bs-theme="dark"] .btn-delete {
    background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
    box-shadow: 0 2px 4px rgba(248, 113, 113, 0.4);
}

    [data-bs-theme="dark"] .btn-action-delete:hover, [data-bs-theme="dark"] .btn-delete:hover {
        box-shadow: 0 4px 12px rgba(248, 113, 113, 0.6);
    }

[data-bs-theme="dark"] .btn-action-list, [data-bs-theme="dark"] .btn-list,
[data-bs-theme="dark"] .btn-action-secondary {
    background: linear-gradient(135deg, var(--secondary) 0%, #059669 100%);
    box-shadow: 0 2px 4px rgba(52, 211, 153, 0.4);
}

    [data-bs-theme="dark"] .btn-action-list:hover, [data-bs-theme="dark"] .btn-list:hover,
    [data-bs-theme="dark"] .btn-action-secondary:hover {
        box-shadow: 0 4px 12px rgba(52, 211, 153, 0.6);
    }

/* ========== FORMS ========== */
.form-control-planifi {
    display: block;
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    font-family: inherit;
    color: var(--text);
    background: var(--card-bg);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    transition: all var(--transition);
    outline: none;
}

    .form-control-planifi:focus {
        border-color: var(--primary);
        box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    }

    .form-control-planifi::placeholder {
        color: var(--text-light);
    }

.form-label-planifi {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.375rem;
}

select.form-control-planifi {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.25rem;
}

textarea.form-control-planifi {
    resize: vertical;
    min-height: 80px;
}

.input-group-pwd {
    display: flex;
}

    .input-group-pwd .form-control-planifi {
        border-radius: 10px 0 0 10px;
        border-right: none;
    }

    .input-group-pwd .btn-planifi-icon {
        border-radius: 0;
        border-left: none;
        height: auto;
        width: 42px;
        border: 1.5px solid var(--border);
        border-left: none;
        background: var(--card-bg);
        color: var(--text-secondary);
        display: flex;
        align-items: center;
        justify-content: center;
    }

        .input-group-pwd .btn-planifi-icon:hover {
            background: var(--primary-light);
            color: var(--primary);
        }

        .input-group-pwd .btn-planifi-icon:last-child {
            border-radius: 0 10px 10px 0;
            border-right: 1.5px solid var(--border);
        }

    .input-group-pwd .form-control-planifi:focus + .btn-planifi-icon,
    .input-group-pwd .form-control-planifi:focus ~ .btn-planifi-icon {
        border-color: var(--primary);
    }

/* ========== MODALS ========== */
.modal-content-planifi {
    border: none;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}

.modal-header-planifi {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

    .modal-header-planifi .modal-title {
        font-size: 1rem;
        font-weight: 700;
        color: var(--text);
        margin: 0;
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    .modal-header-planifi .modal-subtitle {
        font-size: 0.8rem;
        color: var(--text-secondary);
        margin: 0.125rem 0 0;
    }

.modal-body-planifi {
    padding: 1.5rem;
}

.modal-footer-planifi {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
}

.btn-close-planifi {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all var(--transition);
    font-size: 1.1rem;
}

    .btn-close-planifi:hover {
        background: var(--border);
        color: var(--text);
    }

/* ========== TABLE (DataTables override) ========== */
.table-wrap {
    /*background: var(--card-bg);*/
    /*border: 1px solid var(--border);*/
    /*border-radius: var(--radius-lg);*/
    overflow: hidden;
    /*box-shadow: var(--shadow-sm);*/
    margin-bottom: 1.5rem;
}

.dataTables_wrapper {
    padding: 0;
}

    /* ---- Top bar: length + search ---- */
    .dataTables_wrapper .dt-layout-row:first-child {
        display: flex;
        justify-content: space-between;
        align-items: center;
        flex-wrap: wrap;
        gap: 0.75rem;
        padding: 1.5rem 1.75rem;
        background: var(--light-bg);
        border-bottom: 1px solid var(--border);
    }

        .dataTables_wrapper .dt-layout-row:first-child .dt-layout-cell {
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

    .dataTables_wrapper .dt-length label {
        color: var(--text-secondary);
        font-size: 0.8rem;
        white-space: nowrap;
        margin: 0;
    }

    .dataTables_wrapper .dt-length select {
        padding: 0.35rem 2rem 0.35rem 0.5rem;
        border: 1.5px solid var(--border);
        border-radius: 6px;
        background: var(--card-bg);
        color: var(--text);
        font-size: 0.8rem;
        cursor: pointer;
        appearance: none;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 0.5rem center;
        transition: border-color var(--transition);
    }

        .dataTables_wrapper .dt-length select:focus {
            border-color: var(--primary);
            outline: none;
        }

    .dataTables_wrapper .dt-search {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        position: relative;
    }

        .dataTables_wrapper .dt-search label {
            display: none;
        }

        .dataTables_wrapper .dt-search input {
            padding: 0.4rem 0.75rem 0.4rem 2rem;
            border: 1.5px solid var(--border);
            border-radius: 8px;
            background: var(--card-bg);
            color: var(--text);
            font-size: 0.8rem;
            min-width: 220px;
            outline: none;
            transition: all var(--transition);
        }

        .dataTables_wrapper .dt-search::before {
            content: '\F52A';
            font-family: 'bootstrap-icons';
            position: absolute;
            left: 0.75rem;
            top: 50%;
            transform: translateY(-50%);
            color: var(--text-light);
            font-size: 0.85rem;
            pointer-events: none;
        }

        .dataTables_wrapper .dt-search input:focus {
            border-color: var(--primary);
            box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
        }

        .dataTables_wrapper .dt-search input::placeholder {
            color: var(--text-light);
        }

    /* ---- Table: full width, edge to edge ---- */
    .dataTables_wrapper .dt-layout-table {
        display: block;
        padding: 0;
    }

    .dataTables_wrapper table.dataTable {
        width: 100% !important;
        margin: 0 !important;
        border-collapse: collapse;
    }

        .dataTables_wrapper table.dataTable thead th {
            padding: 1.25rem 1rem;
            font-size: 0.78rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.06em;
            color: var(--primary);
            background: var(--primary-light);
            border-bottom: 2.5px solid var(--primary);
            text-align: left;
            white-space: nowrap;
        }

            .dataTables_wrapper table.dataTable thead th i {
                color: var(--primary);
                margin-right: 0.5rem;
                font-size: 0.9rem;
                vertical-align: middle;
            }

        .dataTables_wrapper table.dataTable tbody td {
            padding: 1rem 1rem;
            font-size: 0.85rem;
            color: var(--text);
            border-bottom: 1px solid var(--border);
            vertical-align: middle;
        }

        /* Zebra alternating rows */
        .dataTables_wrapper table.dataTable tbody tr:nth-child(even) td {
            background: rgba(99, 102, 241, 0.02);
        }

[data-bs-theme="dark"] .dataTables_wrapper table.dataTable tbody tr:nth-child(even) td {
    background: rgba(129, 140, 248, 0.03);
}

/* Hover effects with left active border stamp */
.dataTables_wrapper table.dataTable tbody tr {
    transition: all var(--transition);
    border-left: 4px solid transparent;
}

    .dataTables_wrapper table.dataTable tbody tr:hover {
        border-left-color: var(--primary);
    }

        .dataTables_wrapper table.dataTable tbody tr:hover td {
            background: var(--primary-light) !important;
        }

    .dataTables_wrapper table.dataTable tbody tr:last-child td {
        border-bottom: none;
    }

/* Professional touch: Bold first cells of rows */
.dataTables_wrapper table.dataTable tbody td:first-child {
    font-weight: 600;
    color: var(--text);
}

/* Spacing and edge margins of table content */
.dataTables_wrapper table.dataTable thead th:first-child,
.dataTables_wrapper table.dataTable tbody td:first-child {
    padding-left: 1.75rem !important;
}

.dataTables_wrapper table.dataTable thead th:last-child,
.dataTables_wrapper table.dataTable tbody td:last-child {
    padding-right: 1.75rem !important;
}

/* ---- Bottom bar: info + pagination ---- */
.dataTables_wrapper .dt-layout-row:last-child {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 1.5rem 1.75rem;
    background: var(--light-bg);
    border-top: 1px solid var(--border);
}

    .dataTables_wrapper .dt-layout-row:last-child .dt-layout-cell {
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

.dataTables_wrapper .dt-info {
    color: var(--text-secondary);
    font-size: 0.8rem;
    padding: 0;
    border: none;
}

.dataTables_wrapper .dt-paging {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0;
    border: none;
}

    .dataTables_wrapper .dt-paging nav {
        display: flex;
        gap: 0.2rem;
    }

.dataTables_wrapper .dt-paging-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 0.4rem;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all var(--transition);
    font-family: inherit;
}

    .dataTables_wrapper .dt-paging-button:hover:not(.disabled) {
        background: var(--primary-light);
        border-color: var(--primary);
        color: var(--primary);
    }

    .dataTables_wrapper .dt-paging-button.current {
        background: var(--primary);
        border-color: var(--primary);
        color: #fff;
        font-weight: 600;
        box-shadow: 0 2px 6px rgba(99, 102, 241, 0.25);
    }

    .dataTables_wrapper .dt-paging-button.disabled,
    .dataTables_wrapper .dt-paging-button:first-child.disabled,
    .dataTables_wrapper .dt-paging-button:last-child.disabled {
        opacity: 0.35;
        cursor: default;
        background: transparent;
        border-color: var(--border);
        color: var(--text-light);
    }

/* ========== ALERTS ========== */
.alert-planifi {
    border: none;
    border-radius: var(--radius);
    padding: 0.875rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
}

    .alert-planifi i {
        font-size: 1.1rem;
        flex-shrink: 0;
    }

.alert-planifi-success {
    background: var(--secondary-light);
    color: var(--secondary);
}

.alert-planifi-danger {
    background: var(--danger-light);
    color: var(--danger);
}

.alert-planifi-info {
    background: var(--info-light);
    color: var(--info);
}

.alert-planifi-warning {
    background: var(--accent-light);
    color: var(--accent);
}

.toast-planifi {
    position: fixed;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    min-width: 320px;
    max-width: 480px;
}

/* ========== FOOTER ========== */
.footer-planifi {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-light);
    background: var(--card-bg);
}

/* ========== AUTH PAGES ========== */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--light-bg) 0%, var(--primary-light) 100%);
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}

.auth-card-header {
    padding: 2.5rem 2rem 1.5rem;
    text-align: center;
}

    .auth-card-header .auth-logo {
        font-size: 2rem;
        font-weight: 800;
        background: linear-gradient(135deg, var(--primary), #a78bfa);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
        display: block;
        margin-bottom: 0.5rem;
    }

    .auth-card-header h3 {
        font-size: 1.25rem;
        font-weight: 700;
        color: var(--text);
        margin: 0;
    }

    .auth-card-header p {
        font-size: 0.85rem;
        color: var(--text-secondary);
        margin: 0.25rem 0 0;
    }

.auth-card-body {
    padding: 0 2rem 2rem;
}

.auth-card-footer {
    padding: 1.25rem 2rem;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

    .auth-card-footer a {
        color: var(--primary);
        text-decoration: none;
        font-weight: 600;
    }

        .auth-card-footer a:hover {
            text-decoration: underline;
        }

.auth-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
    color: var(--text-light);
    font-size: 0.8rem;
}

    .auth-divider::before,
    .auth-divider::after {
        content: '';
        flex: 1;
        height: 1px;
        background: var(--border);
    }

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

    ::-webkit-scrollbar-thumb:hover {
        background: var(--text-light);
    }

/* ========== RESPONSIVE ========== */
@media (max-width: 1199px) {
    main {
        padding: 1.25rem;
    }
}

@media (max-width: 991px) {
    #layoutSidenav_nav {
        position: fixed !important;
        left: -240px !important;
        top: var(--navbar-h);
        width: 240px !important;
        height: calc(100vh - var(--navbar-h));
        z-index: 100;
    }

        #layoutSidenav_nav.mobile-open {
            left: 0 !important;
        }

    .sidebar {
        position: relative !important;
        top: 0 !important;
        left: 0 !important;
        height: 100% !important;
        width: 100% !important;
    }

    .sidebar-toggle-close {
        display: flex;
        width: 28px;
        height: 28px;
        border: none;
        background: transparent;
        border-radius: 6px;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        color: var(--text-secondary);
    }

        .sidebar-toggle-close:hover {
            background: var(--primary-light);
            color: var(--primary);
        }

    .navbar-brand {
        font-size: 1.1rem;
    }

    .dataTables_wrapper .dt-search input {
        min-width: 140px;
    }
}

@media (max-width: 768px) {
    main {
        padding: 1rem;
    }

    .planifi-navbar {
        padding: 0 0.75rem;
    }

    .nav-toggle, .option-btn {
        width: 34px;
        height: 34px;
    }

        .nav-toggle i, .option-btn i {
            font-size: 1.1rem;
        }

    .navbar-brand {
        font-size: 1rem;
    }

    .navbar-right {
        gap: 2px;
    }

    .user-avatar {
        width: 26px;
        height: 26px;
    }

    .notification-badge {
        width: 16px;
        height: 16px;
        font-size: 0.55rem;
        top: 3px;
        right: 3px;
    }

    .page-header-section h1 {
        font-size: 1.25rem;
    }

    .widget-card {
        padding: 1rem;
    }

        .widget-card .widget-value {
            font-size: 1.25rem;
        }

    .dataTables_wrapper .dt-layout-row:first-child,
    .dataTables_wrapper .dt-layout-row:last-child {
        flex-direction: column;
        padding: 1rem;
    }

        .dataTables_wrapper .dt-layout-row:first-child .dt-layout-cell,
        .dataTables_wrapper .dt-layout-row:last-child .dt-layout-cell {
            width: 100%;
        }

    .dataTables_wrapper .dt-search {
        width: 100%;
    }

        .dataTables_wrapper .dt-search input {
            width: 100%;
            min-width: 0;
        }

    .dataTables_wrapper table.dataTable thead th:first-child,
    .dataTables_wrapper table.dataTable tbody td:first-child {
        padding-left: 1rem !important;
    }

    .dataTables_wrapper table.dataTable thead th:last-child,
    .dataTables_wrapper table.dataTable tbody td:last-child {
        padding-right: 1rem !important;
    }

    .dropdown-menu-custom {
        min-width: 240px;
        right: -10px;
    }

    .user-dropdown {
        min-width: 220px;
        right: -10px;
    }

    .auth-card-header {
        padding: 2rem 1.5rem 1rem;
    }

    .auth-card-body {
        padding: 0 1.5rem 1.5rem;
    }

    .auth-card-footer {
        padding: 1rem 1.5rem;
    }

    .card-planifi .card-header {
        padding: 1rem 1.25rem;
    }

    .card-planifi .card-body {
        padding: 1.25rem;
    }

    .modal-header-planifi {
        padding: 1rem 1.25rem;
    }

    .modal-body-planifi {
        padding: 1.25rem;
    }

    .modal-footer-planifi {
        padding: 0.75rem 1.25rem;
    }

    .action-buttons {
        gap: 0.35rem;
    }

    .btn-action {
        width: 32px;
        height: 32px;
        font-size: 0.85rem;
    }

        .btn-action i {
            font-size: 0.8rem;
        }
}

@media (max-width: 480px) {
    main {
        padding: 0.75rem;
    }

    .dataTables_wrapper table.dataTable thead th,
    .dataTables_wrapper table.dataTable tbody td {
        padding: 0.625rem 0.75rem;
        font-size: 0.8rem;
    }

        .dataTables_wrapper table.dataTable thead th:first-child,
        .dataTables_wrapper table.dataTable tbody td:first-child {
            padding-left: 0.75rem !important;
        }

        .dataTables_wrapper table.dataTable thead th:last-child,
        .dataTables_wrapper table.dataTable tbody td:last-child {
            padding-right: 0.75rem !important;
        }

    .dataTables_wrapper .dt-layout-row:last-child {
        flex-direction: column;
    }

    .action-buttons {
        gap: 0.25rem;
    }

    .btn-action {
        width: 30px;
        height: 30px;
        font-size: 0.8rem;
    }

        .btn-action i {
            font-size: 0.75rem;
        }

    .action-group {
        gap: 0.25rem;
    }

    .dropdown-menu-custom {
        min-width: 200px;
        right: -20px;
    }
}

/* ========== ANIMATIONS ========== */
.fade-in {
    animation: fadeIn 0.3s ease-out;
}

.slide-up {
    animation: slideUp 0.4s ease-out;
}

.scale-in {
    animation: scaleIn 0.2s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ========== UTILITIES ========== */
.text-gradient {
    background: linear-gradient(135deg, var(--primary), #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.gap-1 {
    gap: 0.25rem;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-3 {
    gap: 0.75rem;
}

.gap-4 {
    gap: 1rem;
}

.fw-500 {
    font-weight: 500;
}

.fw-600 {
    font-weight: 600;
}

.fw-700 {
    font-weight: 700;
}

.fw-800 {
    font-weight: 800;
}

.fs-small {
    font-size: 0.8rem;
}

.fs-large {
    font-size: 1.125rem;
}
