/* --- VARIABLES & RESET --- */
:root {
    --sidebar-bg: #1A1C29;
    --sidebar-text: #A0AEC0;
    --sidebar-hover: #2D3748;
    --main-bg: #F8F9FA;
    --primary: #4F46E5;
    --primary-light: #EBF4FF;
    --border: #E2E8F0;
    --success: #48BB78;
    --danger: #EF4444;
    --white: #FFFFFF;
}

* { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
    font-family: 'Segoe UI', system-ui, sans-serif; 
}

body { 
    background-color: var(--main-bg); 
    color: #1e293b; 
    height: 100vh; 
    overflow: hidden; 
}

/* --- LAYOUT --- */
.app-container { 
    display: flex; 
    height: 100vh; 
}

/* --- SIDEBAR --- */
.sidebar { 
    width: 280px; 
    background-color: var(--sidebar-bg); 
    color: var(--white); 
    padding: 20px; 
    display: flex; 
    flex-direction: column; 
    overflow-y: auto;
}

.sidebar .brand { margin-bottom: 25px; }
.sidebar .brand h1 { font-size: 1.5rem; margin-bottom: 5px; }
.sidebar .brand p { color: var(--sidebar-text); font-size: 0.8rem; }

/* Mini Calendrier dans Sidebar */
.month-selector {
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    margin-bottom: 20px;
}

/* Thème clair pour le mini-calendrier dans le journal de bord */
.month-selector.light-theme {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 12px;
    border-radius: 12px;
}

.month-selector.light-theme .month-nav {
    color: #1e293b;
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: capitalize;
}

.month-selector.light-theme .month-nav span,
#dir-week-label {
    color: #1e293b !important;
    font-weight: 700 !important;
    font-size: 0.95rem;
}

.month-selector.light-theme .month-nav button {
    color: #64748b;
    font-size: 1.1rem;
    font-weight: bold;
    padding: 2px 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.month-selector.light-theme .month-nav button:hover {
    color: #0f172a;
    background-color: #e2e8f0;
}

.month-selector.light-theme .mini-day-name {
    color: #64748b;
    font-weight: 700;
}

.month-selector.light-theme .mini-day {
    color: #334155;
}

.month-selector.light-theme .mini-day:hover {
    background-color: #e2e8f0;
    color: #0f172a;
}

.month-selector.light-theme .mini-day.active {
    background-color: #4f46e5;
    color: #ffffff;
    font-weight: bold;
}

.month-selector.light-theme .mini-day.other-month {
    color: #cbd5e1;
    opacity: 0.5;
}

.month-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    font-weight: bold;
    font-size: 0.85rem;
    color: var(--white);
}

.month-nav button { 
    background: none; 
    border: none; 
    color: var(--sidebar-text); 
    cursor: pointer; 
    padding: 5px;
}

.month-nav button:hover { color: var(--white); }

.mini-calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.mini-day-name {
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--sidebar-text);
    padding-bottom: 5px;
    text-align: center;
}

.mini-day {
    font-size: 0.7rem;
    padding: 6px 0;
    cursor: pointer;
    border-radius: 6px;
    transition: 0.2s;
    aspect-ratio: 1/1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--sidebar-text);
}

.mini-day:hover { background-color: var(--sidebar-hover); }
.mini-day.active { background-color: var(--primary); color: var(--white); font-weight: bold; }
.mini-day.other-month { opacity: 0.3; }

/* Menu */
.menu button { 
    width: 100%; 
    text-align: left; 
    padding: 12px; 
    background: none; 
    border: none; 
    color: var(--sidebar-text); 
    cursor: pointer; 
    border-radius: 8px; 
    margin-bottom: 5px; 
    font-size: 0.95rem; 
    transition: 0.2s;
}

.menu button.active, .menu button:hover { 
    background-color: var(--primary); 
    color: var(--white); 
}

/* --- MAIN CONTENT --- */
.main-content { 
    flex: 1; 
    padding: 30px; 
    overflow-y: auto; 
    display: flex;
    flex-direction: column;
}

.view { display: none; height: 100%; }
.view.active { display: flex; flex-direction: column; }

.section-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 25px; 
}

/* --- CALENDAR GRID --- */
.calendar-grid { 
    display: flex; 
    flex: 1;
    border: 1px solid var(--border); 
    background: var(--white); 
    overflow-y: auto; 
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
}

.time-col { 
    width: 65px; 
    flex-shrink: 0; 
    border-right: 1px solid var(--border); 
    background: #FAFBFC; 
}

.day-col { 
    flex: 1; 
    border-right: 1px solid var(--border); 
    position: relative; 
    min-width: 120px; 
}

.day-col:last-child { border-right: none; }

.day-header { 
    text-align: center; 
    height: 52px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-bottom: 1px solid var(--border); 
    font-weight: 700; 
    position: sticky; 
    top: 0; 
    background: var(--white); 
    z-index: 10; 
    font-size: 0.85rem; 
    box-sizing: border-box;
}

.time-cell { 
    height: 60px; 
    border-bottom: 1px solid #F1F5F9; 
    padding-right: 8px; 
    padding-top: 4px; 
    text-align: right; 
    font-size: 0.7rem; 
    color: #94A3B8; 
}

