/* Health monitor detail sheets (monitor-ui.js): resting HR, HRV, sleep,
   breathing, SpO2 and weight. Reuses stress.css's st-* pieces. */
.mo-sheet { --mo-shadow: 0 1px 2px rgba(var(--n-ink-rgb), 0.05), 0 8px 24px rgba(var(--n-ink-rgb), 0.08); }
.mo-sheet .st-mini, .mo-sheet .st-coach { box-shadow: var(--mo-shadow); }
.mo-head { margin-bottom: 10px; }
.mo-card { background: var(--panel); border-radius: 22px; padding: 16px 18px; margin: 12px 0; box-shadow: var(--mo-shadow); display: flex; flex-direction: column; gap: 10px; }
.mo-ico { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.mo-center { text-align: center; }
.mo-sep { border-top: 1px solid var(--border); padding-top: 10px; }
.mo-good { color: var(--acc-700); font-weight: 700; }
.mo-warn { color: #c2410c; font-weight: 700; }
.mo-lbl { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 700; color: var(--muted); }
.mo-big { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; margin-top: 4px; }
.mo-big small { font-size: 14px; font-weight: 600; color: var(--muted); }
.mo-split { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mo-sec { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 10px; margin: 22px 4px 0; }
.mo-sec b { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.mo-sec span { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.mo-sec + .mo-card, .mo-sec + .st-minis, .mo-sec + .mo-vitals, .mo-sec + .st-nochart { margin-top: 10px; }
.mo-sheet .st-minis { margin: 12px 0; }

/* hero */
.mo-hero { align-items: center; text-align: center; padding: 24px 18px 20px; }
.mo-hero-val { font-size: 64px; font-weight: 700; letter-spacing: -0.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.mo-hero-val small { font-size: 20px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.mo-hero-sub { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
.mo-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px; font-weight: 700; font-size: 15px; }
.mo-pill.good { background: var(--acc-100); color: var(--acc-800); }
.mo-pill.warn { background: #ffedd5; color: #9a3412; }
.mo-pill.muted { background: var(--panel-2); color: var(--muted); }
.mo-pill .mo-ico { stroke-width: 3; }
.mo-chips { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.mo-chip { font-size: 14px; font-weight: 700; color: var(--muted); background: var(--panel-2); padding: 6px 12px; border-radius: 999px; }
.mo-chip.blue { color: #075985; background: #e0f2fe; font-weight: 700; }

/* range bar (RHR, SpO2) */
.mo-range { width: 100%; max-width: 320px; margin-top: 4px; }
/* A recessed groove with the normal band in it and small end caps just
   outside it (the "upper and lower" ends), like the Home tiles. */
.mo-range-track { position: relative; height: 22px; border-radius: 11px; background: var(--panel-2); box-shadow: inset 0 1px 3px rgba(var(--n-ink-rgb), 0.06); }
.mo-range-band { position: absolute; top: 7px; bottom: 7px; border-radius: 4px; background: linear-gradient(90deg, color-mix(in srgb, var(--c) 55%, transparent), color-mix(in srgb, var(--c) 80%, transparent)); }
.mo-range-band::before, .mo-range-band::after { content: ''; position: absolute; top: 1px; bottom: 1px; width: 6px; border-radius: 3px; background: color-mix(in srgb, var(--c) 28%, transparent); }
.mo-range-band::before { left: -10px; }
.mo-range-band::after { right: -10px; }
.mo-range-track b { position: absolute; top: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; background: var(--panel); border: 4px solid var(--c); box-sizing: border-box; }
.mo-range-labels { position: relative; height: 18px; margin: 4px 0 6px; }
.mo-range-labels span { position: absolute; transform: translateX(-50%); font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* HRV baseline gauge */
.mo-gauge { width: 100%; max-width: 330px; margin-top: 8px; }
.mo-gauge-track { position: relative; height: 14px; margin-top: 30px; }
.mo-gauge-track i { position: absolute; top: 0; bottom: 0; }
.mo-gauge-track i.low { background: #fdba74; border-radius: 7px 0 0 7px; }
.mo-gauge-track i.mid { background: #fde68a; }
.mo-gauge-track i.mid:last-of-type { border-radius: 0 7px 7px 0; }
.mo-gauge-track i.ok { background: var(--acc-300); }
.mo-gauge-track b { position: absolute; top: -8px; bottom: -8px; }
.mo-gauge-track b.night { width: 3px; margin-left: -1.5px; background: var(--text); border-radius: 2px; }
.mo-gauge-track b.week { top: 50%; bottom: auto; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; background: var(--panel); border: 4px solid var(--acc-600); box-sizing: border-box; }
.mo-gauge-track b span { position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: 11px; font-weight: 700; }
.mo-gauge-track b.week span { bottom: auto; top: calc(100% + 6px); color: var(--acc-700); }
.mo-gauge-labels { position: relative; height: 18px; margin: 30px 0 6px; }
.mo-gauge-labels span { position: absolute; transform: translateX(-50%); white-space: nowrap; font-size: 11px; color: var(--muted); }

/* sleep ring + bed/wake */
.mo-ring { position: relative; width: 170px; height: 170px; }
.mo-ring svg { width: 100%; height: 100%; display: block; }
.mo-ring circle { fill: none; stroke-width: 16; }
.mo-ring .bg { stroke: color-mix(in srgb, #6366f1 12%, var(--panel-2)); }
.mo-ring .fg { stroke: #6366f1; stroke-linecap: round; }
.mo-ring-mid { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.mo-ring-mid b { font-size: 52px; font-weight: 700; letter-spacing: -0.03em; line-height: 1; }
.mo-ring-mid span { font-size: 15px; font-weight: 700; color: #4f46e5; margin-top: 2px; }
.mo-bedwake { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.mo-bedwake .moon { color: #6366f1; }
.mo-bedwake .sun { color: #f59e0b; }
.mo-arrow { width: 36px; height: 8px; fill: none; stroke: var(--muted); stroke-width: 1.6; margin: 0 4px; }

/* stages */
.mo-stack { display: flex; gap: 2px; height: 16px; border-radius: 8px; overflow: hidden; }
.mo-stack i { display: block; }
.mo-stage { display: grid; grid-template-columns: 64px 1fr 84px; align-items: center; gap: 10px; }
.mo-stage-l b, .mo-stage-r b { display: block; font-weight: 700; }
.mo-stage-r { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.mo-stage-bar { position: relative; height: 4px; border-radius: 2px; background: var(--panel-2); }
.mo-stage-bar i { position: absolute; top: -2px; bottom: -2px; border-radius: 4px; background: #c7d2fe; }
.mo-stage-bar b { position: absolute; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; border: 2px solid var(--panel); }
.mo-q { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.mo-q.ex { background: #e0e7ff; color: #3730a3; }
.mo-q.gd { background: var(--acc-100); color: var(--acc-800); }
.mo-q.fa { background: #fef3c7; color: #92400e; }
.mo-q.po { background: #fee2e2; color: #991b1b; }

/* lists */
.mo-list { gap: 0; padding: 4px 18px; }
.mo-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.mo-row:last-child { border-bottom: 0; }
.mo-row-t { font-weight: 700; }
.mo-row-r { text-align: right; display: flex; flex-direction: column; }
.mo-delta { font-size: 17px; font-weight: 700; white-space: nowrap; color: var(--muted); }
.mo-delta.bad { color: #dc2626; }
.mo-delta.good { color: var(--acc-700); }
.mo-callout { flex-direction: row; align-items: flex-start; gap: 10px; font-size: 14px; line-height: 1.5; }
.mo-callout .mo-ico { width: 20px; height: 20px; margin-top: 1px; }
.mo-callout .warn { color: #f97316; }

/* vitals */
.mo-vitals { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.mo-vital { background: var(--panel); border-radius: 18px; padding: 12px 14px; box-shadow: var(--mo-shadow); display: flex; flex-direction: column; gap: 2px; }
.mo-vital span { font-size: 13px; font-weight: 700; color: var(--muted); }
.mo-vital b { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.mo-vital b small { font-size: 12.5px; font-weight: 600; color: var(--muted); letter-spacing: 0; }

/* charts */
.mo-chart { margin: 4px 0 0; }
.mo-chart-plot { position: relative; margin-right: 30px; }
.mo-chart-plot svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; overflow: visible; }
.mo-c-line { fill: none; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.mo-c-grid { stroke: var(--border); stroke-dasharray: 3 4; vector-effect: non-scaling-stroke; }
.mo-c-h { stroke-width: 1.4; opacity: 0.6; vector-effect: non-scaling-stroke; }
.mo-c-shade { fill: rgba(124, 140, 240, 0.12); }
.mo-c-dot { position: absolute; width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; border-radius: 50%; pointer-events: none; }
.mo-c-end, .mo-c-mark { position: absolute; width: 11px; height: 11px; margin: -5.5px 0 0 -5.5px; border-radius: 50%; background: var(--panel); border: 3px solid var(--c); box-sizing: border-box; pointer-events: none; }
.mo-c-mark { box-shadow: 0 0 0 5px color-mix(in srgb, var(--c) 20%, transparent); }
.mo-c-label { position: absolute; transform: translateX(-50%); white-space: nowrap; font-size: 11px; font-weight: 700; pointer-events: none; }
.mo-c-label.end { transform: translateX(-90%); }
.mo-c-label.start { transform: translateX(-10%); }
.mo-chart-y { position: absolute; top: 0; bottom: 0; right: -30px; width: 26px; pointer-events: none; }
.mo-chart-y span { position: absolute; right: 0; transform: translateY(-50%); font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.mo-chart-x { display: flex; justify-content: space-between; margin: 6px 30px 0 0; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.mo-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.mo-legend span { display: inline-flex; align-items: center; gap: 5px; }
.mo-key { display: inline-block; width: 10px; height: 10px; border-radius: 3px; vertical-align: -1px; }
.mo-key.round { border-radius: 50%; }
.mo-key.line { height: 3px; width: 14px; border-radius: 2px; }
.mo-seg { display: inline-flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--panel-2); align-self: flex-start; }
.mo-seg button { border: 0; background: transparent; border-radius: 999px; padding: 6px 13px; font: inherit; font-size: 13px; font-weight: 700; color: var(--muted); cursor: pointer; }
.mo-seg button.on { background: var(--panel); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08); }

/* HRV status strip */
.mo-strip { display: grid; grid-template-columns: repeat(30, minmax(0, 1fr)); gap: 2px; }
.mo-strip i { height: 22px; border-radius: 3px; background: var(--panel-2); }
.mo-strip i.ok { background: var(--acc-500); }
.mo-strip i.warn { background: #f59e0b; }

/* sleep bars and windows */
.mo-bars { position: relative; height: 130px; display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 6px; align-items: end; margin-right: 30px; }
.mo-bar { position: relative; height: 100%; }
.mo-bar i { position: absolute; bottom: 0; left: 0; right: 0; border-radius: 5px; }
.mo-bar i.ok { background: #6366f1; }
.mo-bar i.short { background: #c7d2fe; }
.mo-bar b { position: absolute; left: -2px; right: -2px; height: 2px; background: var(--text); border-radius: 1px; }
.mo-bars-y { position: absolute; top: 0; bottom: 0; right: -30px; width: 26px; }
.mo-bars-y span { position: absolute; right: 0; transform: translateY(50%); font-size: 11px; color: var(--muted); }
.mo-wins { position: relative; height: 150px; display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 6px; margin-right: 40px; }
.mo-wins-grid { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--border); }
.mo-wins-grid span { position: absolute; right: -40px; transform: translateY(-50%); font-size: 10.5px; color: var(--muted); font-style: normal; font-variant-numeric: tabular-nums; }
.mo-win { position: relative; }
.mo-win i { position: absolute; left: 0; right: 0; border-radius: 8px; background: #a5b4fc; }
.mo-win i.last { background: #6366f1; }

/* breathing halves */
.mo-halves { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
.mo-half { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.mo-half + .mo-half { border-left: 1px solid var(--border); }
.mo-half-val { font-size: 52px; font-weight: 700; letter-spacing: -0.04em; line-height: 1; }

/* SpO2 empty state + switch */
.mo-empty b { font-size: 21px; font-weight: 700; letter-spacing: -0.02em; }
.mo-empty p { margin: 0; line-height: 1.5; color: var(--muted); }
.mo-empty-ico { width: 64px; height: 64px; border-radius: 22px; background: #ecfeff; display: grid; place-items: center; color: #0891b2; }
.mo-empty-ico .mo-ico { width: 32px; height: 32px; }
.mo-steps { gap: 14px; }
.mo-steps > div { display: flex; gap: 12px; align-items: flex-start; }
.mo-steps span { flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%; background: #cffafe; color: #0e7490; font-weight: 700; font-size: 13px; display: grid; place-items: center; }
.mo-steps p { margin: 2px 0 0; line-height: 1.5; }
.mo-ghost { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mo-ghost span { display: block; font-size: 13px; font-weight: 700; color: var(--muted); }
.mo-ghost b { font-size: 26px; font-weight: 700; color: var(--border); }
.mo-switch-l { display: flex; flex-direction: column; gap: 2px; }
.mo-switch { position: relative; flex-shrink: 0; width: 52px; height: 32px; border-radius: 16px; border: 0; padding: 0; background: var(--border); cursor: pointer; transition: background 0.2s ease; }
.mo-switch i { position: absolute; left: 3px; top: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); transition: transform 0.2s ease; }
.mo-switch.on { background: var(--accent); }
.mo-switch.on i { transform: translateX(20px); }

/* weight */
.mo-diverge { position: relative; flex: 1; height: 12px; border-radius: 6px; background: var(--panel-2); }
.mo-diverge i { position: absolute; top: 0; bottom: 0; border-radius: 6px; }
.mo-diverge b { position: absolute; left: 50%; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: var(--text); }
.mo-comp { display: flex; align-items: center; gap: 12px; }
.mo-comp > span { width: 44px; font-weight: 700; }
.mo-comp > b { width: 70px; text-align: right; font-variant-numeric: tabular-nums; }
.mo-dark { background: var(--n-ink); color: #fff; }
.mo-dark .mo-split span { font-size: 14px; font-weight: 700; color: #cbd5e1; }
.mo-dark-val { font-size: 40px; font-weight: 700; letter-spacing: -0.03em; line-height: 1; }
.mo-dark-val small { font-size: 16px; font-weight: 600; color: #cbd5e1; letter-spacing: 0; }
.mo-dark p { margin: 0; font-size: 14px; line-height: 1.5; color: #e5e7eb; }

@media (prefers-reduced-motion: reduce) { .mo-switch, .mo-switch i { transition: none; } }
/* Breathing halves: readable on a light card and on the dark sheet hero. */
.mo-half-val.awake { color: var(--text); }
.mo-half-val.asleep { color: #0f766e; }
.view-sheet-body .mo-hero .mo-half-val.awake { color: #f3f4f6; }
.view-sheet-body .mo-hero .mo-half-val.asleep { color: #2dd4bf; text-shadow: 0 0 18px rgba(45,212,191,.35); }
.view-sheet-body .mo-hero .mo-half + .mo-half { border-left-color: rgba(255,255,255,.12); }

/* What affects you */
.mo-effects .mo-eff-lead { margin: 2px 0 10px; font-size: 13px; font-weight: 600; line-height: 1.45; }
.mo-eff-t { flex: 1; min-width: 0; }
.mo-eff-bar { display: block; height: 4px; margin-top: 6px; border-radius: 99px; background: var(--u-tile, #f4f5f7); overflow: hidden; max-width: 180px; }
.mo-eff-bar i { display: block; height: 100%; border-radius: inherit; background: var(--n-line, #c3c7cd); }
.mo-eff-bar.bad i { background: #f87171; }
.mo-eff-bar.good i { background: var(--accent); }
.mo-eff-note { margin: 10px 0 0; }
:root[data-theme="dark"] .mo-eff-bar { background: rgba(255, 255, 255, .08); }

/* Bedtime consistency */
.mo-bt-head { display: flex; gap: 18px; margin-bottom: 12px; }
.mo-bt-head > div { display: flex; flex-direction: column; gap: 2px; }
.mo-bt-head b { font-size: 16px; font-weight: 700; }
.mo-bt-rows { display: grid; gap: 4px; }
.mo-bt-row { display: grid; grid-template-columns: 14px 1fr; align-items: center; gap: 6px; font-size: 10px; color: var(--muted); }
.mo-bt-track { position: relative; height: 10px; border-radius: 99px; background: var(--u-tile, #f4f5f7); }
.mo-bt-track i { position: absolute; top: 0; bottom: 0; border-radius: 99px; background: #6366f1; }
.mo-bt-track b { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: var(--text); opacity: .35; border-radius: 1px; }
.mo-bt-axis { display: flex; justify-content: space-between; margin: 6px 0 8px 20px; font-size: 10px; color: var(--muted); }
:root[data-theme="dark"] .mo-bt-track { background: rgba(255, 255, 255, .08); }

/* Goal weight card (weight sheet) */
.mo-goal .mo-lbl { font-weight: 700; }
.mo-goal-main { display: flex; flex-direction: column; gap: 4px; }
.mo-goal-main b { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.mo-goal-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mo-goal-form input { width: 96px; font-size: 18px; font-weight: 700; padding: 8px 10px; border-radius: 12px; border: 1px solid var(--border); background: var(--panel-2); color: var(--text); }
.mo-goal-form span { color: var(--muted); font-weight: 600; margin-right: 4px; }
.mo-photos { flex-direction: row; align-items: center; gap: 12px; width: 100%; border: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.mo-photos > span:nth-child(2) { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.mo-photos b { font-size: 15px; }
.mo-photos-ico { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: rgba(168, 85, 247, 0.14); color: #9333ea; flex: none; }
.mo-photos svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mo-photos-chev { color: var(--muted); }

/* Add a weigh-in (weight sheet). Weight and body fat side by side, the
   unit inside each box; date and Save each get a full row so nothing is
   squashed on a phone (iOS date inputs won't shrink below their content). */
.mo-add-wi { width: 100%; margin: 0 0 12px; justify-content: center; text-align: center; }
.mo-wi-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.mo-wi-form label { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.mo-wi-form label > span:first-child { font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.mo-wi-form label em { font-style: normal; font-weight: 500; opacity: .8; }
.mo-wi-in { position: relative; display: block; min-width: 0; }
.mo-wi-in i { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-style: normal; color: var(--muted); font-weight: 600; pointer-events: none; }
.mo-wi-form input { display: block; box-sizing: border-box; width: 100%; min-width: 0; max-width: 100%; font-size: 18px; font-weight: 700; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--panel-2); color: var(--text); font-family: inherit; }
.mo-wi-in input { padding-right: 38px; }
.mo-wi-date { grid-column: 1 / -1; }
.mo-wi-form input[type="date"] { -webkit-appearance: none; appearance: none; font-size: 16px; font-weight: 600; min-height: 46px; text-align: left; }
.mo-wi-form input[type="date"]::-webkit-date-and-time-value { text-align: left; }
.mo-wi-form button[type="submit"] { grid-column: 1 / -1; width: 100%; justify-content: center; text-align: center; min-height: 46px; }
.mo-wi-del { flex: none; width: 28px; height: 28px; margin-left: 8px; border: 0; border-radius: 50%; background: var(--panel-2); color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.mo-wi-del svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
