:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #60a5fa;
  --primary-glow: rgba(37, 99, 235, 0.25);
  
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --text-title: #0f172a;
  --text-body: #334155;
  --text-muted: #64748b;
  --border-subtle: #e2e8f0;
  --border-focus: #3b82f6;

  --color-cubierta: #059669;
  --bg-cubierta: #ecfdf5;
  --border-cubierta: #a7f3d0;

  --color-debil: #d97706;
  --bg-debil: #fffbeb;
  --border-debil: #fde68a;

  --color-ausente: #e11d48;
  --bg-ausente: #fff1f2;
  --border-ausente: #fecdd3;

  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 9999px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-card: 0 4px 20px -2px rgba(15, 23, 42, 0.06), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
  --shadow-hover: 0 10px 30px -4px rgba(15, 23, 42, 0.1), 0 4px 10px -2px rgba(15, 23, 42, 0.05);
  --shadow-glow: 0 8px 25px -4px rgba(37, 99, 235, 0.35);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Plus Jakarta Sans', 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* Navbar */
.navbar {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 12px 24px;
}

.nav-container {
  max-width: 1040px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.25);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-title);
}

.brand-subtitle {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f1f5f9;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 600;
  color: #334155;
  border: 1px solid var(--border-subtle);
}

.status-dot {
  width: 8px;
  height: 8px;
  background-color: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.btn-agent {
  background: linear-gradient(135deg, #1e293b, #0f172a);
  color: #ffffff;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.15);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.15);
}

.btn-agent:hover {
  background: linear-gradient(135deg, #334155, #1e293b);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.25);
}

/* Main Content */
.main-content {
  max-width: 1040px;
  margin: 0 auto;
  padding: 40px 20px 80px;
}

/* Hero Section */
.hero-section {
  text-align: center;
  max-width: 760px;
  margin: 0 auto 32px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 5px 14px;
  border-radius: var(--radius-pill);
  margin-bottom: 14px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.hero-title {
  font-size: 2.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-title);
  line-height: 1.2;
  margin-bottom: 14px;
}

.hero-subtitle {
  font-size: 1.05rem;
  color: var(--text-muted);
  line-height: 1.55;
}

/* Invariants Callout Banner */
.invariants-callout {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 1px solid #fde68a;
  border-left: 5px solid #d97706;
  border-radius: var(--radius-md);
  padding: 18px 24px;
  margin-bottom: 36px;
  box-shadow: var(--shadow-sm);
}

.callout-icon-box {
  font-size: 1.6rem;
  line-height: 1;
  padding-top: 2px;
  flex-shrink: 0;
}

.callout-body {
  flex: 1;
}

.callout-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: #92400e;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 4px;
}

.callout-text {
  font-size: 0.92rem;
  color: #78350f;
  line-height: 1.5;
  display: block;
}

/* Tarjetas Principales */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 36px;
  box-shadow: var(--shadow-card);
  margin-bottom: 36px;
}

.card-header {
  margin-bottom: 20px;
}

.step-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--primary);
  background: #eff6ff;
  border: 1px solid #dbeafe;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  margin-bottom: 8px;
}

.card-header h2 {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text-title);
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.card-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
}

/* Grid de Selección Visual de Fondos */
.fund-selection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 12px;
}

.fund-card {
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
}

.fund-card:hover:not(.disabled) {
  border-color: var(--primary-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.fund-card.selected {
  border-color: var(--primary);
  background: #f8faff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.fund-card.disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: #f8fafc;
}

.fund-badge-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.fund-entity {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  background: #f1f5f9;
  color: #475569;
}

.fund-card.selected .fund-entity {
  background: #dbeafe;
  color: var(--primary);
}

.fund-status-tag {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}

.fund-status-tag.active {
  background: var(--bg-cubierta);
  color: var(--color-cubierta);
}

.fund-status-tag.coming-soon {
  background: #f1f5f9;
  color: var(--text-muted);
}

.fund-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-title);
  margin-bottom: 6px;
}

.fund-info {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.fund-aviso {
  font-size: 0.78rem;
  color: #92400e;
  background: #fef3c7;
  border-radius: 6px;
  padding: 6px 8px;
  margin-top: 8px;
  line-height: 1.4;
}

/* Drop Zone Mejorada */
.drop-zone {
  position: relative;
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-md);
  padding: 40px 24px;
  text-align: center;
  background: #fafcff;
  cursor: pointer;
  transition: all 0.25s ease;
  overflow: hidden;
}

.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--primary);
  background: #eff6ff;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.08);
}

.file-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 10;
}

.upload-icon-circle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  margin: 0 auto 14px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease;
}

.drop-zone:hover .upload-icon-circle {
  transform: scale(1.08);
}

.drop-text-main {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-title);
  margin-bottom: 4px;
}

.drop-text-sub {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.highlight-link {
  color: var(--primary);
  font-weight: 600;
  text-decoration: underline;
}

.format-chips {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
}

/* File Preview Card */
.file-preview-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  max-width: 500px;
  margin: 0 auto;
  box-shadow: var(--shadow-sm);
  position: relative;
  z-index: 20;
}

