/* ============================================================
   Task Detail Panel — shared across pages
   Relies on the design tokens defined in each page's :root.
   ============================================================ */

.task-panel-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
}

.task-panel-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.task-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 860px;
    max-width: calc(100vw - 48px);
    background: var(--bg-body);
    border-left: 1px solid var(--border);
    box-shadow: -20px 0 60px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform .25s cubic-bezier(.4, 0, .2, 1);
    font-family: inherit;
}

.task-panel.open { transform: translateX(0); }

/* ===== Header ===== */
.tp-header {
    flex-shrink: 0;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.tp-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
}

.tp-status-pill:hover { background: var(--bg-panel); }

.tp-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--progress);
    flex-shrink: 0;
}

.tp-id {
    font-size: 12px;
    color: var(--faint, #64748b);
    font-weight: 500;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.tp-header-actions {
    margin-left: auto;
    display: flex;
    gap: 2px;
    align-items: center;
}

.tp-icon-btn {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    color: var(--muted);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.tp-icon-btn:hover { background: var(--bg-elev); color: var(--text); }

/* ===== Body (scroll) ===== */
.tp-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px 24px 80px;
}

.tp-title {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 20px;
    line-height: 1.3;
    color: var(--text);
    letter-spacing: -0.2px;
}

.tp-title-input {
    width: 100%;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text);
    font-size: 24px;
    font-weight: 700;
    line-height: 1.3;
    padding: 4px 8px;
    margin: -4px 0 16px -8px;
    border-radius: 6px;
    font-family: inherit;
    outline: none;
    resize: none;
    letter-spacing: -0.2px;
}

.tp-title-input:hover { background: var(--bg-panel); }
.tp-title-input:focus { background: var(--bg-panel); border-color: var(--border); }

/* ===== Properties grid ===== */
.tp-props {
    display: grid;
    grid-template-columns: 120px 1fr;
    row-gap: 10px;
    column-gap: 16px;
    margin-bottom: 28px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.tp-prop-label {
    font-size: 13px;
    color: var(--muted);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
}

.tp-prop-label i { font-size: 14px; width: 16px; text-align: center; }

.tp-prop-value {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text);
    flex-wrap: wrap;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    min-height: 32px;
    margin: 0 -8px;
}

.tp-prop-value:hover { background: var(--bg-panel); }

.tp-prop-value .avatar-stack .avatar {
    width: 24px;
    height: 24px;
    border: 2px solid var(--bg-body);
    font-size: 10px;
}

.tp-prop-value .avatar-stack .avatar + .avatar { margin-left: -8px; }

/* ===== Sections ===== */
.tp-section { margin-bottom: 32px; }

.tp-section-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.tp-section-head h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.1px;
}

.tp-section-head .count {
    background: var(--bg-elev);
    color: var(--muted);
    font-size: 12px;
    padding: 2px 9px;
    border-radius: 999px;
    font-weight: 500;
    border: 1px solid var(--border);
}

.tp-section-head .spacer { flex: 1; }

.tp-section-head .add-inline {
    background: transparent;
    border: none;
    color: var(--muted);
    font-size: 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 500;
}

.tp-section-head .add-inline:hover { background: var(--bg-elev); color: var(--text); }

.tp-desc {
    font-size: 14px;
    line-height: 22px;
    color: var(--muted);
    margin: 0;
}

.tp-desc p { margin: 0 0 12px; }
.tp-desc p:last-child { margin-bottom: 0; }

