/* The legal pages (privacy, terms, cookies, index) and the accept page.
   Layout: sticky glass top bar -> navy hero (title, version chips) -> reading column with a sticky "On this page" rail on wide screens.
   Printable, light and dark. Tokens (--sx-*) come from staff.css, which every legal page loads first. */

.lg { background: var(--sx-canvas); color: var(--sx-text); scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
html { scroll-padding-top: 84px; }
.wx-logo-d { display: none; }
[data-bs-theme="dark"] .wx-logo-l { display: none; }
[data-bs-theme="dark"] .wx-logo-d { display: block; }

/* Reading progress */
.lg-progress { position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 60; background: transparent; pointer-events: none; }
.lg-progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--sx-cobalt), #7C8BFF); border-radius: 0 2px 2px 0; transition: width .12s linear; }

/* Top bar */
.lg-top { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 12px 20px; flex-wrap: wrap;
  padding: 12px max(20px, calc((100vw - 1180px) / 2));
  background: color-mix(in srgb, var(--sx-card) 82%, transparent); -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--sx-line); }
.lg-brand { display: inline-flex; align-items: center; margin-right: auto; border-radius: 3px; }
.lg-top nav { display: flex; gap: 4px; flex-wrap: wrap; padding: 4px; background: var(--sx-canvas); border: 1px solid var(--sx-line-soft); border-radius: 0; }
.lg-top nav a { color: var(--sx-muted); text-decoration: none; font-size: 13.5px; font-weight: 600; padding: 7px 15px; border-radius: 3px; transition: background .15s, color .15s; }
.lg-top nav a:hover { color: var(--sx-text); background: var(--sx-card); }
.lg-top nav a[aria-current="page"] { background: var(--sx-cobalt); color: #fff; box-shadow: 0 1px 2px rgba(14,21,38,.25); }
[data-bs-theme="dark"] .lg-top nav a[aria-current="page"] { background: #3F4FD8; }
.lg-tools { display: flex; gap: 8px; }
.lg-print, .lg-theme { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--sx-line); background: var(--sx-card); color: var(--sx-text); font: inherit; font-size: 13.5px; font-weight: 600; height: 36px; padding: 0 14px; border-radius: 0; cursor: pointer; transition: border-color .15s, color .15s, transform .15s; }
.lg-theme { width: 36px; padding: 0; justify-content: center; }
.lg-print:hover, .lg-theme:hover { border-color: var(--sx-cobalt); color: var(--sx-cobalt); }
.lg-print:active, .lg-theme:active { transform: scale(.97); }
.lg-print svg, .lg-theme svg { width: 16px; height: 16px; flex: none; }
.lg-theme .i-sun { display: none; }
[data-bs-theme="dark"] .lg-theme .i-sun { display: block; }
[data-bs-theme="dark"] .lg-theme .i-moon { display: none; }

/* Hero */
.lg-hero { position: relative; overflow: hidden; color: #fff; background: var(--sx-night, #0E1526);
  background-image: radial-gradient(900px 340px at 85% -10%, rgba(124,139,255,.38), transparent 60%), radial-gradient(700px 300px at 0% 120%, rgba(33,47,176,.55), transparent 60%);
  padding: clamp(40px, 7vw, 76px) max(20px, calc((100vw - 1180px) / 2)) clamp(64px, 8vw, 92px); }
.lg-hero::after { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px);
  background-size: 44px 44px; -webkit-mask-image: linear-gradient(180deg, #000, transparent 85%); mask-image: linear-gradient(180deg, #000, transparent 85%); }
.lg-hero > * { position: relative; z-index: 1; max-width: 760px; }
.lg-eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: #B9C1FF; margin: 0 0 14px; }
.lg-eyebrow::before { content: ""; width: 22px; height: 2px; border-radius: 0; background: #7C8BFF; }
.lg-hero h1 { font-size: clamp(32px, 5.4vw, 54px); line-height: 1.05; letter-spacing: -.035em; font-weight: 800; margin: 0 0 14px; color: #fff; }
.lg-sub { font-size: clamp(15.5px, 2vw, 18px); line-height: 1.6; color: rgba(233,236,245,.78); margin: 0 0 22px; max-width: 640px; }
.lg-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.lg-chips li { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; color: #E3E7FF; padding: 6px 12px; border-radius: 2px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14); }
.lg-chips svg { width: 14px; height: 14px; opacity: .85; }

/* Page layout */
.lg-main { padding: 0 20px 64px; }
.lg-wrap { max-width: 1180px; margin: -44px auto 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; position: relative; z-index: 2; }
.lg-rail { display: none; }
.lg-col { min-width: 0; max-width: 800px; margin: 0 auto; width: 100%; }

.lg-draft { margin: 0 0 18px; padding: 13px 16px; border-radius: 3px; background: var(--sx-warn-soft); color: var(--sx-warn); border: 1px solid color-mix(in srgb, var(--sx-warn) 45%, transparent); font-size: 14px; line-height: 1.55; display: flex; gap: 11px; align-items: flex-start; }
.lg-draft::before { content: "!"; flex: none; width: 20px; height: 20px; margin-top: 1px; border-radius: 3px; background: var(--sx-warn); color: var(--sx-card); font-weight: 800; font-size: 13px; display: grid; place-items: center; }
.lg-draft b { font-weight: 700; }

/* The document card */
.lg-doc { background: var(--sx-card); border: 1px solid var(--sx-line); border-radius: 0; padding: clamp(22px, 5vw, 56px);
  box-shadow: 0 1px 2px rgba(14,21,38,.04), 0 12px 40px -16px rgba(14,21,38,.14); }
[data-bs-theme="dark"] .lg-doc { box-shadow: 0 12px 40px -16px rgba(0,0,0,.6); }
.lg-lede { font-size: clamp(17px, 2.2vw, 19px); line-height: 1.65; color: var(--sx-text); margin: 0 0 28px; padding-bottom: 26px; border-bottom: 1px solid var(--sx-line); font-weight: 500; }
.lg-lede a { font-weight: 600; }

/* Inline contents (fallback and mobile) */
.lg-toc { background: var(--sx-canvas); border: 1px solid var(--sx-line-soft); border-radius: 0; padding: 18px 20px 14px; margin: 0 0 34px; font-size: 14.5px; }
.lg-toc b { display: block; margin: 0 0 8px; font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--sx-muted); font-weight: 700; }
.lg-toc ol { margin: 0; padding: 0; list-style: none; counter-reset: toc; columns: 2; column-gap: 28px; }
.lg-doc .lg-toc ol { margin: 0; }
.lg-toc li { counter-increment: toc; margin: 0; break-inside: avoid; }
.lg-toc li a { display: flex; gap: 10px; align-items: baseline; padding: 6px 8px; margin: 0 -8px; border-radius: 0; color: var(--sx-text); text-decoration: none; font-weight: 500; line-height: 1.4; transition: background .15s, color .15s; }
.lg-toc li a::before { content: counter(toc, decimal-leading-zero); min-width: 20px; font-size: 12px; font-weight: 700; color: var(--sx-cobalt); font-variant-numeric: tabular-nums; flex: none; }
.lg-toc li a:hover { background: var(--sx-tint); color: var(--sx-cobalt); }

/* Sticky rail (built by legal.js on wide screens) */
.lg-rail-box { position: sticky; top: 88px; max-height: calc(100vh - 110px); overflow: auto; padding: 4px 0 4px 4px; }
#lg-rail-toc > b { display: block; font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--sx-muted); font-weight: 700; margin: 0 0 10px 14px; }
.lg-rail-box ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--sx-line); }
#lg-rail-toc a { display: block; position: relative; padding: 7px 12px 7px 16px; margin-left: -1px; border-left: 2px solid transparent; font-size: 13.5px; line-height: 1.4; font-weight: 500; color: var(--sx-muted); text-decoration: none; transition: color .15s, border-color .15s, background .15s; }
#lg-rail-toc a:hover { color: var(--sx-text); }
#lg-rail-toc a.is-active { color: var(--sx-cobalt); border-left-color: var(--sx-cobalt); font-weight: 700; background: linear-gradient(90deg, var(--sx-tint), transparent); }
.lg-rail-help { margin: 20px 0 0 14px; padding: 14px 15px; border: 1px solid var(--sx-line); border-radius: 0; background: var(--sx-card); font-size: 13px; line-height: 1.5; color: var(--sx-muted); }
.lg-rail-help b { display: block; margin: 0 0 4px; font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--sx-muted); }
.lg-rail-help a { color: var(--sx-cobalt); font-weight: 600; word-break: break-word; }

/* Typography */
.lg-doc h2 { font-size: clamp(20px, 2.6vw, 24px); line-height: 1.25; letter-spacing: -.02em; font-weight: 800; margin: 46px 0 14px; scroll-margin-top: 90px; display: flex; align-items: baseline; gap: 12px; }
.lg-doc h2::before { content: ""; flex: none; align-self: center; width: 6px; height: 22px; border-radius: 0; background: linear-gradient(180deg, var(--sx-cobalt), #7C8BFF); }
.lg-doc h3 { font-size: 16.5px; margin: 24px 0 6px; font-weight: 700; }
.lg-doc p, .lg-doc li { font-size: 16px; line-height: 1.72; color: var(--sx-text); }
.lg-doc p { margin: 0 0 14px; }
.lg-doc ul, .lg-doc ol { margin: 0 0 18px; padding-left: 0; list-style: none; }
.lg-doc .lg-toc li { padding-left: 0; margin: 0; }
.lg-doc ul > li { position: relative; padding-left: 24px; margin: 9px 0; }
.lg-doc ul > li::before { content: ""; position: absolute; left: 4px; top: .72em; width: 7px; height: 7px; border-radius: 50%; background: var(--sx-cobalt); opacity: .85; }
.lg-doc li > ul { margin-top: 8px; }
.lg-doc b, .lg-doc strong { font-weight: 700; }
.lg-doc a { color: var(--sx-cobalt); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--sx-cobalt) 40%, transparent); text-underline-offset: 3px; text-decoration-thickness: 1.5px; transition: text-decoration-color .15s; }
.lg-doc a:hover { text-decoration-color: currentColor; }
.lg-doc code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88em; background: var(--sx-tint); color: var(--sx-cobalt); border: 1px solid var(--sx-line-soft); padding: 2px 7px; border-radius: 2px; white-space: nowrap; }
.lg-doc .lg-toc a { text-decoration: none; }

