/* CalAI — polished protein-first nutrition companion
   Warm cream base · green brand · protein-orange accent · no grain */

/* ── design tokens ─────────────────────────────────────────────────────── */
:root {
  /* surfaces */
  --bg:          #F9F6F1;
  --surface:     #FFFFFF;
  --surface-2:   #F2EDE4;

  /* ink */
  --ink:         #1C1B18;
  --ink-soft:    #68635B;
  --ink-faint:   #9C9790;

  /* borders */
  --line:        #E6E0D5;
  --line-strong: #D6CFC4;

  /* brand green */
  --brand:       #4C9A77;
  --brand-dark:  #3A7D60;
  --brand-soft:  #E6F2EC;
  --brand-muted: #C3DCCE;

  /* protein orange */
  --protein:     #D96843;
  --protein-dk:  #BA5535;
  --protein-soft:#F9EAE4;
  --protein-muted:#EEC8BA;

  /* macros */
  --carb: #C98A28;
  --fat:  #7C6AB8;

  /* semantic */
  --focus: #4C9A77;
  --amber: #C08018;

  /* typography */
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-ui:      "Hanken Grotesk", system-ui, -apple-system, sans-serif;

  /* spacing */
  --s1:4px; --s2:8px; --s3:12px; --s4:16px; --s5:20px;
  --s6:24px; --s8:32px; --s10:40px; --s12:48px;

  /* radius */
  --r-sm:10px; --r-md:16px; --r-lg:22px; --r-xl:28px; --r-pill:999px;

  /* shadows */
  --sh-0: 0 1px 3px rgba(28,27,24,.05);
  --sh-1: 0 2px 10px rgba(28,27,24,.08), 0 0 0 1px rgba(28,27,24,.03);
  --sh-2: 0 16px 48px rgba(28,27,24,.16);
  --sh-protein: 0 6px 20px -6px rgba(217,104,67,.5);
  --sh-brand:   0 6px 20px -6px rgba(76,154,119,.5);

  /* motion */
  --ease:     cubic-bezier(.2,.7,.2,1);
  --ease-out: cubic-bezier(0,0,.2,1);
  --dur:      180ms;
  --dur-slow: 320ms;
}

/* ── base ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font-ui);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  display: flex;
  justify-content: center;
  overscroll-behavior: none;
}

/* clean warm gradient — no grain texture */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 70% 55% at 80% 0%,   rgba(76,154,119,.09), transparent 55%),
    radial-gradient(ellipse 70% 55% at 20% 100%, rgba(217,104,67,.08), transparent 55%);
}

/* ── app shell ─────────────────────────────────────────────────────────── */
.app {
  position: relative; z-index: 1;
  width: 100%; max-width: 430px;
  height: 100dvh;
  background: var(--bg);
  overflow: hidden;
  display: flex; flex-direction: column;
}
@media (min-width: 480px) {
  .app {
    height: min(860px, 96dvh);
    margin: auto;
    border-radius: 38px;
    box-shadow: 0 0 0 1px var(--line), 0 40px 90px -20px rgba(28,27,24,.28);
  }
}
.viewport {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding-bottom: 96px; scroll-behavior: smooth;
}
.viewport::-webkit-scrollbar { display: none; }

/* ── typography ────────────────────────────────────────────────────────── */
.display {
  font-family: var(--font-display); font-weight: 460;
  font-variation-settings: "opsz" 80, "SOFT" 60, "WONK" 0;
  letter-spacing: -.015em; line-height: 1.05;
}
.kicker {
  font-size: 11px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--brand-dark); font-weight: 700;
}
.num {
  font-family: var(--font-display); font-variant-numeric: tabular-nums;
  font-variation-settings: "opsz" 120, "SOFT" 40;
}
.muted { color: var(--ink-soft); }
.faint { color: var(--ink-faint); }