/* ===== Subtasks ===== */
.tp-subtask-progress {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    font-size: 12px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.tp-subtask-progress .pct { color: var(--text); font-weight: 600; }

.tp-subtask-bar {
    flex: 1;
    height: 4px;
    background: var(--bg-elev);
    border-radius: 999px;
    overflow: hidden;
}

.tp-subtask-bar-fill {
    height: 100%;
    background: var(--done);
    border-radius: 999px;
    transition: width .2s ease;
}

.tp-subtask-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tp-subtask {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    margin: 0 -12px;
}

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

.tp-subtask .box {
    width: 16px;
    height: 16px;
    border: 1.5px solid var(--border-strong, #3a3d47);
    border-radius: 4px;
    flex-shrink: 0;
    position: relative;
    background: transparent;
    cursor: pointer;
}

.tp-subtask.done .box {
    background: var(--done);
    border-color: var(--done);
}

.tp-subtask.done .box::after {
    content: '\F633';
    font-family: 'bootstrap-icons';
    color: #fff;
    font-size: 11px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    line-height: 1;
}

.tp-subtask .text {
    flex: 1;
    font-size: 13px;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tp-subtask.done .text {
    color: var(--muted);
    text-decoration: line-through;
}

.tp-subtask .sub-assignee {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    flex-shrink: 0;
}

.tp-subtask .sub-due {
    font-size: 11px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

/* ===== Files ===== */
.tp-files {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
}

.tp-file {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: border-color .15s ease, transform .15s ease;
    text-decoration: none;
    color: inherit;
}

.tp-file:hover {
    border-color: var(--border-strong, #3a3d47);
    transform: translateY(-1px);
}

.tp-file-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 16px;
    flex-shrink: 0;
}

.tp-file-icon.pdf { background: linear-gradient(135deg, #ef4444, #dc2626); }
.tp-file-icon.fig { background: linear-gradient(135deg, #a855f7, #8b5cf6); }
.tp-file-icon.img { background: linear-gradient(135deg, #06b6d4, #3b82f6); }
.tp-file-icon.html { background: linear-gradient(135deg, #f97316, #ea580c); }
.tp-file-icon.doc { background: linear-gradient(135deg, #3b82f6, #2563eb); }

.tp-file-info {
    min-width: 0;
    flex: 1;
}

.tp-file-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.tp-file-meta {
    font-size: 11px;
    color: var(--muted);
    margin-top: 2px;
}

/* ===== Comments ===== */
.tp-composer {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.tp-composer-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    background: linear-gradient(135deg, #8b5cf6, #ec4899);
}

.tp-composer-box {
    flex: 1;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    transition: border-color .15s ease;
}

.tp-composer-box:focus-within { border-color: var(--accent); }

.tp-composer-input {
    width: 100%;
    background: transparent;
    border: none;
    padding: 12px 14px;
    color: var(--text);
    font-size: 13px;
    font-family: inherit;
    resize: none;
    min-height: 48px;
    outline: none;
    display: block;
}

.tp-composer-input::placeholder { color: var(--muted); }

.tp-composer-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px 6px 12px;
    border-top: 1px solid var(--border);
    gap: 8px;
}

.tp-composer-tools {
    display: flex;
    gap: 2px;
}

.tp-composer-tools button {
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    color: var(--muted);
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tp-composer-tools button:hover { background: var(--bg-elev); color: var(--text); }

.tp-send-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
}

.tp-send-btn:hover { background: #2563eb; }

.tp-comments {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.tp-comment {
    display: flex;
    gap: 12px;
}

.tp-comment-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
}

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

.tp-comment-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 13px;
}

.tp-comment-head .name {
    font-weight: 600;
    color: var(--text);
}

.tp-comment-head .time {
    color: var(--muted);
    font-size: 12px;
}

.tp-comment-text {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 13px;
    line-height: 20px;
    color: var(--text);
}

.tp-comment-text p { margin: 0 0 8px; }
.tp-comment-text p:last-child { margin-bottom: 0; }

.tp-comment-actions {
    display: flex;
    gap: 16px;
    margin-top: 8px;
    padding: 0 4px;
}

.tp-comment-actions button {
    background: transparent;
    border: none;
    color: var(--muted);
    padding: 0;
    cursor: pointer;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.tp-comment-actions button:hover { color: var(--text); }

/* ===== Priority pills shared with rows (redeclared for pages without them) ===== */
.tp-priority {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid;
}

.tp-priority.p-high { background: rgba(249, 115, 22, 0.1); color: #f97316; border-color: rgba(249, 115, 22, 0.3); }
.tp-priority i { font-size: 11px; }

.tp-label-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 12px;
    color: var(--muted);
    font-weight: 500;
}

.tp-label-pill .ld {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

@media (max-width: 640px) {
    .task-panel {
        width: 100vw;
        max-width: 100vw;
    }
    .tp-props {
        grid-template-columns: 1fr;
        row-gap: 4px;
    }
    .tp-prop-label { padding-bottom: 0; }
    .tp-prop-value { margin-bottom: 6px; }
    .tp-body { padding: 20px 16px 80px; }
}
