/* ============================================================
   RiskPerception Pro v2.0 - Sistema de Diseño Global
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700;800&family=DM+Sans:wght@300;400;500;600&display=swap');

/* --- Variables & Tema --- */
:root {
  --rp-red:        #8B1A1A;
  --rp-red-light:  #C0392B;
  --rp-red-dark:   #5a0f0f;
  --rp-gold:       #D4A853;
  --rp-gold-light: #F4D03F;
  --rp-bg:         #F0F2F5;
  --rp-card:       #FFFFFF;
  --rp-sidebar:    #1a0505;
  --rp-text:       #1e2937;
  --rp-muted:      #6B7280;
  --rp-border:     #E5E7EB;
  --rp-success:    #059669;
  --rp-warning:    #D97706;
  --rp-danger:     #DC2626;
  --rp-info:       #0284C7;
  --sidebar-w:     260px;
  --header-h:      64px;
  --radius:        12px;
  --radius-sm:     8px;
  --shadow:        0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  --shadow-lg:     0 8px 32px rgba(0,0,0,.12);
  --transition:    all .2s ease;
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
  color: var(--rp-text);
  background: var(--rp-bg);
  min-height: 100vh;
}
h1,h2,h3,h4,h5,h6 { font-family: 'Sora', sans-serif; font-weight: 600; line-height: 1.3; }
a { color: var(--rp-red); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--rp-red-light); }
img { max-width: 100%; }

/* ============================================================
   LANDING / AUTH
   ============================================================ */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  background: linear-gradient(135deg, #1a0505 0%, var(--rp-red-dark) 40%, var(--rp-red) 100%);
  position: relative;
  overflow: hidden;
}
.auth-wrapper::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E") repeat;
}
.auth-left {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 60px;
  color: white;
  position: relative;
  z-index: 1;
}
.auth-left .brand {
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 60px;
}
.auth-left .brand-icon {
  width: 52px; height: 52px;
  background: rgba(255,255,255,.15);
  border: 2px solid rgba(255,255,255,.3);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
}
.auth-left h1 { font-size: 2.8rem; font-weight: 800; margin-bottom: 16px; }
.auth-left p { font-size: 1.1rem; color: rgba(255,255,255,.75); line-height: 1.7; max-width: 440px; }
.auth-features { list-style: none; margin-top: 40px; }
.auth-features li {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0;
  color: rgba(255,255,255,.85);
  font-size: 0.95rem;
}
.auth-features li i { color: var(--rp-gold); font-size: 18px; width: 24px; }

.auth-right {
  width: 460px;
  background: var(--rp-card);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 60px 48px;
  position: relative;
  z-index: 1;
}
.auth-right .login-logo {
  text-align: center;
  margin-bottom: 40px;
}
.auth-right .login-logo img { max-height: 80px; }
.auth-title { font-size: 1.6rem; font-weight: 700; margin-bottom: 8px; }
.auth-sub { color: var(--rp-muted); margin-bottom: 32px; font-size: 0.9rem; }