.slot-cell { 
    height: 30px; 
    border-bottom: 1px dotted #F1F5F9; 
    cursor: pointer; 
}

.slot-cell:hover { background-color: var(--primary-light); }

/* Events */
.calendar-event {
    position: absolute;
    left: 4px;
    right: 4px;
    border-radius: 6px;
    padding: 3px 5px 8px 5px; /* Added bottom padding for the resize handle */
    font-size: 0.62rem;
    color: var(--white);
    overflow: hidden; /* Changed from overflow-y: auto to prevent scrollbar conflict with handle */
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    z-index: 5;
    cursor: grab;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    text-align: left;
    font-weight: 600;
    line-height: 1.2;
    border: 1px solid rgba(0,0,0,0.05);
    transition: transform 0.1s, filter 0.2s;
}

/* Event Resize Handle */
.event-resize-handle {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 8px;
    cursor: ns-resize;
    background: transparent;
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
}
.event-resize-handle::after {
    content: "";
    width: 16px;
    height: 2px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 1px;
    opacity: 0;
    transition: opacity 0.2s;
}
.calendar-event:hover .event-resize-handle::after {
    opacity: 1;
}
.event-resize-handle:hover::after {
    background: rgba(0, 0, 0, 0.4);
}

.calendar-event:hover {
    filter: brightness(92%);
    z-index: 20;
    transform: scale(1.02);
}
.calendar-event:active {
    cursor: grabbing;
}

/* Scrollbar discrète pour les événements */
.calendar-event::-webkit-scrollbar {
    width: 4px;
}
.calendar-event::-webkit-scrollbar-track {
    background: transparent;
}
.calendar-event::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.4);
    border-radius: 4px;
}
.calendar-event:hover::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.7);
}

/* --- HORIZONTAL BARS (STATS) --- */
.bars-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 15px;
    padding-right: 10px;
}

.stat-bar-wrapper {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-bar-header {
    display: flex;
    justify-content: flex-end;
    font-size: 0.8rem;
    font-weight: 600;
}

.stat-bar-bg {
    background: #e2e8f0;
    border-radius: 4px;
    height: 24px;
    width: 100%;
    position: relative;
    overflow: hidden;
}

.stat-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    padding-left: 10px;
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

/* --- COMPONENTS --- */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
    margin-top: 10px;
}

.setting-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    transition: transform 0.2s, box-shadow 0.2s;
}

.setting-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.05);
}

.setting-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.color-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
}

.setting-card-title {
    font-weight: 600;
    color: #1e293b;
    font-size: 0.95rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.setting-card-body {
    font-size: 0.8rem;
    color: #64748b;
    margin-bottom: 15px;
    line-height: 1.4;
}

.setting-card-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    border-top: 1px solid #f1f5f9;
    padding-top: 12px;
}

.btn-icon {
    background: transparent;
    border: none;
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}

.btn-icon:hover {
    background: #f1f5f9;
    color: #475569;
}

.btn-icon.danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.btn-primary { 
    background-color: var(--primary); 
    color: var(--white); 
    border: none; 
    padding: 10px 20px; 
    border-radius: 8px; 
    cursor: pointer; 
    font-weight: 600;
    transition: 0.2s;
}

.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }

.list-item, .category-item, .contract-card { 
    background: var(--white); 
    padding: 16px; 
    border-radius: 10px; 
    border: 1px solid var(--border); 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 10px;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.75rem;
    background: #F1F5F9;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

.btn-danger { background: #FFF5F5; color: var(--danger); border-color: #FED7D7; }
.btn-danger:hover { background: #fee2e2; }

.hatched {
    background-image: repeating-linear-gradient(
        45deg,
        rgba(255, 255, 255, 0.8),
        rgba(255, 255, 255, 0.8) 5px,
        currentColor 5px,
        currentColor 6px
    );
}

.calendar-event {
    box-sizing: border-box;
    transition: transform 0.1s, filter 0.2s;
    border-left: 4px solid currentColor !important;
    border: 1px solid rgba(0,0,0,0.05);
}

/* Premium Modal Styles */
.premium-modal {
    width: 550px !important;
    padding: 0 !important;
    overflow: hidden;
    border-radius: 16px !important;
    background: #ffffff;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15) !important;
    border: 1px solid rgba(0,0,0,0.05);
}

.modal-header-premium {
    padding: 20px 30px 10px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.premium-title-input {
    font-size: 1.5rem !important;
    font-weight: 600 !important;
    border: none !important;
    border-bottom: 2px solid transparent !important;
    width: 100%;
    padding: 5px 0 !important;
    color: #1e293b;
    background: transparent;
}

.premium-title-input:focus {
    border-bottom-color: var(--primary) !important;
}

.premium-title-input::placeholder {
    color: #cbd5e1;
}

.btn-close-premium {
    background: none;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: #94a3b8;
    transition: color 0.2s;
}

.btn-close-premium:hover {
    color: #475569;
}

/* Onglets Types */
.premium-tabs-container {
    padding: 0 30px;
    margin-bottom: 5px;
}

.premium-tabs {
    display: flex;
    background: #f1f5f9;
    border-radius: 8px;
    padding: 4px;
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: #64748B;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 8px 0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    color: #1e293b;
}

.tab-btn.active {
    background: #ffffff;
    color: var(--primary);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.modal-body-premium {
    padding: 20px 30px 30px 30px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.premium-row {
    display: flex;
    align-items: center;
    gap: 15px;
}

.premium-icon {
    width: 32px;
    display: flex;
    justify-content: center;
    color: #94a3b8;
}

.premium-icon.align-top {
    align-self: flex-start;
    margin-top: 10px;
}

.premium-select, .premium-textarea {
    flex: 1;
    padding: 12px 15px !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 8px !important;
    font-size: 0.95rem !important;
    background: #f8fafc;
    color: #334155;
    transition: border-color 0.2s, background 0.2s;
    width: 100%;
}

.premium-select:focus, .premium-textarea:focus {
    border-color: var(--primary) !important;
    background: #ffffff;
}

.premium-textarea {
    min-height: 80px;
    resize: vertical;
}

/* DateTime Group */
.premium-datetime-group {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
}

.premium-input {
    padding: 10px 15px !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 8px !important;
    font-size: 0.95rem !important;
    background: #f8fafc;
    color: #334155;
    outline: none;
    transition: border-color 0.2s;
}

.premium-input:focus {
    border-color: var(--primary) !important;
    background: #ffffff;
}

.time-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 2px 10px;
}

.time-wrapper:focus-within {
    border-color: var(--primary);
    background: #ffffff;
}

.time-input {
    border: none !important;
    background: transparent !important;
    padding: 8px 5px !important;
    width: 60px !important;
    text-align: center;
}

.date-input {
    width: 135px !important;
}

.time-sep {
    color: #94a3b8;
    font-size: 0.8rem;
}

/* Switch Toggle (iOS style) */
.premium-switch-label {
    display: flex;
    align-items: center;
    width: 100%;
    font-size: 0.95rem;
    font-weight: 500;
    color: #334155;
    cursor: pointer;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    margin-left: auto;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #cbd5e1;
    transition: .3s;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--primary);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

.toggle-slider.round {
    border-radius: 24px;
}

.toggle-slider.round:before {
    border-radius: 50%;
}

.modal-footer-premium {
    padding: 20px 30px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
}

.btn-primary-premium {
    background: var(--primary);
    color: #fff;
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.2);
    transition: transform 0.1s, box-shadow 0.2s;
}

.btn-primary-premium:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(79, 70, 229, 0.3);
}

.btn-delete-premium {
    background: transparent;
    color: var(--danger);
    padding: 10px 15px;
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-delete-premium:hover {
    background: rgba(239, 68, 68, 0.05);
}

/* Modales */
.modal { 
    position: fixed; 
    top: 0; left: 0; width: 100%; height: 100%; 
    background: rgba(15, 23, 42, 0.4); 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    z-index: 1000; 
}

.modal.hidden { display: none; }

.modal-content { 
    background: var(--white); 
    border-radius: 12px; 
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.modal-content label { font-size: 0.8rem; font-weight: 700; color: #64748B; margin-bottom: -5px; }

.modal-content input, .modal-content select, textarea { 
    padding: 12px; 
    border: 1px solid var(--border); 
    border-radius: 8px; 
    font-size: 0.9rem;
    outline: none;
}

.modal-content input:focus { border-color: var(--primary); }

/* Utilitaires */
.positive { color: var(--success); }
.negative { color: var(--danger); }

.stats-grid {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.chart-container { 
    background: var(--white); 
    padding: 25px; 
    border-radius: 16px; 
    border: 1px solid var(--border); 
    flex: 1;
    min-width: 350px;
    max-width: 500px;
    margin: 10px; 
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    height: auto;
    min-height: 450px;
    display: flex;
    flex-direction: column;
}

.chart-container h3 {
    font-size: 1rem;
    color: #64748B;
    margin-bottom: 15px;
    text-align: center;
}

.version-control { margin-top: auto; padding-top: 20px; display: flex; gap: 10px; }
.version-control button { 
    flex: 1;
    border: 1px solid rgba(255,255,255,0.1); 
    background: rgba(255,255,255,0.05); 
    color: var(--sidebar-text); 
    padding: 10px; 
    border-radius: 8px; 
    cursor: pointer; 
    font-size: 0.8rem;
}

.version-control button:hover { background: rgba(255,255,255,0.1); color: var(--white); }

.today-highlight { 
    background-color: rgba(67, 56, 202, 0.05) !important; 
}
.time-marker {
    position: absolute;
    left: 0; right: 0;
    border-top: 2px solid #ef4444;
    z-index: 10;
    pointer-events: none;
}
.time-marker::after {
    content: '';
    position: absolute;
    left: 0; top: -4px;
    width: 8px; height: 8px;
    background: #ef4444;
    border-radius: 50%;
}

/* --- OVERLAY AUTH --- */
.auth-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: var(--main-bg);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}
.auth-modal {
    background: var(--white);
    padding: 36px 40px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 420px;
    border: 1px solid var(--border);
}
.auth-header {
    text-align: center;
    margin-bottom: 24px;
}
.auth-lock-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 14px;
    border-radius: 12px;
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
}
.auth-header h2 {
    margin: 0 0 8px 0;
    color: #1e293b;
    font-size: 1.4rem;
}
.auth-header p {
    margin: 0;
    color: #64748b;
    font-size: 0.88rem;
    line-height: 1.4;
}
.auth-field {
    margin-bottom: 16px;
    text-align: left;
}
.auth-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 6px;
}
.auth-modal .premium-input {
    width: 100%;
    box-sizing: border-box;
}
.auth-status {
    font-size: 0.82rem;
    color: #ef4444;
    text-align: center;
    min-height: 18px;
    margin-top: 4px;
}
.auth-status.info {
    color: #475569;
}

/* --- USER BANNER --- */
.user-banner {
    position: fixed;
    top: 0; left: 280px; right: 0;
    height: 40px;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    z-index: 50;
    font-size: 0.85rem;
    color: #334155;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}
.user-banner.director-banner {
    left: 0;
}
.banner-user-email {
    color: #64748b;
    font-size: 0.78rem;
    margin-left: 6px;
}
.app-container {
    padding-top: 40px; /* Espace pour la bannière */
}
.sidebar {
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
}
.main-content {
    margin-left: 280px;
    height: calc(100vh - 40px); /* Height minus banner */
}

.btn-disconnect {
    background: transparent;
    border: 1px solid var(--border);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    color: #64748b;
    cursor: pointer;
    transition: 0.2s;
}
.btn-disconnect:hover {
    background: #f1f5f9;
    color: var(--danger);
    border-color: #cbd5e1;
}

/* Pastille pour les dysfonctionnements */
.dys-indicator-dot {
    position: absolute;
    right: 8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: var(--danger);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
    z-index: 25;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, background-color 0.2s;
    border: 2px solid white;
}

.dys-indicator-dot:hover {
    transform: scale(1.15);
    background-color: #dc2626; /* Rouge plus foncé */
    box-shadow: 0 4px 10px rgba(220, 38, 38, 0.6);
    z-index: 30;
}

/* --- CUSTOM CLOCK PICKER POPOVER --- */
.custom-clock-picker-popover {
    position: fixed;
    z-index: 2000;
    width: 240px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.05);
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    font-family: 'Segoe UI', system-ui, sans-serif;
    animation: scaleIn 0.15s ease-out;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-5px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.custom-clock-picker-popover.hidden {
    display: none !important;
}

.clock-picker-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 10px;
}

.clock-picker-time-display {
    font-size: 1.6rem;
    font-weight: 700;
    color: #1e293b;
    display: flex;
    gap: 4px;
    user-select: none;
}

.clock-picker-time-display span {
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 6px;
    transition: background 0.2s, color 0.2s;
}

.clock-picker-time-display span.active {
    background: var(--primary-light);
    color: var(--primary);
}

.clock-picker-time-display span:hover:not(.active) {
    background: #f1f5f9;
}

.clock-picker-ampm {
    display: flex;
    background: #f1f5f9;
    padding: 3px;
    border-radius: 8px;
    width: 100%;
}

.clock-picker-ampm button {
    flex: 1;
    background: transparent;
    border: none;
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    padding: 5px 0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.clock-picker-ampm button.active {
    background: white;
    color: var(--primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.clock-picker-body {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px 0;
}

.clock-face {
    position: relative;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
}

.clock-center-dot {
    position: absolute;
    width: 6px;
    height: 6px;
    background: var(--primary);
    border-radius: 50%;
    left: calc(50% - 3px);
    top: calc(50% - 3px);
    z-index: 10;
}

.clock-hand {
    position: absolute;
    width: 2px;
    height: 65px;
    background: var(--primary);
    left: calc(50% - 1px);
    bottom: 50%;
    transform-origin: bottom center;
    z-index: 5;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.clock-hand::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: rgba(79, 70, 229, 0.15);
    border: 2px solid var(--primary);
    border-radius: 50%;
    top: -10px;
    left: -9px;
}

.clock-numbers {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
}

.clock-number {
    position: absolute;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    border-radius: 50%;
    user-select: none;
    transform: translate(-50%, -50%);
    transition: background 0.15s, color 0.15s;
    z-index: 8;
}

.clock-number:hover {
    background: #cbd5e1;
    color: #0f172a;
}

.clock-number.selected {
    background: var(--primary);
    color: white !important;
}

.clock-picker-footer {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    border-top: 1px solid #f1f5f9;
    padding-top: 10px;
}

.cpp-btn {
    flex: 1;
    padding: 8px 0;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.cpp-btn.secondary {
    background: #f1f5f9;
    color: #475569;
}

.cpp-btn.secondary:hover {
    background: #e2e8f0;
}

.cpp-btn.primary {
    background: var(--primary);
    color: white;
}

.cpp-btn.primary:hover {
    opacity: 0.9;
}

/* --- LAYOUT COMPLEMENTS --- */
.calendar-layout {
    display: flex;
    gap: 20px;
    flex: 1;
    height: 100%;
    min-height: 0;
}

.calendar-sidebar {
    width: 280px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    flex-shrink: 0;
    overflow-y: auto;
    padding-right: 5px;
}

.day-col.selected-day {
    background-color: #f5f3ff !important;
}

/* --- QUICK ACTION CARDS --- */
.quick-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    border-left: 5px solid transparent;
    margin-bottom: 8px;
}
.quick-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}
.quick-card.divers {
    border-left-color: #64748b;
    border-color: #cbd5e1;
}
.quick-card.reunion {
    border-left-color: #10b981;
    border-color: #a7f3d0;
}
.quick-card.activity-card {
    border-left-color: #4F46E5;
    border-color: #e2e8f0;
}
.quick-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}
.quick-badge {
    font-weight: 700;
    font-size: 0.65rem;
    padding: 1px 5px;
    border-radius: 4px;
    text-transform: uppercase;
    color: white;
}
.quick-badge.divers {
    background: #64748b;
}
.quick-badge.reunion {
    background: #10b981;
}
.quick-pct {
    font-size: 0.85rem;
    font-weight: 800;
}
.quick-pct.divers {
    color: #64748b;
}
.quick-pct.reunion {
    color: #10b981;
}
.quick-pct.activity {
    color: #94a3b8;
}
.quick-card-title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}
.quick-card-title-row .title {
    font-weight: 700;
    color: #1e293b;
    font-size: 0.82rem;
    line-height: 1.2;
    text-align: left;
}
.quick-card-title-row .duration {
    font-size: 0.75rem;
    color: #94a3b8;
    font-weight: 600;
    margin-left: 5px;
    white-space: nowrap;
}
.btn-quick-depuis {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background-color: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
    padding: 5px 10px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.75rem;
    margin-bottom: 6px;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-quick-depuis:hover:not(:disabled) {
    background-color: #dcfce7;
}
.btn-quick-depuis:disabled {
    background-color: #f8fafc;
    color: #cbd5e1;
    border-color: #e2e8f0;
    cursor: not-allowed;
}
.quick-buttons-row {
    display: flex;
    gap: 4px;
    width: 100%;
}
.btn-quick-add-sub {
    flex: 1;
    padding: 4px 2px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}
.btn-quick-add-sub:hover {
    background: #e2e8f0;
}
.btn-quick-sub-btn {
    flex: 1;
    padding: 4px 2px;
    border: 1px solid #fecaca;
    background: #fef2f2;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #dc2626;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    margin-top: 4px;
}
.btn-quick-sub-btn:hover {
    background: #fee2e2;
}

/* Modal period buttons */
.btn-depuis-derniere {
    border: 1px solid #e2e8f0;
    background-color: #f8fafc;
    color: #64748b;
    padding: 8px 12px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    transition: all 0.2s;
    white-space: nowrap;
}
.btn-depuis-derniere:hover {
    background-color: #f1f5f9;
}
.btn-depuis-derniere.active {
    border-color: #4F46E5;
    background-color: #EBF4FF;
    color: #4F46E5;
}
.btn-period {
    border: 1px solid #e2e8f0;
    background-color: #f8fafc;
    color: #1e293b;
    padding: 8px 6px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    flex: 1;
    text-align: center;
}
.btn-period:hover {
    background-color: #f1f5f9;
}
.btn-period.active {
    border-color: #4F46E5;
    background-color: #EBF4FF;
    color: #4F46E5;
}

/* --- LUNCH BREAK CELL HATCHED STYLE --- */
.lunch-break-cell {
    background-color: #f1f5f9 !important;
    background-image: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 8px,
        rgba(148, 163, 184, 0.08) 8px,
        rgba(148, 163, 184, 0.08) 16px
    ) !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
}

/* --- ACTIVITIES MANAGEMENT IN SETTINGS --- */
.activities-settings-group {
    margin-bottom: 25px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
}
.activities-category-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f1f5f9;
}
.activity-card-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px 15px;
    margin-bottom: 8px;
    transition: all 0.2s;
}
.activity-card-row:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}
.activity-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.activity-title {
    font-weight: 600;
    color: #1e293b;
    font-size: 0.95rem;
}
.activity-desc {
    font-size: 0.8rem;
    color: #64748b;
}
.activity-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}
.activity-status-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #94a3b8;
}
.activity-status-label.active {
    color: #10b981;
}

