:root {
  --grad: linear-gradient(135deg, #351C75 0%, #670EBA 39%, #9900FF 50%, #FF9900 100%);
  --brand: #351C75; --purple: #670EBA;
  --ink: #0D0620; --ink-2: #4A3F66; --ink-3: #7A6C9C;
  --line: #E7DFF5; --bg-2: #F7F4FC; --radius: 8px; --heading: #351C75;
  --surface: #FFFFFF; --nav-bg: rgba(255,255,255,.92); --hl: #F3ECFD; --wordmark: #351C75; --ok-bg: #F0FDF4; --ok: #166534; --card-hover: #B39DDB;
}
html[data-theme="dark"] {
  color-scheme: dark;
  /* Brand sheet dark palette: Dark BG #0D0620, Brand Violet #361B77, Lavender #B39DDB, White */
  --bg: #0D0620; --bg-2: #130A2B; --surface: #180D36;
  --ink: #FFFFFF; --ink-2: #D1C4EC; --ink-3: #B39DDB; --line: #2A1C55;
  --purple: #B39DDB; --brand: #361B77; --nav-bg: rgba(13,6,32,.9); --hl: #221452; --wordmark: #FFFFFF; --heading: #FFFFFF;
  --ok-bg: rgba(34,197,94,.14); --ok: #7EE2A8; --card-hover: #4B3591;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Montserrat', system-ui, sans-serif; color: var(--ink); background: var(--surface); line-height: 1.65; -webkit-font-smoothing: antialiased; }
a { color: var(--purple); }
p, li, h1, h2, h3, td { text-wrap: pretty; }
h1, h2 { text-wrap: balance; }
:focus-visible { outline: 2px solid var(--purple); outline-offset: 3px; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.narrow { max-width: 760px; margin: 0 auto; padding: 0 24px; }

.nav { position: sticky; top: 0; z-index: 50; background: var(--nav-bg); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.nav-in { height: 64px; display: flex; align-items: center; justify-content: space-between; }
.logo svg { height: 32px; width: auto; display: block; }
.links { display: flex; align-items: center; gap: 28px; }
.links a { font-size: 14px; font-weight: 500; color: var(--ink-2); text-decoration: none; }
.links a:hover, .links a.on { color: var(--ink); }
.links a.on { font-weight: 700; }
.menu { display: none; background: none; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px; font: 600 13px 'Montserrat', sans-serif; color: var(--ink); cursor: pointer; }
.drawer { display: none; border-top: 1px solid var(--line); padding: 8px 24px 16px; }
.drawer.open { display: block; }
.drawer a { display: block; padding: 12px 0; text-decoration: none; font-weight: 500; color: var(--ink-2); border-bottom: 1px solid var(--line); }
.drawer a:last-child { border-bottom: none; }
@media (max-width: 1150px) { .links { display: none; } .menu { display: block; } }

.page-head { background: var(--bg-2); border-bottom: 1px solid var(--line); padding: 56px 0 44px; }
.crumb { font-size: 13px; color: var(--ink-3); margin-bottom: 12px; }
.crumb a { color: var(--ink-3); text-decoration: none; }
.crumb a:hover { color: var(--purple); }
.page-head h1 { font-size: clamp(30px, 4vw, 42px); font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.page-head p { margin-top: 10px; font-size: 16px; color: var(--ink-2); max-width: 640px; }
.meta { margin-top: 14px; font-size: 13px; color: var(--ink-3); display: flex; flex-wrap: wrap; gap: 6px 16px; }
.meta b { color: var(--ink); font-weight: 600; }

main { padding: 48px 0 88px; }
.doc h2 { font-size: 19px; font-weight: 700; margin: 36px 0 10px; letter-spacing: -.01em; }
.doc h2:first-child { margin-top: 0; }
.doc h3 { font-size: 16px; font-weight: 700; margin: 22px 0 8px; }
.doc p, .doc li { font-size: 15px; color: var(--ink-2); }
.doc p { margin-bottom: 12px; }
.doc ul, .doc ol { margin: 0 0 14px 22px; }
.doc li { margin-bottom: 6px; }
.doc strong { color: var(--ink); }
.doc table { width: 100%; border-collapse: collapse; margin: 8px 0 18px; font-size: 14px; }
.doc th { text-align: left; font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); padding: 8px 12px 8px 0; border-bottom: 1px solid var(--line); }
.doc td { padding: 10px 12px 10px 0; border-bottom: 1px solid var(--line); color: var(--ink-2); vertical-align: top; }
.callout { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin: 0 0 28px; font-size: 14px; color: var(--ink-2); }

.version-history { margin-top: 48px; padding-top: 28px; border-top: 1px solid var(--line); }
.badge { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; border-radius: 999px; padding: 2px 8px; margin-left: 6px; vertical-align: 1px; }
.badge.cur { background: var(--ok-bg); color: var(--ok); }
.badge.arc { background: var(--bg-2); color: var(--ink-3); }

/* Policies hub */
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.card { border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; display: flex; flex-direction: column; }
.card h2 { font-size: 18px; font-weight: 700; margin: 0 0 6px; }
.card > p { font-size: 14px; color: var(--ink-2); margin-bottom: 16px; }
.card .open { font-size: 14px; font-weight: 700; text-decoration: none; margin-bottom: 16px; }
.card table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: auto; }
.card th { text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); padding: 6px 0; border-bottom: 1px solid var(--line); }
.card td { padding: 8px 0; border-bottom: 1px solid var(--line); color: var(--ink-2); }
.card tr:last-child td { border-bottom: none; }
@media (max-width: 760px) { .cards { grid-template-columns: 1fr; } }

/* Changelog */
.release { display: grid; grid-template-columns: 180px 1fr; gap: 32px; padding: 36px 0; border-top: 1px solid var(--line); }
.release:first-of-type { border-top: none; padding-top: 0; }
.release .when { font-size: 13px; color: var(--ink-3); }
.release .ver { display: inline-block; margin-top: 6px; font-size: 12px; font-weight: 700; color: var(--purple); background: var(--hl); border-radius: 999px; padding: 3px 10px; }
.release h2 { font-size: 22px; font-weight: 800; letter-spacing: -.01em; margin: 0 0 10px; }
.release p, .release li { font-size: 15px; color: var(--ink-2); }
.release ul { margin: 10px 0 0 20px; }
.release li { margin-bottom: 6px; }
.tagline { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ok); background: var(--ok-bg); border-radius: 999px; padding: 3px 9px; margin-right: 6px; }
.empty { border: 1px dashed var(--line); border-radius: var(--radius); padding: 32px; text-align: center; color: var(--ink-2); font-size: 15px; }
@media (max-width: 700px) { .release { grid-template-columns: 1fr; gap: 10px; } }

footer { border-top: 1px solid var(--line); padding: 32px 0; }
.foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; font-size: 13px; color: var(--ink-3); }
.foot nav { display: flex; flex-wrap: wrap; gap: 20px; }
.foot a { text-decoration: none; color: var(--ink-2); }
.foot a:hover { color: var(--purple); }

