.node {
    position: absolute;
    top: 0;
    left: 0;
    width: 232px;
    min-height: 120px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 14px;
    cursor: pointer;
    transition:
        border-color 0.15s,
        box-shadow 0.15s,
        opacity 0.3s;
    animation: nodeIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
    user-select: none;
    /* Critical for touch/stylus drag: disables browser default gestures
       (pan, pinch-zoom) on the node so pointer events flow uninterrupted. */
    touch-action: none;
    -ms-touch-action: none;
}
@keyframes nodeIn {
    from {
        opacity: 0;
        transform: scale(0.88);
    }
    to {
        opacity: 1;
    }
}
.node:hover {
    border-color: var(--border-strong);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}
.node.dragging {
    opacity: 0.85;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
    z-index: 50;
    cursor: grabbing;
    border-color: var(--border-vivid);
}
.node.selected {
    border-color: rgba(255, 107, 157, 0.5);
    box-shadow:
        0 0 0 2px rgba(255, 107, 157, 0.15),
        0 4px 24px rgba(0, 0, 0, 0.4);
}
.node.ghost {
    opacity: 0.4;
    pointer-events: none;
}
.node-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.node-status {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 10.5px;
    color: var(--fg-dim);
    font-weight: 500;
}
.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--fg-faint);
    flex-shrink: 0;
}
.status-dot.pending {
    background: var(--fg-faint);
}
.status-dot.active {
    background: var(--cyan);
    box-shadow: 0 0 6px rgba(94, 234, 212, 0.6);
    animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}
.status-dot.done {
    background: var(--green);
}
.status-dot.blocked {
    background: var(--amber);
}
.node-step {
    font-family: var(--font-mono);
    font-size: 9.5px;
    color: var(--fg-faint);
}
.node-title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--fg);
    margin: 0 0 5px;
    line-height: 1.35;
}
.node-desc {
    font-size: 11.5px;
    color: var(--fg-dim);
    margin: 0 0 10px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.node-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.node-date {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10.5px;
    color: var(--fg-faint);
    font-family: var(--font-mono);
}
.node-date svg {
    width: 10px;
    height: 10px;
    flex-shrink: 0;
}
.node-explore {
    background: none;
    border: none;
    color: var(--fg-dim);
    font-size: 10.5px;
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 2px 4px;
    border-radius: 4px;
    transition:
        color 0.15s,
        background 0.15s;
}
.node-explore:hover {
    color: var(--fg);
    background: var(--bg-hover);
}
.node-explore svg {
    width: 10px;
    height: 10px;
}
.node[data-category="research"] {
    --cat-color: var(--violet);
}
.node[data-category="build"] {
    --cat-color: var(--cyan);
}
.node[data-category="launch"] {
    --cat-color: var(--pink);
}
.node[data-category="learn"] {
    --cat-color: var(--amber);
}
.node[data-category="train"] {
    --cat-color: var(--green);
}
.node::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    background: var(--cat-color, var(--border-strong));
    opacity: 0.7;
}
.handle {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--bg-3);
    border: 1.5px solid var(--border-strong);
    opacity: 0;
    transition:
        opacity 0.15s,
        background 0.15s,
        transform 0.15s;
    cursor: crosshair;
    z-index: 10;
}
.node:hover .handle,
.linking-active .handle {
    opacity: 1;
}
.handle:hover,
.handle.hot {
    background: var(--pink);
    border-color: var(--pink);
    transform: scale(1.3);
}
.handle-n {
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
}
.handle-s {
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
}
.handle-w {
    left: -5px;
    top: 50%;
    transform: translateY(-50%);
}
.handle-e {
    right: -5px;
    top: 50%;
    transform: translateY(-50%);
}
.node.drop-target {
    border-color: var(--cyan);
    box-shadow: 0 0 0 2px rgba(94, 234, 212, 0.2);
}
.node-title-input {
    width: 100%;
    background: none;
    border: none;
    outline: none;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--fg);
    font-family: var(--font-sans);
    padding: 0;
    margin: 0 0 5px;
    line-height: 1.35;
}
.node-trash {
    position: absolute;
    top: -30px;
    right: -10px;
    width: 22px;
    height: 22px;
    background: none;
    border: none;
    color: var(--fg-faint);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition:
        opacity 0.15s,
        background 0.15s,
        color 0.15s;
}
.node-trash:hover {
    background: rgba(255, 107, 157, 0.12);
    color: var(--pink);
}
.node.selected .node-trash {
    opacity: 1;
}
.node-trash svg {
    width: 11px;
    height: 11px;
}