/* Tables */
.lg-table-wrap { overflow-x: auto; margin: 6px 0 20px; border: 1px solid var(--sx-line); border-radius: 0; background: var(--sx-card); }
.lg-doc table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14.5px; }
.lg-doc th, .lg-doc td { text-align: left; vertical-align: top; padding: 14px 16px; border-bottom: 1px solid var(--sx-line-soft); line-height: 1.6; }
.lg-doc th { background: var(--sx-canvas); font-weight: 700; font-size: 11.5px; letter-spacing: .09em; text-transform: uppercase; color: var(--sx-muted); white-space: nowrap; border-bottom: 1px solid var(--sx-line); }
.lg-doc tbody tr:last-child td { border-bottom: 0; }
.lg-doc tbody tr { transition: background .15s; }
.lg-doc tbody tr:hover { background: color-mix(in srgb, var(--sx-tint) 55%, transparent); }
.lg-doc td:first-child { min-width: 180px; }
.lg-doc td p { font-size: inherit; }

/* Notes and flags */
.legal-unset { background: var(--sx-warn-soft); color: var(--sx-warn); border: 1px dashed var(--sx-warn); border-radius: 0; padding: 1px 7px; font-weight: 600; }
.lawyer-note { margin: 14px 0 22px; padding: 13px 16px; border: 1px solid color-mix(in srgb, var(--sx-warn) 35%, transparent); border-top: 3px solid var(--sx-warn); background: var(--sx-warn-soft); color: var(--sx-text); border-radius: 0; font-size: 14px; line-height: 1.6; }
.lawyer-note::before { content: "For the lawyer / owner"; display: block; font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--sx-warn); margin-bottom: 4px; }

