:root {
  --bg: #F3F4F7; --card: #FFFFFF; --text: #1C2130; --muted: #6B7182; --line: #E2E5EC;
  --navy: #1F2A44; --orange: #E8692C; --orange-soft: #FFF1E9; --green: #2E7D5B; --green-soft: #E6F4EC; --red: #C0392B;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0F1420; --card: #1A2133; --text: #E8EAF0; --muted: #9AA1B2; --line: #2A3349; --orange-soft: #3A2419; --green-soft: #173327; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
#top { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 8px;
  background: var(--navy); color: #fff; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; }
.brand { font-weight: 700; letter-spacing: .2px; }
.sync { font-size: 12px; opacity: .85; } .sync.off { color: #FFC9A8; }
main { max-width: 640px; margin: 0 auto; padding: 12px 12px 24px; }
#tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 5; display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
#tabs a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 10px; font-size: 12px; color: var(--muted); text-decoration: none; }
#tabs a span { font-size: 20px; } #tabs a.on { color: var(--orange); font-weight: 700; }
h2 { font-size: 17px; margin: 0 0 10px; } h3.block { font-size: 13px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); margin: 18px 4px 8px; }
.card { background: var(--card); border-radius: 14px; padding: 14px; margin: 0 0 10px; box-shadow: 0 1px 2px rgba(0,0,0,.05); border: 1px solid var(--line); display: block; color: inherit; text-decoration: none; }
button { font: inherit; border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 10px; padding: 10px 14px; min-height: 44px; cursor: pointer; }
button.primary { background: var(--orange); border-color: var(--orange); color: #fff; font-weight: 700; }
button.wide { width: 100%; margin-top: 8px; }
button.link { background: none; border: none; color: var(--orange); padding: 6px 8px; min-height: 0; font-weight: 600; }
button.center { display: block; margin: -4px auto 8px; }
input { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px; min-height: 44px; width: 100%; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); flex: 1; }
.row { display: flex; gap: 8px; align-items: flex-end; margin-top: 8px; } .row > button { flex: 0 0 auto; }
.detail { color: var(--muted); font-size: 14px; margin: 6px 0 0; }
.dayhead { display: flex; align-items: center; justify-content: space-between; gap: 8px; text-align: center; margin: 4px 0 10px; }
.dayhead .nav { font-size: 26px; width: 48px; padding: 0; }
.date { font-weight: 800; font-size: 20px; } .phase { color: var(--orange); font-weight: 700; font-size: 14px; } .gymtitle { font-size: 14px; color: var(--muted); margin-top: 2px; }
.progress { display: flex; align-items: center; gap: 10px; } .progress span { color: var(--muted); font-size: 13px; }
.bar { flex: 1; height: 10px; background: var(--line); border-radius: 99px; overflow: hidden; } .bar i { display: block; height: 100%; background: var(--green); border-radius: 99px; transition: width .3s; }
.bar.goal { margin-bottom: 6px; } .bar.goal i { background: var(--orange); }
.water { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.water .lbl { font-size: 13px; color: var(--muted); } .water .big { font-size: 28px; font-weight: 800; } .water small { font-size: 13px; color: var(--muted); font-weight: 400; }
.water .btns { display: flex; gap: 8px; } .water .btns button { width: 52px; font-size: 22px; padding: 0; }
.cups { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; }
.cups span { height: 10px; border-radius: 4px; background: var(--line); } .cups span.full { background: #3A8DDE; }
.nowcard { background: var(--orange-soft); border-color: var(--orange); } .nowcard.done { background: var(--green-soft); border-color: var(--green); text-align: center; font-weight: 700; }
.step.is-next { border: 2px solid var(--orange); }
.step.is-done { opacity: .8; } .step.is-done .tick { background: var(--green); color: #fff; border-color: var(--green); }
.step.is-opt:not(.is-done) { border-style: dashed; }
.shead { display: flex; gap: 10px; align-items: center; }
.tick { flex: 0 0 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-weight: 800; font-size: 14px; color: var(--muted); }
.stitle { font-weight: 700; } .stitle em { font-weight: 400; font-size: 12px; color: var(--muted); font-style: normal; border: 1px solid var(--line); border-radius: 6px; padding: 1px 5px; margin-left: 4px; }
.doneline { display: flex; align-items: center; gap: 8px; margin-top: 8px; color: var(--green); font-weight: 700; font-size: 14px; }
.doneline .time { color: var(--muted); font-weight: 400; } .doneline .link { margin-left: auto; color: var(--muted); font-weight: 400; font-size: 13px; }
.pics { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 10px; } .pics.one { grid-template-columns: 1fr; }
.pics img { width: 100%; aspect-ratio: 3/2; object-fit: cover; border-radius: 10px; background: var(--line); }
.presc { margin-top: 10px; display: inline-block; background: var(--navy); color: #fff; font-weight: 800; border-radius: 8px; padding: 6px 10px; font-size: 15px; }
.prev { font-size: 14px; margin: 6px 0 0; }
.sets { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.sets button { min-width: 54px; font-weight: 700; } .sets button.on { background: var(--green); border-color: var(--green); color: #fff; }
.stars { display: flex; gap: 2px; } .stars button { padding: 0 6px; font-size: 24px; border: none; background: none; color: var(--line); } .stars button.on { color: #F4B400; }
.opts { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.opt { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; } .opt.sel { border-color: var(--orange); }
.ohead { width: 100%; display: flex; align-items: center; gap: 10px; border: none; border-radius: 0; text-align: left; }
.code { flex: 0 0 auto; background: var(--navy); color: #fff; font-weight: 800; font-size: 12px; border-radius: 6px; padding: 3px 6px; }
.kcal { margin-left: auto; font-size: 12px; color: var(--green); white-space: nowrap; }
.opt ul { margin: 0; padding: 4px 14px 0 34px; font-size: 14px; } .opt .primary { width: calc(100% - 16px); margin: 8px; }
.opt .row { margin: 6px; }
.chosen { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; } .chosen .kcal { margin-left: 0; }
.info { font-size: 14px; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); text-align: center; } .stats small { display: block; color: var(--muted); font-size: 12px; } .stats b { font-size: 20px; }
.ok { color: var(--green); } .bad { color: var(--red); }
.chart { width: 100%; height: auto; margin-top: 8px; }
.chart .line { fill: none; stroke: var(--orange); stroke-width: 2.5; } .chart .dot { fill: var(--orange); }
.chart .grid { stroke: var(--line); stroke-width: 1; } .chart .goalline { stroke: var(--green); stroke-dasharray: 5 4; stroke-width: 1.5; }
.chart .ax { fill: var(--muted); font-size: 10px; }
table.list { width: 100%; border-collapse: collapse; font-size: 14px; } table.list td { padding: 8px 4px; border-bottom: 1px solid var(--line); }
table.list td:nth-child(n+2) { text-align: right; } table.ex td:nth-child(2) { text-align: left; }
.chip { display: inline-block; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; font-size: 12px; margin: 1px; }
.hrow { display: grid; grid-template-columns: 1fr 80px 40px; gap: 10px; align-items: center; padding: 10px 2px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.hrow small { display: block; color: var(--muted); font-size: 12px; } .hrow span { text-align: right; font-size: 13px; color: var(--muted); }
.mini { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; } .mini i { display: block; height: 100%; background: var(--orange); } .mini i.full { background: var(--green); }
.remrow { display: grid; grid-template-columns: 28px 110px 1fr; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.remrow input[type=checkbox] { width: 22px; height: 22px; min-height: 0; } .remrow small { display: block; color: var(--muted); font-size: 12px; }
#toast { position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--navy); color: #fff;
  padding: 10px 16px; border-radius: 10px; z-index: 10; font-size: 14px; box-shadow: 0 4px 16px rgba(0,0,0,.25); }
