:root {
  --green: #2f6f4f;
  --green-dark: #245540;
  --green-soft: #e7f0ea;
  --bg: #f6f5f1;
  --card: #ffffff;
  --text: #20281f;
  --muted: #7a8278;
  --border: #e7e6df;
  --danger: #b3372f;
  --radius: 16px;
  --shadow: 0 1px 3px rgba(20, 40, 25, 0.06), 0 4px 16px rgba(20, 40, 25, 0.05);
  --topbar-h: 56px;
}

html.dark {
  --green: #3f9068;
  --green-dark: #357a58;
  --green-soft: #20382b;
  --bg: #14181a;
  --card: #1e2426;
  --text: #e8eae6;
  --muted: #9aa39b;
  --border: #2f383a;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
.hidden { display: none !important; }

/* Form controls must follow the theme's text color (fixes invisible text in dark mode) */
input, textarea, select { color: var(--text); font-family: inherit; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
/* Keep native form controls (date/number spinners, dropdown arrow) legible on dark */
html.dark input, html.dark textarea, html.dark select { color-scheme: dark; }

/* Inline SVG icons */
.icon {
  width: 24px; height: 24px;
  display: inline-block;
  vertical-align: middle;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-sm { width: 18px; height: 18px; }
.icon-fill { fill: currentColor; stroke: none; }
.btn-icon { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }

/* Color-coded icon badges (soft tint + saturated icon) */
.acc-green { --acc: #2f9e6e; --acc-bg: rgba(47, 158, 110, 0.15); }
.acc-blue { --acc: #3d8fd6; --acc-bg: rgba(61, 143, 214, 0.15); }
.acc-purple { --acc: #8b6fd6; --acc-bg: rgba(139, 111, 214, 0.16); }
.acc-amber { --acc: #d9982f; --acc-bg: rgba(217, 152, 47, 0.18); }
.acc-teal { --acc: #2bb0a6; --acc-bg: rgba(43, 176, 166, 0.15); }
.acc-pink { --acc: #d6608a; --acc-bg: rgba(214, 96, 138, 0.15); }
.acc-orange { --acc: #e0683d; --acc-bg: rgba(224, 104, 61, 0.15); }
html.dark .acc-green { --acc-bg: rgba(47, 158, 110, 0.22); }
html.dark .acc-blue { --acc-bg: rgba(61, 143, 214, 0.22); }
html.dark .acc-purple { --acc-bg: rgba(139, 111, 214, 0.24); }
html.dark .acc-amber { --acc-bg: rgba(217, 152, 47, 0.24); }
html.dark .acc-teal { --acc-bg: rgba(43, 176, 166, 0.22); }
html.dark .acc-pink { --acc-bg: rgba(214, 96, 138, 0.22); }
html.dark .acc-orange { --acc-bg: rgba(224, 104, 61, 0.22); }

.icon-badge {
  width: 34px; height: 34px;
  border-radius: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--acc-bg);
  flex: 0 0 auto;
}
.icon-badge .icon { color: var(--acc); width: 20px; height: 20px; }
.icon-badge.small { width: 28px; height: 28px; border-radius: 9px; }
.icon-badge.small .icon { width: 17px; height: 17px; }

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* App shell: fixed viewport, each view scrolls internally (no page bounce) */
body {
  max-width: 520px;
  margin: 0 auto;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.view {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}

.scroll-area {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-bottom: 16px;
}

/* Top bar */
.topbar {
  flex: 0 0 auto;
  min-height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: max(8px, env(safe-area-inset-top)) 12px 8px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.topbar.center { justify-content: center; }
.topbar-title { text-align: center; flex: 1; min-width: 0; }
.topbar-title h1 { font-size: 1.15rem; font-weight: 700; }
.topbar-title span { display: block; font-size: 0.78rem; color: var(--muted); }
.topbar-actions { display: flex; gap: 6px; }
.icon-btn {
  flex: 0 0 auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 40px; height: 40px;
  font-size: 1.15rem;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.icon-btn:active { background: var(--border); }
.icon-btn.on { background: var(--green-soft); border-color: var(--green); }

/* Compact, locked diary header */
.diary-header {
  flex: 0 0 auto;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: max(6px, env(safe-area-inset-top)) 12px 10px;
  box-shadow: 0 2px 8px rgba(20, 40, 25, 0.05);
  z-index: 2;
}
.dh-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dh-title { text-align: center; flex: 1; min-width: 0; }
.dh-title h1 { font-size: 1.05rem; font-weight: 700; display: inline; }
.dh-title span { font-size: 0.78rem; color: var(--muted); margin-left: 6px; }
.dh-arrow {
  flex: 0 0 auto; background: none; border: none; color: var(--muted);
  width: 34px; height: 34px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.dh-summary {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 2px 2px;
  color: var(--text);
}
.dh-cal { display: flex; align-items: baseline; gap: 4px; }
.dh-cal-num { font-size: 1.7rem; font-weight: 800; letter-spacing: -0.5px; color: var(--green); }
.dh-cal-unit { font-size: 0.8rem; color: var(--muted); }
.dh-macros { display: flex; gap: 14px; margin-left: auto; }
.dh-m { display: flex; flex-direction: column; align-items: center; font-size: 0.62rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; }
.dh-m b { font-size: 0.9rem; color: var(--text); font-weight: 700; }
.dh-chevron { width: 18px; height: 18px; color: var(--muted); transition: transform 0.2s; }
.dh-summary[aria-expanded="true"] .dh-chevron { transform: rotate(180deg); }

.total-progress { margin-top: 8px; }
.total-bar { height: 7px; background: var(--bg); border-radius: 5px; overflow: hidden; }
.total-bar-fill { height: 100%; background: var(--green); border-radius: 5px; transition: width 0.4s ease; }
.total-bar-fill.over { background: var(--danger); }
.total-progress-label { font-size: 0.75rem; color: var(--muted); margin-top: 5px; }

.dh-expand { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.dh-sub-label { font-size: 0.72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; margin: 14px 0 8px; }
.total-macro-targets { display: flex; gap: 10px; }
.mt-item { flex: 1; }
.mt-label { font-size: 0.68rem; color: var(--muted); margin-bottom: 3px; }
.mt-bar { height: 5px; background: var(--bg); border-radius: 3px; overflow: hidden; }
.mt-fill { height: 100%; background: var(--green); border-radius: 3px; transition: width 0.4s ease; }
.water-row { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; }
.water-label { display: inline-flex; align-items: center; gap: 6px; font-size: 0.85rem; font-weight: 600; }
.water-ico { color: #3d8fd6; }

/* Edit-meal sheet */
.edit-items { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.edit-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: start;
  background: var(--bg);
}
.edit-item .ei-name { grid-column: 1; border: 1px solid var(--border); border-radius: 8px; padding: 8px; font-size: 0.9rem; font-weight: 600; background: var(--card); }
.edit-item .ei-portion { grid-column: 1; border: 1px solid var(--border); border-radius: 8px; padding: 7px 8px; font-size: 0.82rem; background: var(--card); color: var(--muted); }
.edit-item .ei-remove { grid-row: 1 / 3; grid-column: 2; background: none; border: none; color: var(--muted); font-size: 1rem; cursor: pointer; padding: 4px; }
.ei-macros { grid-column: 1; display: flex; gap: 6px; }
.ei-macros label { flex: 1; font-size: 0.62rem; color: var(--muted); text-transform: uppercase; text-align: center; }
.ei-macros input { width: 100%; border: 1px solid var(--border); border-radius: 8px; padding: 6px 4px; font-size: 0.85rem; text-align: center; background: var(--card); margin-top: 2px; }
.add-item { width: 100%; margin-bottom: 14px; }

/* Nutrient grids (micros) */
.nutri-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin: 0 16px 14px;
  padding: 14px 16px;
}
.nutri-card h3 { font-size: 0.95rem; margin-bottom: 12px; }
.est {
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1px 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  vertical-align: middle;
  margin-left: 6px;
}
.nutri-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.nutri { text-align: center; }
.nutri .nv { font-size: 1.05rem; font-weight: 700; }
.nutri .nv small { font-size: 0.62rem; font-weight: 500; color: var(--muted); margin-left: 1px; }
.nutri .nl { font-size: 0.66rem; color: var(--muted); margin-top: 1px; }
.nutri.primary .nv { color: var(--green); }
.review-nutri { margin-bottom: 16px; }

/* Barcode scanner */
.scanner {
  position: fixed; inset: 0;
  background: #000;
  z-index: 110;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.scanner video { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.scanner-reticle {
  position: relative;
  width: 75%; max-width: 320px; height: 150px;
  border: 3px solid #fff;
  border-radius: 14px;
  box-shadow: 0 0 0 9999px rgba(0,0,0,0.45);
}
.scanner-hint { position: relative; color: #fff; margin-top: 20px; font-weight: 600; }
.scanner-cancel { position: absolute; bottom: max(24px, env(safe-area-inset-bottom)); width: 60%; max-width: 280px; }

/* Search */
.search-row { display: flex; gap: 8px; margin-bottom: 12px; }
.search-row input {
  flex: 1; border: 1px solid var(--border); border-radius: 10px;
  padding: 11px 14px; font-size: 0.95rem; background: var(--bg); font-family: inherit;
}
.search-row input:focus { outline: 2px solid var(--green); }
.search-results { display: flex; flex-direction: column; gap: 8px; max-height: 45vh; overflow-y: auto; margin-bottom: 12px; }
.search-result {
  text-align: left;
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 12px;
  padding: 11px 13px;
  cursor: pointer;
}
.search-result:active { background: var(--bg); }
.search-result .sr-name { font-weight: 600; font-size: 0.9rem; }
.search-result .sr-meta { font-size: 0.78rem; color: var(--muted); margin-top: 2px; }
.search-empty { color: var(--muted); font-size: 0.85rem; text-align: center; padding: 16px; }
.food-serving { flex: 0 0 auto; align-self: end; margin-bottom: 14px; }

/* Plan card */
.plan-card .plan-headline { font-size: 1.9rem; font-weight: 800; letter-spacing: -1px; color: var(--green); }
.plan-card .plan-headline small { font-size: 0.85rem; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.plan-rows { display: flex; flex-direction: column; gap: 7px; margin-top: 10px; }
.plan-row { display: flex; justify-content: space-between; font-size: 0.85rem; }
.plan-row span:first-child { color: var(--muted); }
.plan-row span:last-child { font-weight: 600; }
.plan-eta { margin-top: 10px; font-size: 0.85rem; background: var(--green-soft); border-radius: 10px; padding: 9px 12px; }

/* Activity card */
.activity-stats { display: flex; gap: 20px; }
.activity-stat .num { font-size: 1.5rem; font-weight: 800; }
.activity-stat .lbl { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }

/* Form fields (sheets) */
.field-label { display: block; font-size: 0.78rem; color: var(--muted); margin: 12px 0 5px; font-weight: 600; }
.field-row { display: flex; gap: 10px; }
.field { flex: 1; }
.field input, .select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px;
  font-size: 1rem;
  font-family: inherit;
  background: var(--bg);
}
.field input:focus, .select:focus { outline: 2px solid var(--green); }
.segmented { display: flex; gap: 6px; }
.segmented button {
  flex: 1;
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 10px;
  padding: 10px 4px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}
.segmented button.active { background: var(--green); color: #fff; border-color: var(--green); }
.plan-preview {
  margin-top: 16px;
  background: var(--green-soft);
  border-radius: 12px;
  padding: 14px;
  font-size: 0.88rem;
  line-height: 1.6;
}
.plan-preview.hidden { display: none; }
.plan-preview b { font-size: 1.05rem; }

/* Entries */
/* Meals: a distinct, calm, readable grouped list (set apart from the cards elsewhere) */
.meals-area { background: var(--bg); }
.entries { display: flex; flex-direction: column; }
.entries:not(:empty) {
  margin: 14px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.entry {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.entry:last-child { border-bottom: none; }
.entry-thumb {
  width: 46px; height: 46px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg);
}
.entry-icon {
  width: 46px; height: 46px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  flex: 0 0 auto;
}
.entry-icon .icon { color: var(--muted); width: 22px; height: 22px; }
.entry-body { flex: 1; min-width: 0; }
.entry-name { font-weight: 600; font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry-sub { display: flex; align-items: center; gap: 8px; margin-top: 3px; font-size: 0.8rem; color: var(--muted); }
.entry-time { flex: 0 0 auto; }
.entry-macros { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry-cal { display: flex; flex-direction: column; align-items: flex-end; white-space: nowrap; line-height: 1.1; }
.entry-cal-num { font-weight: 800; font-size: 1.1rem; }
.entry-cal-unit { font-size: 0.64rem; color: var(--muted); }
.entry-delete {
  background: none; border: none;
  color: var(--muted);
  padding: 6px; cursor: pointer; line-height: 1;
}
.entry-delete .icon { width: 18px; height: 18px; }
.empty-hint { text-align: center; color: var(--muted); margin-top: 40px; line-height: 1.7; padding: 0 24px; }

/* Diary action bar (now a flex child at the bottom of the view) */
.action-bar {
  flex: 0 0 auto;
  display: flex;
  gap: 10px;
  padding: 10px 16px;
  background: var(--card);
  border-top: 1px solid var(--border);
}
.action-btn {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 9px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 0.78rem;
  color: var(--text);
  cursor: pointer;
}
.action-btn:active { background: var(--border); }
.action-icon { width: 24px; height: 24px; }

/* Bottom tab bar */
.tab-bar {
  flex: 0 0 auto;
  display: flex;
  background: var(--card);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1;
  background: none;
  border: none;
  padding: 8px 0 9px;
  font-size: 0.7rem;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
}
.tab-icon { width: 24px; height: 24px; }
.tab.active { color: var(--green); font-weight: 600; }

/* Dashboard */
.dash-cards { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.card h3 { font-size: 1rem; font-weight: 700; margin-bottom: 12px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-head h3 { margin-bottom: 0; }
.card-title { display: flex; align-items: center; gap: 10px; }
.card-title .est { font-weight: 600; }
.chart svg { width: 100%; height: auto; display: block; }
.chart-empty { color: var(--muted); font-size: 0.85rem; }
.weight-current { font-size: 1.4rem; font-weight: 700; margin-bottom: 10px; }
.weight-current small { font-size: 0.78rem; font-weight: 400; color: var(--muted); }

/* Macro bars */
.macro-bars { display: flex; flex-direction: column; gap: 11px; }
.macro-bar-row { display: grid; grid-template-columns: 56px 1fr 52px; align-items: center; gap: 10px; font-size: 0.85rem; }
.macro-bar-track { background: var(--bg); border-radius: 6px; height: 12px; overflow: hidden; }
.macro-bar-fill { height: 100%; border-radius: 6px; transition: width 0.4s ease; }
.macro-bar-row .val { text-align: right; font-weight: 600; }

/* ===== Coach screen ===== */
.coach-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 14px 14px 4px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.coach-feedback-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.coach-result { margin-top: 4px; }
.coach-hint { color: var(--muted); font-size: 0.85rem; line-height: 1.55; }
.coach-headline { font-size: 0.95rem; font-weight: 600; margin-bottom: 8px; line-height: 1.4; }
.coach-list { list-style: none; display: flex; flex-direction: column; gap: 7px; margin-bottom: 10px; }
.coach-list li { font-size: 0.88rem; line-height: 1.45; padding-left: 18px; position: relative; }
.coach-list li::before { content: "•"; color: var(--green); position: absolute; left: 4px; font-weight: 700; }
.coach-suggestion { font-size: 0.88rem; line-height: 1.45; background: var(--green-soft); border-radius: 10px; padding: 10px 12px; }
.coach-suggestion::before { content: "💡 "; }
.coach-result .spinner { width: 26px; height: 26px; border-width: 3px; margin: 12px auto; }

/* Chat thread */
.coach-chat { display: flex; flex-direction: column; gap: 10px; }
.chat-msg {
  max-width: 88%;
  padding: 10px 13px;
  border-radius: 16px;
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.chat-msg.user { align-self: flex-end; background: var(--green); color: #fff; border-bottom-right-radius: 5px; }
.chat-msg.coach { align-self: flex-start; background: var(--card); border: 1px solid var(--border); border-bottom-left-radius: 5px; box-shadow: var(--shadow); display: flex; gap: 8px; align-items: flex-start; }
.chat-msg.typing { align-self: flex-start; background: var(--card); border: 1px solid var(--border); color: var(--muted); font-style: italic; }
.chat-text { flex: 1; min-width: 0; }
.speak-msg {
  flex: 0 0 auto;
  background: none; border: none;
  font-size: 0.95rem; cursor: pointer;
  opacity: 0.6; padding: 0; line-height: 1;
  margin-top: 2px;
}
.speak-msg:active { opacity: 1; }

/* Coach input bar (pinned) */
.coach-input {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px 12px 6px;
  background: var(--card);
  border-top: 1px solid var(--border);
}
.coach-input input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 11px 16px;
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--bg);
}
.coach-input input:focus { outline: 2px solid var(--green); }
.mic-btn, .coach-send {
  flex: 0 0 auto;
  width: 44px; height: 44px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mic-btn { border: 1px solid var(--border); background: var(--bg); }
.mic-btn.recording { background: #f6d4cf; border-color: var(--danger); animation: pulse 1.2s infinite; }
.mic-btn:disabled { opacity: 0.5; }
.coach-send { border: none; background: var(--green); color: #fff; }
.coach-send:active { background: var(--green-dark); }
.coach-disclaimer {
  flex: 0 0 auto;
  font-size: 0.7rem; color: var(--muted); text-align: center;
  padding: 4px 16px max(8px, env(safe-area-inset-bottom));
  background: var(--card);
}

/* Sheets / modals */
.sheet {
  position: fixed;
  inset: 0;
  background: rgba(20, 30, 22, 0.5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 50;
}
.sheet-card {
  background: var(--card);
  width: 100%;
  max-width: 520px;
  border-radius: 20px 20px 0 0;
  padding: 24px 20px max(24px, env(safe-area-inset-bottom));
  max-height: 85vh;
  overflow-y: auto;
  animation: slideUp 0.22s ease;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet-card.center { text-align: center; border-radius: 20px; margin: auto; width: 84%; padding: 32px; animation: none; }
.sheet-card h2 { font-size: 1.1rem; margin-bottom: 12px; }
.sheet-note { font-size: 0.85rem; color: var(--muted); line-height: 1.5; margin-bottom: 12px; }
.export-btn { width: 100%; margin-bottom: 10px; }
.settings-row { width: 100%; margin-bottom: 10px; display: flex; align-items: center; gap: 12px; justify-content: flex-start; text-align: left; padding: 10px 12px; }
.users-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; max-height: 40vh; overflow-y: auto; }
.user-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; background: var(--bg); border-radius: 10px; }
.user-name { font-weight: 600; font-size: 0.9rem; }
.user-del { background: none; border: 1px solid var(--border); color: var(--danger); border-radius: 8px; padding: 5px 12px; font-size: 0.8rem; cursor: pointer; }

/* Feedback list (admin) */
.feedback-list { display: flex; flex-direction: column; gap: 10px; max-height: 55vh; overflow-y: auto; margin-bottom: 14px; }
.fb-item { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 11px 13px; }
.fb-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 5px; }
.fb-who { font-size: 0.8rem; font-weight: 700; }
.fb-when { font-size: 0.72rem; color: var(--muted); }
.fb-msg { font-size: 0.88rem; line-height: 1.45; white-space: pre-wrap; word-wrap: break-word; }
.fb-del { background: none; border: none; color: var(--muted); cursor: pointer; padding: 2px; }
.fb-del .icon { width: 16px; height: 16px; }

/* Diary strip: streak + water */
.diary-strip { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 16px 14px; }
.streak-pill { display: inline-flex; align-items: center; gap: 6px; background: var(--card); border: 1px solid var(--border); border-radius: 20px; padding: 8px 14px; font-size: 0.82rem; font-weight: 600; box-shadow: var(--shadow); white-space: nowrap; }
.streak-pill .icon { color: #e0683d; }
.water-tracker { display: flex; align-items: center; gap: 6px; background: var(--card); border: 1px solid var(--border); border-radius: 22px; padding: 4px; box-shadow: var(--shadow); }
.water-amount { display: inline-flex; align-items: center; gap: 5px; font-size: 0.82rem; font-weight: 600; min-width: 72px; justify-content: center; }
.water-amount .icon { color: #3d8fd6; }
.water-btn { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--border); background: var(--bg); font-size: 1.2rem; line-height: 1; cursor: pointer; color: var(--text); display: flex; align-items: center; justify-content: center; }
.water-btn:active { background: var(--border); }

/* Quick-add chips (favorites + recents) */
.quick-add { display: flex; gap: 8px; overflow-x: auto; padding: 0 16px 14px; -webkit-overflow-scrolling: touch; }
.quick-add::-webkit-scrollbar { display: none; }
.qa-chip { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; background: var(--card); border: 1px solid var(--border); border-radius: 20px; padding: 8px 12px; font-size: 0.8rem; color: var(--text); cursor: pointer; box-shadow: var(--shadow); white-space: nowrap; }
.qa-chip:active { background: var(--bg); }
.qa-chip .qa-cal { color: var(--muted); }
.qa-fav { color: #e0a83d; }
.qa-remove { border: none; background: none; color: var(--muted); font-size: 1rem; cursor: pointer; padding: 0 0 0 2px; line-height: 1; }

/* Favorite checkbox */
.fav-check { display: flex; align-items: center; gap: 9px; font-size: 0.85rem; margin-bottom: 14px; cursor: pointer; }
.fav-check input { width: 18px; height: 18px; }

/* Coach suggested-prompt chips */
.coach-prompts { display: flex; gap: 8px; overflow-x: auto; padding: 10px 12px 2px; flex: 0 0 auto; background: var(--card); }
.coach-prompts::-webkit-scrollbar { display: none; }
.coach-prompts button { flex: 0 0 auto; border: 1px solid var(--border); background: var(--bg); border-radius: 16px; padding: 7px 12px; font-size: 0.8rem; color: var(--green); font-weight: 600; cursor: pointer; white-space: nowrap; }
.coach-prompts button:active { background: var(--green-soft); }

/* Onboarding */
.onb-btn { width: 100%; margin-top: 10px; }

textarea, .review-name {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  font-size: 1rem;
  font-family: inherit;
  background: var(--bg);
  margin-bottom: 14px;
}
textarea:focus, .review-name:focus { outline: 2px solid var(--green); }

.voice-status { color: var(--green); font-weight: 600; margin-bottom: 10px; }
.voice-status:not(.hidden) { animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: 0.4; } }

.sheet-actions { display: flex; gap: 10px; }
.btn {
  flex: 1;
  border: none;
  border-radius: 12px;
  padding: 13px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}
.btn.primary { background: var(--green); color: #fff; }
.btn.primary:active { background: var(--green-dark); }
.btn.primary:disabled { opacity: 0.6; }
.btn.secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn.small { flex: 0 0 auto; padding: 7px 14px; font-size: 0.82rem; white-space: nowrap; border-radius: 10px; }

/* Review sheet */
.review-items { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.review-item { display: flex; justify-content: space-between; gap: 8px; font-size: 0.92rem; padding: 9px 11px; background: var(--bg); border-radius: 10px; }
.review-item .item-name { flex: 1; }
.review-item .item-portion { color: var(--muted); }
.assumptions { font-size: 0.8rem; color: var(--muted); margin-bottom: 12px; line-height: 1.5; }
.review-totals { display: flex; justify-content: space-between; font-size: 0.9rem; font-weight: 600; padding: 10px 4px; border-top: 1px solid var(--border); margin-bottom: 16px; }

/* Login */
.login-screen {
  position: fixed; inset: 0;
  background: var(--bg);
  z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.login-card { width: 100%; max-width: 320px; text-align: center; display: flex; flex-direction: column; gap: 12px; }
.login-logo { width: 76px; height: 76px; margin: 0 auto; border-radius: 20px; }
.login-card h1 { font-size: 1.5rem; }
.login-sub { color: var(--muted); font-size: 0.9rem; }
.login-card input {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 13px;
  font-size: 1rem;
  background: var(--card);
  text-align: center;
}
.login-card input:focus { outline: 2px solid var(--green); }
.login-error { color: var(--danger); font-size: 0.85rem; }

/* Spinner */
.spinner {
  width: 38px; height: 38px;
  border: 4px solid var(--border);
  border-top-color: var(--green);
  border-radius: 50%;
  margin: 0 auto 14px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
