/* Chalk · Macros — Trends + You + check-ins (classes prefixed mt-). Chalk tokens only.
   This file loads BEFORE index.html's inline <style>, so a rule here that has the same
   specificity as an inline one (".mt-x" vs ".icon", ".mt-card .hd" vs ".card .hd") loses.
   Add a class to the selector (".icon.mt-x", ".card.mt-card .hd") when you override Chalk. */

/* cards + layout */
.card.mt-card .hd{align-items:center}
.mt-card .stats{margin:2px 0 8px;min-width:0;grid-template-columns:repeat(3,minmax(0,1fr))}
.mt-card .stat{min-width:0;padding:10px 9px;overflow:hidden}
.mt-card .stat .v{font-variant-numeric:tabular-nums;white-space:nowrap;font-size:26px}
.mt-card .stat .v small{margin-left:2px}
.mt-card .stats .stat .k{font-size:11px;letter-spacing:.03em;line-height:1.2;overflow-wrap:anywhere}
.mt-card .stat .mt-sub{font-size:12px;color:var(--mut);font-variant-numeric:tabular-nums;margin-top:1px;white-space:nowrap}
.mt-empty{padding:22px 8px;text-align:center;color:var(--mut);font-size:14px;line-height:1.4}
.mt-empty b{color:var(--ink);font-weight:600}
.mt-text{margin:0 0 10px;font-size:15px;line-height:1.4}
.mt-row{display:flex;align-items:center;gap:8px}
.mt-row .btn{flex:none}
.mt-wrap{flex-wrap:wrap}
.mt-wrap .btn{flex:1 1 auto;min-width:0}
.hint.mt-goalline{margin:0 0 6px}
.mt-warn{color:var(--warn)}

/* one range row above both charts */
.mt-rangebar{display:flex;align-items:center;justify-content:space-between;gap:10px;margin:12px 0 10px}
.mt-rl{font-size:13px;color:var(--mut);font-weight:600}
.seg.mt-range button{padding:0 12px;font-size:14px;min-width:44px;min-height:44px}
.mt-sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}

/* charts (SVG; all colors from tokens; readable in both themes) */
.mt-chart{width:100%;height:auto;display:block;margin-top:4px;font-variant-numeric:tabular-nums;overflow:visible}
.mt-chart text{fill:var(--mut);font-size:11px;font-family:"Barlow",-apple-system,sans-serif;font-variant-numeric:tabular-nums}
.mt-chart .g{stroke:var(--line);stroke-width:1}
.mt-chart .ax{stroke:var(--line);stroke-width:1}
.mt-chart .pt{fill:var(--acc);stroke:var(--sur);stroke-width:1.5;opacity:.55}
.mt-chart .last{fill:var(--acc);stroke:var(--sur);stroke-width:2}
.mt-chart .avg{fill:none;stroke:var(--acc);stroke-width:2;stroke-linejoin:round;stroke-linecap:round}
.mt-chart .goal{stroke:var(--ok);stroke-width:1.5;stroke-dasharray:5 4}
.mt-chart .tgt,.mt-chart .tgt-k{stroke:var(--ok);stroke-width:1.5;stroke-dasharray:5 4}
.mt-chart .ll{fill:var(--ink);font-weight:700;font-size:12px;paint-order:stroke;stroke:var(--sur);stroke-width:3px;stroke-linejoin:round}
/* goal / target label on a plate at the left; lines never run through the words */
.mt-pill rect{fill:var(--sur);stroke:var(--ok);stroke-width:1}
.mt-pill text{fill:var(--ink);font-weight:600;font-size:11px}
.mt-pill.off rect{stroke:var(--line)}
/* bar charts name the target line in a band above the bars */
.mt-chart .mt-key text{fill:var(--ink);font-weight:600}
/* tap readout */
.mt-chart[data-pts]{cursor:pointer;-webkit-tap-highlight-color:transparent}
.mt-tip line{stroke:var(--ink);stroke-width:1;opacity:.45}
.mt-tip circle{fill:var(--acc);stroke:var(--sur);stroke-width:2}
.mt-chart.mus .mt-tip circle{fill:var(--mus)}
.mt-tip rect{fill:var(--ink)}
.mt-tip text{fill:var(--sur);font-weight:700;font-size:11px}
.mt-chart .bar{fill:var(--acc)}
.mt-chart .bar-e{fill:none;stroke:var(--line);stroke-width:1;stroke-dasharray:3 2}
.mt-chart.mus .pt,.mt-chart.mus .last,.mt-chart.mus .bar{fill:var(--mus)}
.mt-chart.mus .avg{stroke:var(--mus)}

