/* ===================================
   RESET & BASE
   =================================== */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #f5f5f7;
    color: #1d1d1f;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===================================
   LAYOUT PRINCIPAL
   =================================== */

.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: #ffffff;
    border-bottom: 1px solid #e5e5e7;
    padding: 1rem;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-titles {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-icon-btn {
    border: 1px solid #e5e5e7;
    background: #ffffff;
    color: #2c2c2e;
    padding: 0.5rem 0.6rem;
    border-radius: 12px;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

.header-icon-btn:active {
    transform: scale(0.98);
}

.app-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2c2c2e;
    margin-bottom: 0.25rem;
}

.page-title {
    font-size: 0.875rem;
    color: #86868b;
    font-weight: 500;
}

.app-main {
    margin-top: 5rem; /* Hauteur du header */
    margin-bottom: 5rem; /* Hauteur de la tabbar */
    padding: 1rem;
    min-height: calc(100vh - 10rem);
}

/* ===================================
   PAGES
   =================================== */

.page {
    display: none;
    animation: fadeIn 0.2s ease-in;
}

.page.active {
    display: block;
}

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

/* Conteneur de page pour le contenu */
.page-container {
    max-width: 600px;
    margin: 0 auto;
}

/* Placeholder pour les pages en développement */
.placeholder {
    text-align: center;
    padding: 3rem 1rem;
}

.placeholder-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

.placeholder-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #2c2c2e;
    margin-bottom: 0.5rem;
}

.placeholder-text {
    font-size: 1rem;
    color: #86868b;
    line-height: 1.6;
}

/* ===================================
   NAVIGATION TABBAR
   =================================== */

.tabbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: #ffffff;
    border-top: 1px solid #e5e5e7;
    display: flex;
    justify-content: space-around;
    padding: 0.5rem 0;
    z-index: 100;
}