/* ── topbar ────────────────────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s6) var(--s5) var(--s3);
}
.topbar .greet  { font-size: 13.5px; line-height: 1.4; }
.topbar .greet b { font-weight: 600; }
.brandmark {
  font-family: var(--font-display); font-weight: 500;
  font-size: 20px; letter-spacing: -.025em;
}
.brandmark .dot { color: var(--protein); }
.iconbtn {
  width: 38px; height: 38px; border-radius: 50%;
  border: 1.5px solid var(--line); background: var(--surface);
  display: grid; place-items: center;
  color: var(--ink-soft); cursor: pointer;
  transition: border-color var(--dur), color var(--dur);
}
.iconbtn:hover { color: var(--ink); border-color: var(--line-strong); }
.iconbtn svg { width: 18px; height: 18px; }

/* ── cards ─────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--sh-0); padding: var(--s5);
}
.card + .card { margin-top: var(--s3); }
.section { padding: 0 var(--s5); }
.section-title {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: var(--s6) 0 var(--s3);
}
.section-title h2 {
  font-family: var(--font-display); font-weight: 460; font-size: 20px;
  font-variation-settings: "SOFT" 55;
}
.section-title a { font-size: 13px; color: var(--brand-dark); font-weight: 600; cursor: pointer; }

/* ── protein ring (hero) ───────────────────────────────────────────────── */
.hero { padding: var(--s2) var(--s5) var(--s5); text-align: center; }
.ring-wrap {
  position: relative; width: 220px; height: 220px; margin: 0 auto var(--s4);
}
.ring-wrap svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track  { fill: none; stroke: var(--protein-soft); stroke-width: 15; }
.ring-prog {
  fill: none; stroke: var(--protein); stroke-width: 15; stroke-linecap: round;
  transition: stroke-dashoffset 900ms var(--ease);
  filter: drop-shadow(0 3px 8px rgba(217,104,67,.28));
}
.ring-prog.done {
  stroke: var(--brand);
  filter: drop-shadow(0 3px 8px rgba(76,154,119,.32));
}
.ring-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
}
.ring-center .big {
  font-family: var(--font-display); font-size: 62px; line-height: 1;
  color: var(--ink); font-variation-settings: "opsz" 120, "SOFT" 40; letter-spacing: -.02em;
}
.ring-center .unit { font-size: 13px; color: var(--ink-soft); font-weight: 500; }
.ring-center .of   { font-size: 12px; color: var(--ink-faint); }
.ring-center .check {
  display: flex; align-items: center; gap: 4px;
  font-size: 12.5px; color: var(--brand-dark); font-weight: 600;
}
.ring-center .check svg { width: 13px; height: 13px; stroke-width: 2.5; }

/* macro chips */
.macro-row { display: flex; gap: var(--s2); justify-content: center; flex-wrap: wrap; }
.macro {
  display: flex; align-items: center; gap: 5px;
  font-size: 12.5px; color: var(--ink-soft);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-pill); padding: 5px 12px;
}
.macro b { color: var(--ink); font-weight: 600; }
.dotc { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.dotc.p { background: var(--protein); }
.dotc.c { background: var(--carb); }
.dotc.f { background: var(--fat); }

/* insight banner */
.insight {
  display: flex; gap: var(--s3); align-items: flex-start;
  background: var(--brand-soft); border: 1px solid var(--brand-muted);
  border-radius: var(--r-md); padding: var(--s4); margin: var(--s4) var(--s5) 0;
}
.insight .leaf { font-size: 18px; line-height: 1; flex: none; margin-top: 2px; }
.insight h3 {
  font-family: var(--font-display); font-weight: 460; font-size: 15.5px;
  margin-bottom: 3px; line-height: 1.2;
}
.insight p { font-size: 13.5px; color: var(--ink-soft); line-height: 1.5; }
.insight.win { background: var(--protein-soft); border-color: var(--protein-muted); }

/* ── meal list ─────────────────────────────────────────────────────────── */
.meal {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); overflow: hidden;
  box-shadow: var(--sh-0); margin-bottom: var(--s3); cursor: pointer;
  transition: border-color var(--dur), box-shadow var(--dur), transform .1s var(--ease);
  display: flex;
}
.meal:hover  { border-color: var(--line-strong); box-shadow: var(--sh-1); }
.meal:active { transform: scale(.99); }
/* left accent bar — tinted by protein level */
.meal-accent { width: 4px; flex: none; background: var(--protein-muted); }
.meal-body   { flex: 1; padding: var(--s4); min-width: 0; }
.meal-head {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 5px;
}
.meal-head .label { font-weight: 600; font-size: 14.5px; display: flex; align-items: center; gap: 6px; }
.meal-head .when  { font-size: 12px; color: var(--ink-faint); flex: none; }
.meal-items {
  font-size: 13px; color: var(--ink-soft); line-height: 1.5; margin-bottom: 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.meal-macros { display: flex; align-items: center; gap: 6px; font-size: 12.5px; }
.meal-macros .pp {
  color: var(--protein); font-weight: 700;
  font-family: var(--font-display); font-size: 14px;
  font-variation-settings: "opsz" 60;
}
.meal-macros .sep  { color: var(--line-strong); }
.meal-macros .rest { color: var(--ink-faint); }
.tagsrc {
  font-size: 10px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-faint); border: 1px solid var(--line); border-radius: var(--r-pill); padding: 2px 6px;
}

