/* Scoped Sketchbook refinement. Existing canvas and artwork styles stay owned
   by the engine; these rules arrange the original controls. */
.sk-redesign .sk-app-layout{grid-template-rows:auto minmax(0,1fr)}
.sk-redesign :is(button,summary,label){-webkit-tap-highlight-color:#304f401a}
.sk-redesign .sk-app-layout .dc-shell-header{display:flex;flex-wrap:wrap;height:auto;min-height:64px;padding:6px 12px;gap:8px 16px}
.sk-redesign .sk-app-layout .dc-shell-header .toolbar{height:auto;min-height:44px;gap:12px;flex:1 1 780px;flex-wrap:wrap;padding:0;border:0}
.sk-redesign .sk-app-layout .dc-shell-header .sk-tool-group{gap:4px;padding:0;border:0}
.sk-redesign .sk-app-layout .dc-shell-header .sk-primary-tools{gap:8px}
.sk-redesign .sk-app-layout .dc-shell-header .sk-repeat-tools{border-left:1px solid var(--sk-line);padding-left:12px;gap:8px}
.sk-redesign .sk-app-layout .dc-shell-header .sk-navigation-tools,.sk-redesign .sk-app-layout .dc-shell-header .sk-history-tools{border-left:1px solid var(--sk-line);padding-left:8px}
.sk-redesign .sk-app-layout .dc-header-actions{margin:0}
.sk-redesign .sk-app-layout .dc-header-actions #sk-file-trigger{border:1px solid var(--sk-line);border-radius:6px;padding:0 12px;gap:8px}
.sk-redesign #sk-file-trigger::after{content:'⌄';margin-left:8px}
.sk-redesign .sk-app-layout .dc-shell-header #sk-file-trigger>span,.sk-redesign .sk-app-layout .dc-shell-header #sk-view-trigger>span,.sk-redesign .sk-app-layout .dc-shell-header .sk-visible-label{position:static;width:auto;height:auto;clip:auto;margin:0;overflow:visible;font-size:13px;white-space:nowrap}
.sk-redesign .sk-app-layout .dc-shell-header .toolbar :is(#sk-repeat-trigger,#sk-view-trigger,#drawer-toggle){width:auto;padding-inline:10px;gap:8px;border:1px solid var(--sk-line);border-radius:6px}
.sk-redesign #sk-view-trigger::after{content:'⌄'}
.sk-redesign .sk-app-layout .dc-shell-header #drawer-toggle{margin-left:auto;background:#e1e7da}
.sk-redesign .sk-app-layout .dc-shell-header #sk-symmetry-toggle[aria-pressed=true]{background:#dce5d5;box-shadow:inset 0 -2px #a78243}
.sk-redesign .sk-mode-segments{display:flex;border:1px solid var(--sk-line);border-radius:6px;padding:2px;gap:2px}
.sk-redesign .sk-app-layout .dc-shell-header .sk-mode-segments button{width:auto;min-width:60px;padding-inline:10px;border-radius:4px;font-size:13px}
.sk-redesign .sk-mode-segments button[aria-pressed=true]{background:var(--sk-green);color:white}
.sk-redesign .working-mode-label[hidden]{display:none!important}
.sk-redesign #sk-file-menu{width:300px}
.sk-redesign .sk-file-submenu{border-top:1px solid var(--sk-line);padding-top:4px;margin-top:4px}
.sk-redesign .sk-file-submenu>summary{display:flex;align-items:center;gap:10px;padding:8px 10px;min-height:44px;box-sizing:border-box;cursor:pointer;list-style:none}
.sk-redesign .sk-file-submenu>summary::-webkit-details-marker{display:none}
.sk-redesign .sk-chevron{margin-left:auto}
.sk-redesign .sk-file-submenu[open]>summary>.sk-chevron{transform:rotate(180deg)}
.sk-redesign .sk-file-submenu>button{display:flex;gap:10px;align-items:center;min-height:44px;width:100%;padding:8px 12px;border:0;background:transparent;color:inherit;text-align:left;font:inherit}
.sk-redesign .sk-file-submenu>button:hover,.sk-redesign .sk-file-submenu>summary:hover{background:#eee7d9}
.sk-redesign .sk-menu-content #save{background:transparent;color:inherit}
.sk-redesign #sk-view-menu #fit .control-label{position:static;width:auto;height:auto;clip:auto;margin:0}
.sk-redesign #sk-view-menu #fit .control-icon{display:block}
.sk-redesign .sk-repeat-menu{width:306px}
.sk-redesign .sk-repeat-menu #panel-repeat{display:block;padding:8px 12px}
.sk-redesign .sk-repeat-menu label{display:flex;flex-direction:column;gap:5px;font:12px/1.5 system-ui,sans-serif;margin:8px 0}
.sk-redesign .sk-repeat-menu [hidden]{display:none!important}
.sk-redesign .sk-repeat-menu :is(input[type=number],select){min-height:44px;width:100%;max-width:100%;box-sizing:border-box;background:#fffdf7;border:1px solid var(--sk-line);border-radius:4px;padding:8px;color:inherit}
.sk-redesign .sk-repeat-menu .check{flex-direction:row;align-items:center;min-height:44px}
.sk-redesign .sk-repeat-menu .dimensions{display:flex;gap:10px}
.sk-redesign .sk-repeat-menu .dimensions label{flex:1;min-width:0}
.sk-redesign .sk-repeat-choices{display:flex;flex-direction:column;gap:2px}
.sk-redesign .sk-repeat-choice{min-height:44px;display:flex;align-items:center;gap:12px;border:0;border-radius:4px;padding:8px;background:transparent;color:inherit;text-align:left;font:13px system-ui,sans-serif}
.sk-redesign .sk-repeat-choice .sk-icon{width:22px;height:22px}
.sk-redesign .sk-repeat-choice[aria-pressed=true]{background:#dfe6d8}
.sk-redesign .sk-repeat-check{margin-left:auto;visibility:hidden}
.sk-redesign .sk-repeat-choice[aria-pressed=true] .sk-repeat-check{visibility:visible}
.sk-redesign .sk-repeat-section{border-top:1px solid var(--sk-line);margin-top:8px;padding-top:12px}
.sk-redesign .sk-repeat-section>strong{font:12px system-ui,sans-serif;color:var(--sk-muted)}
.sk-redesign .sk-repeat-section #resize{min-height:44px;width:100%}
.sk-redesign .sk-repeat-menu .small{font:11px/1.5 system-ui,sans-serif;color:var(--sk-muted)}
/* Shared frame docks the same inspector on desktop and rehomes it on iPad. */
.sk-redesign .dc-shell[data-layout=desktop] #control-drawer{width:300px;flex:0 0 300px;border-left:1px solid var(--sk-line);background:var(--sk-paper);overflow:auto}
.sk-redesign .dc-shell[data-layout=desktop] #control-drawer>[data-section]{display:none}
.sk-redesign .dc-shell[data-layout=desktop] #control-drawer>.current-panel{display:block}
.sk-redesign .dc-shell[data-layout=desktop] #control-drawer #panel-files.current-panel{display:block}
.sk-redesign .dc-shell[data-layout=desktop] .drawer-navigation [role=tablist]{display:none}
.sk-redesign .drawer-navigation .sk-floating-title{flex:1;font:17px Georgia,serif;padding-left:10px}
.sk-redesign #control-drawer .drawer-navigation{display:flex;align-items:center;flex-direction:row;min-height:48px;padding:0 6px}
.sk-redesign .dc-inspector-dialog{height:auto;max-height:calc(100dvh - 84px);width:min(320px,calc(100vw - 16px));inset:72px 8px auto auto}
.sk-redesign .dc-inspector-dialog #control-drawer{height:auto;max-height:inherit}
.sk-redesign .dc-inspector-dialog #control-drawer>.current-panel{max-height:calc(100dvh - 140px);overflow:auto}
.sk-redesign #layers{max-height:none!important;overflow:visible!important;padding:0}
.sk-redesign #layers .layer{position:relative;padding:3px;margin:0 0 4px;border:1px solid transparent;box-shadow:none;background:transparent}
.sk-redesign #layers .layer.selected{border-color:#b6c3ab;background:#eef0e7}
.sk-redesign #layers .layer.active{box-shadow:inset 3px 0 var(--sk-green);background:#e3eadb}
.sk-redesign:not(:has(.arrange-mode)) #layers .layer.selected:not(.active){background:transparent;border-color:transparent}
.sk-redesign #layers .layer-head{display:flex;gap:4px;align-items:center;min-height:48px}
.sk-redesign #layers .layer-name{flex:1;min-width:0;text-align:left;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.sk-redesign #layers .layer-toggle:first-child{display:none}
.sk-redesign .arrange-mode #layers .layer-toggle:first-child,.sk-redesign:has(.arrange-mode) #layers .layer-toggle:first-child{display:flex}
.sk-redesign #layers .layer-toggle{font-size:0;min-width:36px;min-height:44px;padding:0;justify-content:center}
.sk-redesign #layers .layer-thumbnail{width:44px;height:44px;min-width:44px}
.sk-redesign #layers .sk-layer-menu{position:static;flex:none}
.sk-redesign #layers .sk-layer-menu>summary{display:flex;align-items:center;justify-content:center;width:44px;height:44px;cursor:pointer;list-style:none;color:var(--sk-green);font-size:14px}
.sk-redesign #layers .sk-layer-menu>summary::-webkit-details-marker{display:none}
.sk-redesign #layers .sk-layer-menu:not([open]) .layer-controls{display:none}
.sk-redesign #layers .sk-layer-menu[open] .layer-controls{position:fixed;z-index:30;display:flex;flex-direction:column;gap:2px;width:200px;box-sizing:border-box;overflow-y:auto;padding:5px;margin:0;border:1px solid var(--sk-line);border-radius:6px;background:var(--sk-paper);box-shadow:0 6px 20px #283d3226}
.sk-redesign #layers .layer-controls button{flex:none;display:flex;align-items:center;justify-content:flex-start;gap:10px;min-width:44px;min-height:44px;width:100%;font-size:13px}
.sk-redesign #layers .layer-controls .sk-action-label{display:inline;position:static;width:auto;height:auto;clip:auto;overflow:visible}
.sk-redesign .dc-shell[data-layout=desktop] .dc-menu{display:none}
.sk-redesign .sk-app-layout .dc-identity>span{display:block;font-size:16px}
@media(max-width:1400px){.sk-redesign .sk-app-layout .dc-identity>span{display:none}.sk-redesign .sk-app-layout .dc-shell-header{gap:6px 10px}.sk-redesign .sk-app-layout .dc-shell-header .toolbar{gap:8px;flex-basis:740px}}
@media(max-width:1100px){.sk-redesign .sk-app-layout .dc-shell-header .toolbar{flex-basis:100%;gap:8px}.sk-redesign .sk-app-layout .dc-identity>span{display:block}.sk-redesign .sk-app-layout .dc-header-actions{margin-left:auto}.sk-redesign .sk-app-layout .dc-shell-header{padding:4px 8px}.sk-redesign .sk-app-layout .dc-shell-header .sk-primary-tools{gap:4px}}
@media(max-width:700px){.sk-redesign .sk-app-layout .dc-shell-header .toolbar{gap:6px;flex-wrap:wrap}.sk-redesign .sk-app-layout .dc-shell-header .sk-primary-tools{flex-wrap:wrap}.sk-redesign .sk-app-layout .dc-shell-header .sk-repeat-tools{padding-left:0;border:0}.sk-redesign .sk-app-layout .dc-shell-header #drawer-toggle .sk-visible-label{display:none}}
/* Native top-layer popovers escape the inspector's scroll clipping, including
   inside the compact modal dialog; the inspector remains modal on touch. */
.sk-redesign #layers .layer-controls[popover]{inset:auto;margin:0}
.sk-redesign #sk-layer-help{position:fixed;inset:auto;margin:0;box-sizing:border-box;width:min(300px,calc(100vw - 16px));max-height:min(360px,calc(100dvh - 16px));padding:10px 14px;border:1px solid var(--sk-line);border-radius:6px;background:var(--sk-paper);color:var(--sk-green);box-shadow:0 6px 20px #283d3226;overflow:auto;z-index:40}
.sk-redesign .drawer-navigation .sk-floating-title{flex:0 1 auto}
.sk-redesign #control-drawer .drawer-navigation #drawer-close{margin-left:auto}
.sk-redesign #add{font-size:13px;white-space:nowrap;padding-inline:8px}
.sk-redesign .sk-direct-size{display:grid;grid-template-columns:1fr auto;align-items:center;gap:4px 10px;margin:8px 0;font-size:13px}
.sk-redesign .sk-direct-size input{grid-row:2;grid-column:1 / -1;width:100%;min-height:44px;margin:0}
.sk-redesign .sk-direct-size output{grid-row:1;grid-column:2;font-variant-numeric:tabular-nums}
/* WebKit callouts must be disabled on the long-press targets themselves. */
.sk-redesign .sk-drawing-tools button,.sk-redesign .sk-drawing-tools button *{-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}
.sk-redesign .sk-drawing-tools button{touch-action:manipulation}
/* Reserve a consistent chevron gutter for both relocated native selects. */
.sk-redesign :is(.sk-menu-content,.sk-repeat-menu) select{padding-inline:10px 32px;min-height:44px;box-sizing:border-box}
.sk-redesign #sk-view-menu .check{display:flex;align-items:center;gap:8px;min-height:44px;font-size:13px}
.sk-redesign .sk-view-tools{margin-left:auto}
.sk-redesign .sk-app-layout .dc-shell-header .toolbar #sk-exit-preview{width:auto;padding-inline:8px;font-size:12px;white-space:nowrap;border:1px solid var(--sk-line);border-radius:6px}
.sk-redesign #sk-exit-preview[hidden]{display:none!important}
/* At iPad landscape width, put File in the control row and spend gaps first. */
@media(min-width:1000px) and (max-width:1400px){
 .sk-redesign .sk-app-layout .dc-shell-header{gap:4px}
 .sk-redesign .sk-app-layout .dc-identity>span{display:none}
 .sk-redesign .sk-app-layout .dc-shell-header .toolbar{flex:1 1 0;flex-wrap:nowrap;gap:4px}
 .sk-redesign .sk-app-layout .dc-shell-header .sk-primary-tools{gap:2px}
 .sk-redesign .sk-app-layout .dc-shell-header :is(.sk-navigation-tools,.sk-history-tools,.sk-repeat-tools){padding-left:4px;gap:2px}
 .sk-redesign .sk-app-layout .dc-shell-header .toolbar :is(#sk-repeat-trigger,#sk-view-trigger,#drawer-toggle){padding-inline:6px;gap:4px}
 .sk-redesign #sk-file-trigger::after{margin-left:0}
 .sk-redesign .sk-app-layout .dc-header-actions #sk-file-trigger{padding-inline:6px;gap:4px}
 .sk-redesign .sk-app-layout .dc-shell-header .sk-mode-segments button{min-width:52px;padding-inline:6px}
}
/* Portrait has two deliberate groups: mode/tools, then repeat/view/layers. */
@media(min-width:701px) and (max-width:999px){
 .sk-redesign .sk-app-layout .dc-shell-header .toolbar{display:grid;grid-template-columns:auto 1fr;gap:6px}
 .sk-redesign .sk-app-layout .dc-shell-header .sk-primary-tools{justify-content:flex-end}
 .sk-redesign .sk-app-layout .dc-shell-header .sk-repeat-tools{padding-left:0;border-left:0}
 .sk-redesign .sk-view-tools{justify-self:end}
}
@media(max-width:700px){.sk-redesign .sk-view-tools{flex:1;justify-content:flex-end}.sk-redesign .sk-app-layout .dc-shell-header .sk-view-tools{flex-wrap:wrap}}
.sk-redesign #sk-tools-menu [hidden]{display:none!important}
.sk-redesign .dc-shell .drawer-navigation .sk-floating-title{flex:0 1 auto}

@media(min-width:1000px) and (max-width:1199px){
 .sk-redesign .sk-app-layout .dc-shell-header #sk-repeat-trigger .sk-visible-label{max-width:72px;overflow:hidden;text-overflow:ellipsis}
 .sk-redesign:is(:has(.arrange-mode),:has(#sk-exit-preview:not([hidden]))) .sk-app-layout .dc-shell-header .toolbar{display:grid;grid-template-columns:auto 1fr}
 .sk-redesign:is(:has(.arrange-mode),:has(#sk-exit-preview:not([hidden]))) .sk-app-layout .dc-shell-header .sk-primary-tools{justify-content:flex-end}
 .sk-redesign:is(:has(.arrange-mode),:has(#sk-exit-preview:not([hidden]))) .sk-view-tools{justify-self:end}
}
.sk-redesign #control-drawer .drawer-navigation #sk-help-trigger{flex:0 0 44px;width:44px;min-height:44px}

/* QA 0.7.2: win against shared label defaults after controls leave #sketchbook. */
.sk-redesign #sk-tools-menu .sk-menu-content .sk-direct-size{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:0 10px;margin:4px 5px;font-size:13px;text-align:left}
.sk-redesign #sk-tools-menu .sk-direct-size output{grid-row:1;grid-column:2;text-align:right}
.sk-redesign #sk-tools-menu .sk-direct-size input{grid-row:2;grid-column:1 / -1;width:100%;min-height:44px;margin:0}
.sk-redesign #sk-tools-menu #sk-size-option{display:none}
.sk-redesign #sk-tools-menu .sk-tool-help{margin:0 5px;padding-top:4px}
.sk-redesign #sk-view-menu .sk-menu-content .check,.sk-redesign #sk-tools-menu .sk-menu-content .check{flex-direction:row;justify-content:flex-start;align-items:center;gap:8px;min-height:44px;margin:0 5px;font-size:13px;text-align:left}
.sk-redesign .sk-menu-content .check input[type=checkbox]{flex:none;width:18px;height:18px;min-height:18px;margin:0}
.sk-redesign #control-drawer #panel-layers{padding:4px 10px 10px}
.sk-redesign #panel-layers>.section-title{justify-content:flex-start;min-height:44px;margin:0 0 4px}
.sk-redesign #panel-layers .sk-layer-heading-actions{gap:8px;flex-wrap:wrap}
.sk-redesign #panel-layers :is(#add,#create-underlay){padding-inline:8px;margin:0}
/* Disable pan/zoom negotiation only on the two hold targets, including SVGs. */
.sk-redesign .sk-app-layout .dc-shell-header .sk-drawing-tools button{touch-action:none}
.sk-redesign .sk-app-layout .dc-shell-header .sk-drawing-tools button *{pointer-events:none}
/* View follows repeat/canvas controls; only Layers consumes spare desktop width. */
.sk-redesign .sk-app-layout .dc-shell-header .sk-view-tools{flex:1;min-width:max-content;margin-left:0;justify-self:stretch}
.sk-redesign .sk-app-layout .dc-shell-header .sk-primary-tools{flex-wrap:nowrap}
@media(min-width:1000px) and (max-width:1400px){
 .sk-redesign .sk-app-layout .dc-shell-header .sk-mode-tools{padding-right:0;border-right:0}
 .sk-redesign .sk-app-layout .dc-shell-header .dc-identity img{width:32px}
 .sk-redesign .sk-app-layout .dc-shell-header .sk-mode-segments button{min-width:44px;padding-inline:4px}
}
@media(min-width:1000px) and (max-width:1099px){
 .sk-redesign .sk-app-layout .dc-shell-header #drawer-toggle .sk-visible-label{display:none}
}

/* QA 0.7.3: preserve focus targets, suppress only pointer-mode action rings. */
.sk-redesign[data-sk-input=pointer] :is(button,summary,a,input[type=checkbox]):focus{outline:none}
.sk-redesign[data-sk-input=pointer] #layers .layer-toggle:focus-within{outline:none}
.sk-redesign #control-drawer .drawer-navigation{gap:6px}
.sk-redesign #control-drawer .drawer-navigation #sk-help-trigger,.sk-redesign .sk-menu-heading>button{display:inline-flex;align-items:center;justify-content:center;line-height:1}
.sk-redesign #control-drawer .drawer-navigation .sk-floating-title{padding-left:8px}
.sk-redesign #panel-layers #add{border:1px solid var(--sk-line);border-radius:6px;background:#eee9dd;padding-inline:10px}
.sk-redesign #panel-layers #add:hover{background:#e1e7da}
.sk-redesign .sk-chevron{display:inline-flex;align-items:center;justify-content:center;flex:none;width:24px;height:24px}
.sk-redesign .sk-chevron svg{display:block;width:20px;height:20px}
.sk-redesign .sk-app-layout .dc-shell-header .sk-panel-tools{margin-left:auto;gap:4px}
.sk-redesign .sk-app-layout .dc-shell-header .sk-panel-tools #drawer-toggle{margin-left:0}
@media(min-width:660px) and (max-width:999px){
 .sk-redesign .sk-app-layout .dc-shell-header{justify-content:flex-start;gap:4px 8px}
 .sk-redesign .sk-app-layout .dc-header-actions{margin-left:0}
 .sk-redesign .sk-app-layout .dc-shell-header .toolbar{display:grid;grid-template-columns:max-content max-content minmax(0,1fr);gap:4px 8px}
 .sk-redesign .sk-app-layout .dc-shell-header .sk-primary-tools{grid-column:2 / -1;grid-row:1;justify-content:flex-start;gap:4px}
 .sk-redesign .sk-app-layout .dc-shell-header .sk-mode-tools{grid-column:1;grid-row:1;padding-right:0;border-right:0}
 .sk-redesign .sk-app-layout .dc-shell-header .sk-mode-segments{padding:0;gap:0}
 .sk-redesign .sk-app-layout .dc-shell-header .sk-repeat-tools{grid-column:1 / 3;grid-row:2;padding-left:0;border-left:0;gap:6px}
 .sk-redesign .sk-app-layout .dc-shell-header .sk-view-tools{grid-column:3;grid-row:2;min-width:0;justify-self:start;gap:4px}
 .sk-redesign .sk-app-layout .dc-shell-header .sk-panel-tools{margin-left:4px}
}

/* Capability presentation complements the engine action guards. */
.sk-redesign [data-qa-unavailable]{display:none!important}

.sk-redesign .sk-repeat-type>strong{display:block;margin:0 0 5px;font:12px system-ui,sans-serif;color:var(--sk-muted)}
