/* ---------------- 프로젝트관리(협업) 스타일 ----------------
   개발 문서(노트 #694) 5장 화면설계 기준. 건강도 5색만 이 파일에서 새로 정의하고
   나머지는 tokens.css 변수를 그대로 쓴다. */
.pm-view {
  --pm-gray: #9aa1ae; --pm-blue: #4f9cf9; --pm-orange: #f2a154; --pm-red: #e5484d; --pm-green: #3ec98a;
  display: flex; flex-direction: column; gap: 18px; height: 100%;
}

/* ---------- 공통 ---------- */
.pm-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pm-toolbar-title { font-size: 20px; font-weight: 700; }
.pm-toolbar .spacer { flex-grow: 1; }
.pm-badge-info {
  font-size: 11px; font-weight: 600; color: var(--text-3); background: var(--surface-2);
  border: 1px dashed var(--border); border-radius: 20px; padding: 2px 10px;
}
.pm-progress-bar { width: 100%; height: 6px; border-radius: 3px; background: var(--border); overflow: hidden; }
.pm-progress-fill { height: 100%; border-radius: 3px; background: var(--accent); }
.pm-health-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.pm-avatar-stack { display: flex; }
.pm-avatar-stack .avatar-badge { margin-left: -8px; border: 2px solid var(--surface); }
.pm-avatar-stack .avatar-badge:first-child { margin-left: 0; }
.pm-avatar-more {
  width: 22px; height: 22px; border-radius: 50%; background: var(--surface-3); color: var(--text-3);
  font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center;
  margin-left: -8px; border: 2px solid var(--surface);
}
.pm-empty { padding: 40px 0; text-align: center; color: var(--text-3); font-size: 13.5px; }

/* ---------- 프로젝트 목록 ---------- */
.pm-project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.pm-project-card {
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  padding: 16px 18px; cursor: pointer; transition: box-shadow .15s, transform .15s; display: flex; flex-direction: column; gap: 10px;
  border-top: 3px solid var(--pm-accent, var(--accent));
}
.pm-project-card:hover { box-shadow: 0 8px 24px rgba(0,0,0,.12); transform: translateY(-2px); }
.pm-project-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.pm-project-name { font-size: 15.5px; font-weight: 700; line-height: 1.35; }
.pm-project-code { font-size: 11px; font-weight: 700; color: var(--text-3); letter-spacing: .04em; }
.pm-project-meta { font-size: 12px; color: var(--text-3); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pm-project-progress-row { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--text-3); }
.pm-project-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 2px; }
.pm-overdue-badge { font-size: 11px; font-weight: 700; color: var(--pm-red); background: rgba(229,72,77,.12); border-radius: 20px; padding: 2px 8px; }
.pm-status-pill { font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 20px; }
.pm-status-pill.active { color: var(--pm-blue); background: rgba(79,156,249,.12); }
.pm-status-pill.done { color: var(--pm-green); background: rgba(62,201,138,.14); }
.pm-status-pill.on_hold { color: var(--pm-orange); background: rgba(242,161,84,.14); }
.pm-status-pill.planning { color: var(--text-3); background: var(--surface-3); }
.pm-status-pill.archived { color: var(--text-3); background: var(--surface-2); border: 1px dashed var(--border); }

/* ---------- 프로젝트 홈 ---------- */
.pm-project-header {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 16px 18px;
}
.pm-project-header-info { flex: 1; min-width: 220px; }
.pm-project-header-info h2 { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.pm-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.pm-tab {
  padding: 9px 16px; font-size: 13.5px; font-weight: 600; color: var(--text-3); cursor: pointer;
  border-bottom: 2px solid transparent; background: none; border-top: none; border-left: none; border-right: none;
}
.pm-tab:hover { color: var(--text); }
.pm-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.pm-tab-body { flex: 1; min-height: 0; overflow: auto; }

/* ---------- 개요 ---------- */
.pm-overview-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.pm-panel { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 16px 18px; }
.pm-panel textarea {
  padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font-size: 13px; font-family: inherit;
}
.pm-panel textarea:disabled { opacity: .6; cursor: not-allowed; }
.pm-panel-title { font-size: 13px; font-weight: 700; color: var(--text-3); text-transform: uppercase; margin-bottom: 10px; }
.pm-milestone-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 13.5px; border-bottom: 1px solid var(--border); }
.pm-milestone-row:last-child { border-bottom: none; }
.pm-activity-row { padding: 7px 0; font-size: 12.5px; color: var(--text-2); border-bottom: 1px solid var(--border); }
.pm-activity-row:last-child { border-bottom: none; }
.pm-activity-row .t { color: var(--text-3); font-size: 11px; display: block; margin-top: 2px; }
@media (max-width: 900px) { .pm-overview-grid { grid-template-columns: 1fr; } }

