/* A stable browsing surface: media first, source and ownership second. */
#view-assets .asset-library-layout { display:block; }
#view-assets > #assetLibraryCategories { width:min(1180px,100%); margin-inline:auto; }
#view-assets .asset-library-categories { position:static; display:flex; width:100%; gap:6px; padding:5px; margin:20px 0 16px; border:1px solid var(--studio-line); border-radius:12px; background:var(--studio-surface); }
#view-assets .asset-library-categories button { display:flex; align-items:center; justify-content:center; gap:9px; flex:0 1 150px; min-height:44px; padding:8px 18px; font-size:14px; border:0; border-radius:9px; background:transparent; }
#view-assets .asset-library-categories button b { font-size:11px; opacity:.65; font-weight:500; }
#view-assets .asset-library-categories button.active { color:var(--studio-accent); background:color-mix(in srgb,var(--studio-accent) 12%,transparent); }
/* The old toolbar backdrop-filter created a stacking context below the sticky
   selection bar. Raise the whole toolbar only while its filter is open. */
#view-assets .asset-library-toolbar { position:relative; z-index:auto; backdrop-filter:none; -webkit-backdrop-filter:none; display:flex; align-items:center; flex-wrap:wrap; gap:10px; overflow:visible; }
#view-assets .asset-library-toolbar:has(.asset-library-filter-more[open]) { z-index:13; }
/* Thumbnail drag handles and checkboxes are local to the result grid; they
   must not compete with filters or the sticky selection summary. */
