/* Shared panel tokens. OBS sources keep their own styles. */
:root {
  --bg:#101519; --panel:#181f24; --surface:#20292f; --line:#344047;
  --text:#edf1ed; --accent-soft:#bbd99b17;
  --ink:#edf1ed; --muted:#a8b5b8; --accent:#bbd99b; --success:#aaceb7;
  --warning:#e9c787; --danger:#edaca2; --focus:#bedb9e;
  --space-1:4px; --space-2:8px; --space-3:12px; --space-4:16px; --space-6:24px; --space-8:32px;
  --radius-sm:6px; --radius:10px; --radius-lg:14px;
  --control-height:40px; --sidebar-width:264px; --header-height:72px; --helper-width:340px;
  color-scheme:dark; font-family:"Segoe UI",Arial,sans-serif;
}
html {scroll-padding-top:calc(var(--header-height) + 20px)}
body {background:var(--bg); color:var(--ink); font-size:14px; line-height:1.5; overflow-x:clip}
button,input,select,textarea {font-family:inherit}
button,.button {font-size:13px; line-height:1.35; min-height:var(--control-height); padding:9px 14px; border-radius:var(--radius-sm); max-width:100%; white-space:normal; background:var(--surface); color:var(--ink); border:1px solid var(--line)}
button:hover,.button:hover {background:#2a363d; border-color:#63736f; filter:none}
button.primary,.button.primary,form button[type=submit]:not(.ghost):not(.secondary),form button:not([type]):not(.ghost):not(.secondary) {background:var(--accent); color:#1d291d; border-color:transparent}
button.primary:hover,.button.primary:hover {background:#c7e3ab}
button.ghost,.button.ghost {background:transparent}
button.danger {background:#53332f40; color:var(--danger); border-color:#9a645b70}
button:disabled {cursor:not-allowed; opacity:.55}
:is(button,a,input,select,textarea,summary,[tabindex]):focus-visible {outline:2px solid var(--focus); outline-offset:3px; box-shadow:none}
input,select,textarea {font-size:14px; line-height:1.45; min-height:var(--control-height); padding:9px 11px; background:#11191e; border-color:#455159; border-radius:var(--radius-sm); max-width:100%; min-width:0}
input[readonly] {font-size:13px}
input[type=checkbox],input[type=radio] {min-height:0; width:18px; height:18px; accent-color:var(--accent); flex-shrink:0}
input[type=range] {padding:0; accent-color:var(--accent)}
label {font-size:14px; color:var(--ink); margin-bottom:16px; min-width:0}
label>input,label>textarea,label>select {margin-top:6px}
label.check {font-size:14px; align-items:center; min-height:32px}
textarea {min-height:88px}
h1 {font-size:28px; line-height:1.2; letter-spacing:-.6px; margin:0 0 10px}
h2 {font-size:18px; line-height:1.4; margin:0 0 14px}
h3 {font-size:16px; line-height:1.4}
.small,small,.badge,.tag,.eyebrow,.preview-foot,.rule .meta,.log small,footer {font-size:12px}
.eyebrow {letter-spacing:1.15px; line-height:1.5}
.muted,.small.muted {color:var(--muted)}
.card,.rule {border-radius:var(--radius); border-color:var(--line); background:var(--panel)}
.card {padding:20px; margin-bottom:20px}
.rule {padding:16px 18px; gap:16px; margin-bottom:10px; min-width:0}
.rule p,.log p {font-size:13px; line-height:1.5}
.rule h3 {font-size:16px; margin-bottom:6px}
.rule button,.rule summary {font-size:13px; min-height:36px}
.badge {font-weight:600; letter-spacing:0; padding:3px 8px; background:#bbd99b17; color:var(--accent)}
.badge.off {color:var(--muted); background:#ffffff08}
.actions {gap:8px}
.form-grid,.setting-grid {gap:0 16px; grid-template-columns:repeat(2,minmax(0,1fr))}
.form-grid>*,.setting-grid>*,.inline>* {min-width:0}
.inline {flex-wrap:wrap; gap:12px}
.inline>label {flex:1 1 200px}
.empty,.search-empty,.list-state {padding:24px 16px; font-size:14px; border:1px dashed var(--line); border-radius:var(--radius); color:var(--muted); text-align:center}
.notice,.channel-permission-note {padding:12px 14px; border:1px solid var(--line); border-left:3px solid var(--accent); border-radius:var(--radius-sm); font-size:13px; margin:12px 0 20px; color:var(--muted); background:#bbd99b04}
.channel-permission-note {border-left-color:var(--warning); color:var(--ink)}
details>summary {cursor:pointer; font-size:14px; color:var(--ink); min-height:36px; display:list-item; padding:7px 0}
details[open]>summary {margin-bottom:12px}
.help-details {margin:12px 0; padding:0; border:0}
.help-details p {font-size:13px; color:var(--muted)}
.setting-group {border:1px solid var(--line); border-radius:var(--radius); padding:16px; margin:20px 0; min-width:0}
.setting-group legend {font-size:16px; font-weight:600; padding:0 6px}
/* Stable account, workspace and navigation. */
.sidebar {width:var(--sidebar-width); padding:22px 16px 16px; position:fixed; inset:0 auto 0 0; background:#141b20; z-index:100; gap:16px; overflow:hidden}
.sidebar .brand {font-size:23px; flex-shrink:0; padding:0 8px}
.sidebar>.eyebrow {display:none}
.sidebar .channel-switcher {flex-shrink:0; margin:0; padding:12px; background:var(--panel); border:1px solid var(--line); border-radius:var(--radius)}
.channel-switcher label {font-size:12px; margin:0}
.channel-switcher select {font-size:14px; padding:8px; margin-top:6px; min-width:0}
.channel-switcher p {font-size:12px; margin:6px 0 0; color:var(--muted)}
.nav-search {margin:0; flex-shrink:0; font-size:12px}
.nav-search input {min-height:38px; font-size:13px}
.sidebar nav {flex:1 1 auto; overflow-y:auto; overflow-x:hidden; min-height:0; flex-direction:column; gap:6px; margin:0; max-height:none; scrollbar-gutter:stable}
.nav-group {padding:8px 0; border:0}
.nav-group>p {font-size:12px; text-transform:none; letter-spacing:0; color:var(--muted); margin:4px 10px 7px; font-weight:600}
.nav-children {margin:0; padding:0; border:0}
.sidebar nav a {font-size:13px; padding:8px 11px; gap:10px; border-radius:7px; min-height:36px; white-space:normal; color:#bac6c8}
.sidebar nav a span {font-size:16px; width:20px; flex-shrink:0}
.sidebar nav a.active,.sidebar nav a[aria-current=page] {background:#bbd99b12; color:var(--accent); box-shadow:inset 2px 0 var(--accent)}
.sidebar nav a:hover {background:#ffffff06}
.sidebar-bottom {margin:0; padding:12px 8px 0; border-top:1px solid var(--line); flex-shrink:0; display:block; font-size:12px}
.sidebar-bottom p {margin:6px 0 10px; overflow-wrap:anywhere}
.sidebar-bottom button {font-size:13px; min-height:36px; width:100%}
main#main-content,#app>main {margin-left:var(--sidebar-width); max-width:none; padding:0 28px 84px; min-width:0}
.topbar,.topbar-shell {position:sticky; top:0; min-height:var(--header-height); height:auto; padding:12px 0; display:flex; flex-wrap:wrap; gap:10px 20px; margin:0 0 24px; background:var(--bg); z-index:45; border-bottom:1px solid var(--line)}
#workspace-context {display:flex; flex:1; flex-wrap:wrap; align-items:center; gap:7px; font-size:14px; min-width:0}
#workspace-channel {font-weight:650; color:var(--ink); overflow-wrap:anywhere}
#workspace-section {color:var(--muted)}
#workspace-role {font-size:12px; color:var(--accent); background:#bbd99b0d; border:1px solid #bbd99b28; padding:3px 7px; border-radius:5px; margin-left:4px; max-width:100%}
#workspace-connection {font-size:12px; max-width:270px; color:var(--muted)}
#workspace-notice {font-size:13px; padding:10px 14px; margin:0 0 16px; border-left:3px solid var(--warning); background:var(--panel)}
#menu-toggle,#menu-close {display:none}
#navigation-backdrop {position:fixed; inset:0; background:#000a; z-index:90; border:0; border-radius:0}
.skip-link {position:fixed; left:16px; top:-100px; background:var(--accent); color:#1b2918; padding:12px 18px; z-index:1000; border-radius:8px}
.skip-link:focus {top:12px}
.heading {margin-bottom:22px; align-items:center; flex-wrap:wrap}
.heading p:last-child {max-width:820px}
.section-intro {max-width:880px; margin:0 0 20px; color:var(--muted)}
.section-shortcuts {position:sticky; top:var(--header-height); z-index:35; gap:6px; padding:10px 0; margin:8px 0 18px; background:var(--bg); border-bottom:1px solid var(--line); flex-wrap:wrap}
.section-shortcuts button {font-size:13px; min-height:34px; padding:6px 10px}
.section-shortcuts button[aria-current=true] {color:var(--accent); border-color:#9bb57e}
.settings-anchor {scroll-margin-top:calc(var(--header-height) + 68px)}
/* Local form actions and list context. */
.form-actions,.editor-actions {position:sticky; bottom:12px; z-index:30; display:flex; flex-wrap:wrap; align-items:center; gap:8px 12px; padding:12px; margin:20px -4px 0; background:#20292ff2; border:1px solid var(--line); border-radius:var(--radius); box-shadow:0 6px 20px #0003}
.form-state {font-size:13px; color:var(--muted); display:block; min-height:20px; line-height:1.45; margin:10px 0 0; overflow-wrap:anywhere}
.form-actions>.form-state {margin:0; flex:1 1 180px}
.form-state[data-state=dirty] {color:var(--warning)}
.form-state[data-state=saved] {color:var(--success)}
.form-state[data-state=error] {color:var(--danger)}
.field-error,[aria-invalid=true]~.field-error {color:var(--danger); font-size:13px; margin:5px 0 10px}
[aria-invalid=true] {border-color:var(--danger)}
.list-toolbar {display:flex; align-items:end; gap:12px; flex-wrap:wrap; margin:16px 0}
.list-toolbar label,.list-toolbar .list-search {margin:0; flex:1 1 230px; max-width:none}
.list-toolbar label.list-status-filter {flex:0 1 175px}
.list-summary {font-size:12px; color:var(--muted); display:flex; gap:12px; align-items:center; margin:0 0 12px}
.list-summary button {font-size:13px; min-height:32px; padding:5px 9px}
.rule-more {position:relative; margin:0; border:0}
.rule-more>summary {border:1px solid var(--line); border-radius:6px; font-size:13px; padding:8px 12px; min-height:36px; list-style:none}
.rule-more>summary::after {content:'⌄'; padding-left:10px}
.rule-more[open]>summary {margin-bottom:5px}
.rule-more>div {position:absolute; top:100%; right:0; min-width:180px; max-width:260px; padding:8px; background:var(--surface); border:1px solid var(--line); border-radius:8px; box-shadow:0 12px 28px #0006; z-index:40; flex-direction:column; align-items:stretch}
.rule-more>div>button {text-align:left; justify-content:flex-start; width:100%}
.conflict-grid {display:grid; grid-template-columns:minmax(120px,.6fr) minmax(0,1fr) minmax(0,1fr); gap:12px; padding:10px 0; border-top:1px solid var(--line); font-size:13px; white-space:pre-wrap; overflow-wrap:anywhere}
.draft-tools {font-size:13px; margin-top:12px; border-top:1px solid var(--line); padding-top:10px}
.draft-tools summary {font-size:13px}
/* Preview surfaces and technical status. */
.overview-summary {display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; margin-bottom:20px}
.overview-summary article {padding:14px 16px; background:var(--panel); border:1px solid var(--line); border-radius:10px; min-width:0}
.overview-summary strong {display:block; font-size:15px; margin:5px 0; font-weight:600}
.overview-summary span,.overview-summary small {font-size:12px; color:var(--muted)}
.overview-quicklinks {display:flex; flex-wrap:wrap; gap:8px; margin:12px 0 20px}
[data-section=overview]>.stats {grid-template-columns:1fr; margin-bottom:16px}
[data-section=overview]>.stats article {padding:12px 18px; display:flex; gap:16px; flex-wrap:wrap; align-items:center}
[data-section=overview]>.stats strong {font-size:26px; line-height:1.3}
[data-section=overview] .preview iframe {height:220px; max-height:34vh; min-height:150px; aspect-ratio:auto}
[data-section=overview] .preview.is-expanded iframe {height:min(60vh,600px); max-height:none}
.preview .card-title {padding:14px 18px}
.preview-foot {padding:10px 16px; flex-wrap:wrap; gap:5px}
.preview-empty-note {padding:10px 16px; background:#ffffff03; color:var(--muted); font-size:13px; margin:0}
.log-toolbar {display:flex; gap:8px; align-items:center; margin-bottom:12px}
.log-toolbar label {margin:0; flex:1; font-size:13px}
.logs {max-height:380px}
.log summary {font-size:13px; color:var(--ink); overflow-wrap:anywhere}
.log details p {font-size:12px; margin:6px 0}
.technical-details {margin:16px 0; color:var(--muted)}
/* Libraries and scene workspaces. */
.media-grid {grid-template-columns:repeat(auto-fill,minmax(165px,1fr)); gap:12px}
.media-preview,.model-preview-surface {background:repeating-conic-gradient(#263138 0% 25%,#1c252b 0% 50%) 0 0/18px 18px; border:1px solid var(--line); border-radius:8px; overflow:hidden; min-height:124px; display:grid; place-items:center}
.media-preview img {height:132px; width:100%; object-fit:contain; padding:8px}
.media-placeholder {font-size:13px; color:var(--muted); padding:16px; text-align:center}
.media-retry {font-size:13px; min-height:36px; margin:6px}
.media-grid-state {padding:24px; text-align:center; color:var(--muted)}
.media-grid article h3,.media-grid article strong {font-size:14px; overflow-wrap:anywhere}
.media-grid article {padding:12px}
.media-grid article p {font-size:12px}
.settings-card-grid {grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px}
.object-workbench {grid-template-columns:minmax(0,1.6fr) minmax(300px,1fr); gap:18px; align-items:start}
.object-canvas {position:sticky; top:calc(var(--header-height) + 12px)}
.object-canvas iframe {width:100%; height:min(53vh,520px); min-height:240px; border:0}
.ensemble-workbench {grid-template-columns:minmax(0,1fr) 285px; gap:16px; align-items:start}
.ensemble-canvas {position:sticky; top:calc(var(--header-height) + 12px); min-width:0}
.ensemble-viewport {max-height:58vh; overflow:auto; overscroll-behavior:contain}
.ensemble-viewport #ensemble-preview {width:100%; margin:0; min-width:0}
.ensemble-inspector {padding:14px; border:1px solid var(--line); border-radius:10px; max-height:none; overflow:visible}
.ensemble-inspector label,.ensemble-inspector input,.ensemble-inspector select {font-size:13px}
.ensemble-inspector input,.ensemble-inspector select {min-height:36px; padding:7px 9px}
.ensemble-handle {width:32px!important; height:32px!important; font-size:22px!important}
.ensemble-resize {right:-17px; bottom:-17px}
.ensemble-rotate {left:calc(50% - 16px); top:-44px}
.workspace-tools {gap:8px; padding:10px 0; font-size:13px}
.workspace-tools button {font-size:13px; min-height:36px}
.workspace-tools span {font-size:12px}
#animation-preview {max-height:52vh}
.section-links {display:flex; flex-wrap:wrap; gap:8px 16px; font-size:13px; margin:10px 0 18px}
.secret-link-actions {margin:8px 0 16px}
.secret-link-actions button {font-size:13px; min-height:36px}
.live-action {border-color:#a38b5c!important; color:var(--warning)!important; background:#d3b26b0b!important}
.local-preview-note {font-size:12px; color:var(--muted); border-left:2px solid var(--accent); padding-left:10px; margin:8px 0 16px}
/* Dialogs sit above shell, assistant and save controls. */
dialog.panel-dialog,#media-library-dialog {width:min(960px,calc(100vw - 32px)); max-height:calc(100dvh - 32px); padding:24px; border-radius:14px; background:var(--panel); color:var(--ink); border:1px solid #52625e; overscroll-behavior:contain}
dialog::backdrop {background:#080d10c9}
.ui-confirm {max-width:520px; overflow-wrap:anywhere}
.ui-confirm .actions {justify-content:flex-end; margin-top:24px}
.ui-confirm-context {font-size:12px; color:var(--accent); margin:0 0 12px}
/* Reserve a lane while the assistant is open; it must not cover editor actions. */
#helper-dock {z-index:60; width:var(--helper-width); right:16px; bottom:16px}
body.helper-open #app>main {margin-right:calc(var(--helper-width) + 16px)}
body.helper-open #helper-dock {right:12px; top:calc(var(--header-height) + 12px); bottom:16px; display:flex; flex-direction:column}
body.helper-open .helper-window {max-height:none; min-height:0; flex:1; margin-bottom:8px}
body.helper-open .object-workbench,body.helper-open .ensemble-workbench {grid-template-columns:1fr}
body.helper-open .ensemble-canvas,body.helper-open .object-canvas {position:static}
#helper-dock button,#helper-dock input,#helper-dock textarea,#helper-dock select,#helper-tour #helper-step-text {font-size:13px}
#helper-dock button {min-height:36px}
#helper-dock .helper-note,#helper-dock small,#helper-tour span,.helper-header small {font-size:12px}
.helper-header-actions button {width:36px}
#helper-guide-list {display:flex; flex-direction:column; align-items:stretch}
#helper-guide-list button {justify-content:flex-start; text-align:left}
.helper-guide-heading {font-size:12px; color:var(--muted); margin:10px 0 4px!important}
.helper-tour-heading strong {font-size:14px}
#toast {top:12px; bottom:auto; left:50%; right:auto; transform:translateX(-50%); z-index:160; font-size:13px; max-width:min(520px,calc(100vw - 32px)); padding:12px 16px; box-shadow:0 8px 28px #0005; border-radius:8px; overflow-wrap:anywhere}
/* Portal and global settings use the same scale. */
.server-admin-main {max-width:1220px; margin:0 auto; padding:32px 24px 72px}
.server-admin-grid {gap:20px}
.server-admin-nav {position:sticky; top:0; background:var(--bg); z-index:30; padding:12px 0; margin:16px 0 24px; gap:10px 20px; border-bottom:1px solid var(--line)}
.server-admin-nav a {font-size:14px}
.server-admin-page [data-form-status] {font-size:13px; min-height:20px; margin:10px 0}
.server-admin-page .card {scroll-margin-top:72px}
.server-scope {font-size:13px; color:var(--accent); margin:8px 0 16px}
@media(min-width:1650px) {#app>main {padding-inline:40px}.columns {grid-template-columns:minmax(0,1.3fr) minmax(340px,1fr)}}
@media(max-width:1200px) {.object-workbench,.ensemble-workbench {grid-template-columns:1fr}.object-canvas,.ensemble-canvas {position:static}.columns,.connection-workspace {grid-template-columns:1fr}.settings-card-grid {grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:1000px) { :root {--sidebar-width:232px} #app>main {padding-inline:20px}.sidebar {padding-inline:12px}.sidebar .brand {font-size:21px}.overview-summary {grid-template-columns:1fr} body.helper-open #app>main {margin-right:0;padding-bottom:min(55dvh,500px)} body.helper-open #helper-dock {inset:auto 16px 12px auto;height:min(52dvh,480px);width:min(460px,calc(100vw - 32px))}.settings-card-grid {grid-template-columns:1fr} }
@media(max-width:800px) {
  .list-toolbar {display:grid;grid-template-columns:minmax(0,1fr) auto;gap:12px;align-items:end}
  .list-toolbar>label:first-child {grid-column:1/-1;min-width:0;width:100%;margin:0}
  .list-toolbar>label.list-status-filter {min-width:0;margin:0;width:100%}
  .list-toolbar>.list-count {grid-column:1/-1}
  .list-toolbar>button {min-height:44px;align-self:end}
  :root {--header-height:68px; --control-height:44px}
  html {scroll-padding-top:84px}
  #app>main,main#main-content {margin:0; padding:0 16px 92px; width:100%; min-width:0}
  .sidebar {position:fixed; inset:0 auto 0 0; width:min(320px,calc(100vw - 36px)); height:100dvh; transform:translateX(-110%); visibility:hidden; padding:20px 16px; transition:transform .18s ease,visibility .18s; z-index:100}
  body.nav-open .sidebar {transform:none; visibility:visible}
  body.nav-open {overflow:hidden}
  .sidebar nav {display:flex; flex-direction:column; overflow:auto; max-height:none; margin:0}
  .sidebar nav a {min-height:44px; padding:10px 12px; font-size:14px}
  .sidebar nav a span {display:inline-block}
  .sidebar-bottom {display:block}
  #menu-toggle,#menu-close {display:inline-flex; width:44px; min-width:44px; height:44px; padding:8px; flex-shrink:0; align-items:center; justify-content:center}
  #menu-close {position:absolute; top:15px; right:12px}
  .sidebar .brand {padding-right:34px; min-height:40px}
  .topbar-shell {flex-wrap:nowrap; gap:10px; margin-bottom:20px; min-height:68px; padding:10px 0; align-items:center}
  #workspace-context {gap:2px 6px; font-size:13px; display:flex; flex-wrap:wrap}
  #workspace-channel {flex-basis:100%; font-size:15px; max-width:calc(100vw - 92px)}
  #workspace-section {font-size:12px}
  #workspace-role {font-size:12px; padding:0; margin:0; border:0; background:transparent}
  #workspace-connection {display:none}
  #mode-badge {display:none}
  h1 {font-size:27px}
  .card {padding:16px; margin-bottom:16px}
  .card-title {gap:10px; flex-wrap:wrap}
  .form-grid,.setting-grid,.settings-card-grid {grid-template-columns:1fr}
  .rule {grid-template-columns:1fr; padding:16px; gap:12px}
  .rule .actions {justify-content:flex-start; max-width:none}
  .rule button,.rule summary {min-height:44px}
  .rule-more>div {left:0; right:auto}
  .form-actions,.editor-actions {bottom:8px; margin-inline:-4px; padding:10px; max-height:34dvh; overflow:auto}
  .form-actions>.form-state {flex-basis:100%}
  .section-shortcuts {overflow-x:auto; flex-wrap:nowrap; padding:8px 0; scrollbar-width:thin}
  .section-shortcuts button {white-space:nowrap; flex:0 0 auto; min-height:44px}
  .list-toolbar {align-items:stretch}
  .list-toolbar label {flex-basis:100%}
  .list-toolbar label.list-status-filter {flex:1}
  .overview-summary {grid-template-columns:1fr; gap:8px}
  [data-section=overview] .preview iframe {height:190px; min-height:150px; max-height:35vh}
  .preview .card-title {padding:12px 16px}
  .preview-foot {padding:10px 12px}
  .object-canvas iframe {height:320px; min-height:230px}
  .ensemble-viewport {max-height:55dvh}
  .ensemble-inspector {padding:14px}
  .ensemble-inspector input,.ensemble-inspector select {min-height:44px; font-size:14px}
  .workspace-tools label {max-width:100%; flex-basis:100%}
  .image-upload {flex-wrap:wrap; gap:14px}
  .image-upload>div {flex-basis:100%}
  .user-visibility-row {flex-direction:column; align-items:stretch}
  .user-visibility-row select {width:100%; min-height:44px}
  #helper-dock {right:12px; bottom:12px; width:min(370px,calc(100vw - 24px))}
  body.helper-open #helper-dock {right:12px; bottom:12px; width:calc(100vw - 24px); height:min(50dvh,440px)}
  body.helper-open #app>main {padding-bottom:calc(50dvh + 80px)}
  #helper-dock button {min-height:44px}
  #helper-tour {max-height:40dvh; overflow:auto}
  dialog.panel-dialog,#media-library-dialog {width:calc(100vw - 20px); max-height:calc(100dvh - 20px); padding:16px}
  .ui-confirm .actions>* {flex:1}
  .conflict-grid {grid-template-columns:1fr; gap:5px}
  .media-grid {grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px}
  .media-grid article {padding:8px; min-width:0}
  .media-preview img {height:100px; padding:6px}
  .media-preview {min-height:108px}
  .server-admin-main {padding:24px 16px 64px; margin:0}
  .server-admin-grid {grid-template-columns:1fr}
  .server-admin-heading {gap:12px; flex-wrap:wrap}
  .server-admin-nav {overflow-x:auto; flex-wrap:nowrap; gap:18px; padding:10px 0}
  .server-admin-nav a {white-space:nowrap; font-size:13px; min-height:44px; display:flex; align-items:center}
}
@media(prefers-reduced-motion:reduce) {*,*::before,*::after {scroll-behavior:auto!important; animation-duration:.01ms!important; animation-iteration-count:1!important; transition:none!important}}
[hidden] {display:none!important}
.sr-only {position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border:0!important}
.workspace-choices {display:grid;gap:12px;margin:20px 0}
.workspace-choice {display:flex;align-items:center;justify-content:space-between;gap:16px;padding:16px;background:var(--panel);border:1px solid var(--line);border-radius:10px;text-decoration:none;color:var(--text)}
.workspace-choice:hover {border-color:var(--accent);background:var(--surface)}
.workspace-choice small,.workspace-choice span {color:var(--muted)}
.portal-admin-link {display:block;margin-top:28px;color:var(--muted);font-size:13px}
.overview-shortcuts {display:flex;gap:8px;flex-wrap:wrap;margin:0 0 20px}
.preview-note {padding:12px 16px;font-size:12px;margin:0;line-height:1.5}
.form-conflict {background:var(--panel);border:1px solid var(--warning);border-radius:10px;padding:16px;margin:16px 0}
.conflict-comparison {overflow-x:auto;margin:12px 0}
.conflict-comparison table,.access-matrix table {width:100%;border-collapse:collapse;font-size:13px}
.conflict-comparison th,.conflict-comparison td,.access-matrix th,.access-matrix td {padding:10px 12px;text-align:left;vertical-align:top;border-bottom:1px solid var(--line);overflow-wrap:anywhere;max-width:300px}
.conflict-comparison pre {white-space:pre-wrap;word-break:break-word;font-family:inherit}
.form-conflict .actions {flex-wrap:wrap}
.helper-open #helper-tour {position:static;max-height:100%;overflow:auto;width:100%}
.helper-open #helper-dock:has(#helper-tour:not([hidden])) {height:auto;bottom:auto}
.section-shortcuts [aria-pressed=true] {background:var(--accent-soft);border-color:var(--accent);color:var(--text)}
.connection-card p {overflow-wrap:anywhere}
.log-controls {display:flex;align-items:end;gap:12px;flex-wrap:wrap;margin:8px 0 16px}
.log-controls label {flex:1;min-width:120px}
.log-controls .check {flex:0 1 auto;min-height:40px;margin-bottom:0}
.log-repeats {margin:8px 0 0}
.log-repeats div {padding:4px 0}
.rule-more:not([open])>div {display:none}
body:not(.helper-open) .form-actions {padding-right:148px}
/* The earlier editor stylesheet uses ID selectors; keep its controls on the panel scale. */
#app #ensemble-form :is(button,label,select,input,textarea,summary) {font-size:13px}
#app #ensemble-form :is(label,select,input,textarea) {font-size:14px}
#app #ensemble-form button:not(.ensemble-handle) {min-height:36px}
#app #ensemble-form .ensemble-history button {min-width:36px}
#app #ensemble-form .ensemble-workbench {grid-template-columns:minmax(0,1fr) 330px;gap:20px;align-items:start}
#app #ensemble-form .ensemble-inspector {max-height:none;height:auto;overflow:visible;position:static;padding:16px}
#app #ensemble-form .ensemble-canvas {top:90px;align-self:start}
#app #ensemble-form .ensemble-viewport {max-height:55dvh;overflow:auto}
#app #ensemble-form .ensemble-viewport #ensemble-preview {width:min(100%,max(360px,calc((100dvh - 660px)*1.77778)))}
#app #ensemble-form .ensemble-scenario-top {gap:16px}
#app #ensemble-form :is(.ensemble-zoom-label,#ensemble-mode-help,#ensemble-status) {font-size:12px}
@media(max-width:1100px) {
  #app #ensemble-form .ensemble-workbench {grid-template-columns:1fr}
  #app #ensemble-form .ensemble-canvas {position:static}
  #app #ensemble-form .ensemble-inspector {display:block}
}
@media(max-width:800px) {
  .rule-more>div {left:auto;right:0;max-width:calc(100vw - 72px)}
  #app #ensemble-form .ensemble-scenario-top {grid-template-columns:1fr}
  #app #ensemble-form .ensemble-track-list {grid-template-columns:1fr}
  #app #ensemble-form .ensemble-track-list>.actions:last-child {grid-column:1;grid-row:auto;justify-content:flex-start;flex-wrap:wrap}
  #app #ensemble-form button:not(.ensemble-handle) {min-height:44px}
  #app #ensemble-form .ensemble-viewport #ensemble-preview {width:100%}
  body:not(.helper-open) .form-actions {bottom:72px;padding-right:10px}
  #workspace-connection {display:block;font-size:12px;flex:0 1 90px;line-height:1.3;white-space:normal}
  .topbar-shell {gap:8px}
  .helper-open #helper-dock:has(#helper-tour:not([hidden])) {top:auto;bottom:12px;max-height:40dvh}
  .workspace-choice {align-items:start;flex-wrap:wrap}
  .conflict-comparison {max-width:100%}
  .list-status-filter select {width:100%}
}

/* Canvas takes the workspace until its inspector is opened. */
.object-workbench:has(#object-form[hidden]){grid-template-columns:minmax(0,1fr)}
.object-workbench .object-canvas{width:100%;max-width:none}
#media-library-tools{margin-left:auto;flex-wrap:wrap;gap:6px}
#media-library-tools .button,#media-library-tools button{font-size:.8rem;padding:8px 10px}
.range-value{display:inline-block;font-variant-numeric:tabular-nums;color:var(--muted);font-size:.85em}

/* Non-modal preview: the range control keeps pointer and keyboard focus. */
.size-live-preview{position:fixed;z-index:2000;width:min(420px,calc(100vw - 32px));max-height:calc(100vh - 32px);overflow:hidden;padding:12px;border:1px solid var(--line);border-radius:12px;background:var(--panel);color:var(--ink);box-shadow:0 12px 36px #0006;pointer-events:none;user-select:none;box-sizing:border-box}
.size-live-preview[hidden]{display:none}
.size-live-preview strong{display:block;font-size:12px;margin-bottom:8px}
.size-live-preview .size-stage{width:100%;max-height:calc(100vh - 140px)}
.size-live-preview [data-size-label]{font-size:11px;line-height:1.4;margin:8px 0 0;color:var(--muted)}
input[type=range][data-size-preview]{touch-action:pan-y}
