/* Shared light/dark surfaces; technical line sheets use a reversible dark display treatment. */
html[data-color-mode]{--ui-bg:#f2f5f9;--ui-surface:#fff;--ui-raised:#fff;--ui-subtle:#edf2f7;--ui-border:#d1dce7;--ui-text:#1c3043;--ui-muted:#536b80;--ui-accent:#275e93;--ui-tint:#eceff2;--ui-shadow:0 2px 8px #19355208;background:var(--ui-bg);color:var(--ui-text)}
html[data-color-mode="dark"]{--ui-bg:#080b0f;--ui-surface:#12171d;--ui-raised:#1c232c;--ui-subtle:#0c1117;--ui-border:#323c48;--ui-text:#e5edf6;--ui-muted:#a6b8cb;--ui-accent:#cbd1d9;--ui-tint:#243c56;--ui-shadow:none}
html[data-color-mode] body[data-section="alpha"]{--ui-accent:#535e6b;--ui-tint:#eceff2}
html[data-color-mode] body[data-section="cockpit"]{--ui-accent:#395f82;--ui-tint:#eaf0f7}
html[data-color-mode] body[data-section="relay"]{--ui-accent:#51529a;--ui-tint:#eeedfa}
html[data-color-mode] body[data-section="antenna"]{--ui-accent:#316e9e;--ui-tint:#e9f2fa}
html[data-color-mode] body[data-section="loads"]{--ui-accent:#8d5b35;--ui-tint:#f7efe8}
html[data-color-mode="dark"] body[data-section="alpha"]{--ui-accent:#cbd1d9;--ui-tint:#2b323b}
html[data-color-mode="dark"] body[data-section="cockpit"]{--ui-accent:#9ab8d6;--ui-tint:#293c50}
html[data-color-mode="dark"] body[data-section="relay"]{--ui-accent:#b4b2f1;--ui-tint:#343451}
html[data-color-mode="dark"] body[data-section="antenna"]{--ui-accent:#91c5ed;--ui-tint:#243d53}
html[data-color-mode="dark"] body[data-section="loads"]{--ui-accent:#dfb28c;--ui-tint:#44362c}
html[data-color-mode] body{--ink:var(--ui-text);--text:var(--ui-text);--muted:var(--ui-muted);--line:var(--ui-border);--bg:var(--ui-bg);--soft:var(--ui-subtle);--panel:var(--ui-surface);--paper:var(--ui-surface);--accent:var(--ui-accent);--accent2:var(--ui-accent);--section-accent:var(--ui-accent);--section-soft:var(--ui-tint);--section-line:var(--ui-border);--navy:var(--ui-accent);--blue:var(--ui-accent);--teal:var(--ui-accent);--teal-dark:var(--ui-accent);--teal-soft:var(--ui-tint);--blueSoft:var(--ui-tint);--cr-text:var(--ui-text);--cr-muted:var(--ui-muted);--cr-line:var(--ui-border);--cr-bg:var(--ui-bg);--cr-panel:var(--ui-surface);--cr-panel-soft:var(--ui-subtle);--cr-accent:var(--ui-accent);--cr-accent-dark:var(--ui-accent);--cr-blue:var(--ui-accent);background:var(--ui-bg)!important;color:var(--ui-text)!important}
/* One surface palette across headers, lists, detail panels and navigation. */
html[data-color-mode] :is(.header,.top,.topbar,.toolbar,.figure-head,.panel,.panelHead,.workspace,.tools,.side,.side-head,.component-row,.component-drawer,.drawer,.drawer-head,.drawer-fact,.drawer-identity,.component-tabs,.component-panes,.gallery-box,.gallery-head,.ref-box,.ref-head,.selected,.topic-page,.thumb,.mobile-library-bar,.cr-shell,.cr-head,.cr-search,.cr-filters,.cr-card,.cr-detail,.cr-fact,.cr-source,.cr-ref,.cr-image-viewer,.cr-image-head,.step-rail,.mode-card,.guide-section,.row,.variant,.fact,.refcard,.viewerbar){background:var(--ui-surface)!important;color:var(--ui-text)!important;border-color:var(--ui-border)!important;box-shadow:none!important}
html[data-color-mode] :is(.viewer,.viewer-stage,.drawer-location-stage,.drawer-location-shell,.gallery-grid,.cr-main,.cr-overlay,.cr-image-stage,.cr-image-canvas,.cr-figure-map,.cr-image-viewer,.compactbar,.stat,.component-list){background:var(--ui-subtle)!important;border-color:var(--ui-border)!important}
html[data-color-mode] :is(.component-row.on,.component-row:hover,.relayrow.on,.relayrow:hover,.row.selected,.cr-card.on,.cr-card:hover,.topic-page.on,.topic-page:hover,.cr-filter.on,.toolbutton.on,.toolbutton:hover,.mobile-library-bar a[aria-current="page"],.rail-step.active){background:var(--ui-tint)!important;color:var(--ui-text)!important;border-color:var(--ui-accent)!important}
html[data-color-mode] :is(.component-row.on,.cr-card.on){box-shadow:inset 3px 0 var(--ui-accent)!important}
html[data-color-mode] :is(.detailTop,.primaryBox,.meaningCard,.componentNote,.drawer-scope,.declaration,.reference-summary,.amm-link){background:var(--ui-tint)!important;color:var(--ui-text)!important;border-color:var(--ui-border)!important}
html[data-color-mode] :is(input:not([type="radio"]):not([type="checkbox"]),select,textarea,.search input){background:var(--ui-raised)!important;color:var(--ui-text)!important;border-color:var(--ui-border)!important}
html[data-color-mode] ::placeholder{color:var(--ui-muted)!important;opacity:1}
html[data-color-mode] :is(.toolbutton,.navstep,.zoom button,.section-back,.component-tab,.cr-filter,.cr-close,.cr-image-actions button,.viewerbar button,.az button,.quick button,.reset,.clear,.viewTab,.multiBtn,.multiMenu,.multiActions,.multiActions button,.ghost-button,.secondary-button,.action,.chip,.badge,.ata-badge,.chapter,.tag:where(:not(.ok):not(.logic):not(.ref)),.roleBadge,.configBadge,.aliasChip,.close){background:var(--ui-raised)!important;color:var(--ui-accent)!important;border-color:var(--ui-border)!important;box-shadow:none!important}
html[data-color-mode] :is(.toolbutton.components,.component-tab.on,.action.primary,.viewTab.active,.primary-button,.reader button,.rail-step.active span){background:var(--ui-accent)!important;color:#fff!important;border-color:var(--ui-accent)!important}
html[data-color-mode="dark"] :is(.toolbutton.components,.component-tab.on,.action.primary,.viewTab.active,.primary-button,.reader button,.rail-step.active span){color:#0d1824!important}
html[data-color-mode] :is(.eyebrow,.current small,.cr-eyebrow,.group,.quick strong,.stat b,.tab.on,.code,.shows,.primaryCode,.detailCode,.firstCode,.section-kicker,.mode-arrow,.back-link,.guide-nav a,.card-arrow,.cr-system){color:var(--ui-accent)!important}
html[data-color-mode] :is(.brand p,.brand small,.sub,.card p,.page-footer,.guide-intro,.guide-note,.declaration p,.guide-section p,.guide-section li,.rowmain small,.fact b,.drawer-fact b,.cr-fact b,.cr-mini,.cr-figure-caption,.refcard p,.foot,.lead,.field span,.rail-step b,.rail-heading,.topbar p,.mobile-library-bar a,.counter,.cr-subtitle,.guide-divider){color:var(--ui-muted)!important}
html[data-color-mode] :is(.brand strong,.brand h1,.card h2,.guide-section h2,.cr-detail h2,.detailtop h2,.detailPurpose,.component-row b,.cr-card strong,.fact span,.drawer-fact span,.drawer-identity span,.cr-fact span){color:var(--ui-text)!important}
html[data-color-mode] .mobile-library-bar a[aria-current="page"]{color:var(--ui-accent)!important}
html[data-color-mode] :is(.card,.card:hover){background:var(--ui-surface)!important;box-shadow:var(--ui-shadow)!important;border-color:var(--ui-border)!important;border-top-color:var(--tone)!important}
html[data-color-mode] .card .section-icon{background:var(--card-tint);color:var(--tone)}
html[data-color-mode] .card h2{color:var(--tone)!important}
html[data-color-mode="dark"] .card.alpha{--tone:#cbd1d9;--card-tint:#2b323b}
html[data-color-mode="dark"] .card.cockpit{--tone:#9ab8d6;--card-tint:#293c50}
html[data-color-mode="dark"] .card.relay{--tone:#b4b2f1;--card-tint:#343451}
html[data-color-mode="dark"] .card.antenna{--tone:#91c5ed;--card-tint:#243d53}
html[data-color-mode="dark"] .card.loads{--tone:#dfb28c;--card-tint:#44362c}
html[data-color-mode] .card .card-arrow{color:var(--tone)!important}
/* Alpha uses a silver header and neutral matching accents. */
html[data-color-mode="light"] body[data-section="alpha"] .top{background:#dce1e6!important;color:#fff!important}
html[data-color-mode="light"] body[data-section="alpha"] .top :is(h1,.back,.topActions a){color:#fff!important}
html[data-color-mode="light"] body[data-section="alpha"] .top .brand p{color:#465361!important}
html[data-color-mode="light"] body[data-section="alpha"] .top .section-back{background:#dce1e6!important;color:white!important;border-color:#a5aeb9!important}
html[data-color-mode] .turbulence-workflow{--teal:var(--ui-accent);--teal-dark:var(--ui-accent);--teal-soft:var(--ui-tint)}
html[data-color-mode] :is(.mode-card,.mode-card:hover){transform:none;box-shadow:none!important}
html[data-color-mode] .appearance-toggle{display:inline-flex;align-items:center;justify-content:center;gap:6px;flex:0 0 auto;min-height:44px;min-width:84px;padding:8px 12px;border:1px solid var(--ui-border);border-radius:10px;background:var(--ui-raised);color:var(--ui-text);font:600 13px -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;cursor:pointer;margin-left:auto;box-shadow:none}
html[data-color-mode] .appearance-toggle span:first-child{font-size:18px;line-height:1}
html[data-color-mode] .appearance-toggle:focus-visible{outline:3px solid var(--ui-accent);outline-offset:2px}
html[data-color-mode] .guide-nav{flex-wrap:wrap;gap:10px}
html[data-color-mode] .guide-nav .appearance-toggle{margin-left:4px}
html[data-color-mode="dark"] :is(.row,.relayrow,.topic-page,.multiOption,.multiActions,.variant,.abbrItem,.card,.reader,.stateCard.zero,summary,.note,.cr-pill,.cr-detail-empty,.cr-stats,.reference-box,.formula-preview,.formula-guide,.weight-guide,.result-grid>div,.calculation-step,.reference-strip>div){background:var(--ui-surface)!important;color:var(--ui-text)!important;border-color:var(--ui-border)!important}
html[data-color-mode="dark"] :is(.multiOption,.abbrItem span,.variant .vmeaning,.variant .vrole,.notes,.note span,.card p,.mode-copy p,.mode-copy small,.mode-copy h2,.field em,.reference-box,.formula-guide-heading,.formula-guide-steps,.formula-guide-steps p){color:var(--ui-text)!important}
html[data-color-mode="dark"] :is(.firstCode,.compare,.reader,.crumb span,.cr-count,.cr-mini,.chip,.ata,.configBadge,.roleBadge,.aliasChip){background:var(--ui-tint)!important;color:var(--ui-text)!important;border-color:var(--ui-border)!important}
/* Keep green/amber/red meaning, while reducing bright status surfaces in dark mode. */
html[data-color-mode="dark"] body{--green:#83dbac;--green-soft:#173d30;--amber:#edc775;--amber-soft:#40351d;--red:#ffaaa2;--red-soft:#46292b}
html[data-color-mode="dark"] body[data-section="alpha"]{--green:#173d30;--amber:#40351d;--red:#46292b}
html[data-color-mode="dark"] :is(.warning,.decoded.invalid,.turbulence-result.red,.result-hero.red){background:#46292b!important;color:#ffb7af!important;border-color:#9f5c5c!important}
html[data-color-mode="dark"] :is(.tip,.configNote,.decoded.wait,.turbulence-result.amber,.result-hero.amber){background:#40351d!important;color:#f0d494!important;border-color:#877345!important}
html[data-color-mode="dark"] :is(.stateCard.one,.decoded:not(.invalid):not(.wait),.turbulence-result.green,.result-hero.green){background:#173d30!important;color:#a3e7bf!important;border-color:#487d60!important}
html[data-color-mode="dark"] .notice{background:var(--ui-subtle)!important;color:var(--ui-muted)!important;border-color:var(--ui-border)!important}
@media(max-width:600px){html[data-color-mode] .guide-nav{width:100%;justify-content:flex-end}html[data-color-mode] .guide-nav a{font-size:12px}html[data-color-mode] .guide-nav .appearance-toggle{min-width:76px;padding:6px 8px}html[data-color-mode] .app .topbar{gap:8px}html[data-color-mode] .app .topbar .brand{flex:1 1 160px}html[data-color-mode] .cr-head{flex-wrap:wrap}html[data-color-mode] .top .topin{flex-wrap:wrap}}
@media print{html[data-color-mode] .appearance-toggle{display:none!important}html[data-color-mode] body{--ui-bg:#fff;--ui-surface:#fff;--ui-raised:#fff;--ui-subtle:#fff;--ui-text:#111;--ui-muted:#444;--ui-border:#bbb;--ui-tint:#f1f1f1;--ui-accent:#222;background:#fff!important;color:#111!important}}
/* Register toolbars and small controls also use the shared surface tokens. */
html[data-color-mode] body :is(.antenna-relays-ata-bar,.cr-summary,.cr-detail-wrap,.cr-figure,.cr-image-caption,.cr-figure-caption,.antenna-relays-source-badge){background:var(--ui-surface)!important;color:var(--ui-muted)!important;border-color:var(--ui-border)!important}
html[data-color-mode] body :is(.antenna-relays-ata-bar button,.cr-count){background:var(--ui-raised)!important;color:var(--ui-text)!important;border-color:var(--ui-border)!important}
html[data-color-mode] body :is(.antenna-relays-ata-bar button.on,.antenna-relays-ata-bar button.active){background:var(--ui-accent)!important;color:var(--ui-surface)!important}
html[data-color-mode="dark"] body :is(.rail-step span,.progress){background:var(--ui-raised);color:var(--ui-text);border-color:var(--ui-border)}
html[data-color-mode="dark"] body .rail-step.active span{background:var(--ui-accent)!important;color:#0d1824!important}
html[data-color-mode="dark"] body :is(.tip b,.configNote b){color:#f0d494!important}
html[data-color-mode="dark"] body :is(.cr-pill.known,.cr-pill.pdf,.antenna-relays-source-badge){background:var(--ui-tint)!important;color:var(--ui-text)!important}

/* Keep the Library cards aligned with their section palettes in light mode. */
html[data-color-mode="light"] .card.alpha{--tone:#535e6b;--card-tint:#eceff2}
html[data-color-mode="light"] .card.antenna{--tone:#316e9e;--card-tint:#e9f2fa}
/* Display-only paper treatment: source pixels, dimensions and hotspots stay intact. */
html[data-color-mode="dark"] body[data-section="antenna"] :is(#figureImage,#componentLocationImage,.cr-figure-map img,.cr-image-canvas img,.thumb-paper),
html[data-color-mode="dark"] body[data-section="relay"] #relayImage{filter:grayscale(1) invert(.92)!important}
html[data-color-mode="dark"] body[data-section="relay"] :is(.relay-zoom-viewport,.relay-zoom-stage){background:var(--ui-subtle)!important}
.thumb-paper{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;background:white;pointer-events:none}
@media print{html[data-color-mode="dark"] body[data-section] :is(#figureImage,#componentLocationImage,.cr-figure-map img,.cr-image-canvas img,.thumb-paper,#relayImage){filter:none!important}}

html[data-color-mode="dark"] body[data-section="antenna"] :is(.viewer-stage,.drawer-location-viewport,.cr-image-canvas,.cr-figure-map,.thumb-image),html[data-color-mode="dark"] body[data-section="relay"] .relay-zoom-viewport{background:#141414!important}

html[data-color-mode="dark"] body[data-section="antenna"] .sourceMetadataMask{background:#141414!important}

/* Antenna dark figures: pure black paper and neutral silver aircraft/labels. */
html[data-color-mode="dark"] body[data-section="antenna"] :is(#figureImage,#componentLocationImage,.cr-figure-map img,.cr-image-canvas img,.thumb-paper){filter:url(#antenna-black-silver)!important}
html[data-color-mode="dark"] body[data-section="antenna"] :is(.viewer-stage,.drawer-location-viewport,.cr-image-canvas,.cr-figure-map,.thumb-image,.sourceMetadataMask){background:#000!important}
@media print{html[data-color-mode="dark"] body[data-section="antenna"] :is(#figureImage,#componentLocationImage,.cr-figure-map img,.cr-image-canvas img,.thumb-paper){filter:none!important}}

/* Alpha's neutral silver identity, including its light-mode header. */
html[data-color-mode="light"] body[data-section="alpha"] .top :is(h1,.back,.topActions a,.section-back){color:#25303b!important}
html[data-color-mode="light"] body[data-section="alpha"] .top .section-back{background:#e8ecf0!important;border-color:#a5aeb9!important}
/* The calculator wrapper must share the dark surface in both open and closed states. */
html[data-color-mode="dark"] body[data-section="loads"] .mass-calculator{background:var(--ui-subtle)!important;color:var(--ui-text)!important;border-color:var(--ui-border)!important}
html[data-color-mode="dark"] body[data-section="loads"] .mass-calculator :is(summary,.form-grid){background:transparent!important;color:var(--ui-text)!important}

/* Silver accents, with enough room for every alternative-code label. */
html[data-color-mode] body[data-section="alpha"] .variant{grid-template-columns:minmax(78px,.45fr) minmax(160px,1fr) minmax(180px,1.4fr) auto;gap:14px;padding:14px;align-items:center}
html[data-color-mode] body[data-section="alpha"] .variant>*{min-width:0;overflow-wrap:anywhere}
html[data-color-mode] body[data-section="alpha"] .variant .vrole{display:flex;flex-direction:column;align-items:flex-start;gap:8px;line-height:1.45}
html[data-color-mode] body[data-section="alpha"] .configBadge{display:inline-flex;max-width:100%;line-height:1.4;white-space:normal}
html[data-color-mode] body[data-section="alpha"] .variant button{background:var(--ui-raised)!important;color:var(--ui-text)!important;border-color:var(--ui-border)!important;min-height:44px}
html[data-color-mode] body[data-section="alpha"] .variant code{color:var(--ui-accent)!important}
html[data-color-mode] body[data-section="alpha"] :is(.configNote,.stateCard,.decoded:not(.invalid),.primaryBox){background:linear-gradient(145deg,#fff 0%,#f1f4f7 55%,#e5ebf0 100%)!important;color:#253442!important;border-color:#c7d1dc!important;box-shadow:inset 0 1px 0 #fff9!important}
html[data-color-mode] body[data-section="alpha"] .configNote b{color:inherit!important}
html[data-color-mode="light"] body[data-section="alpha"] :is(.top,.detailTop){background:linear-gradient(115deg,#f9fbfd,#e3e9ef)!important}
html[data-color-mode="light"] body[data-section="alpha"] .stateCard.one{border-left:4px solid #7e91a5!important}
html[data-color-mode="dark"] body[data-section="alpha"] :is(.configNote,.stateCard,.decoded:not(.invalid),.primaryBox){background:linear-gradient(145deg,#343e49,#20272f)!important;color:#edf2f7!important;border-color:#4d5b6b!important;box-shadow:inset 0 1px 0 #ffffff12!important}
html[data-color-mode="dark"] body[data-section="alpha"] .configNote b{color:inherit!important}
html[data-color-mode] body[data-section="alpha"] .readerLine{display:flex;flex-wrap:wrap;align-items:stretch;gap:9px}
html[data-color-mode] body[data-section="alpha"] .readerLine input{flex:1 1 200px;min-width:0;width:0}
html[data-color-mode] body[data-section="alpha"] .readerLine .decoded{flex:2 1 260px;min-width:0;line-height:1.5}
@media(max-width:1100px){html[data-color-mode] body[data-section="alpha"] .variant{grid-template-columns:minmax(76px,.5fr) minmax(0,1fr)}html[data-color-mode] body[data-section="alpha"] .variant .vmeaning{grid-column:1/-1}html[data-color-mode] body[data-section="alpha"] .variant button{grid-column:2;justify-self:start}}
/* Reference cards must remain legible in every drawer tab. */
html[data-color-mode="dark"] body #componentDrawer .drawer-ref,
html[data-color-mode="dark"] body :is(.cr-ref,.cr-source,.cr-note){background:#11161c!important;border-color:#364352!important;color:var(--ui-text)!important}
html[data-color-mode="dark"] body #componentDrawer .drawer-ref b{color:var(--ui-text)!important;line-height:1.5}
html[data-color-mode="dark"] body #componentDrawer .drawer-ref small{color:var(--ui-accent)!important;line-height:1.5;margin-top:6px}
html[data-color-mode] body .cr-card{display:flex;align-items:center;min-height:58px;height:auto;padding:14px!important;overflow:hidden}
html[data-color-mode] body .cr-card strong{display:block;white-space:normal;overflow-wrap:anywhere}
/* Antenna drawing fills its available canvas; a desktop drawer shares the space. */
html[data-color-mode="light"] body[data-section="antenna"] :is(.viewer,.viewer-stage){background:#fff!important}
body[data-section="antenna"] .figure-wrap{box-shadow:none}
body[data-section="antenna"] .figure-configuration-note{position:absolute;bottom:5px;left:12px;right:12px;z-index:5;text-align:center;font-size:10px;color:var(--ui-muted);pointer-events:none}
@media(min-width:1000px){body[data-section="antenna"].antenna-detail-open{--antenna-drawer-width:clamp(330px,32vw,480px)}body[data-section="antenna"].antenna-detail-open .app{width:calc(100% - var(--antenna-drawer-width))}body[data-section="antenna"].antenna-detail-open #componentDrawer{width:var(--antenna-drawer-width)}body[data-section="antenna"].antenna-detail-open #componentShade{display:none}body[data-section="antenna"].antenna-detail-open .viewer.fullscreen{right:var(--antenna-drawer-width)}}
/* Library: equal-sized cards, quiet depth and a soft metallic finish. */
html[data-color-mode] .cards{display:flex;flex-wrap:wrap;justify-content:center;gap:18px}
html[data-color-mode] .cards>.card{flex:0 1 calc((100% - 36px)/3);min-height:156px;border-top-width:3px;border-radius:20px;padding:24px;background:linear-gradient(125deg,var(--ui-surface) 30%,var(--card-tint))!important;box-shadow:0 6px 20px #14253609,inset 0 1px 0 #ffffff80!important}
html[data-color-mode] .cards>.card .section-icon{width:54px;height:54px;border-radius:16px;border:1px solid var(--ui-border);box-shadow:inset 0 1px 0 #ffffff35}
html[data-color-mode] .cards>.card .card-arrow{display:grid;place-items:center;width:30px;height:30px;flex:none;border-radius:50%;background:var(--card-tint);font-size:20px}
html[data-color-mode] .cards>.card:hover{border-color:var(--tone)!important;box-shadow:0 7px 24px #14253615!important}
html[data-color-mode="dark"] .cards>.card{box-shadow:inset 0 1px 0 #ffffff0d!important}
@media(max-width:1100px){html[data-color-mode] .cards>.card{flex-basis:calc((100% - 18px)/2);padding:20px}}
@media(max-width:600px){html[data-color-mode] .cards{gap:12px}html[data-color-mode] .cards>.card{flex-basis:100%;min-height:110px;padding:18px}html[data-color-mode] .cards>.card .section-icon{width:46px;height:46px}}
/* Show the configuration note once, in the fixed caption below the drawing. */
body[data-section="antenna"] #figureImage{clip-path:inset(0 0 29% 0)}

/* Touch labels preserve source-image coordinates at every zoom level. */
body[data-section="antenna"] .figure-label-hit{position:absolute;transform:translate(-50%,-50%);z-index:22;min-width:0;min-height:0;padding:0;border:0;background:transparent;cursor:pointer;touch-action:manipulation;border-radius:3px}
body[data-section="antenna"] .figure-label-hit:focus-visible{outline:2px solid var(--ui-accent);background:#83bce522}
body[data-section="cockpit"] .cr-location-window{height:280px;overflow:auto;border-radius:10px;border:1px solid var(--ui-border)}
body[data-section="cockpit"] .cr-location-window .cr-figure-map img{width:100%;height:auto;max-height:none!important;object-fit:initial}
body[data-section="cockpit"] .cr-location-first{margin:12px 0}
.relay-view-controls{display:flex;justify-content:flex-end;gap:6px;padding:8px;background:var(--ui-surface)}
.relay-view-controls button{min-height:44px;min-width:44px;padding:8px 12px;border-radius:8px;border:1px solid var(--ui-border);background:var(--ui-raised);color:var(--ui-accent);font:inherit;cursor:pointer}
html body[data-section="relay"] .viewer.relay-fullscreen{position:fixed!important;inset:0!important;z-index:10000!important;display:flex!important;flex-direction:column!important;border-radius:0!important;max-height:none!important;background:var(--ui-bg)!important}
html body[data-section="relay"] .relay-fullscreen .relay-zoom-viewport{flex:1;min-height:0;height:auto!important;max-height:none!important}
/* Both load workflows share dark surfaces through entry, audit and results. */
html[data-color-mode="dark"] body[data-section="loads"]{--blue-soft:#192530;--green:#91d8af;--green-soft:#163b2d;--amber:#f0cc81;--amber-soft:#3a301d;--red:#f8aaa3;--red-soft:#3c2528;color-scheme:dark}
html[data-color-mode="dark"] body[data-section="loads"] :is(.amm-instruction,.value-entry-card,.guided-value-card,.form-grid.three-value,.amm-rule-check,.metric,.calculation-card,.calculation-card h3,.zone-diagram-card,.weight-result-card,.lateral-check-card,.turbulence-formula-guide,.formula-guide-heading,.formula-guide-steps>div,.threshold-preview,.threshold-preview>small,.next-action-card,.parallel-action-card,.action-card,.selection-card,.zone-disc,.colour-disc,.mode-icon,.manual-viewer-window,.manual-viewer-bar){background:var(--ui-surface)!important;color:var(--ui-text)!important;border-color:var(--ui-border)!important}
html[data-color-mode="dark"] body[data-section="loads"] :is(.amm-instruction p,.amm-rule-check p,.parallel-action-card p,.action-copy,.result-hero p,.next-action-card p,.mode-copy em,.question-row label){color:var(--ui-muted)!important}
html[data-color-mode="dark"] body[data-section="loads"] :is(.amm-instruction b,.formula-guide-heading b,.lateral-check-card b,.formula-guide-heading span){color:var(--ui-accent)!important}
html[data-color-mode="dark"] body[data-section="loads"] :is(.inline-message,.method-note){background:var(--red-soft);color:var(--red);border-color:#7d494d}
html[data-color-mode="dark"] body[data-section="loads"] .inline-message.neutral{background:var(--blue-soft);color:var(--ui-text);border-color:var(--ui-border)}
html[data-color-mode="dark"] body[data-section="loads"] :is(.inline-message.success,.zone-badge-1,.turbulence-badge-green){background:var(--green-soft);color:var(--green)}
html[data-color-mode="dark"] body[data-section="loads"] :is(.zone-badge-2,.turbulence-badge-amber){background:var(--amber-soft);color:var(--amber)}
html[data-color-mode="dark"] body[data-section="loads"] :is(.zone-badge-3,.turbulence-badge-red){background:var(--red-soft);color:var(--red)}
html[data-color-mode="dark"] body[data-section="loads"] .plot-zone-1{fill:#173e2c;stroke:#619b7a}
html[data-color-mode="dark"] body[data-section="loads"] .plot-zone-2{fill:#514326;stroke:#bc9d5d}
html[data-color-mode="dark"] body[data-section="loads"] .plot-zone-3{fill:#542e31;stroke:#bc7976}
html[data-color-mode="dark"] body[data-section="loads"] :is(.axis-tick,.axis-label,.zone-label,.point-label){fill:#e4ebf2}
html[data-color-mode="dark"] body[data-section="loads"] :is(.axis-line,.point-guide){stroke:#c3d3e3}
html[data-color-mode="dark"] body[data-section="loads"] .grid-line{stroke:#ffffff20}
html[data-color-mode="dark"] body[data-section="loads"] :is(.diagram-scale-note,th,.sequence-table tr,.rise-table tr){background:var(--ui-subtle);color:var(--ui-text)}

body:has(.relay-fullscreen) nav[aria-label="App navigation"]{display:none!important}

html[data-color-mode] body[data-section="ecam"]{--ui-accent:#b24750;--ui-tint:#fbe7e9}
html[data-color-mode="dark"] body[data-section="ecam"]{--ui-accent:#f1a2a8;--ui-tint:#432c32}
html[data-color-mode] .card.ecam{--tone:#b24750;--card-tint:#fbe7e9;background:linear-gradient(125deg,#fffafa,#f9dce0)!important;border-color:#e9b7bd!important;border-top:4px solid #c96770}
html[data-color-mode="dark"] .card.ecam{--tone:#f1a2a8;--card-tint:#432c32;background:linear-gradient(125deg,#251e24,#432c32)!important;border-color:#70444d!important}

html[data-color-mode="dark"]{--ui-text:#f1e5c9;--ui-muted:#c5bba5}html[data-color-mode="dark"] body[data-section="ecam"]{--ui-accent:#eddbb1;--ui-tint:#342b30}html[data-color-mode="dark"] :is(h1,h2,.reset-line){text-shadow:0 1px 1px #fff1}html[data-color-mode="light"] .card.ecam{background:linear-gradient(125deg,#fff,#f5ecee)!important;border-color:#dfc8cd!important;--card-tint:#f5ecee;--tone:#ac6670}html[data-color-mode="dark"] .card.ecam{background:linear-gradient(125deg,#14191f,#342b30)!important;border-color:#55434a!important;--tone:#eddbb1;--card-tint:#342b30}

/* Alpha uses one neutral silver text palette in dark mode. */
html[data-color-mode="dark"] body[data-section="alpha"]{--ui-text:#e2e7ed;--ui-muted:#e2e7ed;--ui-accent:#e2e7ed}
html[data-color-mode="dark"] body[data-section="alpha"] *{text-shadow:none!important}
html[data-color-mode="dark"] body[data-section="alpha"] :is(.configNote,.stateCard,.decoded:not(.invalid),.primaryBox,.configNote *,.stateCard *,.decoded:not(.invalid) *,.primaryBox *){color:#e2e7ed!important}
html[data-color-mode="dark"] body[data-section="alpha"] input::placeholder{color:#e2e7ed!important;opacity:1}

/* Theme all nested drawer surfaces, including dynamically opened locations. */
html[data-color-mode="dark"] body.clp-mobile :is(.drawer-identity>div,.drawer-fact,.drawer-ref,.drawer-child,.drawer-location,.drawer-location figcaption,.drawer-location-shell.expanded,.cr-figure-caption,.cr-image-caption,.cr-image-head,.cr-source,.cr-ref,.cr-fact,.antenna-relays-ref-box,.antenna-relays-ref-head,.gallery-body,.gallery-tools,.thumb figcaption){background:var(--ui-surface)!important;color:var(--ui-text)!important;border-color:var(--ui-border)!important}
html[data-color-mode="dark"] body.clp-mobile :is(.drawer-location-tools button,.cr-image-tools button,.cr-image-viewer button,.antenna-relays-ref-close,.gallery-tools select,.gallery-tools input){background:var(--ui-raised)!important;color:var(--ui-text)!important;border-color:var(--ui-border)!important;color-scheme:dark}
html[data-color-mode="dark"] body.clp-mobile :is(.drawer-location-viewport,.cr-image-canvas,.cr-figure-map,.drawer-location-shell){background:var(--ui-subtle)!important}
html[data-color-mode="dark"] body.clp-mobile :is(.drawer-identity,.drawer-fact,.drawer-ref,.drawer-child,.cr-fact,.cr-ref) :is(b,span,small){color:inherit!important}
html[data-color-mode="dark"] body.clp-mobile :is(.drawer-ref,.drawer-child,.drawer-location-tools button,.cr-image-tools button):hover{background:var(--ui-tint)!important;color:var(--ui-text)!important}

html[data-color-mode="dark"] body.clp-mobile .cr-picture-locator span{background:var(--ui-surface)!important;color:var(--ui-text)!important;border-color:var(--ui-accent)!important}

html[data-color-mode] .cards>.card.cb{--tone:#20242a;--card-tint:#e9ebee;border-top-color:#20242a!important}
html[data-color-mode="dark"] .cards>.card.cb{--tone:#c5cad1;--card-tint:#2c3036;border-top-color:#8e959f!important}
html[data-color-mode] .cards>.card.cb :is(h2,.section-icon,.card-arrow){color:var(--tone)!important}
html[data-color-mode] .cards>.card.cb .section-icon{background:var(--card-tint)!important}

/* Silver home branding with a restrained metallic highlight. */
html[data-color-mode="dark"] body.library-home .brand strong{color:#e3e7ed!important;background:linear-gradient(180deg,#ffffff 0%,#e7ebf0 38%,#b9c1cb 58%,#eef1f5 100%);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent;text-shadow:0 1px 1px #ffffff12}
html[data-color-mode="dark"] body.library-home .brand small{color:#c4cbd4!important;text-shadow:0 1px 1px #ffffff15}

/* Preserve the muted red ECAM accent with the original warm description. */
html[data-color-mode="dark"] body.library-home .card.ecam{--tone:#d89a9e}
html[data-color-mode="dark"] body.library-home .card.ecam :is(h2,.section-icon,.card-arrow){color:var(--tone)!important}

/* Gentle blue gloss on Antenna interface surfaces. */
html[data-color-mode="light"] body[data-section="antenna"]{--antenna-gloss:linear-gradient(180deg,#ffffff 0%,#f5f9fd 48%,#e9f1f8 100%);--antenna-shine:inset 0 1px 0 #fff,0 2px 5px #18364f0a}
html[data-color-mode="dark"] body[data-section="antenna"]{--antenna-gloss:linear-gradient(180deg,#243444 0%,#18232e 48%,#111a23 100%);--antenna-shine:inset 0 1px 0 #b8dfff22,0 2px 5px #0002}
html[data-color-mode] body[data-section="antenna"] :is(.topbar,.toolbar,.figure-head,.drawer-head,.gallery-head,.component-row,.toolbutton,.navstep,.zoom button){background:var(--antenna-gloss)!important;box-shadow:var(--antenna-shine)!important}
html[data-color-mode="light"] body[data-section="antenna"] :is(.toolbutton.components,.component-row.on){background:linear-gradient(180deg,#518fbf,#3475a7 52%,#28638f)!important;color:#fff!important;border-color:#397bac!important}
html[data-color-mode="dark"] body[data-section="antenna"] :is(.toolbutton.components,.component-row.on){background:linear-gradient(180deg,#aed8f5,#8bbce0 52%,#6e9fc5)!important;color:#112b40!important;border-color:#a7d0ee!important}

/* Lighter champagne surfaces for Load Report in light mode. */
html[data-color-mode="light"] body[data-section="loads"]{--ui-tint:#faf3ec;--ui-accent:#805735}
html[data-color-mode="light"] body[data-section="loads"] :is(.topbar,.step-rail,.workspace,.mode-card){background:linear-gradient(150deg,#ffffff 15%,#fffdfa 68%,#f7f0e9)!important;box-shadow:inset 0 1px 0 #fff,0 2px 8px #765a3d09!important}
html[data-color-mode="light"] body[data-section="loads"] :is(.rail-step.active,.amm-link,.mass-calculator,.choice-card){background:linear-gradient(180deg,#fffdfa,#f6eade)!important;box-shadow:inset 0 1px 0 #fff!important}
html[data-color-mode="light"] body[data-section="loads"] .primary-button{background:linear-gradient(180deg,#f2d4b8 0%,#e6be97 48%,#d9aa7e 100%)!important;color:#382719!important;border-color:#cfa47d!important;box-shadow:inset 0 1px 0 #fff9,0 2px 4px #79523118!important}
html[data-color-mode="light"] body[data-section="loads"] :is(.secondary-button,.ghost-button){background:linear-gradient(180deg,#fff,#faf3ec)!important;box-shadow:inset 0 1px 0 #fff!important}

/* Refined Load Report dark text and AMM reference cards. */
html[data-color-mode="dark"] body[data-section="loads"]{--ui-text:#e6e9ed;--ui-muted:#b9c1ca;--ui-accent:#dfba96;--ui-tint:#302b27}
html[data-color-mode="dark"] body[data-section="loads"] .amm-link{background:linear-gradient(145deg,#303235,#222426)!important;border-color:#55504a!important;box-shadow:inset 0 1px 0 #ffffff16!important}
html[data-color-mode="dark"] body[data-section="loads"] .amm-link b{color:#e6e9ed!important;text-shadow:0 1px 1px #ffffff12}
html[data-color-mode="dark"] body[data-section="loads"] .amm-link small{color:#d6b99c!important}
html[data-color-mode="dark"] body[data-section="loads"] .amm-link>span{background:linear-gradient(180deg,#f0d7bc,#d7b590 52%,#c49c74)!important;color:#30251c!important;box-shadow:inset 0 1px 0 #ffffff66;text-shadow:none}
html[data-color-mode="dark"] body[data-section="loads"] .rail-step.active{background:linear-gradient(140deg,#363330,#282726)!important}

/* Alpha: clearer list text and restrained silver gloss. */
html[data-color-mode="light"] body[data-section="alpha"] #list .row{color:#253442!important;background:linear-gradient(160deg,#fff 35%,#f6f8fa)!important}
html[data-color-mode="light"] body[data-section="alpha"] #list .row :is(.purpose,.firstCode,.code,.tag,.ata,.variantCount){color:#253442!important;opacity:1}
html[data-color-mode="light"] body[data-section="alpha"] #list .row.selected{background:linear-gradient(145deg,#edf2f7,#dce5ee)!important;box-shadow:inset 3px 0 0 #566d83,inset 0 1px 0 #fff!important}
html[data-color-mode="light"] body[data-section="alpha"] :is(.detailTop,.primaryBox,.top,.tools){background:linear-gradient(155deg,#fff 0%,#f0f4f8 48%,#e3eaf1 100%)!important;box-shadow:inset 0 1px 0 #fff,0 2px 6px #263c5108!important}
html[data-color-mode="dark"] body[data-section="alpha"] #list .row{color:#e2e7ed!important;background:linear-gradient(155deg,#20272f,#171d24)!important}
html[data-color-mode="dark"] body[data-section="alpha"] #list .row :is(.purpose,.firstCode,.code,.tag,.ata,.variantCount){color:#e2e7ed!important;opacity:1}
html[data-color-mode="dark"] body[data-section="alpha"] #list .row.selected{background:linear-gradient(145deg,#3c4855,#293440)!important;box-shadow:inset 3px 0 0 #b4c4d4,inset 0 1px 0 #ffffff20!important}
html[data-color-mode="dark"] body[data-section="alpha"] :is(.detailTop,.primaryBox,.top,.tools){background:linear-gradient(155deg,#34404d,#222b35 65%,#1d252e)!important;box-shadow:inset 0 1px 0 #ffffff20!important}
