/* Experimental app controls. Never target the generated .prototype or export CSS. */
body.flush-controls{--chrome-line:#d8d4cc;--chrome-hover:#f0eee8;--chrome-height:48px}
.flush-controls :is(button,select,input,textarea):not(.prototype *){border-radius:0!important;box-shadow:none}
.flush-controls button:not(.prototype *):not(.pane-resize):not(.version-delete):not(.version-duplicate):not(.meaning-name){min-height:44px}
.flush-controls :is(button,select,input,textarea):not(.prototype *):focus-visible{outline:2px solid #81729b;outline-offset:-3px;position:relative;z-index:2}
.flush-controls :is(button,select):not(.prototype *):hover{background-color:var(--chrome-hover)}
.flush-controls .pane{border-radius:0}

/* A single continuous header. Padding lives inside the targets. */
.flush-controls .topbar{gap:0;padding:0;min-height:var(--chrome-height);align-items:stretch;border-bottom:1px solid var(--chrome-line)}
.flush-controls .topbar #product-name{height:auto;min-height:var(--chrome-height);margin:0;padding:12px 16px;border:0;border-right:1px solid var(--chrome-line);background:#fff;align-self:stretch}
.flush-controls .topbar>.workspace-toolbar{gap:0;padding:0;align-items:stretch}
.flush-controls .topbar .workspace-toolbar>.view-picker{gap:0;height:auto;align-items:stretch}
.flush-controls .topbar .workspace-toolbar>.view-picker button{height:auto;min-height:var(--chrome-height);margin:0;border:0;border-right:1px solid var(--chrome-line);padding:12px 16px}
.flush-controls .view-picker button[data-pin][aria-pressed=true]{background:#282724;color:#fff;border-color:#282724;box-shadow:none}
.flush-controls .topbar>.top-actions{gap:0;padding:0;height:auto;min-height:var(--chrome-height);border:0;border-radius:0;box-shadow:none;align-items:stretch}
.flush-controls .topbar .top-actions>button{height:auto;margin:0;padding:12px;min-width:44px;border:0!important;border-left:1px solid var(--chrome-line)!important}
.flush-controls .topbar .top-actions>.toolbar-icon{height:auto;width:44px}
.flush-controls .topbar .top-actions>button:first-child{border-left:0!important}

/* Pane headings and utility bars share edge-to-edge targets. */
.flush-controls .pane-heading{padding:0;gap:0;align-items:stretch;min-height:52px}
.flush-controls .pane-heading>div{flex:1;align-content:center;padding:14px 16px}
.flush-controls .pane-heading>button{height:auto;width:auto;min-width:48px;margin:0!important;padding:12px 16px;border:0!important;border-left:1px solid var(--chrome-line)!important}
.flush-controls :is(.schema-tools,.text-tools,.reference-tools,.text-bottom){padding:0;gap:0;align-items:stretch;border-color:var(--chrome-line)}
.flush-controls :is(.schema-tools,.reference-tools,.text-bottom)>button{flex:1;align-self:stretch;margin:0;padding:12px;border:0;border-right:1px solid var(--chrome-line)}
.flush-controls :is(.schema-tools,.reference-tools,.text-bottom)>button:last-child{border-right:0}
.flush-controls .text-tools>label{flex:1;padding:12px;min-height:44px;cursor:pointer}
.flush-controls .text-tools>label:hover{background:var(--chrome-hover)}
.flush-controls :is(.text-tools,.reference-tools)>span{flex-basis:100%;margin:0;padding:8px 12px;border-top:1px solid var(--chrome-line)}
.flush-controls .schema-tools>.diagram-context{padding:0;gap:0;align-items:stretch;border-bottom:1px solid var(--chrome-line);line-height:44px;text-indent:12px}
.flush-controls .diagram-context select{flex:1;max-width:none;border:0;border-left:1px solid var(--chrome-line);text-indent:0;padding:10px}
.flush-controls .grammar{padding:0}
.flush-controls .grammar summary{padding:14px;min-height:44px}
.flush-controls .grammar p{padding:0 14px}

/* Role and device tabs form shared cells, without pill wrappers. */
.flush-controls .layout-user-tabs{padding:0;gap:0;align-items:stretch;border-color:var(--chrome-line)}
.flush-controls .layout-user-tabs>[role=tab]{flex:1 0 auto;padding:12px 16px;border:0;border-right:1px solid var(--chrome-line)}
.flush-controls .layout-user-tabs>[role=tab]:last-child{border-right:0}
.flush-controls .layout-user-tabs>[aria-selected=true]{box-shadow:inset 0 -1px #9573b4}
.flush-controls .layout-pane>.layout-tools{padding:0;gap:0;align-items:stretch;overflow:visible;border-color:var(--chrome-line)}
.flush-controls .layout-pane>.layout-tools label{position:relative;flex:1 1 auto;min-height:60px;margin:0;padding:0;border:0;border-right:1px solid var(--chrome-line);border-bottom:1px solid var(--chrome-line)}
.flush-controls .control-caption{position:absolute;top:9px;left:12px;z-index:1;font-size:10px;line-height:12px;pointer-events:none;color:#81796d}
.flush-controls .layout-pane>.layout-tools select{height:100%;min-height:60px;width:100%;margin:0;border:0;padding:26px 34px 10px 12px;font-size:12px;background-position:right 12px center}
.flush-controls .layout-pane .layout-tools>.layout-device-bar{flex:1 1 auto;align-self:stretch;align-items:stretch;justify-content:flex-start;margin:0;gap:0;padding:0;border-bottom:1px solid var(--chrome-line)}
.flush-controls #layout-devices{flex:1;gap:0;padding:0;border:0;border-radius:0;align-items:stretch;background:transparent}
.flush-controls #layout-devices button{flex:1;justify-content:center;border:0;border-right:1px solid var(--chrome-line);padding:12px;min-height:60px}

/* Craft parameters retain their labels, with the whole cell opening the select. */
.flush-controls .craft-controls{padding:0;gap:0;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));align-items:stretch}
.flush-controls .craft-controls label{position:relative;min-height:60px;padding:0;gap:0;border:0;border-right:1px solid var(--chrome-line);border-bottom:1px solid var(--chrome-line)}
.flush-controls .craft-controls select{height:100%;min-height:60px;width:100%;padding:26px 34px 10px 12px;border:0;grid-row:1/-1}
.flush-controls .craft-controls label.color{margin:0;padding:10px 12px;border-radius:0;gap:8px;cursor:pointer}
.flush-controls .craft-controls label.color input{flex:1;height:38px;max-width:65px;padding:0}

/* Project tiles use the full rail width; secondary targets remain distinct. */
.flush-controls .version-rail{padding:0;gap:0}
.flush-controls .version-rail-label{padding:12px 0;width:100%;text-align:center;border-bottom:1px solid var(--chrome-line)}
.flush-controls #version-list{width:100%;gap:0}
.flush-controls .version-entry{width:100%;height:56px}
.flush-controls .version-rail .version-tile{width:100%;height:56px;aspect-ratio:auto;border:0;border-bottom:1px solid var(--chrome-line)}
.flush-controls .version-rail #add-version{border-style:solid}
.flush-controls .version-rail :is(.version-delete,.version-duplicate){right:0;width:26px;height:28px;border:0;border-left:1px solid var(--chrome-line);border-bottom:1px solid var(--chrome-line)}
.flush-controls .version-rail .version-delete{top:0}
.flush-controls .version-rail .version-duplicate{bottom:0}

/* Inline schema controls stay in natural-language order. */
.flush-controls .meaning-object{border-radius:0}
.flush-controls .meaning-object :is(.axiom-chip,.meaning-link){border-radius:0}
.flush-controls .meaning-object :is(.axiom-phrase,.meaning-clause,.meaning-relationship){gap:0}
.flush-controls .meaning-object .meaning-sentence{gap:0}
.flush-controls .meaning-object :is(.meaning-name,.capability-target){min-height:40px}
.flush-controls .meaning-object .meaning-name{display:inline-flex;align-items:stretch}
.flush-controls .meaning-name .axiom-chip{display:flex;align-items:center;padding:8px 10px}
.flush-controls .meaning-object .capability-target{padding-top:8px;padding-bottom:8px}
.flush-controls .meaning-sentence>span:not(.axiom-chip),.flush-controls .meaning-relationship>span:not(.axiom-chip){padding:0}

/* Dialog actions and inspector rows are continuous control surfaces. */
.flush-controls>dialog{border-radius:0}
.flush-controls>dialog .dialog-head{padding:0;gap:0;align-items:stretch;min-height:52px}
.flush-controls>dialog .dialog-head h2{flex:1;margin:0;padding:16px 18px;align-content:center}
.flush-controls>dialog .dialog-head button{width:52px;height:auto;margin:0;border:0;border-left:1px solid var(--chrome-line);padding:12px}
.flush-controls>dialog footer{display:flex;gap:0;padding:0}
.flush-controls>dialog footer>button{flex:1;margin:0!important;border:0;border-left:1px solid var(--chrome-line);padding:14px}
.flush-controls>dialog :is(.export-actions,.ds-actions){display:flex;gap:0;padding:0;align-items:stretch}
.flush-controls>dialog :is(.export-actions,.ds-actions)>button{flex:1;margin:0;border:1px solid var(--chrome-line);padding:12px}
.flush-controls>dialog :is(.export-actions,.ds-actions)>button+button{border-left:0}
.flush-controls #inspector-dialog .inspector{padding:0}
.flush-controls #inspector-dialog .inspector-title{gap:0;margin:0}
.flush-controls #inspector-dialog .inspector-title input{min-height:48px;margin:0;border:0;border-bottom:1px solid var(--chrome-line);padding:12px}
.flush-controls #inspector-dialog .inspector-title>div{display:flex;flex:1;gap:0}
.flush-controls #inspector-dialog .inspector-title button{flex:1;border:0;border-right:1px solid var(--chrome-line);border-bottom:1px solid var(--chrome-line)}
.flush-controls #inspector-dialog .inspector :is(h4,h5){padding:14px 12px;margin:0;border-bottom:1px solid var(--chrome-line)}
.flush-controls #inspector-dialog .field-row{gap:0;margin:0;border-bottom:1px solid var(--chrome-line);align-items:stretch}
.flush-controls #inspector-dialog .field-row>:is(input,select,button){min-height:44px;border:0;border-right:1px solid var(--chrome-line);margin:0;padding:10px 12px}
.flush-controls #inspector-dialog .operation-grid{gap:0}
.flush-controls #inspector-dialog .operation-grid label{min-height:48px;border-radius:0;border:0;border-right:1px solid #bedbc9;border-bottom:1px solid #bedbc9;margin:0;padding:12px}
.flush-controls #inspector-dialog .operation-grid label:has(input:checked){background:#d6ebdd}
.flush-controls #inspector-dialog .operation-field{gap:0;margin:0;min-height:44px;padding-left:12px;border-bottom:1px solid var(--chrome-line);align-items:stretch}
.flush-controls #inspector-dialog .operation-field select{flex:1;border:0;border-left:1px solid var(--chrome-line)}
.flush-controls #inspector-dialog .relation-row{gap:0;margin:0;padding:0;border:0;border-bottom:1px solid var(--chrome-line);border-radius:0;align-items:stretch}
.flush-controls #inspector-dialog .relation-row>span{padding:12px;border-bottom:1px solid var(--chrome-line)}
.flush-controls #inspector-dialog .relation-row>:is(select,button){border:0;border-right:1px solid var(--chrome-line);margin:0;min-height:44px}
.flush-controls #inspector-dialog .connect-form{gap:0;align-items:stretch}
.flush-controls #inspector-dialog .connect-form>:is(select,button){border:0;border-right:1px solid var(--chrome-line);border-bottom:1px solid var(--chrome-line);min-height:44px;margin:0}
.flush-controls #inspector-dialog .connect-form button{flex:1}
.flush-controls #design-dialog .ds-tokens{gap:0}
.flush-controls #design-dialog .ds-tokens label{gap:0;margin:0;padding:10px;border:1px solid var(--chrome-line)}
.flush-controls #design-dialog .ds-tokens select{width:100%;min-height:44px}
.flush-controls #ds-generate,.flush-controls #ds-apply{width:100%;min-height:44px}
@media(max-width:1120px){
 .flush-controls .topbar{gap:0}
 .flush-controls .topbar>.workspace-toolbar{border-top:1px solid var(--chrome-line)}
}
@media(max-width:650px){
 .flush-controls .topbar{padding:0;gap:0}
 .flush-controls .topbar>.top-actions{flex:1 1 100%;border-top:1px solid var(--chrome-line)}
 .flush-controls .topbar .top-actions>button{flex:1}
 .flush-controls .topbar .workspace-toolbar>.view-picker{flex-wrap:nowrap;gap:0}
}

/* Schema phrases consume the available line before wrapping. */
.flush-controls .meaning-object{display:flex;flex-wrap:wrap;align-items:center;gap:0}
.flush-controls .meaning-object>.axiom-phrase,
.flush-controls .meaning-object>.meaning-sentence,
.flush-controls .meaning-object>.meaning-clause,
.flush-controls .meaning-object>.meaning-edge:not(.meaning-nested),
.flush-controls .meaning-object>.meaning-edge:not(.meaning-nested)>.meaning-relationship{display:contents}
.flush-controls .meaning-object>.meaning-edge.meaning-nested{flex:0 0 calc(100% - 8px);box-sizing:border-box}
.flush-controls .meaning-object>.meaning-clause>span:first-child{padding:0 6px;min-width:0}
.flush-controls .meaning-field-type{padding:0 6px}
/* Full-height draggable column boundaries. */
.flush-controls .workspace .pane-resize-edge{position:absolute;inset:0 0 0 auto;width:8px;height:100%;min-height:0;margin:0;z-index:14;cursor:col-resize;background:transparent!important;border-radius:0!important;opacity:1}
.flush-controls .workspace .pane-resize-edge[data-side=left]{left:0;right:auto}
.flush-controls .workspace .pane-resize-edge:hover,
.flush-controls .workspace .pane-resize-edge:focus-visible{background:#8d887b33!important}
.flush-controls .workspace .pane-resize-edge[hidden]{display:none}
.resizing-pane-width,.resizing-pane-width *{cursor:col-resize!important}

/* One six-pixel gutter for schema cards, tokens, and nested boundaries. */
.flush-controls #normalized-output{display:grid;gap:6px}
.flush-controls .meaning-scroll{padding:6px}
.flush-controls .meaning-object{padding:6px;margin:0;gap:6px;border:1px solid var(--schema-stroke);box-shadow:none;overflow:hidden}
.flush-controls .meaning-object>.meaning-edge.meaning-nested{display:flex;flex-wrap:wrap;align-items:center;gap:6px;flex-basis:100%;margin:0;padding:0;border:0}
.flush-controls .meaning-edge.meaning-nested>.meaning-object{flex-basis:100%}
.flush-controls .meaning-edge.meaning-nested>.meaning-relationship{display:contents}
.flush-controls .meaning-edge>.meaning-object{margin:0}
.flush-controls .meaning-object .meaning-name{height:40px;min-height:40px;width:fit-content;max-width:100%;margin:0;overflow:hidden;background:transparent!important;box-shadow:none!important}
.flush-controls .meaning-object .axiom-chip,
.flush-controls .meaning-object .meaning-name .axiom-chip,
.flush-controls .meaning-object .capability-target{display:inline-flex;align-items:center;box-sizing:border-box;min-height:40px;height:40px;margin:0;padding:8px 10px;font-size:13px;line-height:22px;border-width:1px}
.flush-controls .meaning-object .capability-target{display:inline-block;padding-right:32px}
.flush-controls .meaning-object .meaning-name .axiom-chip{height:100%;min-height:0;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.flush-controls .meaning-object .meaning-name:hover .axiom-chip{filter:brightness(.95)}
.flush-controls .meaning-object .meaning-name:focus-visible{outline-offset:-2px}
.flush-controls .meaning-object .meaning-field-type{font-size:13px;line-height:22px}

.flush-controls .workspace .pane-resize-edge:focus-visible{position:absolute;z-index:14}

.flush-controls .meaning-object .meaning-edge{border:0!important}

/* High-level schema: rounded tokens within lightly nested object cards. */
.flush-controls .meaning-object,
.flush-controls .meaning-legend .axiom-chip,
.flush-controls .meaning-object :is(.axiom-chip,.meaning-name,.capability-target,.meaning-link){border-radius:4px!important}
.flush-controls #workspace{padding-top:20px}
@media(max-width:650px){.flush-controls #workspace{padding-top:10px}}

/* Expand corners separate by four pixels on each axis. */
.flush-controls .pane-heading>.expand{display:flex;align-items:center;justify-content:center;overflow:hidden}
.flush-controls .pane-heading>.expand:is(:hover,:focus-visible){background:#282724!important;color:#fff!important}
.flush-controls .expand-icon{flex:none;pointer-events:none}
.flush-controls .expand-icon path{transition:transform 180ms ease-out}
.flush-controls .expand:is(:hover,:focus-visible) .expand-corner-ne{transform:translate(2px,-2px)}
.flush-controls .expand:is(:hover,:focus-visible) .expand-corner-sw{transform:translate(-2px,2px)}
@media(prefers-reduced-motion:reduce){.flush-controls .expand-icon path{transition:none;transform:none!important}}

/* Keep the object being edited white, with warm context around it. */
body.flush-controls:has(#inspector-dialog[open]) .meaning-scroll:has(.meaning-object.selected),
body.flush-controls:has(#inspector-dialog[open]) .meaning-object:has(.meaning-object.selected){background:#f0eee8}
body.flush-controls:has(#inspector-dialog[open]) .meaning-object.selected{background:#fff;color:#303342;border-color:#b7ad9d;box-shadow:none}

/* Stable label cells and comfortable, aligned field selectors. */
.flush-controls #inspector-dialog .operation-field{display:grid;grid-template-columns:88px minmax(0,1fr);padding:0;gap:0;align-items:stretch;min-width:0}
.flush-controls #inspector-dialog .operation-field>span{display:flex;align-items:center;padding:12px;white-space:nowrap;line-height:20px}
.flush-controls #inspector-dialog .operation-field>select{width:100%;min-width:0;min-height:44px;margin:0;padding:12px 36px 12px 14px;line-height:20px;appearance:none;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='m2 4 4 4 4-4' fill='none' stroke='%236b665e' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 12px center;background-size:12px 12px}

/* Flush parameter cells: borders belong to the cell, not its native select. */
.flush-controls .layout-pane>.layout-tools label{display:grid;align-items:stretch;border-radius:0;overflow:hidden}
.flush-controls .layout-pane>.layout-tools select{height:auto;align-self:stretch;border-radius:0!important;line-height:20px;background-position:right 12px top calc(50% + 8px)}
.flush-controls .craft-controls label:not(.color){display:grid;align-items:stretch;border-radius:0;overflow:hidden}
.flush-controls .craft-controls select{height:auto;line-height:20px;background-position:right 12px top calc(50% + 8px)}
.flush-controls .layout-pane .layout-tools>.layout-device-bar{border-right:1px solid var(--chrome-line)}
.flush-controls #layout-devices button:last-child{border-right:0}
.flush-controls .version-rail-label{display:flex;align-items:center;justify-content:center;flex:0 0 var(--app-header-height,48px);height:var(--app-header-height,48px);padding:0}

/* Use the viewport below the actual header; scroll content within each pane. */
.flush-controls #workspace{height:var(--workspace-height,calc(100dvh - var(--app-header-height,48px)));min-height:0;padding-bottom:20px}
.flush-controls #workspace:not([data-arrangement=grid])>.pane{height:100%;min-height:0}
.flush-controls #workspace .text-workbench{height:auto;min-height:0;flex:1}
.flush-controls #workspace :is(.meaning-scroll,.preview-host,#graph-scroll){min-height:0}
.flush-controls #workspace .pane-heading,.flush-controls #workspace .text-tools,.flush-controls #workspace .schema-tools,.flush-controls #workspace .layout-tools,.flush-controls #workspace .layout-user-tabs{flex-shrink:0}
.flush-controls #workspace .grammar{max-height:35dvh;overflow:auto}
@media(max-width:650px){
 .flush-controls #workspace{height:auto;min-height:var(--workspace-height);padding-bottom:10px}
 .flush-controls #workspace:not([data-arrangement=grid])>.pane{height:max(480px,var(--workspace-height));min-height:0}
}

.flush-controls .axiom-pending{display:flex;flex-wrap:wrap;align-items:center;gap:8px;padding:10px;line-height:1.5}
.flush-controls .axiom-pending button{padding:8px 12px;min-height:36px}

/* A quiet preview stage with an invisible, full-height resize edge. */
#layout-preview.device-preview{background:#282724}
#layout-preview .device-frame{max-width:100%}
#layout-preview .device-resize{left:auto;right:-5px;top:0;bottom:0;width:10px;min-width:0;padding:0;border:0;background:transparent!important;color:transparent;box-shadow:none;cursor:ew-resize;z-index:3}
#layout-preview .device-resize:focus-visible{position:absolute;outline:2px solid #a99dc1;outline-offset:-3px}