.project-node .node-trash svg {
    width: 12px;
    height: 12px;
}

/* Detail panel */
.detail-panel {
    position: fixed;
    right: 0;
    top: 52px;
    bottom: 0;
    width: 500px;
    background: var(--bg-1);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 299;
    transform: translateX(100%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}
.detail-panel.open {
    transform: translateX(0);
}
.detail-head {
    padding: 16px 16px 0;
    flex-shrink: 0;
}
.detail-eyebrow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.detail-cat {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--fg-faint);
    letter-spacing: 0.08em;
}
.detail-actions {
    display: flex;
    gap: 4px;
}
.detail-icon-btn {
    width: 28px;
    height: 28px;
    background: none;
    border: none;
    color: var(--fg-dim);
    border-radius: var(--r-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition:
        background 0.15s,
        color 0.15s;
}
.detail-icon-btn:hover {
    background: var(--bg-hover);
    color: var(--fg);
}
.detail-icon-btn svg {
    width: 12px;
    height: 12px;
}
.detail-body {
    flex: 1;
    overflow-y: auto;
    padding: 0 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.detail-section h4 {
    font-size: 10px;
    font-weight: 600;
    color: var(--fg-faint);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin: 0 0 8px;
}
.field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.field-label {
    font-size: 10.5px;
    font-weight: 500;
    color: var(--fg-dim);
}

.field-input::-webkit-calendar-picker-indicator {
    filter: invert(48%) sepia(13%) saturate(3207%) hue-rotate(275deg)
        brightness(95%) contrast(80%);
    cursor: pointer;
}

.field-input[type="date"] {
    color-scheme: dark;
}

.field-input,
.field-textarea,
.field-select {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    color: var(--fg);
    font-size: 13px;
    padding: 8px 10px;
    outline: none;
    transition: border-color 0.15s;
    width: 100%;
}
.field-input:focus,
.field-textarea:focus,
.field-select:focus {
    border-color: var(--border-vivid);
    background: var(--bg-hover);
}
.field-textarea {
    resize: vertical;
    min-height: 72px;
    line-height: 1.5;
}
.field-select {
    appearance: none;
    cursor: pointer;
}
.field-row {
    display: flex;
    gap: 8px;
}
.field-row .field {
    flex: 1;
}
.field-input.title-input {
    font-size: 15px;
    font-weight: 600;
}
.resource-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.resource {
    display: flex;
    align-items: center;
    padding: 7px 10px;
    border-radius: var(--r-sm);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    font-size: 12px;
    color: var(--fg-muted);
    transition: background 0.15s;
    min-height: 36px;
    position: relative;
    gap: 8px;
}
.resource:hover {
    background: var(--bg-hover);
}
.resource-icon {
    width: 24px;
    height: 24px;
    border-radius: 5px;
    background: var(--bg-3);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.resource-icon svg {
    width: 11px;
    height: 11px;
    color: var(--fg-dim);
}
.resource-meta {
    font-family: var(--font-mono);
    font-size: 10px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin: 0 8px;
}

.resource-empty {
    font-size: 11.5px;
    color: var(--fg-faint);
    padding: 8px 0;
    font-style: italic;
}

/* Resource text with ellipsis */
.resource-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin: 0 8px;
}

/* Resource buttons */
.resource-delete-btn,
.resource-link-btn {
    width: 22px;
    height: 22px;
    background: none;
    border: none;
    color: var(--fg-faint);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: 1;
    transition:
        background 0.15s,
        color 0.15s;
    cursor: pointer;
    padding: 0;
    position: relative;
    z-index: 1;
}

/* Resource buttons always visible, better contrast on hover */
.resource-delete-btn:hover,
.resource-link-btn:hover {
    opacity: 1;
}

/* Ensure buttons container doesn't get pushed away */
.resource-buttons {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
    margin-left: auto;
}

.resource-delete-btn:hover {
    background: rgba(255, 107, 157, 0.12);
    color: var(--pink);
}

/* Resource buttons container */
.resource-buttons {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.resource-link-btn:hover {
    background: rgba(94, 234, 212, 0.12);
    color: var(--cyan);
}

.resource-delete-btn svg,
.resource-link-btn svg {
    width: 11px;
    height: 11px;
}

/* Resource add form */
.resource-add-form {
    margin-top: 0;
    padding-top: 0;
}

.resource-add-btn {
    width: 100%;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--fg-muted);
    border-radius: var(--r-sm);
    font-size: 11.5px;
    font-weight: 500;
    padding: 8px 12px;
    cursor: pointer;
    transition:
        background 0.15s,
        border-color 0.15s,
        color 0.15s;
}

.resource-add-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-strong);
    color: var(--fg);
}