/* Badges color mapping */
.category-badge {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    text-transform: uppercase;
    color: white;
}

/* Disabled state for quick buttons */
.btn-quick-sub:disabled {
    opacity: 0.45 !important;
    cursor: not-allowed !important;
    background-color: #f8fafc !important;
    color: #cbd5e1 !important;
    border-color: #e2e8f0 !important;
}

/* Premium Table in Stats */
.stats-table-container {
    width: 100%;
    margin-top: 30px;
    box-sizing: border-box;
}

.premium-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.premium-table th {
    background-color: #f8fafc;
    color: #64748b;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 12px 10px;
    border-bottom: 2px solid #e2e8f0;
    text-align: left;
}

.premium-table td {
    padding: 12px 10px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.9rem;
    color: #334155;
    vertical-align: middle;
}

.premium-table tr:hover {
    background-color: #f8fafc;
}

.cat-badge {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 3px;
    vertical-align: middle;
}

/* Print Only Section */
.print-only {
    display: none;
}

@media print {
    @page {
        size: portrait;
        margin: 10mm 10mm;
    }
    
    body {
        background: white !important;
        color: black !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    }
    
    #app-container, #director-container, .modal, .modal-backdrop, #custom-clock-picker, #user-banner {
        display: none !important;
    }
    
    .print-only {
        display: block !important;
        width: 100%;
        box-sizing: border-box;
    }
    
    .print-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-bottom: 2px solid #0f172a;
        padding-bottom: 8px;
        margin-bottom: 15px;
    }
    
    .print-header h1 {
        font-size: 1.4rem;
        color: #0f172a;
        margin: 0;
        font-weight: 700;
    }
    
    .print-meta {
        font-size: 0.8rem;
        color: #475569;
        display: flex;
        gap: 12px;
    }

    .print-badges-bar {
        display: flex;
        gap: 10px;
        margin-bottom: 18px;
    }

    .print-badge {
        background: #f1f5f9 !important;
        border: 1px solid #cbd5e1 !important;
        padding: 4px 12px;
        border-radius: 12px;
        font-size: 0.82rem;
        color: #1e293b !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    
    .print-content {
        display: block !important;
    }

    /* VUE EMPILÉE EN 1 SEULE COLONNE PLEINE LARGEUR */
    .print-stacked-cards {
        display: flex !important;
        flex-direction: column !important;
        gap: 22px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .print-block-card {
        width: 100% !important;
        background: #ffffff !important;
        border: 1px solid #cbd5e1 !important;
        border-radius: 12px !important;
        box-shadow: none !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
        page-break-inside: auto;
        break-inside: auto;
    }

    .card-ratio-block {
        padding: 16px !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    .card-ratio-block .kpi-card-header {
        margin-bottom: 12px !important;
    }

    .card-ratio-block .ratio-bar-container {
        margin-bottom: 14px !important;
    }

    /* EN-TÊTE FIXE DES CARTES DYSFONCTIONNEMENTS ET URGENCES */
    .print-card-header-box {
        background: #f8fafc !important;
        border-bottom: 1px solid #cbd5e1 !important;
        padding: 12px 16px !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }
    .print-card-header-box.border-warning {
        border-top: 4px solid #f59e0b !important;
    }
    .print-card-header-box.border-danger {
        border-top: 4px solid #ef4444 !important;
    }

    .print-card-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
    }

    .print-card-title {
        font-size: 1rem;
        font-weight: 700;
        color: #0f172a;
        margin: 0 0 4px 0;
    }

    .print-card-sub {
        font-size: 0.82rem;
        color: #64748b;
        margin: 0;
    }

    .print-icon-badge {
        font-size: 1.2rem;
    }

    .print-users-summary {
        margin-top: 8px;
        padding-top: 8px;
        border-top: 1px solid #e2e8f0;
    }

    /* CONTENEUR DE TABLEAU AVEC ITEM-ROWS EN PLEINE LARGEUR */
    .print-table-container {
        background: #ffffff !important;
        width: 100% !important;
    }

    .print-table-row {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 8px 16px !important;
        border-bottom: 1px solid #e2e8f0 !important;
        font-size: 0.82rem !important;
        color: #1e293b !important;
        background: #ffffff !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    .print-table-row:nth-child(even) {
        background: #f8fafc !important;
    }
    .print-table-row:last-child {
        border-bottom: none !important;
    }

    .print-item-empty {
        padding: 14px 16px;
        color: #94a3b8;
        font-size: 0.82rem;
        font-style: italic;
    }

    .stat-bar-bg, .bar-segment, .cat-badge, .comparative-bar-bg, .comparative-segment, .cat-bar-row-pill, .cat-bar-track, .cat-bar-fill-bar, .cat-bar-label-badge, .cat-bar-pct-text, .cat-bar-name-text {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .print-page-break {
        page-break-before: always !important;
        break-before: page !important;
    }
}

/* Style compact des cartes d'activités par catégorie (Journal d'Équipe) */
.journal-cat-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 14px;
    margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
    page-break-inside: avoid;
    break-inside: avoid;
}

.journal-cat-title {
    margin: 0 0 6px 0;
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.3;
}

.journal-task-ul {
    list-style-type: square;
    padding-left: 18px;
    color: #334155;
    font-size: 0.82rem;
    line-height: 1.35;
    margin: 0;
}

.journal-task-li {
    margin-bottom: 3px;
}

.journal-task-user {
    color: #64748b;
    font-size: 0.78rem;
    font-style: italic;
    margin-left: 5px;
}

/* ==========================================================================
   REFONTE GLOBALE UX/UI - TABLEAU DE BORD DIRECTEUR & STYLES MODERNES
   ========================================================================== */

/* Header Directeur Premium */
.director-header {
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    padding: 20px 30px 0 30px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    position: relative;
    z-index: 10;
}

.director-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.brand-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-logo-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #4f46e5 0%, #3b82f6 100%);
    color: white;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.25);
}

