/* === VARIABLES ET BASE === */
:root {
    --primary: #2f5d50;
    --primary-dark: #23463d;
    --primary-light: #3f7666;
    --accent: #c56a2a;
    --accent-light: #dd8649;
    --success: #3f8a60;
    --warning: #ba7a2a;
    --danger: #bf4444;
    --gray-50: #faf8f5;
    --gray-100: #f3eee7;
    --gray-200: #e7ddd1;
    --gray-300: #d3c2b1;
    --gray-500: #786b60;
    --gray-700: #3f4b45;
    --gray-900: #222d28;
    --white: #ffffff;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.08), 0 1px 2px 0 rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 12px 24px -4px rgba(0, 0, 0, 0.12), 0 4px 8px -2px rgba(0, 0, 0, 0.06);
    --nav-bg: linear-gradient(160deg, #faf8f5 0%, #f0e8dc 58%, #e8dccb 100%);
    --nav-border: var(--primary);
    --dropdown-bg: white;
    --font-sans: "Inter", "Segoe UI", "Roboto", "Helvetica Neue", Arial, sans-serif;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* === ANIMATIONS GLOBALES === */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.96); }
    to   { opacity: 1; transform: scale(1); }
}

/* === THÈME SOMBRE === */
[data-theme="dark"] {
    --gray-50: #202824;
    --gray-100: #2b3732;
    --gray-200: #36453f;
    --gray-300: #455a51;
    --gray-500: #a9b6ac;
    --gray-700: #dbe3dc;
    --gray-900: #f3f6f3;
    --white: #131a17;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.35), 0 1px 2px 0 rgba(0, 0, 0, 0.25);
    --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 12px 24px -4px rgba(0, 0, 0, 0.5), 0 4px 8px -2px rgba(0, 0, 0, 0.3);
    --nav-bg: linear-gradient(160deg, #202824 0%, #18201d 100%);
    --nav-border: #5c8f7f;
    --dropdown-bg: #202824;
}

[data-theme="dark"] body {
    background: linear-gradient(160deg, #131a17 0%, #1b2421 55%, #202824 100%);
}

[data-theme="dark"] .nav-dropdown-menu {
    background: var(--dropdown-bg);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .nav-dropdown-menu a {
    color: var(--gray-700);
    border-bottom-color: var(--gray-200);
}

[data-theme="dark"] .nav-dropdown-menu a:hover {
    background: var(--gray-200);
}

[data-theme="dark"] .user-info {
    background: rgba(30, 41, 59, 0.8);
    color: var(--gray-500);
}

[data-theme="dark"] .badge-success { background: #064e3b; color: #6ee7b7; }
[data-theme="dark"] .badge-warning { background: #78350f; color: #fcd34d; }
[data-theme="dark"] .badge-danger { background: #7f1d1d; color: #fca5a5; }
[data-theme="dark"] .badge-info { background: #1e3a5f; color: #93c5fd; }

[data-theme="dark"] .alert-success, [data-theme="dark"] .flash.success { background: #064e3b; color: #6ee7b7; }
[data-theme="dark"] .alert-error, [data-theme="dark"] .flash.error { background: #7f1d1d; color: #fca5a5; }
[data-theme="dark"] .alert-warning { background: #78350f; color: #fcd34d; }
[data-theme="dark"] .alert-info { background: #1e3a5f; color: #93c5fd; }

[data-theme="dark"] .login-help code { background: var(--gray-300); color: var(--gray-900); }

/* Formulaires en thème sombre */
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
    background: var(--gray-50) !important;
    color: var(--gray-900) !important;
    border-color: var(--gray-300) !important;
}
[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
    color: var(--gray-500) !important;
}
[data-theme="dark"] input:focus,
[data-theme="dark"] select:focus,
[data-theme="dark"] textarea:focus {
    border-color: var(--primary-light) !important;
}
[data-theme="dark"] select option {
    background: var(--gray-50);
    color: var(--gray-900);
}

/* Footer en thème sombre */
footer {
    text-align: center;
    padding: 1.5rem 0;
    color: var(--gray-500);
    font-size: 0.85rem;
}

[data-theme="dark"] footer {
    color: var(--gray-500);
}

/* Toggle thème */
.theme-toggle {
    background: none;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0.35rem 0.6rem;
    transition: all 0.2s;
    line-height: 1;
}
.theme-toggle:hover { background: rgba(255,255,255,0.15); }
[data-theme="dark"] .theme-toggle { border-color: var(--gray-300); }
[data-theme="dark"] .theme-toggle:hover { background: rgba(255,255,255,0.1); }

/* Badge notification */
.nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 99px;
    background: var(--danger);
    color: white;
    font-size: 11px;
    font-weight: 700;
    margin-left: 4px;
    line-height: 1;
    vertical-align: middle;
}

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

body {
    font-family: var(--font-sans);
    background: linear-gradient(170deg, #faf8f5 0%, #f4eee6 58%, #ece3d7 100%);
    min-height: 100vh;
    color: var(--gray-900);
    line-height: 1.6;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* === NAVIGATION SIDEBAR === */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    height: 100vh;
    background: var(--nav-bg);
    border-right: 2px solid var(--nav-border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform 0.25s ease;
}

.sidebar-header {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-header a {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.sidebar-logo {
    height: 40px;
    width: auto;
    flex-shrink: 0;
}

.sidebar-brand {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    min-width: 0;
}

.sidebar-brand-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--gray-900);
}

.sidebar-brand-subtitle {
    font-size: 0.65rem;
    color: var(--gray-500);
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-nav {
    flex: 1;
    padding: 0.5rem 0;
    overflow-y: auto;
}

/* Section déroulante */
.sidebar-section {
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

.sidebar-section-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.65rem 1rem;
    background: none;
    border: none;
    color: var(--gray-700);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    text-align: left;
}

.sidebar-section-toggle:hover {
    background: rgba(255,255,255,0.5);
    color: var(--primary);
}

.sidebar-arrow {
    font-size: 0.7rem;
    transition: transform 0.2s;
    opacity: 0.5;
}

.sidebar-section.open .sidebar-arrow {
    transform: rotate(180deg);
}

.sidebar-section-menu {
    display: none;
    padding-bottom: 0.25rem;
}

.sidebar-section.open .sidebar-section-menu {
    display: block;
    animation: sidebarSlide 0.2s ease;
}

@keyframes sidebarSlide {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

.sidebar-section-menu a {
    display: block;
    padding: 0.45rem 1rem 0.45rem 2rem;
    color: var(--gray-600);
    text-decoration: none;
    font-size: 0.84rem;
    transition: all 0.15s;
    border-left: 3px solid transparent;
}

.sidebar-section-menu a:hover {
    background: rgba(255,255,255,0.5);
    color: var(--primary);
    border-left-color: var(--primary);
    padding-left: 2.2rem;
}

/* Lien direct (sans sous-menu) */
.sidebar-link {
    display: block;
    padding: 0.65rem 1rem;
    color: var(--gray-700);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 600;
    transition: all 0.15s;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

.sidebar-link:hover {
    background: rgba(255,255,255,0.5);
    color: var(--primary);
}

/* Footer sidebar */
.sidebar-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid rgba(255,255,255,0.08);
    margin-top: auto;
}

.sidebar-user {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    margin-bottom: 0.5rem;
}

.sidebar-user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-900);
}

.sidebar-user-role {
    font-size: 0.75rem;
    color: var(--gray-500);
    text-transform: capitalize;
}

.sidebar-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-actions .btn-logout {
    flex: 1;
    text-align: center;
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    border-radius: 6px;
}

/* Contenu principal décalé */
.main-content {
    min-height: 100vh;
}

.main-content.has-sidebar {
    margin-left: 260px;
}

/* Bouton hamburger mobile */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 200;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    font-size: 1.3rem;
    cursor: pointer;
    box-shadow: var(--shadow);
    color: var(--gray-700);
}

/* Overlay mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 99;
}

.sidebar-overlay.open {
    display: block;
}

/* Dark theme sidebar */
[data-theme="dark"] .sidebar {
    border-right-color: var(--gray-300);
}

[data-theme="dark"] .sidebar-section-toggle:hover,
[data-theme="dark"] .sidebar-section-menu a:hover,
[data-theme="dark"] .sidebar-link:hover {
    background: rgba(255,255,255,0.08);
}

[data-theme="dark"] .sidebar-toggle {
    background: var(--gray-100);
    border-color: var(--gray-300);
    color: var(--gray-900);
}

/* Responsive : mobile */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-toggle {
        display: block;
    }

    .main-content.has-sidebar {
        margin-left: 0;
    }
}

.btn-logout {
    background: var(--danger) !important;
    color: white !important;
    font-weight: 600 !important;
    text-decoration: none;
}

.btn-logout:hover {
    background: #dc2626 !important;
}

/* === CONTENEURS === */
.container {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 2rem;
    animation: fadeIn var(--transition-normal) both;
}

.form-container,
.dashboard,
.vue-mensuelle,
.vue-ensemble,
.historique,
.section,
.users-container,
.login-box {
    background: var(--white);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
    animation: fadeInUp var(--transition-slow) both;
    border: 1px solid var(--gray-200);
    transition: box-shadow var(--transition-normal);
}

.form-container:hover,
.dashboard:hover,
.vue-mensuelle:hover,
.vue-ensemble:hover,
.historique:hover,
.section:hover,
.users-container:hover {
    box-shadow: var(--shadow-lg);
}

/* === TITRES === */
h1 {
    font-size: 2rem;
    font-weight: 800;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
    line-height: 1.2;
    position: relative;
}

h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 3px solid var(--primary);
    position: relative;
    letter-spacing: -0.01em;
}

h3 {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--gray-700);
    margin-bottom: 0.75rem;
}

h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--gray-500);
    font-size: 0.95rem;
    margin-bottom: 2rem;
    letter-spacing: 0.01em;
}

/* === GRILLES === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-sm);
    animation: fadeInUp var(--transition-slow) both;
}

.stat-card:nth-child(1) { animation-delay: 0.05s; }
.stat-card:nth-child(2) { animation-delay: 0.1s; }
.stat-card:nth-child(3) { animation-delay: 0.15s; }
.stat-card:nth-child(4) { animation-delay: 0.2s; }
.stat-card:nth-child(5) { animation-delay: 0.25s; }

.stat-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
    transform: translateY(-2px);
}

.stat-icon {
    font-size: 2.5rem;
    opacity: 0.9;
}

.stat-content h3 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-dark);
    line-height: 1;
}

/* === TABLEAUX === */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.9rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    overflow: hidden;
    animation: fadeIn var(--transition-slow) both;
}

.data-table thead {
    background: var(--gray-100);
}

.data-table thead th {
    padding: 1rem;
    text-align: left;
    font-weight: 700;
    color: var(--gray-700);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--gray-300);
}

.data-table tbody tr {
    border-bottom: 1px solid var(--gray-200);
    transition: all var(--transition-fast);
}

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

.data-table tbody tr:last-child {
    border-bottom: none;
}

.data-table tbody td {
    padding: 1rem;
    color: var(--gray-700);
}

.data-table tfoot {
    background: var(--gray-50);
    font-weight: 600;
    border-top: 2px solid var(--primary);
}

.data-table tfoot td {
    padding: 1rem;
    color: var(--gray-900);
}

/* === FORMULAIRES === */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group input[type="date"],
.form-group input[type="time"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 0.95rem;
    transition: all 0.2s;
    background: var(--white);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
    transform: translateY(-1px);
}

.help-text {
    font-size: 0.85rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
}

/* === BOUTONS === */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition-normal);
    text-decoration: none !important;
    text-align: center;
}

/* Forcer la suppression du soulignement sur TOUS les états */
a.btn,
a.btn:link,
a.btn:visited,
a.btn:hover,
a.btn:active,
a.btn:focus {
    text-decoration: none !important;
}

/* SPÉCIFIQUE CHROME/WEBKIT - Force le soulignement à none */
a.btn:-webkit-any-link {
    text-decoration: none !important;
}

.btn-secondary,
a.btn-secondary,
a.btn-secondary:link,
a.btn-secondary:visited,
a.btn-secondary:hover,
a.btn-secondary:active,
a.btn-secondary:focus {
    text-decoration: none !important;
}

/* SPÉCIFIQUE CHROME/WEBKIT pour btn-secondary */
a.btn-secondary:-webkit-any-link {
    text-decoration: none !important;
}

.btn-primary,
a.btn-primary,
a.btn-primary:link,
a.btn-primary:visited,
a.btn-primary:hover,
a.btn-primary:active,
a.btn-primary:focus {
    text-decoration: none !important;
}

/* SPÉCIFIQUE CHROME/WEBKIT pour btn-primary */
a.btn-primary:-webkit-any-link {
    text-decoration: none !important;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background: var(--gray-300);
}

.btn-full {
    width: 100%;
}

.btn:disabled {
    background: var(--gray-300);
    cursor: not-allowed;
    opacity: 0.6;
}

.btn:disabled:hover {
    box-shadow: none;
}

.btn-icon {
    padding: 0.5rem;
    font-size: 1.25rem;
    background: transparent;
    border: none;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
    text-decoration: none !important;
}

.btn-icon:hover {
    opacity: 1;
}

/* Supprimer le soulignement sur TOUS les états de btn-icon */
a.btn-icon,
a.btn-icon:link,
a.btn-icon:visited,
a.btn-icon:hover,
a.btn-icon:active,
a.btn-icon:focus,
a.btn-icon:-webkit-any-link {
    text-decoration: none !important;
    color: inherit;
}

.actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

/* === BADGES === */
.badge {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    border-radius: 99px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    transition: transform var(--transition-fast);
}

.badge:hover {
    transform: scale(1.05);
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

.badge-inactive {
    background: #fee2e2;
    color: #991b1b;
}

/* === ALERTES === */
.help-box {
    background: var(--gray-50);
    border-left: 4px solid var(--primary);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-sm);
    margin: 1.5rem 0;
    animation: fadeIn var(--transition-slow) both;
}

.help-box h4 {
    margin-top: 0;
    color: var(--primary-dark);
}

.help-box ul {
    margin-left: 1.5rem;
    margin-top: 0.5rem;
}

.help-box li {
    margin-bottom: 0.5rem;
    color: var(--gray-700);
}

.alert,
.flash {
    padding: 1rem 1.5rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    font-weight: 500;
    animation: fadeInUp var(--transition-normal) both;
}

.alert-success,
.flash.success {
    background: #d1fae5;
    color: #065f46;
    border-left: 4px solid var(--success);
}

.alert-error,
.flash.error {
    background: #fee2e2;
    color: #991b1b;
    border-left: 4px solid var(--danger);
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border-left: 4px solid var(--warning);
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border-left: 4px solid var(--primary);
}

/* === SPÉCIFIQUES === */
.month-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--gray-200);
}