.resource-url-input {
    margin-top: 5px;
}

.resource-add-btn {
    margin-top: 5px;
    text-align: left;
}

/* Adjust resource meta to not push buttons - already defined above */
.reexplore {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}
.reexplore-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--fg-muted);
    border-radius: var(--r-md);
    font-size: 12.5px;
    font-weight: 500;
    padding: 10px;
    transition:
        background 0.15s,
        border-color 0.15s,
        color 0.15s;
}
.reexplore-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-strong);
    color: var(--fg);
}
.reexplore-btn svg {
    width: 13px;
    height: 13px;
}

/* ── Project node (home overview) ── */
.project-node {
    cursor: pointer;
    min-height: 140px;
    width: 260px;
    /* leave room at bottom for progress bar */
    padding-bottom: 18px;
}
.project-node::before {
    background: var(--cat-color, var(--pink));
    opacity: 1;
    height: 3px;
}
.project-node:hover {
    border-color: var(--cat-color, var(--border-strong));
    box-shadow:
        0 4px 32px rgba(0, 0, 0, 0.5),
        0 0 0 1px var(--cat-color, transparent);
}

/* Trash button hidden by default, shown on hover */
.project-node .node-edit {
    position: absolute;
    top: -30px;
    right: 24px;
    width: 26px;
    height: 26px;
    background: var(--bg-1);
    border: 1px solid var(--border-strong);
    color: var(--fg-faint);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    transition:
        opacity 0.15s,
        background 0.15s,
        color 0.15s,
        transform 0.15s;
}

.project-node .node-trash {
    position: absolute;
    top: -30px;
    right: -10px;
    width: 26px;
    height: 26px;
    background: var(--bg-1);
    border: 1px solid var(--border-strong);
    color: var(--fg-faint);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    transition:
        opacity 0.15s,
        background 0.15s,
        color 0.15s,
        transform 0.15s;
}
.project-node:hover .node-edit,
.project-node:hover .node-trash {
    opacity: 1;
}

.project-node .node-edit:hover {
    background: rgba(94, 234, 212, 0.12);
    border-color: var(--cyan);
    color: var(--cyan);
    transform: scale(1.1);
}

.project-node .node-trash:hover {
    background: rgba(255, 107, 157, 0.12);
    border-color: var(--pink);
    color: var(--pink);
    transform: scale(1.1);
}

/* Handles: hidden by default, shown on hover or while linking */
.project-node .handle {
    opacity: 0;
}
.project-node:hover .handle,
.linking-active .project-node .handle {
    opacity: 1;
}

/* Drop target highlight when dragging a link onto a project node */
.project-node.drop-target {
    border-color: var(--cyan);
    box-shadow: 0 0 0 2px rgba(94, 234, 212, 0.25);
}

.project-node .node-date {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10.5px;
    color: var(--fg-faint);
    font-family: var(--font-mono);
}
.project-node .node-date svg {
    width: 10px;
    height: 10px;
    flex-shrink: 0;
}