.header-main-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.badge-version {
    font-size: 0.65rem;
    font-weight: 600;
    background: #f1f5f9;
    color: #64748b;
    padding: 2px 8px;
    border-radius: 20px;
    border: 1px solid #e2e8f0;
}

.header-subtitle {
    font-size: 0.82rem;
    color: #64748b;
    margin: 2px 0 0 0;
}

.btn-export-pdf {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-export-pdf:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.35);
}

/* Onglets Directeur */
.director-tabs {
    display: flex;
    gap: 10px;
    border-bottom: 2px solid #f1f5f9;
}

.director-tabs .tab-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-weight: 600;
    color: #64748b;
    font-size: 0.95rem;
    margin-bottom: -2px;
    transition: all 0.2s;
    border-radius: 8px 8px 0 0;
}

.director-tabs .tab-btn:hover {
    color: #1e293b;
    background: #f8fafc;
}

.director-tabs .tab-btn.active {
    color: #4f46e5;
    border-bottom-color: #4f46e5;
    background: #ffffff;
}

/* Main Content Directeur */
.director-main {
    flex: 1;
    padding: 25px 30px;
    overflow-y: auto;
    background-color: #f8fafc;
}

/* Carte de Filtres Globaux */
.filter-card-global {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.filter-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: #475569;
}

