/* ============================================================================
   synth-shell.css
   ----------------------------------------------------------------------------
   Canonical sidebar + shell stylesheet for every Synthology product.
   Served at /synth-shell.css by hosts that reference Synthology.Shared.Web.

   Brand color: ONE knob — --brand — set per product in host <head>:
     <style>:root { --brand: #7c5cff; --brand-rgb: 124, 92, 255; }</style>

   ============================================================================ */

/* --- Theme variables (dark default, light + system overrides) ------------- */
:root {
  --bg:       #0f1117;
  --surface:  #1a1d2e;
  --card:     #1e2235;
  --border:   #2d3148;
  --accent:   #4f8ef7;
  --accent2:  #7c3aed;
  --green:    #22c55e;
  --red:      #ef4444;
  --yellow:   #f59e0b;
  --orange:   #f97316;
  --text:     #e2e8f0;
  --muted:    #64748b;
  /* BI-2026-325 — these five were REFERENCED by shared console code and declared NOWHERE, so
     `var(--x, FALLBACK)` took the dark-theme fallback unconditionally and they rendered dark in
     LIGHT mode too. That is the navy search-criteria panel the operator reported on Fleet Queues
     and the Fleet Study Browser (2026-11-22) while the Dashboard beside it was correct.

     EVERY :root VALUE HERE IS THE LITERAL IT REPLACES, so dark mode cannot move at the sites that
     produced the symptom: 7 of the 10 --panel uses and all of --line's already said exactly this.
     Three --panel sites shift between near-identical dark slates and become CONSISTENT with the
     rest (#1a1d2e in synth-portable-bundle, #222733 in synth-return-to-browser, #1e2235 reached
     through --card in synth-roles) — enumerated rather than discovered, and asserted in
     ThemeVarContractSmoke.

     --fg AND --panel-hover ARE HERE BECAUSE --panel IS, and that is the whole lesson of this
     change. synth-return-to-browser.js:97 sets `background:var(--panel,#222733)` with
     `color:var(--fg,#e6e9ef)`: giving --panel a light value while --fg stayed undeclared would
     have made that control WHITE ON WHITE, and its :hover a dark tint under dark text. Declaring
     a variable can therefore BREAK a pairing that worked by accident, so the unit is the pairing,
     never the variable. Found by reading the call sites before writing these lines.

     THE OTHER 15 UNDECLARED PROPERTIES ARE DELIBERATELY NOT HERE. --primary, --card-bg,
     --input-bg and the rest carry DIFFERENT fallbacks at different call sites, so one declared
     value necessarily moves dark mode somewhere; each needs its sites read. They are
     BI-2026-325's remaining children and ThemeVarContractSmoke names every one with its reason,
     failing when an entry stops being a finding. */
  --panel:       #1e293b;
  --panel-hover: #2b3140;
  --fg:          #e6e9ef;
  --line:        #334155;
  --bg2:         #1a1d2e;
  --font:     'Segoe UI', system-ui, sans-serif;
  /* DCR-2026-698 / RI-2026-128 — shared type-scale tokens. Font SIZE is now a
     shared knob like --font (family) already is: the shell's own chrome uses
     these tokens, and products adopt them for content text (C-staged) so size
     stops drifting per-product.
     DCR-2026-701 sibling — the scale originally stopped at 14px (--fs-lg), which
     covered the sidebar chrome but NOT product CONTENT (headings, page titles,
     KPI numbers run 16–24px). A product page that converted a 20px literal to a
     var that didn't exist resolved to nothing. Extended up to 24px so content
     adoption (RI-2026-128 Phase 2) has a token for every size it needs. */
  --fs-3xs:   9px;
  --fs-2xs:   10px;
  --fs-xs:    11px;
  --fs-sm:    12px;
  --fs-md:    13px;
  --fs-lg:    14px;
  --fs-xl:    16px;
  --fs-2xl:   18px;
  --fs-3xl:   20px;
  --fs-4xl:   24px;
  --sidebar-width: 220px;
  /* Brand defaults to a neutral slate; every product SHOULD override. */
  --brand:     #4f8ef7;
  --brand-rgb: 79, 142, 247;
}

