/* Life: built on the Epsila dashboard design system (web/src/app/eps-theme.css and
   the record kit): Sora, soft-depth widgets, tinted section headers, the shared
   button, switch, tab bar and result widget shapes, light and dark at parity. */

@font-face {
  font-family: 'Sora';
  src: url('/fonts/sora.woff2') format('woff2');
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --font: 'Sora', -apple-system, system-ui, sans-serif;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --tabbar: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

:root, [data-theme='dark'] {
  color-scheme: dark;
  --green: #1fd978; --green-hi: #45e391; --green-fg: #04130b; --green-soft: rgba(31,217,120,.13);
  --bg: #08090a; --surface: #0d0e10; --muted: #121316;
  --border: rgba(255,255,255,.075); --border-hi: rgba(255,255,255,.16);
  --fg: #f0f0f2; --fg-muted: #9a9aa2; --fg-dim: #65656d; --fg-faint: #3f3f46;
  --error: #ff5d57; --error-soft: rgba(255,93,87,.12);
  --warn: #f5b544; --warn-soft: rgba(245,181,68,.12);
  --info: #5aa2ff; --info-soft: rgba(90,162,255,.12);
  --glass: rgba(13,14,16,.82);
  --ctl-bg: rgba(255,255,255,.05);
  --card-bg: linear-gradient(160deg, #16181b 0%, #0e0f12 100%);
  --card-border: rgba(255,255,255,.06);
  --card-shadow: 0 1px 0 rgba(255,255,255,.05) inset, 0 18px 38px -22px rgba(0,0,0,.9), 0 2px 8px -4px rgba(0,0,0,.6);
  --tile-bg: linear-gradient(165deg, rgba(255,255,255,.045), rgba(255,255,255,.012));
  --tile-shadow: 0 1px 0 rgba(255,255,255,.06) inset, 0 6px 16px -10px rgba(0,0,0,.8);
  --chip-bg: rgba(255,255,255,.04);
  --track-bg: #0a0b0d;
  --track-inset: 0 1px 2px rgba(0,0,0,.6) inset, 0 1px 0 rgba(255,255,255,.03);
  --fill-bg: linear-gradient(90deg, rgba(31,217,120,.55), var(--green));
  --fill-shadow: 0 0 10px -1px rgba(31,217,120,.4), 0 1px 0 rgba(255,255,255,.25) inset;
  --viz-1: #3987e5; --viz-2: #d95926; --viz-3: #199e70;
  --t-slate: #9aa7b8; --t-slate-soft: rgba(154,167,184,.14); --t-slate-wash: rgba(154,167,184,.05);
  --t-indigo: #8f99f2; --t-indigo-soft: rgba(143,153,242,.15); --t-indigo-wash: rgba(143,153,242,.055);
  --t-teal: #3ecfc0; --t-teal-soft: rgba(62,207,192,.14); --t-teal-wash: rgba(62,207,192,.05);
  --t-violet: #b18cf0; --t-violet-soft: rgba(177,140,240,.15); --t-violet-wash: rgba(177,140,240,.055);
  --t-amber: #edb14e; --t-amber-soft: rgba(237,177,78,.14); --t-amber-wash: rgba(237,177,78,.05);
  --t-rose: #f06a8a; --t-rose-soft: rgba(240,106,138,.14); --t-rose-wash: rgba(240,106,138,.05);
  --t-green: var(--green); --t-green-soft: var(--green-soft); --t-green-wash: rgba(31,217,120,.05);
  --sheet-shadow: 0 -20px 60px rgba(0,0,0,.6);
}

[data-theme='light'] {
  color-scheme: light;
  --green: #007a45; --green-hi: #008f51; --green-fg: #ffffff; --green-soft: rgba(0,122,69,.12);
  --bg: #f4f6f8; --surface: #ffffff; --muted: #eef1f4;
  --border: rgba(13,23,33,.10); --border-hi: rgba(13,23,33,.22);
  --fg: #0e1411; --fg-muted: #586069; --fg-dim: #828a93; --fg-faint: #aeb5bd;
  --error: #d83a34; --error-soft: rgba(216,58,52,.10);
  --warn: #b9791a; --warn-soft: rgba(185,121,26,.12);
  --info: #2f6fd6; --info-soft: rgba(47,111,214,.10);
  --glass: rgba(255,255,255,.86);
  --ctl-bg: rgba(15,23,42,.05);
  --card-bg: linear-gradient(160deg, #ffffff 0%, #f5f7f9 100%);
  --card-border: rgba(13,23,33,.08);
  --card-shadow: 0 1px 0 rgba(255,255,255,.9) inset, 0 18px 38px -24px rgba(15,23,42,.28), 0 2px 8px -4px rgba(15,23,42,.10);
  --tile-bg: linear-gradient(165deg, rgba(15,23,42,.035), rgba(15,23,42,.012));
  --tile-shadow: 0 1px 0 rgba(255,255,255,.85) inset, 0 6px 16px -12px rgba(15,23,42,.22);
  --chip-bg: rgba(15,23,42,.04);
  --track-bg: #e7eaee;
  --track-inset: 0 1px 2px rgba(15,23,42,.14) inset, 0 1px 0 rgba(255,255,255,.6);
  --fill-bg: linear-gradient(90deg, rgba(0,122,69,.6), var(--green));
  --fill-shadow: 0 0 8px -2px rgba(0,122,69,.3), 0 1px 0 rgba(255,255,255,.4) inset;
  --viz-1: #2a78d6; --viz-2: #eb6834; --viz-3: #1baf7a;
  --t-slate: #55657a; --t-slate-soft: rgba(85,101,122,.12); --t-slate-wash: rgba(85,101,122,.05);
  --t-indigo: #4a56c8; --t-indigo-soft: rgba(74,86,200,.11); --t-indigo-wash: rgba(74,86,200,.05);
  --t-teal: #0e8a80; --t-teal-soft: rgba(14,138,128,.11); --t-teal-wash: rgba(14,138,128,.05);
  --t-violet: #7a4fc0; --t-violet-soft: rgba(122,79,192,.11); --t-violet-wash: rgba(122,79,192,.05);
  --t-amber: #b9791a; --t-amber-soft: rgba(185,121,26,.12); --t-amber-wash: rgba(185,121,26,.05);
  --t-rose: #c8385e; --t-rose-soft: rgba(200,56,94,.11); --t-rose-wash: rgba(200,56,94,.05);
  --t-green-wash: rgba(0,122,69,.05);
  --sheet-shadow: 0 -20px 60px rgba(15,23,42,.18);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--fg); }
body { font: 14.5px/1.5 var(--font); -webkit-font-smoothing: antialiased; min-height: 100dvh; overscroll-behavior-y: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--font); letter-spacing: -0.02em; }
.num, input[type=number] { font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

#app { max-width: 600px; margin: 0 auto; padding: calc(18px + var(--safe-t)) 16px calc(var(--tabbar) + var(--safe-b) + 28px); }
#app > * + * { margin-top: 14px; }

/* page header */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 2px 6px; }
.top h1 { font-size: 26px; line-height: 1.15; margin: 0; font-weight: 700; }
.top .sub { color: var(--fg-muted); font-size: 13px; margin-top: 3px; }
.sync { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; color: var(--fg-muted); padding: 6px 10px; border-radius: 999px; background: var(--chip-bg); white-space: nowrap; }
.sync i { width: 7px; height: 7px; border-radius: 50%; background: var(--fg-dim); }
.sync.ok i { background: var(--green); }
.sync.busy i { background: var(--warn); }
.sync.off i { background: var(--error); }

/* widget: the record kit's section card */
.w { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: var(--radius-lg); box-shadow: var(--card-shadow); }
.w-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: var(--wash); border-bottom: 1px solid var(--border); border-radius: calc(var(--radius-lg) - 1px) calc(var(--radius-lg) - 1px) 0 0; min-height: 52px; }
.w-head.solo { border-bottom: 0; border-radius: calc(var(--radius-lg) - 1px); }
.w-ico { width: 28px; height: 28px; border-radius: 8px; background: var(--soft); color: var(--tint); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.w-ico svg { width: 15px; height: 15px; }
.w-title { font-size: 14.5px; font-weight: 650; margin: 0; flex: 1; min-width: 0; letter-spacing: -0.01em; }
.w-extra { display: flex; align-items: center; gap: 8px; flex: none; }
.w-body { padding: 14px 16px 16px; }
.w-body.tight { padding: 4px 16px 6px; }
.tint-slate { --tint: var(--t-slate); --soft: var(--t-slate-soft); --wash: var(--t-slate-wash); }
.tint-indigo { --tint: var(--t-indigo); --soft: var(--t-indigo-soft); --wash: var(--t-indigo-wash); }
.tint-teal { --tint: var(--t-teal); --soft: var(--t-teal-soft); --wash: var(--t-teal-wash); }
.tint-violet { --tint: var(--t-violet); --soft: var(--t-violet-soft); --wash: var(--t-violet-wash); }
.tint-amber { --tint: var(--t-amber); --soft: var(--t-amber-soft); --wash: var(--t-amber-wash); }
.tint-rose { --tint: var(--t-rose); --soft: var(--t-rose-soft); --wash: var(--t-rose-wash); }
.tint-green { --tint: var(--t-green); --soft: var(--t-green-soft); --wash: var(--t-green-wash); }

/* text */
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--fg-muted); }
.dim { color: var(--fg-dim); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.strong { font-weight: 650; }
.figure { font-size: 30px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.figure small { font-size: 14px; font-weight: 500; color: var(--fg-muted); margin-left: 3px; letter-spacing: 0; }
.mid { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.empty { color: var(--fg-muted); font-size: 13.5px; padding: 6px 0; }
.gap > * + * { margin-top: 10px; }
.mt { margin-top: 12px; }
.hr { height: 1px; background: var(--border); margin: 14px -16px; }

/* tiles */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.tiles.three { grid-template-columns: repeat(3, 1fr); }
.tile { background: var(--tile-bg); box-shadow: var(--tile-shadow); border: 1px solid var(--border); border-radius: var(--radius); padding: 11px 12px; min-width: 0; }
.tile .k { font-size: 12px; color: var(--fg-muted); font-weight: 500; line-height: 1.3; }
.tile .v { font-size: 19px; font-weight: 700; margin-top: 3px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.tile .v small { font-size: 12px; font-weight: 500; color: var(--fg-muted); margin-left: 2px; letter-spacing: 0; }
.tile.empty-v .v { color: var(--fg-faint); }

/* chips (status only) */
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--chip-bg); color: var(--fg-muted); white-space: nowrap; }
.chip.green { background: var(--green-soft); color: var(--green); }
.chip.amber { background: var(--warn-soft); color: var(--warn); }
.chip.red { background: var(--error-soft); color: var(--error); }
.chip.blue { background: var(--info-soft); color: var(--info); }

/* the call (readiness, load) */
.call { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius); background: var(--cs, var(--chip-bg)); border: 1px solid color-mix(in srgb, var(--cc, var(--border)) 30%, var(--border)); }
.call .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--cc, var(--fg-dim)); margin-top: 6px; flex: none; box-shadow: 0 0 0 4px color-mix(in srgb, var(--cc, transparent) 18%, transparent); }
.call strong { display: block; font-size: 15.5px; font-weight: 650; }
.call span { font-size: 13px; color: var(--fg-muted); }
.call.green { --cc: var(--green); --cs: var(--green-soft); }
.call.amber { --cc: var(--warn); --cs: var(--warn-soft); }
.call.red { --cc: var(--error); --cs: var(--error-soft); }

