/* Chalk · Macros — styles (m-ui.js). Every class is prefixed m-; Chalk's own
   classes (.card .btn .chip .seg .stepper .ex-row .opt .stats .tag …) are reused as-is.
   HEADS UP (LK-01): this file loads BEFORE index.html's inline <style>, so a rule here that
   ties with an inline rule on specificity LOSES. To change a Chalk class, add a class to the
   selector (.card.m-slot .hd beats .card .hd; .seg.m-useg button beats .seg button). */
:root{ --fat:#C8742A; --pro:var(--mus); --carb:var(--acc); --ring-bg:var(--sur2); }
@media (prefers-color-scheme: dark){ :root:not([data-theme="light"]){ --fat:#F0A25C; } }
:root[data-theme="dark"]{ --fat:#F0A25C; }

/* ---- mode bar (Train | Macros): index.html styles the switch. Only these two still win over it
   (its .modebar svg is less specific), so they stay; the rest of the old block was dead. ---- */
.modebar{z-index:5}
.modebar button svg{width:20px;height:20px}

/* ---- shared bits ---- */
.m-row{width:100%;text-align:left;min-height:56px}
.m-row:active{background:var(--sur2)}
.m-kcal{font-family:"Barlow Condensed","Barlow",sans-serif;font-size:20px;font-weight:600;white-space:nowrap;flex:none;min-width:44px;text-align:right;font-variant-numeric:tabular-nums}
.m-clamp{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.m-btnrow{display:flex;gap:8px;margin-top:10px;flex-wrap:wrap}
.m-btnrow .btn{flex:1;min-width:0;padding:0 10px}
.m-btnrow.m-col{flex-direction:column}
.m-btnrow.m-col .btn{width:100%}
.m-armed{color:var(--warn) !important;border-color:var(--warn) !important}
.m-search{width:100%;min-height:48px;border-radius:12px;border:1px solid var(--line);background:var(--sur2);color:var(--ink);padding:0 14px;font-size:17px;font-weight:500;-webkit-appearance:none;appearance:none}
.m-search::-webkit-search-cancel-button{-webkit-appearance:none}
.m-status{min-height:20px;margin:8px 0}
.m-inner{margin:0}
.m-file{position:relative;cursor:pointer}
.m-file input{position:absolute;inset:0;opacity:0;width:0;height:0}
.m-ta{font:16px/1.4 "Barlow",-apple-system,sans-serif;min-height:96px}
.m-preview img{display:block;width:100%;max-height:220px;object-fit:cover;border-radius:12px;margin-top:10px}
.stat.pro .v{color:var(--pro)}.stat.carb .v{color:var(--carb)}.stat.fat .v{color:var(--fat)}
.stat.over .v{color:var(--warn)}
.m-stats4{grid-template-columns:repeat(4,1fr);gap:6px}
.m-stats4 .stat{padding:8px 6px}
.m-stats4 .stat .v{font-size:22px}
.m-stats4 .stat .k{font-size:10px}
.m-danger{color:var(--warn)}
.opt:disabled{opacity:.4}

/* ---- diary: day card ---- */
.m-day{padding-bottom:6px}
.m-dayhd{display:flex;align-items:center;justify-content:space-between;padding:8px 8px 0}
.m-dayhd .icon{width:44px;height:44px;font-size:30px;color:var(--ink)}
.m-daylbl{font-size:22px;font-weight:600;min-height:44px;padding:0 12px;display:inline-flex;align-items:center;gap:8px}
.m-dayrow{display:grid;grid-template-columns:120px 1fr;align-items:center;gap:14px;padding:4px 14px 0}
.m-ring{display:block;width:120px;height:120px}
.m-ring-bg{fill:none;stroke:var(--ring-bg);stroke-width:10}
.m-ring-fg{fill:none;stroke:var(--acc);stroke-width:10;stroke-linecap:round;transition:stroke-dashoffset .35s ease-out}
.m-ring.over .m-ring-fg{stroke:var(--warn)}
.m-ring-n{font-family:"Barlow Condensed","Barlow",sans-serif;font-size:36px;font-weight:700;fill:var(--ink);font-variant-numeric:tabular-nums;dominant-baseline:middle}
.m-ring.over .m-ring-n{fill:var(--warn)}
.m-ring-l{font-size:11px;font-weight:600;letter-spacing:.08em;text-transform:uppercase;fill:var(--mut)}
.m-daynums{display:flex;flex-direction:column;gap:10px}
.m-dn .v{display:block;font-family:"Barlow Condensed","Barlow",sans-serif;font-size:28px;font-weight:700;line-height:1;font-variant-numeric:tabular-nums}
.m-dn .k{display:block;font-size:12px;color:var(--mut);font-weight:600;letter-spacing:.05em;text-transform:uppercase;margin-top:3px}
.m-bars{display:flex;flex-direction:column;gap:8px;padding:12px 14px 4px}
.m-bar-h{display:flex;justify-content:space-between;font-size:13px;font-weight:600;margin-bottom:4px}
.m-bar-h .num{color:var(--mut);font-variant-numeric:tabular-nums}
.m-bar-t{height:8px;border-radius:4px;background:var(--sur2);overflow:hidden}
.m-bar-t i{display:block;height:100%;border-radius:4px;transition:width .3s ease-out}
.m-bar.pro .m-bar-t i{background:var(--pro)}.m-bar.carb .m-bar-t i{background:var(--carb)}.m-bar.fat .m-bar-t i{background:var(--fat)}
.m-bar.over .m-bar-t i{background:var(--warn)}
.m-bar.over .m-bar-h .num{color:var(--warn)}
.m-morebtn{display:flex;justify-content:center;padding:2px 14px 0}
.m-morebtn .btn{min-height:40px;border:0;color:var(--mut);font-size:14px}
.m-more{padding:4px 14px 8px}
.m-water{display:flex;justify-content:space-between;align-items:center;gap:10px;padding-top:6px;border-top:1px solid var(--line)}
.m-water .l{font-weight:600}.m-water .s{font-size:13px;color:var(--mut);font-variant-numeric:tabular-nums}
.m-water-b{display:flex;gap:6px}
.m-water-b .btn{min-width:52px;padding:0 10px;font-variant-numeric:tabular-nums}

/* ---- diary: slot cards ---- */
.m-slot .hd{align-items:center;padding-bottom:0}
.m-slot-r{display:flex;align-items:center;gap:6px}
.m-slot-kcal{color:var(--mut);font-size:14px;font-weight:600}
.m-slot .icon{width:44px;height:44px;font-size:24px;letter-spacing:.05em}
.m-slot-add{padding:4px 8px 8px}
.m-slot-add .btn{min-height:44px;border-style:dashed;color:var(--mut)}
.m-foot{display:flex;justify-content:space-between;align-items:center;gap:10px;padding:2px 2px 8px;flex-wrap:wrap}
.m-foot .chip{min-height:36px}

/* ---- add sheet ---- */
.m-pills{display:flex;gap:6px;overflow-x:auto;padding:2px 0 8px;-webkit-overflow-scrolling:touch;scrollbar-width:none}
.m-pills::-webkit-scrollbar{display:none}
.m-pills .chip{flex:none;min-height:36px;cursor:pointer}
.m-pills .chip.on{background:var(--acc);border-color:var(--acc);color:var(--acc-ink)}
.m-tools{display:grid;grid-template-columns:repeat(3,1fr);gap:6px;margin:10px 0 8px}
.m-tools button{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;min-height:52px;border-radius:12px;background:var(--sur2);border:1px solid var(--line);font-size:11px;font-weight:600;color:var(--mut);letter-spacing:.02em;text-align:center;line-height:1.1;padding:4px 2px}
.m-tools button span{font-size:18px;line-height:1;color:var(--ink)}
.m-seg{margin:0 0 6px}
.m-results{min-height:120px}
.m-results .ex-row{padding-left:4px;padding-right:4px}
.m-results .ex-div{padding-left:4px}
.m-offstate{padding:12px 4px}
.m-scan{width:100%;min-height:200px;background:#000;border-radius:12px;overflow:hidden;position:relative}
.m-scan.off{min-height:0;background:transparent}
.m-scan video{width:100% !important;display:block}
.m-scan img{display:none}
.m-coderow{display:flex;gap:8px;margin:4px 0 10px}
.m-coderow .m-search{flex:1;min-width:0}
.m-coderow .btn{flex:none}

/* ---- detail sheet ---- */
.m-det-name{font-family:"Barlow Condensed","Barlow",sans-serif;font-size:22px;font-weight:600;line-height:1.15;margin:0 0 10px}
.m-det-name .mut{font-family:"Barlow",sans-serif;font-size:14px;font-weight:500}
.m-det-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px;align-items:end}
.m-live{margin-top:12px;grid-template-columns:repeat(4,1fr);gap:6px}
.m-live .stat{padding:8px 6px}
.m-live .stat .v{font-size:22px}
.m-live .stat .k{font-size:10px}
.m-move{display:flex;flex-direction:column;gap:6px;margin-top:8px}

/* ---- forms (label / my foods / meal builder) ---- */
.m-form{display:flex;flex-direction:column;gap:8px}
.m-f{display:block}
.m-f>span{display:block;font-size:12px;font-weight:600;letter-spacing:.05em;text-transform:uppercase;color:var(--mut);margin:0 0 3px 2px}
.m-f>span em{font-style:normal;text-transform:none;letter-spacing:0;font-weight:500}
.m-f input[type="text"],.m-f input[type="number"],.m-f input[type="search"]{width:100%;min-height:44px;border-radius:10px;border:1px solid var(--line);background:var(--sur2);color:var(--ink);padding:0 12px;font-size:17px;font-weight:500;-moz-appearance:textfield}
.m-f input::-webkit-outer-spin-button,.m-f input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}
.m-f input[type="number"]{font-variant-numeric:tabular-nums}
.m-f .sel{min-height:44px}
.m-f3{display:grid;grid-template-columns:1fr 1fr 1fr;gap:8px}
.m-fgrid{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.m-badge{margin-bottom:2px}
.m-itot{display:flex;justify-content:space-between;align-items:center;gap:10px;padding:10px 4px;border-top:1px solid var(--line);font-size:14px;color:var(--mut)}
.m-itot b{color:var(--ink);font-size:18px;font-family:"Barlow Condensed","Barlow",sans-serif}
.m-mbedit{background:var(--sur2);border-radius:12px;padding:10px 12px;margin-top:8px}
.m-mbedit-n{font-weight:600;margin-bottom:6px}

/* ---- items list (photo / describe) ---- */
.m-item{padding-right:4px;gap:6px}
.m-istep{width:128px;flex:none;background:var(--sur)}
.m-istep input{font-size:20px}
.m-item .icon{width:36px;height:44px}

/* ---- suggest ---- */
.m-sughd{margin-bottom:4px}
.m-sughd .stats{margin:6px 0 10px}
.m-sug{margin-bottom:10px}
.m-sug .hd h3{font-size:20px}
.m-sugtags{display:flex;gap:4px;flex-wrap:wrap;margin-top:4px}
.m-sugdesc{margin:0 0 6px;font-size:15px;line-height:1.35}

/* ---- foods tab ---- */
.m-foodsbar{display:flex;gap:8px}
.m-foodsbar .m-search{flex:1;min-width:0}
.m-foodsbar .btn{flex:none;padding:0 14px}
.m-mealitems .ex-row{padding:8px 4px}

/* ---- narrow phones ---- */
@media (max-width:360px){
  .m-tools button{font-size:10px}
  .m-dayrow{grid-template-columns:104px 1fr;gap:10px}
  .m-ring{width:104px;height:104px}
}

/* "Not here? Add it as a new food" row at the end of search results */
.m-addnew{display:block;width:100%;text-align:left;padding:14px 4px;border-top:1px solid var(--line);color:var(--acc);font-size:15px;min-height:48px}
.m-addnew b{font-weight:700;margin-right:4px}

/* ---- raw (cooked) amounts on the servings screen ---- */
.m-det-amt{margin:10px 2px 0;font-size:15px;font-weight:600;text-align:center;font-variant-numeric:tabular-nums}
.m-det-of{margin:8px 2px 0;font-size:13px;font-weight:600;color:var(--mut);text-align:center;font-variant-numeric:tabular-nums}
.m-howmuch{font-family:"Barlow Condensed","Barlow",sans-serif;font-size:20px;font-weight:600;margin:0 0 8px}
.m-useg{display:flex;width:100%}
.m-useg button{flex:1;min-height:52px;font-size:17px}
.m-det-inmeal{margin-top:14px;padding-top:12px;border-top:1px solid var(--line)}
.m-batchinfo{margin:0 0 6px}
.m-batchinfo .t{font-size:13px;color:var(--mut);font-variant-numeric:tabular-nums}

/* ---- suggestion items with amounts ---- */
.m-sugitems{list-style:none;margin:8px 0 0;padding:0;font-size:13px}
.m-sugitems li{display:flex;justify-content:space-between;align-items:baseline;gap:10px;padding:5px 0;border-top:1px solid var(--line)}
.m-sugitems li:first-child{border-top:0}
.m-sugitems .n{min-width:0;overflow-wrap:anywhere}
.m-sugitems .n{flex:1}
.m-sugitems .a{color:var(--mut);text-align:right;white-space:nowrap;flex:none;font-variant-numeric:tabular-nums}

/* ---- meal builder: cooked as a batch ---- */
.m-mbslot{grid-column:span 2}
.m-mbrow.batch .m-mbslot{grid-column:1/-1}
.m-mbrow.batch .m-mbsm{display:none}
.m-batch{margin-top:12px;border-top:1px solid var(--line);padding-top:4px}
.m-switch{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;min-height:52px;text-align:left;font-weight:600;font-size:16px}
.m-switch-t{min-width:0}
.m-batchbox{padding:2px 0 4px}
.m-wrow{display:flex;gap:8px;align-items:stretch}
.m-wrow input{flex:1;min-width:0}
.m-wseg{flex:none}
.m-wseg button{min-height:44px;min-width:46px}

/* ---- food form: weighs less after cooking? ---- */
.m-cookseg{margin:0}
.m-cookseg button{font-size:14px;padding:11px 4px}
.m-cookrow{display:flex;align-items:center;gap:8px;margin-top:8px;flex-wrap:wrap;font-size:15px}
.m-cookrow span{color:var(--mut)}
.m-f .m-cookrow input[type="number"]{width:86px;flex:none;text-align:center}

/* ---- Train → Today summary ---- */
.m-trainsum{padding:10px 12px}
.m-ts{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr) auto;align-items:center;gap:12px}
.m-ts-v{font-size:13px;color:var(--mut);white-space:nowrap;font-variant-numeric:tabular-nums;overflow:hidden;text-overflow:ellipsis}
.m-ts-v b{font-family:"Barlow Condensed","Barlow",sans-serif;font-size:22px;font-weight:700;color:var(--ink)}
.m-ts-k{font-size:11px;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--mut);margin-top:1px;white-space:nowrap}
.m-ts-bar{height:5px;border-radius:3px;background:var(--sur2);overflow:hidden;margin-top:6px}
.m-ts-bar i{display:block;height:100%;border-radius:3px;background:var(--carb)}
.m-ts-c.pro .m-ts-bar i{background:var(--pro)}
.m-ts-c.over .m-ts-bar i{background:var(--warn)}
.m-ts-go{min-height:44px;padding:0 14px;font-size:17px}

/* ---- storage full ---- */
.m-warn{border-color:var(--warn);background:var(--warn-soft)}
.m-warn .bd{padding:12px 14px;font-size:14px;line-height:1.35}
.m-warn b{color:var(--warn)}

/* Chalk's .stats (3 columns) loads after this file: win on specificity so the four
   kcal / protein / carbs / fat tiles stay on one row; the unit select matches the stepper. */
.stats.m-live,.stats.m-stats4{grid-template-columns:repeat(4,minmax(0,1fr))}
.stats.m-live .stat .v,.stats.m-stats4 .stat .v{white-space:nowrap}
.m-det-grid select.sel{min-height:54px}
@media (max-width:380px){
  .stats.m-live .stat .v,.stats.m-stats4 .stat .v{font-size:20px}
  .stats.m-live .stat .v small,.stats.m-stats4 .stat .v small{font-size:11px;margin-left:1px}
}

.m-warnline{color:var(--warn);margin:6px 0 0}

/* ---- F2a ---- */
/* Log food: all seven tools in two rows of four, a stroke icon over each name (DY-03);
   while the search box is in use the tools and the Recent / Meals / Foods row step aside
   so results sit above the keyboard (on Meals that row stays, so the way back shows: DY-01) */
.m-tools{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px;overflow:visible;margin:10px 0;padding:0}
.m-tools button{flex-direction:column;justify-content:flex-start;gap:4px;min-height:58px;padding:9px 2px 6px;border-radius:12px;font-size:12px;line-height:1.1;white-space:normal;color:var(--ink);min-width:0}
.m-tools button svg{width:22px;height:22px;flex:none;fill:none;stroke:var(--acc);stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}
.m-tools button .m-tool-l{font-size:12px;line-height:1.1;color:var(--ink);overflow-wrap:anywhere}
.m-add.m-typing .m-tools,.m-add.m-typing .m-seg{display:none}
.m-add.m-typing.m-inmeals .m-seg{display:flex;margin-top:10px}
@media (max-width:340px){ .m-pills{-webkit-mask-image:linear-gradient(90deg,#000 82%,transparent);mask-image:linear-gradient(90deg,#000 82%,transparent)} }
.m-searchbox{position:relative}
.m-searchbox .m-search{padding-right:48px}
.m-clear{position:absolute;right:2px;top:50%;transform:translateY(-50%);width:44px;height:44px;font-size:22px;color:var(--mut);border-radius:22px}
.m-clear[hidden]{display:none}
.m-pills .chip{min-height:44px;padding:0 14px}
.m-seg button{min-height:44px}
.m-keepcase,.btn.m-keepcase{text-transform:none;letter-spacing:0}
.m-results .n,.m-det-name,.ex-row .n{overflow-wrap:anywhere}
.m-offstate{padding:12px 4px}
/* servings screen: unit on its own full-width row, then the amount, then one amount line */
.m-det-u .sel,.m-det-u .m-useg{width:100%;min-height:52px}
.m-det-q{margin-top:10px}
.m-det-u .lbl,.m-det-q .lbl{display:block;margin-bottom:4px}
.m-det-amt{margin:10px 2px 0}
.m-back{min-height:44px;padding:0 6px;margin:-6px 0 4px -6px;font-size:16px;font-weight:600;color:var(--acc)}
.m-move[hidden],.m-cookrow[hidden]{display:none}
.m-inline{min-height:36px;padding:0 12px;margin-left:6px;vertical-align:middle}
#m-det-msg:empty,#m-qa-msg:empty{display:none}
/* Diary */
.m-backtoday{display:flex;justify-content:center;padding:4px 14px 0}
.m-backtoday .btn{min-height:44px;font-size:14px}
.m-morebtn .btn{min-height:44px}
.m-water-b .btn{min-width:0;padding:0 12px;white-space:nowrap}
.m-slot .icon,.m-dayhd .icon{min-width:44px;min-height:44px}
/* Train → Today summary: labels shrink before they overflow */
.m-ts-k{overflow:hidden;text-overflow:ellipsis;text-transform:none;letter-spacing:0;font-size:12px}
.m-quick .m-f3{grid-template-columns:repeat(3,minmax(0,1fr))}
/* short phones (VI-04): the big "+ Log food" button stays, just a bit smaller */
@media (max-height:700px){ #cta:has([data-m="add"]){padding-top:6px;padding-bottom:4px} #cta:has([data-m="add"]) .btn{min-height:46px;font-size:19px} }
/* fat is violet, so it never looks like carbs or like "over" (decision 5) */
:root:not([data-theme="dark"]){ --fat:#7B4FC4; }
@media (prefers-color-scheme: dark){ :root:not([data-theme="light"]){ --fat:#B69CF5; --ring-bg:#2F363F; } }
:root[data-theme="dark"]{ --fat:#B69CF5; --ring-bg:#2F363F; }
/* over (decision 3): protein over is good news (green number); carbs and fat keep their
   color with a small red end-cap and a red number; only the calorie ring turns red */
.m-bar.pro{--c:var(--pro)} .m-bar.carb{--c:var(--carb)} .m-bar.fat{--c:var(--fat)}
.m-bar.over .m-bar-t i{background:var(--c)}
.m-bar.carb.over .m-bar-t i,.m-bar.fat.over .m-bar-t i{box-shadow:inset -8px 0 0 var(--warn)}
.m-bar.carb.over .m-bar-h .num,.m-bar.fat.over .m-bar-h .num{color:var(--warn)}
.m-bar.pro.over .m-bar-h .num{color:var(--ok)}
.m-ts-c.pro.over .m-ts-bar i{background:var(--pro)}
.m-bar-t,.m-ts-bar{background:var(--ring-bg)}
/* Log food keeps one height while typing, so the search box never jumps (VI-07) */
.sheet:has(#m-search){height:84%}
/* meal cards (VI-05, VI-19): a centered ⋯, calories in the number font, an empty meal is one line with a small + */
.m-slot .ex-row{padding-right:14px}
.m-slot .hd{padding-right:6px}
.m-slot-kcal{font:600 18px/1 "Barlow Condensed","Barlow",sans-serif;color:var(--mut);font-variant-numeric:tabular-nums}
.m-slot .icon{display:inline-flex;align-items:center;justify-content:center;line-height:1}
.m-slot.m-empty .hd{padding-bottom:8px}
.m-slot .icon.m-slot-plus{font-size:28px;font-weight:500;color:var(--acc)}
@media (prefers-color-scheme: dark){ :root:not([data-theme="light"]) .m-slot-add .btn{border-color:var(--mut)} }
:root[data-theme="dark"] .m-slot-add .btn{border-color:var(--mut)}
/* batch portion: one line under the stepper ("12 oz cooked · of 51 oz batch") */
.m-det-line{margin:10px 2px 0;text-align:center;font-size:15px;font-weight:600;font-variant-numeric:tabular-nums}
.m-det-line .m-det-amt,.m-det-line .m-det-of{display:inline;margin:0;font-size:15px}
.m-det-line .m-det-of{color:var(--mut)}
.m-det-line .m-det-of:not(:empty)::before{content:" · "}
/* Log food: group headers in grey; a small "Meal" tag on saved meals (VI-20) */
.m-results .ex-div{color:var(--mut)}
.m-mealtag{display:inline-block;vertical-align:2px;margin-left:6px;padding:1px 7px;border-radius:999px;background:var(--acc-soft);color:var(--acc);font:700 11px/1.5 "Barlow",sans-serif;letter-spacing:.04em;text-transform:uppercase}
/* CP-03: typed words keep their own case on the big buttons */
.btn.primary.m-keepcase,.btn.m-keepcase,.m-keepcase{text-transform:none;letter-spacing:0}
/* day card (VI-09): eaten and target side by side */
.m-daynums{flex-direction:row;justify-content:space-evenly;align-items:center;text-align:center}
/* servings screen: labels line up on the left (VI-06); ‹ Back and the name on one row (VI-12) */
.m-det .lbl,.m-quick .lbl,.m-det-grid .lbl{text-align:left;margin:0 0 4px 2px}
.m-det-top{display:flex;align-items:center;gap:6px;margin:-6px 0 8px}
.m-det-top .m-back{flex:none;margin:0 0 0 -6px}
.m-det-top .m-det-name{flex:1;min-width:0;margin:0}
.stats.m-live .stat .k,.stats.m-stats4 .stat .k{font-size:11px}
/* streak chip (VI-18) */
.m-foot .chip.m-streak{background:var(--acc-soft);color:var(--acc);border-color:transparent;min-height:44px}
.m-foot .btn{min-height:44px}
/* Train → Today calories row on a narrow phone (VI-13) */
@media (max-width:360px){ .m-ts{grid-template-columns:1fr 1fr} .m-ts-go{grid-column:1/-1} }
/* ring number: four digits with a comma get a little smaller so they clear the ring */
.m-ring-n.lg{font-size:31px}
.m-ring-n.xl{font-size:26px}
/* borrowed phone: the diary is still coming down from the cloud */
.m-catch{margin:0 0 10px;padding:10px 14px;border-radius:12px;background:var(--acc-soft);color:var(--acc);font-size:14px;font-weight:600;text-align:center}
/* ---- F2a round 5 ---- */
/* LK-01: these used to tie with Chalk's inline rules and lose (see the note at the top) */
.card.m-slot .hd{align-items:center;padding:12px 6px 0 14px}
.card.m-slot.m-empty .hd{padding-bottom:8px}
.card.m-sug .hd h3{font-size:20px}
.seg.m-useg{display:flex;width:100%}
.seg.m-useg button{font-size:17px}
.seg.scope.m-cookseg button{padding:6px 4px}
.stats.m-live,.stats.m-stats4{gap:6px}
/* LK-02: seven tools fill two rows (4 + 3) on a 12-column grid; six tools (meal builder) are 3 + 3 */
.m-tools{grid-template-columns:repeat(12,minmax(0,1fr))}
.m-tools>button{grid-column:span 3}
.m-tools>button:nth-child(n+5):nth-last-child(-n+3),
.m-tools>button:first-child:nth-last-child(6),.m-tools>button:first-child:nth-last-child(6)~button{grid-column:span 4}
/* short phones: a taller sheet, flat tool buttons (icon beside the name), smaller gaps */
@media (max-height:700px){
  .sheet:has(#m-search){height:92%;max-height:92%}
  .sheet:has(#m-search) .sh{padding-top:10px;padding-bottom:4px}
  .m-add .m-pills{padding-bottom:6px}
  .m-tools{gap:6px;margin:8px 0 6px}
  .m-tools>button{flex-direction:row;justify-content:center;align-items:center;gap:5px;min-height:44px;padding:4px 4px;text-align:left}
  .m-tools>button svg{width:18px;height:18px}
  .seg.scope.m-seg{margin:0 0 4px}
}
/* short AND narrow (320 px): the name goes back under the icon so "barcode" never breaks */
@media (max-height:700px) and (max-width:360px){
  .m-tools>button{flex-direction:column;gap:2px;padding:4px 2px;text-align:center}
}
/* LK-12: fiber, sugar and sodium are plain numbers, not buttons */
.m-nutri{display:flex;flex-wrap:wrap;gap:4px 16px;margin:2px 0 10px;font-size:14px;color:var(--mut)}
.m-nutri b{color:var(--ink);font-weight:600}
/* PL-15: the streak chip's gold text reads at 4.5:1 in light mode */
:root:not([data-theme="dark"]) .m-foot .chip.m-streak{color:#7A4F06}
@media (prefers-color-scheme: dark){ :root:not([data-theme="light"]) .m-foot .chip.m-streak{color:var(--acc)} }
.m-foot .chip.m-streak{gap:5px}
/* PL-08: small labels are 12 px at least (tile names, the ring's "left", the Meal tag) */
.stats.m-live .stat .k,.stats.m-stats4 .stat .k{font-size:12px}
.m-ring-l{font-size:12px}
.m-mealtag{font-size:12px}
@media (max-width:360px){ .stats.m-live .stat .k,.stats.m-stats4 .stat .k{letter-spacing:0} }

/* ---- F2b ---- */
/* parts hidden with the hidden attribute (a display rule would otherwise keep them on screen) */
.m-cookf[hidden],.m-cookopen[hidden],#m-label-type[hidden],#m-ff-gwarn[hidden],#m-ff-msg[hidden],#m-mb-warn[hidden],#m-mb-msg[hidden],#m-meal-msg[hidden]{display:none}
/* food form: "Does the weight change when cooked?" */
.m-cookseg{display:flex;width:100%}
.m-cookseg button{flex:1 1 0;min-height:52px;line-height:1.2;padding:6px 4px}
.m-cookseg button small{display:block;font-size:12px;font-weight:500;opacity:.85;margin-top:2px}
.btn.m-cookopen{font-size:14px;text-transform:none;letter-spacing:0;color:var(--acc)}
#m-ff-msg,#m-mb-msg,#m-meal-msg{font-size:14px;font-weight:600}
/* an item set to 0 */
.m-zero{color:var(--warn);font-weight:600}
/* meal builder: a draft from before, and the batch tip */
.m-resume{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:6px 6px 6px 12px;border:1px dashed var(--line);border-radius:12px;font-size:14px;font-weight:600}
.m-resume .btn{min-height:44px;padding:0 12px;flex:none}
.m-batchtip{font-size:14px;color:var(--ink);line-height:1.35;margin:6px 0 10px}
.m-mbsm>span{white-space:nowrap}
/* meal sheet: "What's in it" under the amount of a batch */
.m-inlbl{margin:14px 2px 0;font-size:12px;font-weight:600;letter-spacing:.05em;text-transform:uppercase;color:var(--mut)}
/* armed Delete / Cancel / Start over take the whole row so "Tap again to …" fits */
.m-btnrow>.btn.m-armed[data-m="meal-del"],.m-btnrow>.btn.m-armed[data-m="ff-del"]{flex:1 1 100%}
.btn.m-armed[data-m="mb-cancel"],.btn.m-armed[data-m="mb-fresh"],.btn.m-armed[data-m="mb-save"],.btn.m-armed[data-m="ff-save"],.btn.m-armed[data-m="ff-save-add"],.btn.m-armed[data-m="ff-log"]{text-transform:none;letter-spacing:0}
.m-resume .btn.m-armed{flex:1 1 auto;white-space:normal}
/* Foods tab starts at the same height as the other tabs */
#app>.seg.scope.m-seg:first-child{margin-top:0}
/* Chalk's .hint loads after this file: warnings keep the warning color, the batch tip keeps its space */
.hint.m-warnline{color:var(--warn)}
.hint.m-batchtip{color:var(--ink);font-size:14px;margin:8px 0 12px}
/* describe / label: an empty status line leaves no gap */
#m-desc-status:empty{min-height:0;margin:6px 0}
#m-label-status:empty{min-height:0;margin:0}
/* idea cards: "Add to Breakfast" stays on one line; "Save as meal" takes the rest (or its own row on a narrow phone) */
.m-sug .m-btnrow>.btn{flex:1 1 auto}
.m-sug .m-btnrow>.btn.primary{min-width:auto;white-space:nowrap}
/* barcode hit with calories but no protein, carbs or fat */
.m-offwarn{margin:0 0 10px;padding:10px 12px;border-radius:10px;background:var(--warn-soft);color:var(--warn);font-weight:600;font-size:14px;line-height:1.35}
/* "Deleted … · Undo" bar on the Foods tab */
.m-undo{display:flex;align-items:center;gap:10px;margin:0 0 10px;padding:6px 6px 6px 14px;border-radius:12px;background:var(--acc-soft);color:var(--ink)}
.m-undo>span{flex:1 1 auto;min-width:0;overflow-wrap:anywhere;font-weight:600;font-size:14px}
.m-undo>.btn{flex:0 0 auto;min-height:44px}
/* meal description: two lines, the whole text shows */
.m-f textarea.m-mbdesc{min-height:64px;resize:none;font:17px/1.35 "Barlow",-apple-system,sans-serif;font-weight:500;padding:10px 12px;border-radius:10px}
/* ---- F2b round 4 ---- */
/* Saved meals: meal-time chips under the search box (FD-06), counts in the headers, the other person's tag (FX-09) */
.m-mslots{margin:-2px 0 4px}
.m-mslots .chip{min-height:44px;padding:0 14px}
@media (max-width:420px){ .m-mslots{-webkit-mask-image:linear-gradient(90deg,#000 88%,transparent);mask-image:linear-gradient(90deg,#000 88%,transparent)} }
.sec .m-cnt{color:var(--mut);font-weight:600}
.tag.m-who{margin-left:6px;vertical-align:2px;font-size:11px}
.btn.m-inline{display:flex;margin:10px auto 0;min-height:44px}
/* scan: what to do after a failed lookup or a blocked camera (SC-02, OF-01, IO-02) */
#m-scan-act{margin:6px 0 10px}
.btn.m-codepick{margin-top:8px}
#m-scan-act:empty{display:none}
/* the camera never grows past the sheet (landscape, IO-06); the aiming box follows the video's box */
#sheetB .m-scan video{max-height:min(56dvh,420px);width:100%;object-fit:cover}
/* batch: "That's 2250 oz cooked…" with a "Use 2250 g" button (WK-04) */
#m-mb-warn .btn.m-usealt{display:flex;margin-top:8px;min-height:44px;text-transform:none;letter-spacing:0;color:var(--ink)}
/* ---- F2b round 5 ---- */
/* Describe: a part nothing matched (PL-01), in a warning box with its two ways out */
.m-unfound{display:grid;gap:8px;margin:10px 0 6px}
.m-unf{padding:10px 12px 12px;border-radius:12px;background:var(--warn-soft);border:1px solid var(--warn)}
.m-unf>.m-warnline{margin:0;font-weight:600;font-size:15px;line-height:1.35}
.m-unf>.m-btnrow{margin-top:8px;flex-wrap:nowrap}
.m-unf>.m-btnrow>.btn{min-height:44px;height:auto;line-height:1.2;padding:6px 10px;white-space:normal}
.m-unf>.m-btnrow>.btn:first-child{flex:2 1 0}
.m-unf>.m-btnrow>.btn:last-child{flex:1 1 0}
.m-unfq{margin-top:10px}
.m-unfq[hidden]{display:none}
.m-unfq .m-warnline:empty{display:none}
.m-unfq>.btn{margin-top:10px}
/* PL-09: Describe rows: 44 × 44 steppers, and × keeps a 6 px gap from +
   (.stepper.sm in the selector: index.html's own .stepper.sm rules load later and win ties) */
.m-item>.stepper.sm.m-istep{width:136px;grid-template-columns:44px 1fr 44px}
.m-item>.stepper.sm.m-istep button,.m-item>.stepper.sm.m-istep input{height:44px}
.m-item>.icon{width:44px;height:44px;margin:0}
.m-mbedit .stepper.sm{grid-template-columns:44px 1fr 44px}
.m-mbedit .stepper.sm button,.m-mbedit .stepper.sm input{height:44px}

/* ---- sharing between Nick and Katerina (M.share): inbox cards on the Diary, a waiting line, a Train nudge ---- */
.card.m-share{border:1px solid var(--acc);box-shadow:var(--shadow)}
.card.m-share .hd h3{font-size:20px}
.card.m-share .m-btnrow{margin-top:4px}
.card.m-share .m-btnrow>.btn.primary{flex:2 1 auto;white-space:nowrap}
.card.m-share-out .bd{padding-top:10px;padding-bottom:10px}
.card.m-share-note .srow{padding:10px 14px}
/* the entry and meal sheets' rows hold four buttons: Send gets its own full line so the others stay one line each */
.m-btnrow>.btn[data-m="share-entry"],.m-btnrow>.btn[data-m="share-meal"]{flex:1 1 100%;order:9;white-space:nowrap}
