.legal-ribbons { position: absolute; left: 0; top: 0; width: 100%; height: 560px; pointer-events: none; opacity: .7; }
.legal-glow { position: absolute; left: 50%; top: -260px; width: 1200px; height: 760px; transform: translateX(-50%); background: radial-gradient(closest-side, rgba(22,48,249,.26), rgba(22,48,249,0) 72%); pointer-events: none; }
.page > header, .page > .legal-grid, .page > footer { position: relative; }
.navlinks a[aria-current=page] { color: var(--fg); background: rgba(255,255,255,.08); }

.legal-head { max-width: 1120px; margin: 0 auto; padding: 96px 32px 48px; display: flex; flex-direction: column; gap: 20px; }
.eyebrow { align-self: flex-start; padding: 6px 12px; border-radius: 999px; background: rgba(131,146,255,.12); color: var(--brand-ink); font-size: 12px; font-weight: 700; letter-spacing: .02em; }
.legal-head h1 { font-weight: 900; font-size: clamp(52px, 8vw, 104px); line-height: .92; letter-spacing: -0.055em; }
.lede { max-width: 560px; font-size: 20px; line-height: 1.5; color: var(--muted); }
.meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.meta span { padding: 8px 14px; border-radius: 999px; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.10); color: var(--muted); font-size: 13px; font-weight: 700; }
.meta b { color: var(--fg); font-weight: 700; margin-left: 4px; }

.legal-grid { max-width: 1120px; margin: 0 auto; padding: 0 32px 96px; display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 40px; align-items: start; }
.toc { position: sticky; top: 96px; max-height: calc(100vh - 120px); overflow: auto; padding: 20px 8px 20px 0; scrollbar-width: thin; scrollbar-color: #2a2a34 transparent; }
.toc summary { list-style: none; cursor: default; color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; padding: 0 12px 12px; }
.toc summary::-webkit-details-marker { display: none; }
.toc ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.toc a { display: flex; gap: 12px; align-items: baseline; padding: 8px 12px; border-radius: 12px; color: var(--muted); font-size: 14px; font-weight: 700; line-height: 1.35; transition: background .25s, color .25s; }
.toc a span { flex: none; width: 20px; font-family: var(--font-mono); font-size: 11px; color: #6d6f78; }
.toc a:hover { background: rgba(255,255,255,.05); color: var(--fg); opacity: 1; }
.toc a[aria-current=true] { background: var(--brand-soft); color: #fff; }
.toc a[aria-current=true] span { color: var(--brand-ink); }

.doc { padding: clamp(24px, 4vw, 56px); border-radius: 36px; background: var(--surface-1); border: 1px solid rgba(255,255,255,.08); min-width: 0; }
.doc h2 { display: flex; align-items: baseline; gap: 14px; margin: 56px 0 14px; padding-top: 8px; font-weight: 900; font-size: clamp(26px, 3vw, 34px); letter-spacing: -0.035em; line-height: 1.1; scroll-margin-top: 100px; }
.doc h2:first-child { margin-top: 0; }
.doc h2 .num { flex: none; font-family: var(--font-mono); font-weight: 500; font-size: 14px; letter-spacing: 0; color: var(--brand-ink); }
.doc h3 { margin: 28px 0 10px; font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.doc p { margin: 0 0 16px; color: #c4c4d0; font-size: 16px; line-height: 1.7; }
.doc ul { margin: 0 0 20px; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.doc li { position: relative; padding-left: 24px; color: #c4c4d0; font-size: 16px; line-height: 1.65; }
.doc li::before { content: ""; position: absolute; left: 4px; top: .72em; width: 6px; height: 6px; border-radius: 999px; background: var(--brand-ink); }
.doc strong { color: var(--fg); font-weight: 700; }
.doc a { text-decoration: underline; text-decoration-color: rgba(131,146,255,.4); text-underline-offset: 3px; }
.doc a:hover { text-decoration-color: var(--brand-ink); opacity: 1; }
.doc code { padding: 2px 7px; border-radius: 8px; background: var(--surface-3); color: var(--brand-ink); font-family: var(--font-mono); font-size: .86em; white-space: nowrap; }
.tbl-scroll { margin: 8px 0 24px; overflow-x: auto; border-radius: 20px; border: 1px solid rgba(255,255,255,.08); }
.doc table { width: 100%; min-width: 520px; border-collapse: collapse; font-size: 15px; }
.doc th { text-align: left; padding: 14px 18px; background: rgba(255,255,255,.04); color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.doc td { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.07); color: #c4c4d0; line-height: 1.55; vertical-align: top; }
.doc td.k { color: var(--fg); font-weight: 700; width: 30%; }
.doc-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; margin-top: 56px; padding-top: 28px; border-top: 1px solid rgba(255,255,255,.08); }
.doc-foot > a:last-child { color: var(--muted); font-weight: 700; font-size: 14px; }
.legal-foot { border-top: 1px solid rgba(255,255,255,.08); padding: 24px 32px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; color: var(--muted); font-size: 13px; }
.legal-foot a { color: var(--muted); font-weight: 700; }

@media (max-width: 900px) {
  .legal-grid { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .toc { position: static; max-height: none; padding: 0; }
  .toc details { border-radius: 20px; background: var(--surface-1); border: 1px solid rgba(255,255,255,.08); padding: 4px 8px 8px; }
  .toc summary { cursor: pointer; padding: 14px 12px 8px; }
  .toc details:not([open]) summary { padding-bottom: 14px; }
  .legal-head { padding-top: 72px; }
}
@media (max-width: 560px) { .legal-head, .legal-grid { padding-left: 16px; padding-right: 16px; } .doc { border-radius: 28px; } .doc td.k { width: auto; } }

/* Phones: tables become stacked rows instead of scrolling sideways */
@media (max-width: 560px) {
  .tbl-scroll { overflow: visible; border: 0; }
  .doc table, .doc tbody, .doc tr, .doc td { display: block; min-width: 0; width: 100%; }
  .doc thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .doc tr { margin-bottom: 12px; border: 1px solid rgba(255,255,255,.08); border-radius: 18px; overflow: hidden; background: rgba(255,255,255,.02); }
  .doc td { border-top: 0; padding: 10px 16px; }
  .doc td.k { width: 100%; padding-top: 14px; font-size: 16px; }
  .doc td:not(.k)::before { content: attr(data-label); display: block; margin-bottom: 2px; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
  .doc td:last-child { padding-bottom: 14px; }
}
