/* ============================================================
   MULTICOTIZADOR BTG — Components
   Buttons · Inputs · KPI Cards · Tables · Badges · Modals ·
   Sliders · Toggles · Dropdowns · Alerts
   ============================================================ */

/* ─────────────────────────────────────────────────────────────
   BUTTONS
   ───────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  height: var(--height-btn);      /* 40px */
  padding: 0 var(--sp-5);         /* 0 24px */
  border: none;
  border-radius: var(--radius-default);
  font-family: var(--font-body);
  font-size: var(--text-body-s);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
  letter-spacing: 0.01em;
  transition: var(--transition);
  user-select: none;
}

.btn:hover  { opacity: 0.88; }
.btn:active { opacity: 0.75; transform: translateY(1px); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

/* Variantes */
.btn-primary   { background: var(--color-primary); color: #fff; }
.btn-secondary { background: #fff; color: var(--color-title); border: 1.5px solid var(--color-title); }
.btn-secondary:hover { background: #f1f5f9; color: var(--color-title); opacity: 1; }
.btn-dark      { background: var(--color-shell-bg); color: #fff; }
.btn-accent    { background: var(--color-accent); color: var(--color-title); }
.btn-outline   { background: transparent; color: var(--color-primary); border: 1.5px solid var(--color-primary); }
.btn-outline-white { background: transparent; color: #fff; border: 1.5px solid rgba(255,255,255,0.5); }
.btn-ghost     { background: transparent; color: var(--color-body); }
.btn-danger    { background: var(--color-error); color: #fff; }
.btn-success   { background: var(--color-success); color: #fff; }

/* Tamaños */
.btn-sm  { height: 32px; padding: 0 var(--sp-3); font-size: var(--text-caption); }
.btn-lg  { height: var(--height-btn-lg); padding: 0 var(--sp-6); font-size: var(--text-body-m); }
.btn-full{ width: 100%; }

/* Icon-only button */
.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-default);
  border: 1px solid var(--color-border);
  background: var(--color-bg-white);
  color: var(--color-body);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  transition: var(--transition);
}
.btn-icon:hover { background: var(--color-bg-surface); border-color: var(--color-accent); color: var(--color-accent); }
.btn-icon.active { background: var(--color-title); color: #fff; border-color: var(--color-title); }

/* ─────────────────────────────────────────────────────────────
   INPUTS
   ───────────────────────────────────────────────────────────── */

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.form-label {
  font-family: var(--font-body);
  font-size: var(--text-caption);
  font-weight: 600;
  color: var(--color-body);
  letter-spacing: 0.02em;
}

.form-label .required { color: var(--color-error); margin-left: 2px; }

.input,
.select-input {
  width: 100%;
  height: var(--height-input);   /* 40px */
  padding: 0 var(--sp-3);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-default);
  font-family: var(--font-body);
  font-size: var(--text-body-s);
  color: var(--color-body);
  background: var(--color-bg-white);
  outline: none;
  transition: border-color 0.15s;
  appearance: none;
  -webkit-appearance: none;
}

.input::placeholder { color: var(--color-muted); }
.input:focus,
.select-input:focus { border-color: var(--color-accent); }
.input.error        { border-color: var(--color-error); }

/* Select con ícono dropdown */
.select-wrap {
  position: relative;
}
.select-wrap .select-input { padding-right: 36px; cursor: pointer; }
.select-wrap::after {
  content: '';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid var(--color-muted);
  pointer-events: none;
}

/* Textarea */
.textarea {
  width: 100%;
  padding: var(--sp-3);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-default);
  font-family: var(--font-body);
  font-size: var(--text-body-s);
  color: var(--color-body);
  background: var(--color-bg-white);
  outline: none;
  resize: vertical;
  min-height: 100px;
  transition: border-color 0.15s;
  line-height: 1.6;
}
.textarea::placeholder { color: var(--color-muted); }
.textarea:focus        { border-color: var(--color-accent); }

/* Input con prefijo (ej. $) */
.input-prefix-wrap {
  position: relative;
}
.input-prefix {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-muted);
  font-size: var(--text-body-s);
  pointer-events: none;
}
.input-prefix-wrap .input { padding-left: 24px; }

/* Stepper numérico */
.stepper-wrap {
  display: flex;
  align-items: center;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-default);
  overflow: hidden;
  height: var(--height-input);
}
.stepper-btn {
  width: 36px;
  height: 100%;
  background: var(--color-bg-surface);
  border: none;
  cursor: pointer;
  color: var(--color-body);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  flex-shrink: 0;
}
.stepper-btn:hover   { background: var(--color-border); }
.stepper-input {
  flex: 1;
  height: 100%;
  border: none;
  text-align: center;
  font-family: var(--font-body);
  font-size: var(--text-body-s);
  font-weight: 600;
  color: var(--color-body);
  outline: none;
  background: #fff;
}

/* ─────────────────────────────────────────────────────────────
   TOGGLE / RADIO PILL (¿Ha cotizado antes? Sí / No)
   ───────────────────────────────────────────────────────────── */

.toggle-group {
  display: inline-flex;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-default);
  overflow: hidden;
}

.toggle-option {
  flex: 1;
  padding: 8px 20px;
  background: var(--color-bg-white);
  border: none;
  font-family: var(--font-body);
  font-size: var(--text-body-s);
  font-weight: 600;
  color: var(--color-muted);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.toggle-option:not(:first-child) { border-left: 1.5px solid var(--color-border); }
.toggle-option:hover    { background: var(--color-bg-surface); color: var(--color-body); }
.toggle-option.active   { background: var(--color-title); color: #fff; }
.toggle-option.active-accent { background: var(--color-accent); color: var(--color-title); }

/* Switch ON/OFF */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch-track {
  position: absolute;
  inset: 0;
  background: var(--color-border);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: 0.25s;
}
.switch input:checked + .switch-track { background: var(--color-accent); }
.switch-track::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: 0.25s;
  box-shadow: var(--shadow-sm);
}
.switch input:checked + .switch-track::after { transform: translateX(20px); }

/* Radio buttons estilo card */
.radio-card-group {
  display: flex;
  gap: var(--sp-4);
}

.radio-card {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-card);
  cursor: pointer;
  transition: var(--transition);
  background: var(--color-bg-white);
  position: relative;
}
.radio-card:hover  { border-color: var(--color-accent); }
.radio-card.active { border-color: var(--color-accent); background: rgba(34,211,238,0.05); }

.radio-card .radio-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition);
}
.radio-card.active .radio-dot {
  border-color: var(--color-accent);
}
.radio-card.active .radio-dot::after {
  content: '';
  width: 10px;
  height: 10px;
  background: var(--color-accent);
  border-radius: 50%;
}