#view-assets .asset-library-grid { position:relative; z-index:0; isolation:isolate; }
#view-assets .asset-library-toolbar .search { flex:1 1 240px; max-width:none; }
#view-assets .asset-library-toolbar > select { flex:0 1 150px; }
#view-assets .asset-library-filter-more { position:relative; }
#view-assets .asset-library-filter-more > div { position:absolute; right:0; top:calc(100% + 8px); z-index:1; box-sizing:border-box; width:min(420px,calc(100vw - 40px)); padding:18px; display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:14px; background:var(--studio-surface); border:1px solid var(--studio-line); border-radius:14px; box-shadow:var(--studio-pop-shadow,var(--studio-shadow)); }
#view-assets .asset-library-filter-more:not([open]) > div { display:none; }
#view-assets .asset-library-filter-more label { display:grid; min-width:0; gap:7px; color:var(--studio-sub); font-size:12px; }
#view-assets .asset-library-filter-more select { width:100%; min-width:0; }
#view-assets .asset-library-saved-views { grid-column:1/-1; }
#view-assets .asset-library-status-slot { position:sticky; top:0; z-index:12; height:72px; margin:0 0 12px; background:var(--studio-bg); }
#view-assets .asset-library-result-head { margin:0; height:100%; display:flex; align-items:center; }
#view-assets .asset-library-selection-bar { position:absolute; inset:0; margin:0; height:100%; box-sizing:border-box; padding:10px 14px; border-radius:12px; display:flex; align-items:center; justify-content:space-between; gap:10px; background:var(--studio-surface); border:1px solid color-mix(in srgb,var(--studio-accent) 45%,var(--studio-line)); }
#view-assets .asset-library-selection-bar > div:last-child { display:flex; gap:8px; flex-wrap:wrap; }
#view-assets .asset-library-selection-summary { min-width:0; }
#view-assets .asset-library-selection-summary span { max-width:340px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
#view-assets [hidden], .asset-picker-shell [hidden], .asset-editor [hidden], .asset-detail [hidden] { display:none!important; }
.asset-picker-toolbar { display:flex!important; flex-wrap:wrap; }
.asset-picker-toolbar > input { flex:1 1 240px; }
.asset-picker-toolbar > select { flex:0 1 145px; min-width:120px; }
.asset-picker-toolbar > button { flex:0 0 auto; }
.asset-picker-source-tabs button:disabled { opacity:.35; cursor:not-allowed; }
.asset-picker-grid { overflow-anchor:none; }
.asset-picker-card-actions { height:32px!important; min-height:32px!important; box-sizing:border-box; }
.asset-picker-card-actions select { min-width:0; height:30px; max-width:calc(100% - 54px); }
.asset-picker-card-actions .asset-picker-usage-label { min-height:30px; line-height:30px; }
.asset-detail-summary dl { display:grid; gap:12px; }
.asset-detail-summary dl > div { display:grid; grid-template-columns:64px minmax(0,1fr); align-items:baseline; }
.asset-detail-summary dd { margin:0; overflow-wrap:anywhere; }
.asset-detail-unified-editor > summary { padding:18px!important; }
.asset-editor-section { border:1px solid var(--studio-line); border-radius:12px; padding:20px; margin:0 0 14px; display:grid; gap:16px; }
.asset-editor-section h3 { margin:0; font-size:15px; }
.asset-editor-section > summary { font-weight:600; cursor:pointer; padding:2px 0; }
.asset-editor-section:not([open]) > summary { margin:0; }
details.asset-editor-section:not([open]) > :not(summary) { display:none; }
.asset-editor-section > label { margin:0; }
.asset-editor-section .asset-editor-grid { margin:0; }
.asset-editor-section .asset-visibility-editor { border:0; padding:0; background:transparent; }
.asset-editor-section .asset-visibility-explain { display:none; }
.asset-editor-section .asset-quick-tags { margin-top:0; }
.asset-editor-section .asset-editor-media-field select { max-width:260px; }
.asset-detail-voice-editor { margin-top:16px; padding:20px; border:1px solid var(--studio-line); border-radius:12px; }
.asset-detail:has(#assetDetailUnifiedEditor[open]) .asset-detail-footer-actions { display:none!important; }
html body.reference-ui-shell[data-studio-ui] #view-assets .asset-library-card.selected .asset-library-select-indicator { color:white!important; background:var(--studio-primary)!important; border-color:var(--studio-accent)!important; font-size:13px!important; padding:0!important; }
@media(max-width:700px) {
 #view-assets .asset-library-categories button { flex:1; padding:8px; }
 #view-assets .asset-library-status-slot { height:116px; }
 #view-assets .asset-library-selection-bar { align-items:flex-start; flex-direction:column; justify-content:center; }
 #view-assets .asset-library-selection-bar button { padding:7px 10px; min-height:36px; font-size:12px; }
 #view-assets .asset-library-selection-summary span { max-width:calc(100vw - 70px); }
 /* On narrow screens, expand in the toolbar instead of hanging a wide menu
    over the results. The existing view scrolls all fields into reach. */
 #view-assets .asset-library-filter-more { grid-column:1/-1; flex-basis:100%; }
 #view-assets .asset-library-filter-more > div { position:static; width:100%; min-width:0; margin-top:10px; padding:14px; gap:12px; box-shadow:none!important; }
 #view-assets .asset-library-filter-more .asset-library-saved-views { display:flex; gap:6px; min-width:0; }
 #view-assets .asset-library-saved-views select { flex:1; min-width:0; width:0; }
 .asset-editor-section { padding:14px; }
 .asset-picker-toolbar > input { flex-basis:100%; }
 .asset-picker-toolbar > select { flex:1 1 110px; }
}
@media(prefers-reduced-motion:reduce) { .asset-picker-card,.asset-library-card { transition:none!important; } }
html body.reference-ui-shell[data-studio-ui] .prompt-wrap:has(.prompt-enhancement-actions:not([hidden])) textarea { padding-bottom:44px!important; }
html body.reference-ui-shell[data-studio-ui] .prompt-enhancement-actions { position:absolute; right:12px; bottom:12px; display:flex; align-items:center; gap:7px; z-index:3; }
html body.reference-ui-shell[data-studio-ui] .prompt-enhancement-actions[hidden],html body.reference-ui-shell[data-studio-ui] .prompt-enhancement-actions [hidden] { display:none!important; }
html body.reference-ui-shell[data-studio-ui] .prompt-enhancement-actions button { display:inline-flex; align-items:center; justify-content:center; gap:5px; height:30px; padding:0 10px; font-size:12px; border:1px solid var(--studio-line); border-radius:8px; background:var(--studio-surface); color:var(--studio-sub); }
html body.reference-ui-shell[data-studio-ui] .prompt-enhancement-actions button:disabled { opacity:.5; cursor:default; }
html body.reference-ui-shell[data-studio-ui] .prompt-enhancement-actions button:hover:not(:disabled) { color:var(--studio-accent); border-color:var(--studio-accent); }
html body.reference-ui-shell[data-studio-ui] #promptEditorField .smart-btn { display:none!important; }