[data-theme="light"] {
  --bg:      #f8fafc;
  --surface: #ffffff;
  --card:    #f1f5f9;
  --border:  #e2e8f0;
  --green:   #16a34a;
  --red:     #dc2626;
  --yellow:  #d97706;
  --orange:  #ea580c;
  --text:    #1e293b;
  --muted:   #64748b;
  /* BI-2026-325 — the half that actually fixes the report. A variable declared ONLY in :root is
     still dark here, which is the state these five were already in. Each takes the light-palette
     value its role already has above: --panel is a raised surface, --line is a border, --fg is
     text, --bg2 is a recessed card, --panel-hover is a tint on a white panel. */
  --panel:       #ffffff;
  --panel-hover: #e2e8f0;
  --fg:          #1e293b;
  --line:        #e2e8f0;
  --bg2:         #f1f5f9;
}

@media (prefers-color-scheme: light) {
  [data-theme="system"] {
    --bg:      #f8fafc;
    --surface: #ffffff;
    --card:    #f1f5f9;
    --border:  #e2e8f0;
    --green:   #16a34a;
    --red:     #dc2626;
    --yellow:  #d97706;
    --orange:  #ea580c;
    --text:    #1e293b;
    --muted:   #64748b;
    /* BI-2026-325 — byte-identical to the [data-theme="light"] block above, and it has to be:
       this is the branch a FRAMED pane lands on. synth-study-browser.html declares
       data-theme="system", so a console in light mode on a light OS reaches the page through
       HERE, not through the attribute selector. Omitting these five would have left the Fleet
       Study Browser's criteria panel navy even after the fix, on exactly the screen that was
       reported. ThemeVarContractSmoke asserts the two blocks agree. */
    --panel:       #ffffff;
    --panel-hover: #e2e8f0;
    --fg:          #1e293b;
    --line:        #e2e8f0;
    --bg2:         #f1f5f9;
  }
}

/* --- Reset + base --------------------------------------------------------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }

/* --- Layout container ----------------------------------------------------- */
.layout, .app { display: flex; min-height: 100vh; }

/* ==========================================================================
   SIDEBAR
   ========================================================================== */

.sidebar {
  width: var(--sidebar-width);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; height: 100vh; z-index: 100;
}

.sidebar-resize-handle {
  position: absolute; top: 0; right: -3px;
  width: 6px; height: 100%;
  cursor: ew-resize; z-index: 200;
  background: transparent;
}
.sidebar-resize-handle:hover,
.sidebar-resize-handle.dragging {
  background: rgba(var(--brand-rgb), .4);
}

