:root {
    --orbi: #06392f;
    --orbi-hover: #0a4c3e;
    --legal-bg: #050605;
    --legal-panel: #070807;
    --legal-surface: #0b0d0b;
    --legal-soft: #111411;
    --legal-border: #252925;
    --legal-border-hover: #3d433e;
    --legal-heading: #f2f4f2;
    --legal-text: #c2c8c3;
    --legal-muted: #7c847f;
    --legal-link: #94b2a6;
    --legal-warning: #d0ac61;
    --legal-danger: #f0a39b;
    --legal-success: #86c9ab;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; color-scheme: dark; }
body {
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
    background: radial-gradient(circle at 72% -8%, rgba(6,57,47,.17), transparent 30rem), var(--legal-bg);
    color: var(--legal-text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 15px;
    line-height: 1.72;
    -webkit-font-smoothing: antialiased;
}
a {
    color: var(--legal-link);
    text-decoration-color: rgba(148,178,166,.45);
    text-decoration-thickness: 1px;
    text-underline-offset: 4px;
    transition: color .18s ease, text-decoration-color .18s ease;
}
a:hover { color: #c1d2cb; text-decoration-color: currentColor; }
:where(a, button, select, textarea):focus-visible { outline: 2px solid var(--legal-link); outline-offset: 3px; }

.skip-link {
    position: fixed;
    z-index: 1000;
    top: 10px;
    left: 12px;
    transform: translateY(-160%);
    padding: 10px 14px;
    border: 1px solid var(--legal-border-hover);
    border-radius: 7px;
    background: var(--legal-heading);
    color: var(--legal-bg);
    font-size: .75rem;
    font-weight: 600;
    text-decoration: none;
}
.skip-link:focus { transform: translateY(0); }

.legal-topbar {
    position: sticky;
    z-index: 50;
    top: 0;
    border-bottom: 1px solid rgba(255,255,255,.06);
    background: rgba(5,6,5,.88);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}
.legal-topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
    width: min(1120px, calc(100% - 40px));
    min-height: 68px;
    margin: 0 auto;
}
.legal-brand { display: inline-flex; flex: 0 0 auto; align-items: center; color: var(--legal-heading); text-decoration: none; }
.legal-brand img { display: block; width: 70px; height: auto; filter: brightness(0) invert(1); opacity: .92; }
.legal-brand span { position: relative; margin-left: 14px; padding-left: 14px; color: var(--legal-muted); font-size: .68rem; font-weight: 500; letter-spacing: .02em; }
.legal-brand span::before { content: ""; position: absolute; top: 50%; left: 0; width: 1px; height: 18px; transform: translateY(-50%); background: var(--legal-border); }
.legal-tabs { display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
.legal-tabs a {
    min-height: 38px;
    padding: 9px 11px;
    border: 1px solid transparent;
    border-radius: 7px;
    color: #858e88;
    font-size: .72rem;
    font-weight: 500;
    line-height: 18px;
    text-decoration: none;
    white-space: nowrap;
    transition: background .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
}
.legal-tabs a:hover { border-color: var(--legal-border); background: var(--legal-soft); color: var(--legal-heading); transform: translateY(-1px); }
.legal-tabs a[aria-current="page"] { border-color: #303530; background: #111411; color: #d8ddd9; }
.legal-tabs .back-to-login { margin-left: 5px; border-color: var(--legal-border); }

.legal-hero {
    border-bottom: 1px solid rgba(255,255,255,.055);
    background: linear-gradient(90deg, rgba(6,57,47,.08), transparent 48%), rgba(7,8,7,.72);
}
.legal-hero-inner { width: min(960px, calc(100% - 40px)); margin: 0 auto; padding: clamp(62px,8vw,94px) 0 clamp(48px,6vw,70px); animation: legal-enter .45s ease-out both; }
.legal-kicker { margin: 0 0 17px; color: #78958a; font-size: .67rem; font-weight: 600; letter-spacing: .15em; line-height: 1.4; text-transform: uppercase; }
.legal-hero h1 { max-width: 780px; margin: 0; color: var(--legal-heading); font-size: clamp(2.25rem,5.6vw,3.9rem); font-weight: 500; letter-spacing: -.055em; line-height: 1.02; }
.legal-deck { max-width: 720px; margin: 21px 0 0; color: #8d9690; font-size: clamp(.91rem,1.7vw,1.02rem); line-height: 1.75; }
.legal-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 27px; }
.legal-meta span { position: relative; color: #68706b; font-size: .68rem; font-weight: 500; }
.legal-meta span + span { padding-left: 18px; }
.legal-meta span + span::before { content: ""; position: absolute; top: 50%; left: 0; width: 3px; height: 3px; border-radius: 50%; background: #465049; }

.legal-shell {
    display: grid;
    grid-template-columns: minmax(190px,235px) minmax(0,720px);
    gap: clamp(44px,7vw,88px);
    justify-content: center;
    width: min(1080px, calc(100% - 40px));
    margin: 0 auto;
    padding: 54px 0 90px;
}
.legal-toc { position: sticky; top: 92px; align-self: start; max-height: calc(100vh - 118px); overflow: auto; padding-right: 13px; scrollbar-color: #2c312d transparent; scrollbar-width: thin; }
.legal-toc strong { display: block; margin: 0 0 14px; color: #9ba39d; font-size: .66rem; font-weight: 600; letter-spacing: .13em; text-transform: uppercase; }
.legal-toc nav { display: grid; gap: 1px; }
.legal-toc a { display: block; padding: 6px 10px; border-left: 1px solid #202320; color: #626a65; font-size: .7rem; line-height: 1.45; text-decoration: none; transition: border-color .18s ease, color .18s ease, background .18s ease; }
.legal-toc a:hover, .legal-toc a.active { border-left-color: #65877a; background: linear-gradient(90deg, rgba(6,57,47,.2), transparent 92%); color: #b8c5bf; }
.legal-document { min-width: 0; animation: legal-enter .48s .05s ease-out both; }

.legal-summary { margin-bottom: 7px; padding: 24px 25px; border: 1px solid #26342f; border-radius: 11px; background: linear-gradient(135deg, rgba(6,57,47,.19), rgba(11,13,11,.96) 54%); }
.legal-summary h2 { margin: 0 0 12px; color: #dfe4e0; font-size: 1.08rem; font-weight: 500; letter-spacing: -.02em; }
.legal-summary ul { margin: 0; padding-left: 20px; }
.legal-summary li { margin: 7px 0; color: #9aa39d; font-size: .79rem; }
.legal-notice { margin: 21px 0 2px; padding: 15px 17px; border: 1px solid rgba(208,172,97,.2); border-left: 2px solid rgba(208,172,97,.7); border-radius: 7px; background: rgba(87,63,20,.1); color: #aaa18c; font-size: .78rem; }
.legal-notice strong { color: #ccb77e; font-weight: 600; }
.legal-section { padding: 36px 0 38px; border-bottom: 1px solid #202320; scroll-margin-top: 88px; }
.legal-section:last-child { border-bottom: 0; }
.legal-section h2 { max-width: 650px; margin: 0 0 17px; color: #e1e5e2; font-size: clamp(1.25rem,2.5vw,1.53rem); font-weight: 500; letter-spacing: -.03em; line-height: 1.28; }
.legal-section h3 { margin: 27px 0 9px; color: #bac2bc; font-size: .91rem; font-weight: 600; }
.legal-section p, .legal-section li { color: #959d97; }
.legal-section p { margin: 11px 0; }
.legal-section ul, .legal-section ol { margin: 13px 0; padding-left: 23px; }
.legal-section li { margin: 8px 0; padding-left: 3px; }
.legal-section li::marker { color: #587268; }
.legal-section strong, .legal-document > strong { color: #cbd0cc; font-weight: 600; }
.legal-section table { display: block; width: 100%; margin: 22px 0 5px; overflow-x: auto; border: 1px solid var(--legal-border); border-radius: 8px; border-collapse: separate; border-spacing: 0; font-size: .74rem; line-height: 1.55; }
.legal-section th, .legal-section td { min-width: 155px; padding: 12px 13px; border-right: 1px solid var(--legal-border); border-bottom: 1px solid var(--legal-border); text-align: left; vertical-align: top; }
.legal-section th:last-child, .legal-section td:last-child { border-right: 0; }
.legal-section tbody tr:last-child td { border-bottom: 0; }
.legal-section th { background: #101310; color: #bbc4be; font-weight: 600; }
.legal-section td { background: #090b09; color: #89918c; }
.legal-placeholder { padding: 2px 5px; border: 1px dashed rgba(208,172,97,.4); border-radius: 4px; background: rgba(87,63,20,.14); color: #c8b27b; font-size: .88em; font-weight: 600; }
.legal-small { color: #68706b !important; font-size: .72rem; }

.legal-footer { padding: 32px 20px 40px; border-top: 1px solid rgba(255,255,255,.055); background: #060706; color: #535a55; font-size: .68rem; text-align: center; }
.legal-footer nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 22px; margin-bottom: 10px; }
.legal-footer a { color: #77817a; font-weight: 500; text-decoration: none; }
.toc-toggle { display: none; }

/* Portal para ejercer derechos */
.privacy-page .legal-topbar-inner { width: min(1060px, calc(100% - 40px)); }
.privacy-hero { width: min(960px, calc(100% - 40px)); margin: 0 auto; padding: 58px 0 12px; animation: legal-enter .45s ease-out both; }
.privacy-hero h1 { max-width: 700px; margin: 0; color: var(--legal-heading); font-size: clamp(2rem,5vw,3.35rem); font-weight: 500; letter-spacing: -.05em; line-height: 1.05; }
.privacy-hero p { max-width: 650px; margin: 17px 0 0; color: var(--legal-muted); font-size: .86rem; }
.privacy-shell { display: grid; grid-template-columns: minmax(0,1.35fr) minmax(280px,.65fr); align-items: start; gap: 16px; width: min(960px, calc(100% - 40px)); margin: 30px auto 80px; animation: legal-enter .48s .05s ease-out both; }
.privacy-page .card { min-width: 0; padding: clamp(22px,4vw,31px); border: 1px solid var(--legal-border); border-radius: 11px; background: rgba(10,12,10,.93); }
.privacy-page .card h2 { margin: 0 0 10px; color: var(--legal-heading); font-size: 1.16rem; font-weight: 500; letter-spacing: -.02em; }
.privacy-page .card p { margin: 9px 0; color: #8f9791; font-size: .79rem; line-height: 1.65; }
.privacy-page form { display: grid; gap: 17px; margin-top: 24px; }
.privacy-page .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.privacy-page label { display: block; color: #bdc4bf; font-size: .72rem; font-weight: 500; }
.privacy-page select, .privacy-page textarea { width: 100%; margin-top: 8px; border: 1px solid var(--legal-border); border-radius: 7px; background: #111311; color: #e4e8e5; font: inherit; font-size: .78rem; transition: background .18s ease, border-color .18s ease, box-shadow .18s ease; }
.privacy-page select { min-height: 44px; padding: 10px 34px 10px 12px; }
.privacy-page textarea { min-height: 150px; padding: 12px 13px; resize: vertical; line-height: 1.6; }
.privacy-page select:hover, .privacy-page textarea:hover { border-color: var(--legal-border-hover); background: #151815; }
.privacy-page select:focus, .privacy-page textarea:focus { border-color: #718079; outline: none; box-shadow: 0 0 0 2px rgba(112,133,123,.12); }
.privacy-page button[type="submit"] { justify-self: start; min-height: 44px; padding: 11px 17px; border: 1px solid rgba(255,255,255,.035); border-radius: 7px; background: var(--orbi); color: white; font: inherit; font-size: .76rem; font-weight: 500; cursor: pointer; box-shadow: 0 5px 18px rgba(0,0,0,.12); transition: background .18s ease, box-shadow .18s ease, transform .18s ease; }
.privacy-page button[type="submit"]:hover { background: var(--orbi-hover); box-shadow: 0 8px 22px rgba(0,0,0,.18); transform: translateY(-1px); }
.privacy-page button[type="submit"]:active { transform: translateY(0); }
.privacy-page button:disabled { cursor: wait; opacity: .58; transform: none; }
.privacy-page #form-status { min-height: 22px; margin: 0; }
.privacy-page .error { color: var(--legal-danger) !important; }
.privacy-page .success { color: var(--legal-success) !important; }
.privacy-page .requests { display: grid; gap: 10px; margin-top: 18px; }
.privacy-page .request { padding: 15px; border: 1px solid var(--legal-border); border-radius: 8px; background: #0d100e; }
.privacy-page .request-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; color: #c7cdc8; font-size: .78rem; }
.privacy-page .badge { display: inline-block; padding: 4px 8px; border: 1px solid rgba(92,143,123,.24); border-radius: 999px; background: rgba(6,57,47,.28); color: #a7c0b6; font-size: .62rem; font-weight: 600; }
.privacy-page .meta { margin-top: 7px; color: #626a65; font-size: .66rem; }
.privacy-page .detail { margin-bottom: 0; white-space: pre-wrap; }
.privacy-page .resolution { margin-top: 12px; padding: 12px; border-radius: 7px; background: #111411; }
.privacy-page .legal-note { margin-top: 17px !important; padding: 13px 14px; border: 1px solid rgba(208,172,97,.18); border-left: 2px solid rgba(208,172,97,.68); border-radius: 7px; background: rgba(87,63,20,.09); color: #a49b86 !important; }

@keyframes legal-enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 900px) {
    .legal-topbar-inner { align-items: flex-start; flex-direction: column; gap: 9px; padding: 13px 0 11px; }
    .legal-tabs { justify-content: flex-start; width: 100%; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
    .legal-tabs::-webkit-scrollbar { display: none; }
    .legal-tabs a:first-child { margin-left: -10px; }
    .legal-shell { display: block; padding-top: 30px; }
    .toc-toggle { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 44px; margin-bottom: 10px; padding: 11px 13px; border: 1px solid var(--legal-border); border-radius: 7px; background: #0d100e; color: #bac2bc; font: inherit; font-size: .75rem; font-weight: 500; text-align: left; cursor: pointer; }
    .toc-toggle::after { content: "+"; color: #6c766f; font-size: 1rem; }
    .toc-toggle[aria-expanded="true"]::after { content: "−"; }
    .legal-toc { position: static; display: none; max-height: none; margin-bottom: 20px; padding: 16px; border: 1px solid var(--legal-border); border-radius: 8px; background: #090b09; }
    .legal-toc.open { display: block; }
    .privacy-shell { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
    body { font-size: 14px; }
    .legal-topbar { position: static; }
    .legal-topbar-inner, .legal-hero-inner, .legal-shell, .privacy-page .legal-topbar-inner, .privacy-hero, .privacy-shell { width: min(100% - 28px,1080px); }
    .legal-brand img { width: 62px; }
    .legal-brand span { font-size: .62rem; }
    .legal-tabs { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 4px; overflow: visible; }
    .legal-tabs a, .legal-tabs a:first-child { width: 100%; margin: 0; padding: 8px 9px; text-align: center; }
    .legal-tabs .back-to-login { margin-left: 0; }
    .legal-hero-inner { padding-top: 50px; padding-bottom: 44px; }
    .legal-hero h1 { font-size: clamp(2.05rem,12vw,2.85rem); }
    .legal-deck { font-size: .85rem; }
    .legal-meta { display: grid; gap: 4px; }
    .legal-meta span + span { padding-left: 0; }
    .legal-meta span + span::before { display: none; }
    .legal-shell { padding-bottom: 60px; }
    .legal-summary { padding: 20px; }
    .legal-section { padding: 31px 0 33px; }
    .privacy-hero { padding-top: 45px; }
    .privacy-shell { margin-top: 24px; margin-bottom: 60px; }
    .privacy-page .grid { grid-template-columns: 1fr; }
    .privacy-page button[type="submit"] { width: 100%; }
}

@media (max-width: 360px) {
    .legal-topbar-inner, .legal-hero-inner, .legal-shell, .privacy-page .legal-topbar-inner, .privacy-hero, .privacy-shell { width: min(100% - 20px,1080px); }
    .legal-brand span { display: none; }
    .legal-tabs a { font-size: .67rem; }
    .legal-hero h1 { font-size: 1.9rem; }
    .legal-summary { padding: 17px; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
}

@media print {
    body { background: white; color: #111; }
    .legal-topbar, .legal-toc, .toc-toggle, .skip-link { display: none !important; }
    .legal-hero { border: 0; background: none; }
    .legal-hero-inner { width: 100%; padding: 20px 0; }
    .legal-hero h1, .legal-section h2, .legal-section h3, .legal-section strong, .legal-summary h2 { color: #111; }
    .legal-deck, .legal-kicker, .legal-meta span, .legal-section p, .legal-section li, .legal-summary li { color: #333; }
    .legal-shell { display: block; width: 100%; padding: 0; }
    .legal-summary { border-color: #bbb; background: none; }
    .legal-section { break-inside: avoid; border-color: #ccc; }
    .legal-footer { background: none; color: #555; }
}
