/* Google-style Terms document modal */
body.terms-modal-open {
  overflow: hidden;
}

.terms-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.terms-modal-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.terms-modal-dialog {
  width: 100%;
  max-width: 720px;
  max-height: min(90vh, 820px);
  background: #fff;
  color: #202124;
  border-radius: 8px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28), 0 4px 12px rgba(0, 0, 0, 0.12);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  font-family: "DM Sans", Roboto, Arial, sans-serif;
}

.terms-modal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #e8eaed;
  position: sticky;
  top: 0;
  z-index: 1;
  background: #fff;
}

.terms-modal-title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 500;
  color: #202124;
  line-height: 1.3;
}

.terms-modal-icon-btn {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: #5f6368;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease;
}

.terms-modal-icon-btn:hover {
  background: #f1f3f4;
  color: #202124;
}

.terms-modal-body {
  padding: 1.25rem 1.5rem 0;
}

.terms-modal-loading,
.terms-modal-error {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.5;
  color: #5f6368;
}

.terms-modal-error a {
  color: #1a73e8;
}

.terms-doc {
  font-size: 0.875rem;
  line-height: 1.6;
  color: #3c4043;
}

.terms-doc .terms-h1 {
  margin: 0 0 0.75rem;
  font-size: 1.375rem;
  font-weight: 500;
  color: #202124;
  line-height: 1.3;
}

.terms-doc .terms-h2 {
  margin: 1.35rem 0 0.5rem;
  font-size: 1rem;
  font-weight: 500;
  color: #202124;
}

.terms-doc p {
  margin: 0 0 0.75rem;
}

.terms-doc .terms-ul {
  margin: 0 0 0.85rem 1.25rem;
  padding: 0;
}

.terms-doc .terms-ul li {
  margin-bottom: 0.35rem;
}

.terms-doc .terms-hr {
  border: none;
  border-top: 1px solid #e8eaed;
  margin: 1rem 0;
}

.terms-doc .terms-footnote {
  margin-top: 1.25rem;
  font-size: 0.8125rem;
  color: #5f6368;
}

.terms-doc strong {
  font-weight: 600;
  color: #202124;
}

.terms-modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 1rem 1rem 1.25rem;
  margin-top: 0.5rem;
  border-top: 1px solid #e8eaed;
}

.terms-modal-btn {
  min-height: 36px;
  padding: 0 1.25rem;
  border-radius: 4px;
  border: none;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.terms-modal-btn--text {
  background: transparent;
  color: #1a73e8;
}

.terms-modal-btn--text:hover {
  background: #e8f0fe;
}

.terms-modal-btn--primary {
  background: #1a73e8;
  color: #fff;
  box-shadow: 0 1px 2px rgba(26, 115, 232, 0.35);
}

.terms-modal-btn--primary:hover {
  background: #1765cc;
  box-shadow: 0 1px 3px rgba(26, 115, 232, 0.45);
}

@media (max-width: 480px) {
  .terms-modal-overlay {
    padding: 0;
    align-items: stretch;
  }

  .terms-modal-dialog {
    max-height: 100vh;
    border-radius: 0;
  }
}
