/* Terms & privacy page */
.sb-legal-hero .hero-content { text-align: center; }
.sb-legal-hero .hero-desc { margin-inline: auto; max-width: 60ch; }

.sb-legal-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem 1.4rem; margin: 1.6rem 0 0; padding: 0; list-style: none; }
.sb-legal-meta li { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; color: var(--text-secondary); }
.sb-legal-meta i { color: var(--sky); font-size: 0.85rem; }
.sb-legal-meta b { color: var(--text-primary); font-weight: 600; }

.sb-legal-switch {
    display: inline-flex; gap: 0; margin-top: 1.6rem; padding: 4px;
    border: 1px solid var(--border-subtle); border-radius: 18px; corner-shape: squircle;
    background: var(--bg-card); box-shadow: var(--glass-edge);
}
.sb-legal-switch a {
    display: inline-flex; align-items: center; gap: 0.5rem; min-height: 44px; padding: 0 1.2rem;
    border-radius: 14px; corner-shape: squircle; color: var(--text-primary); font-weight: 600; text-decoration: none;
    transition: background 0.25s;
}
.sb-legal-switch a + a { box-shadow: inset 1px 0 0 var(--border-subtle); }
.sb-legal-switch a:hover { background: rgba(41, 171, 226, 0.12); box-shadow: none; }
.sb-legal-switch i { color: var(--sky); }

.sb-legal { padding-top: 0; }

/* Summary */
.sb-legal-summary {
    max-width: 1080px; margin: 0 auto 3rem; padding: clamp(1.4rem, 3vw, 2.2rem);
    border: 1px solid var(--border-subtle); border-radius: 26px; corner-shape: squircle;
    background:
        radial-gradient(60% 80% at 0% 0%, rgba(41, 171, 226, 0.12), transparent 60%),
        linear-gradient(160deg, rgba(230, 238, 248, 0.06), rgba(230, 238, 248, 0.015));
    box-shadow: var(--glass-edge), 0 24px 50px -32px rgba(0, 0, 0, 0.6);
}
.sb-legal-summary h2 { display: flex; align-items: center; gap: 0.6rem; margin: 0; font-size: 1.35rem; }
.sb-legal-summary h2 i { color: var(--amber); font-size: 1rem; }
.sb-legal-note { margin: 0.35rem 0 1.3rem; font-size: 0.85rem; color: var(--text-tertiary); }
.sb-legal-summary ul { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.8rem; margin: 0; padding: 0; list-style: none; }
.sb-legal-summary li {
    --tone: 41, 171, 226;
    padding: 1rem 1.1rem 1rem 1.2rem; border-radius: 16px; font-size: 0.93rem; line-height: 1.6; color: var(--text-secondary);
    background: rgba(var(--tone), 0.06); box-shadow: inset 3px 0 0 rgb(var(--tone));
}
.sb-legal-summary li b { display: block; margin-bottom: 0.2rem; color: var(--text-primary); font-size: 1rem; }
.sb-legal-summary .t-emerald { --tone: 18, 183, 106; }
.sb-legal-summary .t-amber { --tone: 255, 164, 27; }
.sb-legal-summary .t-coral { --tone: 255, 77, 94; }

/* Layout */
.sb-legal-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: clamp(2rem, 4vw, 3.5rem); max-width: 1180px; margin: 0 auto; align-items: start; }

/* TOC */
.sb-legal-toc { position: sticky; top: 100px; max-height: calc(100vh - 120px); overflow-y: auto; padding-right: 0.4rem; scrollbar-width: thin; }
.sb-legal-toc-h { margin: 0 0 0.5rem; font: 500 0.68rem var(--font-mono, monospace); letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-tertiary); }
.sb-legal-toc ol { margin: 0 0 1.6rem; padding: 0; list-style: none; counter-reset: toc; border-left: 1px solid var(--border-subtle); }
.sb-legal-toc li { counter-increment: toc; }
.sb-legal-toc a {
    display: flex; gap: 0.6rem; padding: 0.32rem 0 0.32rem 0.9rem; margin-left: -1px;
    border-left: 2px solid transparent; font-size: 0.85rem; line-height: 1.4; color: var(--text-secondary); text-decoration: none;
    transition: color 0.2s, border-color 0.2s;
}
.sb-legal-toc a::before { content: counter(toc); min-width: 1.3rem; font: 500 0.72rem/1.6 var(--font-mono, monospace); color: var(--text-tertiary); }
.sb-legal-toc a:hover { color: var(--text-primary); }
.sb-legal-toc a.is-active { color: var(--text-primary); border-left-color: var(--sky); }
.sb-legal-toc a.is-active::before { color: var(--sky); }

