/* Admin workspace only. Customer and preview layouts keep their existing styling. */
#workspaceCover{display:none}
#gallery.admin-workspace{--workspace-ink:#202b3a;--workspace-muted:#5e6877;--workspace-line:#dce2e9;--workspace-paper:#fff;--workspace-soft:#f5f7fa;--workspace-accent:var(--brand-accent,#142d4e);--gallery-bg:#f8f9fb;color:var(--workspace-ink)}
#gallery.admin-workspace .gallery-content{min-width:0}
#gallery.admin-workspace #workspaceCover{display:flex;align-items:center;gap:14px;margin:0 0 18px;padding:13px 15px;border:1px solid var(--workspace-line);border-radius:10px;background:var(--workspace-soft);color:var(--workspace-ink)}
.workspace-cover-swatch{width:74px;height:46px;flex:none;display:grid;place-items:center;border-radius:6px;background:#e9eef4;color:#64748b;overflow:hidden;font-size:24px}
.workspace-cover-swatch img{display:block;width:100%;height:100%;object-fit:cover}
.workspace-cover-copy{flex:1;min-width:0;display:grid;gap:3px}
.workspace-cover-copy small{font-size:12px;color:var(--workspace-muted)}
.workspace-cover-button{min-height:42px;background:#fff;color:var(--workspace-ink);border-color:#cdd7e3;font-weight:600}
#gallery.admin-workspace :is(#coverHeader,.galleryhero,#galleryNavigation,#subgallerySection){display:none!important}
#gallery.admin-workspace #gallerySidebar h2{margin-bottom:13px;overflow-wrap:anywhere}
#gallery.admin-workspace #gallerySidebar .detail-actions{gap:7px}
#gallery.admin-workspace #gallerySidebar .detail-actions button{min-width:0;padding:9px 4px}
#gallery.admin-workspace #gallerySidebar #newSubgallery{background:transparent;color:var(--workspace-ink);border:1px dashed #c5ceda}
.workspace-download button{width:100%;color:var(--workspace-ink);background:white;border-color:#d4dde7;font-size:13px}
.workspace-download button:disabled{opacity:.55}
.workspace-navigation{margin-top:18px}
.workspace-navigation h3{margin:0 0 8px!important;font-size:14px}
.workspace-navigation nav{display:grid;gap:4px}
.workspace-folder{display:flex;align-items:center;gap:7px;width:100%;min-width:0;min-height:38px;padding:7px 8px 7px calc(8px + 9px * var(--depth,0));text-align:left;background:transparent;border-color:transparent;color:var(--workspace-ink);font-size:13px}
.workspace-folder[aria-current=page]{font-weight:700;background:var(--admin-nav-active,#e7edf5);border-color:transparent}
.workspace-folder-title{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.workspace-folder-count{font-variant-numeric:tabular-nums;flex:none;color:#4e5e70}
#gallery.admin-workspace #workflowTools{display:block;margin:0 0 12px}
.workspace-tools-main{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin-bottom:11px}
.workspace-tools-main [data-workspace-action=publication]{font-weight:650}
.workspace-tools-bulk:empty{display:none}
#gallery.admin-workspace .workspace-tools-bulk .organizer-toolbar{padding:0;border:0;background:none;margin:0}
.workspace-more{min-width:0;max-width:100%;position:relative}
.workspace-more summary{width:max-content;max-width:100%;cursor:pointer;min-height:38px;padding:8px 12px;border:1px solid #d4dde7;border-radius:6px;background:#fff;color:#142d4e;font:600 12px/1.6 Arial,sans-serif}
.workspace-menu{position:absolute;left:0;top:calc(100% + 8px);z-index:11;width:min(325px,75vw);max-height:min(57vh,530px);overflow:auto;background:#fff;border:1px solid #d7dfe9;border-radius:10px;box-shadow:0 12px 32px #142d4e20;padding:13px}
.workspace-menu-section+.workspace-menu-section{border-top:1px solid #e7ebf0;margin-top:9px;padding-top:9px}
.workspace-menu-section h3{font-size:12px;margin:0 0 5px;color:#576675}
.workspace-menu-items{display:grid;gap:4px}
#gallery.admin-workspace .workspace-menu-items :is(button,a){width:100%;display:flex;align-items:center;justify-content:flex-start;text-align:left;background:#fff;border:1px solid transparent;border-radius:6px;text-decoration:none;min-height:38px;padding:8px 10px}
#gallery.admin-workspace .workspace-menu-items :is(button,a):hover{background:#f2f5f8}
.workspace-grid-heading{display:flex;align-items:center;gap:8px;margin:17px 0 10px;padding-top:13px;border-top:1px solid var(--workspace-line);color:var(--workspace-ink)}
.workspace-grid-heading h2{margin:0;font-size:18px}
.workspace-file-count{border-radius:20px;background:#eef2f7;color:#4b5b6d;padding:2px 8px;font-size:12px}
#form.settings-dialog.workspace-settings{width:min(920px,94vw);background:#fff;color:#202b3a;border-radius:14px}
#form.workspace-settings>h2{margin:0 0 12px}
#form.workspace-settings .settings-tabs{gap:6px;margin:0 0 9px;padding:5px 0 10px!important;background:#fff}
#form.workspace-settings .settings-tabs button{border:1px solid transparent;background:#f4f6f9;color:#344257;font-weight:600}
#form.workspace-settings .settings-tabs button[aria-selected=true]{background:var(--brand-accent,#142d4e);color:var(--brand-accent-text,#fff)}
#form.workspace-settings .settings-panel-title{margin:0 0 4px}
.settings-panel-intro{margin:0 0 11px;font-size:13px;color:#5e6877}
.settings-section{display:grid;grid-template-columns:minmax(125px,1fr) minmax(0,2.35fr);gap:14px 22px;border-top:1px solid #e5e9ef;padding:15px 0}
.settings-section-heading h4{font-size:14px;margin:0 0 4px}
.settings-section-heading p{font-size:12px;color:#5e6877;margin:0}
.settings-section-controls{min-width:0;display:grid;gap:13px}
#form.workspace-settings .settings-section-controls .field{margin:0}
#form.workspace-settings .settings-section-controls .field>span{font-size:12px;font-weight:600;color:#3c4a5d}
#form.workspace-settings .header-focus-editor{background:#f6f8fa}
#form.workspace-settings #cascadeSettingsNote{font-size:12px;margin:8px 0;color:#5e6877}
.workspace-phase{display:grid;grid-template-columns:1fr 1fr;gap:5px;margin:0;padding:4px;border:0;border-radius:9px;background:#eef2f7;min-width:0}
.workspace-phase legend{margin-bottom:4px;font-size:12px;font-weight:600;color:#3c4a5d}
.workspace-phase label{position:relative;display:flex;min-height:42px;align-items:center;justify-content:center;padding:6px 8px;border-radius:6px;text-align:center;font:600 13px/1.3 Arial,sans-serif;cursor:pointer}
.workspace-phase label:has(input:checked){background:#fff;box-shadow:0 1px 4px #142d4e22}
.workspace-phase label:has(input:focus-visible){outline:2px solid #406b9b;outline-offset:2px}
.workspace-phase input{position:absolute;opacity:0;width:1px;height:1px}
@media(max-width:760px){
 #gallery.admin-workspace #workspaceCover{gap:9px;margin:0 0 14px;padding:10px}
 .workspace-cover-swatch{width:48px;height:40px}
 .workspace-cover-copy small{font-size:11px}
 .workspace-cover-button{font-size:12px;padding:7px 8px;min-height:44px}
 .workspace-menu{position:static;width:100%;max-height:none;box-shadow:none;margin-top:6px}
 .workspace-more[open]{width:100%}
 .workspace-navigation nav{max-height:230px;overflow:auto}
 .settings-section{grid-template-columns:1fr;gap:8px;padding:12px 0}
 #form.settings-dialog.workspace-settings{width:100%}
}

/* The file manager uses its own grid; customer layout settings belong in preview. */
#gallery.admin-workspace #grid{gap:clamp(10px,1.7vw,24px);align-items:start}
#gallery.admin-workspace #grid>.tile{min-width:0;padding-bottom:0}
#gallery.admin-workspace #grid>.tile .media-frame > :is(img,video){
 display:block;width:100%;height:auto;aspect-ratio:1!important;object-fit:contain;
}
#gallery.admin-workspace #grid .tile .image-actions{
 flex-wrap:nowrap;gap:3px;inset-inline:4px;bottom:5px;
}
#gallery.admin-workspace #grid .tile .media-frame:has(video) .image-actions{bottom:48px}
#gallery.admin-workspace #grid .tile .image-actions .image-action{
 position:relative;min-width:38px;width:38px;flex:none;padding:0;
}
#gallery.admin-workspace #grid .tile .image-actions .photo-select span{display:none}
#gallery.admin-workspace #grid .tile .action-count{
 position:absolute;right:2px;top:2px;font-size:9px;line-height:1;max-width:31px;overflow:hidden;
}
@media(max-width:760px){
 #gallery.admin-workspace #grid{grid-template-columns:repeat(auto-fill,minmax(min(100%,148px),1fr))}
 #gallery.admin-workspace #grid .tile .image-actions .image-action{min-width:44px;width:44px}
}
#gallery.admin-workspace #grid .tile > .workspace-photo-caption{
 display:block;min-width:0;margin:7px 0 0;padding:0 4px;text-align:center;
 color:var(--workspace-muted);font-size:13px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
#gallery.admin-workspace #grid .workspace-photo-trigger{
 position:absolute;top:9px;left:9px;z-index:3;width:38px;height:38px;padding:0;
 display:grid;place-items:center;border:1px solid #d4dde7;border-radius:9px;
 background:#fff;color:var(--workspace-ink);box-shadow:0 2px 8px #142d4e20;
}
#gallery.admin-workspace #grid .organizer-checkbox{
 display:grid;place-items:center;width:44px;height:44px;padding:0;
}
#gallery.admin-workspace #grid .organizer-checkbox input{display:block;margin:0}
#gallery.admin-workspace #grid .tile:has(.organizer-checkbox) .workspace-photo-trigger{top:60px}
#gallery.admin-workspace #grid .workspace-photo-menu{
 display:none;position:fixed;inset:auto;margin:0;
 width:min(272px,calc(100vw - 16px));height:max-content;max-height:calc(100dvh - 16px);
 box-sizing:border-box;overflow:auto;overscroll-behavior:contain;padding:6px;
 border:1px solid var(--workspace-line);border-radius:14px;background:#fff;color:var(--workspace-ink);
 box-shadow:0 14px 45px #142d4e2b;
}
#gallery.admin-workspace #grid .workspace-photo-menu:popover-open{display:grid;align-content:start;gap:2px}
#gallery.admin-workspace #grid .workspace-photo-menu button{
 display:flex;align-items:center;justify-content:flex-start;gap:10px;min-height:44px;
 border:0;border-radius:8px;padding:8px 10px;text-align:left;font:500 14px/1.3 Arial,sans-serif;
 background:transparent;color:inherit;
}
#gallery.admin-workspace #grid .workspace-photo-menu button:is(:hover,:focus-visible){background:#edf2f7}
#gallery.admin-workspace #grid .workspace-photo-menu .workspace-photo-danger{color:#a52121}
.workspace-photo-menu svg{flex:none;width:18px;height:18px}
.workspace-file-info{display:grid;grid-template-columns:max-content minmax(0,1fr);gap:8px 14px}
.workspace-file-info dd{margin:0;overflow-wrap:anywhere}
@media(max-width:760px){
 #gallery.admin-workspace #grid .workspace-photo-trigger{width:44px;height:44px}
}

#modal.settings-modal{z-index:24}

/* Keep controls keyboard reachable, but out of the way of photos until needed. */
#gallery:is(.admin-workspace,.customer-view,.preview-mode) #grid .tile .media-frame:is(.admin-workspace .media-frame,:has(>img)) > :is(.image-actions,.image-download,.workspace-photo-trigger,.image-name-overlay){opacity:0;transition:opacity .14s ease}
#gallery:is(.admin-workspace,.customer-view,.preview-mode) #grid .tile .media-frame:is(.admin-workspace .media-frame,:has(>img)) > :is(.image-download,.workspace-photo-trigger),
#gallery:is(.admin-workspace,.customer-view,.preview-mode) #grid .tile .media-frame:is(.admin-workspace .media-frame,:has(>img)) .image-actions .image-action{pointer-events:none}
#gallery:is(.admin-workspace,.customer-view,.preview-mode) #grid .tile:is(.photo-actions-open,:has(:focus-visible,.workspace-photo-menu:popover-open)) .media-frame:is(.admin-workspace .media-frame,:has(>img)) > :is(.image-actions,.image-download,.workspace-photo-trigger,.image-name-overlay){opacity:1}
#gallery:is(.admin-workspace,.customer-view,.preview-mode) #grid .tile:is(.photo-actions-open,:has(:focus-visible,.workspace-photo-menu:popover-open)) .media-frame:is(.admin-workspace .media-frame,:has(>img)) > :is(.image-download,.workspace-photo-trigger),
#gallery:is(.admin-workspace,.customer-view,.preview-mode) #grid .tile:is(.photo-actions-open,:has(:focus-visible,.workspace-photo-menu:popover-open)) .media-frame:is(.admin-workspace .media-frame,:has(>img)) .image-actions .image-action{pointer-events:auto}
@media(hover:hover) and (pointer:fine){
 #gallery:is(.admin-workspace,.customer-view,.preview-mode) #grid .tile:hover .media-frame:is(.admin-workspace .media-frame,:has(>img)) > :is(.image-actions,.image-download,.workspace-photo-trigger,.image-name-overlay){opacity:1}
 #gallery:is(.admin-workspace,.customer-view,.preview-mode) #grid .tile:hover .media-frame:is(.admin-workspace .media-frame,:has(>img)) > :is(.image-download,.workspace-photo-trigger),
 #gallery:is(.admin-workspace,.customer-view,.preview-mode) #grid .tile:hover .media-frame:is(.admin-workspace .media-frame,:has(>img)) .image-actions .image-action{pointer-events:auto}
}
@media(prefers-reduced-motion:reduce){
 #gallery:is(.admin-workspace,.customer-view,.preview-mode) #grid .tile .media-frame:is(.admin-workspace .media-frame,:has(>img)) > :is(.image-actions,.image-download,.workspace-photo-trigger,.image-name-overlay){transition:none}
}

/* Keep cover images at the top even when the neighbouring titles wrap. */
#admin .cards:not(.list) > .card{display:flex;flex-direction:column;align-items:stretch}
#admin .cards:not(.list) > .card > .cover{flex:none;width:100%}
#admin .cards:not(.list) > .card > .info{flex:1}
