/* ── MODAL ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--bg-modal);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--bg-container);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  width: 100%;
  max-width: 540px;
  max-height: 85vh;
  overflow-y: auto;
  border-top: 3px solid var(--accent);
}
.modal-header {
  background: var(--bg-header);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h2 {
  font-family: var(--font-serif);
  font-size: 16px;
  color: #fff;
  font-weight: 700;
}
.modal-close {
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.modal-close:hover { background: rgba(255,255,255,0.22); }
.modal-body { padding: 1.5rem 1.25rem; }
.modal-body h3 {
  font-family: var(--font-serif);
  font-size: 14px;
  color: var(--accent);
  margin-bottom: 6px;
  margin-top: 1rem;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 4px;
}
.modal-body h3:first-child { margin-top: 0; }
.modal-body p, .modal-body li {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.65;
  margin-bottom: 4px;
}
.modal-body ul { padding-left: 1.25rem; }
.modal-body .formula-box {
  background: var(--bg-section);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  color: var(--accent);
  margin: 0.5rem 0;
  line-height: 1.7;
}
.modal-body table { width: 100%; border-collapse: collapse; font-size: 12px; margin: 0.5rem 0; }
.modal-body table th {
  background: var(--bg-header);
  color: #fff;
  padding: 5px 8px;
  text-align: left;
  font-weight: 600;
}
.modal-body table td {
  padding: 5px 8px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-muted);
}
.modal-body table tr:last-child td { border-bottom: none; }

/* ── PANTALLA DE BIENVENIDA / AVISO LEGAL ── */
.bienvenida-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 18, 30, 0.97);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.bienvenida-card {
  background: var(--bg-container);
  border-radius: var(--radius);
  box-shadow: 0 24px 80px rgba(0,0,0,0.6);
  width: 100%;
  max-width: 620px;
  max-height: 92vh;
  overflow-y: auto;
  border-top: 4px solid var(--accent);
}
.bienvenida-header {
  background: var(--bg-header);
  padding: 1.5rem 1.75rem 1.25rem;
  border-bottom: 1px solid rgba(200,169,110,0.2);
}
.bienvenida-escudo {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
}
.bienvenida-escudo-icon {
  width: 44px;
  height: 44px;
  background: rgba(200,169,110,0.15);
  border: 1px solid rgba(200,169,110,0.35);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.bienvenida-header h1 {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 2px;
}
.bienvenida-header .bv-sub {
  font-size: 12px;
  color: rgba(232,226,217,0.55);
  font-weight: 300;
}
.bienvenida-body {
  padding: 1.5rem 1.75rem;
}
.aviso-bloque {
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  overflow: hidden;
}
.aviso-bloque-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.aviso-bloque-header.verde {
  background: rgba(200,169,110,0.12);
  color: #C8A96E;
  border-bottom: 1px solid rgba(200,169,110,0.2);
}
.aviso-bloque-header.rojo {
  background: rgba(139,28,28,0.1);
  color: #8b1c1c;
  border-bottom: 1px solid rgba(139,28,28,0.2);
}
.aviso-bloque-header.dorado {
  background: rgba(45,106,79,0.12);
  color: var(--accent);
  border-bottom: 1px solid rgba(45,106,79,0.25);
}
.aviso-bloque-header.azul {
  background: rgba(31,48,68,0.10);
  color: #1f3044;
  border-bottom: 1px solid rgba(31,48,68,0.2);
}
[data-theme="dark"] .aviso-bloque-header.verde { background: rgba(45,106,79,0.2); }
[data-theme="dark"] .aviso-bloque-header.rojo  { background: rgba(139,28,28,0.2); }
[data-theme="dark"] .aviso-bloque-header.dorado { background: rgba(45,106,79,0.15); }
[data-theme="dark"] .aviso-bloque-header.azul  { background: rgba(232,226,217,0.12); color: var(--text-on-dark); }
.aviso-bloque-body {
  padding: 0.875rem 1rem;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.65;
}
.aviso-bloque-body strong { color: var(--text-main); }
.aviso-bloque-body ul {
  padding-left: 1.25rem;
  margin-top: 6px;
}
.aviso-bloque-body li { margin-bottom: 4px; }
.bv-cnmc-ref {
  background: var(--bg-section);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 0.6rem 0.875rem;
  font-size: 11.5px;
  color: var(--text-light);
  font-style: italic;
  margin-top: 0.75rem;
  line-height: 1.5;
}
.bv-aceptar-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--bg-section);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
  cursor: pointer;
}
.bv-aceptar-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  flex-shrink: 0;
  margin-top: 2px;
  cursor: pointer;
}
.bv-aceptar-row label {
  font-size: 12.5px;
  color: var(--text-main);
  line-height: 1.55;
  cursor: pointer;
}
.bv-aceptar-row label strong { color: var(--text-main); }
.btn-bv-acceder {
  width: 100%;
  padding: 0.875rem;
  background: var(--accent);
  color: var(--bg-header);
  border: none;
  border-radius: var(--radius-pill);
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
  letter-spacing: 0.02em;
}
.btn-bv-acceder:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.btn-bv-acceder:not(:disabled):hover { background: var(--accent-hover); }
