/* The desktop footer and its original actions retain their existing layout. */
.mobile-editor-actions{display:none}
.mobile-editor-sheet{padding:0;border:0;color:var(--dark-green);background:transparent}
.mobile-editor-sheet:not([open]){display:none}
.mobile-editor-sheet::backdrop{background:rgba(16,37,29,.45)}
.mobile-editor-sheet[open]{position:fixed;inset:auto 0;top:var(--mobile-editor-top,0px);display:flex;align-items:flex-end;width:100%;max-width:none;height:var(--mobile-editor-height,100dvh);max-height:none;margin:0;overflow:hidden;box-sizing:border-box}
.mobile-editor-sheet-panel{box-sizing:border-box;width:100%;max-height:100%;overflow-y:auto;overscroll-behavior:contain;padding:10px max(16px,env(safe-area-inset-right)) max(16px,env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left));border-radius:20px 20px 0 0;background:#fff;box-shadow:0 -12px 40px #10251d1a;animation:mobile-editor-slide-up .2s ease-out}
.mobile-editor-sheet-handle{width:36px;height:4px;margin:0 auto 5px;border-radius:3px;background:#d4ddd5}
.mobile-editor-sheet header{display:flex;align-items:center;justify-content:space-between;gap:12px;padding-bottom:6px}
.mobile-editor-sheet h2{margin:0;font-family:inherit;font-size:1.1rem;font-weight:750;line-height:1.3}
.mobile-editor-sheet .dialog-close{position:static;flex:none;width:44px;height:44px;min-width:44px;min-height:44px}
.mobile-editor-sheet-actions{display:grid;gap:4px}
.mobile-editor-sheet-actions>button{display:flex;align-items:center;justify-content:flex-start;gap:14px;width:100%;min-height:54px;padding:12px 14px;border:0;border-radius:9px;box-shadow:none;background:#f4f7f2;color:var(--dark-green);text-align:left;font-family:inherit;font-size:.95rem;font-weight:700;line-height:1.4;cursor:pointer}
.mobile-editor-sheet-actions>button[hidden]{display:none}
.mobile-editor-sheet-actions>button:disabled{opacity:.4;cursor:default}
.mobile-editor-sheet-actions>button:not(:disabled):hover{background:#eaf1e7;transform:none;box-shadow:none}
.mobile-editor-sheet-actions>.admin-danger-action{margin-top:10px;border-top:1px solid #ecdcd8;border-radius:0 0 9px 9px;padding-top:18px;background:#fff6f3;color:#b13c32}
.mobile-editor-sheet-actions>.admin-danger-action:not(:disabled):hover{background:#faeae6}
.mobile-editor-action-icon{flex:none;width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.mobile-editor-sheet :focus-visible,.mobile-editor-actions :focus-visible{outline:3px solid var(--primary-green);outline-offset:2px}
@keyframes mobile-editor-slide-up{from{transform:translateY(100%)}to{transform:translateY(0)}}
@media(prefers-reduced-motion:reduce){.mobile-editor-sheet-panel{animation:none}}

@media(max-width:700px), (max-height:500px) and (pointer:coarse){
  #productEditorDialog.mobile-editor-ready{position:fixed;inset:auto 0;top:var(--mobile-editor-top,0px);box-sizing:border-box;width:100%;max-width:none;height:var(--mobile-editor-height,100dvh);max-height:var(--mobile-editor-height,100dvh);margin:0;padding:0;border:0;border-radius:0;overflow:hidden}
  #productEditorDialog.mobile-editor-ready .product-admin-form{display:grid;grid-template-rows:auto minmax(0,1fr) auto;height:100%;min-height:0}
  #productEditorDialog.mobile-editor-ready .product-editor-header{position:relative;top:auto;min-height:60px;box-sizing:border-box;gap:12px;padding:8px max(16px,env(safe-area-inset-right)) 8px max(16px,env(safe-area-inset-left));padding-top:calc(8px + env(safe-area-inset-top))}
  #productEditorDialog.mobile-editor-ready .product-editor-header h2{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:1.15rem}
  #productEditorDialog.mobile-editor-ready .product-editor-header>div{min-width:0}
  #productEditorDialog.mobile-editor-ready .product-editor-header .dialog-close{position:static;flex:none;width:44px;height:44px;min-width:44px;min-height:44px}
  #productEditorDialog.mobile-editor-ready .product-editor-layout{width:100%;min-width:0;min-height:0;margin:0;padding:0 max(16px,env(safe-area-inset-right)) calc(24px + var(--mobile-editor-status-height,0px)) max(16px,env(safe-area-inset-left));overflow-y:auto;overscroll-behavior:contain;scroll-padding-block:16px;-webkit-overflow-scrolling:touch}
  #productEditorDialog.mobile-editor-ready .product-save-footer{position:relative;bottom:auto;display:block;box-sizing:border-box;padding:10px max(12px,env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left))}
  #productEditorDialog.mobile-editor-ready .product-save-footer>.admin-actions{display:none}
  #productEditorDialog.mobile-editor-ready .mobile-editor-actions{display:grid;grid-template-columns:minmax(0,1fr) 44px;align-items:center;gap:8px;min-width:0}
  #productEditorDialog.mobile-editor-ready .mobile-editor-actions:has(.mobile-editor-more[hidden]){grid-template-columns:minmax(0,1fr)}
  #productEditorDialog.mobile-editor-ready .mobile-editor-primary{min-width:0;width:100%;height:48px;min-height:48px;padding:0 10px;border:1px solid var(--dark-green);border-radius:9px;background:var(--dark-green);color:#fff;font-size:clamp(.8rem,3.4vw,.94rem);font-weight:750;line-height:1.2;white-space:nowrap;box-shadow:none}
  #productEditorDialog.mobile-editor-ready .mobile-editor-primary:disabled{opacity:.45;cursor:default}
  .mobile-editor-more{display:grid;place-items:center;width:44px;height:48px;padding:10px;border:1px solid var(--line);border-radius:9px;background:#f3f6ef;color:var(--dark-green);cursor:pointer}
  .mobile-editor-more:disabled{opacity:.45;cursor:default}
  .mobile-editor-more[hidden]{display:none}
  .mobile-editor-more svg{width:24px;height:24px;fill:currentColor}
  /* Existing status text stays above the actions, with room to scroll the final
     fields clear of it. Long API errors cannot enlarge the fixed action bar. */
  #productEditorDialog.mobile-editor-ready .product-action-status{position:absolute;bottom:100%;inset-inline:0;max-height:min(calc(var(--mobile-editor-height,100dvh) * .2),130px);overflow-y:auto;overscroll-behavior:contain;padding:8px 16px;background:#fff;border-top:1px solid var(--line);box-sizing:border-box}
  #productEditorDialog.mobile-editor-ready .product-action-status:not(:has(>p:not(:empty))){display:none}
  #productEditorDialog.mobile-editor-ready .product-action-status p{margin:0;overflow-wrap:anywhere}
  #productEditorDialog.mobile-editor-ready .product-action-status p+p:not(:empty){margin-top:4px}
}