.tab-button {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    background: none;
    border: none;
    color: #86868b;
    cursor: pointer;
    padding: 0.5rem;
    transition: color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.tab-button:hover {
    color: #2c2c2e;
}

.tab-button.active {
    color: #007aff;
}

.tab-icon {
    width: 24px;
    height: 24px;
    stroke-width: 2;
}

.tab-label {
    font-size: 0.625rem;
    font-weight: 500;
    letter-spacing: 0.02em;
}

/* ===================================
   COMPOSANTS RÉUTILISABLES
   =================================== */

/* Bouton primaire */
.btn-primary {
    background-color: #007aff;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.btn-primary:hover {
    background-color: #0051d5;
}

.btn-primary:active {
    transform: scale(0.98);
}

/* ===================================
   FAB (BOUTON FLOTTANT GLOBAL)
   =================================== */

.fab {
    position: fixed;
    right: 1rem;
    bottom: 5.75rem; /* au-dessus de la tabbar */
    z-index: 120;
}

.fab-btn {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    border: none;
    background: #007aff;
    color: #fff;
    font-size: 28px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(0,0,0,0.18);
    -webkit-tap-highlight-color: transparent;
}

.fab-btn:active {
    transform: scale(0.98);
}

.fab-menu {
    position: absolute;
    right: 0;
    bottom: 66px;
    display: none;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 220px;
    background: rgba(255,255,255,0.95);
    border: 1px solid #e5e5e7;
    border-radius: 16px;
    padding: 0.5rem;
    box-shadow: 0 14px 35px rgba(0,0,0,0.12);
    backdrop-filter: blur(10px);
}

.fab-menu.open {
    display: flex;
}

.fab-menu-item {
    width: 100%;
    border: none;
    background: #fff;
    border-radius: 12px;
    padding: 0.75rem 0.85rem;
    text-align: left;
    font-weight: 600;
    cursor: pointer;
}

.fab-menu-item:hover {
    background: #f2f2f7;
}

.fab-backdrop {
    position: fixed;
    inset: 0;
    display: none;
    background: rgba(0,0,0,0.18);
    z-index: 110;
}

.fab-backdrop.open {
    display: block;
}

/* Bouton secondaire */
.btn-secondary {
    background-color: #e5e5e7;
    color: #2c2c2e;
    border: none;
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.btn-secondary:hover {
    background-color: #d1d1d6;
}

.btn-secondary:active {
    transform: scale(0.98);
}

/* Carte */
.card {
    background-color: #ffffff;
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 1rem;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #2c2c2e;
    margin-bottom: 0.5rem;
}

.card-content {
    font-size: 0.9375rem;
    color: #48484a;
}

/* Input */
.input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #e5e5e7;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    background-color: #ffffff;
    transition: border-color 0.2s ease;
}

.input:focus {
    outline: none;
    border-color: #007aff;
}

/* ===================================
   RESPONSIVE
   =================================== */

@media (min-width: 768px) {
    .app-header {
        padding: 1.5rem 2rem;
    }

    .app-title {
        font-size: 1.75rem;
    }

    .app-main {
        padding: 2rem;
        margin-top: 6rem;
    }

    .tabbar {
        max-width: 600px;
        left: 50%;
        transform: translateX(-50%);
        border-radius: 12px 12px 0 0;
    }

    .tab-label {
        font-size: 0.75rem;
    }
}

/* ===================================
   CALENDRIER (mensuel)
   =================================== */

.calendar-page,
.calendar-embed {
    width: 100%;
}

.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.calendar-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.calendar-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.calendar-legend {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin: 0 0 10px;
    font-size: 0.8125rem;
    color: #86868b;
}

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

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

.calendar-legend-dot.busy { background: #ef4444; }
.calendar-legend-dot.rdv { background: #3b82f6; }

.calendar-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    display: inline-block;
}

.calendar-legend-dot.busy { background: #ff3b30; }
.calendar-legend-dot.rdv { background: #34c759; }

.calendar-month-title {
    font-weight: 700;
    text-transform: capitalize;
}

.calendar-dow {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-bottom: 8px;
}

.calendar-dow-cell {
    font-size: 0.75rem;
    color: #86868b;
    text-align: center;
    font-weight: 600;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}

.calendar-cell {
    border: 1px solid #e5e5e7;
    background: #ffffff;
    border-radius: 14px;
    padding: 10px;
    min-height: 64px;
    text-align: left;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.calendar-cell.is-outside {
    opacity: 0.45;
}

.calendar-cell.is-today {
    border-color: #007aff;
    box-shadow: 0 0 0 2px rgba(0,122,255,0.12);
}

.calendar-cell-num {
    font-weight: 700;
    font-size: 0.9rem;
}

.calendar-cell-title {
    margin-top: 6px;
    font-size: 0.75rem;
    color: #2c2c2e;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    opacity: 0.9;
}

.calendar-cell-badges {
    display: flex;
    align-items: center;
    gap: 6px;
}

.cal-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    display: inline-block;
}

.cal-dot-busy {
    background: #ff3b30;
}

.cal-dot-rdv {
    background: #34c759;
}

.cal-more {
    font-size: 0.75rem;
    color: #86868b;
    font-weight: 600;
}

.calendar-day-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 12px;
}

.calendar-event-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid #e5e5e7;
    background: #ffffff;
    border-radius: 14px;
    padding: 12px;
    margin-bottom: 10px;
}

.calendar-event-time {
    font-size: 0.85rem;
    color: #86868b;
    font-weight: 600;
}

.calendar-event-title {
    font-weight: 700;
    margin-top: 2px;
}

.calendar-event-meta {
    font-size: 0.8rem;
    color: #86868b;
    margin-top: 2px;
}

.calendar-event-item-actions {
    display: flex;
    gap: 8px;
}

.tasks-calendar-wrap {
    margin-top: 8px;
}

@media (min-width: 1024px) {
    .app-main {
        padding: 2rem;
    }
}

/* ===================================
   UTILITAIRES
   =================================== */

.hidden {
    display: none !important;
}

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

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

/* ===================================
   PAGE ONBOARDING
   =================================== */

.onboarding-container {
    max-width: 500px;
    margin: 0 auto;
    padding-bottom: 2rem;
}

.onboarding-header {
    text-align: center;
    margin-bottom: 2rem;
    padding: 1rem 0;
}

.onboarding-icon {
    font-size: 4rem;
    margin-bottom: 0.5rem;
}

.onboarding-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #2c2c2e;
    margin-bottom: 0.5rem;
}

.onboarding-subtitle {
    font-size: 1rem;
    color: #86868b;
    line-height: 1.5;
}

.onboarding-card {
    margin-bottom: 1.5rem;
}

.card-desc {
    font-size: 0.875rem;
    color: #86868b;
    margin-bottom: 1rem;
    line-height: 1.5;
}

/* Formulaire */
.form-group {
    margin-bottom: 1rem;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #2c2c2e;
    margin-bottom: 0.5rem;
}

.form-group-inline {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.form-label-inline {
    font-size: 0.875rem;
    color: #2c2c2e;
    flex: 1;
}

.input-small {
    width: 80px;
    padding: 0.5rem;
    text-align: center;
}

.form-unit {
    font-size: 0.875rem;
    color: #86868b;
}

/* Radio buttons groupe */
.radio-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.radio-button {
    flex: 1;
    min-width: 80px;
    padding: 0.75rem 1rem;
    background-color: #f5f5f7;
    border: 2px solid #e5e5e7;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 600;
    color: #2c2c2e;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.radio-button:hover {
    border-color: #007aff;
    background-color: #f0f8ff;
}

.radio-button.active {
    background-color: #007aff;
    border-color: #007aff;
    color: #ffffff;
}

/* Toggle switch */
.toggle-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    background-color: #f5f5f7;
    border-radius: 8px;
}

.toggle-label {
    font-size: 0.9375rem;
    font-weight: 500;
    color: #2c2c2e;
    cursor: pointer;
}

.toggle-container {
    display: inline-block;
}

.toggle-switch {
    width: 48px;
    height: 28px;
    appearance: none;
    background-color: #e5e5e7;
    border-radius: 14px;
    position: relative;
    cursor: pointer;
    transition: background-color 0.2s ease;
    outline: none;
}

.toggle-switch::before {
    content: '';
    position: absolute;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: #ffffff;
    top: 2px;
    left: 2px;
    transition: transform 0.2s ease;
}

.toggle-switch:checked {
    background-color: #34c759;
}

.toggle-switch:checked::before {
    transform: translateX(20px);
}

/* Paramètres conditionnels */
.breaks-params,
.buffers-params {
    margin-top: 1rem;
    padding: 1rem;
    background-color: #f9f9fb;
    border-radius: 8px;
    border: 1px solid #e5e5e7;
}

.breaks-params.hidden,
.buffers-params.hidden {
    display: none;
}

/* Message d'erreur */
.form-error {
    margin-top: 0.5rem;
    padding: 0.75rem;
    background-color: #fff3f3;
    border: 1px solid #ff3b30;
    border-radius: 6px;
    color: #ff3b30;
    font-size: 0.875rem;
    font-weight: 500;
}

.form-error.hidden {
    display: none;
}

/* Bouton de soumission */
.onboarding-submit {
    margin-top: 2rem;
    text-align: center;
}

.btn-large {
    width: 100%;
    max-width: 400px;
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

/* Responsive */
@media (min-width: 768px) {
    .onboarding-container {
        max-width: 600px;
    }
    
    .onboarding-title {
        font-size: 2rem;
    }
    
    .onboarding-icon {
        font-size: 5rem;
    }
}

/* ===================================
   PAGE TÂCHES
   =================================== */

.tasks-page {
    max-width: 800px;
    margin: 0 auto;
}

.tasks-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.tasks-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2c2c2e;
}

.btn-add-task {
    white-space: nowrap;
}

/* Tabs */
.tabs-container {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background-color: #f5f5f7;
    border: 2px solid #e5e5e7;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 600;
    color: #2c2c2e;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.tab-btn:hover {
    border-color: #007aff;
    background-color: #f0f8ff;
}

.tab-btn.tab-active {
    background-color: #007aff;
    border-color: #007aff;
    color: #ffffff;
}

.tab-icon {
    font-size: 1.125rem;
}

.tab-badge {
    margin-left: 0.25rem;
    background: rgba(255,255,255,0.85);
    color: #2c2c2e;
    border-radius: 999px;
    padding: 0.15rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 700;
}

.tab-btn.tab-active .tab-badge {
    background: rgba(255,255,255,0.2);
    color: #ffffff;
}

/* Tabs compacts */
.tabs-compact {
    margin-bottom: 0.9rem;
}

.tabs-compact .tab-btn {
    padding: 0.55rem 0.75rem;
    border-radius: 12px;
}

.tasks-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border: 1px solid #e5e5e7;
    border-radius: 14px;
    background: #ffffff;
    margin-bottom: 1rem;
}

