/* ============================================================
   Bubble — pages/goals.css  (Módulo 6: Objetivos / OKRs)
   Panel resumen + cuadrícula de 3 columnas de tarjetas de meta,
   estilo minimalista Dribbble. Color solo en progreso y toggles.
   ============================================================ */

.goals-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-5); flex-wrap: wrap; }
.goals-head-title { font-size: var(--text-xl); font-weight: var(--fw-medium); letter-spacing: -0.02em; }
.goals-head-sub { font-size: var(--text-sm); color: var(--text-tertiary); margin-top: 2px; }

/* Panel resumen consolidado */
.goals-summary {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-xl); padding: var(--card-padding-lg);
  box-shadow: var(--shadow-sm); margin-bottom: var(--space-6);
  display: flex; align-items: flex-end; gap: var(--space-6); flex-wrap: wrap;
}
.goals-summary-label { font-size: var(--text-sm); color: var(--text-tertiary); }
.goals-summary-value { font-size: 44px; font-weight: var(--fw-medium); letter-spacing: -0.03em; line-height: 1; color: var(--text-primary); }
.goals-summary-bar { flex: 1; min-width: 200px; }

/* Cuadrícula de objetivos */
.goals-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--grid-gap); }
.goal-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-xl); padding: var(--card-padding-lg);
  box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: var(--space-3);
}
.goal-card-top { display: flex; align-items: flex-start; gap: var(--space-3); }
.goal-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: var(--radius-md);
  background: var(--accent-light); color: var(--accent); flex-shrink: 0;
}
.goal-icon svg { width: 20px; height: 20px; }
.goal-name { font-size: var(--text-base); font-weight: var(--fw-medium); color: var(--text-primary); line-height: var(--lh-tight); }
.goal-menu { margin-left: auto; color: var(--text-tertiary); cursor: pointer; padding: 0 4px; }
.goal-target { font-size: var(--text-xl); font-weight: var(--fw-medium); letter-spacing: -0.02em; color: var(--text-primary); }
.goal-target small { font-size: var(--text-sm); color: var(--text-tertiary); font-weight: var(--fw-regular); }

.goal-progress-track { height: 8px; background: var(--bg-overlay); border-radius: var(--radius-pill); overflow: hidden; }
.goal-progress-fill { height: 100%; background: var(--accent); border-radius: var(--radius-pill); transition: width 600ms cubic-bezier(0.16,1,0.3,1); }

.goal-meta { display: flex; align-items: center; justify-content: space-between; font-size: var(--text-sm); }
.goal-meta .pct { color: var(--accent); font-weight: var(--fw-medium); }
.goal-meta .muted { color: var(--text-tertiary); }

.goal-krs { display: flex; flex-direction: column; gap: var(--space-2); padding-top: var(--space-2); border-top: 1px solid var(--border); }
.goal-kr { display: flex; align-items: center; justify-content: space-between; font-size: var(--text-sm); color: var(--text-secondary); }
.goal-kr .kr-val { color: var(--text-primary); font-weight: var(--fw-medium); }

.goal-foot { display: flex; align-items: center; justify-content: space-between; padding-top: var(--space-2); border-top: 1px solid var(--border); }
.goal-foot-label { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); color: var(--text-secondary); }
.goal-due { font-size: var(--text-sm); color: var(--text-tertiary); }

/* Objetivo archivado: atenuado, al final del grid */
.goal-card.is-archived { opacity: 0.55; filter: grayscale(0.4); }
.goal-card.is-archived:hover { opacity: 1; filter: none; }