.segment-control {
    display: flex;
    background: #f1f5f9;
    padding: 4px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

.segment-btn {
    padding: 6px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #64748b;
    background: transparent;
    border: none;
    border-radius: 7px;
    cursor: pointer;
    transition: all 0.2s;
}

.segment-btn:hover {
    color: #1e293b;
}

.segment-btn.active {
    background: #ffffff;
    color: #4f46e5;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.filter-period-info {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    color: #64748b;
    font-weight: 500;
}

/* Grilles & Cartes KPI */
.kpi-row-two {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 25px;
}

.kpi-row-three {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 25px;
}

.kpi-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 22px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.2s, box-shadow 0.2s;
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.05);
}

.kpi-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 18px;
}

.kpi-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}

.kpi-subtitle {
    font-size: 0.8rem;
    color: #64748b;
    margin: 4px 0 0 0;
}

.kpi-icon-badge {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.kpi-icon-badge.icon-pompier {
    background: #fef2f2;
}

.kpi-icon-badge.icon-warning {
    background: #fffbeb;
}

/* Ratio Bar styling */
.ratio-bar-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 18px;
}

.ratio-values-top {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
}

.ratio-tag.pompier {
    color: #ef4444;
}

.ratio-tag.batisseur {
    color: #8b5cf6;
}