.tasks-summary-left {
    font-weight: 700;
    color: #2c2c2e;
}

.tasks-summary-right {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.summary-chip {
    border: 1px solid #e5e5e7;
    background: #f5f5f7;
    border-radius: 999px;
    padding: 0.35rem 0.65rem;
    font-size: 0.8125rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.summary-chip:hover {
    border-color: #007aff;
    background: #f0f8ff;
}

/* Contrôles */
.tasks-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.search-group {
    flex: 1;
    min-width: 200px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background-color: #f5f5f7;
    border-radius: 8px;
}

.search-icon {
    font-size: 1rem;
    color: #86868b;
}

.search-input {
    flex: 1;
    border: none;
    background: none;
    font-size: 0.9375rem;
    color: #2c2c2e;
    outline: none;
}

.search-input::placeholder {
    color: #86868b;
}

.sort-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sort-label {
    font-size: 0.875rem;
    color: #86868b;
    white-space: nowrap;
}

.sort-select {
    padding: 0.5rem;
    border: 1px solid #e5e5e7;
    border-radius: 6px;
    font-size: 0.9375rem;
    color: #2c2c2e;
    background-color: #ffffff;
    cursor: pointer;
}

/* Liste des tâches */
.tasks-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.task-card {
    background-color: #ffffff;
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.2s ease;
}

.task-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.task-card-header {
    margin-bottom: 0.75rem;
}

.task-card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #2c2c2e;
    margin-bottom: 0.25rem;
}

.task-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-type {
    background-color: #e3f2fd;
    color: #1976d2;
}

.badge-energy {
    background-color: #fff3e0;
    color: #f57c00;
}

.badge-priority {
    background-color: #f3e5f5;
    color: #7b1fa2;
}

.badge-duration {
    background-color: #e8f5e9;
    color: #388e3c;
}

.badge-deadline {
    background-color: #fff9c4;
    color: #f57f17;
}

.badge-deadline-overdue {
    background-color: #ffebee;
    color: #c62828;
}

.task-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* État vide */
.tasks-empty {
    text-align: center;
    padding: 3rem 1rem;
}

.tasks-empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

.tasks-empty-text {
    font-size: 1rem;
    color: #86868b;
    line-height: 1.6;
}

/* ===================================
   MODAL
   =================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    transition: all 0.2s ease;
    padding: 1rem;
}

.modal-overlay.modal-open {
    background-color: rgba(0, 0, 0, 0.5);
    opacity: 1;
}

.modal-overlay.modal-closing {
    opacity: 0;
}

.modal {
    background-color: #ffffff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    transform: scale(0.9);
    transition: transform 0.2s ease;
}

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

.modal-small {
    width: 400px;
}

.modal-medium {
    width: 600px;
}

.modal-large {
    width: 700px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid #e5e5e7;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #2c2c2e;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: 50%;
    font-size: 2rem;
    line-height: 1;
    color: #86868b;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background-color: #f5f5f7;
    color: #2c2c2e;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    padding: 1.5rem;
    border-top: 1px solid #e5e5e7;
}

.confirm-message {
    font-size: 1rem;
    color: #48484a;
    line-height: 1.6;
}

/* ===================================
   CHIPS
   =================================== */

.chips-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.chip {
    padding: 0.5rem 1rem;
    background-color: #f5f5f7;
    border: 2px solid #e5e5e7;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    color: #2c2c2e;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.chip:hover {
    border-color: #007aff;
    background-color: #f0f8ff;
}

.chip.chip-active {
    background-color: #007aff;
    border-color: #007aff;
    color: #ffffff;
}

/* ===================================
   FORMULAIRE TÂCHE
   =================================== */

.task-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group-advanced {
    margin-top: -0.5rem;
}

.btn-text {
    background: none;
    border: none;
    color: #007aff;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.5rem 0;
    text-align: left;
}

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

.advanced-content {
    margin-top: 0.75rem;
}

.advanced-content.hidden {
    display: none;
}

/* Responsive modal */
@media (max-width: 768px) {
    .modal-small,
    .modal-medium,
    .modal-large {
        width: 100%;
        max-width: 100%;
    }
    
    .modal {
        max-height: 95vh;
    }
}

/* ===================================
   PAGE PLANIFIER
   =================================== */

.plan-page {
    max-width: 700px;
    margin: 0 auto;
}

.plan-section {
    background-color: #ffffff;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 1.5rem;
}

.plan-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.plan-section-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #2c2c2e;
    margin-bottom: 1rem;
}