/* Auth: Empresa login (centered) */
.auth-center {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--rp-bg);
}
.auth-card {
  background: var(--rp-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 48px;
  width: 100%;
  max-width: 440px;
}
.empresa-badge {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  margin-bottom: 28px;
  border: 1.5px solid var(--rp-border);
}
.empresa-badge img { width: 44px; height: 44px; object-fit: contain; border-radius: 6px; }
.empresa-badge .empresa-info h5 { font-size: 0.95rem; margin: 0; }
.empresa-badge .empresa-info span { font-size: 0.8rem; color: var(--rp-muted); }

/* ============================================================
   FORM ELEMENTS
   ============================================================ */
.form-label { font-weight: 500; font-size: 0.875rem; color: var(--rp-text); margin-bottom: 6px; }
.form-control, .form-select {
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--rp-border);
  padding: 10px 14px;
  font-size: 0.9rem;
  transition: var(--transition);
  background: var(--rp-bg);
}
.form-control:focus, .form-select:focus {
  border-color: var(--rp-red);
  box-shadow: 0 0 0 3px rgba(139,26,26,.1);
  background: white;
}
.btn {
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  font-weight: 600;
  font-size: 0.9rem;
  transition: var(--transition);
  border: none;
  cursor: pointer;
}
.btn-primary {
  background: var(--rp-red);
  color: white;
}
.btn-primary:hover { background: var(--rp-red-dark); color: white; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(139,26,26,.3); }
.btn-outline-primary {
  border: 1.5px solid var(--rp-red);
  color: var(--rp-red);
  background: transparent;
}
.btn-outline-primary:hover { background: var(--rp-red); color: white; }
.btn-success { background: var(--rp-success); color: white; }
.btn-success:hover { background: #047857; color: white; }
.btn-warning { background: var(--rp-warning); color: white; }
.btn-danger { background: var(--rp-danger); color: white; }
.btn-danger:hover { background: #B91C1C; color: white; }
.btn-light { background: white; color: var(--rp-text); border: 1.5px solid var(--rp-border); }
.btn-light:hover { background: var(--rp-bg); }
.btn-gold { background: var(--rp-gold); color: white; }
.btn-gold:hover { background: #B8892A; color: white; }
.btn-lg { padding: 13px 28px; font-size: 1rem; border-radius: 10px; }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }

/* ============================================================
   LAYOUT - SIDEBAR
   ============================================================ */
.app-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--rp-sidebar);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
}
.sidebar-brand {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar-brand .brand-icon {
  width: 38px; height: 38px;
  background: var(--rp-red);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: white; flex-shrink: 0;
}
.sidebar-brand .brand-text { line-height: 1.2; }
.sidebar-brand .brand-text span { display: block; font-family: 'Sora', sans-serif; font-weight: 700; font-size: 0.95rem; color: white; }
.sidebar-brand .brand-text small { font-size: 0.7rem; color: rgba(255,255,255,.4); }

.sidebar-section { padding: 20px 12px 8px; }
.sidebar-section-title {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(255,255,255,.3);
  padding: 0 8px;
  margin-bottom: 4px;
}
.sidebar-nav { list-style: none; }
.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: rgba(255,255,255,.65);
  font-size: 0.88rem;
  font-weight: 500;
  transition: var(--transition);
}
.sidebar-nav li a i { width: 18px; text-align: center; font-size: 14px; }
.sidebar-nav li a:hover { background: rgba(255,255,255,.07); color: white; }
.sidebar-nav li a.active { background: var(--rp-red); color: white; }

