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

.tasks-hero {
    margin: 6px 0 16px;
    padding: 16px;
    border-radius: 16px;
    border: 1px solid #d6e4ec;
    background: linear-gradient(130deg, #f6fbff 0%, #effaf4 55%, #fff7ec 100%);
}

.tasks-subtitle {
    margin: -12px auto 10px;
    text-align: center;
    max-width: 760px;
    color: #4b6677;
}

.tasks-top-actions {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.tasks-calendar-link {
    text-decoration: none;
    border: 1px solid #c9dce9;
    background: #fff;
    color: #1b506c;
    border-radius: 999px;
    padding: 8px 12px;
    font-weight: 700;
    font-size: 0.88rem;
}

.tasks-create-btn {
    border: none;
    border-radius: 999px;
    padding: 8px 14px;
    font-weight: 700;
    font-size: 0.88rem;
    cursor: pointer;
    background: linear-gradient(135deg, #28a56f 0%, #1c7e54 100%);
    color: #fff;
}

/* === MODALE CRÉATION TÂCHE === */
.tc-modal {
    max-width: 520px;
    width: 92vw;
    text-align: left;
    padding: 0;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 16px;
}

.tc-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 12px;
    border-bottom: 1px solid #e4eef4;
}

.tc-modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: #132e40;
}

.tc-close-btn {
    background: none;
    border: none;
    font-size: 1.4rem;
    color: #7a9aad;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
}

.tc-form {
    padding: 16px 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tc-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tc-field label,
.tc-row > .tc-field label {
    font-size: 0.82rem;
    font-weight: 700;
    color: #3a5a6e;
}

.tc-input {
    border: 1px solid #c5d8e4;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 0.9rem;
    background: #fbfdff;
    width: 100%;
    box-sizing: border-box;
}

.tc-input:focus {
    outline: none;
    border-color: #5aaecf;
    background: #fff;
}

.tc-textarea {
    resize: vertical;
    min-height: 64px;
}

.tc-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.tc-type-row {
    display: flex;
    gap: 6px;
    flex-wrap: nowrap;
}

.tc-type-btn {
    flex: 1;
    padding: 7px 10px;
    border: 1px solid #c5d8e4;
    border-radius: 999px;
    font-size: 0.86rem;
    font-weight: 600;
    color: #2a4d62;
    cursor: pointer;
    background: #fff;
    white-space: nowrap;
    text-align: center;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    font-family: inherit;
}

.tc-type-btn:hover {
    background: #eaf4fb;
    border-color: #5aaecf;
}

.tc-type-btn.active {
    background: #1b4d68;
    border-color: #1b4d68;
    color: #fff;
}

.tc-type-btn.active:hover {
    background: #1b4d68;
}

#tc-recurring-fields {
    display: none;
}

.tc-memo-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #475569;
    cursor: pointer;
    margin: 4px 0 8px;
}

.tc-memo-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.tc-memo-hint {
    font-size: 0.8rem;
    color: #94a3b8;
}

