:root {
  color-scheme: light;
  --bg: #f6f7f5;
  --surface: #ffffff;
  --surface-2: #eef1ee;
  --line: #dde2dd;
  --text: #16201b;
  --text-2: #52514e;
  --muted: #7d837f;
  --accent: #167854;
  --accent-ink: #ffffff;
  --good: #0f7a3d;
  --good-bg: #e3f4e8;
  --bad: #c0392b;
  --bad-bg: #fbe6e3;
  --warn-bg: #fff3d6;
  --warn: #8a5a00;
  --series-1: #2a78d6;
  --r: 14px;
  --tap: 48px;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #121513;
    --surface: #1a1a19;
    --surface-2: #232624;
    --line: #333833;
    --text: #f0efec;
    --text-2: #c3c2b7;
    --muted: #8e938f;
    --accent: #2fa77a;
    --accent-ink: #06150e;
    --good: #4cc27a;
    --good-bg: #16301f;
    --bad: #ef7a6c;
    --bad-bg: #3a1c18;
    --warn-bg: #3a2e12;
    --warn: #f0c060;
    --series-1: #3987e5;
  }
}
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
body {
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
}
#app {
  max-width: 620px;
  margin: 0 auto;
  padding: 0 14px 96px;
}
h1,
h2,
h3 {
  margin: 0;
  font-weight: 650;
  letter-spacing: -0.01em;
}
h1 {
  font-size: 24px;
}
h2 {
  font-size: 19px;
}
h3 {
  font-size: 16px;
}
p {
  margin: 0.4em 0;
}
.dim {
  color: var(--text-2);
}
.muted {
  color: var(--muted);
  font-size: 14px;
}
.row {
  display: flex;
  gap: 10px;
  align-items: center;
}
.between {
  justify-content: space-between;
}
.wrap {
  flex-wrap: wrap;
}
.stack > * + * {
  margin-top: 12px;
}
header.top {
  padding: 18px 2px 10px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 16px;
  margin-top: 12px;
}
button {
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 12px;
  min-height: var(--tap);
  padding: 0 16px;
  background: var(--surface-2);
  color: var(--text);
}
button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 650;
}
button.ghost {
  background: transparent;
}
button.sm {
  min-height: 38px;
  padding: 0 12px;
  font-size: 14px;
}
button.wide {
  width: 100%;
}
button:active {
  transform: translateY(1px);
}
input,
select {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  min-height: var(--tap);
  padding: 0 12px;
  width: 100%;
}
label.field {
  display: block;
}
label.field span {
  display: block;
  font-size: 14px;
  color: var(--text-2);
  margin-bottom: 4px;
}
.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 4px;
}
.chips button {
  min-height: 40px;
  border-radius: 999px;
  white-space: nowrap;
}
.chips button[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
/* check-in items */
.item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.item:first-child {
  border-top: none;
}
.item .label {
  flex: 1;
}
.seg {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  flex: none;
}
.seg button {
  border: none;
  border-radius: 0;
  min-width: 58px;
  background: var(--surface);
}
.seg button[aria-pressed="true"].yes {
  background: var(--good-bg);
  color: var(--good);
  font-weight: 650;
}
.seg button[aria-pressed="true"].no {
  background: var(--bad-bg);
  color: var(--bad);
  font-weight: 650;
}
.stepper {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}
.stepper button {
  width: var(--tap);
  padding: 0;
  font-size: 22px;
}
.stepper output {
  min-width: 34px;
  text-align: center;
  font-size: 20px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.oz input {
  width: 90px;
  text-align: center;
}
/* status */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--text-2);
}
.badge.good {
  background: var(--good-bg);
  color: var(--good);
}
.badge.bad {
  background: var(--bad-bg);
  color: var(--bad);
}
.warning {
  background: var(--warn-bg);
  color: var(--warn);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 14px;
  margin-top: 8px;
}
/* stat tiles */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
}
.stat {
  background: var(--surface-2);
  border-radius: 12px;
  padding: 10px;
}
.stat b {
  display: block;
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}
.stat span {
  font-size: 13px;
  color: var(--text-2);
}
/* check-in strip */
.strip {
  display: grid;
  grid-template-columns: repeat(14, 1fr);
  gap: 3px;
  margin-top: 8px;
}
.strip i {
  aspect-ratio: 1;
  border-radius: 4px;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-style: normal;
  font-size: 11px;
  font-weight: 700;
}
.strip i.good {
  background: var(--good-bg);
  color: var(--good);
}
.strip i.bad {
  background: var(--bad-bg);
  color: var(--bad);
}
/* chart */
.chart {
  position: relative;
}
.chart svg {
  width: 100%;
  height: auto;
  display: block;
}
.chart .tip {
  position: absolute;
  pointer-events: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 13px;
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.12);
  white-space: nowrap;
  display: none;
}
ul.rules {
  margin: 8px 0 0;
  padding-left: 20px;
  color: var(--text-2);
  font-size: 15px;
}
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
table.data td,
table.data th {
  padding: 6px 4px;
  border-top: 1px solid var(--line);
  text-align: left;
}
/* tabs */
nav.tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: center;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
}
nav.tabs button {
  flex: 1;
  max-width: 155px;
  border: none;
  background: transparent;
  font-size: 14px;
  color: var(--text-2);
}
nav.tabs button[aria-current="page"] {
  color: var(--accent);
  font-weight: 700;
}
#toast {
  position: fixed;
  left: 50%;
  bottom: 84px;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 15px;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}
#toast.show {
  opacity: 1;
}
.err {
  color: var(--bad);
  font-size: 14px;
  min-height: 1.2em;
}