/* ---------- 리스트 ---------- */
.pm-list-section { margin-bottom: 4px; }
.pm-list-section-head {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--surface-2);
  border-radius: 8px; font-size: 12.5px; font-weight: 700; color: var(--text-2); cursor: pointer;
}
.pm-list-table { width: 100%; border-collapse: collapse; }
.pm-list-table td { padding: 9px 10px; border-bottom: 1px solid var(--border); font-size: 13.5px; vertical-align: middle; }
.pm-list-table tr:hover td { background: var(--surface-2); cursor: pointer; }
.pm-list-table .col-title { display: flex; align-items: center; gap: 8px; }
.pm-list-table .col-seq { color: var(--text-3); font-size: 11.5px; flex-shrink: 0; }
.pm-status-chip { font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 20px; white-space: nowrap; }
.pm-status-chip.todo { background: var(--surface-3); color: var(--text-3); }
.pm-status-chip.doing { background: var(--accent-soft); color: var(--accent-strong); }
.pm-status-chip.done { background: rgba(62,201,138,.14); color: var(--pm-green); }
.pm-priority-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }

/* ---------- 타임라인 ---------- */
.pm-timeline-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.pm-timeline-toolbar b { min-width: 90px; text-align: center; }
.pm-timeline-wrap { display: flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.pm-timeline-left { width: 320px; flex-shrink: 0; border-right: 1px solid var(--border); }
.pm-timeline-left-row {
  height: 36px; display: flex; align-items: center; gap: 6px; padding: 0 10px; font-size: 12.5px;
  border-bottom: 1px solid var(--border); overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.pm-timeline-left-row.is-section { background: var(--surface-2); font-weight: 700; }
.pm-timeline-right { flex: 1; min-width: 0; overflow-x: auto; position: relative; }
.pm-timeline-grid { position: relative; width: 100%; min-width: 100%; }
.pm-timeline-daycols {
  display: flex; width: 100%; height: 36px; box-sizing: border-box; position: sticky; top: 0;
  background: var(--surface); z-index: 2; border-bottom: 1px solid var(--border);
}
.pm-timeline-daycol { flex: 1 1 0; min-width: 20px; display: flex; align-items: center; justify-content: center; font-size: 10px; color: var(--text-3); }
.pm-timeline-daycol.weekend { background: var(--surface-2); }
.pm-timeline-row { height: 36px; display: flex; width: 100%; border-bottom: 1px solid var(--border); position: relative; }
.pm-timeline-row.is-section { background: var(--surface-2); }
.pm-timeline-daycell { flex: 1 1 0; min-width: 20px; border-right: 1px solid var(--border); box-sizing: border-box; }
.pm-timeline-daycell.weekend { background: rgba(120,120,140,.06); }
.pm-timeline-today-line { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1px dashed var(--danger); z-index: 1; }
.pm-timeline-bar {
  position: absolute; height: 18px; top: 9px; border-radius: 5px; overflow: hidden;
  display: flex; align-items: center; font-size: 10px; color: #fff; padding: 0 6px; white-space: nowrap;
  cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,.25); box-sizing: border-box;
}
.pm-timeline-bar-fill { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(255,255,255,.35); }
.pm-timeline-bar span { position: relative; z-index: 1; overflow: hidden; text-overflow: ellipsis; }
.pm-timeline-bar.pm-timeline-bar-dragging { opacity: .75; box-shadow: 0 2px 8px rgba(0,0,0,.4); z-index: 3; }
.pm-timeline-bar-handle { position: absolute; top: 0; bottom: 0; width: 6px; cursor: ew-resize; z-index: 2; }
.pm-timeline-bar-handle.left { left: 0; }
.pm-timeline-bar-handle.right { right: 0; }
.pm-timeline-bar-handle:hover { background: rgba(255,255,255,.4); }
.pm-timeline-milestone {
  position: absolute; top: 8px; width: 20px; height: 20px; background: var(--accent);
  transform: translate(-50%, 0) rotate(45deg); border-radius: 4px; cursor: grab;
}
.pm-timeline-milestone.pm-timeline-bar-dragging { opacity: .75; cursor: grabbing; }

/* ---------- 칸반 ---------- */
.pm-kanban { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 8px; align-items: flex-start; }
.pm-kanban-col { width: 260px; flex-shrink: 0; background: var(--surface-2); border-radius: var(--radius); padding: 10px; transition: background .1s; }
.pm-kanban-col.drag-over { background: var(--accent-soft); outline: 2px dashed var(--accent); outline-offset: -2px; }
.pm-kanban-col-head { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; padding: 4px 4px 10px; }
.pm-kanban-col-head .cnt { font-size: 11px; color: var(--text-3); font-weight: 600; }
.pm-kanban-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px;
  margin-bottom: 8px; cursor: grab; display: flex; flex-direction: column; gap: 6px;
}
.pm-kanban-card:hover { border-color: var(--accent); }
.pm-kanban-card.dragging { opacity: .4; }
.pm-kanban-card .seq { font-size: 10.5px; color: var(--text-3); font-weight: 700; }
.pm-kanban-card .title { font-size: 13px; font-weight: 600; line-height: 1.4; }
.pm-kanban-card-labels { display: flex; gap: 4px; flex-wrap: wrap; }
.pm-kanban-label { width: 22px; height: 5px; border-radius: 3px; }
.pm-kanban-card-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 2px; }
.pm-kanban-due { font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 20px; }
.pm-kanban-add { width: 100%; text-align: left; background: none; border: none; color: var(--text-3); font-size: 12.5px; padding: 6px 4px; cursor: pointer; }
.pm-kanban-add:hover { color: var(--accent); }