.tc-actions {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.tc-submit-btn {
    flex: 1;
    border: none;
    border-radius: 8px;
    padding: 10px;
    font-weight: 700;
    font-size: 0.9rem;
    color: #fff;
    cursor: pointer;
    background: linear-gradient(135deg, #28a56f 0%, #1c7e54 100%);
}

.tc-cancel-btn {
    border: 1px solid #c5d8e4;
    border-radius: 8px;
    padding: 10px 14px;
    font-weight: 700;
    font-size: 0.9rem;
    background: #fff;
    color: #3a5a6e;
    cursor: pointer;
}

.tasks-summary-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px 8px;
    margin-top: 8px;
    font-size: 0.84rem;
}

.tasks-summary-stat {
    color: #3a5a6e;
    font-weight: 600;
}

.tasks-summary-stat.pending { color: #7a4e0a; }
.tasks-summary-stat.done    { color: #1a6e42; }

.tasks-summary-sep {
    color: #b0c5d0;
    font-weight: 400;
}

.tasks-legend-sep {
    margin: 0 2px;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.82rem;
    color: #395567;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.dot.soon    { background: #f0bc32; }
.dot.urgent  { background: #f28f41; }
.dot.expired { background: #d14a4a; }

.task-section-title {
    background: linear-gradient(130deg, #eff5ff 0%, #edf9f2 100%);
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 1.08rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 14px 0 10px;
    color: #1f4870;
    border: 1px solid #ccdcf2;
}

.task-section-count {
    font-size: 0.76rem;
    font-weight: 700;
    color: #3b6178;
    background: #ffffff;
    border: 1px solid #d5e3eb;
    border-radius: 999px;
    padding: 2px 8px;
}

.task-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.task-card {
    background: #ffffff;
    border-radius: 14px;
    border: 1px solid #d8e4ea;
    box-shadow: 0 8px 20px rgba(16, 41, 56, 0.06);
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    overflow: hidden;
}

.task-card.content-to-be-validated {
    border-right-color: #e39a1f;
}

.task-card.important {
    border-top: 3px solid #a855f7;
    box-shadow: 0 8px 20px rgba(168, 85, 247, 0.12), 0 0 0 1px rgba(168, 85, 247, 0.1);
}

.summary-pill.important-badge {
    background: rgba(168, 85, 247, 0.1);
    border-color: rgba(168, 85, 247, 0.35);
    color: #7c3aed;
    font-weight: 600;
}

.summary-pill.memo-badge {
    background: rgba(100, 116, 139, 0.1);
    border-color: rgba(100, 116, 139, 0.35);
    color: #475569;
    font-weight: 600;
}

.task-card details {
    padding: 12px 14px;
}

.task-card summary {
    list-style: none;
    cursor: pointer;
}

.task-card summary::-webkit-details-marker {
    display: none;
}

.task-summary-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.task-title {
    margin: 0;
    font-size: 1.06rem;
    color: #153249;
}

.done-icon {
    margin-left: 6px;
    color: #17814f;
    font-size: 0.85rem;
    font-weight: 700;
    border-radius: 999px;
    border: 1px solid #8ad5ad;
    padding: 1px 6px;
    background: #ecfff4;
}

.task-summary-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

.summary-pill {
    display: inline-block;
    border-radius: 999px;
    padding: 4px 8px;
    font-size: 0.76rem;
    font-weight: 700;
    border: 1px solid #d7e3eb;
    color: #2d4c5f;
    background: #f8fbfd;
}

.summary-pill.points {
    background: #edf9f2;
    border-color: #cbe9d8;
    color: #1f6a46;
}

.summary-pill.date {
    background: #eff5ff;
    border-color: #cfe0f9;
    color: #265082;
}

.summary-pill.state-done {
    background: #e9fff2;
    border-color: #bde7cf;
    color: #1f7f4f;
}

.summary-pill.state-todo {
    background: #fff8e8;
    border-color: #f0ddb2;
    color: #8b661e;
}

.task-header {
    margin-top: 10px;
    border-top: 1px dashed #d8e4ea;
    padding-top: 10px;
}

.task-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.task-info {
    margin-top: 10px;
    background: #fcfeff;
    border: 1px solid #dfebf1;
    border-radius: 10px;
    padding: 10px;
}

.task-info-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 4px 0;
    font-size: 0.9rem;
}

.task-kpis {
    padding-bottom: 8px;
    margin-bottom: 8px;
    border-bottom: 1px dashed #d5e4eb;
}

.task-kpis > div {
    flex: 1;
    text-align: center;
}

.task-info-row .label {
    color: #557082;
    font-weight: 700;
}

.task-info-row .value {
    color: #1f394b;
}

.task-description {
    margin-top: 10px;
    font-size: 0.9rem;
    color: #1f3a4b;
    background: #f7fbff;
    padding: 9px;
    border-radius: 8px;
    border-left: 4px solid #c8dcec;
}

.give-btn,
.toggle-done-btn,
.give-malus-btn {
    padding: 0.46rem 0.72rem;
    font-size: 0.88rem;
    border: none;
    color: white;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
}

.give-btn {
    background: linear-gradient(135deg, #27a66f 0%, #1c8558 100%);
}

.toggle-done-btn {
    background: linear-gradient(135deg, #157db0 0%, #0f6088 100%);
}

.give-malus-btn {
    background: linear-gradient(135deg, #cb4d4d 0%, #a83131 100%);
}

.schedule-toggle-btn {
    background: #fff;
    border: 1px solid #b8cdd8;
    color: #1b4861;
    border-radius: 8px;
    padding: 8px 13px;
    font-size: 0.84rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.schedule-toggle-btn:hover,
.schedule-toggle-btn.active {
    background: #eaf4fb;
    border-color: #5da8cc;
}

.schedule-inline-form {
    display: none;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
    padding: 10px 12px;
    background: #f3fafd;
    border: 1px solid #c4dce8;
    border-radius: 10px;
}

.schedule-inline-form.open {
    display: flex;
}

.schedule-date-input {
    border: 1px solid #c4dce8;
    border-radius: 8px;
    padding: 7px 10px;
    font-size: 0.86rem;
    background: #fff;
    flex: 1;
    min-width: 140px;
}

.schedule-confirm-btn {
    border: none;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 0.84rem;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    background: linear-gradient(135deg, #2388c0 0%, #166b99 100%);
    white-space: nowrap;
}

.deadline.normal {
    border-left-color: #cfdbe3;
}

.deadline.soon {
    border-left-color: #e1b743;
    background: linear-gradient(180deg, #ffffff 0%, #fffbee 100%);
}

.deadline.urgent {
    border-left-color: #e18540;
    background: linear-gradient(180deg, #fffdf8 0%, #fff5eb 100%);
}

.deadline.expired {
    border-left-color: #c43f3f;
    background: linear-gradient(180deg, #fff9f9 0%, #fff0f0 100%);
}

.task-card.done {
    border-left-color: #3aad78 !important;
    background: linear-gradient(180deg, #f6fffb 0%, #eafaf2 100%) !important;
    opacity: 0.82;
}

.task-card.done .task-title {
    color: #2a6648;
    text-decoration: line-through;
    text-decoration-color: #7dcea8;
}

.task-filters {
    margin-bottom: 14px;
}

.filter-chips-row {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    align-items: center;
}

.filter-chips-divider {
    width: 1px;
    height: 24px;
    background: #cddde8;
    border-radius: 2px;
    flex-shrink: 0;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid #cddde8;
    background: #fff;
    color: #2a4d62;
    font-size: 0.84rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    white-space: nowrap;
}

.filter-chip:hover {
    border-color: #8ab8d0;
    background: #f0f8fd;
}

/* Profil */
.profile-chip.active {
    background: #1b4d68;
    border-color: #1b4d68;
    color: #fff;
}

/* Statut A faire */
.status-chip.todo.active {
    background: #fff4e0;
    border-color: #e8b84b;
    color: #7a4e0a;
}

/* Statut Faites */
.status-chip.done.active {
    background: #d8f5e6;
    border-color: #5fbe96;
    color: #1a6e42;
}

/* Catégorie — utilise la couleur CSS custom --cat-color */
.category-chip {
    border-color: color-mix(in srgb, var(--cat-color) 35%, #cddde8);
}

.category-chip.active {
    background: color-mix(in srgb, var(--cat-color) 18%, #fff);
    border-color: var(--cat-color);
    color: color-mix(in srgb, var(--cat-color) 80%, #1a2830);
}

/* Tout afficher */
.reset-chip {
    color: #8a5a1a;
    border-color: #e8d4b0;
    background: #fffbf3;
}

.reset-chip:hover {
    background: #fff3dc;
    border-color: #d4a84b;
}

.tasks-empty {
    border: 1px dashed #c9d9e4;
    border-radius: 12px;
    background: #fafdff;
    padding: 18px;
    color: #456173;
    text-align: center;
}

.assign-points-form {
    border-radius: 10px;
    max-width: 400px;
    margin: 1rem auto;
}

.assign-points-form h3 {
    margin-bottom: 0.8rem;
    font-size: 1.2rem;
    color: #111827;
    text-align: center;
}

.assign-points-form label {
    display: flex;
    align-items: center;
    margin-bottom: 0.6rem;
    cursor: pointer;
    font-weight: 500;
    color: #1f2937;
    background-color: #ffffff;
    padding: 0.5rem 0.8rem;
    border-radius: 6px;
    transition: background-color 0.2s, box-shadow 0.2s;
}

.assign-points-form label:hover {
    background-color: #eef2ff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.assign-points-form input[type="checkbox"] {
    margin-right: 0.8rem;
    width: 18px;
    height: 18px;
    accent-color: #2b8f5e;
}

.assign-points-form button {
    padding: 0.6rem;
    margin-top: 1rem;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #24996a 0%, #1b7b54 100%);
    color: white;
    font-weight: 600;
    cursor: pointer;
}

.assign-points-form .note {
    display: block;
    text-align: center;
    font-size: 0.85rem;
    color: #6b7280;
    margin-top: 0.5rem;
}

@media (max-width: 820px) {
    .task-summary-main {
        flex-direction: column;
        align-items: flex-start;
    }

    .task-summary-meta {
        justify-content: flex-start;
    }

}


@media (max-width: 560px) {
    .tasks-hero {
        padding: 14px 12px;
    }

    .task-card details {
        padding: 10px;
    }

    .task-kpis {
        display: grid;
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .task-info-row {
        flex-direction: column;
    }

    .task-actions {
        width: 100%;
        gap: 8px;
    }

    .task-actions form,
    .task-actions button {
        width: 100%;
    }

    /* Tap targets : hauteur minimum 44px sur mobile */
    .give-btn,
    .toggle-done-btn,
    .give-malus-btn,
    .schedule-toggle-btn,
    .schedule-confirm-btn,
    .edit-task-btn,
    .delete-task-btn,
    .planner-pause-btn {
        min-height: 44px;
        padding-top: 10px;
        padding-bottom: 10px;
        font-size: 0.92rem;
    }

    .filter-chip {
        min-height: 40px;
        padding: 9px 14px;
    }

    .tc-type-btn {
        min-height: 44px;
        padding: 10px;
    }

    .tc-close-btn {
        min-height: 44px;
        min-width: 44px;
        padding: 10px;
    }

    .deadline-confirm-btn {
        min-height: 44px;
        padding: 10px 14px;
        font-size: 0.88rem;
    }

    .deadline-cancel-btn {
        min-height: 44px;
        min-width: 44px;
        padding: 10px;
    }

    .schedule-date-input {
        min-height: 44px;
        font-size: 1rem;
    }

    /* Évite le zoom automatique iOS sur les inputs (seuil : 16px) */
    .tc-form input,
    .tc-form select,
    .tc-form textarea {
        font-size: 1rem;
    }
}

/* Inline deadline editing */
.hidden {
    display: none !important;
}

.deadline-display {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    border-radius: 6px;
    transition: background 0.15s;
}

.deadline-display:hover {
    background: #eaf4fb;
}

.deadline-edit-icon {
    font-size: 0.78rem;
    opacity: 0.5;
    transition: opacity 0.15s;
}

.deadline-display:hover .deadline-edit-icon {
    opacity: 1;
}

.no-deadline {
    color: #aaa;
    font-style: italic;
}

.deadline-edit-form {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.deadline-date-input {
    border: 1px solid #c4dce8;
    border-radius: 8px;
    padding: 5px 8px;
    font-size: 0.84rem;
    background: #fff;
}

.deadline-confirm-btn {
    border: none;
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 0.82rem;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    background: linear-gradient(135deg, #2388c0 0%, #166b99 100%);
}

.deadline-cancel-btn {
    border: none;
    background: none;
    color: #999;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 4px 6px;
}

.deadline-cancel-btn:hover {
    color: #c43f3f;
}

/* Edit / Delete task buttons */
.edit-task-btn {
    background: #fff;
    border: 1px solid #b8cdd8;
    color: #1b4861;
    border-radius: 8px;
    padding: 8px 13px;
    font-size: 0.84rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.edit-task-btn:hover {
    background: #eaf4fb;
    border-color: #5da8cc;
}

.delete-task-btn {
    background: none;
    border: 1px solid #e8b4b4;
    color: #c43f3f;
    border-radius: 8px;
    padding: 8px 13px;
    font-size: 0.84rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.delete-task-btn:hover {
    background: #fff0f0;
    border-color: #c43f3f;
}


/* ── Tâches accomplies aujourd'hui ────────────────────────────── */

.done-today-section {
    margin-top: 2rem;
    border-top: 1px solid var(--border, #2e2e3e);
    padding-top: 1rem;
}

.done-today-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted, #9a9ab0);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.6rem;
}

.done-today-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.done-today-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.45rem 0.75rem;
    background: var(--surface, #1e1e2e);
    border: 1px solid var(--border, #2e2e3e);
    border-radius: 8px;
    font-size: 0.875rem;
    opacity: 0.75;
}

.done-today-task {
    color: var(--text, #e2e8f0);
    flex: 1;
    text-decoration: line-through;
    text-decoration-color: var(--text-muted, #9a9ab0);
}

.done-today-who {
    font-size: 0.78rem;
    color: var(--text-muted, #9a9ab0);
    background: var(--border, #2e2e3e);
    border-radius: 10px;
    padding: 0.15rem 0.5rem;
    flex-shrink: 0;
}


/* ── Barre suppression tâches faites ──────────────────────────── */

.delete-done-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.75rem;
    background: var(--surface, #1e1e2e);
    border: 1px solid var(--border, #2e2e3e);
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--text-muted, #9a9ab0);
}

.delete-done-btn {
    background: transparent;
    border: 1px solid #ef4444;
    color: #ef4444;
    border-radius: 6px;
    padding: 0.3rem 0.75rem;
    font-size: 0.82rem;
    cursor: pointer;
    white-space: nowrap;
    min-height: 36px;
}

.delete-done-btn:active {
    background: #ef444422;
}