/* Footer */
.lg-foot { padding: 34px 20px 44px; text-align: center; color: var(--sx-muted); font-size: 13.5px; border-top: 1px solid var(--sx-line); background: var(--sx-card); }
.lg-foot-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 22px; margin-bottom: 12px; }
.lg-foot a { color: var(--sx-muted); text-decoration: none; font-weight: 600; }
.lg-foot a:hover { color: var(--sx-cobalt); text-decoration: underline; }
.lg-foot small { display: block; font-size: 12.5px; color: var(--sx-faint); }

/* Legal index cards */
.lg-cards { display: grid; grid-template-columns: 1fr; gap: 14px; margin: 0 0 24px; padding: 0; list-style: none; }
.lg-doc ul.lg-cards > li { padding: 0; margin: 0; }
.lg-doc ul.lg-cards > li::before { display: none; }
.lg-card { display: block; height: 100%; padding: 20px 22px; border: 1px solid var(--sx-line); border-radius: 0; background: var(--sx-canvas); color: var(--sx-text); text-decoration: none !important; transition: border-color .15s, transform .15s, box-shadow .15s; }
.lg-card:hover { border-color: var(--sx-cobalt); transform: translateY(-2px); box-shadow: 0 10px 28px -14px rgba(33,47,176,.45); }
.lg-card b { display: block; font-size: 17px; margin-bottom: 6px; color: var(--sx-cobalt); }
.lg-card span { display: block; font-size: 14.5px; line-height: 1.55; color: var(--sx-muted); }
.lg-card em { display: inline-block; margin-top: 12px; font-style: normal; font-size: 13px; font-weight: 700; color: var(--sx-cobalt); }

