/* Unified dialog chrome. Document and shared-image rendering remain unchanged. */
@media screen{
body.module-modal-open,body:has(dialog[open]){overflow:hidden}
dialog.module-dialog,dialog.share-dialog,dialog.pdf-delivery{position:fixed;inset:0;margin:auto!important;box-sizing:border-box;padding:0;border:1px solid #e1e9e2;border-radius:18px;background:#f5f7f5;color:#304338;box-shadow:0 24px 90px #142b3540;max-height:calc(100dvh - 32px);overscroll-behavior:contain}
dialog.module-dialog[open]{display:flex;flex-direction:column;overflow:hidden}
dialog.module-dialog:not(.plan-print):not(.photo-viewer-dialog){width:min(600px,calc(100% - 32px));max-height:calc(100dvh - 32px)}
dialog.module-dialog.food-entry-dialog{width:min(480px,calc(100% - 32px))}
dialog.module-dialog::backdrop,dialog.share-dialog::backdrop,dialog.pdf-delivery::backdrop{background:#15251dcc;backdrop-filter:blur(4px)}
dialog.module-dialog>header,dialog.share-dialog>.share-head,dialog.pdf-delivery>.pdf-modal-head{display:flex;align-items:center;justify-content:space-between;flex-shrink:0;gap:14px;padding:15px 18px;background:#303436;color:white;border:0;position:sticky;top:0;z-index:3}
.modal-heading{min-width:0}.modal-heading>small,.share-head>div>p{display:block;color:#b5e2cd;font-size:9px;letter-spacing:.09em;margin:0 0 5px}
dialog.module-dialog>header h2,dialog.share-dialog .share-head h2,dialog.pdf-delivery .pdf-modal-head h2{font-size:17px;line-height:1.4;letter-spacing:-.02em;margin:0;color:#fff;overflow-wrap:anywhere}
dialog.module-dialog>header .icon-button,dialog.share-dialog>.share-head .icon-button,dialog.pdf-delivery>.pdf-modal-head .icon-button{display:grid;place-items:center;width:44px;min-width:44px;height:44px;min-height:44px;flex-basis:44px;border:0;border-radius:50%;background:#ffffff0c;color:#c4e6d2;padding:12px}
dialog.pdf-delivery>.pdf-modal-head .icon-button{font-size:25px}
dialog.module-dialog>.module-dialog-body{overflow:auto;overscroll-behavior:contain;padding:18px;min-height:0;scroll-padding:18px;min-width:0;max-width:100%;box-sizing:border-box}
.module-dialog-body>p,.module-dialog-body .module-notice{font-size:13px;line-height:1.7;overflow-wrap:anywhere}
.module-dialog .module-form{display:grid;gap:15px;margin:0}.module-dialog .field{min-width:0;display:grid;gap:6px}
.module-dialog .module-form input:not([type=radio]):not([type=checkbox]):not([type=hidden]),.module-dialog .module-form select,.module-dialog .module-form textarea{width:100%;min-width:0;max-width:100%;font-size:16px;border-radius:10px;min-height:44px}
.module-dialog textarea{min-height:84px;line-height:1.5;resize:vertical}
.module-dialog .module-form fieldset{min-width:0;border:1px solid #dfe9e1;border-radius:12px;padding:13px;margin:0}
.module-dialog .module-form legend{font-size:12px;font-weight:600;color:#557361;padding:0 5px;line-height:1.5}
.module-dialog input[type=checkbox],.module-dialog input[type=radio],.share-dialog input[type=checkbox]{accent-color:#377e62}
.module-dialog .module-check{min-height:44px;align-items:center;gap:9px}
.module-dialog .module-form label:has(input[type=radio]){min-height:44px;display:inline-flex;align-items:center;gap:8px}
.module-dialog .primary,.share-dialog .primary,.pdf-delivery .primary{background:#303436;color:#b5e2cd;border:0;min-height:44px;border-radius:10px;font-size:13px;padding:11px 16px}
.module-dialog .secondary,.share-dialog .secondary,.pdf-delivery .secondary{background:#e8f0e9;color:#456950;border:1px solid #dce7df;min-height:44px;border-radius:10px;font-size:12px;padding:10px 14px}
.module-dialog .module-form>button.primary{justify-self:stretch;margin-top:4px}
.module-dialog .module-form>p{font-size:12px;line-height:1.6;margin:0}
.module-dialog [role=alert]:not(:empty){padding:10px 12px;border-radius:9px;background:#fff0e9;color:#87513d;font-size:12px;line-height:1.6}
.module-dialog [role=status]:not(:empty){font-size:12px;line-height:1.6}
.module-dialog [hidden],.share-dialog [hidden]{display:none!important}
.module-dialog button:disabled,.share-dialog button:disabled,.pdf-delivery button:disabled{opacity:.45}
.module-dialog :is(button,a,input,select,textarea):focus-visible,.share-dialog :is(button,a,input,select):focus-visible,.pdf-delivery :is(button,a):focus-visible{outline:2px solid #72b491;outline-offset:2px}
.modal-confirm-copy{margin:0 0 20px;white-space:pre-wrap}.modal-confirm-actions{display:flex;gap:10px;justify-content:flex-end;flex-wrap:wrap}.modal-confirm-actions>button{flex:1}
.module-dialog .module-row{gap:12px;padding:13px 0;min-width:0}.module-dialog .module-copy{min-width:0;overflow-wrap:anywhere}
.module-dialog .module-results{background:#fff;border-radius:12px}.module-dialog .module-results button{min-height:48px}
dialog.photo-viewer-dialog{width:min(960px,calc(100% - 24px));background:#232b27}
dialog.photo-viewer-dialog>.module-dialog-body{background:#232b27;padding:12px}
.photo-viewer-dialog .photo-viewer{margin:0;display:flex;flex-direction:column;gap:10px;align-items:center}
.photo-viewer-dialog .photo-viewer img{display:block;max-width:100%;max-height:calc(100dvh - 160px);width:auto;height:auto;object-fit:contain;border-radius:8px;touch-action:pan-x pan-y pinch-zoom}
.photo-viewer-dialog .photo-viewer figcaption{color:#c9d9cd;font-size:12px;text-align:center}
dialog.pdf-delivery{width:min(430px,calc(100% - 32px));overflow:auto;background:#f5f7f5;color:#36533f}
dialog.pdf-delivery.is-ready{background:#f5f7f5;color:#36533f}
.pdf-delivery .pdf-delivery-content{padding:24px 20px;gap:14px;font-size:14px;line-height:1.6}
.pdf-delivery .pdf-spinner{border-color:#d8e5dc;border-top-color:#548e69}
dialog.share-dialog{width:min(960px,calc(100% - 32px));overflow:auto}
.share-dialog .share-layout{gap:18px;padding:18px}.share-dialog .share-stage{background:#e7ede8;border-radius:12px;padding:12px;min-height:160px}
.share-dialog .share-controls{gap:15px}.share-dialog .share-controls legend{color:#587460;font-size:12px}
.share-dialog .share-sources button,.share-dialog .share-models button{border-radius:10px;min-height:44px;background:#e9efea;color:#536e5b}
.share-dialog .share-sources button[aria-pressed=true],.share-dialog .share-models button[aria-pressed=true]{border-color:#7bac8d;background:#dceee1;color:#365a43}
.share-dialog .share-controls select{font-size:16px;min-height:44px;border:1px solid #dbe6dd;border-radius:10px;padding:10px;background:white}
.share-dialog .share-check{min-height:40px;font-size:12px}.share-dialog .share-actions button{width:100%}
.share-dialog .share-crop{background:white;padding:12px;border-radius:10px}.share-dialog input[type=range]{accent-color:#4a8760;min-height:36px}
@media(max-width:600px){
dialog.module-dialog,dialog.module-dialog:not(.plan-print):not(.photo-viewer-dialog),dialog.module-dialog.food-entry-dialog,dialog.share-dialog,dialog.pdf-delivery{width:calc(100% - 16px);max-width:calc(100% - 16px);max-height:calc(100dvh - 16px);margin:auto;border-radius:16px}
dialog.module-dialog>header,dialog.share-dialog>.share-head,dialog.pdf-delivery>.pdf-modal-head{padding:12px 14px}
dialog.module-dialog>.module-dialog-body{padding:15px;padding-bottom:max(15px,env(safe-area-inset-bottom))}
.module-dialog .module-grid,.module-dialog .module-form-grid{grid-template-columns:1fr}
.module-dialog .food-manual .module-form-grid{grid-template-columns:1fr 1fr}
.share-dialog .share-layout{grid-template-columns:1fr;padding:14px}.share-dialog .share-stage canvas{max-height:34dvh}
.share-dialog .share-models{grid-template-columns:repeat(3,minmax(0,1fr))}
}
@media(prefers-reduced-motion:reduce){dialog *,dialog *:before,dialog *:after{scroll-behavior:auto!important}.pdf-spinner{animation:none}}
}
/* Explicit geometry for evolution forms; neutralize inherited bottom-sheet margins. */
@media screen{
dialog.module-dialog.evolution-dialog{position:fixed;inset:0;margin:auto!important;width:min(560px,calc(100% - 24px));max-width:calc(100% - 24px);max-height:calc(100dvh - 24px);border-radius:18px}
dialog.module-dialog.evolution-dialog>.module-dialog-body{padding:18px;overflow:auto;min-width:0}
.evolution-dialog .module-form{width:100%;min-width:0;gap:14px}
.evolution-dialog .module-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px 12px;align-items:end}
.evolution-dialog .field{min-width:0;line-height:1.5}
.evolution-dialog .module-form>button.primary{justify-self:stretch!important;width:100%;margin-top:6px}
.evolution-dialog input[type=file]{white-space:normal;font-size:12px!important;overflow:hidden;padding:10px!important}
.evolution-dialog textarea{min-height:80px}
.evolution-dialog details{min-width:0;padding:12px;border-radius:10px;background:#edf3ee}
.evolution-dialog details summary{font-size:12px;color:#58735f;cursor:pointer}
.evolution-dialog details[open] summary{margin-bottom:12px}
@media(max-width:380px){dialog.module-dialog.evolution-dialog>.module-dialog-body{padding:14px}.evolution-dialog .module-grid{gap:12px 10px}.evolution-dialog .module-grid .field{font-size:11px}}
}
@media screen{dialog.pdf-delivery{position:fixed;inset:0;margin:auto!important;width:min(480px,calc(100% - 24px));max-height:calc(100dvh - 24px)}.pdf-delivery-content{display:flex;flex-direction:column;align-items:stretch;gap:12px;padding:22px}.pdf-delivery-content a{text-align:center;text-decoration:none}}