.plan-section-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.input-time {
    width: 120px;
}

.plan-info {
    font-size: 0.875rem;
    color: #86868b;
    margin-top: 0.5rem;
}

.plan-empty {
    font-size: 0.9375rem;
    color: #86868b;
    text-align: center;
    padding: 1rem;
}

/* Événements fixes */
.events-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.event-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background-color: #f5f5f7;
    border-radius: 8px;
    border-left: 4px solid #007aff;
}

.event-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.event-time {
    font-size: 0.875rem;
    font-weight: 600;
    color: #007aff;
}

.event-title {
    font-size: 1rem;
    font-weight: 600;
    color: #2c2c2e;
}

.event-duration {
    font-size: 0.875rem;
    color: #86868b;
}

.event-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #ffffff;
    border: 1px solid #e5e5e7;
    border-radius: 6px;
    font-size: 1.125rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background-color: #f5f5f7;
    border-color: #007aff;
}

.event-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Paramètres pauses et buffers */
.pauses-params,
.buffers-params {
    margin-top: 0.75rem;
    padding: 1rem;
    background-color: #f9f9fb;
    border-radius: 8px;
    border: 1px solid #e5e5e7;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.pauses-params.hidden,
.buffers-params.hidden {
    display: none;
}

/* Sélection des tâches */
.tasks-selection-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.task-selection-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background-color: #f5f5f7;
    border-radius: 8px;
    transition: background-color 0.2s ease;
}

.task-selection-item:hover {
    background-color: #e8e8ea;
}

.task-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #007aff;
}

.task-selection-label {
    flex: 1;
    cursor: pointer;
}

.task-selection-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.task-selection-title {
    font-size: 1rem;
    font-weight: 600;
    color: #2c2c2e;
}

.task-selection-meta {
    font-size: 0.875rem;
    color: #86868b;
}

/* Bouton de génération */
.plan-generate {
    text-align: center;
    margin-top: 2rem;
    margin-bottom: 2rem;
}

.plan-generate-sticky {
    position: sticky;
    bottom: 1rem;
    z-index: 60;
    padding: 0.75rem;
    border-radius: 16px;
    background: rgba(255,255,255,0.92);
    border: 1px solid #e5e5e7;
    backdrop-filter: blur(10px);
}