/* buttons (record kit tones) */
.btn { appearance: none; border: 1px solid var(--border); border-radius: 10px; padding: 0 16px; height: 44px; font-weight: 600; font-size: 14px; background: var(--ctl-bg); color: var(--fg); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; transition: background .15s, border-color .15s; }
.btn:active { transform: translateY(1px); }
.btn svg { width: 17px; height: 17px; flex: none; }
.btn.primary { background: var(--green-soft); color: var(--green); border-color: color-mix(in srgb, var(--green) 35%, transparent); }
.btn.solid { background: var(--green); color: var(--green-fg); border-color: var(--green); }
.btn.danger { background: var(--t-rose-soft); color: var(--t-rose); border-color: color-mix(in srgb, var(--t-rose) 30%, transparent); }
.btn.sm { height: 36px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .45; }
.hbtn { appearance: none; border: 1px solid var(--border); background: var(--ctl-bg); color: var(--fg); border-radius: 9px; height: 32px; padding: 0 12px; font-weight: 600; font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.hbtn svg { width: 14px; height: 14px; }
.iconbtn { width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--border); background: var(--ctl-bg); color: var(--fg-muted); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex: none; }
.iconbtn svg { width: 16px; height: 16px; }
.btnrow { display: flex; flex-wrap: wrap; gap: 8px; }
.btnrow .btn { flex: 1 1 0; min-width: 0; }