html:not(.store-live) .live-only { display: none !important; }
html.store-live .pending-only { display: none !important; }

/* Documents hub groups */
.doc h2.group { font-size: 13px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--purple); margin: 0 0 14px; }
.doc .cards + h2.group { margin-top: 40px; }

/* User guide */
.toc { border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 24px; margin: 0 0 36px; }
.doc .toc h2 { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 10px; }
.toc ol { columns: 2; column-gap: 32px; margin: 0 0 0 18px; }
.toc li { font-size: 14px; margin-bottom: 4px; break-inside: avoid; }
.toc a { text-decoration: none; }
.toc a:hover { text-decoration: underline; }
.doc h2[id] { scroll-margin-top: 84px; padding-top: 8px; }
.doc code { font-size: 13px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; }
.guide-shot { display: inline-block; margin: 6px 0 18px; text-decoration: none; }
.guide-shot img { display: block; max-width: 340px; width: 100%; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 6px 18px rgba(23,18,42,.08); transition: transform .15s; }
.guide-shot:hover img { transform: translateY(-2px); }
.guide-shot span { display: block; margin-top: 6px; font-size: 12px; color: var(--ink-3); }
@media (max-width: 600px) { .toc ol { columns: 1; } }

/* Contact */
.contact-grid { max-width: 620px; }
.contact-form label { display: block; font-size: 14px; font-weight: 600; color: var(--ink); margin-bottom: 18px; }
.contact-form input, .contact-form textarea { display: block; width: 100%; margin-top: 6px; font: 400 15px 'Montserrat', sans-serif; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; transition: border-color .15s, box-shadow .15s; }
.contact-form textarea { resize: vertical; min-height: 150px; }
.contact-form input:focus, .contact-form textarea:focus { outline: none; border-color: var(--purple); box-shadow: 0 0 0 3px rgba(123,0,204,.12); }
.contact-form input[aria-invalid="true"], .contact-form textarea[aria-invalid="true"] { border-color: #DC2626; box-shadow: 0 0 0 3px rgba(220,38,38,.1); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }
.form-note { font-size: 13px; color: var(--ink-3); margin: 0 0 16px; }
.form-error { font-size: 14px; color: #B91C1C; background: #FEF2F2; border: 1px solid #FECACA; border-radius: var(--radius); padding: 10px 14px; margin: 0 0 16px; }
.submit { font: 600 15px 'Montserrat', sans-serif; color: #fff; background: var(--grad); border: none; border-radius: var(--radius); padding: 13px 26px; cursor: pointer; }
.submit:hover { box-shadow: 0 8px 22px rgba(123,0,204,.25); }
.submit:disabled { opacity: .7; cursor: default; box-shadow: none; }
.form-done { border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; background: var(--bg-2); }
.doc .form-done h2 { margin: 0 0 8px; }
@media (max-width: 560px) { .row2 { grid-template-columns: 1fr; gap: 0; } }

/* Install button in header */
.links .btn-install { display: inline-flex; align-items: center; font: 600 14px 'Montserrat', sans-serif; color: #fff; background: var(--grad) border-box; border-radius: var(--radius); padding: 9px 16px; text-decoration: none; white-space: nowrap; }
.links .btn-soon { opacity: .55; cursor: default; }
.links .btn-soon small { font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; margin-left: 6px; padding: 2px 6px; border-radius: 999px; background: rgba(255,255,255,.25); }

/* Theme toggle */
.theme-toggle { width: 38px; height: 38px; flex: none; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; }
.theme-toggle:hover { color: var(--ink); border-color: var(--ink-3); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .sun, [data-theme="dark"] .theme-toggle .moon { display: none; }
[data-theme="dark"] .theme-toggle .sun { display: block; }
.nav-actions { display: flex; align-items: center; gap: 16px; }
.logo .wm { fill: var(--wordmark); }
[data-theme="dark"] .form-error { background: rgba(220,38,38,.12); border-color: rgba(220,38,38,.4); color: #FCA5A5; }

/* Brand typography (brand sheet): headings in Deep Violet on light, white on dark */
h1, h2, h3 { font-family: 'Montserrat', 'Arial Black', sans-serif; color: var(--heading); }
.doc h2.group { font-weight: 600; letter-spacing: .12em; }
.release h2 { font-weight: 700; }
