:root {
  color-scheme: light;
  --forest: #194d38;
  --ink: #20372d;
  --muted: #55665b;
  --line: #d5dfd5;
  --wash: #edf4ec;
  --paper: #fafbf7;
  font: 100%/1.45 "DM Sans", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
button, textarea, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: transparent; }
button:disabled { opacity: .5; cursor: default; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid #418661; outline-offset: 3px; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h1, h2 { font-family: Georgia, serif; font-weight: 500; line-height: 1.12; letter-spacing: -.045em; }
h1 { font-size: clamp(2.4rem, 6vw, 3.4rem); }
h2 { font-size: 2rem; }
h3 { font-size: 1.04rem; }
.mast { background: var(--forest); color: white; }
.mast-in, main { width: min(100%, 48rem); margin: auto; padding: 0 1.25rem; }
.mast-in, .brand, .header-button, .day-head, .balance-line, .compose-actions, .journal-head, .range, .attachment, .replying, .meal-row { display: flex; align-items: center; }
.mast-in { min-height: 4.25rem; justify-content: space-between; }
.brand { font-weight: 750; font-size: 1.3rem; letter-spacing: -.045em; gap: .4rem; }
.brand img { border-radius: .55rem; }
.header-button { color: white; gap: .55rem; font-weight: 600; padding: .6rem .78rem; border: 1px solid #72957e; border-radius: .7rem; }
.book { width: 16px; height: 17px; border: 1.6px solid currentColor; border-radius: 3px; box-shadow: inset 3px 0 0 var(--forest), inset 4px 0 0 currentColor; }
main { position: relative; }
.conversation { display: flex; flex-direction: column; height: calc(100dvh - 4.25rem); min-height: 33rem; padding: 1.3rem 0 max(.85rem, env(safe-area-inset-bottom)); }
.day-head, .balance-line, .journal-head, .range, .meal-row { justify-content: space-between; gap: .7rem; }
.date { font-size: .9rem; color: var(--muted); margin-bottom: .12rem; }
.balance { margin-top: .85rem; padding: .8rem 1.05rem; color: white; background: var(--forest); border-radius: .85rem; }
.fuel-line { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; }
.balance .fuel-line { align-items: center; }
.fuel-line small { display: block; }
#fuelScale, #logged { color: #d7e7d9; font-size: .82rem; }
.fuel-reading { white-space: nowrap; color: #d7e7d9; font-variant-numeric: tabular-nums; }
.fuel-reading b { color: #fff9e8; font-size: clamp(1.8rem, 6vw, 2.25rem); line-height: 1; letter-spacing: -.045em; }
.balance-line { align-items: baseline; flex-wrap: wrap; font-size: .9rem; margin-top: .4rem; gap: .15rem .65rem; }
progress { display: block; width: 100%; appearance: none; height: .35rem; border: 0; border-radius: 2rem; overflow: hidden; background: #d4e3d4; margin-top: .45rem; }
progress::-webkit-progress-bar { background: #d4e3d4; }
progress::-webkit-progress-value { background: var(--forest); }
progress::-moz-progress-bar { background: var(--forest); }
.fuel-track { height: .65rem; mask-image: repeating-linear-gradient(to right, #000 0 calc(10% - 2px), transparent calc(10% - 2px) 10%); }
.balance .fuel-track, .balance .fuel-track::-webkit-progress-bar { background: #4a705d; }
.balance .fuel-track::-webkit-progress-value { background: #c5deaa; }
.balance .fuel-track::-moz-progress-bar { background: #c5deaa; }
.meal-fuel { width: min(100%, 23rem); padding: .7rem .9rem .8rem; color: var(--forest); background: #e5efdf; border-radius: .75rem; }
.meal-fuel .fuel-line { flex-wrap: wrap; gap: .15rem .65rem; font-weight: 650; }
.meal-miles { font-size: 1.35rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stream { overflow: auto; flex: 1 1 auto; min-height: 6rem; padding: 1.25rem .2rem; overscroll-behavior: contain; }
.empty { margin: clamp(.5rem, 6vh, 4rem) 0 1rem; max-width: 29rem; }
.empty h2 { font-size: clamp(1.8rem, 4.5vw, 2.4rem); color: var(--forest); }
.empty p { color: var(--muted); margin-top: .5rem; line-height: 1.55; }
.turn { display: flex; flex-direction: column; align-items: flex-start; gap: .45rem; margin-bottom: 1.1rem; }
.bubble { padding: .7rem .9rem; border: 1px solid var(--line); border-radius: .95rem .95rem .95rem .22rem; background: white; max-width: 94%; white-space: pre-wrap; overflow-wrap: anywhere; }
.user { align-self: flex-end; background: var(--wash); border-color: transparent; border-radius: .95rem .95rem .22rem .95rem; }
.byline { display: block; color: var(--forest); font-size: .85rem; font-weight: 700; margin-bottom: .2rem; }
.photo-link { display: block; text-align: left; padding: 0; }
.photo-link img { display: block; width: min(64vw, 15rem); aspect-ratio: 4 / 3; object-fit: contain; object-position: left; border-radius: .6rem; margin-bottom: .3rem; }
.photo-link span { display: block; font-weight: 650; color: var(--forest); }
.meta, .pending, .stats-note { color: var(--muted); font-size: .9rem; }
.composer, #gate { background: white; border: 1px solid #abbfaf; padding: .8rem; border-radius: 1rem; box-shadow: 0 4px 18px #173e2f0b; }
#gate { margin-top: 2rem; }
#gate p, #gate input { margin: .75rem 0; }
#gate label, #gate input { display: block; }
.auth-card { max-width: 31rem; margin-inline: auto; padding: clamp(1rem, 4vw, 2rem) !important; }
.auth-card h1 { font-size: 2.1rem; }
#gate input[type=password] { width: 100%; border: 1px solid #abbfaf; border-radius: .55rem; padding: .65rem; margin-top: .25rem; }
#gate label.remember { display: flex; gap: .5rem; align-items: center; margin: .7rem 0 1rem; }
#gate .remember input { margin: 0; accent-color: var(--forest); }
.device-actions { display: flex; flex-wrap: wrap; border-top: 1px solid var(--line); margin-top: 1rem; }
.composer:focus-within { border-color: var(--forest); }
textarea { display: block; border: none; border-radius: .3rem; width: 100%; resize: vertical; padding: .25rem .35rem; line-height: 1.45; min-height: 3.1rem; max-height: 24vh; }
.compose-actions { gap: .4rem; margin-top: .35rem; }
.primary, .send, .text-button, .close, .nav-step { min-height: 42px; border-radius: .65rem; padding: .45rem .75rem; font-weight: 650; }
.primary { background: var(--forest); color: white; }
.send { background: var(--wash); color: var(--forest); margin-left: auto; }
.text-button { color: var(--forest); }
.camera-button { display: inline-flex; align-items: center; gap: .55rem; }
.camera { position: relative; width: 19px; height: 14px; border: 1.6px solid currentColor; border-radius: 3px; }
.camera::before { content: ""; position: absolute; top: 2px; left: 5px; border: 1.3px solid currentColor; width: 6px; height: 6px; border-radius: 50%; }
.camera::after { content: ""; position: absolute; top: -4px; left: 3px; width: 8px; height: 3px; border-radius: 2px; background: currentColor; }
.attachment, .replying { gap: .55rem; color: var(--forest); font-size: .9rem; }
.attachment img { width: 3rem; height: 3rem; object-fit: cover; border-radius: .4rem; }
.replying button { padding: .15rem .4rem; min-height: 32px; }
.notice { background: #fff0d7; color: #64400e; padding: .65rem 1rem; border-radius: .7rem; margin: .5rem 0; }
dialog { position: fixed; width: min(94vw, 34rem); max-height: 86dvh; padding: 1.25rem; border: 1px solid var(--line); border-radius: 1.2rem; color: var(--ink); background: var(--paper); overscroll-behavior: contain; }
dialog::backdrop { background: #172b22a6; }
.close, .nav-step { font-size: 1.5rem; line-height: 1; background: var(--wash); }
.periods { display: flex; margin: 1.2rem 0 .8rem; padding: .22rem; gap: .2rem; border-radius: .75rem; background: #e7eee6; }
.periods button { flex: 1; border-radius: .55rem; min-height: 40px; font-weight: 650; }
.periods button[aria-pressed=true] { background: var(--forest); color: white; }
.date-pick { font-weight: 650; position: relative; color: var(--forest); text-align: center; }
.date-pick input { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; }
.date-pick:focus-within { outline: 2px solid var(--forest); }
.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: .65rem; margin: 1rem 0 .7rem; }
.metric { margin: 0; padding: .85rem; background: var(--wash); border-radius: .7rem; }
.metric dt { font-size: .86rem; color: var(--muted); }
.metric dd { margin: .2rem 0 0; font-weight: 700; font-size: 1.35rem; color: var(--forest); }
#statsBody h3 { margin: 1rem 0 .3rem; }
.day-row { width: 100%; display: grid; grid-template-columns: 4.4rem 1fr 7rem; align-items: center; gap: .5rem; text-align: left; min-height: 40px; border-bottom: 1px solid var(--line); }
.day-row small { text-align: right; font-size: .85rem; color: var(--muted); }
.day-row progress { margin: 0; }
.meal-row { width: 100%; text-align: left; border-bottom: 1px solid var(--line); min-height: 44px; }
.meal-row button:first-child { flex: 1; text-align: left; color: var(--forest); padding: .6rem 0; font-weight: 650; }
.sr-only { position: absolute; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; }
@media(max-width:420px) { .mast-in, main { padding-left: .85rem; padding-right: .85rem; } .compose-actions button { padding-inline: .55rem; } .day-row { grid-template-columns: 3.6rem 1fr 6.5rem; } }
@media(max-height:620px) { .conversation { min-height: 25rem; padding-top: .55rem; } .empty { margin: .5rem 0; } }
