/* ==========================================================================
   My tasks: layout only. Chips, cards, counts, filter bar and empty state come from components/ui.css.
   The groups and cards are drawn by projects.js (myTaskCard, renderMyTasksGrouped).
   ========================================================================== */
@layer app-pages {

    .my-tasks-wrapper {
        display: flex;
        flex-direction: column;
        gap: 1.25rem;
    }
    .ui-note + .my-tasks-wrapper { margin-top: 0.75rem; }
    #myTasksCount:not(:empty) { margin: 0 0 0.75rem; }

    /* One group of tasks: a header row (fold button and count) over a grid of cards. */
    .my-tasks-group { overflow: hidden; }
    .my-tasks-group-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
        padding: 0 1.25rem;
        background: var(--d26-surface);
        border-bottom: 1px solid var(--d26-line);
    }
    .my-tasks-toggle {
        display: inline-flex;
        align-items: center;
        gap: 0.5rem;
        min-height: var(--d26-target);
        padding: 0;
        border: 0;
        background: transparent;
        color: var(--d26-ink);
        font: inherit;
        font-weight: 700;
        text-align: left;
        cursor: pointer;
    }
    .my-tasks-chevron { width: 0.75rem; font-size: 0.75rem; color: var(--d26-ink-muted); }

    /* The group colour follows the status pairs in tokens.css; the icon and the label always say what it is. */
    .my-tasks-group--danger .my-tasks-toggle { color: var(--d26-bad-fg); }
    .my-tasks-group--warning .my-tasks-toggle { color: var(--d26-wait-fg); }
    .my-tasks-group--primary .my-tasks-toggle { color: var(--d26-accent); }

    /* The tasks of a group as rows: the due date is the left edge, so the list reads like a schedule. */
    .my-tasks-list { display: flex; flex-direction: column; }
    .my-tasks-list[hidden] { display: none; }

    .my-task-row {
        display: grid;
        grid-template-columns: 3.25rem minmax(0, 1fr) auto;
        align-items: center;
        gap: 0.5rem 1rem;
        padding: 0.75rem 1.25rem;
        background: var(--d26-card);
        border-top: 1px solid var(--d26-line);
        cursor: pointer;
    }
    .my-task-row:first-child { border-top: 0; }
    .my-task-row:hover { background: var(--d26-surface); }

    /* The date block: the day in large tabular figures, the month under it. A late task takes the danger tint. */
    .my-task-date {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        min-height: 3.25rem;
        border-radius: var(--d26-radius-control);
        background: var(--d26-draft-bg);
        color: var(--d26-ink);
        font-variant-numeric: tabular-nums;
        line-height: 1.1;
    }
    .my-task-day { font-size: 1.25rem; font-weight: 600; }
    .my-task-day--none { color: var(--d26-ink-muted); font-weight: 400; }
    .my-task-month { font-size: 0.75rem; color: var(--d26-ink-2); }
    .my-task-row--late .my-task-date { background: var(--d26-bad-bg); color: var(--d26-bad-fg); }
    .my-task-row--late .my-task-month { color: var(--d26-bad-fg); }

    .my-task-main { min-width: 0; display: flex; flex-direction: column; gap: 0.25rem; }
    .my-task-title { margin: 0; font-size: 1rem; line-height: 1.4; }
    .my-task-title .ui-link-btn { padding: 0; text-align: left; text-decoration: none; color: var(--d26-ink); }
    .my-task-title .ui-link-btn:hover { text-decoration: underline; }
    .my-task-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.5rem; margin: 0; font-size: 0.8125rem; color: var(--d26-ink-muted); }
    .my-task-meta .ui-chip { white-space: normal; }
    .my-task-when { color: var(--d26-ink-2); font-weight: 600; }
    .my-task-when--late { color: var(--d26-bad-fg); }
    .my-task-actions { justify-self: end; }

    /* Phone: the date block stays on the left; the action goes under the text. */
    @media (max-width: 640px) {
        .my-task-row { grid-template-columns: 3rem minmax(0, 1fr); padding: 0.75rem 1rem; }
        .my-task-actions { grid-column: 2; justify-self: start; }
    }
}