/* ── buttons ───────────────────────────────────────────────────────────── */
.btn {
  font-family: var(--font-ui); font-weight: 600; font-size: 15px;
  border: none; cursor: pointer; border-radius: var(--r-md);
  padding: 13px 20px; min-height: 48px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .12s var(--ease), background var(--dur), opacity var(--dur);
  position: relative;
}
.btn:active { transform: scale(.975); }
.btn svg { width: 19px; height: 19px; flex: none; }
.btn.primary { background: var(--brand); color: #fff; box-shadow: var(--sh-brand); }
.btn.primary:hover { background: var(--brand-dark); }
.btn.protein { background: var(--protein); color: #fff; box-shadow: var(--sh-protein); }
.btn.protein:hover { background: var(--protein-dk); }
.btn.secondary {
  background: var(--surface); color: var(--ink); border: 1.5px solid var(--line);
}
.btn.secondary:hover { border-color: var(--line-strong); }
.btn.ghost { background: transparent; color: var(--ink-soft); min-height: auto; padding: 8px 12px; }
.btn.ghost:hover { color: var(--ink); }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .4; cursor: default; transform: none !important; pointer-events: none; }
.btn.loading { pointer-events: none; }
.btn.loading .lbl { opacity: .3; }
.spin {
  width: 17px; height: 17px;
  border: 2px solid rgba(255,255,255,.3); border-top-color: #fff;
  border-radius: 50%; animation: spin .6s linear infinite; position: absolute;
}
.btn.secondary .spin, .btn.ghost .spin {
  border-color: rgba(28,27,24,.12); border-top-color: var(--ink-soft);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── bottom dock ───────────────────────────────────────────────────────── */
.dock {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 20;
  padding: 8px 12px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(249,246,241,.98) 40%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.dock-inner {
  display: flex; align-items: center; gap: 2px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-pill); padding: 5px 8px; box-shadow: var(--sh-1);
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 10px; font-weight: 600; letter-spacing: .01em;
  color: var(--ink-faint); background: none; border: none;
  cursor: pointer; padding: 5px 2px; border-radius: var(--r-md);
  transition: color var(--dur); position: relative;
}
.tab svg { width: 21px; height: 21px; stroke-width: 1.8; }
.tab.active { color: var(--brand-dark); }
.tab.add { flex: 0 0 auto; }
.add-btn {
  width: 54px; height: 54px; margin-top: -22px; border-radius: 50%;
  background: var(--protein); color: #fff; border: 4px solid var(--bg);
  display: grid; place-items: center; cursor: pointer;
  box-shadow: var(--sh-protein); transition: transform .15s var(--ease);
}
.add-btn:active { transform: scale(.9); }
.add-btn svg { width: 24px; height: 24px; stroke-width: 2.3; }
.tab-badge {
  position: absolute; top: 3px; right: calc(50% - 13px);
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--protein); border: 1.5px solid var(--surface);
}

/* ── sheets ────────────────────────────────────────────────────────────── */
.scrim {
  position: absolute; inset: 0;
  background: rgba(28,27,24,.36); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
  opacity: 0; transition: opacity var(--dur-slow); z-index: 40;
}
.scrim.show { opacity: 1; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 41;
  background: var(--surface); border-radius: 26px 26px 0 0;
  box-shadow: var(--sh-2); max-height: 92%;
  display: flex; flex-direction: column; overflow: hidden;
  transform: translateY(102%); transition: transform 320ms var(--ease-out);
}
.sheet.show { transform: translateY(0); }
.sheet > div { flex: 1; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.sheet .grip {
  width: 36px; height: 4px; border-radius: 2px;
  background: var(--line-strong); margin: 10px auto 6px; flex: none;
}
.sheet-head {
  padding: var(--s2) var(--s5) var(--s3);
  display: flex; align-items: center; justify-content: space-between;
  flex: none; border-bottom: 1px solid var(--line);
}
.sheet-head h2 {
  font-family: var(--font-display); font-weight: 460; font-size: 22px;
  font-variation-settings: "SOFT" 55;
}
.sheet-body {
  flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: var(--s4) var(--s5) var(--s5);
}
.sheet-foot {
  padding: var(--s4) var(--s5) calc(var(--s5) + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line); background: var(--surface); flex: none;
}
.disclaimer {
  font-size: 12.5px; color: var(--ink-soft); background: var(--surface-2);
  border-radius: var(--r-sm); padding: 9px 12px; margin-bottom: var(--s3);
  display: flex; gap: 7px; align-items: center;
}
.preview {
  width: 100%; height: 160px; object-fit: cover;
  border-radius: var(--r-md); margin-bottom: var(--s4);
  border: 1px solid var(--line); background: var(--surface-2);
}

/* describe-meal textarea */
.describe-ta {
  width: 100%;
  border: 1.5px solid var(--line); border-radius: var(--r-md);
  padding: 12px 14px; font-size: 15px; font-family: var(--font-ui);
  color: var(--ink); background: var(--surface);
  resize: none; outline: none; line-height: 1.5;
  transition: border-color var(--dur);
  display: block;
}
.describe-ta:focus { border-color: var(--protein); }

/* ── item row (confirm sheet) ──────────────────────────────────────────── */
.item {
  border: 1.5px solid var(--line); border-radius: var(--r-md);
  padding: var(--s4); margin-bottom: var(--s3);
  background: var(--surface); transition: border-color var(--dur);
}
.item:focus-within { border-color: var(--brand); }
.item-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.item-name {
  font-weight: 600; font-size: 14.5px; flex: 1;
  border: none; background: none; color: var(--ink);
  font-family: var(--font-ui); padding: 0; line-height: 1.3;
}
.item-name:focus { outline: none; }
.item-pro {
  font-family: var(--font-display); font-variant-numeric: tabular-nums;
  color: var(--protein); font-size: 17px; white-space: nowrap; line-height: 1;
}
.item-pro small { font-family: var(--font-ui); font-size: 10.5px; color: var(--ink-faint); font-weight: 600; }
.item-meta { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 12px; color: var(--ink-faint); }
.conf { display: inline-flex; align-items: center; gap: 4px; }
.conf .led { width: 6px; height: 6px; border-radius: 50%; background: var(--brand); }
.conf.med .led { background: var(--amber); }
.conf.low .led { background: var(--ink-faint); }
.grams { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.grams output { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 13px; min-width: 52px; text-align: right; color: var(--ink); }
input[type=range] {
  -webkit-appearance: none; appearance: none; flex: 1;
  height: 5px; border-radius: 3px; background: var(--surface-2); cursor: pointer;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; border: 2px solid var(--protein);
  box-shadow: 0 2px 6px rgba(217,104,67,.3); cursor: grab;
}
input[type=range]::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%; background: #fff;
  border: 2px solid var(--protein); box-shadow: 0 2px 6px rgba(217,104,67,.3); cursor: grab;
}
.item-del {
  background: none; border: none; color: var(--ink-faint); cursor: pointer;
  font-size: 13px; padding: 3px 6px; margin-left: auto;
  border-radius: var(--r-sm); transition: color var(--dur), background var(--dur);
}
.item-del:hover { color: var(--protein); background: var(--protein-soft); }

/* meal label chips */
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: var(--s3) 0 var(--s4); }
.chip {
  font-size: 13px; font-weight: 600; padding: 7px 14px;
  border-radius: var(--r-pill); border: 1.5px solid var(--line);
  background: var(--surface); color: var(--ink-soft); cursor: pointer;
  transition: all var(--dur);
}
.chip.sel { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip:hover:not(.sel) { border-color: var(--line-strong); }

/* totals strip */
.totals { display: flex; justify-content: space-between; align-items: center; padding: var(--s3) 0 var(--s4); }
.totals .t { text-align: center; flex: 1; }
.totals .t .v { font-family: var(--font-display); font-size: 22px; font-variant-numeric: tabular-nums; line-height: 1; }
.totals .t .k { font-size: 10.5px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .08em; margin-top: 2px; }
.totals .t.pro .v { color: var(--protein); }

/* search */
.search {
  display: flex; align-items: center; gap: 8px; background: var(--surface-2);
  border: 1.5px solid transparent; border-radius: var(--r-md);
  padding: 11px 14px; margin-bottom: var(--s3); transition: border-color var(--dur), background var(--dur);
}
.search:focus-within { border-color: var(--brand); background: var(--surface); }
.search svg { width: 17px; height: 17px; color: var(--ink-faint); flex: none; }
.search input { border: none; background: none; flex: 1; font-family: var(--font-ui); font-size: 15px; color: var(--ink); }
.search input:focus { outline: none; }
.res {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 6px; border-bottom: 1px solid var(--line); cursor: pointer;
  border-radius: var(--r-sm); transition: background var(--dur);
}
.res:hover { background: var(--surface-2); }
.res .nm  { font-weight: 600; font-size: 14px; }
.res .mc  { font-size: 12px; color: var(--ink-faint); margin-top: 1px; }
.res .add { color: var(--brand-dark); font-weight: 700; font-size: 22px; line-height: 1; }

/* ── onboarding ────────────────────────────────────────────────────────── */
.ob { display: flex; flex-direction: column; min-height: 100%; padding: var(--s10) var(--s6) 0; }
.ob > .btn { position: sticky; bottom: max(var(--s6), env(safe-area-inset-bottom, 16px)); margin-top: var(--s4); flex-shrink: 0; }
.ob .dots { display: flex; gap: 6px; margin-bottom: var(--s10); }
.ob .dots i { width: 24px; height: 3px; border-radius: 2px; background: var(--line); }
.ob .dots i.on { background: var(--brand); }
.ob .grow { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.ob h1 {
  font-family: var(--font-display); font-weight: 440; font-size: 36px; line-height: 1.07;
  font-variation-settings: "opsz" 90, "SOFT" 65; margin-bottom: var(--s4);
}
.ob h1 em { font-style: italic; color: var(--protein); }
.ob p.lead { font-size: 16px; color: var(--ink-soft); line-height: 1.55; margin-bottom: var(--s6); }
.ob .field { margin: var(--s4) 0; }
.ob label { font-size: 13px; font-weight: 600; color: var(--ink-soft); display: block; margin-bottom: 8px; }
.ob input[type=text] {
  width: 100%; font-family: var(--font-ui); font-size: 18px; padding: 14px 16px;
  border: 1.5px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); color: var(--ink); transition: border-color var(--dur);
}
.ob input[type=text]:focus { outline: none; border-color: var(--brand); }
.goalpick { display: flex; gap: 8px; }
.goalpick .g {
  flex: 1; text-align: center; padding: 14px 6px;
  border-radius: var(--r-md); border: 1.5px solid var(--line);
  background: var(--surface); cursor: pointer; transition: all var(--dur);
}
.goalpick .g.sel { border-color: var(--brand); background: var(--brand-soft); }
.goalpick .g .gv { font-family: var(--font-display); font-size: 24px; line-height: 1; }
.goalpick .g .gl { font-size: 11px; color: var(--ink-faint); margin-top: 3px; }
.promise { list-style: none; margin: var(--s4) 0; }
.promise li { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; color: var(--ink-soft); padding: 8px 0; }
.promise li b { color: var(--ink); font-weight: 600; }
.promise .ic { color: var(--brand); margin-top: 1px; flex: none; }
.promise .ic svg { width: 16px; height: 16px; }

/* ── coach nudge card ──────────────────────────────────────────────────── */
.coach-nudge {
  background: var(--surface); border: 1.5px solid var(--brand-muted);
  border-radius: var(--r-lg); padding: var(--s4);
  margin: var(--s3) var(--s5) 0; box-shadow: var(--sh-0);
}
.cn-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--s3); }
.cn-id { display: flex; align-items: center; gap: var(--s3); }
.cn-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--brand-soft); border: 1.5px solid var(--brand-muted);
  display: grid; place-items: center; font-size: 17px; flex: none;
  overflow: hidden;
}
.cn-label { font-size: 12.5px; font-weight: 700; color: var(--brand-dark); }
.cn-meta  { font-size: 11px; color: var(--ink-faint); margin-top: 1px; }
.cn-text  { font-size: 14px; color: var(--ink); line-height: 1.55; }
.cn-cta   { min-height: auto; padding: 8px 0 0; font-size: 13px; color: var(--brand-dark); font-weight: 600; }
/* dismiss button — replaces inline style */
.cn-close-btn {
  background: none; border: none; cursor: pointer;
  color: var(--ink-faint); font-size: 18px; padding: 4px 6px;
  line-height: 1; border-radius: var(--r-sm); transition: color var(--dur);
}
.cn-close-btn:hover { color: var(--ink); }