/* forms */
label.f { display: block; margin-bottom: 12px; }
label.f > span { display: block; font-size: 12.5px; font-weight: 500; color: var(--fg-muted); margin-bottom: 6px; }
.in, select.in, textarea.in { width: 100%; background: var(--ctl-bg); border: 1px solid var(--border); border-radius: 10px; padding: 0 12px; height: 44px; color: var(--fg); font-size: 16px; font-weight: 500; outline: none; }
textarea.in { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; }
select.in { padding-right: 30px; }
.in:focus { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.fgrid.three { grid-template-columns: repeat(3, 1fr); }
.err { color: var(--error); font-size: 13.5px; min-height: 20px; margin: 2px 0 8px; }

/* tab bar (segmented choice) */
.tabs { display: flex; padding: 3px; gap: 3px; background: var(--muted); border: 1px solid var(--border); border-radius: 11px; }
.tabs button { flex: 1; border: 0; background: transparent; height: 36px; padding: 0 8px; border-radius: 8px; font-weight: 600; font-size: 13px; color: var(--fg-muted); cursor: pointer; white-space: nowrap; }
.tabs button.on { background: var(--card-bg); color: var(--fg); box-shadow: var(--tile-shadow), 0 0 0 1px var(--border); }

/* switch */
.sw { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; cursor: pointer; font-size: 14px; }
.sw + .sw { border-top: 1px solid var(--border); }
.sw .track { width: 42px; height: 24px; border-radius: 999px; background: var(--border-hi); position: relative; flex: none; transition: background .15s; }
.sw .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: transform .18s var(--ease); }
.sw[aria-checked=true] .track { background: var(--green); }
.sw[aria-checked=true] .track::after { transform: translateX(18px); }