/* log body sheet */
.mt-form .entry{margin-top:2px}
.mt-daterow{margin-top:10px}
input.mini.mt-date{text-align:left;padding:0 12px;-webkit-appearance:none;appearance:none}
input.mini.mt-date::-webkit-date-and-time-value{text-align:left}
.mt-savebtn{margin-top:12px}
.mt-list{display:flex;flex-direction:column;margin-top:4px}
.mt-brow{display:grid;grid-template-columns:58px 1fr auto 44px;align-items:center;gap:8px;padding:2px 0;border-top:1px solid var(--line);min-height:48px}
.mt-brow:first-child{border-top:0}
.mt-brow .d{font-weight:600;white-space:nowrap}
.mt-brow .k{color:var(--mut);min-width:0}
.mt-brow .v{white-space:nowrap;font-weight:600}
.icon.mt-x{width:44px;height:44px;margin:0}
.icon.mt-x.mt-arm{width:auto;min-width:44px;padding:0 10px;color:var(--warn);font-size:13px;font-weight:700;background:var(--warn-soft);border-radius:9px}
.mt-older{margin-top:6px}
.hint.mt-last{margin:8px 0 0}
.mt-form .lbl{line-height:1.25}
/* a message under a form (sheets hide toasts) */
.mt-msg{margin:10px 0 0;color:var(--warn);font-size:14px;font-weight:600;line-height:1.35}
.mt-msg[hidden]{display:none}
.mt-wmsg{margin:0;padding:0 14px 12px;display:flex;flex-wrap:wrap;align-items:center;gap:8px}
.mt-wmsg .btn{min-height:44px;padding:0 14px}

/* You: numbers */
.mt-ctl{display:inline-flex;align-items:center;gap:6px;flex:none}
.mt-ctl input.mini{width:74px}
/* example values look like hints, not like numbers already filled in */
.mt-card input.mini::placeholder,.mt-form input.mini::placeholder,.mt-b14 input.mini::placeholder{font-family:"Barlow",-apple-system,sans-serif;font-weight:400;font-size:14px;color:var(--mut);opacity:1}
.mt-card [data-row].mt-need{box-shadow:inset 3px 0 0 var(--warn);background:var(--warn-soft)}
.hint.mt-pacehint{margin:6px 0 0}
.mt-pacehint[hidden]{display:none}
.mt-nowrap{white-space:nowrap;flex:none}
.mt-manrow{min-height:56px}
.mt-card .srow .seg button{min-height:44px}
/* 44 px to tap: number boxes, the key link (the manual switch: see round 5 at the end) */
.mt-card input.mini,.mt-form input.mini,.mt-b14 input.mini{height:44px}
.mt-keyhint a{display:inline-block;padding:13px 0;margin:-13px 0}
.mt-hgt input.mini{width:56px}
.mt-u{font-size:13px;color:var(--mut);font-weight:600}
.mt-field{padding:8px 14px 4px}
.mt-field .l{font-weight:500;margin-bottom:6px}
.mt-field-flat{padding:10px 0 0}
.mt-card .srow .seg{flex:none}
@media (max-width:360px){.mt-ctl input.mini{width:64px}.mt-hgt input.mini{width:48px}}

/* You: split options + custom % */
.mt-opts{padding:0 14px}
.mt-opt>span:first-child{display:flex;flex-direction:column;gap:2px;min-width:0}
.mt-opt>span:first-child b{font-weight:600}
.opt.mt-opt .m{flex:none;font-size:18px;font-weight:700}
.opt.mt-opt.cur .m{color:var(--acc)}
.mt-custom{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;padding:10px 14px 0}
.mt-sumrow{display:flex;justify-content:space-between;align-items:center;gap:10px;padding:8px 14px 4px}
.mt-tgrid{grid-template-columns:repeat(3,1fr);padding:0 14px;margin:8px 0 4px}
.mt-tgrid .stat .v input.mini{height:44px;font-size:22px;width:100%}
.mt-card>.hint,.mt-tbox>.hint{padding:0 14px 8px;margin:0}

/* You: AI card */
.mt-status{display:flex;align-items:flex-start;gap:8px;font-size:14px;line-height:1.35;margin:2px 0 10px}
.mt-status i{width:10px;height:10px;border-radius:50%;background:var(--mut);flex:none;margin-top:5px}
.mt-status.ok i{background:var(--ok)}
.mt-status.warn i{background:var(--warn)}
.hint.mt-keyhint{margin:8px 0 0}
.mt-keyhint a{color:inherit;text-decoration:underline}
.mt-testrow{margin-top:14px}
.mt-key{display:flex;gap:8px;align-items:center}
.mt-key input{flex:1;min-width:0;height:44px;border-radius:12px;border:1px solid var(--line);background:var(--sur2);color:var(--ink);padding:0 12px;font-family:ui-monospace,Menlo,monospace;font-size:16px}
.mt-key .btn{flex:none;padding:0 14px}
.mt-row #mt-ai-msg{min-width:0}