/* ── coach context bar ─────────────────────────────────────────────────── */
.coach-ctx-bar {
  display: flex; align-items: center; justify-content: center;
  margin: 0 var(--s5) var(--s3);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: var(--s3) var(--s5);
}
.ccb-col { flex: 1; text-align: center; }
.ccb-val {
  display: block; font-family: var(--font-display); font-size: 20px;
  color: var(--ink); line-height: 1.1; font-variation-settings: "opsz" 80;
}
.ccb-key { display: block; font-size: 10.5px; color: var(--ink-faint); margin-top: 2px; text-transform: uppercase; letter-spacing: .07em; }
.ccb-sep { width: 1px; height: 28px; background: var(--line); flex: none; }

/* ── coach chat ────────────────────────────────────────────────────────── */
.chat { display: flex; flex-direction: column; gap: var(--s3); padding: var(--s4) var(--s5) 150px; }
.bubble-row { display: flex; align-items: flex-end; gap: 8px; align-self: flex-start; max-width: 90%; }
.bubble-avatar {
  width: 26px; height: 26px; border-radius: 50%; flex: none; margin-bottom: 2px;
  background: var(--brand-soft); border: 1px solid var(--brand-muted);
  display: grid; place-items: center; font-size: 13px; overflow: hidden;
}
.av-img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 50%; }
.bubble { padding: 10px 14px; border-radius: 18px; font-size: 14.5px; line-height: 1.55; }
.bubble.a { background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 5px; flex: 1; }
.bubble.u { align-self: flex-end; max-width: 84%; background: var(--brand); color: #fff; border-bottom-right-radius: 5px; }
.chatbar {
  position: absolute; left: 0; right: 0;
  bottom: calc(70px + env(safe-area-inset-bottom)); z-index: 30;
  padding: var(--s3) var(--s4); display: flex; gap: 8px; align-items: center;
}
.chatbar .field {
  flex: 1; display: flex; background: var(--surface);
  border: 1.5px solid var(--line); border-radius: var(--r-pill);
  padding: 6px 6px 6px 16px; box-shadow: var(--sh-0); transition: border-color var(--dur);
}
.chatbar .field:focus-within { border-color: var(--brand); }
.chatbar input { flex: 1; border: none; background: none; font-family: var(--font-ui); font-size: 16px; color: var(--ink); }
.chatbar input:focus { outline: none; }
.chatbar input:disabled { opacity: .5; }
.send {
  width: 44px; height: 44px; border-radius: 50%; background: var(--brand); color: #fff;
  border: none; cursor: pointer; display: grid; place-items: center; flex: none;
  box-shadow: var(--sh-brand); transition: transform .12s var(--ease);
}
.send:active { transform: scale(.9); }
.send svg { width: 19px; height: 19px; }
.typing { display: inline-flex; gap: 4px; align-items: center; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-faint); animation: bb .9s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes bb {
  0%,60%,100% { opacity:.3; transform:translateY(0); }
  30% { opacity:1; transform:translateY(-3px); }
}
.ai-generating { display: inline-flex; align-items: center; gap: 8px; }
.ai-gen-label  { font-size: 13px; color: var(--ink-soft); font-style: italic; }

/* ── trends ────────────────────────────────────────────────────────────── */
.bars { display: flex; align-items: flex-end; gap: 5px; height: 140px; padding: var(--s4) 0; }
.bars .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; height: 100%; }
.bars .bar {
  width: 100%; max-width: 22px; border-radius: 6px 6px 2px 2px;
  background: var(--protein-soft); position: relative; margin-top: auto;
  transition: height 700ms var(--ease);
}
.bars .bar .fill { position: absolute; inset: 0; border-radius: inherit; background: var(--protein); }
.bars .bar.hit .fill { background: var(--brand); }
.bars .d { font-size: 10px; color: var(--ink-faint); }
.goalline { border-top: 1.5px dashed #d8cfc0; font-size: 11px; color: var(--ink-faint); padding-top: 4px; }
.streak-card { text-align: center; }
.streak-card .n { font-family: var(--font-display); font-size: 50px; color: var(--brand); line-height: 1; font-variation-settings: "opsz" 80; }

/* ── memory strip ──────────────────────────────────────────────────────── */
.memory-strip { display: flex; align-items: center; gap: 8px; padding: 4px var(--s5) 0; overflow: hidden; }
.ms-label {
  display: flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 700;
  color: var(--brand-dark); letter-spacing: .07em; text-transform: uppercase;
  white-space: nowrap; flex: none;
}
.ms-label svg { width: 12px; height: 12px; }
.ms-chips { display: flex; gap: 5px; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
.ms-chips::-webkit-scrollbar { display: none; }
.memory-chip {
  font-size: 11.5px; font-weight: 500; white-space: nowrap;
  background: var(--brand-soft); border: 1px solid var(--brand-muted);
  color: var(--brand-dark); border-radius: var(--r-pill); padding: 4px 10px; flex: none;
}
button.memory-chip { cursor: pointer; font-family: var(--font-ui); }
button.memory-chip:hover { background: var(--brand-muted); }
.ms-more { background: var(--surface-2); border-color: var(--line); color: var(--ink-soft); }

/* ── sessions list ─────────────────────────────────────────────────────── */
.sess-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 4px; border-bottom: 1px solid var(--line); cursor: pointer;
  transition: background var(--dur); border-radius: var(--r-sm); gap: 8px;
}
.sess-item:hover  { background: var(--surface-2); }
.sess-item.active { background: var(--brand-soft); }
.si-content { flex: 1; min-width: 0; }
.si-title { font-weight: 600; font-size: 14.5px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.si-date  { font-size: 12px; color: var(--ink-faint); margin-top: 2px; }
.si-del {
  width: 32px; height: 32px; border-radius: 50%; border: none; background: transparent;
  color: var(--ink-faint); cursor: pointer; display: grid; place-items: center;
  flex: none; transition: background var(--dur), color var(--dur);
}
.si-del:hover { background: var(--protein-soft); color: var(--protein); }
.si-del svg { width: 14px; height: 14px; }

/* ── memory list ───────────────────────────────────────────────────────── */
.mem-list { display: flex; flex-direction: column; }
.mem-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--line); gap: 10px; }
.mem-kv { flex: 1; min-width: 0; }
.mem-key { font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: var(--brand-dark); font-weight: 700; margin-bottom: 2px; }
.mem-val { font-size: 14.5px; color: var(--ink); font-weight: 500; }
.mem-del {
  width: 30px; height: 30px; border-radius: 50%; border: none; background: transparent;
  color: var(--ink-faint); font-size: 18px; cursor: pointer; display: grid;
  place-items: center; flex: none; line-height: 1; transition: color var(--dur);
}
.mem-del:hover { color: var(--protein); }