/* checklist rows */
.check { display: flex; align-items: center; gap: 12px; min-height: 50px; border-bottom: 1px solid var(--border); cursor: pointer; user-select: none; }
.check:last-child { border-bottom: 0; }
.check .box { width: 24px; height: 24px; border-radius: 7px; border: 1.5px solid var(--border-hi); display: flex; align-items: center; justify-content: center; flex: none; transition: background .15s, border-color .15s; }
.check .box svg { width: 14px; height: 14px; color: var(--green-fg); opacity: 0; }
.check.on .box { background: var(--green); border-color: var(--green); }
.check.on .box svg { opacity: 1; }
.check .lbl { flex: 1; font-weight: 500; }
.check.on .lbl { color: var(--fg-muted); }
.check .streak { font-size: 12px; color: var(--fg-muted); font-variant-numeric: tabular-nums; display: inline-flex; align-items: center; gap: 4px; }
.check .streak svg { width: 13px; height: 13px; color: var(--t-amber); }

/* progress track */
.meter { display: flex; align-items: center; gap: 10px; }
.track { height: 8px; flex: 1; background: var(--track-bg); box-shadow: var(--track-inset); border-radius: 99px; overflow: hidden; }
.track > i { display: block; height: 100%; background: var(--fill-bg); box-shadow: var(--fill-shadow); border-radius: 99px; transition: width .4s var(--ease); }
.meter .pct { font-size: 12.5px; font-weight: 650; min-width: 38px; text-align: right; font-variant-numeric: tabular-nums; }
.metric { padding: 4px 0 12px; }
.metric + .metric { border-top: 1px solid var(--border); padding-top: 12px; }