/* Proyecto vinculado + due badge */
.goal-project { font-size: var(--text-xs, 12px); color: var(--text-tertiary); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.due-badge { font-size: 12px; padding: 2px 8px; border-radius: var(--radius-pill); font-weight: var(--fw-medium); }
.due-badge.ok   { background: color-mix(in srgb, var(--success, #16a34a) 14%, transparent); color: var(--success, #16a34a); }
.due-badge.warn { background: color-mix(in srgb, var(--warning, #d97706) 16%, transparent); color: var(--warning, #d97706); }
.due-badge.late { background: color-mix(in srgb, var(--danger, #dc2626) 14%, transparent); color: var(--danger, #dc2626); }

/* Avatares de colaboradores */
.goal-avatars { display: flex; align-items: center; }
.goal-avatar { width: 26px; height: 26px; border-radius: 50%; overflow: hidden; display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-light); color: var(--accent); font-size: 11px; font-weight: var(--fw-medium); border: 2px solid var(--bg-surface); margin-left: -6px; }
.goal-avatar:first-child { margin-left: 0; }
.goal-avatar img { width: 100%; height: 100%; object-fit: cover; }
.goal-avatar.is-pending { opacity: 0.55; border-style: dashed; }
.goal-tg { display: inline-flex; color: var(--text-tertiary); }
.goal-tg svg { width: 15px; height: 15px; }

/* Popover de acciones de tarjeta */
.goal-popover { position: fixed; z-index: 1200; background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-md); box-shadow: var(--shadow-lg, 0 8px 24px rgba(0,0,0,.12)); padding: 4px; min-width: 150px; display: flex; flex-direction: column; }
.goal-popover button { display: flex; align-items: center; gap: 8px; background: none; border: none; text-align: left; padding: 8px 10px;
  border-radius: var(--radius-sm); font-size: var(--text-sm); color: var(--text-primary); cursor: pointer; }
.goal-popover button:hover { background: var(--bg-overlay); }
.goal-popover button.danger { color: var(--danger, #dc2626); }
.goal-popover button svg { width: 15px; height: 15px; flex-shrink: 0; }
.due-badge svg { width: 13px; height: 13px; vertical-align: -2px; }

/* Modal grande */
.modal.modal-lg { max-width: 620px; width: 100%; }

/* Selector de icono */
.icon-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.icon-opt { width: 38px; height: 38px; border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--bg-surface);
  color: var(--text-secondary); cursor: pointer; transition: border-color .15s, background .15s; }
.icon-opt svg { width: 19px; height: 19px; vertical-align: middle; }
.icon-opt:hover { background: var(--bg-overlay); }
.icon-opt.on { border-color: var(--accent); background: var(--accent-light); }

/* Listas de selección (tareas / personas) */
.goal-picklist { border: 1px solid var(--border); border-radius: var(--radius-md); max-height: 200px; overflow-y: auto; background: var(--bg-surface); }
.pick-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; cursor: pointer; border-bottom: 1px solid var(--border); font-size: var(--text-sm); }
.pick-item:last-child { border-bottom: none; }
.pick-item:hover { background: var(--bg-overlay); }
.pick-item input { accent-color: var(--accent); flex-shrink: 0; }
.pick-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-primary); }
.pick-badge { font-size: 11px; color: var(--text-tertiary); padding: 1px 7px; border-radius: var(--radius-pill); background: var(--bg-overlay); }
.pick-badge.ok { color: var(--success, #16a34a); background: color-mix(in srgb, var(--success, #16a34a) 12%, transparent); }
.pick-avatar { width: 24px; height: 24px; border-radius: 50%; overflow: hidden; display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-light); color: var(--accent); font-size: 10px; font-weight: var(--fw-medium); flex-shrink: 0; }
.pick-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* Switch row + umbrales Telegram */
.goal-switch-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); cursor: pointer; }
.toggle.is-disabled { opacity: 0.4; pointer-events: none; }
.goal-thresholds { margin-top: var(--space-3); display: flex; flex-direction: column; gap: 8px; }
.threshold-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: var(--text-sm); color: var(--text-secondary); }
.input.mini, .select.mini { width: auto; min-width: 56px; padding: 4px 8px; font-size: var(--text-sm); display: inline-block; }
.select.mini { min-width: 110px; }
.th-del { background: none; border: none; color: var(--text-tertiary); cursor: pointer; font-size: 13px; padding: 2px 6px; }
.th-del:hover { color: var(--danger, #dc2626); }
.btn-sm { padding: 4px 10px; font-size: var(--text-sm); align-self: flex-start; }

@media (max-width: 1024px) { .goals-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .goals-grid { grid-template-columns: 1fr; } }