/* ── memory suggestion inline card (in-chat confirm / skip) ─────────────── */
.mem-suggest {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--brand-soft); border: 1.5px solid var(--brand-muted);
  border-radius: var(--r-md); padding: 11px 13px;
  margin: 6px 0 2px; max-width: 86%;
  animation: fadeUp .22s var(--ease-out) both;
  transition: opacity var(--dur), transform var(--dur);
}
.mem-suggest.ms-done { opacity: 0; transform: scale(.96); pointer-events: none; }
.ms-icon { font-size: 16px; flex: none; margin-top: 1px; }
.ms-content { flex: 1; min-width: 0; }
.ms-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--brand-dark); margin-bottom: 4px; }
.ms-kv { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px; }
.ms-key { font-size: 13px; font-weight: 600; color: var(--ink); text-transform: capitalize; }
.ms-sep { color: var(--ink-faint); font-size: 12px; }
.ms-val { font-size: 13px; color: var(--ink-soft); }
.ms-btns { display: flex; flex-direction: column; gap: 5px; flex: none; }
.ms-yes {
  font-family: var(--font-ui); font-size: 12px; font-weight: 600;
  padding: 5px 11px; border-radius: var(--r-pill);
  border: none; background: var(--brand); color: #fff;
  cursor: pointer; white-space: nowrap; min-height: 30px;
  transition: background var(--dur);
}
.ms-yes:hover { background: var(--brand-dark); }
.ms-no {
  font-family: var(--font-ui); font-size: 12px; font-weight: 500;
  padding: 5px 11px; border-radius: var(--r-pill);
  border: 1.5px solid var(--line); background: transparent;
  color: var(--ink-soft); cursor: pointer; white-space: nowrap; min-height: 30px;
  transition: border-color var(--dur), color var(--dur);
}
.ms-no:hover { border-color: var(--ink-soft); color: var(--ink); }