/* Sticky header (product name + version) */
.sidebar-header { flex-shrink: 0; }
.sidebar-logo {
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-logo .mark {
  width: 32px; height: 32px; border-radius: 7px;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  color: var(--surface); font-weight: 800; font-size: var(--fs-md);
  display: flex; align-items: center; justify-content: center;
  letter-spacing: -0.3px;
}
/* When config.discPath is set, SynthShell.init() adds `.has-disc` to the
   mark element and replaces its 2-letter text with an <img class="disc">.
   Strip the gradient/letter styling and render the SVG disc as a circular
   32×32 badge — the brand-color circle is baked into the disc SVG itself,
   so this container needs no background or border. */
.sidebar-logo .mark.has-disc {
  background: none;
  border-radius: 50%;
  overflow: hidden;
  padding: 0;
  letter-spacing: normal;
  font-size: 0;
}
.sidebar-logo .mark.has-disc img.disc {
  width: 100%;
  height: 100%;
  display: block;
}
.sidebar-logo svg { width: 28px; height: 28px; }
.sidebar-logo .title,
.sidebar-logo span {
  font-size: var(--fs-lg); font-weight: 700;
  color: var(--brand); letter-spacing: .5px;
}
.sidebar-logo small {
  display: block; font-size: var(--fs-2xs);
  color: var(--muted); font-weight: 400;
}

/* Identity widget (below header, above search) */
.sidebar-user {
  display: none;                          /* JS reveals on /api/auth/whoami success */
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: rgba(var(--brand-rgb), .06);
}
.sidebar-user-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
  min-width: 0;                          /* let flex children shrink */
}
.sidebar-user-row > * { min-width: 0; }  /* same for inner wrappers */
.sidebar-user-name {
  font-size: var(--fs-sm); font-weight: 600; color: var(--brand);
  /* Long org emails (e.g. firstname.lastname@long-org-domain.tld)
     overflowed the sidebar width into the main content area. Allow
     word-break inside the local-part / domain so the email wraps to
     a second line instead of overflowing horizontally. */
  overflow-wrap: anywhere;
  word-break: break-word;
}
.sidebar-user-role {
  font-size: var(--fs-2xs); color: var(--muted); text-transform: uppercase;
}
.sidebar-user-actions { display: flex; gap: 4px; }
.sidebar-user-actions button {
  background: transparent; border: 1px solid var(--border);
  color: var(--muted); padding: 3px 6px;
  border-radius: 4px; cursor: pointer; font-size: var(--fs-xs);
}
.sidebar-user-actions button:hover {
  color: var(--text); border-color: var(--brand);
}

/* Live-filter search */
.sidebar-search {
  padding: 6px 12px 8px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}
.sidebar-search-wrap { position: relative; }
.sidebar-search-wrap::before {
  content: '🔍';
  position: absolute; left: 6px; top: 50%; transform: translateY(-50%);
  font-size: var(--fs-2xs); pointer-events: none;
}
.sidebar-search input {
  width: 100%;
  font-size: var(--fs-xs); padding: 5px 8px 5px 26px;
  border-radius: 5px;
  background: var(--bg); border: 1px solid var(--border);
  color: var(--text); outline: none;
}
.sidebar-search input:focus { border-color: var(--brand); }

/* Scrollable nav region */
.sidebar nav,
.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 0; }

/* Section headers + collapsible groups */
.sidebar-section {
  padding: 12px 16px 4px;
  font-size: var(--fs-2xs); font-weight: 700;
  color: var(--muted); letter-spacing: 1px;
  text-transform: uppercase;
}
.sidebar-section.collapsible {
  cursor: pointer;
  display: flex; justify-content: space-between; align-items: center;
  user-select: none;
}
.sidebar-section.collapsible:hover { color: var(--text); }
.sidebar-section .caret {
  transition: transform .2s;
  font-style: normal; font-size: var(--fs-2xs);
}
.sidebar-section.collapsed .caret { transform: rotate(-90deg); }
.section-alert-badge {
  margin-left: auto;
  background: var(--red); color: #fff;
  border-radius: 10px; padding: 1px 7px;
  font-size: var(--fs-2xs); font-weight: 700;
  min-width: 18px; text-align: center;
}
.sidebar-group {
  overflow: hidden;
  transition: max-height .25s ease;
}
.sidebar-group.collapsed { max-height: 0 !important; }