/* list rows */
.li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.li:last-child { border-bottom: 0; }
.li.tap { cursor: pointer; }
.li .t { font-weight: 600; }
.li .s { font-size: 12.5px; color: var(--fg-muted); margin-top: 2px; }
.li .r { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.li .r.green { color: var(--green); }
.li .chev { width: 16px; height: 16px; color: var(--fg-dim); flex: none; }
.li .done { width: 20px; height: 20px; border-radius: 50%; background: var(--green-soft); color: var(--green); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.li .done svg { width: 12px; height: 12px; }
.li .num-i { width: 20px; height: 20px; border-radius: 50%; background: var(--chip-bg); color: var(--fg-dim); font-size: 11px; font-weight: 650; display: inline-flex; align-items: center; justify-content: center; flex: none; }

/* exercise logging */
.ex-target { text-align: right; }
.ex-target .mid { color: var(--green); }
.why { font-size: 12.5px; color: var(--fg-muted); margin-top: 8px; display: flex; gap: 6px; align-items: flex-start; }
.why svg { width: 14px; height: 14px; flex: none; margin-top: 2px; }
.why.capped { color: var(--warn); }
.facts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.setline { display: flex; align-items: center; gap: 10px; padding: 0 12px; height: 44px; background: var(--tile-bg); box-shadow: var(--tile-shadow); border: 1px solid var(--border); border-radius: 10px; font-variant-numeric: tabular-nums; font-weight: 600; cursor: pointer; }
.setline + .setline { margin-top: 6px; }
.setline .n { color: var(--fg-dim); width: 18px; font-size: 12px; }
.setline .x { margin-left: auto; color: var(--fg-dim); }
.setline .x svg { width: 15px; height: 15px; }
.stepper { display: flex; align-items: center; height: 52px; background: var(--ctl-bg); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.stepper button { border: 0; background: transparent; width: 44px; height: 100%; font-size: 22px; font-weight: 400; color: var(--fg-muted); cursor: pointer; flex: none; }
.stepper button:active { background: var(--chip-bg); }
.stepper .mid-in { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; }
.stepper input { width: 100%; border: 0; background: transparent; text-align: center; font-size: 20px; font-weight: 700; padding: 0; outline: none; font-variant-numeric: tabular-nums; }
.stepper .unit { font-size: 10.5px; color: var(--fg-dim); font-weight: 600; line-height: 1; margin-top: -1px; }
.logger { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.logger.one { grid-template-columns: 1fr; }
.side-note { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--info); background: var(--info-soft); border-radius: 9px; padding: 8px 10px; margin-top: 10px; }
.side-note svg { width: 14px; height: 14px; flex: none; }

/* day strip as a tab bar */
.days { display: grid; grid-template-columns: repeat(8, minmax(56px, 1fr)); gap: 4px; padding: 3px; background: var(--muted); border: 1px solid var(--border); border-radius: 12px; overflow-x: auto; scrollbar-width: none; }
.days::-webkit-scrollbar { display: none; }
.days button { border: 0; background: transparent; border-radius: 9px; padding: 7px 4px; color: var(--fg-muted); font-weight: 650; font-size: 13px; cursor: pointer; text-align: center; position: relative; }
.days button small { display: block; font-weight: 500; font-size: 10.5px; color: var(--fg-dim); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.days button.on { background: var(--card-bg); color: var(--fg); box-shadow: var(--tile-shadow), 0 0 0 1px var(--border); }
.days button.today::after { content: ""; position: absolute; top: 5px; right: 6px; width: 5px; height: 5px; border-radius: 50%; background: var(--green); }

/* result widget (ResultNotice shape) */
.res { position: relative; padding: 16px 16px 16px 20px; border-radius: var(--radius-lg); border: 1px solid color-mix(in srgb, var(--rc) 38%, var(--border)); background: var(--card-bg); box-shadow: var(--card-shadow); --rc: var(--info); --rs: var(--info-soft); scroll-margin: 16px; animation: rise .25s var(--ease); }
.res::before { content: ""; position: absolute; left: -1px; top: -1px; bottom: -1px; width: 4px; border-radius: var(--radius-lg) 0 0 var(--radius-lg); background: var(--rc); }
.res.done { --rc: var(--green); --rs: var(--green-soft); }
.res.action { --rc: var(--warn); --rs: var(--warn-soft); }
.res.refused { --rc: var(--error); --rs: var(--error-soft); }
.res-head { display: flex; align-items: center; gap: 12px; }
.res-ico { width: 34px; height: 34px; border-radius: 10px; background: var(--rs); color: var(--rc); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.res-ico svg { width: 17px; height: 17px; }
.res-title { font-size: 15.5px; font-weight: 700; flex: 1; margin: 0; }
.res-text { font-size: 13.5px; color: var(--fg-muted); margin: 8px 0 0 46px; }
.res-text b { color: var(--fg); }
@keyframes rise { from { opacity: 0; transform: translateY(-6px); } }

/* bottom tab bar */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--glass); backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4); border-top: 1px solid var(--border); padding-bottom: var(--safe-b); }
.tabbar nav { max-width: 600px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); height: var(--tabbar); }
.tabbar button { border: 0; background: none; color: var(--fg-dim); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 11px; font-weight: 600; cursor: pointer; position: relative; }
.tabbar button svg { width: 22px; height: 22px; }
.tabbar button.on { color: var(--fg); }
.tabbar button.on svg { color: var(--green); }
.tabbar button.on::before { content: ""; position: absolute; top: 0; width: 26px; height: 2px; border-radius: 0 0 2px 2px; background: var(--green); }

/* sheets */
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 40; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.sheet { background: var(--surface); width: 100%; max-width: 600px; max-height: 92dvh; overflow: auto; border-radius: 20px 20px 0 0; border: 1px solid var(--border); border-bottom: 0; box-shadow: var(--sheet-shadow); padding: 0 18px; animation: up .22s var(--ease); }
.sheet-head { position: sticky; top: 0; z-index: 2; background: var(--surface); display: flex; align-items: center; gap: 10px; padding: 18px 0 14px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.sheet-head h3 { font-size: 17px; margin: 0; flex: 1; font-weight: 700; }
.sheet .actions { position: sticky; bottom: 0; display: flex; gap: 10px; background: var(--surface); border-top: 1px solid var(--border); padding: 12px 0 calc(14px + var(--safe-b)); margin-top: 8px; }
.sheet .actions .btn { flex: 1; }
.sheet-label { font-size: 12.5px; font-weight: 600; color: var(--fg-muted); margin: 6px 0 8px; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(40px); opacity: .6; } }

/* choice chips inside sheets (pick one / several) */
.picks { display: flex; flex-wrap: wrap; gap: 8px; }
.pick { border: 1px solid var(--border); background: var(--ctl-bg); border-radius: 10px; height: 40px; padding: 0 14px; font-size: 13.5px; font-weight: 600; cursor: pointer; color: var(--fg-muted); display: inline-flex; align-items: center; gap: 6px; }
.pick.on { background: var(--green-soft); border-color: color-mix(in srgb, var(--green) 40%, transparent); color: var(--green); }
.pick svg { width: 14px; height: 14px; }

/* rest timer */
.timer { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar) + var(--safe-b) + 12px); z-index: 30; background: var(--surface); border: 1px solid var(--border-hi); color: var(--fg); border-radius: 16px; padding: 8px 8px 8px 14px; display: flex; align-items: center; gap: 12px; box-shadow: 0 16px 40px rgba(0,0,0,.45); min-width: 260px; }
.timer .ring { width: 34px; height: 34px; flex: none; }
.timer .ring circle { fill: none; stroke-width: 3.5; }
.timer .ring .bg { stroke: var(--border-hi); }
.timer .ring .fg { stroke: var(--green); stroke-linecap: round; transform: rotate(-90deg); transform-origin: center; }
.timer .t { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; flex: 1; }
.timer .t small { display: block; font-size: 11px; color: var(--fg-muted); font-weight: 600; }
.timer.done { border-color: var(--green); }