/* Back to top */
.lg-top-btn { position: fixed; right: 20px; bottom: 20px; width: 44px; height: 44px; border-radius: 3px; border: 1px solid var(--sx-line); background: var(--sx-card); color: var(--sx-text); box-shadow: 0 8px 24px -8px rgba(14,21,38,.35); cursor: pointer; display: grid; place-items: center; opacity: 0; transform: translateY(8px); pointer-events: none; transition: opacity .2s, transform .2s, border-color .15s, color .15s; z-index: 40; }
.lg-top-btn.is-on { opacity: 1; transform: none; pointer-events: auto; }
.lg-top-btn:hover { border-color: var(--sx-cobalt); color: var(--sx-cobalt); }
.lg-top-btn svg { width: 18px; height: 18px; }

/* Accept page (inside the auth split) */
.lg-accept-list { margin: 16px 0 20px; padding: 0; list-style: none; display: grid; gap: 8px; }
.lg-accept-list li { margin: 0; }
.lg-accept-list a { display: block; padding: 11px 14px; border: 1px solid var(--sx-line); border-radius: 0; background: var(--sx-card); color: var(--sx-cobalt); font-weight: 600; text-decoration: none; transition: border-color .15s, background .15s; }
.lg-accept-list a:hover { border-color: var(--sx-cobalt); background: var(--sx-tint); }
.lg-check { display: flex; gap: 10px; align-items: flex-start; font-size: 14.5px; line-height: 1.5; margin: 0 0 16px; cursor: pointer; }
.lg-check input { margin-top: 3px; width: 18px; height: 18px; flex: none; accent-color: var(--sx-cobalt); }
.lg-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.lg-link-btn { background: none; border: 0; padding: 0; font: inherit; font-size: 14px; color: var(--sx-muted); text-decoration: underline; cursor: pointer; }
.lg-delete { margin-top: 26px; border-top: 1px solid var(--sx-line); padding-top: 14px; font-size: 14px; color: var(--sx-muted); }
.lg-delete summary { cursor: pointer; font-weight: 600; }
.lg-delete .sx-field { margin-top: 12px; }

