/* ============================================================
   CAPA LEGAL — pantalla de aceptación y lector de documentos
   ============================================================
   Misma estética que el resto del cotizador: tema claro, tipografía del
   sistema, tarjeta con vidrio esmerilado como la de login, y los tokens de
   color de styles.css. Sin librerías externas.
   ============================================================ */

.lg-gate,
.lg-modal {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow: auto;
}

.lg-gate {
  background:
    radial-gradient(circle at 20% 20%, #dbeafe 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, #ede9fe 0%, transparent 50%),
    linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

.lg-modal {
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

/* Con el gate abierto no se puede hacer scroll ni operar el fondo. */
body.lg-locked {
  overflow: hidden;
}

.lg-card {
  position: relative;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 22px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.10), 0 8px 24px rgba(15, 23, 42, 0.05);
  width: 100%;
  max-width: 640px;
  max-height: calc(100vh - 40px);
  padding: 26px 26px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.lg-card-sm {
  max-width: 460px;
}

.lg-card-read {
  max-width: 680px;
}

.lg-card-hd {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.lg-ico {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 13px;
  background: linear-gradient(135deg, #6366f1 0%, #3b82f6 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.28);
}

.lg-ico svg {
  width: 22px;
  height: 22px;
}

.lg-card-hd h2 {
  margin: 0 0 3px;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.4px;
  color: var(--gray-900, #111827);
}

.lg-card-hd p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--gray-500, #6b7280);
}

.lg-card h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: var(--gray-900, #111827);
}

/* ── Pestañas de documento ───────────────────────────────── */
.lg-tabs {
  display: flex;
  gap: 4px;
  background: var(--gray-100, #f3f4f6);
  border-radius: 11px;
  padding: 4px;
}

.lg-tab {
  flex: 1;
  border: 0;
  background: transparent;
  border-radius: 8px;
  padding: 8px 6px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--gray-500, #6b7280);
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}

.lg-tab:hover {
  color: var(--gray-900, #111827);
}

.lg-tab.is-active {
  background: #fff;
  color: var(--gray-900, #111827);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.10);
}

/* ── Cuerpo del documento ────────────────────────────────── */
.lg-doc {
  flex: 1 1 auto;
  min-height: 190px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: #fff;
  border: 1px solid var(--gray-200, #e5e7eb);
  border-radius: 13px;
  padding: 18px 20px;
  font-size: 13px;
  line-height: 1.65;
  color: var(--gray-700, #374151);
}

.lg-doc h3 {
  margin: 0 0 2px;
  font-size: 15.5px;
}

.lg-doc h4 {
  margin: 18px 0 5px;
  font-size: 13px;
  font-weight: 700;
  color: var(--gray-900, #111827);
}

.lg-doc h4:first-of-type {
  margin-top: 14px;
}

.lg-doc p {
  margin: 0 0 9px;
}

.lg-doc ul {
  margin: 0 0 9px;
  padding-left: 18px;
}

.lg-doc li {
  margin-bottom: 5px;
}

.lg-doc b {
  color: var(--gray-900, #111827);
  font-weight: 650;
}

.lg-meta {
  font-size: 11.5px;
  color: var(--gray-400, #9ca3af);
  margin-bottom: 4px !important;
}

/* Dato del responsable sin completar: tiene que saltar a la vista en una
   revisión, no pasar desapercibido en producción. */
.lg-todo {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px dashed #fca5a5;
  border-radius: 5px;
  padding: 0 4px;
  font-size: 12px;
  font-weight: 600;
}

/* ── Casillas ────────────────────────────────────────────── */
.lg-check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--gray-700, #374151);
  cursor: pointer;
  background: var(--gray-50, #f9fafb);
  border: 1px solid var(--gray-200, #e5e7eb);
  border-radius: 11px;
  padding: 12px 14px;
}

.lg-check-soft {
  background: transparent;
  border-color: transparent;
  padding: 2px 14px;
  color: var(--gray-500, #6b7280);
}

.lg-check input {
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  margin: 1px 0 0;
  accent-color: var(--accent, #2563eb);
  cursor: pointer;
}

.lg-check b {
  color: var(--gray-900, #111827);
  font-weight: 650;
}

.lg-p {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--gray-500, #6b7280);
}

/* ── Acciones ────────────────────────────────────────────── */
.lg-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  align-items: center;
}

.lg-actions-read {
  justify-content: flex-start;
}

.lg-btn,
.lg-btn-ghost {
  border-radius: 11px;
  padding: 11px 18px;
  font: inherit;
  font-size: 13.5px;
  font-weight: 650;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}

.lg-btn {
  border: 0;
  background: var(--accent, #2563eb);
  color: #fff;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.22);
}

.lg-btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.lg-btn:disabled {
  opacity: .45;
  cursor: not-allowed;
  box-shadow: none;
}

.lg-btn-ghost {
  border: 1px solid var(--gray-200, #e5e7eb);
  background: #fff;
  color: var(--gray-500, #6b7280);
}

.lg-btn-ghost:hover {
  color: var(--gray-900, #111827);
}

.lg-x {
  position: absolute;
  top: 14px;
  right: 16px;
  border: 0;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  color: var(--gray-400, #9ca3af);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 8px;
}

.lg-x:hover {
  color: var(--gray-900, #111827);
  background: var(--gray-100, #f3f4f6);
}

/* ── Móvil ───────────────────────────────────────────────── */
@media (max-width: 640px) {
  .lg-gate,
  .lg-modal {
    padding: 0;
  }

  .lg-card {
    max-width: none;
    max-height: 100vh;
    height: 100vh;
    border-radius: 0;
    border: 0;
    padding: 20px 16px 16px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }

  .lg-tab {
    font-size: 11.5px;
  }

  .lg-actions {
    flex-direction: column-reverse;
  }

  .lg-actions .lg-btn,
  .lg-actions .lg-btn-ghost {
    width: 100%;
  }

  .lg-actions-read {
    flex-direction: column;
  }
}

/* La pantalla de aceptación no se imprime nunca. */
@media print {
  .lg-gate,
  .lg-modal {
    display: none !important;
  }
}