/* You: sync & backup */
.mt-sync .bd>.hint{margin:0 0 10px}
.mt-quiet{color:var(--mut);margin:0}
.mt-code{background:var(--sur2);border:1px solid var(--line);border-radius:12px;padding:10px 8px;margin:2px 0 8px;text-align:center;font-family:"Barlow Condensed","Barlow",sans-serif;font-size:22px;font-weight:700;letter-spacing:.05em;line-height:1.15;font-variant-numeric:tabular-nums;overflow-wrap:anywhere;-webkit-user-select:all;user-select:all}
.mt-codebtns{display:flex;gap:8px;margin:0 0 8px}
.mt-codebtns .btn{flex:1 1 0;min-width:0;min-height:44px}
.mt-sync .bd>.mt-codehint{margin:0 0 12px}
.lbl.mt-codelbl{margin:6px 0 6px}
.mt-sync .bd>.mt-synchow{margin:-4px 0 12px}
/* the steps for the other phone, right after Start */
.mt-steps p{margin:0}
.mt-steps ol{margin:6px 0 0;padding-left:22px}
.mt-steps li{margin:3px 0 0;padding-left:2px}
/* More options: Turn off, Change code, Delete cloud copy */
.mt-more{border-top:1px solid var(--line);margin-top:10px}
/* summary stays a block (older iPhone Safari can't make it a flex box); the arrow sits at the right */
.mt-more>summary{display:block;position:relative;min-height:44px;line-height:44px;padding-right:30px;cursor:pointer;list-style:none;font-weight:600;font-size:15px;color:var(--mut);-webkit-tap-highlight-color:transparent}
.mt-more>summary::-webkit-details-marker{display:none}
.mt-more>summary::marker{content:""}
.mt-more>summary::after{content:"";position:absolute;right:8px;top:50%;width:8px;height:8px;margin-top:-7px;border-right:2px solid currentColor;border-bottom:2px solid currentColor;transform:rotate(45deg);transition:transform .15s}
.mt-more[open]>summary::after{margin-top:-2px;transform:rotate(-135deg)}
.mt-moreitem{margin:4px 0 12px}
.mt-moreitem .btn{min-height:44px}
.mt-sync .mt-moreitem .hint{margin:6px 2px 0}
.mt-joinfirst{display:flex;align-items:center;gap:10px;margin-top:10px;padding:8px 10px;background:var(--sur2);border-radius:10px}
.mt-joinfirst .hint{flex:1;min-width:0;margin:0}
.mt-joinfirst .btn{flex:none;min-height:44px}
.mt-syncrow{display:flex;align-items:center;justify-content:space-between;gap:10px;margin:0 0 8px}
.mt-syncrow .mt-status{flex:1;min-width:0;margin:0}
.mt-syncrow .btn{flex:none}
.mt-restore{border-top:1px solid var(--line);padding-top:10px;margin:0 0 10px}
.mt-restore .mt-text{margin:0 0 8px}
.mt-restore .hint{margin:6px 0 0}
.btn.mt-armed{background:var(--warn-soft);color:var(--warn);border-color:var(--warn)}
.mt-join{margin-top:12px}
.mt-syncbtns{display:flex;flex-direction:column;gap:8px}
.mt-syncbtns[hidden],.mt-syncbtns .btn[hidden]{display:none}
.mt-next{margin:0 0 10px;font-size:14px;line-height:1.4;background:var(--sur2);border-radius:10px;padding:8px 10px}
.mt-join[hidden],.mt-sync [hidden]{display:none}
.mt-join>.lbl{text-align:left;margin:0 0 2px}
.mt-join>.hint{margin:0 0 8px}
.mt-joinrow{display:flex;gap:8px;align-items:center}
.mt-joinrow input{flex:1;min-width:0;height:44px;border-radius:12px;border:1px solid var(--line);background:var(--sur2);color:var(--ink);padding:0 10px;font-family:"Barlow Condensed","Barlow",sans-serif;font-size:19px;font-weight:600;letter-spacing:.03em;text-transform:uppercase}
.mt-joinrow input::placeholder{color:var(--mut);opacity:.75;text-transform:none;letter-spacing:0;font-family:"Barlow",sans-serif;font-size:16px;font-weight:400}
.mt-joinrow .btn{flex:none;padding:0 16px}
#mt-join-msg{margin:8px 0 0}