/* charts */
.chart { width: 100%; display: block; }
.chart text { fill: var(--fg-dim); font-size: 10px; font-family: var(--font); }
.chart .ln { fill: none; stroke: var(--green); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.chart .ln2 { fill: none; stroke: var(--viz-1); stroke-width: 1.8; stroke-linejoin: round; }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .dot { fill: var(--green); stroke: var(--surface); stroke-width: 1.5; }
.chart .ref { stroke: var(--warn); stroke-dasharray: 4 3; stroke-width: 1.2; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--fg-muted); margin-top: 8px; }
.legend i { display: inline-block; width: 12px; height: 3px; border-radius: 2px; background: var(--green); vertical-align: middle; margin-right: 6px; }
.legend i.b { background: var(--viz-1); }
.legend i.w { background: var(--warn); }

/* table */
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.tbl th { text-align: left; color: var(--fg-muted); font-weight: 600; font-size: 12px; padding: 0 6px 8px; border-bottom: 1px solid var(--border); }
.tbl td { padding: 10px 6px; border-bottom: 1px solid var(--border); }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.r, .tbl th.r { text-align: right; }

/* steps (block, rehab) */
.steps { display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 4px; }
.steps div { text-align: center; }
.steps b { display: block; height: 6px; border-radius: 4px; background: var(--track-bg); box-shadow: var(--track-inset); }
.steps .past b { background: color-mix(in srgb, var(--green) 40%, var(--track-bg)); box-shadow: none; }
.steps .now b { background: var(--green); box-shadow: var(--fill-shadow); }
.steps span { display: block; font-size: 10.5px; color: var(--fg-dim); margin-top: 6px; font-weight: 600; }
.steps .now span { color: var(--fg); }