/* Progress bar at the very bottom of the card */
.project-node-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--border);
    border-radius: 0 0 var(--r-lg) var(--r-lg);
    overflow: hidden;
}
.project-node-progress-bar {
    height: 100%;
    border-radius: 0 0 var(--r-lg) var(--r-lg);
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* "Créer vide" / manual creation button in modal footer */
#npCreateManual {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* ─── EDITABLE FIELDS (JIRA-like, inline edit) ──────────────────────── */
/*
 * The JS lazy-mounts the edit view on click, so we don't need to hide it
 * with display:none. In read mode the .jira-field contains only the
 * .jira-readview. In edit mode it contains only the .jira-editview.
 */

.editable-field {
    margin-bottom: 16px;
}

.btn-small {
    padding: 4px 10px;
    font-size: 11px;
    height: 26px;
}

.btn-text {
    background: transparent;
    border-color: transparent;
    color: var(--fg-muted);
    padding: 6px 10px;
}

.btn-text:hover:not(:disabled) {
    background: var(--bg-hover);
    border-color: transparent;
    color: var(--fg);
}

/* ─── JIRA-LIKE FIELD: shell ────────────────────────────────────────── */
.jira-field {
    position: relative;
    margin-bottom: 4px;
}

/* ─── READ MODE: static value with hover affordance ─────────────────── */
.jira-readview {
    display: block;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-radius: var(--r-sm);
    color: var(--fg);
    font-size: 13px;
    line-height: 1.5;
    cursor: text;
    transition:
        background 0.15s,
        border-color 0.15s;
    outline: none;
    word-break: break-word;
}

.jira-readview.is-multiline {
    min-height: 80px;
    white-space: pre-wrap;
}

.jira-readview.is-empty {
    color: var(--fg-faint);
    font-style: italic;
}

.jira-readview:hover,
.jira-readview:focus-visible {
    background: var(--bg-hover);
    border-color: var(--border-strong);
}

/* Title-style read view: bigger and bolder */
.jira-field[data-field="title"] .jira-readview,
.jira-field[data-field="name"] .jira-readview {
    font-size: 15px;
    font-weight: 600;
}

/* ─── EDIT MODE: input/textarea with focus ring ─────────────────────── */
.jira-editview {
    display: block;
}

.jira-editview .field-input,
.jira-editview .field-textarea,
.jira-editview .field-select {
    background: var(--bg-2);
    border: 1px solid var(--pink);
    box-shadow: 0 0 0 1px var(--pink);
    outline: none;
}

.jira-editview .field-input.title-input {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
}

/* Action row below the input/textarea */
.jira-actions {
    display: flex;
    margin-top: 6px;
    align-items: center;
    gap: 4px;
}

/* ─── Title icon-button row: ✓ ✕ right-aligned ──────────────────────── */
.jira-actions-icons {
    justify-content: flex-end;
}

.jira-actions-right {
    display: flex;
    align-items: center;
    gap: 4px;
}

.jira-icon-btn {
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: var(--r-sm);
    border: 1px solid var(--border-strong);
    background: var(--bg-elevated);
    color: var(--fg-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition:
        background 0.15s,
        color 0.15s,
        border-color 0.15s,
        transform 0.08s;
}

.jira-icon-btn:hover {
    background: var(--bg-hover);
    color: var(--fg);
    border-color: var(--border-vivid);
}

.jira-icon-btn:active {
    transform: scale(0.95);
}

.jira-icon-btn.jira-confirm:hover {
    background: var(--pink);
    color: #fff;
    border-color: var(--pink);
}

.jira-icon-btn svg {
    width: 12px;
    height: 12px;
}

/* ─── Description: wrapper with toolbar + textarea ──────────────────── */
.jira-textarea-wrap {
    border: 1px solid var(--pink);
    border-radius: var(--r-sm);
    background: var(--bg-2);
    box-shadow: 0 0 0 1px var(--pink);
    overflow: hidden;
}

.jira-toolbar {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 6px 8px;
    border-bottom: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.25);
    overflow-x: auto;
    scrollbar-width: none;
}

.jira-toolbar::-webkit-scrollbar {
    display: none;
}

.jira-tb-btn {
    height: 26px;
    min-width: 26px;
    padding: 0 8px;
    border-radius: 4px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--fg-muted);
    font-size: 11.5px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
    transition:
        background 0.12s,
        color 0.12s,
        border-color 0.12s;
    flex-shrink: 0;
}

.jira-tb-btn:hover:not(:disabled) {
    background: var(--bg-hover);
    color: var(--pink);
}

.jira-tb-btn svg {
    width: 12px;
    height: 12px;
}

