/* =============================================
   COMPONENTS — Cards, Badges, Tables, Modals
   Paleta simplificada: Blanco / Azul / Amarillo
   ============================================= */

/* ---- CARD ---- */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
}
.card-sm { padding: 16px 20px; }
.card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

/* ---- KPI CARD ---- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

.kpi-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
/* Barra superior: solo azul para todos */
.kpi-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--blue);
  border-radius: 3px 3px 0 0;
}
.kpi-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}
.kpi-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  line-height: 1;
}
.kpi-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.kpi-meta svg { width: 12px; height: 12px; }
.kpi-meta.up   { color: #16a34a; }
.kpi-meta.down { color: #dc2626; }
.kpi-icon {
  position: absolute;
  top: 18px; right: 18px;
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  background: var(--primary-light);
  display: flex; align-items: center; justify-content: center;
  color: var(--blue);
}
.kpi-icon svg { width: 18px; height: 18px; }

/* ---- GRID ---- */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
@media (max-width: 900px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* ---- BADGES / STATUS ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 50px;
  white-space: nowrap;
}

.badge-green  { background: rgba(22,163,74,0.10);   color: #15803d; }
.badge-yellow { background: rgba(255,194,0,0.12);   color: #92660a; }
.badge-red    { background: rgba(220,38,38,0.10);   color: #b91c1c; }
.badge-blue   { background: var(--primary-light);   color: #0369a1; }
.badge-purple { background: rgba(161,106,254,0.10); color: #6d28d9; }
.badge-gray   { background: rgba(156,163,175,0.10); color: #6b7280; }

/* Health — colores sutiles */
.health-good      { background: rgba(22,163,74,0.09);  color: #15803d; }
.health-at-risk   { background: rgba(255,194,0,0.12);  color: #92660a; }
.health-attention { background: rgba(220,38,38,0.09);  color: #b91c1c; }
.health-not-set   { background: rgba(156,163,175,0.10); color: #6b7280; }

/* Status */
.status-active   { background: var(--primary-light); color: #0369a1; }
.status-inactive { background: rgba(156,163,175,0.10); color: #6b7280; }
.status-pending  { background: rgba(255,194,0,0.12);  color: #92660a; }
.status-done     { background: rgba(22,163,74,0.10);  color: #15803d; }

/* ---- TABLE ---- */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
thead th {
  background: var(--bg);
  padding: 11px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--primary-light); }

/* ---- PROGRESS BAR ---- */
.progress-bar {
  height: 5px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  min-width: 80px;
}
.progress-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s ease;
}
.progress-green  { background: #22c55e; }
.progress-yellow { background: var(--yellow); }
.progress-red    { background: #ef4444; }
.progress-blue   { background: var(--blue); }

/* ---- AVATAR ---- */
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800;
  flex-shrink: 0;
  color: #fff;
}
.avatar-sm { width: 26px; height: 26px; font-size: 10px; }
.avatar-lg { width: 40px; height: 40px; font-size: 15px; }
.avatar-xl { width: 52px; height: 52px; font-size: 18px; }

/* Avatares — variantes de azul para consistencia */
.avatar-blue   { background: linear-gradient(135deg, #02adf5, #0284c7); }
.avatar-yellow { background: linear-gradient(135deg, #ffc200, #e6a800); color: #000; }
.avatar-green  { background: linear-gradient(135deg, #22c55e, #16a34a); }
.avatar-purple { background: linear-gradient(135deg, #a78bfa, #7c3aed); }
.avatar-pink   { background: linear-gradient(135deg, #f472b6, #db2777); }
.avatar-teal   { background: linear-gradient(135deg, #2dd4bf, #0d9488); }

.avatar-stack { display: flex; }
.avatar-stack .avatar { border: 2px solid var(--surface); margin-left: -8px; }
.avatar-stack .avatar:first-child { margin-left: 0; }

/* ---- BUTTON ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-family: 'Manrope', sans-serif;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.4;
}
.btn svg { width: 15px; height: 15px; }

/* Botón primario = AZUL */
.btn-primary {
  background: var(--blue);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 14px rgba(2,173,245,0.30);
}

/* Botón accent = AMARILLO (solo para acciones destacadas) */
.btn-accent {
  background: var(--yellow);
  color: #000;
}
.btn-accent:hover { background: #e6ae00; box-shadow: 0 4px 12px rgba(255,194,0,0.30); }

.btn-secondary {
  background: var(--surface);
  color: var(--text-primary);
  border: 1.5px solid var(--border);
}
.btn-secondary:hover { background: var(--bg); border-color: #d1d5db; }

.btn-blue { background: var(--blue); color: #fff; }
.btn-blue:hover { background: var(--primary-hover); }

.btn-danger { background: #fef2f2; color: #b91c1c; border: 1.5px solid #fecaca; }
.btn-danger:hover { background: #fee2e2; }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1.5px solid transparent;
}
.btn-ghost:hover { background: var(--bg); color: var(--text-primary); }

.btn-sm  { padding: 5px 12px; font-size: 12px; }
.btn-lg  { padding: 11px 22px; font-size: 14px; }

.btn-icon {
  padding: 7px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  transition: all var(--transition);
}
.btn-icon:hover { background: var(--primary-light); color: var(--blue); border-color: rgba(2,173,245,0.3); }
.btn-icon svg { width: 15px; height: 15px; }

/* ---- TAG CHIP ---- */
.tag {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 4px;
  white-space: nowrap;
}
/* Solo azul y gris — los otros sutiles */
.tag-blue   { background: var(--primary-light);       color: #0369a1; }
.tag-gray   { background: rgba(156,163,175,0.12);     color: #6b7280; }
.tag-yellow { background: rgba(255,194,0,0.12);        color: #92660a; }
.tag-green  { background: rgba(22,163,74,0.10);        color: #15803d; }
.tag-purple { background: rgba(161,106,254,0.10);      color: #6d28d9; }
.tag-red    { background: rgba(220,38,38,0.09);        color: #b91c1c; }

/* ---- MODAL ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13,13,13,0.50);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.15s ease;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.2s ease;
}
.modal-lg  { max-width: 720px; }
.modal-xl  { max-width: 900px; }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 26px 16px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  z-index: 1;
}
.modal-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-primary);
}
.modal-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 6px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center;
  transition: all var(--transition);
}
.modal-close:hover { background: var(--bg); color: var(--text-primary); }
.modal-close svg { width: 18px; height: 18px; }
.modal-body { padding: 20px 26px 26px; }
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 26px;
  border-top: 1px solid var(--border);
  background: #fafbfc;
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

/* ---- FORM ---- */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.2px;
}
.form-label .required { color: var(--blue); margin-left: 3px; }
.form-input {
  width: 100%;
  padding: 9px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Manrope', sans-serif;
  font-size: 13.5px;
  color: var(--text-primary);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(2,173,245,0.10);
}
.form-input::placeholder { color: var(--text-muted); }
select.form-input { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
textarea.form-input { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-hint { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }

/* Tags input dentro del form */
.tags-input-wrapper {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 7px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  min-height: 40px; align-items: center; cursor: text;
  transition: border-color var(--transition);
}
.tags-input-wrapper:focus-within { border-color: var(--blue); }
.tags-input-wrapper input { border: none; outline: none; font-family: Manrope; font-size: 13px; background: none; flex: 1; min-width: 80px; }

/* ---- TABS ---- */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
}
.tab {
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  background: none;
  font-family: 'Manrope', sans-serif;
  position: relative;
  transition: color var(--transition);
}
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--blue); font-weight: 700; }
.tab.active::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 0; right: 0;
  height: 2px;
  background: var(--blue);
  border-radius: 2px;
}
.tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--border);
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 700;
  border-radius: 10px;
  padding: 1px 6px;
  margin-left: 5px;
  line-height: 1.4;
}
.tab.active .tab-badge {
  background: rgba(2,173,245,0.12);
  color: var(--blue);
}

/* ---- EMPTY STATE ---- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  color: var(--text-muted);
}
.empty-state svg { width: 44px; height: 44px; color: #d1d5db; margin-bottom: 14px; }
.empty-state h3 { font-size: 15px; font-weight: 700; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state p { font-size: 13px; max-width: 280px; line-height: 1.5; }

/* ---- FILTER BAR ---- */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.filter-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  flex: 1;
  min-width: 200px;
  max-width: 320px;
  transition: border-color var(--transition);
}
.filter-search:focus-within { border-color: var(--blue); }
.filter-search svg { width: 14px; height: 14px; color: var(--text-muted); flex-shrink: 0; }
.filter-search input {
  border: none; background: none;
  font-family: 'Manrope', sans-serif;
  font-size: 13px; color: var(--text-primary);
  outline: none; width: 100%;
}
.filter-select {
  padding: 7px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Manrope', sans-serif;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--surface);
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition);
}
.filter-select:focus { border-color: var(--blue); }

/* ---- SECTION HEADER ---- */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.section-title { font-size: 15px; font-weight: 800; color: var(--text-primary); }
.section-link {
  font-size: 12px; font-weight: 600;
  color: var(--blue); text-decoration: none; cursor: pointer;
}
.section-link:hover { text-decoration: underline; }

/* ---- ACTIVITY ---- */
.activity-list { display: flex; flex-direction: column; }
.activity-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border-light);
}
.activity-item:last-child { border-bottom: none; }
.activity-icon {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: 1px;
  background: var(--primary-light);
  color: var(--blue);
}
.activity-icon svg { width: 13px; height: 13px; }
.activity-content { flex: 1; min-width: 0; }
.activity-text { font-size: 13px; color: var(--text-primary); line-height: 1.4; }
.activity-text strong { font-weight: 700; }
.activity-time { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ---- PIPELINE ---- */
.pipeline-col {
  background: var(--bg);
  border-radius: var(--radius-lg);
  padding: 12px;
  min-width: 230px;
  flex-shrink: 0;
  border: 1px solid var(--border);
}
.pipeline-col-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px; padding: 0 4px;
}
.pipeline-col-title { font-size: 11.5px; font-weight: 800; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; }
.pipeline-col-count { font-size: 11px; font-weight: 700; color: var(--text-muted); background: var(--surface); border: 1px solid var(--border); border-radius: 50px; padding: 1px 8px; }
.pipeline-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 14px; margin-bottom: 8px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: box-shadow var(--transition), transform var(--transition);
}
.pipeline-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.pipeline-card-name { font-size: 13.5px; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; }
.pipeline-card-value { font-size: 16px; font-weight: 800; color: var(--blue); margin-bottom: 8px; }
.pipeline-card-meta { font-size: 11.5px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.pipeline-card-meta svg { width: 12px; height: 12px; }

/* ---- CHART ---- */
.chart-container { position: relative; height: 220px; }

/* ---- METRIC ROW ---- */
.metric-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid var(--border-light);
}
.metric-row:last-child { border-bottom: none; }
.metric-label { font-size: 13px; color: var(--text-secondary); font-weight: 500; }
.metric-value { font-size: 14px; font-weight: 800; color: var(--text-primary); }

/* ---- ANIMATIONS ---- */
@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideIn      { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: translateX(0); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(24px);  } to { opacity: 1; transform: translateX(0); } }

/* ---- CLIENT DETAIL PANEL ---- */
.detail-panel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}
.detail-stat {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
}
.detail-stat-label { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.3px; margin-bottom: 4px; }
.detail-stat-value { font-size: 20px; font-weight: 800; color: var(--text-primary); }

/* ---- TOAST NOTIFICATION ---- */
.toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 2000;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: #0d0d0d;
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 10px;
  animation: slideUp 0.2s ease;
  max-width: 320px;
}
.toast svg { width: 16px; height: 16px; flex-shrink: 0; }
.toast-success { border-left: 3px solid var(--blue); }
.toast-error   { border-left: 3px solid #ef4444; }

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }
