/* ══════════════════════════════════════
   PHASE 13 — CHECKLIST
══════════════════════════════════════ */
.checklist-progress {
    background: #fff;
    border-radius: var(--radius);
    padding: 10px 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(44, 32, 22, 0.05);
    margin-bottom: 20px;
}
.checklist-progress-info {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 10px;
}
.checklist-progress-text {
    font-family: "Cormorant Garamond", serif;
    font-size: 1rem;
    color: var(--txt-m);
    font-weight: 400;
}
.checklist-progress-pct {
    font-family: "Cormorant Garamond", serif;
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--sage-d);
}
.checklist-progress-bar {
    height: 8px;
    background: var(--cream-d);
    border-radius: 4px;
    overflow: hidden;
}
.checklist-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--sage) 0%, var(--sage-d) 100%);
    border-radius: 4px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Category breakdown chips */
.checklist-categories {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
}
.checklist-categories::-webkit-scrollbar {
    display: none;
}
.checklist-cat-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.68rem;
    background: #fff;
    border: 1px solid rgba(44, 32, 22, 0.08);
    color: var(--txt-m);
    letter-spacing: 0.3px;
    font-weight: 400;
    white-space: nowrap;
    flex-shrink: 0;
}
.checklist-cat-chip .cat-count {
    font-weight: 500;
    color: var(--sage-d);
    background: var(--sage-bg);
    padding: 1px 7px;
    border-radius: 10px;
    font-size: 0.62rem;
}
.checklist-cat-chip .cat-done {
    font-weight: 500;
    color: var(--txt-xl);
    font-size: 0.6rem;
}

/* Checklist filters */
.checklist-filters {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.checklist-filters select {
    padding: 8px 14px;
    border: 1px solid rgba(44, 32, 22, 0.1);
    border-radius: var(--radius);
    font-family: "Jost", sans-serif;
    font-size: 0.74rem;
    background: #fff;
    color: var(--txt-m);
}

/* Checklist toolbar (search + sort) */
.checklist-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.checklist-search-wrap {
    position: relative;
    flex: 1;
    min-width: 180px;
}
.checklist-search-wrap svg {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--txt-l);
}
#checklist-search {
    width: 100%;
    padding: 8px 12px 8px 34px;
    border: 1px solid rgba(44, 32, 22, 0.1);
    border-radius: var(--radius);
    font-family: "Jost", sans-serif;
    font-size: 0.74rem;
    background: #fff;
    color: var(--txt);
}
#checklist-search:focus {
    outline: none;
    border-color: var(--sage);
    box-shadow: 0 0 0 3px var(--sage-bg);
}
.checklist-sort-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}
.checklist-sort-label {
    font-size: 0.68rem;
    color: var(--txt-l);
    letter-spacing: 0.3px;
}
#checklist-sort {
    padding: 8px 12px;
    border: 1px solid rgba(44, 32, 22, 0.1);
    border-radius: var(--radius);
    font-family: "Jost", sans-serif;
    font-size: 0.74rem;
    background: #fff;
    color: var(--txt-m);
}

/* Checklist items */
.checklist-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.checklist-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: #fff;
    border-radius: var(--radius);
    border: 1px solid rgba(44, 32, 22, 0.05);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    cursor: default;
    border-left: 3px solid #c8c2bb; /* gray = to-do default */
}
.checklist-item:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}
.checklist-item.completed {
    opacity: 0.55;
    border-left-color: #27ae60;
}
.checklist-item.completed .cl-title {
    text-decoration: line-through;
    color: var(--txt-l);
}
.checklist-item.overdue,
.checklist-item.cl-urgent {
    border-left-color: var(--terra);
}
.checklist-item.overdue .cl-due {
    color: var(--terra);
    font-weight: 500;
}
.checklist-item.cl-drag-over {
    border-color: var(--sage);
    background: var(--sage-bg);
}
.checklist-item.cl-dragging {
    opacity: 0.4;
}

/* Drag handle — always visible, 6-dot SVG */
.cl-drag-handle {
    cursor: grab;
    color: var(--txt-xl);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 28px;
    border-radius: 4px;
    user-select: none;
    touch-action: none;
    transition:
        color 0.15s,
        background 0.15s;
}
.cl-drag-handle:hover {
    color: var(--txt-m);
    background: var(--cream-d);
}
.cl-drag-handle:active {
    cursor: grabbing;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.cl-checkbox {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--cream-dd);
    background: transparent;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}
