#legal-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
}
#legal-modal.hidden { display: none; }
#legal-modal.modal-visible { opacity: 1; }

#modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

#modal-box {
  position: relative;
  z-index: 10;
  background: #fff;
  border-radius: 12px;
  width: 100%;
  max-width: 720px;
  max-height: 80vh;
  overflow-y: auto;
  margin: 1rem;
  padding: 2rem;
}

.legal-page-wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 3rem 1.25rem;
}

.legal-subline {
  font-size: 12px;
  color: #9ca3af;
  border-left: 2px solid #e5e7eb;
  padding-left: 12px;
  margin-bottom: 2rem;
  line-height: 1.65;
}

.legal-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}
.legal-card {
  background: #fff;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 12px;
  padding: 1.25rem;
}
.legal-card-icon { font-size: 1.5rem; margin-bottom: 0.5rem; }
.legal-card-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: #1a1a2e;
}
.legal-card-text {
  font-size: 13px;
  color: #6b7280;
  line-height: 1.65;
}

#modal-box h2 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 0.25rem;
}
#modal-box .modal-subtitle {
  font-size: 12px;
  color: #9ca3af;
  margin-bottom: 1.5rem;
}
#modal-box .legal-section-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #9ca3af;
  margin: 1.75rem 0 0.5rem;
}
#modal-box p, #modal-box li {
  font-size: 13.5px;
  color: #374151;
  line-height: 1.8;
}
#modal-box ul { margin: 0.5rem 0 0.5rem 1.2rem; }
#modal-box .pending {
  font-style: italic;
  color: #9ca3af;
}
.modal-close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: #6b7280;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 6px;
}
.modal-close-btn:hover { background: #f3f4f6; }
.legal-open-btn {
  display: inline-block;
  margin-top: 1rem;
  padding: 10px 20px;
  border: 1px solid rgba(0,0,0,0.15);
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  background: transparent;
  color: #1a1a2e;
  transition: background 0.15s;
}
.legal-open-btn:hover { background: #f3f4f6; }
.badge-pending {
  display: inline-block;
  font-size: 11px;
  background: #fef9c3;
  color: #92400e;
  border: 1px solid #fde68a;
  border-radius: 4px;
  padding: 2px 8px;
  margin-left: 6px;
}
.legal-version-badge {
  font-size: 12px;
  color: #9ca3af;
  background: #f1f3f5;
  padding: 2px 10px;
  border-radius: 20px;
  display: inline-block;
  margin-bottom: 1rem;
}

/* ── P15 legal templates ──────────────────────────────────────────────────── */
.legal-section-label { font-size: 11px; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; color: #9ca3af; margin-bottom: 10px; }
.legal-section-label--mt { margin-top: 2rem; }
.legal-footer-note { font-size: 12px; color: #9ca3af; margin-top: 2rem; padding-top: 1rem; border-top: 1px solid #e5e7eb; }
.legal-page-title  { font-size: 26px; font-weight: 600; margin-bottom: 0.4rem; }
.legal-pre-wrap    { white-space: pre-wrap; }
.legal-divider { border: none; border-top: 1px solid #e5e7eb; margin: 2rem 0; }
.legal-highlight-box { background: #fffbeb; border: 1.5px solid #f59e0b; border-radius: 8px; padding: 16px 20px; margin: 1.2rem 0 1.2rem; }
.legal-highlight-box p { margin: 0 0 8px; font-size: 13px; line-height: 1.65; color: #1a1a2e; }
.legal-highlight-box p:last-child { margin-bottom: 0; }
.legal-checkout-hint { background: #f0f7ff; border: 1.5px solid #3b82f6; border-radius: 8px; padding: 18px 22px; margin: 1.2rem 0; }
.legal-checkout-hint p { margin: 0 0 10px; font-size: 13px; line-height: 1.68; color: #1e3a5f; }
.legal-checkout-hint p:last-child { margin-bottom: 0; }
.legal-checkbox-label { background: #fff; border: 1px solid #cbd5e1; border-radius: 6px; padding: 10px 14px; margin-top: 8px; font-size: 13px; }