.plan-estimate {
    font-size: 0.875rem;
    color: #48484a;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

/* Résumé du planning */
.plan-summary {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.summary-info {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.summary-info p {
    font-size: 1rem;
    color: #48484a;
    line-height: 1.6;
}

.summary-highlight {
    font-weight: 700;
    color: #2c2c2e;
    font-size: 1.125rem !important;
    padding: 0.75rem;
    background-color: #f0f8ff;
    border-left: 4px solid #007aff;
    border-radius: 6px;
}

.summary-message {
    padding: 1rem;
    border-radius: 8px;
    font-size: 1rem;
    line-height: 1.6;
}

.summary-success {
    background-color: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

.summary-warning {
    background-color: #fff3e0;
    color: #e65100;
    border: 1px solid #ffb74d;
}

.summary-note {
    font-size: 0.875rem;
    color: #86868b;
    font-style: italic;
    padding: 0.75rem;
    background-color: #f9f9fb;
    border-radius: 6px;
}

/* Responsive */
@media (max-width: 768px) {
    .event-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .event-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

/* ===================================
   PAGE AUJOURD'HUI
   =================================== */

.today-page {
    max-width: 800px;
    margin: 0 auto;
}

.today-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.today-title-group {
    flex: 1;
}

.today-title-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.today-nav-btn {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid #e5e5ea;
    background: #ffffff;
    color: #2c2c2e;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.today-nav-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}


.today-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #2c2c2e;
    margin-bottom: 0.25rem;
}

.today-subtitle {
    font-size: 1rem;
    color: #86868b;
    text-transform: capitalize;
}

.today-stats {
    display: flex;
    gap: 0.5rem;
}

.stat-badge {
    padding: 0.5rem 1rem;
    background-color: #f5f5f7;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 600;
    color: #2c2c2e;
}

/* Timeline */
.timeline-container {
    background-color: #ffffff;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.timeline {
    position: relative;
    min-height: 400px;
}

.time-grid {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.time-line {
    position: relative;
    height: 60px;
    border-bottom: 1px solid #e5e5e7;
}

.time-label {
    position: absolute;
    left: 0;
    top: -10px;
    font-size: 0.75rem;
    color: #86868b;
    background-color: #ffffff;
    padding: 0 0.25rem;
}

/* Blocs */
.block-item {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 8px;
    border-left: 4px solid;
    cursor: pointer;
    transition: all 0.2s ease;
}

.block-item:hover {
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.block-task {
    background-color: #e3f2fd;
    border-color: #2196f3;
}

.block-break {
    background-color: #fff3e0;
    border-color: #ff9800;
}

.block-buffer {
    background-color: #f3e5f5;
    border-color: #9c27b0;
}

.block-rdv {
    background-color: #e8f5e9;
    border-color: #4caf50;
}

.block-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.block-time {
    font-size: 0.875rem;
    font-weight: 600;
    color: #2c2c2e;
}

.block-label {
    font-size: 1rem;
    font-weight: 600;
    color: #2c2c2e;
}

.block-duration {
    font-size: 0.875rem;
    color: #86868b;
    white-space: nowrap;
}

.block-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-icon-small {
    width: 32px;
    height: 32px;
    font-size: 1rem;
}

/* État vide */
.today-empty {
    text-align: center;
    padding: 3rem 1rem;
}

.today-empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

.today-empty-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2c2c2e;
    margin-bottom: 0.5rem;
}

.today-empty-message {
    font-size: 1rem;
    color: #86868b;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.today-empty-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Carte Prochain */
.today-next-card {
    border: 1px solid #e5e5e7;
    border-radius: 16px;
    background: #ffffff;
    padding: 1rem;
    margin-bottom: 1rem;
}

.today-next-header {
    font-weight: 800;
    color: #2c2c2e;
    margin-bottom: 0.5rem;
}

.today-next-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #2c2c2e;
}

.today-next-meta {
    margin-top: 0.25rem;
    color: #48484a;
    font-weight: 600;
}

.today-next-sub {
    margin-top: 0.25rem;
    color: #86868b;
    font-size: 0.875rem;
}

.today-next-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

/* Résumé de la journée */
.day-summary {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e5e5e7;
}

.summary-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #2c2c2e;
    margin-bottom: 1rem;
}

.summary-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.stat-item {
    padding: 0.75rem 1rem;
    background-color: #f5f5f7;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 600;
    color: #2c2c2e;
}

.stat-highlight {
    background-color: #e3f2fd;
    color: #2196f3;
}

/* Responsive */
@media (max-width: 768px) {
    .today-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .block-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .block-actions {
        width: 100%;
        justify-content: flex-end;
    }
    
    .summary-stats {
        flex-direction: column;
    }
}

/* ===================================
   PAGE EXÉCUTION
   =================================== */

.execution-page {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    z-index: 2000;
}

.execution-header {
    text-align: center;
    margin-bottom: 3rem;
}

.execution-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.execution-type {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 0.5rem;
}

.execution-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.execution-time-range {
    font-size: 1.125rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

/* Timer */
.execution-timer {
    margin-bottom: 3rem;
}

.timer-display {
    font-size: 6rem;
    font-weight: 700;
    color: #ffffff;
    font-variant-numeric: tabular-nums;
    text-align: center;
    margin-bottom: 2rem;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.timer-display.timer-warning {
    color: #ffd700;
}

.timer-display.timer-danger {
    color: #ff4444;
    animation: pulse 1s infinite;
}

.timer-display.timer-extended {
    animation: bounce 0.5s ease;
}

.timer-display.timer-complete {
    color: #4caf50;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

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

.timer-progress {
    width: 100%;
    max-width: 600px;
    height: 12px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    overflow: hidden;
    margin: 0 auto;
}

.timer-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #4caf50 0%, #8bc34a 100%);
    border-radius: 6px;
    transition: width 1s linear;
}

/* Actions */
.execution-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    max-width: 800px;
}

.btn-execution {
    padding: 1rem 2rem;
    font-size: 1.125rem;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    min-width: 140px;
}

.btn-execution:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.btn-execution:active {
    transform: translateY(0);
}

.btn-done {
    background-color: #4caf50;
    color: #ffffff;
}

.btn-done:hover {
    background-color: #45a049;
}

.btn-extend {
    background-color: #2196f3;
    color: #ffffff;
}

.btn-extend:hover {
    background-color: #1976d2;
}

.btn-pause {
    background-color: #ff9800;
    color: #ffffff;
}

.btn-pause:hover {
    background-color: #f57c00;
}

.btn-incident {
    background-color: #f44336;
    color: #ffffff;
}

.btn-incident:hover {
    background-color: #d32f2f;
}

.btn-quit {
    background-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    border: 2px solid rgba(255, 255, 255, 0.5);
}

.btn-quit:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

/* Erreur */
.execution-error {
    text-align: center;
    padding: 3rem;
    background-color: #ffffff;
    border-radius: 16px;
    max-width: 500px;
    margin: 0 auto;
}

.error-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.error-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #2c2c2e;
    margin-bottom: 1rem;
}

.error-message {
    font-size: 1rem;
    color: #86868b;
    margin-bottom: 2rem;
    line-height: 1.6;
}

/* Responsive */
@media (max-width: 768px) {
    .execution-title {
        font-size: 1.75rem;
    }
    
    .timer-display {
        font-size: 4rem;
    }
    
    .execution-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-execution {
        width: 100%;
    }
}

/* ===================================
   BOTTOM SHEET
   =================================== */

.bottom-sheet-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0);
    z-index: 2000;
    transition: background-color 0.3s ease;
}

.bottom-sheet-overlay-open {
    background-color: rgba(0, 0, 0, 0.5);
}

.bottom-sheet-overlay-closing {
    background-color: rgba(0, 0, 0, 0);
}

.bottom-sheet {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: #ffffff;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
    max-height: 80vh;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.bottom-sheet-open {
    transform: translateY(0);
}

.bottom-sheet-closing {
    transform: translateY(100%);
}

.bottom-sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e5e5e7;
}

.bottom-sheet-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #2c2c2e;
}

.bottom-sheet-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f5f5f7;
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    color: #86868b;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.bottom-sheet-close:hover {
    background-color: #e5e5e7;
}

.bottom-sheet-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.bottom-sheet-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e5e5e7;
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

/* ===================================
   FORMULAIRE INCIDENT
   =================================== */

.incident-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.form-label-bold {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #2c2c2e;
}

.shift-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.shift-option {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    background-color: #f5f5f7;
    border-radius: 8px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.shift-option:has(input:checked) {
    background-color: #e3f2fd;
    border-color: #2196f3;
}

.shift-option input[type="radio"] {
    margin-top: 0.25rem;
    cursor: pointer;
}

.shift-option-label {
    flex: 1;
    cursor: pointer;
}

.shift-option-title {
    font-size: 1rem;
    font-weight: 600;
    color: #2c2c2e;
    margin-bottom: 0.25rem;
}

.shift-option-desc {
    font-size: 0.875rem;
    color: #86868b;
}

/* ===================================
   RÉSULTAT REPLANIFICATION
   =================================== */

.replan-result {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.replan-stats {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.replan-stats p {
    font-size: 1rem;
    color: #48484a;
}

.replan-changes-title {
    font-size: 1rem;
    font-weight: 600;
    color: #2c2c2e;
    margin-bottom: 0.5rem;
}

.replan-changes-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.replan-change-item {
    padding: 0.75rem;
    background-color: #f5f5f7;
    border-radius: 6px;
    font-size: 0.9375rem;
    color: #2c2c2e;
}

.replan-warning {
    padding: 1rem;
    background-color: #fff3e0;
    border-left: 4px solid #ff9800;
    border-radius: 6px;
}

.replan-warning p {
    margin: 0;
    color: #e65100;
    font-size: 0.9375rem;
}

/* Actions header */
.today-header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Responsive */
@media (max-width: 768px) {
    .bottom-sheet {
        max-height: 90vh;
    }
    
    .bottom-sheet-footer {
        flex-direction: column;
    }
    
    .bottom-sheet-footer button {
        width: 100%;
    }
    
    .today-header-actions {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
        gap: 0.75rem;
    }
}

/* ===================================
   PAGE STATISTIQUES
   =================================== */

.stats-page {
    max-width: 900px;
    margin: 0 auto;
}

.stats-header {
    margin-bottom: 1.5rem;
}

.stats-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #2c2c2e;
}

.stats-section {
    background-color: #ffffff;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 1.5rem;
}

.stats-section-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #2c2c2e;
    margin-bottom: 1rem;
}

.stats-empty {
    text-align: center;
    color: #86868b;
    padding: 2rem;
}

/* Grille de stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.stat-card {
    padding: 1.25rem;
    background-color: #f5f5f7;
    border-radius: 10px;
    border-left: 4px solid #007aff;
}

.stat-card-success {
    border-color: #4caf50;
    background-color: #e8f5e9;
}

.stat-card-warning {
    border-color: #ff9800;
    background-color: #fff3e0;
}

.stat-card-danger {
    border-color: #f44336;
    background-color: #ffebee;
}

.stat-card-label {
    font-size: 0.875rem;
    color: #86868b;
    margin-bottom: 0.5rem;
}

.stat-card-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2c2c2e;
}

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

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background-color: #f5f5f7;
    border-radius: 8px;
}

.history-date {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #2c2c2e;
    min-width: 120px;
}

.history-data {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.history-no-data {
    font-size: 0.875rem;
    color: #86868b;
}

.history-tasks {
    font-size: 0.875rem;
    color: #2c2c2e;
    font-weight: 600;
}

.history-time {
    font-size: 0.875rem;
    color: #86868b;
}

/* Réglages */
.settings-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.settings-info {
    font-size: 0.875rem;
    color: #86868b;
    line-height: 1.6;
}

.btn-danger {
    background-color: #f44336;
    color: #ffffff;
    border: none;
}

.btn-danger:hover {
    background-color: #d32f2f;
}

/* Responsive */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .history-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .settings-actions {
        flex-direction: column;
    }
    
    .settings-actions button {
        width: 100%;
    }
}


/* === TODAY timeline rows (improved) === */
.timeline.timeline-rows {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.timeline-row {
    display: grid;
    grid-template-columns: 64px 1fr;
    align-items: start;
    gap: 10px;
    position: relative;
}
.timeline-hour {
    font-size: 12px;
    color: #6b7280;
    padding-top: 8px;
    text-align: right;
}
.timeline-lane {
    min-height: 52px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.timeline-row.is-current-hour .timeline-lane {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59,130,246,0.12) inset;
}
.timeline-now-line {
    height: 2px;
    border-radius: 999px;
    width: 100%;
    background: rgba(59,130,246,0.55);
}

.today-subtitle {
    display: flex;
    align-items: center;
    gap: 6px;
}
.today-subtitle-clock {
    font-variant-numeric: tabular-nums;
    color: #374151;
}

/* === Plan day picker + special bar === */
.plan-special-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    margin-bottom: 14px;
}
.plan-special-label {
    font-size: 13px;
    color: #374151;
}
.plan-day-picker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}
.plan-day-picker-title {
    flex: 1;
    text-align: center;
    font-weight: 600;
}
.plan-day-picker-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}
.plan-day-picker-dow {
    font-size: 11px;
    color: #6b7280;
    text-align: center;
}
.plan-day-cell {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 10px 0;
    background: #fff;
    cursor: pointer;
}
.plan-day-cell.is-outside {
    opacity: 0.4;
}
.plan-day-cell.is-today {
    border-color: #3b82f6;
}
.plan-day-cell.is-selected {
    box-shadow: 0 0 0 2px rgba(59,130,246,0.2) inset;
}