.cl-checkbox:hover {
    border-color: var(--sage);
}
.cl-checkbox.checked {
    background: var(--sage);
    border-color: var(--sage);
}
.cl-checkbox.checked::after {
    content: "";
    width: 6px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-top: -2px;
}
.cl-content {
    flex: 1;
    min-width: 0;
}
.cl-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    flex-wrap: wrap;
}
.cl-title {
    font-size: 0.82rem;
    color: var(--txt);
    font-weight: 400;
}
.cl-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.66rem;
    color: var(--txt-l);
    flex-wrap: wrap;
}
.cl-cat-badge {
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--cream-d);
    font-size: 0.6rem;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    font-weight: 500;
}
.cl-due {
    font-size: 0.66rem;
}
.cl-notes-preview {
    color: var(--txt-l);
    font-size: 0.64rem;
    font-style: italic;
}

/* Priority badges */
.cl-priority-badge {
    font-size: 0.58rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 10px;
}
.cl-priority-badge.high {
    background: #fdecea;
    color: #c0392b;
}
.cl-priority-badge.medium {
    background: #fef3e2;
    color: #b7770d;
}
.cl-priority-badge.low {
    background: #e8f5e9;
    color: #27ae60;
}

/* Days remaining chips */
.cl-days-chip {
    font-size: 0.6rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
}
.cl-days-chip.overdue {
    background: #fdecea;
    color: #c0392b;
}
.cl-days-chip.today {
    background: #fef3e2;
    color: #b7770d;
}
.cl-days-chip.urgent {
    background: #fef3e2;
    color: #e67e22;
}
.cl-days-chip.soon {
    background: #e8f5e9;
    color: #27ae60;
}

/* Checklist kebab (reuse .budget-kebab-menu portal styles) */
#checklist-kebab-menu {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.14);
    border: 1px solid rgba(44, 32, 22, 0.07);
    min-width: 180px;
    overflow: hidden;
}
#checklist-kebab-menu button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 16px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-family: "Jost", sans-serif;
    font-size: 0.78rem;
    color: var(--txt-m);
    text-align: left;
    transition: background 0.15s;
}
#checklist-kebab-menu button:hover {
    background: var(--cream-d);
}
#checklist-kebab-menu button.danger {
    color: var(--red);
}
#checklist-kebab-menu button.danger:hover {
    background: var(--red-bg);
}

.cl-actions {
    display: flex;
    gap: 4px;
}

/* Touch drag target highlight */
.checklist-item.cl-touch-target {
    border-color: var(--sage) !important;
    background: var(--sage-bg) !important;
    box-shadow: 0 0 0 2px var(--sage) !important;
}

/* ── View toggle ── */
.cl-view-toggle {
    display: flex;
    gap: 2px;
    background: var(--cream-d);
    border-radius: var(--radius);
    padding: 3px;
    flex-shrink: 0;
}
.cl-view-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: calc(var(--radius) - 2px);
    color: var(--txt-l);
    display: flex;
    align-items: center;
    gap: 5px;
    font-family: "Jost", sans-serif;
    font-size: 0.72rem;
    transition: var(--transition);
}
.cl-view-btn.active {
    background: #fff;
    color: var(--txt);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}
.cl-view-btn:hover:not(.active) {
    color: var(--txt-m);
}
@media (max-width: 480px) {
    .cl-view-btn {
        flex-direction: column;
        align-items: center;
        gap: 2px;
        padding: 6px 10px;
    }
    .cl-view-label {
        display: block;
        font-size: 0.5rem;
        line-height: 1.1;
    }
}