/* Nav links.
   RI-2026-128 fix: also match `.sidebar-group a`. normalizeHeader() relocates the OVERVIEW
   group OUT of <nav class="sidebar-nav"> into the sticky region, and pinOverviewItems() can
   pull Help/Monitor into it from a separate section — once outside <nav>, `nav a`/`.sidebar-nav a`
   no longer apply and the links collapse to inline (the cramming seen on ME/VNA Repo/EE). Keying
   on `.sidebar-group a` (location-independent — every nav link lives in a .sidebar-group) keeps
   the flex layout wherever the group ends up.
   DCR-705 fix: ALSO match `.sidebar-pinned a`. The pinned-pattern products (QMS/Vault/Gateway/SCC)
   put their OVERVIEW links in `<div class="sidebar-pinned">`, which is NEITHER `nav`/`.sidebar-nav`
   NOR `.sidebar-group` — so the shell never styled those links and they relied on per-product CSS.
   QMS+Vault carry a local `.sidebar-pinned a` rule (so they were fine); Gateway+SCC carry none, so
   once pinOverviewItems() moved a 2nd link (Help & Docs) into SCC's pinned block the two links
   collapsed inline (SCC cramming). Styling `.sidebar-pinned a` from the shared shell fixes SCC,
   standardizes Gateway, and makes the per-product rules redundant. Local rules still win on source
   order, so QMS/Vault are unchanged.
   RI-2026-909 fix: ALSO match `#overview-links a`. The fleet-standard pinned OVERVIEW block (SR Engine
   reference, DCR-2026-526) is a PLAIN `<div id="overview-links">` — deliberately NOT a .sidebar-group so
   collapseAllSidebar() skips it — so its links were styled only where a product wrote per-anchor inline
   display:flex (SR Engine, Core MWL). Core Router + Essential Router carried bare anchors there and
   rendered crammed inline. Keying the shell on the container id makes the standard block correct
   without inline styles on every page. */
nav a,
.sidebar-nav a,
.sidebar-group a,
.sidebar-pinned a,
#overview-links a {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 16px;
  color: var(--muted); cursor: pointer;
  font-size: var(--fs-md); font-weight: 500;
  transition: all .15s;
  border-left: 3px solid transparent;
}
nav a:hover,
.sidebar-nav a:hover,
.sidebar-group a:hover,
.sidebar-pinned a:hover,
#overview-links a:hover {
  color: var(--text);
  background: rgba(var(--brand-rgb), .06);
}
nav a.active,
.sidebar-nav a.active,
.sidebar-group a.active,
.sidebar-pinned a.active,
#overview-links a.active {
  color: var(--text);
  background: rgba(var(--brand-rgb), .10);
  border-left-color: var(--brand);
}
nav a svg,
.sidebar-nav a svg,
.sidebar-group a svg,
.sidebar-pinned a svg,
#overview-links a svg { width: 16px; height: 16px; flex-shrink: 0; }
nav a .ico,
.sidebar-nav a .ico,
.sidebar-group a .ico,
.sidebar-pinned a .ico,
#overview-links a .ico {
  width: 16px; display: inline-block; text-align: center;
}
nav a .locked,
nav a .nav-lock-badge,
.sidebar-group a .locked,
.sidebar-group a .nav-lock-badge,
.sidebar-pinned a .locked,
.sidebar-pinned a .nav-lock-badge {
  margin-left: auto;
  font-size: var(--fs-3xs); color: var(--muted); letter-spacing: .5px;
}

/* License-lock states */
.nav-item-locked { opacity: .55; }
.nav-item-hidden { display: none !important; }

/* Drag-reorder affordances */
.sidebar-drag-item { cursor: grab; }
.sidebar-drag-item.dragging { opacity: .35; }
.sidebar-drag-over,
.sidebar-item-drag-over {
  outline: 2px dashed var(--brand);
  outline-offset: -2px;
  border-radius: 4px;
}
.sidebar-item-drag-over { background: rgba(var(--brand-rgb), .06); }
.sidebar-hidden-item { display: none !important; }

/* ==========================================================================
   SIDEBAR FOOTER
   ========================================================================== */

.sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  position: sticky; bottom: 0;
  flex-shrink: 0;
}
.sidebar-footer .footer-copyright {
  text-align: center;
  font-size: var(--fs-2xs);
  color: var(--brand);
  padding: 4px 8px;
  font-weight: 600;
  line-height: 1.3;
}
.sidebar-footer .footer-copyright a {
  color: inherit;
  text-decoration: underline;
  opacity: .85;
}

