/* Centre the food form; the camera uses the available screen with a caption below. */
html:has(#meal-dialog.entry-camera-open:modal),html:has(body.has-morning-section){scrollbar-gutter:auto}
.food-save-status,.food-result-status{padding:12px 14px;border-radius:12px;background:#eef6e8;color:#28451e;font-size:13px;line-height:1.6;margin:12px 0}
.meal-ai-review{margin:24px 0 16px;padding:18px;border:1px solid var(--line);border-radius:14px;background:#f6f8f2}
.meal-ai-review label{display:block;font-size:14px;font-weight:700;margin:16px 0 8px}
#meal-dialog #food-clarification{display:block;width:100%;min-height:96px;line-height:1.6;resize:vertical;margin:0 0 12px}
.meal-ai-review .fine{margin-top:10px;line-height:1.6}
#meal-dialog #food-details>summary,#meal-dialog #food-composition-details>summary{cursor:pointer;font-weight:700;font-size:13px;line-height:1.5;padding:12px 0}
#meal-dialog.entry-preview:modal[data-entry-mode=food]{width:min(800px,calc(100vw - 2 * var(--dialog-gap)))}
.entry-preview .meal-editor-body{display:flex;flex-direction:column;gap:8px}
.entry-preview .meal-editor-composition{order:0}.entry-preview .meal-editor-fields{order:1}
.entry-preview .food-date-row{display:none}
.entry-preview #food-edit-back{display:none}
.entry-preview .estimate-summary h3{font-size:18px;margin:0 0 12px}
.entry-preview .estimate-summary strong{display:block;font-size:28px;margin-bottom:8px}
.entry-preview .estimate-summary p,.entry-preview .estimate-summary li{font-size:13px;line-height:1.6}
.entry-preview .food-recognized-items{margin:12px 0}
#meal-dialog.entry-preview #save-meal{position:static;margin-top:16px;width:100%}
.entry-preview .meal-ai-review{margin-top:16px}
.food-processing{display:flex;align-items:center;gap:10px;padding:14px;border-radius:12px;background:#eef6e8;color:#28451e}
.food-processing::before{content:"";flex:none;width:16px;height:16px;border:2px solid #b4cca8;border-top-color:#28451e;border-radius:50%;animation:food-processing-spin 1s linear infinite}
@keyframes food-processing-spin{to{transform:rotate(360deg)}}
@media(prefers-reduced-motion:reduce){.food-processing::before{animation:none}}
#meal-dialog:modal[data-entry-mode=food]{
  inset-block-start:calc(var(--dialog-viewport-top,0px) + var(--morning-mini-height,0px));
  inset-block-end:calc(100dvh - var(--dialog-viewport-top,0px) - var(--dialog-viewport-height,100dvh));
  margin-block:auto;margin-inline:auto;height:fit-content;
  max-height:calc(var(--dialog-viewport-height,100dvh) - var(--morning-mini-height,0px) - 2 * var(--dialog-gap));
}
#meal-dialog[data-entry-mode=food]>.dialog-heading{padding-bottom:18px;border-bottom:1px solid var(--line);margin-bottom:18px;align-items:center}
#meal-dialog .capture-description>span{display:block;font-size:14px;font-weight:700;margin-bottom:8px}
#meal-dialog .capture-description textarea{width:100%;line-height:1.5;min-height:92px}
#meal-dialog .food-media-actions{gap:10px;flex-wrap:wrap}
#meal-dialog .food-calculation-actions{margin-top:20px;gap:10px}
#meal-dialog .photo-preview{height:auto;min-height:0;padding:0;background:transparent}
#meal-dialog .photo-preview img{display:block;flex:none;width:100%;max-height:min(420px,45dvh);object-fit:contain;border-radius:14px;background:#f3f4ef}
#meal-dialog:modal.entry-camera-open[data-entry-mode=food]{
  inset-inline:0;inset-block-start:calc(var(--dialog-viewport-top,0px) + var(--morning-mini-height,0px));inset-block-end:auto;
  margin:0;width:100%;max-width:100%;height:calc(var(--dialog-viewport-height,100dvh) - var(--morning-mini-height,0px));
  max-height:calc(var(--dialog-viewport-height,100dvh) - var(--morning-mini-height,0px));
  padding:0;border:0;border-radius:0;background:#111914;color:#fff;
}
#meal-dialog.entry-camera-open>.dialog-heading,#meal-dialog.entry-camera-open .entry-tabs,#meal-dialog.entry-camera-open #voice-panel,#meal-dialog.entry-camera-open .food-date-row,#meal-dialog.entry-camera-open .food-day-panel{display:none!important}
#meal-dialog.entry-camera-open>.entry-content{flex:1;padding:0;overflow:hidden;scrollbar-gutter:auto}
#meal-dialog.entry-camera-open #entry-food,#meal-dialog.entry-camera-open #capture-form{display:flex;flex-direction:column;min-height:0;height:100%;margin:0;gap:0}
#meal-dialog.entry-camera-open #capture-form>:not(#live-camera):not(.capture-description){display:none!important}
#meal-dialog.entry-camera-open #live-camera{display:flex;flex:1;flex-direction:column;min-height:0;width:100%;margin:0}
.food-camera-heading{display:flex;justify-content:space-between;align-items:center;gap:16px;padding:8px max(16px,env(safe-area-inset-right)) 8px max(16px,env(safe-area-inset-left));flex:none}
.food-camera-heading h3{color:#fff;font-size:16px;margin:0}
#meal-dialog .food-camera-heading button{width:44px;height:44px;padding:0;border:0;border-radius:50%;background:#ffffff14;color:#fff;font-size:28px;cursor:pointer}
.food-camera-view{position:relative;flex:1;min-height:0;width:100%;background:#080c09}
#meal-dialog.entry-camera-open #live-camera video{position:absolute;inset:0;display:block;width:100%;height:100%;max-height:none;aspect-ratio:auto;object-fit:contain;background:#080c09;border:0;border-radius:0}
.food-camera-actions{display:flex;justify-content:center;padding:12px 16px;flex:none}
#meal-dialog #camera-shoot{display:flex;align-items:center;justify-content:center;gap:12px;min-height:52px;min-width:180px;border-radius:30px;font-size:15px;background:#e3fa86;color:#17241e}
#camera-shoot span{font-size:28px;line-height:1}
#meal-dialog.entry-camera-open .capture-description{display:block;flex:none;width:100%;padding:12px max(16px,env(safe-area-inset-right)) max(12px,env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left));margin:0;background:#fff;color:#202b24}
#meal-dialog.entry-camera-open .capture-description textarea{display:block;height:64px!important;min-height:64px;max-height:64px;resize:none;margin:0;padding:10px 12px;font-size:16px;overflow-y:auto;background:#f6f7f3;color:#202b24}
@media(max-height:500px){.food-camera-heading{padding-block:2px}.food-camera-actions{padding:5px}#meal-dialog.entry-camera-open .capture-description{padding-block:6px}#meal-dialog.entry-camera-open .capture-description>span{margin-bottom:3px}#meal-dialog.entry-camera-open .capture-description textarea{height:44px!important;min-height:44px;max-height:44px}}