/* Textarea inside the wrap: borderless since wrap handles the frame */
.jira-textarea-wrap .field-textarea {
    border: 0 !important;
    background: transparent !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    min-height: 80px;
    padding: 10px 12px;
    width: 100%;
    color: var(--fg);
    resize: vertical;
}

.jira-textarea-wrap .field-textarea:focus {
    outline: none;
}

/* Text-button row, left-aligned */
.jira-actions-text {
    justify-content: flex-start;
    margin-top: 8px;
    gap: 6px;
}

/* ─── Project edit drawer specific tweaks ───────────────────────────── */
#projectEditBody .jira-readview {
    padding: 6px 10px;
}

/* No-provider hint inside new-project modal */
#npNoProviderHint {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

/* ─── DROPDOWN WIDGET ───────────────────────────────────────────────── */
.dd-wrapper {
    position: relative;
    display: block;
    width: 100%;
}

.dd-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    height: 34px;
    padding: 0 10px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    color: var(--fg);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition:
        background 0.15s,
        border-color 0.15s,
        box-shadow 0.15s;
    text-align: left;
}

.dd-trigger:hover {
    background: var(--bg-hover);
    border-color: var(--border-strong);
}

.dd-trigger:focus-visible {
    outline: none;
    border-color: var(--pink);
    box-shadow: 0 0 0 1px var(--pink);
}

.dd-trigger.is-open {
    border-color: var(--pink);
    box-shadow: 0 0 0 1px var(--pink);
    background: var(--bg-2);
}

.dd-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--fg-faint);
    flex-shrink: 0;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.04);
}

.dd-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dd-label.is-placeholder {
    color: var(--fg-faint);
}

.dd-chevron {
    display: inline-flex;
    color: var(--fg-dim);
    transition: transform 0.15s;
    flex-shrink: 0;
}

.dd-chevron svg {
    width: 12px;
    height: 12px;
}

.dd-trigger.is-open .dd-chevron {
    transform: rotate(180deg);
    color: var(--pink);
}

/* ─── Popover ───────────────────────────────────────────────────────── */
.dd-popover {
    position: fixed;
    z-index: 9999;
    background: var(--bg-2);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
    padding: 4px;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.5),
        0 2px 8px rgba(0, 0, 0, 0.3);
    min-width: 180px;
    max-height: 280px;
    overflow-y: auto;
    opacity: 0;
    transform: translateY(-4px);
    transition:
        opacity 0.12s,
        transform 0.12s;
    scrollbar-width: thin;
}

.dd-popover.is-open {
    opacity: 1;
    transform: translateY(0);
}

.dd-popover::-webkit-scrollbar {
    width: 6px;
}
.dd-popover::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 3px;
}

.dd-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 7px 8px;
    background: transparent;
    border: none;
    border-radius: var(--r-sm);
    color: var(--fg-muted);
    font-size: 13px;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition:
        background 0.1s,
        color 0.1s;
}

.dd-item:hover,
.dd-item.is-highlighted {
    background: var(--bg-hover);
    color: var(--fg);
}

.dd-item.is-selected {
    color: var(--fg);
    background: var(--bg-active);
}

.dd-item-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--fg-faint);
    flex-shrink: 0;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.04);
}

.dd-item-label {
    flex: 1;
    white-space: nowrap;
}

.dd-item-check {
    display: inline-flex;
    color: var(--pink);
    opacity: 0;
    flex-shrink: 0;
    transition: opacity 0.1s;
}

.dd-item-check svg {
    width: 12px;
    height: 12px;
}

.dd-item.is-selected .dd-item-check {
    opacity: 1;
}

/* ─── SUBTASKS PANEL ────────────────────────────────────────────────── */
.subtasks-panel {
    margin-top: 16px;
    border-top: 1px solid var(--border);
    padding-top: 12px;
}

.subtasks-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.subtasks-panel-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 10px;
    font-weight: 600;
    color: var(--fg-faint);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.subtasks-counter {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--fg-muted);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    padding: 1px 6px;
    border-radius: 8px;
    letter-spacing: 0.04em;
    text-transform: none;
}

