/* Sistema visual compartido: formularios y buscadores, móvil primero */
.modal.show{z-index:10000!important;align-items:flex-end}
/* Modal always overlays fixed bottom navigation; all actions remain reachable. */
body:has(.modal.show) .bottom-nav{z-index:1!important;pointer-events:none}
.modal.show>.sheet{position:relative;z-index:10001;scrollbar-gutter:stable;}
.modal.show>.sheet select{line-height:1.4!important;padding-top:12px!important;padding-bottom:12px!important;appearance:auto}
/* Keep the save action reachable above the iPhone navigation and safe area. */
.modal.show:has(#servingDate)>.sheet{display:flex;flex-direction:column;overflow-y:auto;max-height:calc(100dvh - 12px);padding-bottom:calc(22px + env(safe-area-inset-bottom));scroll-padding-bottom:100px}
.modal.show:has(#servingDate)>.sheet>button.primary:last-child{position:sticky;bottom:0;flex-shrink:0;z-index:2;margin-top:18px;padding:15px;background:#648f75;box-shadow:0 -8px 18px #faf7f1;border-radius:14px}
.modal.show:has(#servingDate)~.bottom-nav{pointer-events:none}
.modal.show>.sheet{display:block;width:min(100%,520px);max-height:calc(100dvh - 24px);overflow-y:auto;overscroll-behavior:contain;background:#faf7f1;border-radius:26px 26px 0 0;padding:24px 22px calc(34px + env(safe-area-inset-bottom));box-shadow:0 -12px 40px #32281e20}
.modal.show>.sheet .close{display:grid;place-items:center;width:42px;height:42px;border-radius:50%;background:#eee6dc;color:#6c5140;font-size:27px;margin:0 0 18px}
.modal.show>.sheet h2{font-size:26px;line-height:1.2;letter-spacing:-.5px;color:#3d342e;margin:0 0 12px}
.modal.show>.sheet .recipe-meta{font-size:14px;line-height:1.5;margin:0 0 24px}
.modal.show>.sheet label{display:block;font-size:14px;font-weight:750;color:#51483f;margin:17px 0 8px}
.modal.show>.sheet input:not([type=checkbox]),.modal.show>.sheet select,.modal.show>.sheet textarea{display:block;width:100%;min-width:0;max-width:100%;font:inherit;font-size:16px;color:#403831;background:#fff;border:1px solid #dcd0c3;border-radius:15px;padding:13px 15px;min-height:51px;outline-offset:2px}
.modal.show>.sheet textarea{min-height:105px;resize:vertical}
.modal.show>.sheet input:focus,.modal.show>.sheet textarea:focus,.modal.show>.sheet select:focus{outline:2px solid #70977e}
.modal.show>.sheet .serving-edit-grid{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:12px;align-items:end}
.modal.show>.sheet .serving-edit-grid>div{min-width:0}
.modal.show>.sheet .serving-edit-grid input,.modal.show>.sheet .serving-edit-grid select{width:100%;min-width:0}
.modal.show>.sheet .serving-edit-actions{display:grid;gap:10px;margin-top:24px}
.modal.show>.sheet .serving-edit-actions button{width:100%;min-height:48px;border-radius:14px;font-size:14px;margin:0!important}
.modal.show>.sheet .serving-edit-actions .primary{background:#668f78;color:#fff}
.modal.show>.sheet .serving-edit-actions .secondary{background:#edf0e9;color:#557761}
.modal.show>.sheet .serving-edit-actions .secondary:last-child{background:#f8e9e5;color:#ad5546!important;border:0!important}
.modal.show>.sheet #calendarRecipeResults{max-height:min(43dvh,390px)!important;overflow-y:auto!important;overscroll-behavior:contain;padding-bottom:14px}
.modal.show>.sheet.calendar-recipe-sheet{padding-bottom:calc(35px + env(safe-area-inset-bottom))}
@media(max-width:390px){.modal.show>.sheet .serving-edit-grid{grid-template-columns:1fr}}
.recipe-editor-screen input,.recipe-editor-screen select,.recipe-editor-screen textarea{max-width:100%;min-width:0}
.recipe-editor-screen .recipe-editor{min-width:0}