/* Tasks owns list/detail layout, difficulty/status cues, and fast keyboard-safe interactions. */
.tasks-content {
    --task-todo: #64748b;
    --task-progress: #f2b94b;
    --task-completed: #22a66f;
    min-width: 0;
    min-height: calc(100vh - 78px);
    padding: 28px 30px 80px;
    overflow-x: hidden;
}

.tasks-content [hidden] {
    display: none !important;
}

.tasks-content .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.tasks-shell {
    width: min(1040px, 100%);
    margin: 0 auto;
}

.tasks-page-heading {
    display: flex;
    margin-bottom: 22px;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
}

.tasks-page-heading .eyebrow,
.task-detail-heading .eyebrow {
    margin: 0 0 5px;
    color: var(--accent);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.tasks-page-heading h1 {
    margin: 0;
    color: var(--ink);
    font-family: "Manrope", sans-serif;
    font-size: clamp(25px, 3vw, 34px);
    font-weight: 850;
    letter-spacing: -.035em;
}

.tasks-page-heading > div:first-child > p:last-child {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.tasks-heading-actions {
    display: flex;
    align-items: center;
    gap: 9px;
}

.tasks-add-action {
    min-height: 44px;
    padding-inline: 17px;
    font-size: 12px;
}

.tasks-controls {
    margin-bottom: 14px;
}

.tasks-filter-form {
    display: grid;
    width: 100%;
    grid-template-columns: minmax(180px, 260px);
    align-items: center;
    gap: 10px;
}

.tasks-project-filter {
    min-height: 46px;
    grid-template-columns: auto minmax(0, 1fr) auto;
    padding: 0 13px;
    gap: 9px;
}

.tasks-project-filter > svg {
    width: 17px;
    height: 17px;
    color: var(--muted);
}

.tasks-project-filter select {
    height: 44px;
    padding: 0;
    font-size: 13px;
    font-weight: 750;
}

.tasks-search-dock {
    max-width: 720px;
}

.tasks-search-form {
    min-width: 0;
    flex: 1;
}

.tasks-search-field {
    width: 100%;
}

.tasks-search-field input {
    font-size: 15px;
    font-weight: 650;
}

.tasks-search-dock .tasks-add-action {
    padding: 0;
}

.tasks-results {
    transition: opacity .14s ease, transform .14s ease;
}

.tasks-results.is-loading,
.tasks-content.is-navigating .tasks-shell {
    opacity: .58;
    pointer-events: none;
}

.tasks-results.is-loading {
    transform: translateY(2px);
}

.tasks-status-tabs {
    display: flex;
    margin-bottom: 22px;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
}

.tasks-status-tabs::-webkit-scrollbar {
    display: none;
}

.tasks-status-tabs .pc-chip {
    min-height: 42px;
    flex: 0 0 auto;
    color: var(--muted);
    border-color: var(--line);
    background: color-mix(in srgb, var(--surface) 92%, var(--canvas));
    text-decoration: none;
}

.tasks-status-tabs .pc-chip > span {
    display: grid;
    min-width: 21px;
    height: 21px;
    padding: 0 6px;
    place-items: center;
    color: inherit;
    border-radius: 999px;
    background: color-mix(in srgb, currentColor 10%, transparent);
    font-size: 10px;
}

.tasks-status-tabs .pc-chip.active {
    color: var(--accent);
    border-color: color-mix(in srgb, var(--accent) 32%, var(--line));
    background: color-mix(in srgb, var(--accent) 10%, var(--surface));
}

.tasks-status-tabs .task-status-tab-in_progress.active {
    color: var(--task-progress);
}

.tasks-status-tabs .task-status-tab-completed.active {
    color: var(--task-completed);
}

.tasks-groups {
    display: grid;
    gap: 24px;
}

.tasks-group {
    min-width: 0;
}

.tasks-group-heading {
    display: grid;
    margin-bottom: 10px;
    grid-template-columns: 36px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
}

.tasks-group-heading > span {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    color: var(--task-todo);
    border-radius: 11px;
    background: color-mix(in srgb, var(--task-todo) 11%, var(--surface));
}

.task-group-in_progress .tasks-group-heading > span {
    color: var(--task-progress);
    background: color-mix(in srgb, var(--task-progress) 11%, var(--surface));
}

.task-group-completed .tasks-group-heading > span {
    color: var(--task-completed);
    background: color-mix(in srgb, var(--task-completed) 11%, var(--surface));
}

.tasks-group-heading svg {
    width: 17px;
    height: 17px;
}

.tasks-group-heading strong,
.tasks-group-heading small {
    display: block;
}

.tasks-group-heading strong {
    color: var(--ink);
    font-family: "Manrope", sans-serif;
    font-size: 14px;
    font-weight: 850;
}

.tasks-group-heading small {
    margin-top: 1px;
    color: var(--muted);
    font-size: 10px;
}

.tasks-group-heading em {
    display: grid;
    min-width: 27px;
    height: 27px;
    padding: 0 8px;
    place-items: center;
    color: var(--muted);
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    font-size: 10px;
    font-style: normal;
    font-weight: 900;
}

.tasks-list {
    display: grid;
    gap: 9px;
}

.task-card {
    display: grid;
    min-height: 82px;
    grid-template-columns: 54px minmax(0, 1fr);
    overflow: hidden;
    border-radius: 17px;
    box-shadow: 0 8px 26px rgba(24, 28, 42, .045);
    transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.task-card:hover,
.task-card:focus-within {
    border-color: color-mix(in srgb, var(--accent) 24%, var(--line));
    box-shadow: 0 12px 34px rgba(24, 28, 42, .08);
}

.task-card-status-form {
    display: grid;
    min-width: 0;
    place-items: center;
    border-right: 1px solid var(--line);
    background: color-mix(in srgb, var(--canvas) 62%, var(--surface));
}

.task-status-control {
    position: relative;
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border-radius: 13px;
    cursor: pointer;
}

.task-status-control:hover,
.task-status-control:focus-within {
    background: color-mix(in srgb, var(--accent) 9%, transparent);
}

.task-status-glyph {
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    color: var(--task-todo);
    border: 1px solid color-mix(in srgb, var(--task-todo) 28%, var(--line));
    border-radius: 9px;
    background: color-mix(in srgb, var(--task-todo) 7%, var(--surface));
    pointer-events: none;
}

.task-status-in_progress .task-status-glyph {
    color: var(--task-progress);
    border-color: color-mix(in srgb, var(--task-progress) 32%, var(--line));
    background: color-mix(in srgb, var(--task-progress) 9%, var(--surface));
}

.task-status-completed .task-status-glyph {
    color: var(--task-completed);
    border-color: color-mix(in srgb, var(--task-completed) 32%, var(--line));
    background: color-mix(in srgb, var(--task-completed) 9%, var(--surface));
}

.task-status-glyph svg {
    width: 16px;
    height: 16px;
}

.task-status-control select {
    position: absolute;
    z-index: 1;
    inset: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    opacity: 0;
}

.task-status-control select:disabled {
    cursor: default;
}

.task-card-main {
    display: grid;
    min-width: 0;
    min-height: 80px;
    padding: 12px 13px 12px 15px;
    grid-template-columns: minmax(0, 1fr) auto 18px;
    align-items: center;
    gap: 11px;
    color: var(--ink);
    text-decoration: none;
}

.task-card-copy {
    display: grid;
    min-width: 0;
    gap: 5px;
}

.task-card-copy > strong,
.task-card-copy > small {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.task-card-copy > strong {
    color: var(--ink);
    font-size: 14px;
    font-weight: 850;
    line-height: 1.25;
}

.task-status-completed .task-card-copy > strong {
    color: color-mix(in srgb, var(--ink) 58%, var(--muted));
    text-decoration: line-through;
    text-decoration-thickness: 1px;
}

.task-card-copy > small {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.35;
}

.task-card-meta,
.task-tag-row {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
}

.task-card-meta > span,
.task-card-meta > time,
.task-tag,
.task-tag-more {
    display: inline-flex;
    min-height: 22px;
    align-items: center;
    gap: 4px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
}

.task-card-meta svg {
    width: 13px;
    height: 13px;
}

.task-project-meta {
    color: var(--task-color, var(--muted)) !important;
}

.task-priority {
    padding: 0 7px;
    border-radius: 999px;
    background: color-mix(in srgb, currentColor 9%, transparent);
}

.task-priority-low {
    color: #64809e !important;
}

.task-priority-medium {
    color: #9b6f22 !important;
}

.task-priority-high {
    color: #d26735 !important;
}

.task-priority-urgent {
    color: #d33f5b !important;
}

.task-difficulty {
    min-height: 21px !important;
    padding: 0 7px;
    border: 1px solid color-mix(in srgb, currentColor 24%, var(--line));
    border-radius: 999px;
    background: color-mix(in srgb, currentColor 8%, transparent);
}

.task-difficulty-easy {
    color: #2b9d68 !important;
}

.task-difficulty-medium {
    color: #6577ff !important;
}

.task-difficulty-hard {
    color: #d6536b !important;
}

.task-due.is-overdue {
    color: #d33f5b !important;
}

.task-due.is-today {
    color: #b97716 !important;
}

.task-tag {
    min-height: 21px;
    padding: 0 7px;
    color: var(--task-color, var(--muted));
    border: 1px solid color-mix(in srgb, var(--task-color, var(--muted)) 22%, var(--line));
    border-radius: 999px;
    background: color-mix(in srgb, var(--task-color, var(--muted)) 8%, var(--surface));
}

.task-tag-more {
    font-weight: 900;
}

.task-color-slate { --task-color: #718096; }
.task-color-blue { --task-color: #3b82f6; }
.task-color-violet { --task-color: #7c6df2; }
.task-color-rose { --task-color: #e05d82; }
.task-color-amber { --task-color: #d89528; }
.task-color-green { --task-color: #29a36a; }

.task-assignee {
    display: grid;
    place-items: center;
}

.task-avatar.pc-avatar {
    width: 34px;
    height: 34px;
    font-size: 12px;
}

.task-avatar svg {
    width: 16px;
    height: 16px;
}

.task-card-chevron {
    width: 16px;
    height: 16px;
    color: color-mix(in srgb, var(--muted) 68%, transparent);
}

.tasks-empty-state {
    min-height: 310px;
    padding: 32px;
}

.tasks-empty-state strong {
    color: var(--ink);
    font-family: "Manrope", sans-serif;
    font-size: 17px;
}

.tasks-empty-state p {
    max-width: 340px;
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}

.tasks-empty-status {
    min-height: 230px;
}

.task-flash-panel {
    display: flex;
    min-height: 48px;
    margin-bottom: 14px;
    padding: 11px 14px;
    align-items: center;
    gap: 9px;
    color: var(--ink);
    border-color: color-mix(in srgb, var(--task-completed) 28%, var(--line));
    font-size: 12px;
    font-weight: 750;
}

.task-flash-panel.is-error {
    border-color: color-mix(in srgb, #ef6575 34%, var(--line));
}

.task-flash-panel svg {
    width: 17px;
    height: 17px;
    flex: 0 0 auto;
    color: var(--task-completed);
}

.task-flash-panel.is-error svg {
    color: #ef6575;
}

.task-undo-panel {
    display: flex;
    min-height: 54px;
    margin-bottom: 14px;
    padding: 7px 8px 7px 14px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-color: color-mix(in srgb, var(--accent) 24%, var(--line));
}

.task-undo-panel > span {
    display: inline-flex;
    min-width: 0;
    align-items: center;
    gap: 8px;
    color: var(--ink);
    font-size: 12px;
    font-weight: 750;
}

.task-undo-panel > span svg {
    width: 17px;
    height: 17px;
    color: var(--accent);
}

.tasks-content .task-detail-layer,
.tasks-content .task-project-layer {
    z-index: 230;
}

.task-detail-panel,
.task-project-panel {
    width: min(620px, 100%);
    padding: 20px;
    overflow-x: hidden;
}

.task-detail-heading {
    display: flex;
    margin-bottom: 17px;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.task-detail-heading h2 {
    margin: 0;
    color: var(--ink);
    font-family: "Manrope", sans-serif;
    font-size: 23px;
    font-weight: 850;
    letter-spacing: -.025em;
}

.task-detail-form {
    display: grid;
    gap: 13px;
}

.task-title-field,
.task-form-field {
    align-content: center;
    padding: 9px 13px;
    gap: 5px;
}

.task-title-field {
    min-height: 62px;
}

.task-title-field > span,
.task-form-field > span {
    color: var(--muted);
    font-size: 9px;
    font-weight: 900;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.task-title-field input {
    height: 28px;
    font-size: 16px;
    font-weight: 800;
}

.task-progressive-details {
    border: 1px solid var(--line);
    border-radius: 16px;
    background: color-mix(in srgb, var(--surface) 92%, var(--canvas));
}

.task-progressive-details > summary {
    display: grid;
    min-height: 48px;
    padding: 0 13px;
    grid-template-columns: 20px minmax(0, 1fr) 18px;
    align-items: center;
    gap: 8px;
    color: var(--ink);
    border-radius: 16px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 850;
    list-style: none;
}

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

.task-progressive-details > summary > svg {
    width: 17px;
    height: 17px;
    color: var(--accent);
}

.task-progressive-details .task-details-chevron {
    color: var(--muted);
    transition: transform .18s ease;
}

.task-progressive-details[open] .task-details-chevron {
    transform: rotate(180deg);
}

.task-detail-fields {
    display: grid;
    padding: 0 12px 12px;
    gap: 10px;
}

.task-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.task-form-grid-three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.task-form-field {
    min-height: 58px;
}

.task-form-field input,
.task-form-field select {
    min-height: 28px;
    font-size: 12px;
    font-weight: 700;
}

.task-form-field small {
    color: var(--muted);
    font-size: 9px;
}

.task-description-field textarea {
    min-height: 100px;
    padding-top: 3px;
    resize: vertical;
    font-size: 12px;
    line-height: 1.5;
}

.task-save-action {
    width: 100%;
    min-height: 46px;
}

.task-subtasks-section {
    display: grid;
    margin-top: 20px;
    padding-top: 17px;
    gap: 10px;
    border-top: 1px solid var(--line);
}

.task-subtasks-section > header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.task-subtasks-section > header strong,
.task-subtasks-section > header small {
    display: block;
}

.task-subtasks-section > header strong {
    color: var(--ink);
    font-size: 13px;
    font-weight: 900;
}

.task-subtasks-section > header small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 10px;
}

.task-subtasks-section > header > span {
    display: grid;
    min-width: 25px;
    height: 25px;
    padding: 0 7px;
    place-items: center;
    color: var(--muted);
    border-radius: 999px;
    background: color-mix(in srgb, var(--ink) 7%, transparent);
    font-size: 10px;
    font-weight: 900;
}

.task-subtask-list {
    display: grid;
    gap: 6px;
}

.task-subtask-row {
    display: grid;
    min-height: 46px;
    padding: 0 12px 0 6px;
    grid-template-columns: 42px minmax(0, 1fr);
    align-items: center;
    gap: 7px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: color-mix(in srgb, var(--surface) 94%, var(--canvas));
}

.task-subtask-status {
    position: relative;
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
}

.task-subtask-status::before {
    width: 17px;
    height: 17px;
    border: 1.5px solid var(--muted);
    border-radius: 5px;
    content: "";
}

.task-subtask-status select {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
}

.task-subtask-title {
    min-width: 0;
    overflow: hidden;
    color: var(--ink);
    font-size: 12px;
    font-weight: 750;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.task-subtask-title.is-completed {
    color: var(--muted);
    text-decoration: line-through;
}

.task-subtask-add {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px;
    gap: 8px;
}

.task-subtask-add .pc-field {
    min-height: 44px;
    padding: 0 12px;
}

.task-subtask-add input {
    height: 42px;
    font-size: 12px;
}

.task-detail-delete {
    display: flex;
    margin-top: 18px;
    padding-top: 16px;
    justify-content: flex-end;
    border-top: 1px solid var(--line);
}

.task-project-create {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 150px auto;
    align-items: end;
    gap: 9px;
}

.task-project-create .pc-field {
    min-height: 58px;
    padding: 7px 11px;
    gap: 3px;
}

.task-project-create .pc-field > span {
    color: var(--muted);
    font-size: 9px;
    font-weight: 900;
    text-transform: uppercase;
}

.task-project-create input,
.task-project-create select {
    min-height: 28px;
    font-size: 12px;
    font-weight: 700;
}

.task-project-create .pc-action {
    min-height: 58px;
}

.task-project-list {
    display: grid;
    margin-top: 18px;
    padding-top: 15px;
    gap: 7px;
    border-top: 1px solid var(--line);
}

.task-project-row {
    display: grid;
    min-height: 58px;
    padding: 6px 7px 6px 11px;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    align-items: center;
    gap: 9px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: color-mix(in srgb, var(--surface) 94%, var(--canvas));
}

.task-project-row > .task-project-share-details {
    width: 100%;
    grid-column: 1 / -1;
}

.task-project-share-details > summary {
    grid-template-columns: 20px minmax(0, 1fr) auto 18px;
}

.task-project-share-details > summary > em {
    color: var(--muted);
    font-size: 10px;
    font-style: normal;
}

.task-project-row > span {
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    color: var(--task-color);
    border-radius: 10px;
    background: color-mix(in srgb, var(--task-color) 10%, var(--surface));
}

.task-project-row > span svg {
    width: 16px;
    height: 16px;
}

.task-project-row strong,
.task-project-row small {
    display: block;
}

.task-project-row strong {
    color: var(--ink);
    font-size: 12px;
    font-weight: 850;
}

.task-project-row small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 10px;
}

body.tasks-modal-open {
    overflow: hidden;
}

@media (max-width: 760px) {
    .tasks-content {
        min-height: calc(100dvh - 68px);
        padding: 18px 12px max(86px, calc(env(safe-area-inset-bottom) + 76px));
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tasks-page-heading {
        margin-bottom: 16px;
        align-items: center;
    }

    .tasks-page-heading h1 {
        font-size: 25px;
    }

    .tasks-page-heading > div:first-child > p:last-child {
        display: none;
    }

    .tasks-heading-actions {
        gap: 7px;
    }

    .tasks-add-action {
        width: 54px;
        min-width: 54px;
        height: 54px;
        padding: 0;
        border-radius: 16px;
    }

    .tasks-add-action span {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
    }

    .tasks-add-action svg {
        width: 20px;
        height: 20px;
    }

    .tasks-filter-form {
        grid-template-columns: minmax(0, 1fr);
    }

    .tasks-project-filter {
        min-width: 0;
        height: 46px;
        padding: 0 11px;
    }

    .tasks-project-filter select {
        min-width: 0;
        font-size: 12px;
    }

    .tasks-search-dock .tasks-search-field {
        height: 54px;
    }

    .tasks-search-field input {
        font-size: 16px;
    }

    .tasks-status-tabs {
        margin: 0 0 18px;
        padding: 0;
        flex-wrap: wrap;
        gap: 7px;
        overflow: visible;
    }

    .tasks-status-tabs .pc-chip {
        min-height: 40px;
        flex: 1 1 calc(50% - 4px);
        padding: 0 11px;
    }

    .tasks-groups {
        gap: 21px;
    }

    .task-card {
        min-height: 78px;
        grid-template-columns: 52px minmax(0, 1fr);
    }

    .task-card-main {
        min-height: 76px;
        padding: 10px 10px 10px 12px;
        grid-template-columns: minmax(0, 1fr) auto 14px;
        gap: 8px;
    }

    .task-card-copy > strong {
        font-size: 13px;
    }

    .task-card-copy > small {
        display: none;
    }

    .task-card-meta,
    .task-tag-row {
        gap: 5px;
    }

    .task-project-meta {
        max-width: 112px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .task-avatar.pc-avatar {
        width: 31px;
        height: 31px;
    }

    .tasks-empty-state {
        min-height: 260px;
        padding: 24px 18px;
    }

    .task-undo-panel {
        align-items: flex-start;
    }

    .task-detail-layer,
    .task-project-layer {
        align-items: end;
        padding: 8px;
    }

    .task-detail-panel,
    .task-project-panel {
        width: 100%;
        max-height: calc(var(--app-visual-viewport-height, 100dvh) - 12px);
        padding: 17px 14px max(17px, calc(env(safe-area-inset-bottom) + 12px));
        border-radius: 20px;
        overscroll-behavior: contain;
    }

    .task-detail-heading h2 {
        font-size: 20px;
    }

    .task-form-grid {
        grid-template-columns: 1fr;
        gap: 9px;
    }

    .task-form-field {
        min-height: 60px;
    }

    .task-project-create {
        grid-template-columns: 1fr 1fr;
    }

    .task-project-create .pc-action {
        min-height: 46px;
        grid-column: 1 / -1;
    }

    body.app-shell-keyboard-open .task-detail-layer,
    body.app-shell-keyboard-open .task-project-layer {
        top: var(--app-visual-viewport-top, 0px);
        bottom: auto;
        height: var(--app-visual-viewport-height, 100dvh);
    }
}

@media (max-width: 390px) {
    .tasks-project-filter {
        width: 100%;
    }

    .task-card-main {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .task-card-chevron {
        display: none;
    }
}