.radio-card .radio-icon {
  font-size: 28px;
  color: var(--color-muted);
  transition: var(--transition);
}
.radio-card.active .radio-icon { color: var(--color-accent); }

.radio-card .radio-label {
  font-family: var(--font-display);
  font-size: var(--text-h4);
  font-weight: 600;
  color: var(--color-title);
}

.radio-card .radio-sublabel {
  font-size: var(--text-caption);
  color: var(--color-muted);
  margin-top: 2px;
}

/* Checkbox */
.checkbox-wrap {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  cursor: pointer;
}
.checkbox-wrap input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--color-accent);
  cursor: pointer;
  border-radius: 4px;
  flex-shrink: 0;
}
.checkbox-label {
  font-size: var(--text-body-s);
  color: var(--color-body);
}

/* ─────────────────────────────────────────────────────────────
   SLIDER DE DESCUENTO (Cotizador Step 2)
   ───────────────────────────────────────────────────────────── */

.discount-slider-wrap {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  min-width: 180px;
}

.discount-slider-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.discount-label {
  font-size: var(--text-caption);
  font-weight: 600;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.discount-value {
  font-family: var(--font-display);
  font-size: var(--text-body-m);
  font-weight: 700;
  color: var(--color-accent);
}

.slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: var(--radius-pill);
  background: var(--color-border);
  outline: none;
  cursor: pointer;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--color-accent);
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px rgba(34,211,238,0.3);
}
.slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--color-accent);
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px rgba(34,211,238,0.3);
}

.slider-range-labels {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-xs);
  color: var(--color-muted);
}

/* ─────────────────────────────────────────────────────────────
   KPI CARDS
   ───────────────────────────────────────────────────────────── */

.kpi-card {
  background: var(--color-bg-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  padding: var(--sp-5);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  overflow: hidden;
}

.kpi-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
}