/* Document */
.sb-legal-doc { min-width: 0; color: var(--text-secondary); font-size: 1rem; line-height: 1.75; }
.sb-legal-part + .sb-legal-part { margin-top: 4rem; padding-top: 3rem; border-top: 1px solid var(--border-subtle); }
.sb-legal-part { scroll-margin-top: 100px; }
.sb-legal-part-head { display: flex; align-items: center; gap: 0.9rem; margin-bottom: 1.6rem; }
.sb-legal-part-head h2 { margin: 0; font-size: clamp(1.7rem, 3vw, 2.3rem); letter-spacing: -0.02em; }
.sb-legal-part-tag {
    padding: 0.3rem 0.65rem; border-radius: 10px; font: 600 0.7rem var(--font-mono, monospace); letter-spacing: 0.1em; text-transform: uppercase;
    color: var(--sky); background: rgba(41, 171, 226, 0.12); border: 1px solid rgba(41, 171, 226, 0.3);
}
.sb-legal-lead { font-size: 1.05rem; color: var(--text-secondary); }

.sb-legal-doc h3 {
    display: flex; align-items: baseline; gap: 0.75rem; scroll-margin-top: 100px;
    margin: 2.6rem 0 0.8rem; font-size: 1.25rem; line-height: 1.3; color: var(--text-primary);
}
.sb-legal-doc h3 > span {
    flex: none; display: inline-grid; place-items: center; min-width: 2rem; height: 2rem; padding: 0 0.4rem; translate: 0 -0.1rem;
    border-radius: 10px; corner-shape: squircle; font: 600 0.8rem var(--font-mono, monospace);
    color: var(--sky); background: rgba(41, 171, 226, 0.1); border: 1px solid rgba(41, 171, 226, 0.25);
}
#privacy h3 > span { color: var(--emerald); background: rgba(18, 183, 106, 0.1); border-color: rgba(18, 183, 106, 0.25); }
.sb-legal-doc h4 { margin: 1.4rem 0 0.4rem; font-size: 1rem; color: var(--text-primary); }
.sb-legal-doc p { margin: 0 0 0.9rem; }
.sb-legal-doc strong { color: var(--text-primary); }
.sb-legal-doc a { color: var(--sky); text-underline-offset: 3px; }
.sb-legal-doc ul { margin: 0 0 1rem; padding-left: 0; list-style: none; }
.sb-legal-doc ul > li { position: relative; padding-left: 1.3rem; margin-bottom: 0.45rem; }
.sb-legal-doc ul > li::before { content: ""; position: absolute; left: 0.2rem; top: 0.72em; width: 6px; height: 6px; border-radius: 50%; background: rgba(41, 171, 226, 0.6); }
#privacy ul > li::before { background: rgba(18, 183, 106, 0.6); }
.sb-legal-doc ul.sb-legal-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.1rem 1.5rem; }

/* Alert */
.sb-legal-alert {
    display: flex; gap: 0.9rem; margin-bottom: 1rem; padding: 1.1rem 1.25rem; border-radius: 18px; corner-shape: squircle;
    border: 1px solid rgba(255, 164, 27, 0.4); background: rgba(255, 164, 27, 0.08);
}
.sb-legal-alert i { flex: none; margin-top: 0.3rem; color: var(--amber); }
.sb-legal-alert p { margin: 0; }