/* ── add menu ──────────────────────────────────────────────────────────── */
.add-menu-ctx {
  background: var(--brand-soft); border: 1px solid var(--brand-muted);
  border-radius: var(--r-md); padding: 10px 14px; margin-bottom: var(--s4);
}
.amc-label { font-size: 13.5px; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.amc-bar   { height: 5px; background: var(--protein-soft); border-radius: 3px; overflow: hidden; }
.amc-fill  { height: 100%; background: var(--protein); border-radius: 3px; transition: width .6s var(--ease); }
.amc-note  { font-size: 11.5px; color: var(--ink-faint); margin-top: 4px; }
.add-grid  { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: var(--s3); }
.add-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 18px 10px; border-radius: var(--r-lg); border: 1.5px solid var(--line);
  background: var(--surface); cursor: pointer; gap: 3px; min-height: 96px;
  font-family: var(--font-ui);
  transition: border-color var(--dur), transform .12s var(--ease);
}
.add-tile:hover  { border-color: var(--line-strong); }
.add-tile:active { transform: scale(.96); }
.at-icon  { font-size: 26px; line-height: 1; margin-bottom: 3px; }
.at-label { font-size: 14px; font-weight: 700; color: var(--ink); }
.at-sub   { font-size: 11px; color: var(--ink-faint); text-align: center; }