.kpi-card-label {
  font-size: var(--text-caption);
  font-weight: 700;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.kpi-card-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-default);
  background: var(--color-info-bg);
  color: var(--color-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.kpi-card-value {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 700;
  color: var(--color-title);
  line-height: 1;
}

.kpi-card-delta {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-caption);
  font-weight: 600;
}

.kpi-delta-up   { color: var(--color-success); }
.kpi-delta-down { color: var(--color-error); }

.kpi-sparkline {
  margin-top: var(--sp-1);
  height: 40px;
}

/* KPI card con progress bar (Admin Dashboard) */
.kpi-progress-bar-wrap {
  width: 100%;
  height: 4px;
  background: var(--color-bg-surface);
  border-radius: var(--radius-pill);
  margin-top: var(--sp-2);
  overflow: hidden;
}

.kpi-progress-bar {
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--color-accent);
  transition: width 0.4s ease;
}

/* ─────────────────────────────────────────────────────────────
   TABLA BASE
   ───────────────────────────────────────────────────────────── */

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-body-s);
  font-family: var(--font-body);
}

.data-table th {
  font-size: var(--text-caption);
  font-weight: 700;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: var(--sp-3) var(--sp-4);
  background: var(--color-bg-surface);
  border-bottom: 1px solid var(--color-border);
  text-align: left;
  white-space: nowrap;
}

/* Header doble nivel (Agent Performance) */
.data-table th.th-group {
  text-align: center;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg-surface);
}
.data-table th.th-sub {
  text-align: center;
  font-weight: 600;
  background: var(--color-bg-white);
  border-top: 1px solid var(--color-border);
}

.data-table td {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--color-border);
  color: var(--color-body);
  vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: none; }

.data-table tbody tr:hover { background: rgba(34,211,238,0.03); }

/* Fila de totales */
.data-table tfoot td {
  padding: var(--sp-3) var(--sp-4);
  background: var(--color-bg-surface);
  font-weight: 700;
  color: var(--color-title);
  border-top: 2px solid var(--color-border);
}

/* Acciones de fila */
.row-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  opacity: 0;
  transition: opacity 0.15s;
}
.data-table tbody tr:hover .row-actions { opacity: 1; }

.row-action-btn {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg-white);
  color: var(--color-muted);
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}
.row-action-btn:hover { border-color: var(--color-accent); color: var(--color-accent); }

/* ─────────────────────────────────────────────────────────────
   BADGES / STATUS
   ───────────────────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: var(--text-caption);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.badge-success  { background: var(--color-success-bg); color: var(--color-success-text); }
.badge-error    { background: var(--color-error-bg);   color: var(--color-error-text); }
.badge-warning  { background: var(--color-warning-bg); color: var(--color-warning-text); }
.badge-info     { background: var(--color-info-bg);    color: var(--color-info); }
.badge-muted    { background: var(--color-bg-surface); color: var(--color-muted); border: 1px solid var(--color-border); }
.badge-dark     { background: var(--color-title); color: #fff; }

/* Badges de cumplimiento % (Agent Performance) */
.badge-perf-high   { background: rgba(29,184,122,0.12); color: #0f6b46; } /* >100% */
.badge-perf-mid    { background: rgba(245,166,35,0.12); color: #8a5a00; } /* 80-100% */
.badge-perf-low    { background: rgba(232,76,61,0.12);  color: #9b1e13; } /* <80% */

/* Badges de tipo de seguro */
.badge-tipo {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-caption);
  color: var(--color-muted);
}

/* ─────────────────────────────────────────────────────────────
   MODAL
   ───────────────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(12,26,39,0.55);
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--sp-5);
  backdrop-filter: blur(2px);
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--color-bg-white);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 934px;              /* confirmado Figma para modales de agente */
  max-height: 90vh;
  overflow-y: auto;
  animation: modal-in 0.2s ease;
}

.modal-sm { max-width: 560px; }  /* para modal Detalle de Claves (672px) */
.modal-claves { max-width: 672px; }

@keyframes modal-in {
  from { opacity: 0; transform: translateY(-12px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--color-border);
  gap: var(--sp-3);
  position: sticky;
  top: 0;
  background: var(--color-bg-white);
  z-index: 1;
}

.modal-title-wrap {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.modal-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-default);
  background: var(--color-info-bg);
  color: var(--color-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.modal-title {
  font-family: var(--font-display);
  font-size: var(--text-h4);
  font-weight: 700;
  color: var(--color-title);
}

.modal-subtitle {
  font-size: var(--text-body-s);
  color: var(--color-muted);
  margin-top: 2px;
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-default);
  background: none;
  cursor: pointer;
  color: var(--color-muted);
  font-size: 16px;
  transition: var(--transition);
  flex-shrink: 0;
}
.modal-close:hover { background: var(--color-error-bg); color: var(--color-error); border-color: var(--color-error); }

.modal-body {
  padding: var(--sp-6);
}

.modal-footer {
  padding: var(--sp-4) var(--sp-6);
  border-top: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-3);
}

/* Sección dentro del modal */
.modal-section {
  margin-bottom: var(--sp-6);
}
.modal-section:last-child { margin-bottom: 0; }

.modal-section-title {
  font-family: var(--font-display);
  font-size: var(--text-body-m);
  font-weight: 700;
  color: var(--color-title);
  margin-bottom: var(--sp-4);
  padding-bottom: var(--sp-2);
  border-bottom: 1px solid var(--color-border);
}

/* ─────────────────────────────────────────────────────────────
   FORM GRID (para formularios dentro de modales)
   ───────────────────────────────────────────────────────────── */

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-4) var(--sp-5);
}