.file-preview-icon {
  font-size: 1.6rem;
}

.file-preview-details {
  flex: 1;
  text-align: left;
  overflow: hidden;
}

.file-preview-name {
  font-weight: 700;
  font-size: 0.98rem;
  color: var(--text-title);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-preview-size {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.btn-remove-file {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: #f1f5f9;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.btn-remove-file:hover {
  background: var(--bg-ausente);
  color: var(--color-ausente);
}

/* Botón CTA Grande */
.form-submit-container {
  margin-top: 36px;
}

.btn-cta {
  width: 100%;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #ffffff;
  font-size: 1.15rem;
  font-weight: 700;
  padding: 18px 32px;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  box-shadow: var(--shadow-glow);
  transition: all 0.2s ease;
}

.btn-cta:hover:not(:disabled) {
  background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
  transform: translateY(-2px);
  box-shadow: 0 12px 30px -4px rgba(37, 99, 235, 0.45);
}

.btn-cta:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-cta-icon {
  font-size: 1.3rem;
}

/* Sección de Progreso Animado */
.progress-card {
  text-align: center;
  padding: 50px 30px;
}

.progress-animation-wrapper {
  position: relative;
  width: 80px;
  height: 80px;
  margin: 0 auto 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.radar-pulse {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 4px solid var(--primary-light);
  animation: pulse-ring 1.5s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(0.6); opacity: 1; }
  100% { transform: scale(1.6); opacity: 0; }
}

.progress-center-icon {
  font-size: 2.2rem;
  z-index: 2;
}

.progress-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-title);
  margin-bottom: 6px;
}

.progress-status {
  font-size: 1rem;
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 36px;
}

.timeline-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  max-width: 840px;
  margin: 0 auto;
}

.timeline-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f8fafc;
  border: 1px solid var(--border-subtle);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  transition: all 0.3s ease;
}

.timeline-marker {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #cbd5e1;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.timeline-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: left;
}

.timeline-item.active {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.timeline-item.active .timeline-marker {
  background: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.timeline-item.active .timeline-label {
  color: var(--primary-dark);
}

.timeline-item.completed {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.timeline-item.completed .timeline-marker {
  background: var(--color-cubierta);
}

/* Alertas */
.alert-box {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 24px;
  border-radius: var(--radius-md);
  margin-bottom: 32px;
}

.alert-box.error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.alert-icon {
  font-size: 1.4rem;
}

/* Resultados */
.results-header-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  box-shadow: var(--shadow-card);
  margin-bottom: 28px;
}

.results-kicker {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--primary);
  letter-spacing: 0.05em;
}

.results-header-info h2 {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-title);
  letter-spacing: -0.02em;
  margin: 2px 0 6px;
}

.results-sub {
  font-size: 0.95rem;
  color: var(--text-muted);
}

.results-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-download {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 12px 22px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
  transition: all 0.15s;
}

.btn-download:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  transform: translateY(-1px);
}

.btn-consultant {
  background: #ffffff;
  color: var(--text-title);
  border: 1px solid var(--border-subtle);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 12px 22px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s;
}

.btn-consultant:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

/* Tarjetas de Métricas */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.metric-card {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 22px;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s;
}

.metric-card:hover {
  transform: translateY(-2px);
}

.metric-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.metric-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.metric-value {
  font-size: 2.3rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 6px;
}