/* ── toast ─────────────────────────────────────────────────────────────── */
.toast-host {
  position: absolute; left: 0; right: 0; bottom: 90px; z-index: 60;
  display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none;
}
.toast {
  background: var(--ink); color: #fff; font-size: 13.5px; font-weight: 500;
  padding: 11px 18px; border-radius: var(--r-pill); box-shadow: var(--sh-2);
  display: flex; gap: 7px; align-items: center;
  transform: translateY(10px); opacity: 0; animation: toastin .25s var(--ease) forwards;
}
.toast .ic { color: #7edba9; }
@keyframes toastin { to { transform: translateY(0); opacity: 1; } }

/* ── empty / misc ──────────────────────────────────────────────────────── */
.empty { text-align: center; padding: var(--s12) var(--s6); color: var(--ink-soft); }
.empty .ill { font-size: 40px; margin-bottom: var(--s3); }
.empty h3 { font-family: var(--font-display); font-weight: 460; font-size: 20px; color: var(--ink); margin-bottom: 6px; }
.locked { display: flex; gap: 10px; align-items: center; background: var(--surface-2); border-radius: var(--r-md); padding: var(--s4); font-size: 13.5px; color: var(--ink-soft); margin: var(--s4) var(--s5); }

/* ── animations ────────────────────────────────────────────────────────── */
.reveal { animation: reveal .4s var(--ease) both; }
.reveal.d1 { animation-delay: .05s; }
.reveal.d2 { animation-delay: .1s; }
.reveal.d3 { animation-delay: .16s; }
@keyframes reveal { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ── sodium/sat-fat secondary totals line (Task 3) ─────────────────────── */
.totals-secondary {
  font-size: 12px; color: var(--ink-soft); text-align: center;
  padding: 4px 0 0; letter-spacing: 0.01em;
}
/* ── meal card extra macros (sodium/sat-fat) ───────────────────────────── */
.meal-extra-macros {
  font-size: 11.5px; color: var(--ink-faint, #b0a898); margin-top: 3px;
}