/* ---------- 대시보드 ---------- */
.pm-dash-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.pm-dash-tile { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 14px 16px; }
.pm-dash-tile b { display: block; font-size: 22px; font-weight: 700; }
.pm-dash-tile span { font-size: 12px; color: var(--text-3); }
.pm-health-bar { display: flex; height: 22px; border-radius: 6px; overflow: hidden; margin: 8px 0; }
.pm-health-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11.5px; color: var(--text-3); }
.pm-health-legend span { display: inline-flex; align-items: center; gap: 5px; }
@media (max-width: 900px) { .pm-dash-grid { grid-template-columns: repeat(2, 1fr); } }

/* ---------- 작업 상세 슬라이드 패널 ---------- */
.pm-panel-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 8500; }
.pm-task-panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 100%); background: var(--surface);
  z-index: 8501; box-shadow: -8px 0 30px rgba(0,0,0,.2); display: flex; flex-direction: column;
  animation: pm-slide-in .18s ease-out;
}
@keyframes pm-slide-in { from { transform: translateX(100%); } to { transform: translateX(0); } }
.pm-task-panel-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.pm-task-panel-head .seq { font-size: 11.5px; font-weight: 700; color: var(--text-3); }
.pm-task-panel-body { flex: 1; overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 14px; }
.pm-field-row { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.pm-field-row .label { width: 78px; flex-shrink: 0; color: var(--text-3); }
.pm-field-row .value { flex: 1; }
.pm-task-panel textarea, .pm-task-panel input[type="text"] {
  width: 100%; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font-size: 13px; font-family: inherit;
}
.pm-checklist-item { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 13px; }
.pm-checklist-item.done span { text-decoration: line-through; color: var(--text-3); }
.pm-comment-item { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.pm-comment-item .author { font-weight: 700; margin-right: 6px; }
.pm-comment-item .t { color: var(--text-3); font-size: 11px; }
.pm-comment-body { margin-top: 4px; white-space: pre-wrap; word-break: break-word; color: var(--text-2); line-height: 1.5; }
.pm-comment-edit-textarea {
  padding: 6px 8px; border-radius: 8px; border: 1px solid var(--border); resize: vertical;
  background: var(--surface-2); color: var(--text); font-size: 12.5px; font-family: inherit;
}
.pm-panel-subtabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-top: 4px; }
.pm-panel-subtab { padding: 6px 10px; font-size: 12px; font-weight: 600; color: var(--text-3); cursor: pointer; border-bottom: 2px solid transparent; }
.pm-panel-subtab.active { color: var(--accent); border-bottom-color: var(--accent); }

.pm-task-panel select {
  padding: 6px 8px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font-size: 12.5px; font-family: inherit;
}
.pm-assignee-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.pm-assignee-chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px 3px 4px; border-radius: 20px;
  border: 1px solid var(--border); background: var(--surface-2); font-size: 12px; cursor: pointer;
}
.pm-assignee-chip.selected { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong); }
.pm-assignee-chip .primary-tag { font-size: 9.5px; color: var(--accent); font-weight: 700; }
.pm-checklist-add-row { display: flex; gap: 6px; margin-top: 6px; }
.pm-checklist-add-row input {
  flex: 1; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font-size: 12.5px; font-family: inherit;
}
.pm-checklist-item input[type="checkbox"] { cursor: pointer; }
.pm-checklist-item .del-btn { margin-left: auto; background: none; border: none; color: var(--text-3); cursor: pointer; font-size: 13px; }
.pm-checklist-item .del-btn:hover { color: var(--danger); }
.pm-member-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 13px; border-bottom: 1px solid var(--border); }
.pm-member-row:last-child { border-bottom: none; }
.pm-member-row .role { margin-left: auto; font-size: 11px; color: var(--text-3); background: var(--surface-2); padding: 2px 8px; border-radius: 20px; }
.pm-section-add-row { padding: 8px 10px; }
.pm-section-add-row input { width: 100%; padding: 6px 10px; border-radius: 8px; border: 1px dashed var(--border); background: none; color: var(--text); font-size: 12.5px; }
.pm-inline-error { color: var(--danger); font-size: 12px; margin-top: 4px; }
.pm-saving-dot { font-size: 11px; color: var(--text-3); }