/* sign in */
.auth { min-height: 82dvh; display: flex; flex-direction: column; justify-content: center; }
.brand { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.brand .mark { width: 48px; height: 48px; border-radius: 14px; background: var(--green); color: var(--green-fg); display: flex; align-items: center; justify-content: center; box-shadow: 0 10px 30px -10px color-mix(in srgb, var(--green) 70%, transparent); }
.brand .mark svg { width: 26px; height: 26px; }
.brand h1 { margin: 0; font-size: 24px; font-weight: 700; }

/* ---------- desktop and tablet ---------- */
.side-brand { display: none; }
.chart { height: auto; }

@media (hover: hover) {
  .btn:hover, .hbtn:hover, .iconbtn:hover { border-color: var(--border-hi); }
  .btn.solid:hover { background: var(--green-hi); }
  .li.tap:hover .t { color: var(--green); }
  .setline:hover { border-color: var(--border-hi); }
  .tabbar button:hover { color: var(--fg); }
  .w { transition: box-shadow .2s var(--ease), transform .2s var(--ease); }
}

/* Tablet: one wider column, still the bottom tab bar. */
@media (min-width: 640px) {
  #app { max-width: 680px; padding-left: 24px; padding-right: 24px; }
  .tabbar nav { max-width: 680px; }
}

/* PC: sidebar navigation and widgets flowing into columns. */
@media (min-width: 960px) {
  body { --side: 232px; }
  .tabbar { top: 0; right: auto; width: var(--side); border-top: 0; border-right: 1px solid var(--border); padding: 22px 14px; display: flex; flex-direction: column; gap: 22px; background: var(--surface); backdrop-filter: none; -webkit-backdrop-filter: none; }
  .side-brand { display: flex; align-items: center; gap: 11px; padding: 0 8px; font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
  .side-brand .mark { width: 34px; height: 34px; border-radius: 10px; background: var(--green); color: var(--green-fg); display: inline-flex; align-items: center; justify-content: center; }
  .side-brand .mark svg { width: 19px; height: 19px; }
  .tabbar nav { display: flex; flex-direction: column; gap: 3px; height: auto; max-width: none; margin: 0; }
  .tabbar button { flex-direction: row; justify-content: flex-start; gap: 12px; height: 42px; padding: 0 12px; border-radius: 10px; font-size: 14px; font-weight: 600; color: var(--fg-muted); }
  .tabbar button svg { width: 19px; height: 19px; }
  .tabbar button.on { background: var(--green-soft); color: var(--fg); }
  .tabbar button.on::before { top: 10px; bottom: 10px; left: -14px; width: 3px; height: auto; border-radius: 0 3px 3px 0; }

  #app { max-width: none; margin: 0 0 0 var(--side); padding: 32px 36px 48px; }
  #app.app-view { columns: 2 330px; column-gap: 18px; max-width: 1400px; }
  #app.app-view > * { break-inside: avoid; margin: 0 0 18px; }
  #app.app-view > * + * { margin-top: 0; }
  #app.app-view > .top, #app.app-view > #result, #app.app-view > .days, #app.app-view > .page-actions { column-span: all; }
  #app.app-view > .page-actions { max-width: 460px; }
  #app.app-view > .days { max-width: 760px; }
  .top h1 { font-size: 30px; }
  .w:hover { transform: translateY(-1px); }

  #app.narrow { max-width: 640px; margin: 0 auto; padding-top: 48px; }
  #app.narrow.auth-page { max-width: 420px; }

  .sheet-bg { align-items: center; padding: 24px; }
  .sheet { border-radius: 18px; border-bottom: 1px solid var(--border); max-height: 86vh; max-width: 560px; animation: pop .2s var(--ease); }
  .sheet .actions { padding-bottom: 16px; }
  @keyframes pop { from { transform: scale(.97); opacity: .5; } }

  .timer { left: auto; right: 28px; bottom: 28px; transform: none; }
}

@media (min-width: 1440px) {
  #app.app-view { columns: 3 340px; }
}

a.hbtn { text-decoration: none; }

.goals { display: inline-flex; align-items: center; gap: 2px; color: var(--green); font-size: 12.5px; font-weight: 700; vertical-align: middle; }
.goals svg { width: 14px; height: 14px; }
.card-y, .card-r { display: inline-block; width: 9px; height: 12px; border-radius: 2px; vertical-align: middle; margin-left: 2px; }
.card-y { background: #f5c518; } .card-r { background: var(--error); }
.form { display: inline-flex; gap: 5px; }
.form .chip { width: 26px; justify-content: center; padding: 3px 0; }
.li .chip + .chip { margin-left: -4px; }