/* Theme chip row (3 discrete buttons: ☀ 🌙 SYS) + Save/Reset pair */
.sidebar-footer .footer-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 4px;
  border-top: 1px solid rgba(255, 255, 255, .08);
  margin-top: 4px;
  gap: 6px;
}
.theme-btn,
.prefs-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 4px 8px;
  border-radius: 5px;
  cursor: pointer;
  font-size: var(--fs-xs);
  display: inline-flex; align-items: center; gap: 4px;
  transition: color .15s, border-color .15s, background .15s;
}
.theme-btn:hover,
.prefs-btn:hover {
  color: var(--text); border-color: var(--brand);
}
.theme-btn.active {
  color: var(--brand);
  border-color: var(--brand);
  background: rgba(var(--brand-rgb), .10);
}
.sidebar-footer .theme-group,
.sidebar-footer .prefs-group { display: flex; gap: 4px; }

/* Full-width utility buttons (Collapse All, Hide Unlicensed) */
.sidebar-footer .btn-sidebar-util {
  width: 100%;
  margin-top: 6px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 5px;
  cursor: pointer;
  font-size: var(--fs-xs);
}
.sidebar-footer .btn-sidebar-util:hover {
  color: var(--text);
  border-color: var(--brand);
}
.sidebar-footer .btn-sidebar-util.active {
  color: var(--brand);
  border-color: var(--brand);
  background: rgba(var(--brand-rgb), .08);
}

/* Restart & Reload License (dangerous, orange tint) */
.sidebar-footer .btn-restart-reload {
  width: 100%;
  display: flex; align-items: center; justify-content: center;
  gap: 7px;
  font-size: var(--fs-sm);
  padding: 7px 10px;
  margin-top: 8px;
  background: rgba(var(--brand-rgb), .08);
  border: 1px solid rgba(var(--brand-rgb), .25);
  color: var(--brand);
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  font-weight: 600; letter-spacing: .2px;
}
.sidebar-footer .btn-restart-reload:hover {
  background: rgba(var(--brand-rgb), .16);
  border-color: rgba(var(--brand-rgb), .5);
}
.sidebar-footer .btn-restart-reload:disabled {
  opacity: .5; cursor: not-allowed;
}
.sidebar-footer .restart-status {
  margin-top: 6px;
  font-size: var(--fs-xs);
  text-align: center;
  color: var(--muted);
  min-height: 14px;
  transition: color .2s;
}

/* Runtime log-level override (RI-2026-826 Phase 4) — a compact select in the footer */
.sidebar-footer .loglevel-wrap {
  display: flex; align-items: center; gap: 8px;
  margin-top: 8px;
}
.sidebar-footer .loglevel-label {
  font-size: var(--fs-xs);
  color: var(--muted);
  flex-shrink: 0;
}
.sidebar-footer .loglevel-select {
  flex: 1 1 auto;
  min-width: 0;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 5px 8px;
  border-radius: 5px;
  cursor: pointer;
  font-size: var(--fs-xs);
}
.sidebar-footer .loglevel-select:hover { border-color: var(--brand); }
.sidebar-footer .loglevel-select:disabled { opacity: .5; cursor: not-allowed; }
.sidebar-footer .loglevel-wrap .restart-status { margin-top: 0; flex-shrink: 0; min-height: 0; }

/* HIPAA / compliance mode badge (optional, rendered by host) */
.sidebar-footer .hipaa-badge {
  margin-top: 8px;
  padding: 6px 8px;
  background: rgba(34, 197, 94, .12);
  border: 1px solid rgba(34, 197, 94, .35);
  border-radius: 6px;
  font-size: var(--fs-2xs); font-weight: 600;
  text-transform: uppercase; letter-spacing: .5px;
  color: var(--green); text-align: center;
}

/* ==========================================================================
   MAIN CONTENT AREA
   ========================================================================== */