/* ── Grouped view ── */
.cl-group {
    background: #fff;
    border-radius: var(--radius);
    border: 1px solid rgba(44, 32, 22, 0.06);
    box-shadow: var(--shadow-sm);
    margin-bottom: 10px;
    overflow: hidden;
}
.cl-group-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 16px;
    cursor: pointer;
    transition: background 0.15s;
    border-left: 3px solid var(--sage);
    user-select: none;
}
.cl-group-header:hover {
    background: var(--cream);
}
.cl-group-name {
    font-family: "Cormorant Garamond", serif;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--txt);
    min-width: 90px;
}
.cl-group-bar-wrap {
    flex: 1;
    min-width: 50px;
}
.cl-group-bar {
    height: 4px;
    background: var(--cream-d);
    border-radius: 2px;
    overflow: hidden;
}
.cl-group-bar-fill {
    height: 100%;
    background: var(--sage);
    border-radius: 2px;
    transition: width 0.4s;
}
.cl-group-count {
    font-size: 0.68rem;
    color: var(--sage-d);
    font-weight: 600;
    white-space: nowrap;
    background: var(--sage-bg);
    padding: 2px 8px;
    border-radius: 10px;
}
.cl-group-chevron {
    transition: transform 0.2s;
    color: var(--txt-l);
    flex-shrink: 0;
}
.cl-group-chevron.collapsed {
    transform: rotate(-90deg);
}
.cl-group-body {
    border-top: 1px solid rgba(44, 32, 22, 0.04);
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.cl-group-body.collapsed {
    display: none;
}
.cl-group .checklist-item {
    box-shadow: none;
    border: 1px solid rgba(44, 32, 22, 0.05);
    border-left: 3px solid #c8c2bb; /* gray default — shorthand resets it so we re-state explicitly */
}
.cl-group .checklist-item.overdue,
.cl-group .checklist-item.cl-urgent {
    border-left-color: var(--terra);
}
.cl-group .checklist-item.completed {
    border-left-color: #27ae60;
}
.cl-group .checklist-item:hover {
    box-shadow: var(--shadow-sm);
}

/* ── Kanban view — equal-height columns, each independently scrollable ── */
.cl-kanban {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    align-items: stretch;
    height: calc(100vh - 390px);
    min-height: 360px;
}
.cl-kanban-col {
    background: var(--cream);
    border-radius: var(--radius);
    border: 1px solid rgba(44, 32, 22, 0.07);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: background 0.15s;
}
.cl-kanban-col.cl-drag-over {
    background: rgba(143, 168, 135, 0.12);
    border-color: var(--sage);
}
.cl-kanban-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(44, 32, 22, 0.07);
}
/* Dots match the column border colours */
.cl-kanban-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.cl-kanban-dot.todo {
    background: #c8c2bb;
}
.cl-kanban-dot.urgent {
    background: var(--terra);
}
.cl-kanban-dot.done {
    background: #27ae60;
}

/* Mobile-only tab bar */
.cl-kanban-tab-bar {
    display: none;
}
.cl-kanban-label {
    flex: 1;
    font-size: 0.68rem;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--txt-m);
}
.cl-kanban-count {
    background: rgba(44, 32, 22, 0.08);
    color: var(--txt-m);
    font-size: 0.64rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
}
.cl-kanban-cards {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    scrollbar-width: thin;
    scrollbar-color: var(--cream-dd) transparent;
}
.cl-kanban-cards::-webkit-scrollbar {
    width: 4px;
}
.cl-kanban-cards::-webkit-scrollbar-thumb {
    background: var(--cream-dd);
    border-radius: 2px;
}
.cl-kanban-empty {
    text-align: center;
    padding: 24px 10px;
    color: var(--txt-xl);
    font-size: 0.72rem;
    font-style: italic;
}
.cl-kanban-card {
    background: #fff;
    border-radius: calc(var(--radius) - 2px);
    padding: 12px 12px 10px;
    border-left: 3px solid var(--cream-dd);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    cursor: grab;
    transition: var(--transition);
}
.cl-kanban-card:hover {
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}
.cl-kanban-card.completed {
    opacity: 0.5;
}
.cl-kanban-card.cl-dragging {
    opacity: 0.3;
    cursor: grabbing;
}
/* Kanban borders driven by column (status), not priority */
.cl-kanban-card.priority-high,
.cl-kanban-card.priority-medium,
.cl-kanban-card.priority-low {
    border-left-color: #c8c2bb;
}
.cl-kanban-urgent .cl-kanban-card {
    border-left-color: var(--terra) !important;
}
.cl-kanban-done .cl-kanban-card {
    border-left-color: #27ae60 !important;
}
.cl-kanban-card-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}
.cl-kanban-kebab {
    margin-left: auto;
    flex-shrink: 0;
}
.cl-kanban-title {
    font-size: 0.79rem;
    color: var(--txt);
    font-weight: 500;
    margin-bottom: 8px;
    line-height: 1.35;
}
.cl-kanban-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

