.action-dialog{width:min(560px,calc(100vw - 32px));max-width:560px;max-height:calc(100svh - 32px);padding:0;border:1px solid var(--border,#ccd7cc);border-radius:12px;background:var(--surface,#fff);color:var(--text,#17251c);box-shadow:0 18px 70px #0004;overflow:auto}
.action-dialog::backdrop{background:#071b12a6}
.action-dialog>header{position:static;display:block;padding:20px 24px;background:transparent;border:0;border-bottom:1px solid var(--border,#ccd7cc)}
.action-dialog h2{margin:0;font-size:1.3rem;line-height:1.4;overflow-wrap:anywhere}
.action-dialog-body{padding:24px;white-space:pre-line;overflow-wrap:anywhere;line-height:1.6}
.action-dialog>.dialog-actions{display:flex;flex-wrap:wrap;justify-content:flex-end;align-items:center;gap:10px;margin:0;padding:16px 24px;border-top:1px solid var(--border,#ccd7cc)}
.action-dialog>.dialog-actions>button{display:inline-flex;align-items:center;justify-content:center;min-height:46px;max-width:100%;margin:0;padding:10px 18px;line-height:1.4;font:inherit;border-radius:8px;border:1px solid #b6c6bd;white-space:normal;overflow-wrap:anywhere;cursor:pointer}
.action-dialog>.dialog-actions>.secondary{color:var(--text,#17251c);background:transparent}
.action-dialog>.dialog-actions>.secondary:hover{background:var(--bg,#f4f6f3)}
.action-dialog>.dialog-actions>.dialog-primary{background:#176a3b;border-color:#176a3b;color:#fff}
.action-dialog>.dialog-actions>.dialog-primary:hover{background:#10532d;border-color:#10532d}
.action-dialog>.dialog-actions>.dialog-danger{background:#b4232b;border-color:#b4232b;color:#fff}
.action-dialog>.dialog-actions>.dialog-danger:hover{background:#901b22;border-color:#901b22}
.action-dialog button:focus-visible{outline:3px solid #b87500;outline-offset:3px}
/* Modal focus trapping does not by itself prevent background scrolling. */
html{scrollbar-gutter:stable}
html:has(dialog:modal),html.has-modal,html.workspace-has-modal{overflow:hidden;overscroll-behavior:none}
body:has(dialog:modal),html.has-modal>body,html.workspace-has-modal>body{overflow:hidden;overscroll-behavior:none}
dialog:modal{max-height:calc(100dvh - 32px);overflow:auto;overscroll-behavior:contain;touch-action:pan-y}
html dialog:modal::backdrop{background:rgb(7 20 16 / 55%);overscroll-behavior:none;touch-action:none}
dialog:modal :is([role=listbox],.media-picker-grid){overscroll-behavior:contain}
html.workspace-has-modal .admin-sidebar>nav{overflow:hidden}
html.workspace-has-modal .admin-footer{position:relative}
html.workspace-has-modal :is(.admin-topbar,.admin-sidebar,.admin-footer)::after{content:'';position:absolute;inset:0;background:rgb(7 20 16 / 55%);z-index:1000;pointer-events:auto}

/* Shared modal frame: fixed size, with scrolling confined to the content area. */
html dialog.cs-dialog{--dialog-width:760px;--dialog-height:600px;box-sizing:border-box;position:fixed;inset:0;margin:auto;width:min(var(--dialog-width),calc(100vw - 32px));height:min(var(--dialog-height),calc(100dvh - 32px));max-width:calc(100vw - 32px);max-height:calc(100dvh - 32px);padding:0;border:1px solid var(--border,#ccd7cc);border-radius:12px;background:var(--surface,#fff);color:var(--text,#17251c);box-shadow:0 18px 70px #0004;overflow:hidden}
html dialog.cs-dialog[data-dialog-size="wide"]{--dialog-width:1040px;--dialog-height:720px}
html dialog.cs-dialog[data-dialog-size="compact"]{--dialog-width:560px;--dialog-height:360px}
html dialog.cs-dialog[open]{display:grid;grid-template-rows:auto minmax(0,1fr) auto;overflow:hidden}
html dialog.cs-dialog::backdrop{background:rgb(7 20 16 / 55%)}
html dialog.cs-dialog>.cs-dialog-header{position:static;display:flex;flex-direction:row;align-items:center;justify-content:space-between;gap:16px;min-width:0;margin:0;padding:16px 24px;background:var(--surface,#fff);border:0;border-bottom:1px solid var(--border,#ccd7cc);z-index:auto}
html dialog.cs-dialog>.cs-dialog-header :is(h1,h2){margin:0;padding:0;font:700 1.3rem/1.35 system-ui,sans-serif;letter-spacing:normal;overflow-wrap:anywhere;min-width:0}
html dialog.cs-dialog .cs-dialog-header>.cs-dialog-close{display:inline-flex;align-items:center;justify-content:center;flex:0 0 44px;width:44px;height:44px;min-width:44px;min-height:44px;margin:0;padding:0;border:1px solid var(--border,#ccd7cc);border-radius:8px;background:transparent;color:var(--text,#17251c);cursor:pointer}
html dialog.cs-dialog .cs-dialog-close:hover{background:var(--bg,#f4f6f3)}
html dialog.cs-dialog .cs-dialog-body{display:block;min-width:0;min-height:0;height:auto;max-height:none;flex:auto;margin:0;padding:20px 24px;overflow:auto;overscroll-behavior:contain;scrollbar-gutter:stable;touch-action:pan-y}
html dialog.cs-dialog .cs-dialog-form{display:grid;grid-template-rows:minmax(0,1fr) auto;min-height:0;min-width:0;grid-row:2/-1;height:100%;margin:0;padding:0;gap:0;overflow:hidden}
html dialog.cs-dialog .cs-dialog-footer{position:static;display:flex;flex-direction:row;flex-wrap:wrap;justify-content:flex-end;align-items:center;gap:10px;min-width:0;margin:0;padding:16px 24px;border:0;border-top:1px solid var(--border,#ccd7cc);background:var(--surface,#fff);color:var(--text,#17251c);z-index:auto}
html dialog.cs-dialog .cs-dialog-footer :is(button,.button){display:inline-flex;align-items:center;justify-content:center;min-height:44px;max-width:100%;margin:0;padding:10px 18px;font:inherit;line-height:1.4;white-space:normal;overflow-wrap:anywhere;border-radius:8px;text-decoration:none}
html dialog.cs-dialog .cs-dialog-footer>form{display:flex;margin:0;padding:0;gap:0}
html dialog.cs-dialog button:focus-visible{outline:3px solid #b87500;outline-offset:3px}
html dialog.cs-dialog .media-picker-grid{max-height:none;overflow:visible}
html dialog.cs-dialog .filter-values{max-height:none;overflow:visible}
html dialog.cs-dialog .cash-register-confirm-panel{width:auto;max-width:none;padding:0;background:transparent;box-shadow:none;border:0}
@media(max-width:600px){html dialog.cs-dialog{width:calc(100vw - 16px);height:calc(100dvh - 16px);max-width:calc(100vw - 16px);max-height:calc(100dvh - 16px)}html dialog.cs-dialog>.cs-dialog-header,html dialog.cs-dialog .cs-dialog-footer{padding:12px 16px}html dialog.cs-dialog .cs-dialog-body{padding:16px}html dialog.cs-dialog .cs-dialog-footer :is(button,.button){flex:1 1 auto}html dialog.cs-dialog .cs-dialog-footer>form{flex:1 1 auto}html dialog.cs-dialog .cs-dialog-footer>form>button{width:100%}}
html dialog.cs-dialog .dialog-header-actions{display:flex;align-items:center;gap:8px;margin-left:auto;flex-shrink:0}
html dialog.cs-dialog .dialog-header-actions>button{min-height:44px;margin:0;padding:10px 16px;white-space:nowrap}
@media(max-width:600px){html dialog.cs-dialog>.cs-dialog-header{gap:8px}html dialog.cs-dialog .dialog-header-actions>button{padding:10px 12px}}
