.food-summary strong{font-size:20px}.food-total{padding:14px;margin:12px 0;border:1px solid var(--line);border-radius:12px;font-size:23px;font-weight:700}.food-total small{display:block;font-size:12px;font-weight:400}.food-meal{margin:18px 0}.food-meal h3{display:flex;justify-content:space-between;gap:10px}.food-meal h3 small{font-weight:400;white-space:nowrap}.food-entry{border:1px solid var(--line);border-radius:12px;padding:12px;margin:10px 0}.food-entry p{margin:6px 0}.food-entry .row{margin-top:10px}.food-entry small{display:block;color:var(--muted)}#food-entry-form>.row>*{flex:1;min-width:0}#food-entry-form input,#food-entry-form select{width:100%;box-sizing:border-box}

#meal-set-form>.row>*{flex:1;min-width:0}#meal-set-form input:not([type=checkbox]),#meal-set-form select{width:100%;box-sizing:border-box}#meal-set-form legend{max-width:100%;font-weight:600}#meal-set-form .food-entry{min-width:0}#meal-set-form input[type=checkbox]{width:18px;height:18px;vertical-align:middle}
/* Scoped food forms: editable fields, disclosure links and actions have distinct shapes. */
.food-form{--food-field-bg:#fff;--food-field-border:#879b9c;--food-text:#183f45;color:var(--food-text);display:flex;flex-direction:column;gap:16px;min-width:0}
.food-form .field{display:block;margin:0;min-width:0;width:100%}
.food-form .field>span{display:block;font-size:13px;font-weight:650;color:var(--food-text);margin:0 0 7px;line-height:1.4}
.food-form input:not([type=checkbox]),.food-form select{display:block;appearance:auto;-webkit-appearance:auto;width:100%;min-width:0;max-width:100%;min-height:48px;border:2px solid var(--food-field-border);border-radius:9px;background:var(--food-field-bg);color:var(--food-text);padding:10px 12px;font:400 16px/1.4 system-ui,-apple-system,sans-serif;box-sizing:border-box;box-shadow:none}
.food-form input::placeholder{color:#647678;opacity:1;font-size:14px}
.food-form input:focus,.food-form select:focus{border-color:#226a73;outline:3px solid #226a7333;outline-offset:2px}
.food-form input[type=date]{text-align:left;-webkit-min-logical-width:0}
.food-form input::-webkit-date-and-time-value{text-align:left}
.food-form .food-hint{font-size:12px;line-height:1.45;color:var(--muted);margin:-8px 0 0}
.food-form .food-reference{border:0;border-top:1px solid var(--line);border-bottom:1px solid var(--line);border-radius:0;background:none;padding:14px 0;display:block}
.food-reference>.field+.field{margin-top:12px}
.food-form details summary{font-size:13px;line-height:1.5;cursor:pointer;padding:7px 0;color:var(--food-text);font-weight:500}
.food-form details summary span{float:right;font-size:12px;text-decoration:underline;text-underline-offset:3px}
.food-form details[open]>summary{margin-bottom:12px}
.food-form .food-help{margin-top:10px}
.food-form .food-help summary{font-size:12px;color:var(--muted);text-decoration:underline dotted;text-underline-offset:3px;padding:0}
.food-form .food-help p{font-size:13px;line-height:1.55;color:var(--muted);margin-top:8px}
.food-form .food-date-row{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:12px;min-width:0}
.food-form .food-action{display:grid;gap:12px;padding:8px 0 10px}
.food-form .food-action output{font-size:25px;font-weight:700;text-align:center;color:var(--food-text)}
.food-form .btn.primary{border:0;min-height:50px;border-radius:12px;background:#214b50;color:#fff;font-weight:700;font-size:16px}
.food-form .btn:not(.primary){border:1px solid var(--food-field-border);border-radius:12px;min-height:46px;color:var(--food-text);background:transparent}
.food-form .food-entry{margin:0;padding:12px;border:1px solid var(--line);background:none;border-radius:12px}
.food-form .food-entry legend{font-size:14px;line-height:1.5;padding:0 4px;white-space:normal}
.food-form input[type=checkbox]{accent-color:#226a73;width:20px;height:20px;margin:0 5px 0 0}
.food-form .food-entry .food-reference{margin-top:12px}
.food-form .food-total{margin:0;border:0;padding:8px 0;font-size:21px;text-align:center}
[data-theme=fire] .food-form{--food-field-bg:#3b2b32;--food-field-border:#ad8f88;--food-text:#fff5ed}
[data-theme=fire] .food-form input:not([type=checkbox]),[data-theme=fire] .food-form select{background:var(--food-field-bg);color:var(--food-text);border-color:var(--food-field-border)}
[data-theme=fire] .food-form input::placeholder{color:#d3bfb7}
[data-theme=fire] .food-form input:focus,[data-theme=fire] .food-form select:focus{border-color:#ffb46e;outline-color:#ffb46e55}
[data-theme=fire] .food-form .btn.primary{background:var(--fire-gradient);color:#2c100c}
[data-theme=fire] .food-form input[type=checkbox]{accent-color:#ffb46e}
@media(max-width:360px){.food-form .food-date-row{grid-template-columns:minmax(0,1fr)}}

.food-form .food-add-ingredient{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;padding:12px;border:1px solid var(--food-field-border);border-radius:12px;min-height:64px}.food-add-ingredient strong{font-size:15px}.food-add-ingredient small{font-size:12px;color:var(--muted)}

/* Photo selection and weighing are distinct steps; only the dialog header stays fixed. */
#sheet[data-sheet-kind=meal-set] .sheet-head{padding:8px 14px 10px}
#sheet[data-sheet-kind=meal-set] .sheet-handle{margin-bottom:6px;height:3px;width:26px}
#sheet[data-sheet-kind=meal-set] .sheet-head .row{gap:7px;flex-wrap:nowrap}
#sheet[data-sheet-kind=meal-set] .sheet-head h2{font:600 19px/1.25 system-ui,-apple-system,sans-serif}
#sheet[data-sheet-kind=meal-set] .sheet-body{padding:12px 14px max(18px,env(safe-area-inset-bottom))}
#sheet[data-sheet-kind=meal-set] .meal-header-context{display:flex;gap:3px;align-items:center;min-width:0;max-width:124px;width:auto;padding:6px 8px;white-space:nowrap;font-size:13px}
#sheet[data-sheet-kind=meal-set] .meal-header-context svg{width:14px;height:14px}
#meal-set-form.meal-picker-form{gap:12px}
#meal-set-form [hidden]{display:none!important}
.meal-picker-tools{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px;align-items:center}
.meal-picker-search{position:relative;min-width:0}
.meal-picker-search>svg{position:absolute;left:11px;top:14px;width:18px;height:18px;pointer-events:none;color:var(--muted)}
#meal-set-form .meal-picker-search input{padding-left:37px;border-width:1px;min-height:46px}
#meal-set-form .meal-picker-tools>.btn{display:flex;gap:5px;align-items:center;padding:9px;white-space:nowrap;min-height:46px}
.meal-picker-tools>.btn svg{width:16px;height:16px}
.meal-picker-filters{display:flex;flex-direction:column;gap:12px;border-bottom:1px solid var(--line);padding-bottom:12px}
.meal-filter-types{display:flex;gap:7px;flex-wrap:wrap}
#meal-set-form .meal-filter-types .btn{min-height:42px;padding:8px 12px;font-size:13px}
#meal-set-form .meal-filter-types [aria-pressed=true]{background:var(--ink);color:var(--surface);border-color:var(--ink)}
.meal-filter-options{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:12px;align-items:end}
.meal-favorites{display:flex;gap:6px;align-items:center;min-height:48px;font-size:13px}
.meal-picker-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
.meal-tile{position:relative;display:flex;flex-direction:column;align-items:stretch;text-align:left;min-width:0;background:var(--surface);color:var(--ink);border:1px solid var(--line);border-radius:12px;overflow:hidden;padding:0}
.meal-tile[aria-pressed=true]{border-color:var(--ink);box-shadow:0 0 0 2px var(--ink)}
.meal-tile-photo{display:block;width:100%;height:106px;object-fit:cover;background:var(--soft)}
.meal-photo-missing{display:flex;justify-content:center;align-items:center;flex-direction:column;gap:5px;color:var(--muted)}
.meal-photo-missing>svg{width:26px;height:26px}
.meal-photo-missing>small{font-size:11px;color:var(--muted)}
.meal-tile-title{padding:9px 9px 4px;font-size:13px;line-height:1.35;font-weight:600;overflow-wrap:anywhere}
.meal-tile>small{padding:0 9px 10px;font-size:11px;color:var(--muted);margin-top:auto}
.meal-tile-mark{position:absolute;top:7px;right:7px;display:flex;align-items:center;justify-content:center;width:26px;height:26px;border-radius:50%;background:var(--surface);color:var(--ink);box-shadow:0 1px 4px #0002}
.meal-tile-mark svg{width:17px;height:17px}
.meal-tile[aria-pressed=true] .meal-tile-mark{background:var(--ink);color:var(--surface)}
.meal-picker-bottom{display:flex;align-items:center;justify-content:space-between;gap:12px;border-top:1px solid var(--line);padding-top:14px}
.meal-picker-bottom>div{min-width:0}
.meal-picker-bottom strong{font-size:14px}
.meal-picker-bottom small{display:block;font-size:12px;color:var(--muted);margin-top:4px}
#meal-set-form .meal-picker-bottom>.btn{display:flex;gap:7px;align-items:center;justify-content:center;padding:10px 13px;white-space:nowrap;min-height:46px;font-size:14px;flex-shrink:0}
.meal-set-total{font-size:20px;font-weight:650;font-variant-numeric:tabular-nums;overflow-wrap:anywhere}
.meal-custom-add{border:0;background:none;color:var(--ink);padding:9px 0;min-height:44px;display:flex;align-items:center;justify-content:center;gap:6px;font-size:13px;text-decoration:underline;text-underline-offset:3px}
.meal-custom-add svg{width:16px;height:16px}
.meal-empty{text-align:center;color:var(--muted);padding:22px 0}
.meal-picked-top{display:flex;justify-content:flex-end}
#meal-set-form .meal-picked-top>.btn{display:flex;align-items:center;gap:6px;min-height:42px;padding:8px 11px;font-size:13px}
.meal-picked-list{display:flex;flex-direction:column}
.meal-picked-row{display:grid;grid-template-columns:46px minmax(0,1fr) 110px 34px;align-items:center;gap:10px;border-bottom:1px solid var(--line);padding:14px 0;min-width:0}
.meal-picked-photo{width:46px;height:46px;border-radius:8px;object-fit:cover;background:var(--soft)}
.meal-picked-name{min-width:0}
.meal-picked-name>strong{display:block;font-size:13px;line-height:1.4;overflow-wrap:anywhere}
.meal-picked-name>small{display:block;color:var(--muted);font-size:12px;margin-top:5px}
.meal-weight{display:flex;align-items:center;gap:5px;min-width:0}
#meal-set-form .meal-weight input{width:88px;min-width:0;padding:9px 8px;text-align:right;font-variant-numeric:tabular-nums}
#meal-set-form .meal-weight>span:not(.sr-only){font-size:13px;flex-shrink:0}
#meal-set-form .meal-picked-remove{min-height:44px;width:34px;min-width:0;padding:6px;border:0}
.meal-custom-density{grid-column:2/-1}
.meal-picker-error{color:#a63425;font-size:13px}
#meal-set-form .meal-weight-hint{margin:0;font-size:12px}
[data-theme=fire] #meal-set-form .meal-filter-types [aria-pressed=true],[data-theme=fire] .meal-tile[aria-pressed=true] .meal-tile-mark{background:#ffb46e;color:#2c100c;border-color:#ffb46e}
[data-theme=fire] .meal-tile{color:var(--food-text,#fff5ed)}
[data-theme=fire] .meal-tile[aria-pressed=true]{border-color:#ffb46e;box-shadow:0 0 0 2px #ffb46e}
[data-theme=fire] .meal-picker-error{color:#ffb4a8}
@media(max-width:520px){.meal-picker-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.meal-tile-photo{height:104px}.meal-picked-row{grid-template-columns:42px minmax(0,1fr) 32px;gap:9px}.meal-picked-photo{width:42px;height:42px;grid-row:1 / span 2}.meal-picked-name{grid-column:2;grid-row:1}.meal-weight{grid-column:2;grid-row:2}.meal-picked-remove{grid-column:3;grid-row:1 / span 2}.meal-custom-density{grid-row:3;grid-column:2/-1}.meal-picker-bottom{gap:8px}.meal-set-total{font-size:18px}#meal-set-form .meal-picker-bottom>.btn{font-size:13px;padding:10px}.meal-filter-options{grid-template-columns:minmax(0,1fr)}}
@media(min-width:521px){.meal-weight:has(+.meal-picked-remove) .sr-only{position:absolute}}

/* Single portion uses the same compact header, photos and gram fields as the meal picker. */
#sheet[data-sheet-kind=food-entry] .sheet-head{padding:8px 16px 10px}
#sheet[data-sheet-kind=food-entry] .sheet-handle{margin-bottom:6px;height:3px;width:26px}
#sheet[data-sheet-kind=food-entry] .sheet-head h2{font:600 19px/1.25 system-ui,-apple-system,sans-serif}
#sheet[data-sheet-kind=food-entry] .sheet-body{padding:14px 16px max(18px,env(safe-area-inset-bottom));flex:0 1 auto}
#food-entry-form.portion-form{gap:14px}
.portion-food{min-width:0;padding-bottom:12px;border-bottom:1px solid var(--line)}
.portion-food-main{display:grid;grid-template-columns:88px minmax(0,1fr);gap:14px;align-items:center}
.portion-photo{display:block;width:88px;height:88px;border-radius:13px;object-fit:cover;background:var(--soft)}
.portion-photo-missing{display:flex;align-items:center;justify-content:center;color:var(--muted)}
.portion-photo-missing svg{width:30px;height:30px}
.portion-food-title{display:block;font-size:16px;font-weight:650;line-height:1.4;overflow-wrap:anywhere;color:var(--food-text)}
.portion-food-main small{display:block;font-size:12px;color:var(--muted);margin-top:7px}
#food-entry-form .portion-source{margin:7px 0 0}
#food-entry-form .portion-source summary{padding:6px 0 0;font-size:12px;color:var(--muted)}
#food-entry-form .portion-source[open]>summary{margin-bottom:10px}
.portion-weight-input{display:flex;align-items:center;gap:10px}
#food-entry-form .portion-weight-input input{flex:1;min-width:0;width:100%;font-size:20px;min-height:54px;padding:11px 13px;border-width:1px}
.portion-weight-input>span{font-size:16px;color:var(--muted);padding-right:4px}
#food-entry-form .portion-hint{margin:-6px 0 0;font-size:12px}
#food-entry-form .portion-add{align-self:flex-start;width:auto;display:inline-flex;flex-direction:row;gap:7px;min-height:42px;padding:8px 12px;font-size:13px;border-color:var(--line)}
.portion-add svg{width:17px;height:17px}
#food-entry-form .food-options{border-top:1px solid var(--line);padding-top:6px}
#food-entry-form .portion-action{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:12px;align-items:center;border-top:1px solid var(--line);padding:14px 0 0}
#food-entry-form .portion-action output{display:block;text-align:left;font-size:23px;font-weight:650;overflow-wrap:anywhere}
.portion-action small{display:block;font-size:11px;color:var(--muted);margin-top:4px}
#food-entry-form .portion-action .btn{display:flex;align-items:center;justify-content:center;gap:7px;width:auto;min-height:48px;padding:11px 16px;font-size:14px}
.portion-action .btn svg{width:18px;height:18px}
@media(max-width:360px){.portion-food-main{grid-template-columns:72px minmax(0,1fr);gap:11px}.portion-photo{width:72px;height:72px}.portion-food-title{font-size:14px}#food-entry-form .portion-action{gap:8px}#food-entry-form .portion-action output{font-size:20px}#food-entry-form .portion-action .btn{padding:10px;font-size:13px}}