.main, .content {
  margin-left: var(--sidebar-width);
  padding: 28px 32px 40px;
  flex: 1; min-width: 0;
  transition: margin-left .1s;
}

.page, .pane { display: none; }
.page.active, .pane.active { display: block; }

.page-hdr, .page-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg);
  padding: 16px 0 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  display: flex; justify-content: space-between;
  align-items: flex-start; gap: 16px;
}
.page-hdr h1, .page-header h1 { margin: 0 0 2px; color: var(--brand); }
.page-hdr .subtitle, .page-header .subtitle {
  margin: 0; color: var(--muted); font-size: var(--fs-md);
}
.page-hdr-actions, .page-header-actions {
  display: flex; gap: 8px; align-items: center;
  flex-shrink: 0; flex-wrap: wrap; padding-top: 4px;
}

/* A same-page fragment link must not park its target UNDER the sticky header.
   DCR-2026-4082 / DCR-2026-4083 (RI-2026-1039).

   .page-hdr above is position:sticky; top:0, so a native fragment jump - which aligns the target
   to the very TOP of the viewport - leaves the target's own heading hidden behind it. Reported on
   Core Router, where the sidebar's Listeners / Source Nodes / Routing Rules links are plain
   anchors (href="/config.html#sec-listeners"), but the sticky rule is HERE, in the shared shell,
   so this is not one product's bug.

   MEASURED AGAINST THE SHIPPED FILES, and the number matters: a realistic header with a title,
   subtitle and a wrapped actions row renders 110px, not the ~80px the padding alone suggests. A
   hard-coded 80px offset was tried and DID NOT FIX THE DEFECT - the target still landed at 92px
   behind a 110px header. It also grows further when the actions wrap at narrow widths, and
   products override the padding (Core Router's local copy uses 12px/10px). So synth-shell.js
   measures the real header into --page-hdr-h and keeps it current with a ResizeObserver.

   The 120px literal here is ONLY the pre-measurement fallback, for the window before the shell's
   JS runs or if it never does. It is deliberately generous: over-scrolling by a few pixels leaves
   a small gap above the heading, while under-scrolling hides the heading entirely, which is the
   defect being fixed.

   scroll-margin-top also applies to element.scrollIntoView(), so JS-driven jumps get the same
   clearance for free. The window is the scroll container here - body/.main set no overflow - so
   this is the standards-correct remedy rather than a JS scroll handler. */
:target { scroll-margin-top: calc(var(--page-hdr-h, 120px) + 12px); }

/* Small-screen: sidebar collapses off-canvas.
   RI-2026-959 — this used to slide the sidebar away with NO way to bring it back
   (toggleSidebarGroup is the in-sidebar accordion, not a drawer), so below 900px the
   console had no navigation at all. The shell now injects a hamburger + scrim and
   toggles .is-open here. */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform .22s ease;
    will-change: transform;
  }
  .sidebar.is-open { transform: translateX(0); box-shadow: 0 0 40px rgba(0,0,0,.45); }
  .main, .content { margin-left: 0; padding: 18px; }
  /* Clear the fixed hamburger so it never sits on top of page content. */
  .main, .content { padding-top: 60px; }
  #synth-nav-toggle { display: flex; }
  #synth-nav-scrim.is-open { display: block; }
}

/* Hamburger + scrim: injected once by the shell, inert above 900px. */
#synth-nav-toggle {
  display: none;
  position: fixed; top: 10px; left: 10px; z-index: 102;
  align-items: center; justify-content: center;
  width: 40px; height: 40px; padding: 0;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  cursor: pointer; line-height: 0;
}
#synth-nav-toggle:hover { border-color: var(--accent); color: var(--accent); }
#synth-nav-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#synth-nav-scrim {
  display: none;
  position: fixed; inset: 0; z-index: 99;
  background: rgba(0,0,0,.45);
}
@media (prefers-reduced-motion: reduce) {
  .sidebar { transition: none; }
}