/* === UI Improvements (Planifier/Aujourd'hui) === */

.plan-special-bar{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:12px;padding:10px 12px;border:1px solid var(--border);border-radius:12px;background:#fff;}
.plan-special-label{font-weight:600;color:#222;}

.plan-day-picker-header{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:10px;}
.plan-day-picker-title{font-weight:700;text-transform:capitalize;}
.plan-day-picker-grid{display:grid;grid-template-columns:repeat(7,1fr);gap:8px;}
.plan-day-picker-dow{font-size:12px;color:#777;text-align:center;padding:4px 0;}
.plan-day-cell{border:1px solid var(--border);border-radius:12px;padding:10px 0;background:#fff;}
.plan-day-cell.is-outside{opacity:.35;}
.plan-day-cell.is-today{border-color:var(--primary);box-shadow:0 0 0 2px rgba(0,122,255,.12) inset;}
.plan-day-cell.is-selected{background:rgba(0,122,255,.08);border-color:var(--primary);}

/* Aujourd'hui : timeline par heures (échelle minute→pixel continue)
   IMPORTANT: pas de gap vertical sinon la position des minutes devient fausse. */
.timeline.timeline-rows{display:flex;flex-direction:column;gap:0;}
.timeline-row{display:grid;grid-template-columns:70px 1fr;align-items:stretch;gap:10px;}
.timeline-hour{font-size:12px;color:#6b7280;display:flex;align-items:flex-start;justify-content:flex-end;padding-right:6px;padding-top:6px;font-variant-numeric:tabular-nums;}
.timeline-lane{position:relative;height:120px;border:1px solid var(--border);border-radius:14px;background:#fff;padding:0;overflow:visible;}

/* Grille interne (hybride): lignes fines chaque 15 min + repère à 30 min */
.timeline-lane{
    background-image:
        /* ligne 30 min (un peu plus visible) */
        linear-gradient(to bottom, rgba(0,0,0,.06) 1px, transparent 1px),
        /* lignes 15 min (très discrètes) */
        repeating-linear-gradient(to bottom, rgba(0,0,0,.035) 0 1px, transparent 1px 30px);
    /* 120px / heure => 30px / 15min et 60px / 30min */
    background-size: 100% 60px, 100% 30px;
    background-position: 0 60px, 0 0;
    background-repeat: repeat;
}
.timeline-row.is-current-hour .timeline-lane{border-color:var(--primary);box-shadow:0 0 0 2px rgba(0,122,255,.10) inset;}
.timeline-now-line{position:absolute;left:0;right:0;top:0;height:2px;background:rgba(255,59,48,.7);border-radius:99px;opacity:.75;pointer-events:none;}

.today-subtitle{display:flex;align-items:center;gap:6px;flex-wrap:wrap;}
.today-subtitle-clock{font-variant-numeric:tabular-nums;font-weight:600;color:#333;}

/* Assurer que le menu FAB reste cliquable */
.fab-menu{z-index:140;}
.fab-backdrop{z-index:0;}

/* STEP 4 */
.task.cancelled { opacity: 0.6; text-decoration: line-through; }

/* ===== PATCH: Planifier compact pauses/buffers ===== */
.plan-section-compact .plan-section-title { margin: 0; }
.plan-compact-header { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.plan-compact-toggles { display:flex; align-items:center; gap:12px; }
.compact-toggle { display:flex; align-items:center; gap:8px; padding:6px 10px; border:1px solid rgba(0,0,0,.10); border-radius:14px; }
.compact-toggle-label { font-size: 0.9rem; opacity: .9; }
.plan-compact-content { padding-top: 8px; }
.plan-compact-grid { display:grid; grid-template-columns: 1fr 1fr; gap:10px; }
.plan-compact-card { padding:10px; border:1px solid rgba(0,0,0,.10); border-radius:14px; }
.compact-card-title { font-weight:600; margin-bottom:8px; }
.compact-field { display:flex; align-items:center; gap:8px; margin:6px 0; }
.compact-field-label { width: 120px; font-size:0.9rem; opacity:.9; }

/* ===== PATCH: Today timeline proportional blocks ===== */
.block-absolute { 
    position: absolute !important; 
    margin: 0 !important;
    padding: 6px 8px !important;
    font-size: 0.85rem !important;
    overflow: hidden;
    box-sizing: border-box;
    /* Ne pas centrer verticalement le contenu: sinon texte peut paraitre coupe sur petits blocs */
    align-items: flex-start !important;
    justify-content: flex-start !important;
}

/* Blocs: look "calendar" (propre, lisible) */
.block-absolute{border-radius:12px !important;box-shadow:0 2px 10px rgba(0,0,0,.06);}
.block-absolute:hover{box-shadow:0 6px 18px rgba(0,0,0,.10);} 

.block-absolute .block-info {
    gap: 2px !important;
}

.block-absolute .block-time {
    font-size: 0.75rem !important;
    font-weight: 600 !important;
}

.block-absolute .block-label {
    font-size: 0.85rem !important;
    font-weight: 600 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.block-absolute .block-duration {
    font-size: 0.7rem !important;
}

.block-absolute .block-actions {
    position: absolute;
    right: 4px;
    top: 4px;
    gap: 4px !important;
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s ease;
}
.block-absolute:hover .block-actions,
.block-absolute:focus-within .block-actions{
    opacity: 1;
    pointer-events: auto;
}

.block-absolute .btn-icon-small {
    width: 24px !important;
    height: 24px !important;
    font-size: 0.8rem !important;
}

/* Segments de continuation (blocs qui traversent plusieurs heures)
   - évite la répétition du contenu (texte/actions) sur chaque rangée */
.block-absolute.block-continuation {
    padding: 4px 6px !important;
}
.block-absolute.block-continuation .block-time,
.block-absolute.block-continuation .block-duration,
.block-absolute.block-continuation .block-actions {
    display: none !important;
}
.block-absolute.block-continuation .block-label {
    font-weight: 700 !important;
    opacity: 0.85;
}

/* Densité adaptive */
.block-absolute.block-small{padding:3px 6px !important;}
/* Blocs courts: garder heure + titre + durée sans couper (typo plus compacte) */
.block-absolute.block-small .block-info{gap:1px !important;}
.block-absolute.block-small .block-time{font-size:.68rem !important;line-height:1.0 !important;}
.block-absolute.block-small .block-label{font-size:.74rem !important;line-height:1.0 !important;}
.block-absolute.block-small .block-duration{display:block !important;font-size:.62rem !important;line-height:1.0 !important;white-space:nowrap;}

.block-absolute.block-tiny{padding:2px 6px !important;}
/* Blocs tres courts: afficher AU MOINS l'heure sur une seule ligne lisible */
.block-absolute.block-tiny .block-info{display:flex !important;flex-direction:row !important;align-items:center !important;gap:6px !important;}
.block-absolute.block-tiny .block-time{display:block !important;font-size:.70rem !important;line-height:1.05 !important;white-space:nowrap;}
.block-absolute.block-tiny .block-label{display:block !important;font-size:.74rem !important;line-height:1.05 !important;font-weight:700 !important;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.block-absolute.block-tiny .block-duration,
.block-absolute.block-tiny .block-actions{display:none !important;}

/* Blocs longs: légèrement plus discrets pour ne pas écraser le reste */
.block-absolute.block-long{filter:saturate(.92);}
