.terms-gate {
  position: fixed;
  inset: 0;
  z-index: 10030;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.1rem;
}

.terms-gate.hidden,
.terms-gate[hidden] {
  display: none;
}

.terms-gate-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
}

.terms-gate-panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(38rem, calc(100vw - 2rem));
  max-height: min(42rem, calc(100vh - 2rem));
  overflow: hidden;
  padding: 1.15rem 1.25rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
  outline: none;
}

.terms-gate-brand {
  margin: 0 0 0.55rem;
  font-size: 1.85rem;
  text-align: center;
}

.terms-gate-title {
  margin: 0 0 0.35rem;
  font-size: 1.2rem;
  line-height: 1.25;
}

.terms-gate-view {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
}

.terms-gate-view[hidden] {
  display: none;
}

.terms-gate-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 0.15rem 0.35rem 0.75rem 0;
  font-size: 0.88rem;
  line-height: 1.5;
}

.terms-gate-scroll p {
  margin: 0 0 0.7rem;
}

.terms-gate-scroll h3 {
  margin: 0.85rem 0 0.35rem;
  font-size: 0.92rem;
}

.terms-gate-scroll ul {
  margin: 0 0 0.7rem;
  padding-left: 1.15rem;
}

.terms-gate-scroll li + li {
  margin-top: 0.28rem;
}

.terms-gate-check {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin: 0.15rem 0 0.85rem;
  font-size: 0.88rem;
  line-height: 1.4;
  font-weight: 600;
  cursor: pointer;
}

.terms-gate-check input {
  margin-top: 0.18rem;
  flex: 0 0 auto;
}

.terms-gate-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.terms-gate-export-note {
  margin: 0.7rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.4;
}

.terms-gate-export-note[hidden] {
  display: none;
}

/* Opaque dialog surface, independent of the page's glass theme. */
#ml-terms-gate .terms-gate-panel {
  background: #fff;
  color: #1e293b;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.22);
}
#ml-terms-gate .terms-gate-brand {
  margin: 0.65rem 0 1.25rem;
  font: 700 2rem/1.2 var(--app-font) !important;
  color: #263746;
  text-align: center;
  white-space: nowrap;
}
#ml-terms-gate .terms-brand-vector {
  display: inline-block;
  width: .29833984375em;
  height: .71337890625em;
  vertical-align: baseline;
  overflow: visible;
}
#ml-terms-gate .terms-gate-title {
  margin-bottom: 1rem;
}
#ml-terms-gate .terms-gate-scroll {
  padding-right: .75rem;
  scrollbar-gutter: stable;
  line-height: 1.65;
}
#ml-terms-gate .terms-gate-check {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: .65rem;
  margin: .75rem 0 1rem;
  padding-top: 1rem;
  border-top: 1px solid #e2e8f0;
  color: #475569;
}
#ml-terms-gate .terms-gate-check input {
  width: 1rem;
  height: 1rem;
  margin: .15rem 0 0;
}
#ml-terms-gate .terms-gate-check span {
  font-size: .82rem !important;
  font-weight: 400 !important;
  line-height: 1.45;
}
#ml-terms-gate .terms-gate-actions .btn {
  min-height: 2.6rem;
  border-radius: 9px;
}
#ml-terms-gate .terms-gate-actions .secondary {
  background: #fff;
  color: #334155;
  border-color: #cbd5e1;
}
@media (max-width: 540px) {
  #ml-terms-gate .terms-gate-panel { padding: 1rem; }
  #ml-terms-gate .terms-gate-actions .btn { flex: 1 1 auto; }
}

#ml-terms-gate .terms-gate-decline-note {
  margin: 0 0 .85rem;
  padding: .65rem .8rem;
  border-radius: 8px;
  background: #f1f5f9;
  color: #334155;
  font-size: .82rem !important;
  font-weight: 400 !important;
  line-height: 1.5;
}
#ml-terms-gate .terms-gate-actions .btn[data-terms-decline-btn] {
  background: #e2e8f0;
  border: 1px solid #64748b;
  color: #1e293b;
  font-weight: 600 !important;
  opacity: 1;
}
#ml-terms-gate .terms-gate-actions .btn[data-terms-decline-btn]:hover {
  background: #cbd5e1;
  border-color: #334155;
}
#ml-terms-gate .terms-gate-actions .btn[data-terms-decline-btn]:focus-visible {
  outline: 2px solid #334155;
  outline-offset: 3px;
}

.terms-settings-status {
  padding: .85rem 1rem;
  border-radius: var(--radius);
  background: #f1f5f9;
  color: #475569;
}
.terms-settings-status.is-accepted {
  background: #ecfdf5;
  border: 1px solid #86efac;
  color: #166534;
  font-weight: 600;
}