/* ==========================================================================
   EMBED MODE — this page is rendered inside a host shell (RI-2026-1221 item 1)
   --------------------------------------------------------------------------
   Set by synth-embed.js when the page is loaded with ?embed=1, before first
   paint. The host supplies the sidebar, so this page hides its own and drops
   the offset that sidebar creates. Nothing here matches without that class,
   so a direct visit to the page is unchanged.

   BOTH SELECTOR FAMILIES, because the fleet uses both: .main and .content
   carry margin-left: var(--sidebar-width) at :490, and the resize handle is a
   separate element from .sidebar so hiding only the sidebar would leave a
   draggable strip floating over the embedded content.
   ========================================================================== */
html.embed .sidebar,
html.embed .sidebar-resize-handle { display: none !important; }

html.embed .main,
html.embed .content { margin-left: 0 !important; }

/* The host frame already provides the page's outer padding and scroll, so the
   embedded document must not add a second viewport-height scroller inside it. */
html.embed, html.embed body { min-height: 0; }

/* BI-2026-342 - THE SUPPORT BANNER IS THE HOST'S TO SHOW, EXACTLY LIKE THE SIDEBAR.
   synth-supportagent-session.js injects its banner into <main> (not into .sidebar), so the
   sidebar rule above never covered it and a framed pane drew a SECOND copy above the host's.
   Both IDs, because findBanner() accepts either: a product may pre-place the element itself.

   IT ALSO FIXES A TIMESTAMP DISAGREEMENT, which is how the operator spotted it. The two copies
   showed the same session five hours apart - 20:41 against 15:41 - because the framed document
   resolves the display timezone separately from its host and had not picked up the configured
   one. Suppressing the inner copy leaves one banner carrying the host's resolved timezone,
   rather than leaving two and teaching the reader that one of them lies. */
html.embed #synth-supportagent-session-banner,
html.embed #support-session-banner { display: none !important; }

/* BI-2026-342 - THE SAME ESCAPE, FOR EVERY ELEMENT THE SHELL PUTS OUTSIDE .sidebar.
   The banner above was the one an operator happened to see. Swept synth-shell.js for what else
   can land on document.body, because fixing them one cook at a time is the expensive way to
   find out:

     #synth-config-lock-chip   anchors to #sidebar-user-widget, and FALLS BACK to document.body
                               when that is absent - which is exactly the embedded case. Observed
                               floating at the foot of the Associations pane, 2026-11-23.
     #synth-impersonation-*    inserted as document.body.firstChild, so a framed pane would show
                               a second full-width "view-as" bar above the host's.
     #synth-nav-toggle         hamburger + scrim, appended to body and live below 900px. A framed
     #synth-nav-scrim          pane is narrow BY CONSTRUCTION, so these are more likely inside a
                               frame than on the page they belong to.

   All of them are host chrome: the host shell already renders its own, and a frame is not where
   the operator acts on any of them. Hidden rather than not-created, matching how the sidebar
   itself is handled - synth-embed.js adds a class and CSS does the rest, so no script needs to
   know whether it is framed. */
html.embed #synth-config-lock-chip,
html.embed #synth-impersonation-banner,
html.embed #synth-impersonation-exit,
html.embed #synth-nav-toggle,
html.embed #synth-nav-scrim { display: none !important; }

