/* Proyectos, tablero y tareas (subtareas, historial, mover) */

/* ================================================================ proyectos */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }
.project-card {
  --pc: var(--accent);
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 14px;
  padding: 22px 20px 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s, transform .2s;
}
.project-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 5px; background: var(--pc); }
.project-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.project-card header { display: flex; align-items: flex-start; gap: 8px; }
.project-card h3 { flex: 1; font-size: 16px; padding-top: 5px; overflow-wrap: anywhere; }
.card-actions { display: flex; gap: 2px; opacity: .65; transition: opacity .15s; }
.project-card:hover .card-actions { opacity: 1; }
.project-desc { color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.project-members { display: grid; gap: 6px; margin-top: auto; padding-top: 12px; border-top: 1px dashed var(--border); }
.pm-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pm-name { flex: 1; min-width: 0; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.color-group { margin-bottom: 26px; }
.color-group-title { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-2); margin-bottom: 12px; }
.dot { width: 14px; height: 14px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 25%, transparent); }

/* selector de miembros */
.members-editor { display: grid; gap: 10px; }
.member-pick {
  list-style: none; margin: 0; padding: 4px;
  display: grid; gap: 2px; max-height: 300px; overflow-y: auto;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2);
}
.member-pick li { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 7px; }
.member-pick li.checked { background: var(--surface); box-shadow: var(--shadow-sm); }
.mp-who { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; cursor: pointer; }
.mp-who input { width: 17px; height: 17px; accent-color: var(--accent); flex-shrink: 0; }
.mp-who span { display: grid; min-width: 0; }
.mp-who strong { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mp-who small { color: var(--muted); font-size: 12px; }
.role-select {
  --c: var(--muted);
  width: auto !important; min-height: 32px !important; max-width: 210px;
  padding: 4px 28px 4px 10px !important;
  font-size: 12.5px; font-weight: 600;
  border-color: color-mix(in srgb, var(--c) 45%, var(--border)) !important;
  background-color: color-mix(in srgb, var(--c) 10%, var(--surface)) !important;
  color: color-mix(in srgb, var(--c) 80%, var(--text));
}
.role-select:disabled { opacity: .4; }
.role-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.role-legend.card { padding: 12px 16px; margin-bottom: 16px; }

/* selector de color */
.color-picker { display: grid; gap: 10px; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch {
  --sw: #999;
  position: relative; display: grid; place-items: center;
  width: 30px; height: 30px; padding: 0;
  border: 0; border-radius: 50%; background: var(--sw); color: #fff;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1);
  transition: transform .12s;
}
.swatch:hover { transform: scale(1.1); }
.swatch .icon { width: 15px; height: 15px; opacity: 0; stroke-width: 3; }
.swatch.selected { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--sw); }
.swatch.selected .icon { opacity: 1; }
.swatch-custom { --sw: conic-gradient(red, yellow, lime, aqua, blue, magenta, red); background: var(--sw); cursor: pointer; overflow: hidden; }
.swatch-custom .icon { opacity: 1; color: #fff; filter: drop-shadow(0 0 2px rgba(0, 0, 0, .6)); }
.swatch-custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.used-colors { display: grid; gap: 6px; padding-top: 10px; border-top: 1px dashed var(--border); }
.used-colors > span { font-size: 12px; color: var(--muted); font-weight: 600; }

/* ================================================================ tablero de tareas */
.project-card h3 a:hover { color: var(--accent); }
.project-board-link {
  display: flex; align-items: center; gap: 8px; padding: 9px 11px; border-radius: 9px;
  background: var(--surface-2); border: 1px solid var(--border); font-size: 12.5px; color: var(--text-2);
  transition: border-color .15s, background .15s;
}
.project-board-link:hover { border-color: color-mix(in srgb, var(--pc) 50%, var(--border)); background: color-mix(in srgb, var(--pc) 6%, var(--surface)); }
.project-board-link > span:first-of-type { flex: 1; min-width: 0; }
.project-board-link .icon { width: 15px; height: 15px; color: var(--pc); }
.project-board-link .progress { width: 60px; }

.board-head h2 { display: flex; align-items: center; gap: 10px; }
.board-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 6px; }
.avatar-stack { display: flex; }
.avatar-stack .avatar { margin-left: -6px; box-shadow: 0 0 0 2px var(--bg); }
.avatar-stack .avatar:first-child { margin-left: 0; }
.board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.board-col { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); min-height: 200px; }
.board-col > header { display: flex; align-items: center; gap: 8px; padding: 2px 4px; }
.board-col > header h3 { font-size: 14px; flex: 1; }
.board-col > header .icon { width: 16px; height: 16px; }
.col-todo > header .icon { color: var(--muted); }
.col-doing > header .icon { color: #0b84f3; }
.col-done > header .icon { color: var(--success); }
.board-cards { display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.board-empty { padding: 18px 8px; text-align: center; color: var(--muted); font-size: 12.5px; border: 1px dashed var(--border-strong); border-radius: 10px; }
.board-add { justify-content: flex-start; color: var(--muted); background: transparent; border-style: dashed; }
.board-hint { margin-top: 14px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.board-hint .icon { width: 14px; height: 14px; }
.task-card {
  --c: var(--accent);
  position: relative; display: grid; gap: 6px; padding: 10px 12px 10px 14px;
  border-radius: 10px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  cursor: grab; user-select: none; transition: border-color .12s, box-shadow .12s;
}
.task-card::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--c); }
.task-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.task-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.task-card h4 { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.task-card.is-done h4 { text-decoration: line-through; color: var(--muted); }
.tc-top { display: flex; align-items: center; gap: 8px; }
.tc-commits { display: inline-flex; align-items: center; gap: 3px; margin-left: auto; font-size: 11.5px; color: var(--muted); }
.tc-commits .icon { width: 13px; height: 13px; }
.tc-desc { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tc-foot { display: flex; align-items: center; gap: 6px; min-height: 28px; }
.tc-foot .due { font-size: 11.5px; padding: 2px 7px; }
.tc-unassigned { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; border: 1px dashed var(--border-strong); color: var(--muted); }
.tc-unassigned .icon { width: 14px; height: 14px; }
.task-ghost { position: fixed; left: 0; top: 0; z-index: 100; pointer-events: none; box-shadow: var(--shadow-lg); opacity: .95; cursor: grabbing; }
.task-placeholder { border-radius: 10px; border: 2px dashed color-mix(in srgb, var(--accent) 50%, transparent); background: var(--accent-soft); }
.task-card.drag-source { display: none; }

.task-commits { display: grid; gap: 8px; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); }
.task-commits h4 { display: flex; align-items: center; gap: 6px; font-size: 13.5px; }
.task-commits h4 .icon { width: 15px; height: 15px; color: var(--accent); }
.commit-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.commit-list li { display: flex; align-items: flex-start; gap: 10px; }
.commit-list li > div { display: grid; min-width: 0; }
.commit-summary { font-size: 13px; overflow-wrap: anywhere; }
.task-link { color: var(--accent); font-weight: 600; }
.task-link:hover { text-decoration: underline; }
.drag-chip.is-done .chip-title { text-decoration: line-through; opacity: .7; }
.drag-chip .avatar.xs { margin-left: auto; }

/* ================================================================ tareas con varias personas */
.assignee-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.assignee-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px 0 5px; border-radius: 99px;
  border: 1px solid var(--border); background: var(--surface); font-size: 13px; color: var(--text-2);
  transition: background .15s, border-color .15s, color .15s, transform .1s;
}
.assignee-chip:active { transform: scale(.96); }
.assignee-chip .chip-check { width: 13px; height: 13px; opacity: 0; transition: opacity .15s; }
.assignee-chip.on { border-color: var(--accent); background: var(--accent-soft); color: var(--text); font-weight: 600; }
.assignee-chip.on .chip-check { opacity: 1; color: var(--accent); }
.assignee-general { display: none; align-items: center; gap: 5px; height: 32px; padding: 0 10px; border-radius: 99px; background: var(--surface-3); color: var(--muted); font-size: 12.5px; font-weight: 600; }
.assignee-general.on { display: inline-flex; }
.assignee-general .icon { width: 14px; height: 14px; }
.tc-general { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 99px; background: var(--surface-3); color: var(--muted); font-size: 11.5px; font-weight: 600; }
.tc-general .icon { width: 13px; height: 13px; }
.avatar-more { background: var(--surface-3) !important; color: var(--text-2) !important; font-size: 10.5px; }
.task-check.status-todo { border-style: dashed; }
.task-check.status-todo .icon { stroke-width: 2; }
.my-task.advancing { animation: nudge .5s ease; }
@keyframes nudge { 40% { transform: translateX(6px); } }

/* --- subtareas */
.task-checklist { display: grid; gap: 8px; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); }
.task-checklist h4 { display: flex; align-items: center; gap: 6px; font-size: 13.5px; }
.task-checklist h4 .icon { width: 15px; height: 15px; color: var(--accent); }
.check-progress { width: 100%; height: 5px; }
.check-progress i { background: var(--accent); }
.check-progress.is-full i { background: var(--success); }
.check-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.check-item { display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 2px 4px; border-radius: 8px; }
.check-item:hover { background: var(--surface-2); }
.check-box {
  flex: none; width: 22px; height: 22px; display: grid; place-items: center; padding: 0; border: 1.5px solid var(--border-strong);
  border-radius: 6px; background: var(--surface); color: transparent; cursor: pointer; transition: background .15s, border-color .15s;
}
.check-box .icon { width: 14px; height: 14px; }
.check-item.is-done .check-box { border-color: var(--success); background: var(--success); color: #fff; }
.check-item:not(.is-done) .check-box .icon { opacity: 0; }
.check-text { flex: 1; min-width: 0; font-size: 14px; overflow-wrap: anywhere; cursor: text; }
.check-item.is-done .check-text { color: var(--muted); text-decoration: line-through; }
.check-edit { flex: 1; min-width: 0; }
.check-edit input { width: 100%; height: 30px; }
.check-del { opacity: 0; }
.check-item:hover .check-del, .check-del:focus-visible { opacity: 1; }
.check-add { display: flex; gap: 8px; }
.check-add input { flex: 1; min-width: 0; height: 34px; }
.tc-check.is-full { color: var(--success); }

/* --- historial de la tarea */
.task-history { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); }
.task-history summary { display: flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 650; cursor: pointer; list-style: none; }
.task-history summary::-webkit-details-marker { display: none; }
.task-history summary .icon { width: 15px; height: 15px; color: var(--accent); }
.task-history summary::after { content: '›'; margin-left: 4px; color: var(--muted); transition: transform .15s; }
.task-history[open] summary::after { transform: rotate(90deg); }
.history-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; max-height: 260px; overflow-y: auto; }
.history-list li { display: grid; grid-template-columns: auto 1fr auto; align-items: start; gap: 10px; font-size: 13px; color: var(--text-2); }
.history-list strong { color: var(--text); }
.history-icon { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-3); color: var(--muted); }
.history-icon .icon { width: 13px; height: 13px; }
.history-list time { white-space: nowrap; }

/* Tablero: «Mover a…» en cada tarjeta. En el ordenador aparece al pasar el ratón o con el teclado; en el móvil, siempre */
.task-card { position: relative; }
.tc-move { margin-left: auto; width: 26px; height: 26px; opacity: 0; transition: opacity .12s; }
.task-card:hover .tc-move, .task-card:focus-within .tc-move, .tc-move:focus-visible { opacity: 1; }
@media (hover: none) { .tc-move { opacity: 1; } }
.move-menu { position: absolute; top: 38px; right: 8px; z-index: 30; }
.tc-commits ~ .tc-move { margin-left: 0; }