.month-header h1 {
    margin: 0;
    color: var(--primary-dark);
}

.no-data {
    text-align: center;
    padding: 3rem;
    color: var(--gray-500);
    font-style: italic;
}

.time-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.time-section {
    background: var(--gray-50);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--gray-200);
}

/* Login page */
.login-container {
    max-width: 440px;
    margin: 6rem auto;
}

.login-card,
.login-box {
    background: var(--white);
    padding: 3rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    animation: scaleIn var(--transition-slow) both;
    border: 1px solid var(--gray-200);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h1 {
    color: var(--primary-dark);
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--gray-500);
}

.login-help {
    margin-top: 2rem;
    padding: 1rem;
    background: var(--gray-50);
    border-radius: 6px;
    font-size: 0.9rem;
    color: var(--gray-700);
}

.login-help code {
    background: var(--gray-200);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    color: var(--gray-900);
}

/* === DARK THEME — Pages spécifiques === */

/* Vue ensemble validation */
[data-theme="dark"] .vue-ensemble { background: var(--white) !important; }
[data-theme="dark"] .row-validated { background: #064e3b !important; }
[data-theme="dark"] .row-partial { background: #78350f !important; }
[data-theme="dark"] .row-pending { background: #7f1d1d !important; }
[data-theme="dark"] .vue-ensemble .data-table tbody tr:hover { background: var(--gray-200) !important; }

/* Historique modifications */
[data-theme="dark"] .historique { background: var(--white) !important; }
[data-theme="dark"] .historique .section[style] { background: var(--gray-50) !important; }
[data-theme="dark"] .historique tr[id^="details-"] { background: var(--gray-50) !important; }
[data-theme="dark"] .historique .data-table tbody tr:hover { background: var(--gray-200) !important; }

/* Pesée ALISFA */
[data-theme="dark"] .pa-key-box { background: #78350f !important; border-color: #92400e !important; }
[data-theme="dark"] .pa-key-box.pa-key-ok { background: #064e3b !important; border-color: #065f46 !important; }
[data-theme="dark"] .pa-key-box p { color: var(--gray-700) !important; }
[data-theme="dark"] .pa-key-box span[style] { color: #6ee7b7 !important; }
[data-theme="dark"] .pa-upload:hover { background: var(--gray-200) !important; }
[data-theme="dark"] .pa-upload.pa-has-file { background: #064e3b !important; border-color: #065f46 !important; }
[data-theme="dark"] .pa-criterion.pa-locked { background: #064e3b !important; border-color: #065f46 !important; }
[data-theme="dark"] .pa-criterion-points { background: #4c1d95 !important; color: #c4b5fd !important; }
[data-theme="dark"] .pa-criterion-justif { background: var(--gray-200) !important; }
[data-theme="dark"] .pa-alert-warn { background: #78350f !important; color: #fcd34d !important; }
[data-theme="dark"] .pa-alert-info { background: #1e3a5f !important; color: #93c5fd !important; }
[data-theme="dark"] .pa-alert-error { background: #7f1d1d !important; color: #fca5a5 !important; }
[data-theme="dark"] .pa-synthese { background: #1e3a5f !important; border-color: #1e40af !important; }
[data-theme="dark"] .pa-diag-global { background: #2e1065 !important; border-color: #6d28d9 !important; }
[data-theme="dark"] .pa-diag-fort { background: #064e3b !important; color: #6ee7b7 !important; border-color: #065f46 !important; }
[data-theme="dark"] .pa-diag-badge-fond { background: #7f1d1d !important; color: #fca5a5 !important; }
[data-theme="dark"] .pa-diag-badge-forme { background: #78350f !important; color: #fcd34d !important; }
[data-theme="dark"] .pa-diag-suggestion { background: #1e3a5f !important; color: #93c5fd !important; }
[data-theme="dark"] .pa-diag-priorite { background: #2e1065 !important; border-color: #6d28d9 !important; }
[data-theme="dark"] .pa-diag-extrait { color: var(--gray-500) !important; border-left-color: var(--gray-300) !important; }
[data-theme="dark"] .pa-lock-btn.pa-unlocked { background: var(--gray-200) !important; border-color: var(--gray-300) !important; color: var(--gray-500) !important; }
[data-theme="dark"] .pa-lock-btn.pa-is-locked { background: #064e3b !important; border-color: #065f46 !important; color: #6ee7b7 !important; }

/* === PAGE ABSENCES === */
.absences-page {
    background: var(--white);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
    animation: fadeInUp var(--transition-slow) both;
    border: 1px solid var(--gray-200);
}

.absences-form-section {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: 2rem;
    margin-bottom: 2rem;
    transition: box-shadow var(--transition-normal);
}

.absences-form-section:hover {
    box-shadow: var(--shadow);
}

.absences-form-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

@media (max-width: 1024px) {
    .absences-form-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .absences-form-grid {
        grid-template-columns: 1fr;
    }
}

.jours-ouvres-display {
    background: var(--white);
    border: 2px solid var(--primary);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    text-align: center;
}

.jours-ouvres-display #joursOuvresValue {
    font-size: 1.5rem;
}

.absences-search-form {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

.absences-table {
    font-size: 0.85rem;
}

.absences-table td {
    vertical-align: middle;
}

/* Badges motifs d'absence */
.badge-absence {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-absence-conge-paye { background: #dbeafe; color: #1e40af; }
.badge-absence-conge-conventionnel { background: #fef3c7; color: #92400e; }
.badge-absence-arret-maladie { background: #fee2e2; color: #991b1b; }
.badge-absence-conge-parental { background: #ede9fe; color: #5b21b6; }
.badge-absence-jour-enfant-malade { background: #fce7f3; color: #9d174d; }
.badge-absence-accident-du-travail { background: #fed7aa; color: #9a3412; }
.badge-absence-evenement-familial { background: #d1fae5; color: #065f46; }
.badge-absence-sans-solde { background: #f1f5f9; color: #475569; }
.badge-absence-mi-temps-therapeutique { background: #e0e7ff; color: #3730a3; }
.badge-absence-autre { background: #e5e7eb; color: #374151; }

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    border-radius: 4px;
}

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

.btn-danger:hover {
    background: #dc2626;
}

/* Dark theme for absences page */
[data-theme="dark"] .absences-page { background: var(--white); }
[data-theme="dark"] .absences-form-section { background: var(--gray-100); border-color: var(--gray-300); }
[data-theme="dark"] .jours-ouvres-display { background: var(--gray-50); border-color: var(--primary-light); }
[data-theme="dark"] .badge-absence-conge-paye { background: #1e3a5f; color: #93c5fd; }
[data-theme="dark"] .badge-absence-conge-conventionnel { background: #78350f; color: #fcd34d; }
[data-theme="dark"] .badge-absence-arret-maladie { background: #7f1d1d; color: #fca5a5; }
[data-theme="dark"] .badge-absence-conge-parental { background: #4c1d95; color: #c4b5fd; }
[data-theme="dark"] .badge-absence-jour-enfant-malade { background: #831843; color: #f9a8d4; }
[data-theme="dark"] .badge-absence-accident-du-travail { background: #7c2d12; color: #fdba74; }
[data-theme="dark"] .badge-absence-evenement-familial { background: #064e3b; color: #6ee7b7; }
[data-theme="dark"] .badge-absence-sans-solde { background: var(--gray-200); color: var(--gray-700); }
[data-theme="dark"] .badge-absence-mi-temps-therapeutique { background: #312e81; color: #a5b4fc; }
[data-theme="dark"] .badge-absence-autre { background: var(--gray-300); color: var(--gray-700); }

/* Calendrier Forfait Jour */
.cal-day { min-height: 100px; padding: 0.5rem; position: relative; cursor: pointer; }
.cal-day-default { background: var(--white); }
.cal-day-travaille { background: #d1fae5; }
.cal-day-conge_paye { background: #dbeafe; }
.cal-day-conge_conv { background: #fef3c7; }
.cal-day-repos_forfait { background: #e0e7ff; }
.cal-day-ferie { background: #fce7f3; }
.cal-day-maladie { background: #fed7aa; }
.cal-day-sans_solde { background: #f3f4f6; }
.cal-day-autre { background: #e5e7eb; }
.cal-day-weekend { background: #f9fafb; }

[data-theme="dark"] .cal-day-default { background: var(--white); }
[data-theme="dark"] .cal-day-travaille { background: #064e3b; }
[data-theme="dark"] .cal-day-conge_paye { background: #1e3a5f; }
[data-theme="dark"] .cal-day-conge_conv { background: #78350f; }
[data-theme="dark"] .cal-day-repos_forfait { background: #312e81; }
[data-theme="dark"] .cal-day-ferie { background: #831843; }
[data-theme="dark"] .cal-day-maladie { background: #7c2d12; }
[data-theme="dark"] .cal-day-sans_solde { background: var(--gray-200); }
[data-theme="dark"] .cal-day-autre { background: var(--gray-300); }
[data-theme="dark"] .cal-day-weekend { background: var(--gray-50); }

.cal-swatch { width: 20px; height: 20px; border-radius: 4px; flex-shrink: 0; }

/* Modal calendrier */
[data-theme="dark"] #modalSaisie > div { background: var(--white) !important; color: var(--gray-900) !important; }
[data-theme="dark"] #modalSaisie h3 { color: var(--gray-900) !important; }

/* === TABLEAU DE BORD DIRECTION === */
.direction-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    animation: fadeInUp var(--transition-slow) both;
}

.stats-grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

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

.stat-card-accent {
    border-left: 4px solid var(--accent);
}

.stat-card-danger {
    border-left: 4px solid var(--danger);
}

.stat-detail {
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
}

.direction-row {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.direction-row-3 {
    grid-template-columns: repeat(3, 1fr);
}

.direction-col-main { min-width: 0; }
.direction-col-side { min-width: 0; }

/* Navigation mois validations */
.direction-validation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--gray-200);
}

.direction-validation-header h2 {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.direction-month-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.direction-month-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 6px;
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    color: var(--gray-700);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.direction-month-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.direction-month-btn-disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

.direction-month-label {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-dark);
    min-width: 140px;
    text-align: center;
}

[data-theme="dark"] .direction-month-btn { background: var(--gray-200); border-color: var(--gray-300); }
[data-theme="dark"] .direction-month-btn:hover { background: var(--primary-light); border-color: var(--primary-light); }

.direction-secteur-block {
    margin-bottom: 1.5rem;
}

.direction-secteur-block:last-child {
    margin-bottom: 0;
}

.direction-secteur-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-700);
}

.direction-empty {
    text-align: center;
    padding: 2rem;
    color: var(--gray-500);
    font-style: italic;
    background: var(--gray-50);
    border-radius: 8px;
    border: 1px dashed var(--gray-300);
}

.direction-empty-ok {
    background: #d1fae5;
    border-color: var(--success);
    color: #065f46;
}

[data-theme="dark"] .direction-empty-ok {
    background: #064e3b;
    border-color: #065f46;
    color: #6ee7b7;
}

/* Graphique barres horizontales */
.direction-chart {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.direction-chart-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.direction-chart-label {
    width: 120px;
    font-size: 0.8rem;
    color: var(--gray-700);
    text-align: right;
    flex-shrink: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.direction-chart-bar-container {
    flex: 1;
    height: 22px;
    background: var(--gray-100);
    border-radius: 4px;
    overflow: hidden;
}

.direction-chart-bar {
    height: 100%;
    border-radius: 4px;
    min-width: 4px;
    transition: width 0.5s ease;
}

.direction-chart-value {
    width: 30px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--gray-900);
    text-align: right;
}

/* Mini stats */
.direction-mini-stats {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
}

.direction-mini-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.direction-mini-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-dark);
    line-height: 1;
}

.direction-mini-label {
    font-size: 0.8rem;
    color: var(--gray-500);
}

/* Barre de progression validation */
.direction-progress-section {
    margin-bottom: 2rem;
}

.direction-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--gray-700);
}

.direction-progress-bar-bg {
    height: 24px;
    background: var(--gray-200);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
}

.direction-progress-bar-sm {
    height: 12px;
    margin-bottom: 0.5rem;
}

.direction-progress-bar {
    height: 100%;
    transition: width 0.5s ease;
}

.direction-progress-complete {
    background: var(--success);
}

.direction-progress-encours {
    background: var(--warning);
}

.direction-progress-legend {
    display: flex;
    gap: 1.5rem;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--gray-500);
}

.direction-legend-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.direction-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

/* Grille validation par secteur */
.direction-validation-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.direction-validation-card {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: 1rem;
    transition: all var(--transition-normal);
}

.direction-validation-card:hover {
    box-shadow: var(--shadow);
    border-color: var(--primary-light);
    transform: translateY(-1px);
}

.direction-validation-card h4 {
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
}

.direction-validation-stats {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.direction-validation-stats .badge {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
}

/* Details/Summary */
.direction-details {
    margin-top: 1rem;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    overflow: hidden;
}

.direction-details summary {
    padding: 0.75rem 1rem;
    background: var(--gray-50);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--primary);
    user-select: none;
}

.direction-details summary:hover {
    background: var(--gray-100);
}

.direction-details[open] summary {
    border-bottom: 1px solid var(--gray-200);
}

/* Anomalies */
.direction-anomalies-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.direction-anomaly-item {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    border-left: 3px solid var(--gray-300);
    background: var(--gray-50);
}

.direction-anomaly-haute {
    border-left-color: var(--danger);
}

.direction-anomaly-moyenne {
    border-left-color: var(--warning);
}

.direction-anomaly-basse {
    border-left-color: var(--primary);
}

.direction-anomaly-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.35rem;
}

.direction-anomaly-header small {
    color: var(--gray-500);
    font-size: 0.75rem;
}

.direction-anomaly-desc {
    font-size: 0.85rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
}

/* Timeline activite recente */
.direction-activity-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.direction-activity-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--gray-100);
    align-items: flex-start;
}

.direction-activity-item:last-child {
    border-bottom: none;
}

.direction-activity-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    margin-top: 0.4rem;
    flex-shrink: 0;
}

.direction-activity-content {
    flex: 1;
    min-width: 0;
}

.direction-activity-content p {
    font-size: 0.85rem;
    margin: 0;
    line-height: 1.4;
}

.direction-activity-action {
    color: var(--gray-500);
    font-style: italic;
}

.direction-activity-target {
    color: var(--gray-500);
    font-size: 0.8rem !important;
}

.direction-activity-content small {
    color: var(--gray-500);
    font-size: 0.75rem;
}

/* Acces rapides */
.direction-quick-links {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.direction-quick-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--gray-700);
    font-weight: 500;
    font-size: 0.9rem;
    transition: all var(--transition-normal);
}

.direction-quick-link:hover {
    border-color: var(--primary);
    background: var(--white);
    box-shadow: var(--shadow-md);
    color: var(--primary);
    transform: translateY(-2px);
}

.direction-ql-icon {
    font-size: 1.5rem;
}

/* Dark theme direction */
[data-theme="dark"] .direction-validation-card { background: var(--gray-100); border-color: var(--gray-300); }
[data-theme="dark"] .direction-anomaly-item { background: var(--gray-100); }
[data-theme="dark"] .direction-empty { background: var(--gray-100); border-color: var(--gray-300); }
[data-theme="dark"] .direction-quick-link { background: var(--gray-100); border-color: var(--gray-300); }
[data-theme="dark"] .direction-quick-link:hover { background: var(--gray-50); border-color: var(--primary-light); }
[data-theme="dark"] .direction-details summary { background: var(--gray-100); }
[data-theme="dark"] .direction-details summary:hover { background: var(--gray-200); }
[data-theme="dark"] .direction-chart-bar-container { background: var(--gray-200); }

/* Responsive direction */
@media (max-width: 1024px) {
    .stats-grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    .direction-row {
        grid-template-columns: 1fr;
    }
    .direction-row-3 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .stats-grid-4 {
        grid-template-columns: 1fr;
    }
    .direction-mini-stats {
        flex-direction: column;
        align-items: center;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .nav-links {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .nav-links a {
        width: 100%;
    }
    
    .user-info {
        margin-left: 0;
        width: 100%;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .time-grid {
        grid-template-columns: 1fr;
    }
    
    .month-header {
        flex-direction: column;
        gap: 1rem;
    }
    
    .container {
        padding: 0 1rem;
    }
    
    .form-container,
    .dashboard,
    .vue-mensuelle,
    .section {
        padding: 1.5rem;
    }
}

/* ============================================================
   GESTION DES BUDGETS
   ============================================================ */

.budget-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.budget-year-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Barre de progression budget */
.budget-progress-bar {
    height: 8px;
    background: var(--gray-200);
    border-radius: 99px;
    overflow: hidden;
    width: 100%;
}

.budget-progress-fill {
    height: 100%;
    border-radius: 99px;
    transition: width 0.4s ease;
}

.budget-progress-low { background: var(--gray-300); }
.budget-progress-ok { background: var(--primary); }
.budget-progress-success { background: var(--success); }
.budget-progress-danger { background: var(--danger); }

/* Carte budget global */
.budget-global-card {
    display: flex;
    gap: 2rem;
    background: var(--gray-50);
    border: 2px solid var(--primary);
    border-radius: var(--radius-lg);
    padding: 1.5rem 2rem;
    margin-bottom: 1.5rem;
    align-items: center;
    animation: fadeInUp var(--transition-slow) both;
    transition: box-shadow var(--transition-normal);
}

.budget-global-card:hover {
    box-shadow: var(--shadow-md);
}

.budget-global-left {
    flex: 0 0 320px;
}

.budget-global-right {
    flex: 1;
    min-width: 0;
}

.budget-global-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.budget-global-input-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.budget-global-input {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-dark);
    border: 2px solid var(--gray-300);
    border-radius: 8px;
    padding: 0.5rem 1rem;
    width: 220px;
    background: var(--white);
}

.budget-global-input:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.budget-global-currency {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-dark);
}

.budget-global-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-dark);
}

.budget-summary-grid {
    display: flex;
    gap: 2rem;
}

.budget-summary-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.budget-summary-label {
    font-size: 0.8rem;
    color: var(--gray-500);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.budget-summary-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-900);
}

.budget-summary-reste {
    color: var(--primary);
}

/* Tableau budget */
.budget-table {
    font-size: 0.85rem;
}

.budget-table thead th {
    font-size: 0.75rem;
    padding: 0.75rem;
    white-space: nowrap;
}

.budget-table tbody td {
    padding: 0.6rem 0.75rem;
    vertical-align: middle;
}

.budget-table tfoot td {
    padding: 0.75rem;
}

.budget-col-number {
    text-align: right !important;
}

.budget-input {
    width: 100px;
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    font-size: 0.85rem;
    text-align: right;
    background: var(--white);
    transition: border-color 0.2s;
}

.budget-input:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.budget-input::-webkit-outer-spin-button,
.budget-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.budget-row-total {
    font-weight: 700;
    color: var(--gray-900);
    font-size: 0.9rem;
}

/* Actions budget */
.budget-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--gray-200);
}

.budget-save-status {
    font-size: 0.9rem;
    font-weight: 500;
}

.budget-save-success {
    color: var(--success);
}

.budget-save-error {
    color: var(--danger);
}

/* Grille de checkboxes */
.budget-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.budget-checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
    font-size: 0.9rem;
}

.budget-checkbox-item:hover {
    border-color: var(--primary);
    background: var(--white);
}

.budget-checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

/* Modale budget */
.budget-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.budget-modal-content {
    background: var(--white);
    border-radius: 12px;
    padding: 2rem;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.budget-modal-content h2 {
    margin-bottom: 1.5rem;
}

/* Dark theme budget */
[data-theme="dark"] .budget-global-card {
    background: var(--gray-100);
    border-color: var(--primary-light);
}

[data-theme="dark"] .budget-global-input {
    background: var(--gray-50);
    border-color: var(--gray-300);
    color: var(--gray-900);
}

[data-theme="dark"] .budget-input {
    background: var(--gray-50);
    border-color: var(--gray-300);
    color: var(--gray-900);
}

[data-theme="dark"] .budget-checkbox-item {
    background: var(--gray-100);
    border-color: var(--gray-300);
}

[data-theme="dark"] .budget-checkbox-item:hover {
    background: var(--gray-50);
    border-color: var(--primary-light);
}

[data-theme="dark"] .budget-modal-content {
    background: var(--white);
}

/* Budget tabs */
.budget-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--gray-200);
}

.budget-tab {
    padding: 0.75rem 1.5rem;
    text-decoration: none;
    color: var(--gray-500);
    font-weight: 600;
    font-size: 0.95rem;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s ease;
}

.budget-tab:hover {
    color: var(--primary);
    background: var(--gray-50);
}

.budget-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

[data-theme="dark"] .budget-tab {
    color: var(--gray-500);
}

[data-theme="dark"] .budget-tab:hover {
    color: var(--primary-light);
    background: var(--gray-200);
}

[data-theme="dark"] .budget-tab.active {
    color: var(--primary-light);
    border-bottom-color: var(--primary-light);
}

/* Jours ouvrés label */
.budget-jours-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--gray-500);
    margin-top: 2px;
}

[data-theme="dark"] .alert-error {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.3);
}

/* Responsive budget */
@media (max-width: 1024px) {
    .budget-global-card {
        flex-direction: column;
    }

    .budget-global-left {
        flex: none;
        width: 100%;
    }

    .budget-summary-grid {
        flex-direction: column;
        gap: 1rem;
    }
}

@media (max-width: 768px) {
    .budget-header {
        flex-direction: column;
    }

    .budget-input {
        width: 80px;
    }

    .budget-global-input {
        width: 160px;
        font-size: 1.25rem;
    }

    .budget-global-currency {
        font-size: 1.25rem;
    }
}

/* ============================================================
   GESTION DES SUBVENTIONS (Board Monday.com)
   ============================================================ */

.sv-page {
    margin-top: -0.5rem;
    animation: fadeInUp var(--transition-slow) both;
}

.sv-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    background: var(--white);
    padding: 1.75rem 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-200);
    border-left: 5px solid var(--primary);
    animation: fadeInUp var(--transition-slow) both;
}

.sv-header h1 {
    font-size: 1.75rem;
    margin-bottom: 0.25rem;
}

.sv-header .subtitle {
    margin-bottom: 0;
}

/* ── Groupe ── */
.sv-group {
    margin-bottom: 1.25rem;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow);
    animation: fadeInUp var(--transition-slow) both;
    transition: box-shadow var(--transition-normal);
    border: 1px solid var(--gray-200);
}

.sv-group:nth-child(2) { animation-delay: 0.05s; }
.sv-group:nth-child(3) { animation-delay: 0.1s; }
.sv-group:nth-child(4) { animation-delay: 0.15s; }
.sv-group:nth-child(5) { animation-delay: 0.2s; }
.sv-group:nth-child(6) { animation-delay: 0.25s; }

.sv-group:hover {
    box-shadow: var(--shadow-md);
}

.sv-group-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    user-select: none;
    transition: filter var(--transition-fast);
}

.sv-group-head:hover {
    filter: brightness(1.08);
}

.sv-group-arrow {
    font-size: 1rem;
    width: 16px;
    text-align: center;
    transition: transform var(--transition-fast);
}

.sv-group-label {
    flex: 1;
}

.sv-group-count {
    font-size: 0.8rem;
    opacity: 0.85;
    font-weight: 400;
}

.sv-group-add {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.4);
    color: #fff;
    padding: 5px 14px;
    border-radius: 99px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.sv-group-add:hover {
    background: rgba(255,255,255,0.35);
    transform: scale(1.05);
}

/* ── Board (table scrollable) ── */
.sv-group-body {
    background: var(--white);
}

.sv-scroll {
    overflow-x: auto;
    overflow-y: visible;
}

.sv-board {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.sv-board thead th {
    padding: 8px 12px;
    text-align: left;
    font-weight: 600;
    color: var(--gray-500);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-bottom: 1px solid var(--gray-200);
    white-space: nowrap;
    background: var(--gray-50);
}

.sv-board tbody td {
    padding: 6px 12px;
    border-bottom: 1px solid var(--gray-100);
    white-space: nowrap;
    vertical-align: middle;
    min-height: 40px;
    height: 40px;
}

.sv-row {
    transition: all var(--transition-fast);
}

.sv-row:hover td {
    background: var(--gray-50);
}

/* ── Colonne sticky (nom) ── */
.sv-sticky {
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--white);
}

.sv-row:hover .sv-sticky {
    background: var(--gray-50);
}

.sv-board thead .sv-sticky {
    background: var(--gray-50);
    z-index: 3;
}

.sv-col-name {
    min-width: 260px;
    max-width: 320px;
    font-weight: 600;
    color: var(--gray-900);
    position: relative;
    padding-left: 42px !important;
}

.sv-left-color {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
}

/* ── Tailles colonnes ── */
.sv-col-person { width: 80px; min-width: 80px; text-align: center; }
.sv-col-status { width: 160px; min-width: 160px; }
.sv-col-date { width: 130px; min-width: 130px; }
.sv-col-amount { width: 140px; min-width: 140px; text-align: right; }
.sv-col-file { width: 90px; min-width: 90px; text-align: center; }
.sv-col-select { width: 160px; min-width: 160px; }
.sv-col-text { width: 160px; min-width: 160px; }
.sv-col-actions { width: 44px; min-width: 44px; text-align: center; }
.sv-col-name-end { min-width: 200px; font-weight: 600; color: var(--gray-900); white-space: nowrap; }

/* ── Avatars (initiales) ── */
.sv-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    cursor: pointer;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.sv-avatar:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(47, 110, 166, 0.35);
}

.sv-avatar-sm {
    width: 28px;
    height: 28px;
    font-size: 0.6rem;
}

.sv-avatar-empty {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 2px dashed var(--gray-300);
    color: var(--gray-300);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.15s;
}

.sv-avatar-empty:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.sv-avatar-empty.sv-avatar-sm {
    width: 28px;
    height: 28px;
    font-size: 0.85rem;
}

/* ── Statut pill ── */
.sv-status-pill {
    display: inline-block;
    padding: 5px 14px;
    border-radius: 99px;
    color: #fff;
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition-fast);
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

.sv-status-pill:hover {
    opacity: 0.9;
    transform: scale(1.05);
    box-shadow: 0 2px 6px rgba(0,0,0,0.18);
}

/* ── Sous-éléments status ── */
.sv-se-status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 99px;
    color: #fff;
    font-weight: 600;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.sv-se-status:hover {
    opacity: 0.9;
    transform: scale(1.05);
}

/* ── Expand arrow ── */
.sv-expand-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 4px;
    color: var(--gray-500);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s;
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
}

.sv-expand-btn:hover {
    background: var(--gray-200);
    color: var(--gray-900);
}

.sv-expand-open {
    color: var(--primary);
}

/* ── Sous-éléments row ── */
.sv-sub-row td {
    padding: 0 !important;
    background: var(--gray-50);
}

.sv-sub-spacer {
    min-width: 260px;
    max-width: 320px;
    position: relative;
}

.sv-sub-td {
    padding: 12px 16px !important;
}

.sv-sub-table {
    width: auto;
    border-collapse: collapse;
    font-size: 0.82rem;
    background: var(--white);
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--gray-200);
}

.sv-sub-table thead th {
    padding: 6px 10px;
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--gray-500);
    font-weight: 600;
    border-bottom: 1px solid var(--gray-200);
    background: var(--gray-50);
    text-align: left;
}

.sv-sub-table tbody td {
    padding: 6px 10px;
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
}

.sv-sub-table tbody tr:last-child td {
    border-bottom: none;
}

.sv-sub-table tbody tr:hover td {
    background: var(--gray-50);
}

/* ── Boutons ── */
.sv-del-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    opacity: 0.4;
    transition: opacity 0.15s;
    padding: 2px;
}

.sv-del-btn:hover {
    opacity: 1;
}

.sv-del-btn-sm {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--gray-300);
    transition: color 0.15s;
    padding: 0 4px;
}

.sv-del-btn-sm:hover {
    color: var(--danger);
}

.sv-add-se-btn {
    background: none;
    border: 1px dashed var(--gray-300);
    color: var(--gray-500);
    padding: 6px 14px;
    border-radius: 99px;
    font-size: 0.8rem;
    cursor: pointer;
    margin-top: 8px;
    transition: all var(--transition-fast);
}

.sv-add-se-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--gray-50);
    transform: translateY(-1px);
}

/* ── Inline editing ── */
.sv-inline-input {
    width: 100%;
    padding: 4px 8px;
    border: 1px solid var(--primary);
    border-radius: 4px;
    font-size: 0.85rem;
    outline: none;
    background: var(--white);
    color: var(--gray-900);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.sv-inline-select {
    width: 100%;
    padding: 4px 6px;
    border: 1px solid var(--primary);
    border-radius: 4px;
    font-size: 0.82rem;
    outline: none;
    background: var(--white);
    color: var(--gray-900);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

/* ── File link ── */
.sv-file-link {
    text-decoration: none;
    font-size: 0.8rem;
    color: var(--primary);
    font-weight: 500;
}

.sv-file-link:hover {
    text-decoration: underline;
}

.sv-file-upload {
    cursor: pointer;
    font-size: 1rem;
    opacity: 0.5;
    transition: opacity 0.15s;
}

.sv-file-upload:hover {
    opacity: 1;
}

/* ── Placeholder ── */
.sv-placeholder {
    color: var(--gray-300);
    font-style: italic;
}

/* ── Empty state ── */
.sv-empty {
    text-align: center;
    padding: 1.5rem !important;
    color: var(--gray-500);
    font-style: italic;
}

/* ── Curseur edition ── */
.sv-cell-text-edit { cursor: text; }
.sv-cell-date { cursor: pointer; }
.sv-cell-amount { cursor: text; }
.sv-cell-person { cursor: pointer; }

/* ── Dark theme subventions ── */
[data-theme="dark"] .sv-header { background: var(--white); border-color: var(--gray-300); border-left-color: var(--primary-light); }
[data-theme="dark"] .sv-group { border-color: var(--gray-300); }
[data-theme="dark"] .sv-group-body { background: var(--white); }
[data-theme="dark"] .sv-board thead th { background: var(--gray-100); }
[data-theme="dark"] .sv-sticky { background: var(--white); }
[data-theme="dark"] .sv-row:hover td { background: var(--gray-100); }
[data-theme="dark"] .sv-row:hover .sv-sticky { background: var(--gray-100); }
[data-theme="dark"] .sv-board thead .sv-sticky { background: var(--gray-100); }
[data-theme="dark"] .sv-sub-row td { background: var(--gray-100); }
[data-theme="dark"] .sv-sub-table { background: var(--white); border-color: var(--gray-300); }
[data-theme="dark"] .sv-sub-table thead th { background: var(--gray-100); }
[data-theme="dark"] .sv-sub-table tbody tr:hover td { background: var(--gray-100); }
[data-theme="dark"] .sv-avatar-empty { border-color: var(--gray-300); color: var(--gray-500); }
[data-theme="dark"] .sv-inline-input { background: var(--gray-50); color: var(--gray-900); }
[data-theme="dark"] .sv-inline-select { background: var(--gray-50); color: var(--gray-900); }

/* ── Benevoles : colonne commentaire + textarea inline ── */
.sv-col-comment { min-width: 200px; max-width: 300px; white-space: pre-wrap; word-break: break-word; }
.sv-inline-textarea { width: 100%; padding: 4px 8px; border: 1px solid var(--primary); border-radius: 4px; box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15); resize: vertical; font-family: inherit; font-size: 0.85rem; }

/* ═══════════════════════════════════════════════════════
   MODULE SALLES – Reservations de salles
   ═══════════════════════════════════════════════════════ */

.salles-page { max-width: 1400px; margin: 0 auto; }

.salles-header {
    display: flex; justify-content: space-between; align-items: flex-start;
    margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
}
.salles-header h1 {
    display: flex; align-items: center; gap: 8px;
    margin: 0; font-size: 1.6rem; color: var(--gray-900);
}
.salles-header .subtitle { color: var(--gray-500); margin: 4px 0 0; font-size: 0.9rem; }

.salles-section {
    background: var(--white); border-radius: var(--radius-lg);
    box-shadow: var(--shadow); padding: 20px;
    margin-bottom: 20px; border: 1px solid var(--gray-200);
    animation: fadeInUp var(--transition-slow) both;
    transition: box-shadow var(--transition-normal);
}
.salles-section:hover { box-shadow: var(--shadow-md); }
.salles-section-title {
    font-size: 1.1rem; color: var(--gray-900); margin: 0;
    cursor: pointer; user-select: none; display: flex; align-items: center; gap: 8px;
}
.salles-section-title:hover { color: var(--primary); }
.salles-arrow { font-size: 0.9rem; width: 16px; display: inline-block; }
.salles-section-body { margin-top: 16px; }

/* Tables */
.salles-table {
    width: 100%; border-collapse: collapse; font-size: 0.88rem;
}
.salles-table th {
    text-align: left; padding: 8px 10px; background: var(--gray-50);
    color: var(--gray-700); font-weight: 600; border-bottom: 2px solid var(--gray-200);
    white-space: nowrap;
}
.salles-table td {
    padding: 6px 10px; border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
}
.salles-table input[type="text"],
.salles-table input[type="number"] {
    padding: 4px 8px; border: 1px solid var(--gray-200); border-radius: 4px;
    font-size: 0.85rem; width: 100%;
}
.salles-actions { white-space: nowrap; display: flex; gap: 4px; }

/* Formulaires inline */
.salles-form-inline {
    display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
    margin-bottom: 16px;
}
.salles-form-inline input,
.salles-form-inline select {
    padding: 6px 10px; border: 1px solid var(--gray-200); border-radius: 6px;
    font-size: 0.88rem;
}

/* Formulaire grille */
.salles-form-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}
.salles-form-field label {
    display: block; font-size: 0.82rem; font-weight: 600;
    color: var(--gray-700); margin-bottom: 4px;
}
.salles-form-field input,
.salles-form-field select {
    width: 100%; padding: 6px 10px; border: 1px solid var(--gray-200);
    border-radius: 6px; font-size: 0.88rem;
}
.salles-form-field input[type="checkbox"] {
    width: auto; margin-right: 6px;
}

/* Dot de couleur */
.salles-color-dot {
    display: inline-block; width: 10px; height: 10px; border-radius: 50%;
    vertical-align: middle; margin-right: 4px;
}

/* ── Timeline / Grille horaire ── */
.salles-grid-wrapper {
    display: flex; flex-direction: column; gap: 0; margin: 16px 0; overflow-x: auto;
}
.salles-timeline {
    display: flex; flex-direction: row; padding-top: 0; padding-left: 160px; flex-shrink: 0;
}
.salles-time-label {
    flex: 1; height: auto; display: flex; align-items: center; justify-content: flex-start;
    font-size: 0.72rem; color: var(--gray-500); padding: 0 0 4px;
    white-space: nowrap; min-width: 0;
}
.salles-grid {
    display: flex; flex-direction: column; gap: 4px; width: 100%;
}
.salles-grid-row {
    display: flex; align-items: center; height: 36px;
}
.salles-grid-label {
    width: 160px; flex-shrink: 0; font-size: 0.85rem; font-weight: 600;
    color: var(--gray-700); padding-right: 8px; display: flex; align-items: center;
    gap: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.salles-grid-label a { color: var(--gray-700); text-decoration: none; }
.salles-grid-label a:hover { color: var(--primary); text-decoration: underline; }
.salles-grid-label small { color: var(--gray-500); font-weight: 400; }
.salles-grid-track {
    flex: 1; height: 100%; position: relative;
    background: var(--gray-50); border-radius: 4px;
    display: flex; min-width: 0;
}
.salles-grid-hour {
    flex: 1; border-right: 1px solid var(--gray-200); min-width: 0;
}
.salles-grid-hour:last-child { border-right: none; }
.salles-grid-block {
    position: absolute; top: 2px; bottom: 2px; border-radius: 4px;
    color: #fff; font-size: 0.72rem; display: flex; align-items: center;
    padding: 0 6px; overflow: hidden; cursor: default;
    opacity: 0.9; z-index: 1;
}
.salles-grid-block:hover { opacity: 1; }
.salles-block-text {
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ── Liste reservations ── */
.salles-list { margin-top: 16px; }

/* ── Liens calendrier ── */
.salles-calendrier-links {
    display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px;
}
.salles-cal-link {
    display: flex; align-items: center; gap: 6px;
    padding: 8px 16px; background: var(--gray-50); border-radius: 8px;
    color: var(--gray-700); text-decoration: none; font-size: 0.9rem;
    font-weight: 500; border: 1px solid var(--gray-200);
    transition: all 0.15s;
}
.salles-cal-link:hover {
    background: var(--primary); color: #fff; border-color: var(--primary);
}
.salles-cal-link:hover .salles-color-dot { background: #fff !important; }

/* ═══════ CALENDRIER SALLE ═══════ */

.salles-cal-nav {
    display: flex; align-items: center; justify-content: center; gap: 20px;
    margin-bottom: 20px;
}
.salles-cal-month {
    font-size: 1.3rem; margin: 0; min-width: 200px; text-align: center;
    color: var(--gray-900);
}

.salles-cal-grid {
    background: var(--white); border-radius: 12px;
    box-shadow: var(--shadow); overflow: hidden;
}
.salles-cal-header {
    display: grid; grid-template-columns: repeat(7, 1fr);
    background: var(--gray-50); border-bottom: 2px solid var(--gray-200);
}
.salles-cal-header > div {
    padding: 10px; text-align: center; font-weight: 600;
    font-size: 0.85rem; color: var(--gray-700);
}
.salles-cal-week {
    display: grid; grid-template-columns: repeat(7, 1fr);
    border-bottom: 1px solid var(--gray-100);
}
.salles-cal-week:last-child { border-bottom: none; }

.salles-cal-day {
    min-height: 90px; padding: 4px 6px;
    border-right: 1px solid var(--gray-100);
}
.salles-cal-day:last-child { border-right: none; }
.salles-cal-day-num {
    font-size: 0.82rem; font-weight: 600; color: var(--gray-700);
    margin-bottom: 4px;
}
.salles-cal-other { background: var(--gray-50); }
.salles-cal-other .salles-cal-day-num { color: var(--gray-300); }
.salles-cal-today {
    background: #eff6ff;
}
.salles-cal-today .salles-cal-day-num {
    color: var(--primary); font-weight: 700;
}
[data-theme="dark"] .salles-cal-today { background: #1e3a5f; }

.salles-cal-event {
    padding: 2px 4px; margin-bottom: 2px; border-radius: 3px;
    font-size: 0.72rem; line-height: 1.3; cursor: default;
    overflow: hidden;
}
.salles-cal-event-time {
    font-weight: 600; color: var(--gray-700); display: block;
}
.salles-cal-event-title {
    color: var(--gray-900); display: block; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .salles-grid-label { width: 80px; font-size: 0.75rem; }
    .salles-time-label { font-size: 0.65rem; }
    .salles-timeline { padding-left: 80px; }
    .salles-form-grid { grid-template-columns: 1fr; }
    .salles-cal-day { min-height: 60px; padding: 2px; }
    .salles-cal-event-title { display: none; }
    .salles-header { flex-direction: column; }
}

/* ═══════ AIDE CONTEXTUELLE (TOOLTIP) ═══════ */

.ctx-help {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    margin-left: 0.4rem;
    flex-shrink: 0;
    vertical-align: middle;
    transition: background 0.2s, transform 0.15s;
    line-height: 1;
    user-select: none;
}

.ctx-help:hover {
    background: var(--primary-dark);
    transform: scale(1.1);
}

.ctx-help-bubble {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    width: 300px;
    padding: 0.75rem 1rem;
    background: var(--gray-900);
    color: #f1f5f9;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 400;
    line-height: 1.5;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    pointer-events: none;
}

.ctx-help-bubble::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--gray-900);
}

/* Afficher au clic (classe active) */
.ctx-help.active .ctx-help-bubble {
    display: block;
    pointer-events: auto;
}

/* Positionnement alternatif pour les tooltips en haut de page */
.ctx-help--below .ctx-help-bubble {
    bottom: auto;
    top: calc(100% + 8px);
}

.ctx-help--below .ctx-help-bubble::after {
    top: auto;
    bottom: 100%;
    border-top-color: transparent;
    border-bottom-color: var(--gray-900);
}

/* Ajustement quand le tooltip déborde à gauche */
.ctx-help--left .ctx-help-bubble {
    left: 0;
    transform: none;
}

.ctx-help--left .ctx-help-bubble::after {
    left: 10px;
    transform: none;
}

/* Dark mode */
[data-theme="dark"] .ctx-help {
    background: var(--primary-light);
}

[data-theme="dark"] .ctx-help:hover {
    background: var(--primary);
}

[data-theme="dark"] .ctx-help-bubble {
    background: #1e293b;
    color: #e2e8f0;
    border: 1px solid var(--gray-300);
}

[data-theme="dark"] .ctx-help-bubble::after {
    border-top-color: #1e293b;
}

[data-theme="dark"] .ctx-help--below .ctx-help-bubble::after {
    border-top-color: transparent;
    border-bottom-color: #1e293b;
}

/* Responsive : tooltip plein écran sur mobile */
@media (max-width: 480px) {
    .ctx-help-bubble {
        position: fixed;
        bottom: auto;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: calc(100vw - 2rem);
        max-width: 340px;
    }
    .ctx-help-bubble::after {
        display: none;
    }
}

/* ═══════════════════════════════════════════════════════
   MODULE FACTURES - Modales et page factures
   ═══════════════════════════════════════════════════════ */

.factures-page {
    max-width: 1400px;
    margin: 0 auto;
    animation: fadeInUp var(--transition-slow) both;
}

/* ── Modale générique ── */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: var(--white);
    border-radius: 12px;
    padding: 0;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.2s ease;
}

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

.modal-content .form-group {
    padding: 0 1.5rem;
    margin-bottom: 1rem;
}

.modal-content .actions {
    padding: 0 1.5rem 1.5rem;
    display: flex;
    gap: 0.5rem;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    margin-bottom: 1.25rem;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.15rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--gray-500);
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.15s;
}

.modal-close:hover {
    color: var(--gray-900);
}

/* Dark theme modales */
[data-theme="dark"] .modal-content {
    background: var(--white);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

[data-theme="dark"] .modal-header {
    border-bottom-color: var(--gray-300);
}

[data-theme="dark"] .modal-close {
    color: var(--gray-500);
}

[data-theme="dark"] .modal-close:hover {
    color: var(--gray-900);
}