/* ==========================================================================
   SHARED STANDALONE PAGE CHROME — .synth-page                    (RI-2026-1220)

   WHY THIS EXISTS. The five shared standalone pages in Synthology.Shared.Web.Review
   (associations, de-ID review, DICOM viewer, recovered studies, study browser) are
   written against .panel / .btn / .btn-primary and against styled form controls.
   Measured 2026-11-12: NO stylesheet in the fleet defined .panel or .btn — not this
   one, not any product's — and a base input/select/textarea rule existed in only
   three consoles' inline <style>. A console's inline <style> cannot reach a page the
   console FRAMES via data-embed, so each of these pages rendered with browser
   defaults on every thin-shell console (Core Router, Essential Router, Core MWL):
   bare buttons, white inputs inside a dark theme, panels with no card behind them.
   No color-scheme property is declared anywhere either, so the UA widgets render
   light regardless of the theme.

   The operator reported it as "Core router doesn't render the same as Router".
   Router's copy of the Study Browser looked right for a reason unrelated to sharing:
   it is INLINE in Router's own index.html, where Router's own .btn and
   input/select/textarea rules reach it.

   WHY IT IS SCOPED TO .synth-page AND NOT GLOBAL. Unscoped, these rules would restyle
   live consoles that use the classes without defining them — .btn on six (SynthIQ,
   SynthInSight, SynthPulse, CohortaNexus, Device Registry, V-Light Encapsulator),
   .panel on Router and Encounter Engine, and a base input/select rule on twenty-three
   of the twenty-six. Every one of those is arguably an improvement; not one of them
   was asked for, and none can be previewed without cooking that product. Scoped, the
   blast radius is exactly the pages that carry class="synth-page" on <body>.

   THE VALUES ARE ROUTER'S OWN, COPIED RATHER THAN INVENTED, so a shared page framed
   in any console reads as the flagship does. That fidelity includes a quirk: a bare
   .btn declares no background, so it falls to the UA's light button face on Router
   too. Giving it one here would have made the two differ again in the other
   direction, which is the whole defect. Worth its own decision, not this change.

   SPECIFICITY IS DELIBERATELY LOW — a single class, so a page's own <style>, which
   loads after this file, wins a tie: .sb-form input (0,1,1) ties .synth-page input
   (0,1,1) and the page's rule applies. A body.synth-page prefix would silently have
   outranked every page-local control rule in the library.

   The per-console duplication these values come from — .btn written out thirteen
   times in thirteen index.html files and absent on six more, .panel defined nowhere
   at all — is a separate finding and is NOT fixed here.
   ========================================================================== */

.synth-page .panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
}

.synth-page label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* A label that WRAPS its own control is a caption, not a field heading: uppercasing
   it and forcing it to block turns "Select all" into a stacked shout. :has() is
   current in every browser these consoles run in; an engine without it drops this one
   rule and keeps the heading styling, so the degrade is cosmetic rather than broken. */
.synth-page label:has(> input[type=checkbox]),
.synth-page label:has(> input[type=radio]) {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-transform: none;
  letter-spacing: normal;
  color: var(--text);
  margin-bottom: 0;
}

.synth-page input,
.synth-page select,
.synth-page textarea {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  font-family: var(--font);
}

.synth-page input[type=radio],
.synth-page input[type=checkbox] {
  width: auto;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.synth-page input:focus,
.synth-page select:focus,
.synth-page textarea:focus { outline: none; border-color: var(--accent); }

.synth-page .btn {
  padding: 7px 14px; border-radius: 6px; border: none; cursor: pointer; font-size: 13px;
  font-weight: 500; transition: all .15s; display: inline-flex; align-items: center; gap: 6px;
}
.synth-page .btn-primary { background: var(--accent); color: #fff; }
.synth-page .btn-primary:hover { background: #3b7de8; }
.synth-page .btn-danger { background: rgba(239,68,68,.15); color: var(--red); border: 1px solid rgba(239,68,68,.3); }
.synth-page .btn-danger:hover { background: rgba(239,68,68,.25); }
.synth-page .btn-success { background: rgba(34,197,94,.15); color: var(--green); border: 1px solid rgba(34,197,94,.3); }
.synth-page .btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.synth-page .btn-ghost:hover { color: var(--text); border-color: var(--muted); }
.synth-page .btn-sm { padding: 4px 10px; font-size: 12px; }
.synth-page .btn:disabled { opacity: .5; cursor: not-allowed; }