.form-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--sp-4) var(--sp-5);
}

.form-col-full { grid-column: 1 / -1; }

@media (max-width: 767px) {
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
}

/* ─────────────────────────────────────────────────────────────
   ASEGURADORA ROW (Cotizador Step 2)
   ───────────────────────────────────────────────────────────── */

.aseg-row {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--color-border);
  flex-wrap: wrap;
}
.aseg-row:last-child { border-bottom: none; }

.aseg-logo {
  width: 80px;
  height: 40px;
  object-fit: contain;
  flex-shrink: 0;
}

.aseg-logo-placeholder {
  width: 80px;
  height: 40px;
  background: var(--color-bg-surface);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-caption);
  font-weight: 700;
  color: var(--color-muted);
  flex-shrink: 0;
}

.aseg-credencial {
  font-size: var(--text-caption);
  color: var(--color-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.aseg-prima-total {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  margin-left: auto;
}
.aseg-prima-label {
  font-size: var(--text-caption);
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.aseg-prima-value {
  font-family: var(--font-display);
  font-size: var(--text-h4);
  font-weight: 700;
  color: var(--color-accent);
}

/* ─────────────────────────────────────────────────────────────
   ASEGURADORA CARD (Cotizador Step 1 — grid 3×2)
   ───────────────────────────────────────────────────────────── */

.insurer-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}

.insurer-card {
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-card);
  padding: var(--sp-4);
  background: var(--color-bg-white);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.insurer-card:hover   { border-color: var(--color-accent); }
.insurer-card.active  { border-color: var(--color-accent); background: rgba(34,211,238,0.04); }
.insurer-card.inactive { opacity: 0.4; }

.insurer-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.insurer-card-name {
  font-family: var(--font-display);
  font-size: var(--text-body-m);
  font-weight: 700;
  color: var(--color-title);
}

.insurer-expand-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-muted);
  font-size: 16px;
  padding: 4px;
  transition: transform 0.2s;
}
.insurer-expand-btn.open { transform: rotate(180deg); }

/* ─────────────────────────────────────────────────────────────
   TAGS / CHIPS (Territorio Permitido en Create Package)
   ───────────────────────────────────────────────────────────── */

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  align-items: center;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--color-info-bg);
  border: 1px solid rgba(34,211,238,0.3);
  border-radius: var(--radius-pill);
  font-size: var(--text-caption);
  font-weight: 600;
  color: var(--color-accent);
}

.tag-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-accent);
  font-size: 12px;
  display: flex;
  align-items: center;
  padding: 0;
  opacity: 0.7;
  transition: opacity 0.15s;
}
.tag-remove:hover { opacity: 1; }

/* ─────────────────────────────────────────────────────────────
   ALERT BANNER
   ───────────────────────────────────────────────────────────── */

.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-default);
  font-size: var(--text-body-s);
  margin-bottom: var(--sp-4);
}

