/* Watch Coach: dark, mobile-first instrument-panel UI. No build step. */
:root{
  color-scheme:dark;
  --bg:#0e0e0d;--surface-1:#171716;--surface-2:#20201e;--surface-3:#2a2a27;--line:#2f2f2b;--grid:#242421;
  --text-primary:#f2f1ed;--text-secondary:#cfcec4;--text-muted:#9d9c93;
  /* zone / metric colours (unchanged fills) and lighter variants for text on dark */
  --good:#0ca30c;--warning:#fab219;--critical:#d03b3b;
  --good-t:#3ccf4a;--warning-t:#fab219;--critical-t:#f0716f;
  --strain:#3987e5;--sleep:#9085e9;--rhr:#d95926;--steps:#199e70;--stress:#e0a53a;
  --deep:#3987e5;--core:#199e70;--rem:#9085e9;--awake:#d95926;
  --accent:#4a93ee;--accent-bg:#142a47;--focus:#8fc0ff;
  --r-sm:10px;--r-md:14px;--r-lg:20px;
  --ease:cubic-bezier(.2,.8,.2,1);
  --sat:env(safe-area-inset-top,0px);--sab:env(safe-area-inset-bottom,0px);
  --hdr-h:64px;--strip-h:88px;--tab-h:58px;
  --font:-apple-system,BlinkMacSystemFont,"SF Pro Text","SF Pro Display","Segoe UI",Roboto,system-ui,sans-serif;
}
*,*::before,*::after{box-sizing:border-box;touch-action:manipulation;-webkit-tap-highlight-color:transparent}
html{-webkit-text-size-adjust:100%;text-size-adjust:100%;background:var(--bg)}
body{margin:0;background:var(--bg);color:var(--text-primary);font:15px/1.5 var(--font);font-variant-numeric:tabular-nums;-webkit-font-smoothing:antialiased;overscroll-behavior-y:contain;padding-left:env(safe-area-inset-left);padding-right:env(safe-area-inset-right)}
body.locked{overflow:hidden}
button,input,select,textarea{font:inherit;color:inherit}
button{background:none;border:0;padding:0;cursor:pointer;-webkit-user-select:none;user-select:none}
::selection{background:#2e5f9f;color:#fff}
:focus-visible{outline:2px solid var(--focus);outline-offset:2px;border-radius:var(--r-sm)}
input,select,textarea{font-size:16px;background:var(--surface-2);border:1px solid var(--line);border-radius:12px;padding:0 12px;min-height:48px;width:100%;caret-color:var(--accent)}
textarea{padding:12px;min-height:48px;resize:none;line-height:1.4}
input::placeholder,textarea::placeholder{color:var(--text-muted)}
input:focus,select:focus,textarea:focus{outline:2px solid var(--focus);outline-offset:0;border-color:transparent}
select{appearance:none;background-image:linear-gradient(45deg,transparent 50%,var(--text-muted) 50%),linear-gradient(135deg,var(--text-muted) 50%,transparent 50%);background-position:calc(100% - 20px) 21px,calc(100% - 15px) 21px;background-size:5px 5px;background-repeat:no-repeat;padding-right:36px}
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.muted{color:var(--text-muted)}.sec{color:var(--text-secondary)}.small{font-size:13px}.micro{font-size:12px}
[hidden]{display:none!important}
.i{width:20px;height:20px;stroke:currentColor;fill:none;stroke-width:1.75;stroke-linecap:round;stroke-linejoin:round;flex:none}
.i.lg{width:24px;height:24px}.i.sm{width:16px;height:16px}

/* ---------- shell ---------- */
#app{max-width:600px;margin:0 auto;min-height:100dvh}
#hdr{position:sticky;top:0;z-index:30;padding:calc(var(--sat) + 6px) 16px 4px;background:color-mix(in srgb,var(--bg) 90%,transparent);-webkit-backdrop-filter:blur(14px);backdrop-filter:blur(14px)}
.hdr-row{display:flex;align-items:center;gap:4px;min-height:44px}
.title-btn{display:flex;align-items:center;gap:6px;min-height:44px;margin-left:-4px;padding:0 4px;border-radius:12px;font-size:24px;font-weight:700;letter-spacing:-.02em;line-height:1.1;text-align:left}
h1.title-btn{margin:0;cursor:default}
button.title-btn .i{color:var(--text-muted);width:18px;height:18px}
.hdr-actions{margin-left:auto;display:flex;gap:2px}
.ib{width:44px;height:44px;display:grid;place-items:center;border-radius:12px;color:var(--text-secondary)}
.ib:active,.title-btn:active{background:var(--surface-2)}
.sync{display:flex;align-items:center;gap:8px;min-height:30px;margin:-4px 0 0 -2px;padding:0 4px;border-radius:8px;font-size:13px;color:var(--text-muted);max-width:100%}
.sdot{width:8px;height:8px;border-radius:50%;background:var(--text-muted);flex:none}
.sync.fresh .sdot{background:var(--good-t)}
.sync.stale .sdot{background:var(--warning)}.sync.stale{color:var(--warning-t)}
.sync.failed .sdot{background:var(--critical-t)}.sync.failed{color:var(--critical-t)}
.sync.never .sdot{background:none;box-shadow:inset 0 0 0 1.5px var(--text-muted)}
.sync.syncing .sdot{background:var(--accent);animation:pulse 1.2s ease-in-out infinite}
.sync .i{width:14px;height:14px}
.sync.syncing .i{animation:spin 1s linear infinite}
@keyframes pulse{50%{opacity:.35}}@keyframes spin{to{transform:rotate(360deg)}}

#strip-wrap{position:sticky;top:var(--hdr-real,calc(var(--sat) + 76px));z-index:25;background:color-mix(in srgb,var(--bg) 97%,transparent);-webkit-backdrop-filter:blur(14px);backdrop-filter:blur(14px);padding:2px 0 6px;border-bottom:1px solid transparent}
#strip-wrap.scrolled,#hdr.scrolled{box-shadow:0 1px 0 var(--grid)}
.strip-top{display:flex;align-items:center;justify-content:space-between;padding:0 16px;min-height:28px}
.strip-top .lbl{font-size:12px;color:var(--text-muted);font-weight:500;letter-spacing:.01em}
.pill{display:inline-flex;align-items:center;gap:6px;height:32px;padding:0 12px;border-radius:999px;background:var(--accent-bg);color:var(--focus);font-size:13px;font-weight:600;position:relative}
.pill::after{content:"";position:absolute;inset:-6px -4px}
.pill .i{width:14px;height:14px}
#strip{display:flex;overflow-x:auto;scroll-snap-type:x mandatory;scrollbar-width:none;overscroll-behavior-x:contain;-webkit-overflow-scrolling:touch;padding:0}
#strip::-webkit-scrollbar{display:none}
.week{flex:0 0 100%;scroll-snap-align:start;scroll-snap-stop:always;display:grid;grid-template-columns:repeat(7,1fr);padding:0 10px;gap:2px}
.dchip{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1px;min-height:56px;border-radius:14px;color:var(--text-secondary);position:relative}
.dchip .w{font-size:12px;color:var(--text-muted);font-weight:500}
.dchip .n{font-size:17px;font-weight:650;line-height:1.2}
.dchip .z{width:6px;height:6px;border-radius:50%;margin-top:3px;background:transparent;box-shadow:inset 0 0 0 1.25px var(--surface-3)}
.dchip.z-green .z{background:var(--good);box-shadow:none}.dchip.z-yellow .z{background:var(--warning);box-shadow:none}.dchip.z-red .z{background:var(--critical);box-shadow:none}
.dchip.nodata .n{color:var(--text-muted);font-weight:500}
.dchip.istoday .n::after{content:"";position:absolute;left:50%;top:34px;width:14px;height:2px;margin-left:-7px;background:var(--accent);border-radius:2px;display:none}
.dchip.istoday .w{color:var(--focus)}
.dchip.on{background:var(--surface-3);color:var(--text-primary);box-shadow:inset 0 0 0 1.5px var(--accent)}
.dchip.on .w{color:var(--text-secondary)}
.dchip:disabled{opacity:.3;cursor:default}
.dchip:not(:disabled):active{background:var(--surface-2)}

main{padding:8px 16px calc(var(--tab-h) + var(--sab) + 28px)}
.view{display:none}.view.on{display:block}
.stack>*+*{margin-top:12px}
.card{background:var(--surface-1);border-radius:var(--r-lg);padding:16px}
.card-h{display:flex;align-items:baseline;justify-content:space-between;gap:12px;margin-bottom:10px;min-height:24px}
h2{font-size:16px;font-weight:650;margin:0;letter-spacing:-.005em}
.card-h .aside{font-size:13px;color:var(--text-muted)}
.sect-h{font-size:13px;font-weight:600;color:var(--text-muted);margin:20px 4px 8px}
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:44px;padding:0 16px;border-radius:12px;background:var(--surface-3);font-weight:600;font-size:15px;color:var(--text-primary)}
.btn.primary{background:var(--accent);color:#06121f}
.btn.danger{background:var(--critical-bg,#361414);color:var(--critical-t)}
.btn.ghost{background:none;color:var(--text-secondary)}
.btn.sm{min-height:36px;padding:0 12px;font-size:14px;border-radius:10px}
.btn:active{filter:brightness(.88)}
.btn:disabled{opacity:.45;cursor:default}
.btn .i{width:18px;height:18px}
.row{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.chip{display:inline-flex;align-items:center;gap:6px;min-height:28px;padding:0 10px;border-radius:999px;background:var(--surface-2);color:var(--text-secondary);font-size:12px;font-weight:500}
.chip.warn{background:#33270a;color:var(--warning-t)}
.chip.good{background:#12301f;color:var(--good-t)}
.chip.bad{background:#361414;color:var(--critical-t)}
.chip .i{width:14px;height:14px}

/* ---------- hero ---------- */
.hero{padding:18px 16px 16px;text-align:center}
.hero-date{display:flex;align-items:center;justify-content:center;gap:8px;font-size:13px;color:var(--text-muted);min-height:28px}
.ringbox{position:relative;width:184px;height:184px;margin:6px auto 0}
.ringbox svg{width:100%;height:100%;display:block;transform:rotate(-90deg)}
.ringbox .track{stroke:var(--surface-3)}
.ringbox .arc{transition:stroke-dasharray .7s var(--ease)}
.ringc{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center}
.ringc .big{font-size:58px;font-weight:700;line-height:1;letter-spacing:-.03em}
.ringc .big small{font-size:24px;font-weight:600;letter-spacing:0;margin-left:1px}
.ringc .word{margin-top:6px;font-size:15px;font-weight:650}
.hero-note{margin:10px auto 0;max-width:30ch;font-size:14px;color:var(--text-secondary);text-wrap:balance}
.calib{margin:10px auto 0;display:flex;align-items:center;justify-content:center;gap:10px;font-size:13px;color:var(--text-muted)}
.calib .segs{display:flex;gap:3px}.calib .segs i{width:14px;height:4px;border-radius:2px;background:var(--surface-3)}.calib .segs i.f{background:var(--accent)}
.tiles{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:16px;text-align:left}
.tile{background:var(--surface-2);border-radius:16px;padding:12px 14px}
.tile .k{font-size:13px;color:var(--text-muted);display:flex;align-items:center;gap:6px}
.tile .k .i{width:16px;height:16px}
.tile .v{font-size:30px;font-weight:700;letter-spacing:-.02em;line-height:1.15;margin-top:2px}
.tile .v small{font-size:13px;font-weight:500;color:var(--text-muted);letter-spacing:0;margin-left:3px}
.bar{height:4px;border-radius:2px;background:var(--surface-3);margin:8px 0 6px;overflow:hidden}
.bar i{display:block;height:100%;border-radius:2px;transition:width .6s var(--ease)}
.tile .c{font-size:12px;color:var(--text-secondary)}

/* ---------- insights ---------- */
.ins{list-style:none;margin:0;padding:0}
.ins li{display:flex;gap:12px;padding:12px 0;border-top:1px solid var(--grid)}
.ins li:first-child{border-top:0;padding-top:4px}
.ins .g{width:34px;height:34px;border-radius:50%;display:grid;place-items:center;flex:none;background:color-mix(in srgb,var(--c) 16%,transparent);color:var(--c)}
.ins .t{min-width:0}
.ins .h{font-weight:650;font-size:15px;line-height:1.35}
.ins .b{font-size:14px;color:var(--text-secondary);margin-top:1px;line-height:1.45}
.more{display:flex;width:100%;justify-content:center;align-items:center;gap:6px;min-height:44px;margin-top:2px;color:var(--text-secondary);font-size:14px;font-weight:600;border-top:1px solid var(--grid)}

/* ---------- charts ---------- */
.readout{min-height:44px;display:flex;align-items:center;gap:14px;flex-wrap:wrap;font-size:14px;color:var(--text-secondary)}
.readout b{color:var(--text-primary);font-weight:650}
.readout .rv{font-size:22px;font-weight:700;color:var(--text-primary);letter-spacing:-.01em}
.readout .hint{margin-left:auto;font-size:12px;color:var(--text-muted)}
.chart{position:relative;width:100%;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}
.chart svg{display:block;width:100%;height:auto;touch-action:pan-y;overflow:visible}
.chart text{font-family:var(--font);font-variant-numeric:tabular-nums}
.chart:focus-visible{outline-offset:4px}
.legend{display:flex;gap:14px;flex-wrap:wrap;font-size:12px;color:var(--text-secondary);margin-top:6px}
.legend i{display:inline-block;width:10px;height:10px;border-radius:3px;margin-right:6px;vertical-align:-1px}
.legend i.dash{height:0;border-top:2px dashed var(--text-secondary);border-radius:0;width:14px;vertical-align:3px;background:none}
.stagebar{display:flex;gap:2px;height:12px;margin:12px 0 10px}
.stagebar i{display:block;height:100%;border-radius:4px;min-width:3px}
.stagebar i:first-child{border-radius:6px 4px 4px 6px}.stagebar i:last-child{border-radius:4px 6px 6px 4px}
.stagelist{display:grid;grid-template-columns:repeat(4,1fr);gap:4px}
.stagelist div{font-size:12px;color:var(--text-muted)}
.stagelist b{display:block;font-size:15px;color:var(--text-primary);font-weight:650;margin-top:1px}
.stagelist .dot{display:inline-block;width:8px;height:8px;border-radius:3px;margin-right:5px}
.bignum{display:flex;align-items:baseline;gap:8px}
.bignum b{font-size:30px;font-weight:700;letter-spacing:-.02em}
.bignum span{font-size:13px;color:var(--text-muted)}

.grid2{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.stat{background:var(--surface-2);border-radius:14px;padding:12px;min-height:76px}
.stat .k{font-size:12px;color:var(--text-muted);font-weight:500}
.stat .v{font-size:22px;font-weight:650;letter-spacing:-.01em;line-height:1.25;margin-top:2px}
.stat .v small{font-size:13px;font-weight:500;color:var(--text-muted);margin-left:3px;letter-spacing:0}
.stat .n{font-size:12px;color:var(--text-secondary);min-height:16px}
.sect-sub{font-size:13px;color:var(--text-muted);font-weight:600;margin:14px 2px 8px}
.sect-sub:first-child{margin-top:0}

.empty{text-align:center;padding:26px 12px;color:var(--text-secondary)}
.empty .i{width:28px;height:28px;color:var(--text-muted);margin-bottom:8px}
.empty h3{margin:0 0 4px;font-size:17px;font-weight:650;color:var(--text-primary)}
.empty p{margin:0 auto 14px;max-width:34ch;font-size:14px;color:var(--text-secondary)}
.empty .row{justify-content:center}
.ph{display:flex;align-items:center;justify-content:center;min-height:90px;border-radius:12px;border:1px dashed var(--line);color:var(--text-muted);font-size:13px;text-align:center;padding:12px}
.banner{display:flex;align-items:center;gap:12px;background:var(--accent-bg);color:var(--text-secondary);border-radius:var(--r-md);padding:8px 8px 8px 14px;font-size:14px}
.banner .btn{margin-left:auto}

/* ---------- controls ---------- */
.seg{display:grid;grid-auto-flow:column;grid-auto-columns:1fr;background:var(--surface-2);border-radius:14px;padding:3px;gap:2px}
.seg button{min-height:44px;border-radius:11px;color:var(--text-secondary);font-weight:600;font-size:14px}
.seg button.on{background:var(--surface-3);color:var(--text-primary)}
.chips{display:flex;gap:8px;overflow-x:auto;scrollbar-width:none;margin:12px -16px 0;padding:0 16px}
.chips::-webkit-scrollbar{display:none}
.mchip{flex:none;min-height:44px;padding:0 16px;border-radius:999px;background:var(--surface-1);color:var(--text-secondary);font-weight:600;font-size:14px;display:inline-flex;align-items:center;gap:8px}
.mchip.on{background:var(--surface-3);color:var(--text-primary)}
.mchip .dotc{width:8px;height:8px;border-radius:50%}
.sumrow{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin-bottom:6px}
.sumrow div{font-size:12px;color:var(--text-muted)}
.sumrow b{display:block;font-size:20px;color:var(--text-primary);font-weight:700;letter-spacing:-.01em;margin-top:1px}
.delta{font-size:12px;font-weight:600;display:inline-flex;align-items:center;gap:3px}
.delta.good{color:var(--good-t)}.delta.bad{color:var(--critical-t)}.delta.flat{color:var(--text-muted)}
.delta .i{width:12px;height:12px;stroke-width:2.25}
details{border-top:1px solid var(--grid);margin-top:10px}
summary{list-style:none;display:flex;align-items:center;min-height:44px;color:var(--text-secondary);font-weight:600;font-size:14px;cursor:pointer}
summary::-webkit-details-marker{display:none}
.tablewrap{overflow:auto;max-height:340px}
table{border-collapse:collapse;width:100%;font-size:13px}
th,td{padding:8px 8px;border-bottom:1px solid var(--grid);text-align:right;white-space:nowrap}
th{color:var(--text-muted);font-weight:600;font-size:12px;position:sticky;top:0;background:var(--surface-1)}
th:first-child,td:first-child{text-align:left}

/* ---------- reports ---------- */
.pnav{display:flex;align-items:center;gap:4px;margin:12px 0 4px}
.pnav .ptitle{flex:1;text-align:center;min-width:0}
.pnav .ptitle b{display:block;font-size:17px;font-weight:700;letter-spacing:-.01em}
.pnav .ptitle span{font-size:13px;color:var(--text-muted)}
.scores{display:grid;grid-template-columns:repeat(3,1fr)}
.scores>div{padding:2px 12px;border-left:1px solid var(--grid)}
.scores>div:first-child{border-left:0;padding-left:0}
.scores .k{font-size:12px;color:var(--text-muted)}
.scores .v{font-size:28px;font-weight:700;letter-spacing:-.02em;line-height:1.2}
.scores .v small{font-size:13px;color:var(--text-muted);font-weight:500;margin-left:2px}
.kv{display:grid;grid-template-columns:1fr auto;gap:0 12px}
.kv>*{padding:10px 0;border-top:1px solid var(--grid);min-height:44px;display:flex;align-items:center}
.kv>:nth-child(-n+2){border-top:0}
.kv>:nth-child(even){justify-content:flex-end;text-align:right;font-weight:650;gap:8px}
.kv>:nth-child(odd){color:var(--text-secondary)}
.dayrow{display:flex;align-items:center;gap:12px;width:100%;min-height:52px;padding:6px 0;border-top:1px solid var(--grid);text-align:left}
.dayrow:first-of-type{border-top:0}
.dayrow .gl{width:32px;height:32px;border-radius:50%;display:grid;place-items:center;flex:none}
.dayrow .tx{flex:1;min-width:0;font-size:14px;color:var(--text-secondary)}
.dayrow .tx b{display:block;color:var(--text-primary);font-weight:650;font-size:15px}
.dayrow .ch{color:var(--text-muted)}
.ai-h{display:flex;align-items:center;gap:8px}
.ai-h .i{color:var(--focus)}
.headline{font-size:22px;font-weight:700;letter-spacing:-.015em;line-height:1.25;margin:4px 0 12px;text-wrap:balance}
.bul{margin:0 0 4px;padding:0;list-style:none}
.bul li{display:flex;gap:10px;padding:8px 0;font-size:15px}
.bul li::before{content:"";width:6px;height:6px;border-radius:50%;background:var(--accent);margin-top:9px;flex:none}
.ai-foot{display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap;margin-top:12px;padding-top:10px;border-top:1px solid var(--grid);font-size:12px;color:var(--text-muted)}
.skel{height:14px;border-radius:7px;background:var(--surface-2);margin:10px 0;animation:pulse 1.4s ease-in-out infinite}
.heat{display:grid;grid-template-columns:repeat(12,1fr);gap:4px}
.heat button{aspect-ratio:1;border-radius:8px;min-height:24px;display:flex;align-items:flex-end;justify-content:center;font-size:10px;color:#0e0e0d;font-weight:700}
.heatlbl{display:grid;grid-template-columns:repeat(12,1fr);gap:4px;margin-top:4px;text-align:center;font-size:11px;color:var(--text-muted)}

/* ---------- coach chat ---------- */
#v-coach{display:none}
#v-coach.on{display:flex;flex-direction:column;min-height:calc(100dvh - var(--hdr-h) - var(--sat) - var(--tab-h) - var(--sab) - 44px)}
.chat{flex:1;display:flex;flex-direction:column;gap:10px;padding-bottom:12px}
.msg{max-width:88%;padding:11px 14px;border-radius:18px;font-size:15px;line-height:1.5;word-wrap:break-word;overflow-wrap:anywhere}
.msg.me{align-self:flex-end;background:var(--accent);color:#06121f;border-bottom-right-radius:6px;font-weight:500}
.msg.ai{align-self:flex-start;background:var(--surface-1);border-bottom-left-radius:6px}
.msg.ai p{margin:0 0 8px}.msg.ai p:last-child{margin:0}
.msg.ai ul,.msg.ai ol{margin:4px 0 8px;padding-left:20px}.msg.ai li{margin:2px 0}
.msg.ai strong{font-weight:650}
.msg .meta{font-size:11px;color:var(--text-muted);margin-top:6px}
.msg.err{color:var(--critical-t)}
.typing{display:inline-flex;gap:4px;padding:4px 0}.typing i{width:7px;height:7px;border-radius:50%;background:var(--text-muted);animation:pulse 1.2s ease-in-out infinite}.typing i:nth-child(2){animation-delay:.15s}.typing i:nth-child(3){animation-delay:.3s}
.sugg{display:flex;flex-wrap:wrap;gap:8px;margin:4px 0 12px}
.sugg button{min-height:44px;padding:0 14px;border-radius:999px;background:var(--surface-1);color:var(--text-secondary);font-size:14px;font-weight:500;text-align:left}
.sugg button:active{background:var(--surface-2)}
.composer{position:sticky;bottom:calc(var(--tab-h) + var(--sab) + 8px);display:flex;gap:8px;align-items:flex-end;background:var(--bg);padding:8px 0 0}
.composer textarea{flex:1;border-radius:22px;padding:12px 16px;max-height:120px}
.composer .send{width:48px;height:48px;border-radius:50%;background:var(--accent);color:#06121f;display:grid;place-items:center;flex:none}
.composer .send:disabled{opacity:.4}
.coach-meta{display:flex;gap:8px;justify-content:space-between;align-items:center;font-size:12px;color:var(--text-muted);margin:0 2px 6px}

/* ---------- tab bar ---------- */
#tabbar{position:fixed;left:0;right:0;bottom:0;z-index:40;background:color-mix(in srgb,var(--bg) 88%,transparent);-webkit-backdrop-filter:blur(20px);backdrop-filter:blur(20px);border-top:1px solid var(--grid);padding-bottom:var(--sab)}
#tabbar .in{max-width:600px;margin:0 auto;display:grid;grid-template-columns:repeat(4,1fr);height:var(--tab-h)}
#tabbar button{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;color:var(--text-muted);font-size:12px;font-weight:600;min-height:44px}
#tabbar button.on{color:var(--text-primary)}
#tabbar button.on .i{color:var(--accent)}
#tabbar .i{width:24px;height:24px}

/* ---------- sheets ---------- */
#backdrop{position:fixed;inset:0;background:rgba(0,0,0,.55);z-index:60;opacity:0;pointer-events:none;transition:opacity .22s var(--ease)}
#backdrop.on{opacity:1;pointer-events:auto}
.sheet{position:fixed;left:0;right:0;bottom:0;z-index:61;max-width:600px;margin:0 auto;max-height:90dvh;background:var(--surface-1);border-radius:24px 24px 0 0;transform:translateY(105%);visibility:hidden;transition:transform .26s var(--ease),visibility 0s .26s;display:flex;flex-direction:column;padding-bottom:var(--sab)}
.sheet.on{transform:none;visibility:visible;transition:transform .26s var(--ease)}
.sheet .grab{width:36px;height:4px;border-radius:2px;background:var(--surface-3);margin:8px auto 0;flex:none}
.sheet-h{display:flex;align-items:center;gap:8px;padding:6px 8px 4px 20px;flex:none}
.sheet-h h2{font-size:18px;flex:1}
.sheet-b{overflow-y:auto;padding:4px 20px 20px;overscroll-behavior:contain}
.sheet-f{padding:10px 20px 14px;border-top:1px solid var(--grid);display:flex;gap:10px;flex:none}
.sheet-f .btn{flex:1;min-height:48px}
.cal-h{display:flex;align-items:center;gap:4px;margin-bottom:6px}
.cal-h .mt{flex:1;display:flex;align-items:center;justify-content:center;gap:6px;min-height:44px;font-size:17px;font-weight:700;border-radius:12px}
.cal-h .mt .i{width:16px;height:16px;color:var(--text-muted)}
.cal-dow,.cal-grid{display:grid;grid-template-columns:repeat(7,1fr);justify-items:center}
.cal-dow span{font-size:12px;color:var(--text-muted);height:24px;display:grid;place-items:center}
.cal-grid button{width:44px;height:48px;border-radius:12px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;font-size:15px;position:relative}
.cal-grid button .z{width:5px;height:5px;border-radius:50%}
.cal-grid button.z-green .z{background:var(--good)}.cal-grid button.z-yellow .z{background:var(--warning)}.cal-grid button.z-red .z{background:var(--critical)}
.cal-grid button.hasdata:not(.z-green):not(.z-yellow):not(.z-red) .z{background:var(--text-muted)}
.cal-grid button.nodata{color:var(--text-muted)}
.cal-grid button.istoday{box-shadow:inset 0 0 0 1.5px var(--accent)}
.cal-grid button.on{background:var(--accent-bg);color:var(--focus);font-weight:700}
.cal-grid button:disabled{opacity:.25;cursor:default}
.cal-legend{display:flex;gap:14px;justify-content:center;margin:10px 0 4px;font-size:12px;color:var(--text-muted)}
.cal-legend i{display:inline-block;width:8px;height:8px;border-radius:50%;margin-right:5px}
.mgrid{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin-top:8px}
.mgrid button{min-height:52px;border-radius:14px;background:var(--surface-2);font-weight:600}
.mgrid button.on{background:var(--accent-bg);color:var(--focus)}
.mgrid button:disabled{opacity:.25}
.field{display:block;margin-bottom:12px}
.field>span{display:block;font-size:13px;color:var(--text-secondary);margin-bottom:6px}
.field .hint{font-size:12px;color:var(--text-muted);margin:6px 0 0}
.fgrid{display:grid;grid-template-columns:1fr 1fr;gap:0 12px}
.keyrow{display:flex;gap:8px}
.set-h{font-size:13px;font-weight:600;color:var(--text-muted);margin:22px 0 10px}
.set-h:first-child{margin-top:4px}
.about{font-size:12px;color:var(--text-muted);line-height:1.5;margin-top:18px}
pre.log{white-space:pre-wrap;font-size:11px;color:var(--text-muted);background:var(--surface-2);padding:10px;border-radius:10px;max-height:160px;overflow:auto}

#toast{position:fixed;left:50%;top:calc(var(--sat) + 10px);transform:translate(-50%,-140%);z-index:90;background:var(--surface-3);color:var(--text-primary);border-radius:14px;padding:11px 16px;max-width:min(92vw,420px);text-align:center;font-size:14px;box-shadow:0 8px 28px rgba(0,0,0,.5);transition:transform .25s var(--ease)}
#toast.on{transform:translate(-50%,0)}
#tip{position:fixed;pointer-events:none;background:#0b0b0a;border:1px solid var(--line);border-radius:8px;padding:6px 9px;font-size:12px;z-index:70;display:none;white-space:nowrap;box-shadow:0 4px 18px #0008}
#ptr{position:fixed;left:50%;top:calc(var(--sat) + 8px);width:36px;height:36px;margin-left:-18px;border-radius:50%;background:var(--surface-3);display:grid;place-items:center;z-index:35;opacity:0;pointer-events:none;color:var(--text-secondary)}
#ptr .i{width:18px;height:18px}

@media(min-width:700px){
  .sheet{bottom:auto;top:50%;border-radius:24px;max-height:86dvh;transform:translateY(-46%) scale(.98);opacity:0}
  .sheet.on{transform:translateY(-50%);opacity:1}
  .sheet{transition:transform .26s var(--ease),opacity .2s,visibility 0s .26s}
  .sheet .grab{display:none}
}
@media(max-width:360px){
  .ringbox{width:164px;height:164px}.ringc .big{font-size:50px}
  .scores .v{font-size:24px}
}
@media(prefers-reduced-motion:reduce){
  *,*::before,*::after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important;scroll-behavior:auto!important}
  .sync.syncing .sdot{animation:none}
}
#v-today{touch-action:pan-y}
.grab,.sheet-h{touch-action:none}
code{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.9em;background:var(--surface-3);padding:1px 5px;border-radius:5px}
.ringc .big.nil{color:var(--text-muted);font-weight:500}
#calBody{min-height:min(470px,58dvh)}
.coach-meta .btn{white-space:nowrap;flex:none}.composer textarea{height:48px;overflow-y:auto}
.btn.sm{min-height:44px}
.sync{min-height:44px;margin:-12px 0 -10px -2px}
.card-h .btn.sm{margin-top:-10px;margin-bottom:-10px}
.chat{padding-bottom:28px}
.grid2 .stat:last-child:nth-child(odd){grid-column:1/-1}