/* setup card + preview + 2-week check-in */
.mt-setup .bd>.hint{margin:0}
.mt-preview{display:grid;grid-template-columns:repeat(4,1fr);gap:6px;background:var(--sur2);border-radius:12px;padding:10px 8px;text-align:center}
.mt-preview>.small{grid-column:1/-1}
.mt-pv{display:flex;flex-direction:column;align-items:center;gap:2px}
.mt-pv b{font-family:"Barlow Condensed","Barlow",sans-serif;font-size:24px;font-weight:700;line-height:1}
.mt-pv span{font-size:11px;color:var(--mut);font-weight:600;letter-spacing:.04em;text-transform:uppercase}
.mt-pvnote{grid-column:1/-1}
.mt-b14{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:0 0 10px}
.mt-b14 .lbl{line-height:1.25}
.mt-setnote .mt-text{margin-bottom:10px}
@media (max-width:340px){.mt-rangebar .mt-rl{display:none}.mt-rangebar{justify-content:flex-end}.mt-code{font-size:19px;letter-spacing:.02em}}

/* ---- round 4 (TR-06, VI-14, VI-21, VI-22, TR-01..03 messages) ---- */
/* today is still going: a lighter bar with "so far" over it */
.mt-chart .bar.sofar{fill-opacity:.42}
.mt-chart .sofar-t{fill:var(--mut);font-size:12px;font-weight:600}
.hint.mt-sofarnote{margin:0 0 4px}
/* the 3 tiles line up: the small line under the label sits at the bottom of every tile in a row */
.mt-card .stat{display:flex;flex-direction:column}
.mt-card .stat .mt-sub{margin-top:auto;padding-top:1px}
/* 361-380 wide (iPhone 375): one-line labels, a wider middle tile for "7-day average" */
@media (min-width:361px) and (max-width:380px){.mt-card .stats{grid-template-columns:minmax(0,1fr) minmax(0,1.25fr) minmax(0,1fr)}.mt-card .stat{padding:10px 8px}.mt-card .stats .stat .k{white-space:nowrap;letter-spacing:.02em}}
/* 360 and less (320 = iPhone with Display Zoom): labels wrap, smaller numbers, tighter tiles; nothing is cut off */
@media (max-width:360px){.mt-card .stats{gap:6px}.mt-card .stat{padding:9px 7px}.mt-card .stat .v{font-size:22px}.mt-card .stats .stat .k{letter-spacing:.02em;text-wrap:balance}.mt-card .stat .mt-sub{white-space:normal}}
.mt-nb{white-space:nowrap}
/* You: no double line under a card head; the key box hint in the app's font */
.mt-card>.hd+.srow{border-top:0}
.mt-key input:placeholder-shown{font-family:"Barlow",-apple-system,sans-serif;font-size:16px;letter-spacing:0}
/* both check-in cards: the same two-column buttons; a third button (Skip) takes the full row */
.mt-banner .mt-row{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.mt-banner .mt-row .btn{width:100%;min-width:0}
.mt-banner .mt-row .btn:nth-child(3){grid-column:1/-1}
/* a typo message sits right under its row */
.mt-card>.mt-msg{margin:0;padding:0 14px 12px}
#mt-tmsg{margin:4px 2px 6px}

/* ---- round 5 (LK-07, LK-09, LK-13, LK-14, PL-09) ---- */
/* LK-09: the targets grid has its own small heading and a line above it, apart from the split list */
.mt-card .mt-thd{margin:10px 14px 0;padding:12px 0 0;border-top:1px solid var(--line);font-size:15px;font-weight:600;line-height:1.2}
.mt-card .stats.mt-tgrid{margin:8px 0 4px}
/* LK-14: check-in labels and numbers start at the left edge of their box */
.mt-b14 .lbl,.mt-form .lbl{text-align:left}
.mt-b14 input.mini,.mt-form .entry input.mini{text-align:left;padding:0 12px}
/* PL-09: "Type my own targets" switch: 44 px tall to tap; the track still looks 52 x 32 (a clear edge around it).
   #app so Chalk's dark-mode .toggle colors can't bring back the full-size track. */
#app .mt-manrow .toggle{width:64px;height:44px;border:6px solid transparent;border-radius:22px;background-clip:padding-box;margin:0 -6px}

/* ---- final check (CV) ---- */
/* a unit under an uppercase tile label stays lowercase: "PROTEIN (g)", not "PROTEIN (G)" */
.mt-card .stat .k .mt-lc{text-transform:none;letter-spacing:0}