/* ── Checklist mobile responsive ── */
@media (max-width: 768px) {
    /* Toolbar */
    .checklist-toolbar {
        flex-wrap: wrap;
        gap: 10px;
    }
    .checklist-search-wrap {
        min-width: 0;
        flex: 1 1 140px;
    }
    .checklist-sort-wrap {
        flex-wrap: wrap;
    }

    /* List view: kebab pinned right */
    .checklist-item {
        padding: 12px 42px 12px 10px;
        position: relative;
    }
    .checklist-item .cl-actions {
        position: absolute;
        top: 50%;
        right: 10px;
        transform: translateY(-50%);
    }

    /* Drag handle — visible on mobile, generous tap target */
    .cl-drag-handle {
        display: flex;
        width: 28px;
        height: 36px;
        color: var(--txt-m);
        opacity: 0.6;
    }
    .cl-drag-handle:active {
        opacity: 1;
        background: var(--cream-d);
    }

    /* Grouped view */
    .cl-group-name {
        min-width: 70px;
        font-size: 0.85rem;
    }
    .cl-group-bar-wrap {
        display: none;
    }

    /* ── Trello-style mobile kanban ── */
    .cl-kanban-tab-bar {
        display: flex;
        border-bottom: 2px solid var(--cream-d);
        margin-bottom: 12px;
        background: #fff;
        border-radius: var(--radius) var(--radius) 0 0;
        overflow: hidden;
    }
    .cl-kanban-tab {
        flex: 1;
        padding: 11px 6px;
        border: none;
        background: transparent;
        font-family: "Jost", sans-serif;
        font-size: 0.7rem;
        font-weight: 600;
        color: var(--txt-l);
        letter-spacing: 0.3px;
        cursor: pointer;
        border-bottom: 2px solid transparent;
        margin-bottom: -2px;
        transition:
            color 0.15s,
            border-color 0.15s;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 5px;
        white-space: nowrap;
    }
    .cl-kanban-tab.active {
        color: var(--txt);
        border-bottom-color: var(--terra);
    }
    .cl-kanban-tab-dot {
        width: 7px;
        height: 7px;
        border-radius: 50%;
        flex-shrink: 0;
    }
    .cl-kanban-tab-dot.todo {
        background: #c8c2bb;
    }
    .cl-kanban-tab-dot.urgent {
        background: var(--terra);
    }
    .cl-kanban-tab-dot.done {
        background: #27ae60;
    }
    .cl-kanban-tab-count {
        background: rgba(44, 32, 22, 0.08);
        padding: 1px 6px;
        border-radius: 10px;
        font-size: 0.62rem;
    }
    .cl-kanban-tab.active .cl-kanban-tab-count {
        background: var(--terra);
        color: #fff;
    }

    /* Horizontal scroll-snap board */
    .cl-kanban {
        display: flex !important;
        flex-direction: row !important;
        width: 100% !important;
        overflow-x: scroll;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-x;
        overscroll-behavior-x: contain;
        height: auto !important;
        min-height: 0 !important;
        gap: 0 !important;
        border-radius: 0 !important;
        scrollbar-width: none;
    }
    .cl-kanban::-webkit-scrollbar {
        display: none;
    }
    .cl-kanban-col {
        flex: 0 0 100% !important;
        min-width: 100% !important;
        scroll-snap-align: start;
        border-radius: 0 !important;
        border-left: none !important;
        border-right: none !important;
        border-top: none !important;
        height: auto !important;
    }
    /* Show column header inside each panel (acts as section title while swiping) */
    .cl-kanban-header {
        position: sticky;
        top: 0;
        z-index: 2;
        background: var(--cream);
    }
    .cl-kanban-cards {
        max-height: 65vh !important;
        overflow-y: auto;
        flex: unset !important;
    }
}

@media (max-width: 480px) {
    .checklist-filters {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
    }
    .checklist-filters select {
        flex-shrink: 0;
    }
    .cl-kanban-cards {
        max-height: 58vh !important;
    }
}

/* Budget target */
.budget-target-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    padding: 12px 18px;
    background: #fff;
    border-radius: var(--radius);
    border: 1px solid rgba(44, 32, 22, 0.05);
    box-shadow: var(--shadow-sm);
}
.budget-target-wrap label {
    font-size: 0.64rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--txt-l);
    font-weight: 400;
    white-space: nowrap;
}
.budget-target-input-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}
.budget-target-input-wrap input {
    width: 120px;
    padding: 6px 10px;
    border: 1px solid rgba(44, 32, 22, 0.1);
    border-radius: var(--radius);
    font-family: "Cormorant Garamond", serif;
    font-size: 1rem;
    font-weight: 500;
    text-align: right;
}
.budget-target-currency {
    font-family: "Cormorant Garamond", serif;
    font-size: 1rem;
    color: var(--txt-l);
}
.budget-target-hint {
    font-family: "Jost", sans-serif;
    font-size: 0.6rem;
    color: var(--txt-l);
    font-weight: 300;
    display: block;
    margin-top: 2px;
}
.budget-card-amount.over .budget-target-hint,
.budget-card-estimated .budget-card-amount.over {
    color: var(--terra);
}

