/* Task detail drawer (sql90) — td-* classes. Loaded globally from dashboard.html. */
.td-overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 10050; display: none; }
.td-overlay.active { display: block; }
body.td-open { overflow: hidden; }
.td-panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(760px, 100%); background: #fff; box-shadow: -12px 0 40px rgba(0,0,0,.18);
    display: flex; flex-direction: column; animation: tdSlide .18s ease-out; }
@keyframes tdSlide { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.td-head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 22px 10px; border-bottom: 1px solid #eef0f4; }
.td-head-main { flex: 1; min-width: 0; }
.td-id { font-size: 12px; color: #8a93a3; font-weight: 600; letter-spacing: .02em; }
.td-title { margin: 2px 0 8px; font-size: 20px; font-weight: 700; line-height: 1.25; color: var(--text-dark, #1e293b); word-break: break-word; }
.td-badges { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.td-badges .status-badge, .td-badges .priority-badge { font-size: 12px; }
.td-close { border: none; background: #f3f4f7; width: 34px; height: 34px; border-radius: 8px; cursor: pointer; color: #475569; flex: none; }
.td-close:hover { background: #e7e9ef; }
.td-appr, .td-code, .td-blocked, .td-overdue { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.td-appr-pending { background: #fff4e0; color: #b45309; }
.td-appr-approved { background: #e6f7ec; color: #15803d; }
.td-appr-returned { background: #fde8e8; color: #b91c1c; }
.td-appr-none { background: #f1f5f9; color: #64748b; }
.td-code { background: #ecebff; color: #4338ca; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .04em; }
.td-blocked { background: #fde8e8; color: #b91c1c; }
.td-overdue { background: #fde8e8; color: #b91c1c; }
.td-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 22px; background: #fafbfc; border-bottom: 1px solid #eef0f4; }
.td-actions:empty { display: none; }
.td-btn { display: inline-flex; align-items: center; gap: 7px; padding: 8px 13px; border-radius: 8px; border: 1px solid #d6dbe3; background: #fff; color: #1e293b;
    font-size: 13px; font-weight: 600; cursor: pointer; transition: all .15s; white-space: nowrap; }
.td-btn:hover { border-color: #9aa3b2; background: #f8fafc; }
.td-btn-primary { background: var(--accent, #6366f1); border-color: var(--accent, #6366f1); color: #fff; }
.td-btn-primary:hover { filter: brightness(.95); background: var(--accent, #6366f1); }
.td-btn-success { background: #16a34a; border-color: #16a34a; color: #fff; }
.td-btn-success:hover { background: #15803d; }
.td-btn-warn { background: #f59e0b; border-color: #f59e0b; color: #fff; }
.td-btn-warn:hover { background: #d97706; }
.td-btn-disabled { opacity: .5; cursor: not-allowed; }
.td-btn-small { padding: 6px 10px; font-size: 12px; }
.td-tabs { display: flex; gap: 2px; padding: 0 16px; border-bottom: 1px solid #eef0f4; overflow-x: auto; }
.td-tab { border: none; background: none; padding: 11px 12px; font-size: 13px; font-weight: 600; color: #64748b; cursor: pointer; display: inline-flex; align-items: center; gap: 7px;
    border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.td-tab.on { color: var(--accent, #6366f1); border-bottom-color: var(--accent, #6366f1); }
.td-tab b { background: #eef0f4; color: #475569; border-radius: 999px; padding: 1px 7px; font-size: 11px; }
.td-tab.on b { background: #ecebff; color: #4338ca; }
.td-body { flex: 1; overflow-y: auto; padding: 18px 22px 40px; }
.td-loading { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; background: rgba(255,255,255,.7); font-size: 28px; color: var(--accent, #6366f1); }
.td-desc { white-space: normal; line-height: 1.55; color: #334155; background: #f8fafc; border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; font-size: 14px; }
.td-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; margin-bottom: 8px; }
.td-row { padding: 6px 0; border-bottom: 1px dashed #eef0f4; }
.td-label { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: #8a93a3; font-weight: 600; }
.td-value { font-size: 14px; color: #1e293b; margin-top: 2px; }
.td-red { color: #b91c1c; font-weight: 600; }
.td-project { display: inline-flex; align-items: center; gap: 6px; }
.td-project i { color: var(--pc, var(--accent, #6366f1)); }
.td-project small { color: #8a93a3; }
.td-section { margin-top: 18px; }
.td-section-title { font-size: 13px; font-weight: 700; color: #1e293b; display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.td-section-title i { color: var(--accent, #6366f1); }
.td-progress-pill, .td-blocked-pill { font-size: 11px; padding: 1px 8px; border-radius: 999px; background: #ecebff; color: #4338ca; }
.td-blocked-pill { background: #fde8e8; color: #b91c1c; }
.td-progress { height: 6px; border-radius: 999px; background: #eef0f4; margin: 4px 0 10px; overflow: hidden; }
.td-progress-bar { height: 100%; background: linear-gradient(90deg, #6366f1, #22c55e); border-radius: 999px; transition: width .3s; }
.td-person { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border: 1px solid #eef0f4; border-radius: 10px; margin-bottom: 6px; }
.td-person.td-me { border-color: #c7d2fe; background: #f5f5ff; }
.td-avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.td-person-name { flex: 1; font-size: 14px; font-weight: 600; min-width: 0; }
.td-person-name small { color: #8a93a3; font-weight: 500; }
.td-person-note { font-size: 12px; color: #64748b; font-weight: 400; }
.td-part, .td-part-select { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; border: 1px solid #d6dbe3; background: #fff; }
.td-part-pending { background: #f1f5f9; color: #64748b; }
.td-part-in_progress { background: #e0f2fe; color: #0369a1; }
.td-part-done { background: #e6f7ec; color: #15803d; }
.td-muted { color: #8a93a3; font-size: 13px; }
.td-empty { padding: 18px; text-align: center; border: 1px dashed #d6dbe3; border-radius: 10px; }
.td-empty i { margin-right: 6px; }
.td-dep { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid #eef0f4; border-radius: 10px; margin-bottom: 6px; }
.td-dep > i { color: #f59e0b; font-size: 16px; }
.td-dep.done > i { color: #16a34a; }
.td-dep.done .td-dep-name { text-decoration: line-through; color: #8a93a3; }
.td-dep-main { flex: 1; min-width: 0; }
.td-dep-name { font-size: 14px; font-weight: 600; }
.td-dep-name a { color: inherit; text-decoration: none; }
.td-dep-name a:hover { color: var(--accent, #6366f1); }
.td-dep-meta { font-size: 12px; color: #64748b; margin-top: 2px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.td-dep-meta .status-badge { font-size: 11px; padding: 2px 8px; }
.td-ext { background: #fff4e0; color: #b45309; padding: 2px 8px; border-radius: 999px; font-weight: 600; }
.td-check { font-size: 12px; color: #475569; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.td-icon-btn { border: none; background: #f3f4f7; width: 30px; height: 30px; border-radius: 8px; cursor: pointer; color: #64748b; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; flex: none; }
.td-icon-btn:hover { background: #e7e9ef; color: #1e293b; }
.td-dep-add { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.td-dep-add select, .td-dep-add input { padding: 7px 9px; border: 1px solid #d6dbe3; border-radius: 8px; font-size: 13px; }
.td-dep-add .td-dep-task, .td-dep-add .td-dep-name-input { flex: 1; min-width: 180px; }
/* approvals */
.td-appr-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.td-appr-status { padding: 6px 12px; border-radius: 8px; font-weight: 700; font-size: 13px; }
.td-code-big { display: flex; flex-direction: column; align-items: flex-end; }
.td-code-big span { font-size: 11px; color: #8a93a3; text-transform: uppercase; letter-spacing: .04em; }
.td-code-big b { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 20px; color: #4338ca; letter-spacing: .06em; }
.td-chain { list-style: none; margin: 12px 0; padding: 0; position: relative; }
.td-chain::before { content: ''; position: absolute; left: 15px; top: 8px; bottom: 8px; width: 2px; background: #eef0f4; }
.td-step { display: flex; gap: 12px; padding: 6px 0; position: relative; }
.td-step-n { width: 32px; height: 32px; border-radius: 50%; background: #eef0f4; color: #64748b; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; flex: none; z-index: 1; }
.td-step-n.small { width: 24px; height: 24px; font-size: 12px; font-weight: 700; }
.td-step.ok .td-step-n { background: #16a34a; color: #fff; }
.td-step.back .td-step-n { background: #ef4444; color: #fff; }
.td-step.cur .td-step-n { background: #f59e0b; color: #fff; box-shadow: 0 0 0 4px #fff4e0; }
.td-step-main { flex: 1; padding-top: 5px; }
.td-step-name { font-weight: 600; font-size: 14px; }
.td-step-meta { font-size: 12px; color: #64748b; margin-top: 2px; }
.td-step-comment { margin-top: 5px; background: #f8fafc; border-left: 3px solid #d6dbe3; padding: 6px 10px; border-radius: 6px; font-size: 13px; color: #334155; }
.td-ini { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; padding: 1px 6px; border-radius: 6px; background: #ecebff; color: #4338ca; margin-left: 4px; }
.td-appr-act { background: #fff8eb; border: 1px solid #fde4b3; border-radius: 10px; padding: 12px; margin: 10px 0; }
.td-appr-act textarea, .td-comment-box textarea, .td-mini textarea { width: 100%; box-sizing: border-box; padding: 9px 11px; border: 1px solid #d6dbe3; border-radius: 8px; font-size: 13px; font-family: inherit; resize: vertical; }
.td-appr-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.td-chain-edit { display: flex; flex-direction: column; gap: 4px; }
.td-chain-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid #eef0f4; border-radius: 8px; }
.td-chain-name { flex: 1; font-size: 14px; font-weight: 600; }
.td-chain-add { display: flex; gap: 6px; margin-top: 8px; }
.td-chain-add select { flex: 1; padding: 7px 9px; border: 1px solid #d6dbe3; border-radius: 8px; font-size: 13px; }
.td-chain-save { margin-top: 8px; }
/* files */
.td-upload { border: 2px dashed #d6dbe3; border-radius: 12px; padding: 22px; text-align: center; cursor: pointer; color: #475569; transition: all .15s; margin-bottom: 14px; }
.td-upload:hover, .td-upload.over { border-color: var(--accent, #6366f1); background: #f5f5ff; }
.td-upload i { font-size: 26px; color: var(--accent, #6366f1); margin-bottom: 6px; }
.td-upload small { display: block; color: #8a93a3; margin-top: 4px; }
.td-upload-progress { height: 5px; border-radius: 999px; background: #eef0f4; margin-top: 10px; overflow: hidden; }
.td-upload-progress div { height: 100%; width: 0; background: var(--accent, #6366f1); transition: width .2s; }
.td-files { display: flex; flex-direction: column; gap: 6px; }
.td-file { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid #eef0f4; border-radius: 10px; }
.td-file-icon { width: 40px; height: 40px; border-radius: 8px; background: #f1f5f9; display: inline-flex; align-items: center; justify-content: center; font-size: 18px; color: #475569; flex: none; }
.td-file-thumb { width: 40px; height: 40px; border-radius: 8px; overflow: hidden; flex: none; display: block; }
.td-file-thumb img { width: 100%; height: 100%; object-fit: cover; }
.td-file-main { flex: 1; min-width: 0; }
.td-file-name { font-size: 14px; font-weight: 600; color: #1e293b; text-decoration: none; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.td-file-name:hover { color: var(--accent, #6366f1); }
.td-file-meta { font-size: 12px; color: #64748b; }
/* history */
.td-comment-box { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 14px; }
.td-comment-box textarea { flex: 1; }
.td-timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.td-timeline::before { content: ''; position: absolute; left: 14px; top: 6px; bottom: 6px; width: 2px; background: #eef0f4; }
.td-tl { display: flex; gap: 12px; padding: 6px 0; position: relative; }
.td-tl-icon { width: 30px; height: 30px; border-radius: 50%; background: #eef0f4; color: #64748b; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; flex: none; z-index: 1; }
.td-tl.approved .td-tl-icon { background: #e6f7ec; color: #15803d; }
.td-tl.returned .td-tl-icon { background: #fde8e8; color: #b91c1c; }
.td-tl.submitted .td-tl-icon, .td-tl.handover .td-tl-icon { background: #fff4e0; color: #b45309; }
.td-tl.is-comment .td-tl-icon { background: #ecebff; color: #4338ca; }
.td-tl-main { flex: 1; padding-top: 4px; min-width: 0; }
.td-tl-head { font-size: 13px; color: #334155; }
.td-tl-time { color: #8a93a3; font-size: 12px; margin-left: 8px; white-space: nowrap; }
.td-tl-comment { margin-top: 4px; background: #f8fafc; border-radius: 8px; padding: 8px 10px; font-size: 13px; color: #1e293b; line-height: 1.5; }
.td-tl.is-comment .td-tl-comment { background: #f5f5ff; }
/* time */
.td-hold { display: flex; flex-direction: column; gap: 8px; }
.td-hold-row { display: flex; gap: 10px; align-items: center; }
.td-hold-main { flex: 1; }
.td-hold-head { display: flex; justify-content: space-between; font-size: 13px; }
.td-hold-bar { height: 6px; background: #eef0f4; border-radius: 999px; overflow: hidden; margin-top: 4px; }
.td-hold-bar div { height: 100%; background: var(--accent, #6366f1); }
.td-live { color: #22c55e; font-size: 8px; vertical-align: middle; animation: tdPulse 1.4s infinite; }
@keyframes tdPulse { 50% { opacity: .3; } }
.td-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.td-table th { text-align: left; font-size: 11px; text-transform: uppercase; color: #8a93a3; padding: 6px 8px; border-bottom: 1px solid #eef0f4; }
.td-table td { padding: 7px 8px; border-bottom: 1px solid #f3f4f7; }
/* mini dialog (handover) */
.td-mini-overlay { position: fixed; inset: 0; z-index: 10060; background: rgba(15,23,42,.35); display: none; align-items: center; justify-content: center; }
.td-mini-overlay.active { display: flex; }
.td-mini { background: #fff; border-radius: 14px; width: min(460px, 94vw); padding: 18px 20px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.td-mini-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; font-size: 16px; }
.td-mini label { display: block; font-size: 12px; font-weight: 600; color: #475569; margin: 10px 0 0; }
.td-mini select, .td-mini textarea { width: 100%; box-sizing: border-box; margin-top: 4px; padding: 9px 11px; border: 1px solid #d6dbe3; border-radius: 8px; font-size: 13px; font-family: inherit; }
.td-mini-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
@media (max-width: 700px) {
    .td-grid { grid-template-columns: 1fr; }
    .td-body { padding: 14px; }
    .td-head, .td-actions { padding-left: 14px; padding-right: 14px; }
}

/* sql104: open the linked custom-form record */
.td-btn-record { border-color: var(--accent, #6366f1); color: var(--accent, #6366f1); }
.td-btn-record:hover { background: rgba(99,102,241,.08); }
.td-record-link { color: var(--accent, #6366f1); text-decoration: none; }
.td-record-link:hover { text-decoration: underline; }