/* Wide screens: show the sticky rail (only when JS built it), hide the inline contents */
@media (min-width: 1080px) {
  .lg-wrap.lg-has-rail { grid-template-columns: 250px minmax(0, 800px); justify-content: center; gap: 44px; }
  .lg-wrap.lg-has-rail .lg-rail { display: block; order: -1; padding-top: 44px; }
  .lg-wrap.lg-has-rail .lg-col { margin: 0; }
  .lg-wrap.lg-has-rail .lg-doc .lg-toc { display: none; }
}
@media (min-width: 720px) { .lg-cards { grid-template-columns: repeat(3, 1fr); } }

@media (max-width: 760px) {
  .lg-top { padding: 10px 16px; gap: 10px; }
  .lg-top nav { order: 3; width: 100%; justify-content: space-between; overflow-x: auto; flex-wrap: nowrap; }
  .lg-top nav a { padding: 7px 12px; white-space: nowrap; flex: 1 1 auto; text-align: center; }
  .lg-print span { display: none; }
  .lg-print { width: 36px; padding: 0; justify-content: center; }
  .lg-hero { padding-left: 18px; padding-right: 18px; }
  .lg-main { padding: 0 12px 48px; }
  .lg-wrap { margin-top: -36px; }
}
@media (max-width: 640px) {
  .lg-toc ol { columns: 1; }
  .lg-doc { border-radius: 0; }
  .lg-doc h2::before { height: 18px; }
  /* A table becomes a stack of small cards: each row one card, each cell labelled by its column (data-label), so nothing scrolls sideways. */
  .lg-table-wrap { overflow-x: visible; border: 0; background: transparent; border-radius: 0; }
  .lg-doc table, .lg-doc tbody, .lg-doc tr, .lg-doc td { display: block; width: 100%; }
  .lg-doc thead { position: absolute; left: -9999px; top: auto; width: 1px; height: 1px; overflow: hidden; }
  .lg-doc tr { border: 1px solid var(--sx-line); border-radius: 0; margin: 0 0 12px; padding: 6px 0; background: var(--sx-card); }
  .lg-doc tbody tr:hover { background: var(--sx-card); }
  .lg-doc td { border: 0 !important; padding: 7px 16px; }
  .lg-doc td:first-child { min-width: 0; }
  .lg-doc td[data-label]::before { content: attr(data-label); display: block; font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--sx-muted); margin-bottom: 2px; }
}

@media (prefers-reduced-motion: reduce) {
  .lg { scroll-behavior: auto; }
  .lg *, .lg-progress i { transition: none !important; }
}

@media print {
  .no-print, .lg-top, .lg-foot, .lg-print, .lg-hero::after, .lg-progress, .lg-rail, .lg-top-btn { display: none !important; }
  .lg, .lg-main, .lg-doc { background: #fff !important; color: #000 !important; }
  .lg-hero { background: none !important; color: #000 !important; padding: 0 0 12px; border-bottom: 2px solid #000; }
  .lg-hero h1, .lg-sub, .lg-eyebrow, .lg-chips li { color: #000 !important; background: none !important; border-color: #999 !important; }
  .lg-eyebrow::before { background: #000; }
  .lg-main { padding: 0; }
  .lg-wrap { margin: 16px 0 0; display: block; }
  .lg-doc { border: 0; padding: 0; max-width: none; box-shadow: none; border-radius: 0; }
  .lg-doc p, .lg-doc li, .lg-doc td { color: #000 !important; }
  .lg-doc a { color: #000; text-decoration: underline; }
  .lg-doc a[href^="http"]::after { content: " (" attr(href) ")"; font-size: .85em; }
  .lg-doc h2 { break-after: avoid; }
  .lg-doc h2::before { background: #000; }
  .lg-doc table, .lg-doc tr { break-inside: avoid; }
  .lg-table-wrap { border-color: #999; }
  .lg-toc { display: block !important; background: none; }
  .lg-draft, .lawyer-note { border: 1px solid #000; background: #fff !important; color: #000 !important; }
  .lg-draft::before { display: none; }
}