.metric-footnote {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.metric-card.cubierta {
  border-left: 4px solid var(--color-cubierta);
  background: linear-gradient(to bottom, #ffffff, #f0fdf4);
}
.metric-card.cubierta .metric-value { color: var(--color-cubierta); }

.metric-card.debil {
  border-left: 4px solid var(--color-debil);
  background: linear-gradient(to bottom, #ffffff, #fffbeb);
}
.metric-card.debil .metric-value { color: var(--color-debil); }

.metric-card.ausente {
  border-left: 4px solid var(--color-ausente);
  background: linear-gradient(to bottom, #ffffff, #fff1f2);
}
.metric-card.ausente .metric-value { color: var(--color-ausente); }

.metric-card.total {
  border-left: 4px solid var(--primary);
  background: linear-gradient(to bottom, #ffffff, #eff6ff);
}
.metric-card.total .metric-value { color: var(--primary); }

/* Filtros */
.filter-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.filter-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-muted);
}

.filter-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-pill {
  border: 1px solid var(--border-subtle);
  background: #ffffff;
  color: var(--text-body);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 6px 16px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.15s;
}

.filter-pill:hover {
  border-color: #94a3b8;
}

.filter-pill.active {
  background: var(--text-title);
  color: #ffffff;
  border-color: var(--text-title);
}

.filter-pill.pill-cubierta.active { background: var(--color-cubierta); border-color: var(--color-cubierta); }
.filter-pill.pill-debil.active { background: var(--color-debil); border-color: var(--color-debil); }
.filter-pill.pill-ausente.active { background: var(--color-ausente); border-color: var(--color-ausente); }

/* Tarjetas de Ítems en el Stream */
.item-card {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.item-card:hover {
  box-shadow: var(--shadow-hover);
  border-color: #cbd5e1;
}

.item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 12px;
}

.item-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.item-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-title);
}

.type-pill {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  background: #f1f5f9;
  color: #475569;
}

.status-badge {
  font-size: 0.8rem;
  font-weight: 800;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.status-badge.cubierta { background: var(--bg-cubierta); color: var(--color-cubierta); border: 1px solid var(--border-cubierta); }
.status-badge.debil { background: var(--bg-debil); color: var(--color-debil); border: 1px solid var(--border-debil); }
.status-badge.ausente { background: var(--bg-ausente); color: var(--color-ausente); border: 1px solid var(--border-ausente); }

.item-requirement-desc {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.45;
}

.item-block {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #f1f5f9;
}

.block-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.quote-highlight {
  background: #f8fafc;
  border-left: 3px solid #3b82f6;
  padding: 10px 16px;
  border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
  font-size: 0.92rem;
  font-style: italic;
  color: #1e293b;
}

.suggestion-highlight {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-sm);
  padding: 14px;
  font-size: 0.94rem;
  color: #14532d;
  line-height: 1.5;
}

.precedents-list {
  background: #f8fafc;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
}

.precedent-entry {
  font-size: 0.88rem;
  color: #334155;
  margin-bottom: 6px;
}

.precedent-entry:last-child {
  margin-bottom: 0;
}

.pending-alert-box {
  margin-top: 12px;
  background: #fff1f2;
  border: 1px solid #fecdd3;
  color: #be123c;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Modales */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
  animation: fadeIn 0.15s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-box {
  background: #ffffff;
  border-radius: var(--radius-lg);
  max-width: 580px;
  width: 100%;
  padding: 32px;
  box-shadow: 0 20px 40px -8px rgba(0, 0, 0, 0.25);
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-agente-box {
  max-width: 660px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 18px;
}

.modal-header-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-icon {
  font-size: 1.8rem;
}

.modal-header-title h3 {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-title);
  letter-spacing: -0.02em;
}

.modal-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.modal-close-btn {
  background: #f1f5f9;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1rem;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.modal-close-btn:hover {
  background: #e2e8f0;
  color: var(--text-title);
}

.modal-intro {
  font-size: 0.94rem;
  color: var(--text-muted);
  margin-bottom: 22px;
  line-height: 1.5;
}

/* Opciones del Agente */
.agent-download-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.agent-option-card {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.agent-option-card.highlight {
  border-color: var(--primary-light);
  background: #fafcff;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.option-tag {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--primary);
  display: block;
  margin-bottom: 4px;
}

.agent-option-card h4 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-title);
  margin-bottom: 6px;
}

.agent-option-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.4;
}

.btn-block {
  width: 100%;
  text-align: center;
  justify-content: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
  border: none;
}

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

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-outline {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  color: var(--text-title);
}

.btn-outline:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

/* Snippet Code Box */
.config-snippet-box {
  background: #0f172a;
  border-radius: var(--radius-md);
  padding: 14px 18px;
  color: #f8fafc;
  overflow: hidden;
}

.snippet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: #94a3b8;
  margin-bottom: 8px;
}

.btn-copy {
  background: #334155;
  border: none;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-xs);
  cursor: pointer;
}

.btn-copy:hover {
  background: #475569;
}

.snippet-code {
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 0.8rem;
  line-height: 1.45;
  max-height: 160px;
  overflow-y: auto;
  color: #38bdf8;
}

/* Inputs para modal revisión */
.input-field {
  margin-bottom: 16px;
}

.input-field label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-title);
  margin-bottom: 6px;
}

.input-field input, .input-field textarea {
  width: 100%;
  padding: 10px 14px;
  font-size: 0.92rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--text-title);
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s;
}

.input-field input:focus, .input-field textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

.success-feedback {
  text-align: center;
  padding: 24px 0;
}

.feedback-circle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--bg-cubierta);
  color: var(--color-cubierta);
  font-size: 1.8rem;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.success-feedback h4 {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-title);
  margin-bottom: 8px;
}

.success-feedback p {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

/* Pestañas de herramientas y lista del informe de prefactibilidad */
.tool-tabs { display: flex; gap: 8px; margin: 24px 0; flex-wrap: wrap; }
.tool-tab {
  padding: 10px 18px; border: 1px solid #cbd5e1; border-radius: 999px; background: #fff;
  font: inherit; font-weight: 600; color: #475569; cursor: pointer;
}
.tool-tab.active { background: #4f46e5; border-color: #4f46e5; color: #fff; }
.pf-list { margin: 6px 0 0 18px; padding: 0; font-size: 0.92rem; color: #334155; }
.pf-list li { margin-bottom: 6px; }
#panel-prefactibilidad textarea { width: 100%; box-sizing: border-box; }

/* Acceso y barra de usuario */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: 100%; max-width: 400px; text-align: center; }
.login-card .input-field { text-align: left; }
.login-title { margin: 8px 0 4px; font-size: 1.6rem; }
.user-chip { font-size: 0.9rem; font-weight: 600; color: #475569; margin-right: 8px; }
.btn-block { width: 100%; }