.ratio-stacked-bar {
    display: flex;
    width: 100%;
    height: 36px;
    border-radius: 10px;
    overflow: hidden;
    background: #e2e8f0;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.bar-segment {
    display: flex;
    align-items: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: white;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.bar-segment.pompier {
    background: #ef4444;
    padding-left: 12px;
    justify-content: flex-start;
}

.bar-segment.batisseur {
    background: #8b5cf6;
    padding-right: 12px;
    justify-content: flex-end;
}

.ratio-values-bottom {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 700;
    color: #475569;
}

.category-breakdown-mini {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    padding-top: 15px;
    border-top: 1px solid #f1f5f9;
    font-size: 0.78rem;
}

.cat-group-title {
    font-weight: 700;
    display: block;
    margin-bottom: 6px;
}

.text-danger { color: #ef4444; }
.text-primary { color: #8b5cf6; }

.category-breakdown-mini ul {
    padding-left: 14px;
    margin: 0;
    color: #64748b;
    line-height: 1.4;
}

/* Big Stat KPI */
.kpi-big-stat {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 15px;
}

.stat-number {
    font-size: 2.2rem;
    font-weight: 800;
    color: #f59e0b;
    line-height: 1;
}

.badge-warning-pill {
    background: #fef3c7;
    color: #b45309;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
}

.users-dysf-summary {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-top: 12px;
    border-top: 1px solid #f1f5f9;
    font-size: 0.85rem;
}

.user-dysf-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #475569;
}

.user-dysf-item strong {
    color: #ef4444;
}

/* Cards de Section Dashboard */
.dashboard-section-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 22px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
    margin-bottom: 25px;
}

.card-header-with-action {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}

.card-subtitle {
    font-size: 0.8rem;
    color: #64748b;
    margin: 3px 0 0 0;
}

/* Stacked Main Comparative Chart */
.comparative-chart-box {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.comparative-bar-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.comparative-bar-bg {
    display: flex;
    height: 32px;
    width: 100%;
    background: #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
}

.comparative-segment {
    height: 100%;
    display: flex;
    align-items: center;
    padding: 0 8px;
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
    transition: width 0.5s ease;
}

.comparative-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 10px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: #475569;
    font-weight: 500;
}

.legend-color-dot {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

/* Dysfonctionnements par collaborateur (Ligne 3) */
.collaborators-dysf-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 15px;
}

.user-dysf-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.user-dysf-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-dysf-name {
    font-weight: 700;
    color: #1e293b;
    font-size: 0.95rem;
}

.user-dysf-hours {
    font-weight: 800;
    color: #ef4444;
    font-size: 1rem;
}

.user-dysf-progress-bg {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}

.user-dysf-progress-fill {
    height: 100%;
    background: #f59e0b;
    border-radius: 4px;
}

/* Tableau d'Urgences (Ligne 4) */
.table-controls-bar {
    display: flex;
    gap: 12px;
    align-items: center;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 6px 12px;
}

.search-box input {
    border: none;
    background: transparent;
    font-size: 0.85rem;
    color: #1e293b;
    outline: none;
    width: 180px;
}

.table-select-filter {
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    font-size: 0.85rem;
    color: #1e293b;
    outline: none;
    cursor: pointer;
}

.table-responsive-container {
    width: 100%;
    overflow-x: auto;
}

.sortable-table th {
    user-select: none;
    transition: background 0.2s;
}

.sortable-table th:hover {
    background: #f1f5f9;
}

.badge-cat-pill {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
}

.badge-duration {
    font-weight: 700;
    color: #ef4444;
    background: #fef2f2;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.82rem;
}

/* Grille 4 cartes en ligne (Journal de l'Équipe) */
.journal-4cards-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    align-items: start;
    width: 100%;
}

