/* ================================================
   DASHBOARD ELEGANTE - Diseño SaaS Profesional
   ================================================ */

.dash-wrapper {
  padding: 28px 32px;
  max-width: 1600px;
  margin: 0 auto;
}

/* ============ HEADER ============ */
.dash-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
  padding-bottom: 28px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--border);
}

.dash-brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.dash-brand-icon {
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, #39a900 0%, #2d8400 100%);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(57, 169, 0, 0.35);
}

.dash-title {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: -0.5px;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.dash-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 2px 0 0 0;
  font-weight: 500;
}

.dash-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* ============ FILTRO ============ */
.dash-filter {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px 4px 4px 14px;
  transition: all 0.2s ease;
  min-width: 260px;
}

.dash-filter:hover { border-color: var(--border-strong); }
.dash-filter:focus-within { border-color: var(--sena-green); box-shadow: 0 0 0 3px rgba(57,169,0,0.1); }

.dash-filter-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-right: 12px;
  margin-bottom: 0;
  white-space: nowrap;
}

.dash-select {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 10px;
  cursor: pointer;
  outline: none;
  flex: 1;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238896b3' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 26px;
}

.dash-select option { background: var(--bg-card); color: var(--text-primary); }

/* ============ BOTONES ============ */
.dash-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.dash-btn-primary {
  background: linear-gradient(135deg, #39a900 0%, #2d8400 100%);
  color: white;
  box-shadow: 0 4px 14px rgba(57, 169, 0, 0.3);
}
.dash-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(57, 169, 0, 0.4); }

.dash-btn-ghost {
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  width: 40px;
  justify-content: center;
  padding: 10px;
}
.dash-btn-ghost:hover { background: var(--bg-card-hover); color: var(--text-primary); }

/* ============ KPI GRID ============ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.kpi-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-strong);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.25);
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px;
  height: 100%;
  background: var(--sena-green);
  opacity: 0;
  transition: opacity 0.3s;
}

.kpi-card:hover::before { opacity: 1; }

.kpi-emerald::before { background: #39a900; }
.kpi-blue::before { background: #1890ff; }
.kpi-amber::before { background: #fa8c16; }
.kpi-violet::before { background: #722ed1; }
.kpi-rose::before { background: #ff4d4f; }

.kpi-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.kpi-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  background: rgba(255,255,255,0.04);
}

.kpi-emerald .kpi-icon { background: rgba(57,169,0,0.12); color: #52c41a; }
.kpi-blue .kpi-icon { background: rgba(24,144,255,0.12); color: #1890ff; }
.kpi-amber .kpi-icon { background: rgba(250,140,22,0.12); color: #fa8c16; }
.kpi-violet .kpi-icon { background: rgba(114,46,209,0.12); color: #9254de; }
.kpi-rose .kpi-icon { background: rgba(255,77,79,0.12); color: #ff4d4f; }

.kpi-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(255,255,255,0.05);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.kpi-value {
  font-size: 32px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -1px;
  line-height: 1;
  margin-bottom: 6px;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.kpi-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Featured KPI (Avance) */
.kpi-featured {
  background: linear-gradient(135deg, #2d8400 0%, #39a900 60%, #52c41a 100%);
  border: none;
  color: white;
}

.kpi-featured::before { display: none; }
.kpi-featured .kpi-icon { background: rgba(255,255,255,0.2); color: white; }
.kpi-tag-light {
  font-size: 10px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(255,255,255,0.2);
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}
.kpi-value-light {
  font-size: 32px;
  font-weight: 800;
  color: white;
  letter-spacing: -1px;
  line-height: 1;
  margin-bottom: 6px;
  font-family: 'Plus Jakarta Sans', sans-serif;
}
.kpi-label-light { font-size: 12px; color: rgba(255,255,255,0.85); font-weight: 500; }

/* ============ ROWS & CARDS ============ */
.dash-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.dash-row-3 {
  grid-template-columns: repeat(3, 1fr);
}

.span-2 { grid-column: span 1; }

.dash-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  transition: border-color 0.2s;
}

