/* Scrollbars must remain discoverable even when macOS hides native overlays. */
[hidden]{display:none!important}
html:has(dialog[open]){overflow:hidden}
dialog.scrollable-dialog{overflow:hidden;max-height:calc(100vh - 24px);max-height:calc(100dvh - 24px);width:min(840px,calc(100vw - 24px))}
.dialog-toolbar{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:11px 16px 11px 26px;min-height:48px;box-sizing:border-box;border-bottom:1px solid #e3e7eb;background:#f7f9fa}
.dialog-toolbar strong{font-size:13px;color:#657187;overflow-wrap:anywhere}
.dialog-toolbar form{margin:0;flex:none}
dialog .dialog-toolbar .close{position:static;display:block;margin:0;width:32px;height:32px;line-height:28px}
.dialog-scroll-shell{display:grid;grid-template-columns:minmax(0,1fr);min-height:0}
.dialog-scroll-shell.can-scroll{grid-template-columns:minmax(0,1fr) 38px}
.dialog-scroll{overflow:auto;overscroll-behavior:contain;max-height:calc(100vh - 110px);max-height:calc(100dvh - 110px);min-width:0;scrollbar-width:none}
.dialog-scroll::-webkit-scrollbar{display:none}
.dialog-scroll .dialog-body{padding:24px 28px 30px}
.scroll-controls{display:flex;align-items:center;gap:8px;background:#f0f4f5;border:1px solid #dce3e6;padding:7px;box-sizing:border-box}
.scroll-controls.vertical{flex-direction:column;border-width:0 0 0 1px;padding:8px 5px;min-height:110px;min-width:0}
.scroll-controls.horizontal{margin:0;min-width:0;border-width:1px 0 0;gap:12px}
.scroll-controls button{display:block;border:1px solid #cbd5db;border-radius:5px;background:white;color:#244e3c;cursor:pointer;width:26px;height:26px;padding:0;font-size:17px;line-height:24px;flex:none}
.scroll-controls button:disabled{opacity:.35;cursor:default}
.scroll-controls input[type=range]{appearance:none;-webkit-appearance:none;display:block;box-sizing:border-box;border:0;border-radius:6px;padding:0;margin:0;min-width:0;min-height:0;background:#d6e0e3;cursor:pointer;box-shadow:none;accent-color:#2b694d;touch-action:none}
.scroll-controls.horizontal input[type=range]{height:12px;flex:1;width:100%}
.scroll-controls.vertical input[type=range]{writing-mode:vertical-lr;direction:ltr;width:12px;flex:1;height:100%;min-height:40px}
.scroll-controls input[type=range]::-webkit-slider-thumb{appearance:none;-webkit-appearance:none;width:23px;height:34px;background:#2b694d;border:2px solid white;border-radius:6px;box-shadow:0 1px 4px #18213835}
.scroll-controls input[type=range]::-moz-range-thumb{width:19px;height:30px;background:#2b694d;border:2px solid white;border-radius:6px;box-shadow:0 1px 4px #18213835}
.scroll-controls.horizontal input[type=range]::-webkit-slider-thumb{width:38px;height:22px}
.scroll-controls.horizontal input[type=range]::-moz-range-thumb{width:34px;height:18px}
.scroll-controls input:focus-visible,.scroll-controls button:focus-visible{outline:3px solid #6b84e7;outline-offset:3px}
textarea,.preview-text,.pay-extracted pre,.table-scroll,.sidebar nav{scrollbar-width:auto;scrollbar-color:#7d998c #eaf0ed}
textarea::-webkit-scrollbar,.preview-text::-webkit-scrollbar,.pay-extracted pre::-webkit-scrollbar,.table-scroll::-webkit-scrollbar{width:13px;height:13px}
textarea::-webkit-scrollbar-thumb,.preview-text::-webkit-scrollbar-thumb,.pay-extracted pre::-webkit-scrollbar-thumb,.table-scroll::-webkit-scrollbar-thumb{background:#7d998c;border:3px solid #eaf0ed;border-radius:10px}
textarea::-webkit-scrollbar-track,.preview-text::-webkit-scrollbar-track,.pay-extracted pre::-webkit-scrollbar-track,.table-scroll::-webkit-scrollbar-track{background:#eaf0ed}
@media(max-width:600px){.dialog-scroll .dialog-body{padding:20px 16px 24px}.dialog-toolbar{padding-left:16px}.dialog-scroll .form-grid{grid-template-columns:minmax(0,1fr)}.dialog-scroll .form-grid .wide{grid-column:1}}
@media(prefers-reduced-motion:reduce){.dialog-scroll,.table-scroll{scroll-behavior:auto}}

.table-scroll{scrollbar-width:none}.table-scroll::-webkit-scrollbar{display:none}
.dialog-scroll .preview-text,.dialog-scroll .pay-extracted pre{max-height:none;overflow:visible}

@media(min-width:761px){.sidebar{overflow-y:auto;scrollbar-width:thin;scrollbar-color:#7d998c #141d34}.sidebar .brand,.sidebar .workspace-label,.sidebar nav,.sidebar-bottom{flex-shrink:0}.sidebar-bottom{margin-top:28px}}
@media(min-width:761px) and (min-height:740px){.sidebar-bottom{margin-top:auto}}