@media (max-width: 1300px) {
    .journal-4cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .journal-4cards-grid {
        grid-template-columns: 1fr;
    }
}

/* Graphique Multi-Barres Catégories (Style Journal de Bord & Stats) */
.cat-bar-row-pill {
    position: relative;
    margin-bottom: 10px;
}

.cat-bar-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.cat-bar-name-text {
    font-size: 0.76rem;
    font-weight: 600;
    color: #334155;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 8px;
}

.cat-bar-pct-text {
    font-size: 0.76rem;
    font-weight: 700;
    white-space: nowrap;
}

.cat-bar-track {
    width: 100%;
    height: 10px;
    background: #e2e8f0;
    border-radius: 5px;
    position: relative;
    overflow: hidden;
}

.cat-bar-fill-bar {
    height: 100%;
    border-radius: 5px;
    transition: width 0.4s ease;
}

/* Cartes Synthèse Collaborateurs (Journal) */
.collaborators-synthesis-section {
    margin-bottom: 20px;
}

.section-subtitle {
    font-size: 1rem;
    font-weight: 700;
    color: #334155;
    margin-bottom: 12px;
}

.collaborators-synthesis-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 15px;
}

.collab-synth-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.collab-synth-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.collab-name {
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
}

.collab-total-time {
    font-size: 0.85rem;
    font-weight: 700;
    background: #ebf4ff;
    color: #4f46e5;
    padding: 3px 8px;
    border-radius: 6px;
}

.collab-stacked-bar {
    display: flex;
    height: 14px;
    width: 100%;
    background: #e2e8f0;
    border-radius: 7px;
    overflow: hidden;
}

.collab-bar-chunk {
    height: 100%;
    transition: width 0.3s;
}

.collab-cat-legend {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.75rem;
    color: #475569;
}

.collab-cat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Grille du Journal */
.journal-columns-grid {
    display: grid;
    grid-template-columns: 280px 1fr 1fr;
    gap: 20px;
    align-items: flex-start;
}

.journal-nav-card {
    margin: 0 !important;
    height: fit-content !important;
}

.journal-content-card {
    margin: 0 !important;
    min-height: 450px !important;
}

.journal-card-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 4px;
}

.journal-card-sub {
    font-size: 0.8rem;
    color: #64748b;
    margin-bottom: 15px;
}

.journal-activities-scroll {
    overflow-y: auto;
    max-height: 550px;
    padding-right: 5px;
}

.flex-column { display: flex; flex-direction: column; }
.gap-15 { gap: 15px; }

/* Modale Export PDF */
.modal-export-pdf-content {
    width: 520px !important;
}

.pdf-export-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.export-option-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    background: #ffffff;
}

.export-option-card:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.export-option-card.active {
    border-color: #4f46e5;
    background: #f5f3ff;
}

.option-radio {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid #cbd5e1;
    margin-top: 2px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.export-option-card.active .option-radio {
    border-color: #4f46e5;
    background: #4f46e5;
}

.export-option-card.active .option-radio::after {
    content: '';
    width: 6px;
    height: 6px;
    background: white;
    border-radius: 50%;
}

.option-details h4 {
    margin: 0 0 3px 0;
    font-size: 0.95rem;
    color: #0f172a;
}

.option-details p {
    margin: 0;
    font-size: 0.8rem;
    color: #64748b;
    line-height: 1.35;
}

.premium-select-sm {
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    font-size: 0.85rem;
    color: #1e293b;
    background: #ffffff;
    outline: none;
    cursor: pointer;
}

/* Breakpoints Responsive */
@media (max-width: 1200px) {
    .kpi-row-two {
        grid-template-columns: 1fr;
    }
    .journal-columns-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .director-header-top {
        flex-direction: column;
        align-items: flex-start;
    }
    .filter-card-global {
        flex-direction: column;
        align-items: flex-start;
    }
    .collaborators-synthesis-grid {
        grid-template-columns: 1fr;
    }
}