.sidebar-footer {
  margin-top: auto;
  padding: 16px 12px;
  border-top: 1px solid rgba(255,255,255,.06);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
}
.sidebar-user .user-avatar {
  width: 34px; height: 34px;
  background: var(--rp-red);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: white; font-weight: 700; flex-shrink: 0;
}
.sidebar-user .user-info span { display: block; font-size: 0.8rem; color: rgba(255,255,255,.85); font-weight: 500; }
.sidebar-user .user-info small { font-size: 0.7rem; color: rgba(255,255,255,.4); }
.sidebar-user a.logout { color: rgba(255,255,255,.5); font-size: 14px; margin-left: auto; }
.sidebar-user a.logout:hover { color: var(--rp-gold); }

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.topbar {
  height: var(--header-h);
  background: var(--rp-card);
  border-bottom: 1px solid var(--rp-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-title { font-size: 1.1rem; font-weight: 700; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }

.page-content { padding: 28px; flex: 1; }

/* ============================================================
   CARDS & STATS
   ============================================================ */
.card {
  background: var(--rp-card);
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.05);
  border: 1px solid var(--rp-border);
  transition: box-shadow .2s;
}
.card-header {
  background: transparent;
  border-bottom: 1px solid var(--rp-border);
  padding: 16px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-header h5 { font-size: 1rem; font-weight: 600; margin: 0; }
.card-body { padding: 24px; }

.stat-card {
  background: var(--rp-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: var(--transition);
  border: 1.5px solid transparent;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.stat-icon.red   { background: rgba(139,26,26,.1);  color: var(--rp-red); }
.stat-icon.gold  { background: rgba(212,168,83,.15); color: var(--rp-gold); }
.stat-icon.green { background: rgba(5,150,105,.1);   color: var(--rp-success); }
.stat-icon.blue  { background: rgba(2,132,199,.1);   color: var(--rp-info); }
.stat-icon.orange{ background: rgba(217,119,6,.1);   color: var(--rp-warning); }

.stat-body h3 { font-size: 2rem; font-weight: 800; line-height: 1; color: var(--rp-text); }
.stat-body p  { font-size: 0.8rem; color: var(--rp-muted); margin: 4px 0 0; font-weight: 500; }
.stat-body .trend { font-size: 0.75rem; margin-top: 6px; }
.trend-up   { color: var(--rp-success); }
.trend-down { color: var(--rp-danger); }

/* ============================================================
   TABLES
   ============================================================ */
.table-rp { width: 100%; border-collapse: collapse; }
.table-rp thead tr { border-bottom: 2px solid var(--rp-border); }
.table-rp thead th {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--rp-muted);
  padding: 12px 16px;
  white-space: nowrap;
}
.table-rp tbody tr {
  border-bottom: 1px solid var(--rp-border);
  transition: var(--transition);
}
.table-rp tbody tr:last-child { border-bottom: none; }
.table-rp tbody tr:hover { background: rgba(139,26,26,.03); }
.table-rp tbody td { padding: 14px 16px; font-size: 0.88rem; vertical-align: middle; }

/* ============================================================
   BADGES & NIVELES
   ============================================================ */
.badge-nivel {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}
.nivel-alto    { background: rgba(5,150,105,.12);  color: #065F46; }
.nivel-medio   { background: rgba(217,119,6,.12);  color: #92400E; }
.nivel-bajo    { background: rgba(220,38,38,.12);  color: #991B1B; }
.nivel-muy-alto{ background: rgba(2,132,199,.12);  color: #075985; }

/* Barra de progreso */
.progress-rp {
  height: 8px;
  background: var(--rp-border);
  border-radius: 4px;
  overflow: hidden;
}
.progress-rp-bar {
  height: 100%;
  border-radius: 4px;
  transition: width .6s ease;
}

/* ============================================================
   IGPR GAUGE
   ============================================================ */
.igpr-display {
  text-align: center;
  padding: 32px 24px;
}
.igpr-score {
  font-family: 'Sora', sans-serif;
  font-size: 4.5rem;
  font-weight: 800;
  line-height: 1;
  color: var(--rp-red);
}
.igpr-score sup { font-size: 1.5rem; font-weight: 400; color: var(--rp-muted); }
.igpr-label { font-size: 0.9rem; color: var(--rp-muted); margin-top: 8px; }
.igpr-nivel {
  display: inline-block;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-top: 12px;
}

/* ============================================================
   TEST / EVALUACIÓN
   ============================================================ */
.test-wrapper {
  max-width: 760px;
  margin: 0 auto;
  padding: 28px 20px;
}
.test-header {
  background: linear-gradient(135deg, var(--rp-red-dark), var(--rp-red));
  color: white;
  border-radius: var(--radius);
  padding: 28px 32px;
  margin-bottom: 24px;
}
.test-progress-bar {
  height: 6px;
  background: rgba(255,255,255,.25);
  border-radius: 3px;
  margin-top: 16px;
  overflow: hidden;
}
.test-progress-fill {
  height: 100%;
  background: var(--rp-gold);
  border-radius: 3px;
  transition: width .4s ease;
}
.question-card {
  background: var(--rp-card);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.question-number {
  font-size: 0.75rem;
  color: var(--rp-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 12px;
}
.question-text {
  font-size: 1.05rem;
  font-weight: 500;
  line-height: 1.6;
  margin-bottom: 24px;
  color: var(--rp-text);
}
.likert-scale {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.likert-option {
  flex: 1;
  min-width: 80px;
}
.likert-option input[type="radio"] { display: none; }
.likert-option label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 8px;
  border: 2px solid var(--rp-border);
  border-radius: 10px;
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.78rem;
  color: var(--rp-muted);
  text-align: center;
  background: white;
  font-weight: 500;
}
.likert-option label .likert-num {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--rp-text);
}
.likert-option input:checked + label {
  border-color: var(--rp-red);
  background: rgba(139,26,26,.06);
  color: var(--rp-red);
}
.likert-option input:checked + label .likert-num { color: var(--rp-red); }
.likert-option label:hover {
  border-color: var(--rp-red-light);
  background: rgba(139,26,26,.04);
}
.test-nav {
  background: white;
  position: sticky;
  bottom: 0;
  padding: 16px 20px;
  border-top: 1px solid var(--rp-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 -4px 20px rgba(0,0,0,.08);
}
.area-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(139,26,26,.1);
  color: var(--rp-red);
  margin-bottom: 12px;
}

/* ============================================================
   RESULTADO INDIVIDUAL
   ============================================================ */
.resultado-hero {
  background: linear-gradient(135deg, var(--rp-red-dark), var(--rp-red));
  color: white;
  padding: 48px 40px;
  border-radius: var(--radius);
  text-align: center;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}
.resultado-hero::after {
  content: '';
  position: absolute;
  right: -40px; top: -40px;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: rgba(255,255,255,.05);
}
.resultado-igpr {
  font-family: 'Sora', sans-serif;
  font-size: 5rem;
  font-weight: 800;
  line-height: 1;
}
.resultado-nivel-badge {
  display: inline-block;
  padding: 8px 24px;
  border-radius: 24px;
  background: rgba(255,255,255,.2);
  border: 1.5px solid rgba(255,255,255,.4);
  font-weight: 600;
  font-size: 0.95rem;
  margin-top: 12px;
}
.kpi-box {
  text-align: center;
  padding: 20px;
  background: var(--rp-bg);
  border-radius: var(--radius-sm);
}
.kpi-box .kpi-val { font-family: 'Sora', sans-serif; font-size: 2rem; font-weight: 700; }
.kpi-box .kpi-label { font-size: 0.75rem; color: var(--rp-muted); font-weight: 500; margin-top: 4px; }
.dimension-row {
  padding: 16px 0;
  border-bottom: 1px solid var(--rp-border);
}
.dimension-row:last-child { border-bottom: none; }
.dimension-name { font-weight: 600; font-size: 0.9rem; }
.dimension-score { font-family: 'Sora', sans-serif; font-weight: 700; font-size: 1.1rem; }

/* ============================================================
   INFORME GERENCIAL
   ============================================================ */
.informe-wrapper { max-width: 900px; margin: 0 auto; }

.informe-cover {
  background: white;
  border-radius: var(--radius);
  padding: 60px 56px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
  border-top: 8px solid var(--rp-red);
}
.informe-header-strip {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 32px;
  border-bottom: 2px solid var(--rp-border);
  margin-bottom: 40px;
}
.informe-section {
  background: white;
  border-radius: var(--radius);
  padding: 40px 48px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.informe-section h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--rp-red);
  padding-bottom: 12px;
  border-bottom: 2px solid var(--rp-border);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.informe-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
  font-size: 0.9rem;
}
.informe-table thead tr { background: var(--rp-red); color: white; }
.informe-table thead th { padding: 12px 16px; font-weight: 600; text-align: center; }
.informe-table tbody tr:nth-child(even) { background: #FEF2F2; }
.informe-table tbody td { padding: 11px 16px; border-bottom: 1px solid #FEE2E2; text-align: center; }
.informe-table tbody td:first-child { text-align: left; font-weight: 600; }

.fortaleza-card {
  padding: 16px 20px;
  border-left: 4px solid var(--rp-red);
  background: #FEF2F2;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 12px;
}
.fortaleza-card h6 { font-weight: 700; color: var(--rp-red); margin-bottom: 4px; font-size: 0.9rem; }
.fortaleza-card p { font-size: 0.85rem; color: var(--rp-text); margin: 0; line-height: 1.6; }

.rec-card {
  padding: 16px 20px;
  background: var(--rp-bg);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  border: 1px solid var(--rp-border);
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.rec-card .rec-num {
  width: 28px; height: 28px;
  background: var(--rp-red);
  color: white;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700; flex-shrink: 0;
}
.rec-card .rec-body h6 { font-weight: 600; font-size: 0.88rem; margin-bottom: 3px; }
.rec-card .rec-body p  { font-size: 0.82rem; color: var(--rp-muted); margin: 0; line-height: 1.5; }

/* ============================================================
   DISTRIBUCIÓN IGPR (Donuts / barras)
   ============================================================ */
.dist-bar { display: flex; height: 32px; border-radius: 8px; overflow: hidden; margin: 16px 0; }
.dist-bar-seg { display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 700; color: white; transition: width .6s ease; }

/* ============================================================
   PRINT STYLES (Informe)
   ============================================================ */
@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .informe-section { box-shadow: none !important; break-inside: avoid; }
  body { background: white; }
  .btn { display: none; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 992px) {
  .auth-left { display: none; }
  .auth-right { width: 100%; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
}

/* ============================================================
   UTILITIES
   ============================================================ */
.text-red    { color: var(--rp-red) !important; }
.text-gold   { color: var(--rp-gold) !important; }
.text-muted  { color: var(--rp-muted) !important; }
.bg-red      { background: var(--rp-red) !important; }
.bg-red-soft { background: rgba(139,26,26,.08) !important; }
.divider { height: 1px; background: var(--rp-border); margin: 24px 0; }
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--rp-red);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}
.chip-success { background: rgba(5,150,105,.1); color: #065F46; }
.chip-warning { background: rgba(217,119,6,.1); color: #92400E; }
.chip-danger  { background: rgba(220,38,38,.1); color: #991B1B; }
.chip-info    { background: rgba(2,132,199,.1); color: #075985; }

.empty-state {
  text-align: center;
  padding: 60px 40px;
  color: var(--rp-muted);
}
.empty-state i { font-size: 3rem; opacity: .3; margin-bottom: 16px; display: block; }
.empty-state h5 { color: var(--rp-text); margin-bottom: 8px; }

/* Animations */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeIn .3s ease; }

/* ============================================================
   AUTH PAGES
   ============================================================ */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
}
.auth-left {
  flex: 1;
  background: linear-gradient(160deg, var(--rp-red-dark) 0%, var(--rp-red) 100%);
  padding: 56px 48px;
  display: flex;
  flex-direction: column;
  color: white;
  min-width: 360px;
}
.auth-left h1 {
  font-family: 'Sora', sans-serif;
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.25;
  margin: 32px 0 16px;
  color: white;
}
.auth-left p { font-size: .9rem; opacity: .75; line-height: 1.7; max-width: 380px; }
.auth-features { list-style: none; padding: 0; margin-top: 28px; }
.auth-features li { padding: 8px 0; font-size: .88rem; opacity: .8; display: flex; align-items: center; gap: 10px; }
.auth-features li i { opacity: .7; width: 16px; }
.auth-right {
  width: 520px;
  flex-shrink: 0;
  background: white;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 56px 48px;
}
.auth-center {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--rp-bg);
  padding: 24px;
}
.auth-card {
  background: white;
  border-radius: 18px;
  padding: 32px;
  box-shadow: 0 4px 32px rgba(0,0,0,.08);
}
.auth-title { font-family: 'Sora', sans-serif; font-size: 1.5rem; font-weight: 800; }
.auth-sub { color: var(--rp-muted); font-size: .88rem; margin-top: 4px; }
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 40px; }
.brand-icon {
  width: 48px; height: 48px;
  background: rgba(255,255,255,.15);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; color: white;
}
@media (max-width: 900px) {
  .auth-left { display: none; }
  .auth-right { width: 100%; padding: 40px 28px; }
}

/* ============================================================
   STAT CARDS (dashboard)
   ============================================================ */
.stat-card {
  background: white;
  border-radius: 16px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.05);
  border: 1px solid var(--rp-border);
  transition: transform .2s, box-shadow .2s;
  position: relative;
  overflow: hidden;
}
.stat-card::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--rp-red), var(--rp-gold));
  opacity: 0;
  transition: opacity .2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.1); }
.stat-card:hover::after { opacity: 1; }

.stat-icon {
  width: 48px; height: 48px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.stat-icon.red    { background: rgba(139,26,26,.1);  color: var(--rp-red); }
.stat-icon.gold   { background: rgba(212,168,83,.15); color: var(--rp-gold); }
.stat-icon.green  { background: rgba(5,150,105,.1);  color: #059669; }
.stat-icon.blue   { background: rgba(2,132,199,.1);  color: #0284C7; }
.stat-icon.orange { background: rgba(234,88,12,.1);  color: #EA580C; }
.stat-icon.info   { background: rgba(99,102,241,.1); color: #6366F1; }

.stat-body { min-width: 0; flex: 1; }
.stat-body h3 { font-family: 'Sora', sans-serif; font-size: 2rem; font-weight: 900; color: var(--rp-text); line-height: 1; margin: 0 0 5px; }
.stat-body p  { font-size: .8rem; color: var(--rp-muted); font-weight: 500; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trend { font-size: .74rem; margin-top: 5px; font-weight: 700; display: flex; align-items: center; gap: 3px; }
.trend-up   { color: #059669; }
.trend-down { color: #DC2626; }
.trend-neutral { color: var(--rp-muted); }

/* ── STAT CARD MOBILE ── */
@media (max-width: 576px) {
  .stat-card {
    padding: 16px 14px;
    border-radius: 14px;
    gap: 12px;
  }
  .stat-icon {
    width: 42px; height: 42px;
    border-radius: 11px;
    font-size: 17px;
  }
  .stat-body h3 { font-size: 1.7rem; }
  .stat-body p  { font-size: .75rem; }
}

/* ============================================================
   IGPR DISPLAY
   ============================================================ */
.igpr-display { text-align: center; padding: 16px 0; }
.igpr-score {
  font-family: 'Sora', sans-serif;
  font-size: 4rem;
  font-weight: 900;
  color: var(--rp-red);
  line-height: 1;
}
.igpr-score sup { font-size: 1.5rem; color: var(--rp-muted); font-weight: 400; }
.igpr-label { font-size: .8rem; color: var(--rp-muted); margin: 8px 0; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; }
.igpr-nivel {
  display: inline-block;
  padding: 6px 20px;
  border-radius: 20px;
  font-weight: 700;
  font-size: .85rem;
  margin-top: 4px;
}
.bg-interdependiente { background: #0284C7; }
.bg-independiente    { background: #059669; }
.bg-dependiente      { background: #D97706; }
.bg-desarrollo       { background: #DC2626; }
.bg-reactivo         { background: #9CA3AF; }

/* Niveles de percepción (por área) */
.badge-nivel {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.nivel-alto  { background: #D1FAE5; color: #065F46; }
.nivel-medio { background: #FEF3C7; color: #92400E; }
.nivel-bajo  { background: #FEE2E2; color: #991B1B; }
/* IGPR levels */
.nivel-muy-alto, .nivel-muy\.alto      { background: #DBEAFE; color: #1D4ED8; }
.nivel-alto-independiente              { background: #D1FAE5; color: #065F46; }
.nivel-adecuado-dependiente            { background: #FEF3C7; color: #92400E; }
.nivel-medio-en.desarrollo             { background: #FFEDD5; color: #9A3412; }
.nivel-bajo-reactivo                   { background: #FEE2E2; color: #991B1B; }

/* ============================================================
   TEST PAGE
   ============================================================ */
.test-wrapper { max-width: 720px; margin: 0 auto; padding: 24px 20px 80px; }
.test-header {
  background: var(--rp-red);
  color: white;
  border-radius: 16px;
  padding: 20px 24px;
  margin-bottom: 24px;
}
.test-progress-bar {
  height: 6px;
  background: rgba(255,255,255,.2);
  border-radius: 3px;
  margin-top: 10px;
  overflow: hidden;
}
.test-progress-fill {
  height: 100%;
  background: var(--rp-gold);
  border-radius: 3px;
  transition: width .4s ease;
}
.question-card {
  background: white;
  border-radius: 14px;
  padding: 24px;
  margin-bottom: 16px;
  border: 2px solid var(--rp-border);
  transition: border-color .2s, background .2s;
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
}
.area-indicator {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 10px;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 10px;
}
.question-number { font-size: .75rem; color: var(--rp-muted); font-weight: 600; margin-bottom: 6px; }
.question-text { font-size: 1rem; font-weight: 600; line-height: 1.55; color: var(--rp-text); margin-bottom: 20px; }
.likert-scale { display: flex; gap: 8px; flex-wrap: wrap; }
.likert-option { flex: 1; min-width: 100px; }
.likert-option input[type=radio] { display: none; }
.likert-option label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 8px;
  border-radius: 10px;
  border: 2px solid var(--rp-border);
  cursor: pointer;
  font-size: .75rem;
  font-weight: 500;
  text-align: center;
  transition: all .15s;
  color: var(--rp-muted);
  line-height: 1.3;
}
.likert-option label:hover { border-color: var(--rp-red); background: rgba(139,26,26,.04); color: var(--rp-red); }
.likert-option input:checked + label { border-color: var(--rp-red); background: var(--rp-red); color: white; }
.likert-num { font-family: 'Sora', sans-serif; font-size: 1.3rem; font-weight: 800; display: block; }
.test-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: white;
  border-top: 1px solid var(--rp-border);
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 100;
  box-shadow: 0 -4px 20px rgba(0,0,0,.08);
}

/* ============================================================
   RESULTADO INDIVIDUAL
   ============================================================ */
.resultado-hero {
  background: linear-gradient(135deg, var(--rp-red-dark), var(--rp-red));
  border-radius: var(--radius);
  padding: 40px 32px;
  text-align: center;
  color: white;
  margin-bottom: 28px;
}
.resultado-igpr {
  font-family: 'Sora', sans-serif;
  font-size: 5rem;
  font-weight: 900;
  line-height: 1;
  margin-bottom: 12px;
}
.resultado-nivel-badge {
  display: inline-block;
  background: rgba(255,255,255,.18);
  border: 1.5px solid rgba(255,255,255,.3);
  padding: 8px 24px;
  border-radius: 24px;
  font-weight: 700;
  font-size: .95rem;
}
.kpi-box {
  background: white;
  border-radius: var(--radius);
  padding: 20px 16px;
  text-align: center;
  box-shadow: var(--shadow);
  border: 1px solid var(--rp-border);
}
.kpi-val { font-family: 'Sora', sans-serif; font-size: 2.2rem; font-weight: 800; line-height: 1; margin-bottom: 6px; }
.kpi-label { font-size: .75rem; color: var(--rp-muted); font-weight: 600; }
.dimension-row { margin-bottom: 16px; }
.dimension-name { font-weight: 600; font-size: .88rem; }
.dimension-score { font-family: 'Sora', sans-serif; font-size: 1rem; font-weight: 800; }

/* ============================================================
   INFORME GERENCIAL
   ============================================================ */
.informe-cover {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--rp-border);
  overflow: hidden;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.informe-header-strip {
  background: linear-gradient(135deg, var(--rp-red-dark), var(--rp-red));
  padding: 28px 32px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  color: white;
}
.informe-cover > div:last-child { padding: 28px 32px; }
.informe-section {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--rp-border);
  padding: 28px 32px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
}
.informe-section h2 {
  font-family: 'Sora', sans-serif;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--rp-red);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 14px;
  border-bottom: 2px solid rgba(139,26,26,.1);
}
.informe-section h2 i { font-size: 15px; }
.informe-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .87rem;
  margin-bottom: 8px;
}
.informe-table thead tr { background: var(--rp-red); color: white; }
.informe-table thead th { padding: 10px 14px; font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
.informe-table tbody tr:nth-child(even) { background: rgba(139,26,26,.03); }
.informe-table tbody td { padding: 10px 14px; border-bottom: 1px solid var(--rp-border); }
.fortaleza-card {
  background: rgba(5,150,105,.06);
  border: 1px solid rgba(5,150,105,.2);
  border-left: 4px solid #059669;
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 12px;
}
.fortaleza-card h6 { font-weight: 700; font-size: .9rem; margin-bottom: 5px; color: #065F46; }
.fortaleza-card p { font-size: .85rem; color: #374151; line-height: 1.6; margin: 0; }
.rec-card {
  display: flex;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--rp-border);
  border-radius: 12px;
  margin-bottom: 10px;
  align-items: flex-start;
}
.rec-num {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--rp-red);
  color: white;
  font-weight: 800;
  font-size: .85rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.rec-body h6 { font-weight: 700; font-size: .88rem; margin-bottom: 5px; }
.rec-body p  { font-size: .84rem; color: var(--rp-muted); line-height: 1.6; margin: 0; }

/* ============================================================
   PLANES DE ACCIÓN
   ============================================================ */
.stat-icon.orange { background: rgba(234,88,12,.1); color: #EA580C; }

/* ============================================================
   PROGRESS BARS
   ============================================================ */
.progress-rp {
  height: 6px;
  background: var(--rp-bg);
  border-radius: 3px;
  overflow: hidden;
}
.progress-rp-bar {
  height: 100%;
  border-radius: 3px;
  transition: width .6s ease;
}

/* ============================================================
   BTN GOLD
   ============================================================ */
.btn-gold {
  background: var(--rp-gold);
  color: white;
  border: none;
}
.btn-gold:hover { background: #c49840; color: white; }

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
  .no-print,
  .sidebar,
  .sidebar-overlay,
  .top-bar,
  nav,
  .btn { display: none !important; }
  body, .main-content { margin: 0 !important; padding: 0 !important; background: white !important; }
  .card { box-shadow: none !important; border: 1px solid #eee !important; }
  .informe-section, .informe-cover { page-break-inside: avoid; }
  a[href]:after { content: ''; }
}

/* ============================================================
   PAGE HEADER — Encabezado de página unificado
   ============================================================ */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.page-header-left {}
.page-header-title {
  font-size: 1.5rem;
  font-weight: 800;
  margin: 0 0 4px;
  color: var(--rp-text);
  font-family: 'Sora', sans-serif;
  display: flex;
  align-items: center;
  gap: 10px;
}
.page-header-title i {
  color: var(--rp-red);
  font-size: 1.2rem;
}
.page-header-subtitle {
  font-size: .85rem;
  color: var(--rp-muted);
  margin: 0;
  font-weight: 400;
}
.page-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

@media (max-width: 576px) {
  .page-header-title  { font-size: 1.25rem; }
  .page-header .btn   { font-size: .82rem; padding: 7px 12px; }
}

/* ============================================================
   RESPONSIVE — MOBILE TABLE → CARDS
   ============================================================ */
@media (max-width: 768px) {
  /* ── Layout ── */
  .page-content { padding: 12px 10px; }
  .app-layout { overflow-x: hidden; }
  .main-content { overflow-x: hidden; }

  /* ── Stat cards 2×2 ── */
  .col-xl-3.col-6 { width: 50% !important; flex: 0 0 50% !important; }
  .stat-icon { display: none; }
  .stat-card { padding: 12px 10px; }
  .stat-body h3 { font-size: 1.4rem; }
  .stat-body p { font-size: .72rem; }

  /* ── Bootstrap grid — full width on mobile ── */
  .col-xl-4, .col-xl-8,
  .col-xl-3:not(.col-6), .col-xl-9,
  .col-xl-5, .col-xl-7,
  .col-md-4, .col-md-8 {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
  }

  /* ── Card header ── */
  .card-header { flex-wrap: wrap; gap: 8px; padding: 12px 14px; }
  .card-header h5 { font-size: .88rem; }
  .card-header .btn { font-size: .78rem; padding: 5px 10px; }

  /* ── TABLE → CARDS ──
     Cada fila <tr> se convierte en una tarjeta independiente.
     Cada <td> muestra su etiqueta de columna encima del valor.
  ── */
  .table-rp { display: block; width: 100%; }
  .table-rp thead { display: none; }   /* Ocultamos el header */
  .table-rp tbody { display: block; }
  .table-rp tbody tr {
    display: block;
    background: white;
    border-radius: 14px;
    border: 1px solid var(--rp-border);
    margin-bottom: 10px;
    padding: 14px;
    box-shadow: 0 1px 6px rgba(0,0,0,.06);
    overflow: hidden;
  }
  .table-rp tbody tr:hover { background: white; }

  /* Cada celda: label arriba, valor abajo */
  .table-rp tbody td {
    display: block;
    padding: 7px 0;
    border-bottom: 1px solid var(--rp-border);
    font-size: .88rem;
    position: relative;
  }
  .table-rp tbody td:last-child  { border-bottom: none; padding-bottom: 0; }
  .table-rp tbody td:first-child { padding-top: 0; }

  /* Etiqueta de columna — aparece como texto pequeño gris encima */
  .table-rp tbody td::before {
    content: attr(data-label);
    display: block;
    font-size: .65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--rp-muted);
    margin-bottom: 3px;
    line-height: 1;
  }
  /* Celdas sin label o vacías se ocultan */
  .table-rp tbody td:empty { display: none; }

  /* Acciones al final — sin etiqueta, botones alineados a la derecha */
  .table-rp tbody td.td-acciones,
  .table-rp tbody td:last-child {
    padding-top: 10px;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    align-items: center;
  }
  .table-rp tbody td.td-acciones::before,
  .table-rp tbody td:last-child::before { display: none; }

  /* Progreso bar — no necesita label */
  .table-rp tbody td .progress-rp { max-width: 100%; }

  /* Badges de nivel — inline */
  .table-rp tbody td .badge-nivel { font-size: .75rem; padding: 4px 10px; }
}

@media (max-width: 480px) {
  .page-content { padding: 10px 8px; }
  .topnav-brand-name { font-size: .78rem; max-width: 100px; }
  .table-rp tbody tr { padding: 12px; }
  .table-rp tbody td { font-size: .85rem; }
  /* Buttons wrap on very small screens */
  .table-rp tbody td:last-child { flex-wrap: wrap; }
}

/* ============================================================
   CARD IMPROVEMENTS — Mobile polish
   ============================================================ */

/* Cards general */
.card { transition: box-shadow .2s; }
.card:hover { box-shadow: 0 6px 24px rgba(0,0,0,.09); }
.card-header h5 {
  display: flex; align-items: center; gap: 8px;
  font-size: .95rem; font-weight: 700; margin: 0;
}
.card-header h5 i { color: var(--rp-red); font-size: 14px; }

@media (max-width: 768px) {
  /* Card inner spacing */
  .card-body { padding: 16px; }
  .card-header { padding: 13px 16px; }
  .card-header h5 { font-size: .88rem; }
  .card-header .btn { font-size: .78rem; padding: 5px 10px; }

  /* Stat numbers slightly smaller but still impactful */
  .stat-body h3 { font-size: 1.6rem; }

  /* Grid rows tighter */
  .row.g-3 { --bs-gutter-x: 0.6rem; --bs-gutter-y: 0.6rem; }
  .row.g-4 { --bs-gutter-x: 0.75rem; --bs-gutter-y: 0.75rem; }

  /* Col full-width overrides for dashboard content */
  .col-xl-4 { width: 100% !important; max-width: 100% !important; flex: 0 0 100% !important; }
  .col-xl-8 { width: 100% !important; max-width: 100% !important; flex: 0 0 100% !important; }

  /* Keep 2-col stat grid on mobile */
  .col-xl-3.col-6,
  .col-md-6.col-6 { width: 50% !important; flex: 0 0 50% !important; }

  /* IGPR score smaller on mobile */
  .igpr-score { font-size: 3rem; }

  /* Page header */
  .page-header { margin-bottom: 16px; }
  .page-header-title { font-size: 1.2rem; }
}

@media (max-width: 400px) {
  .stat-card { padding: 13px 11px; gap: 10px; }
  .stat-icon { width: 38px; height: 38px; font-size: 15px; border-radius: 10px; }
  .stat-body h3 { font-size: 1.4rem; }
  .stat-body p { font-size: .72rem; }
}
