:root {
  --bg: #eef6fb;
  --card: #ffffff;
  --ink: #2c3e50;
  --muted: #7c8fa0;
  --blue: #7fb8e0;
  --blue-soft: #dcecf8;
  --lime: #a8cf5a;
  --lime-soft: #edf6dc;
  --pink: #f2a7b5;
  --pink-soft: #fde8ec;
  --amber: #f0c36d;
  --amber-soft: #fdf3dd;
  --line: #e3ebf2;
  font-size: 17px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: -apple-system, "Sukhumvit Set", "Noto Sans Thai", system-ui, sans-serif;
}
main { padding: calc(env(safe-area-inset-top) + 8px) 14px calc(env(safe-area-inset-bottom) + 90px); max-width: 560px; margin: 0 auto; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
h2 { font-size: 1rem; margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: .82rem; margin: 6px 0 4px; }

.top { display: flex; align-items: center; justify-content: space-between; padding: 6px 0 12px; }
.top .title { flex: 1; text-align: center; }
.top .big { font-size: 1.4rem; font-weight: 700; }
.top .sub { color: var(--muted); font-size: .85rem; }
.nav { font-size: 2rem; width: 44px; height: 44px; border-radius: 50%; color: var(--blue); }
.nav:disabled { opacity: .25; }

.card { background: var(--card); border-radius: 18px; padding: 14px 16px; margin-bottom: 12px; box-shadow: 0 1px 3px rgba(44, 62, 80, .06); }
.hero { display: flex; gap: 16px; align-items: center; }
.ring {
  --p: 0; flex: none; width: 74px; height: 74px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--lime) calc(var(--p) * 1%), var(--blue-soft) 0);
}
.ring span { background: var(--card); width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; }
.phase { font-weight: 700; }
.streak { margin-top: 4px; }
.streak b { color: #6f9a2a; font-size: 1.15rem; }

.alert { border-radius: 14px; padding: 10px 14px; margin-bottom: 12px; font-size: .92rem; }
.alert.warn { background: var(--amber-soft); }
.alert.doctor { background: var(--pink-soft); }
.alert.good { background: var(--lime-soft); margin: 10px 0 0; }

.feels { display: flex; justify-content: space-between; margin-bottom: 10px; }
.feel { display: flex; flex-direction: column; align-items: center; padding: 6px 4px; border-radius: 14px; width: 19%; }
.feel .emo { font-size: 1.9rem; filter: grayscale(.7); opacity: .55; }
.feel small { font-size: .7rem; color: var(--muted); }
.feel.on { background: var(--blue-soft); }
.feel.on .emo { filter: none; opacity: 1; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 7px 12px; border-radius: 999px; background: #f3f6f9; font-size: .9rem; }
.chip.on { background: var(--blue); color: #fff; }
.chip.warnchip.on { background: var(--pink); }
.chip.good.on { background: var(--lime); }
.chip.watch.on { background: var(--amber); }

.chk { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 9px 0; border-bottom: 1px solid var(--line); }
.chk:last-child { border-bottom: 0; }
.chk .box { flex: none; width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--blue); display: grid; place-items: center; color: #fff; font-weight: 700; }
.chk.on .box { background: var(--lime); border-color: var(--lime); }
.chk.on > span:last-child { color: var(--muted); }
.differin { margin-top: 6px; border-radius: 12px; }
.differin.on { background: var(--lime-soft); padding: 0 10px; }
.differin .chk:not(:first-child) { padding-left: 24px; }

.row { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; }
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper button { width: 40px; height: 40px; border-radius: 50%; background: var(--blue-soft); font-size: 1.3rem; }
.stepper b { min-width: 34px; text-align: center; font-size: 1.2rem; }
.stepper b.low { color: #d9786b; }
.unit { color: var(--muted); font-size: .85rem; width: 30px; }
.glasses { font-size: 1.2rem; letter-spacing: 2px; margin-top: 4px; }
.glasses span { opacity: .2; }
.glasses span.full { opacity: 1; }

textarea { width: 100%; min-height: 70px; border: 1px solid var(--line); border-radius: 12px; padding: 10px; font: inherit; resize: vertical; }
input[type=date] { font: inherit; border: 1px solid var(--line); border-radius: 10px; padding: 6px 8px; background: #fff; color: var(--ink); }
.btn { display: block; width: 100%; text-align: center; padding: 12px; margin-top: 10px; border-radius: 12px; background: var(--blue-soft); }

.count { display: flex; justify-content: space-between; margin-top: 10px; font-size: .92rem; }
.bar { height: 10px; border-radius: 6px; background: var(--blue-soft); overflow: hidden; margin-top: 4px; }
.bar i { display: block; height: 100%; background: var(--lime); border-radius: 6px; }

.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cell { position: relative; aspect-ratio: 1; border-radius: 10px; background: #f3f6f9; display: grid; place-items: center; font-size: .75rem; color: var(--muted); }
.cell.ok { background: var(--lime); color: #fff; }
.cell.mid { background: var(--blue-soft); }
.cell.bad { background: var(--pink); color: #fff; }
.cell i { position: absolute; bottom: 4px; width: 5px; height: 5px; border-radius: 50%; background: #5b7fa3; }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; font-size: .78rem; color: var(--muted); }
.legend .cell { width: 14px; height: 14px; border-radius: 4px; aspect-ratio: auto; }
.legend .dot { width: 6px; height: 6px; border-radius: 50%; background: #5b7fa3; margin-left: 6px; }
.ins { padding: 8px 0; border-bottom: 1px solid var(--line); }
.ins:last-child { border-bottom: 0; }
ul { margin: 0; padding-left: 20px; }
li { margin: 4px 0; line-height: 1.45; }

.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; display: flex; background: rgba(255, 255, 255, .95);
  backdrop-filter: blur(10px); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.tabs button { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 8px 0 6px; color: var(--muted); }
.tabs button span { font-size: 1.2rem; }
.tabs button small { font-size: .72rem; }
.tabs button.on { color: #4f8fc0; font-weight: 700; }