.dash-card:hover { border-color: var(--border-strong); }

.dash-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 20px 22px 14px;
}

.dash-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.dash-card-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin: 4px 0 0 0;
  font-weight: 500;
}

.dash-card-body { padding: 6px 22px 22px; }

/* ============ CHIPS ============ */
.chip {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.chip-emerald { background: rgba(57,169,0,0.12); color: #52c41a; border: 1px solid rgba(57,169,0,0.2); }
.chip-blue { background: rgba(24,144,255,0.12); color: #1890ff; border: 1px solid rgba(24,144,255,0.2); }
.chip-amber { background: rgba(250,140,22,0.12); color: #fa8c16; border: 1px solid rgba(250,140,22,0.2); }
.chip-rose { background: rgba(255,77,79,0.12); color: #ff4d4f; border: 1px solid rgba(255,77,79,0.2); }

/* ============ ACTIVITY LIST ============ */
.activity-list { list-style: none; padding: 0; margin: 0; }

.activity-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.activity-row:last-child { border-bottom: none; }

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.activity-dot.is-green { background: #39a900; box-shadow: 0 0 12px rgba(57,169,0,0.5); }
.activity-dot.is-amber { background: #fa8c16; box-shadow: 0 0 12px rgba(250,140,22,0.5); }

.activity-info { flex: 1; min-width: 0; }
.activity-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.activity-desc {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.activity-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}
.activity-time { font-size: 10px; color: var(--text-muted); }

/* ============ RANKING ============ */
.rank-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
}

.rank-pos {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  background: var(--bg-input);
  color: var(--text-secondary);
  flex-shrink: 0;
}

.rank-pos.rank-1 { background: linear-gradient(135deg, #f59e0b, #d97706); color: white; }
.rank-pos.rank-2 { background: linear-gradient(135deg, #94a3b8, #64748b); color: white; }
.rank-pos.rank-3 { background: linear-gradient(135deg, #d97706, #92400e); color: white; }

.rank-info { flex: 1; min-width: 0; }
.rank-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rank-bar {
  height: 5px;
  background: rgba(255,255,255,0.05);
  border-radius: 4px;
  overflow: hidden;
}
.rank-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #39a900, #52c41a);
  border-radius: 4px;
  transition: width 0.6s ease;
}

.rank-pct {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  min-width: 42px;
  text-align: right;
}

/* ============ RISK SEMÁFORO ============ */
.risk-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.risk-row:last-child { border-bottom: none; }

.risk-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.risk-dot.is-green { background: #39a900; box-shadow: 0 0 10px rgba(57,169,0,0.5); }
.risk-dot.is-amber { background: #fa8c16; box-shadow: 0 0 10px rgba(250,140,22,0.5); }
.risk-dot.is-red { background: #ff4d4f; box-shadow: 0 0 10px rgba(255,77,79,0.5); }

.risk-info { flex: 1; min-width: 0; }
.risk-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.risk-meta { font-size: 10px; color: var(--text-muted); margin-top: 2px; }

/* ============ ALERT BANNER ============ */
.dash-alert {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-radius: 12px;
  margin-bottom: 16px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid;
}

.dash-alert.danger { background: rgba(255,77,79,0.08); border-color: rgba(255,77,79,0.25); color: #ff7875; }
.dash-alert.warning { background: rgba(250,140,22,0.08); border-color: rgba(250,140,22,0.25); color: #ffa940; }

.dash-alert-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

/* ============ EMPTY ============ */
.empty-msg {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
  font-size: 13px;
}

/* ============ ANIMATION ============ */
.fade-in-up { animation: fadeInUp 0.5s cubic-bezier(0.4, 0, 0.2, 1); }
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============ RESPONSIVE ============ */
@media (max-width: 1100px) {
  .dash-row { grid-template-columns: 1fr; }
  .dash-row-3 { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .dash-wrapper { padding: 16px; }
  .dash-header { flex-direction: column; align-items: stretch; }
  .dash-filter { min-width: 0; width: 100%; }
}