.alert-info    { background: var(--color-info-bg);    border: 1px solid rgba(34,211,238,0.25); color: var(--color-title); }
.alert-success { background: var(--color-success-bg); border: 1px solid rgba(29,184,122,0.25); color: var(--color-success-text); }
.alert-warning { background: var(--color-warning-bg); border: 1px solid rgba(245,166,35,0.25); color: var(--color-warning-text); }
.alert-error   { background: var(--color-error-bg);   border: 1px solid rgba(232,76,61,0.25);  color: var(--color-error-text); }

.alert-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.alert-body { flex: 1; line-height: 1.5; }
.alert-title { font-weight: 700; }
.alert-close {
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  font-size: 16px;
  opacity: 0.6;
  padding: 0;
  flex-shrink: 0;
  transition: opacity 0.15s;
}
.alert-close:hover { opacity: 1; }

/* ─────────────────────────────────────────────────────────────
   LEADERBOARD (Admin Dashboard)
   ───────────────────────────────────────────────────────────── */

.rank-badge {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}
.rank-1 { background: #FFD700; color: #7a6200; }
.rank-2 { background: #C0C0C0; color: #5a5a5a; }
.rank-3 { background: #CD7F32; color: #5a2e00; }
.rank-n { background: var(--color-bg-surface); color: var(--color-muted); border: 1px solid var(--color-border); }

/* ─────────────────────────────────────────────────────────────
   CONTEXT MENU (menú ⋮)
   ───────────────────────────────────────────────────────────── */

.ctx-menu-wrap { position: relative; display: inline-block; }

.ctx-menu {
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 4px;
  min-width: 160px;
  background: var(--color-bg-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-default);
  box-shadow: var(--shadow-md);
  z-index: 300;
  display: none;
  overflow: hidden;
}
.ctx-menu.open { display: block; }

.ctx-menu-item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--text-body-s);
  color: var(--color-body);
  cursor: pointer;
  transition: background 0.12s;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
}
.ctx-menu-item:hover { background: var(--color-bg-surface); color: var(--color-title); }
.ctx-menu-item.danger:hover { background: var(--color-error-bg); color: var(--color-error); }

/* ─────────────────────────────────────────────────────────────
   CREDENTIAL ROW (Modal Editar Agente)
   ───────────────────────────────────────────────────────────── */

.cred-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--color-border);
}
.cred-row:last-child { border-bottom: none; }

.cred-logo {
  width: 60px;
  height: 28px;
  object-fit: contain;
  flex-shrink: 0;
}
.cred-logo-placeholder {
  width: 60px;
  height: 28px;
  background: var(--color-bg-surface);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--color-muted);
  flex-shrink: 0;
}

.cred-info { flex: 1; min-width: 0; }
.cred-name { font-size: var(--text-body-s); font-weight: 600; color: var(--color-title); }

.cred-expand-body {
  padding: var(--sp-3) 0 var(--sp-1);
  display: none;
}
.cred-expand-body.open { display: block; }

/* ─────────────────────────────────────────────────────────────
   AVATAR (usuario en header / leaderboard)
   ───────────────────────────────────────────────────────────── */

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-accent);
  color: var(--color-title);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
  user-select: none;
}

.avatar-sm {
  width: 28px;
  height: 28px;
  font-size: 11px;
}

/* ─────────────────────────────────────────────────────────────
   CHART CARD
   ───────────────────────────────────────────────────────────── */

.chart-card {
  background: var(--color-bg-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  padding: var(--sp-5);
  box-shadow: var(--shadow-sm);
}

.chart-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-4);
  gap: var(--sp-3);
  flex-wrap: wrap;
}

.chart-card-title {
  font-family: var(--font-display);
  font-size: var(--text-body-l);
  font-weight: 600;
  color: var(--color-title);
}

.chart-canvas-wrap {
  position: relative;
  width: 100%;
}

/* ─────────────────────────────────────────────────────────────
   MOBILE RESPONSIVE — overrides
   ───────────────────────────────────────────────────────────── */

@media (max-width: 767px) {
  .modal { max-width: 100%; border-radius: var(--radius-card) var(--radius-card) 0 0; }
  .modal-overlay { align-items: flex-end; padding: 0; }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
  .insurer-grid { grid-template-columns: 1fr 1fr; }
  .radio-card-group { flex-direction: column; }
  .row-actions { opacity: 1; }
  .aseg-row { flex-wrap: wrap; }
}