.subtasks-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: 1px solid var(--border);
    color: var(--fg-dim);
    font-size: 10.5px;
    padding: 3px 8px;
    border-radius: var(--r-sm);
    cursor: pointer;
    transition:
        background 0.15s,
        color 0.15s,
        border-color 0.15s;
}

.subtasks-add-btn:hover {
    background: var(--bg-hover);
    color: var(--fg);
    border-color: var(--border-strong);
}

.subtasks-add-btn svg {
    width: 10px;
    height: 10px;
}

.subtasks-empty {
    font-size: 11.5px;
    color: var(--fg-faint);
    font-style: italic;
    padding: 8px 0;
    text-align: center;
}

.subtasks-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.subtask-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 10px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    transition: border-color 0.15s;
}

.subtask-item:hover {
    border-color: var(--border-strong);
}

.subtask-item:hover .subtask-delete {
    opacity: 1;
}

.subtask-item.is-done .subtask-title,
.subtask-item.is-done .subtask-desc {
    color: var(--fg-faint);
    text-decoration: line-through;
}

.subtask-checkbox {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin-top: 1px;
    border-radius: 4px;
    border: 1.5px solid var(--border-strong);
    background: transparent;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition:
        background 0.12s,
        border-color 0.12s,
        transform 0.08s;
}

.subtask-checkbox:hover {
    border-color: var(--pink);
}

.subtask-checkbox:active {
    transform: scale(0.92);
}

.subtask-item.is-done .subtask-checkbox {
    background: var(--green);
    border-color: var(--green);
}

.subtask-checkbox svg {
    width: 11px;
    height: 11px;
}

.subtask-body {
    flex: 1;
    min-width: 0;
}

.subtask-title {
    font-size: 13px;
    color: var(--fg);
    line-height: 1.4;
    cursor: text;
    border-radius: 3px;
    padding: 1px 4px;
    margin: -1px -4px;
    word-break: break-word;
    transition: background 0.12s;
}

.subtask-title:hover {
    background: var(--bg-hover);
}

.subtask-title-input {
    width: 100%;
    font-size: 13px;
    background: var(--bg-2);
    border: 1px solid var(--pink);
    box-shadow: 0 0 0 1px var(--pink);
    color: var(--fg);
    padding: 1px 4px;
    margin: -1px -4px;
    border-radius: 3px;
    font-family: inherit;
    outline: none;
}

.subtask-desc {
    font-size: 11.5px;
    color: var(--fg-dim);
    line-height: 1.4;
    margin-top: 2px;
}

.subtask-days {
    flex-shrink: 0;
    font-family: var(--font-mono);
    font-size: 10.5px;
    color: var(--fg-faint);
    background: var(--bg-1);
    padding: 2px 6px;
    border-radius: 8px;
    margin-top: 1px;
    letter-spacing: 0.02em;
}

.subtask-delete {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    background: none;
    border: none;
    color: var(--fg-faint);
    border-radius: var(--r-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition:
        opacity 0.15s,
        background 0.12s,
        color 0.12s;
}

.subtask-delete:hover {
    background: rgba(255, 107, 157, 0.12);
    color: var(--pink);
}

.subtask-delete svg {
    width: 10px;
    height: 10px;
}

/* ─── "MARK TASK AS DONE" BUTTON ────────────────────────────────────── */
.task-done-row {
    margin-top: 16px;
}

.task-done-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--fg);
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    border-radius: var(--r-sm);
    cursor: pointer;
    transition:
        background 0.15s,
        border-color 0.15s,
        color 0.15s;
}

.task-done-btn:hover {
    background: rgba(34, 197, 94, 0.08);
    border-color: var(--green);
    color: var(--green);
}

.task-done-btn .task-done-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    color: var(--fg-faint);
    transition: color 0.15s;
}

.task-done-btn:hover .task-done-check {
    color: var(--green);
}

.task-done-btn.is-done {
    background: rgba(34, 197, 94, 0.1);
    border-color: var(--green);
    color: var(--green);
}

.task-done-btn.is-done .task-done-check {
    color: var(--green);
}

.task-done-btn.is-done:hover {
    background: rgba(255, 107, 157, 0.08);
    border-color: var(--pink);
    color: var(--pink);
}

.task-done-btn.is-done:hover .task-done-check {
    color: var(--pink);
}