/* Definitions */
.sb-legal-defs { display: grid; gap: 0.5rem; margin: 0 0 1rem; }
.sb-legal-defs > div { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 1rem; padding: 0.75rem 1rem; border-radius: 14px; background: rgba(230, 238, 248, 0.035); border: 1px solid var(--border-subtle); }
.sb-legal-defs dt { font-weight: 600; color: var(--text-primary); }
.sb-legal-defs dd { margin: 0; }

/* Tables */
.sb-legal-table { margin: 0 0 1rem; overflow-x: auto; border: 1px solid var(--border-subtle); border-radius: 16px; }
.sb-legal-table:focus-visible { outline: 2px solid var(--sky); outline-offset: 2px; }
.sb-legal-table table { width: 100%; border-collapse: collapse; font-size: 0.92rem; line-height: 1.6; }
.sb-legal-table th, .sb-legal-table td { padding: 0.8rem 1rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border-subtle); }
.sb-legal-table tr:last-child > * { border-bottom: 0; }
.sb-legal-table thead th { font: 500 0.7rem var(--font-mono, monospace); letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-tertiary); background: rgba(230, 238, 248, 0.03); }
.sb-legal-table tbody th { width: 30%; color: var(--text-primary); font-weight: 600; }
.sb-legal-table code { font-size: 0.82rem; padding: 0.1rem 0.35rem; border-radius: 6px; background: rgba(41, 171, 226, 0.1); color: var(--text-primary); }
.sb-legal-table em { color: var(--text-primary); font-style: normal; font-weight: 600; }

/* Rights */
.sb-legal-doc ul.sb-legal-rights { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; }
.sb-legal-doc ul.sb-legal-rights > li { display: flex; gap: 0.8rem; margin: 0; padding: 0.9rem 1rem; border-radius: 14px; border: 1px solid var(--border-subtle); background: rgba(18, 183, 106, 0.04); }
.sb-legal-doc ul.sb-legal-rights > li::before { content: none; }
.sb-legal-rights i { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; color: var(--emerald); background: rgba(18, 183, 106, 0.12); font-size: 0.85rem; }
.sb-legal-rights span { font-size: 0.92rem; line-height: 1.55; }
.sb-legal-rights b { display: block; color: var(--text-primary); }

/* Contact card */
.sb-legal-contact {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 2rem; margin: 0 0 1rem; padding: 1.3rem 1.4rem;
    border-radius: 18px; corner-shape: squircle; border: 1px solid rgba(18, 183, 106, 0.3); background: rgba(18, 183, 106, 0.05);
}
.sb-legal-contact p { margin: 0 0 0.35rem; }
.sb-legal-contact-h { font-weight: 700; color: var(--text-primary); }
.sb-legal-contact i { width: 1.2rem; margin-right: 0.5rem; color: var(--emerald); }

/* Light mode */
body.light-mode .sb-legal-summary { background: radial-gradient(60% 80% at 0% 0%, rgba(41, 171, 226, 0.1), transparent 60%), rgba(255, 255, 255, 0.75); }
body.light-mode .sb-legal-switch { background: rgba(255, 255, 255, 0.85); }
body.light-mode .sb-legal-defs > div, body.light-mode .sb-legal-table thead th { background: rgba(255, 255, 255, 0.6); }
body.light-mode .sb-legal-doc a { color: #0b6f9c; }

/* Responsive */
@media (max-width: 1024px) {
    .sb-legal-layout { grid-template-columns: minmax(0, 1fr); }
    .sb-legal-toc { display: none; }
}
@media (max-width: 720px) {
    .sb-legal-summary ul, .sb-legal-doc ul.sb-legal-cols, .sb-legal-doc ul.sb-legal-rights, .sb-legal-contact { grid-template-columns: minmax(0, 1fr); }
    .sb-legal-defs > div { grid-template-columns: minmax(0, 1fr); gap: 0.2rem; }
    .sb-legal-doc h3 { font-size: 1.12rem; }
    .sb-legal-switch { display: flex; width: 100%; }
    .sb-legal-switch a { flex: 1; justify-content: center; padding: 0 0.6rem; font-size: 0.92rem; }
    .sb-legal-table tbody th { width: auto; }
}
