:root{
  --bg: #EFECE2;
  --surface: #FBFAF4;
  --surface-2: #F3F0E5;
  --ink: #2A2820;
  --ink-soft: #6E6858;
  --ink-faint: #6E6858;
  --accent-on-surface: #825614;
  --accent-on-deep: #E3A94A;
  --accent: #B9812A;
  --accent-ink: #2A2013;
  --olive: #55624A;
  --rust: #9C4A34;
  --good: #4C7A4C;
  --line: rgba(42,40,32,0.14);
  --line-strong: rgba(42,40,32,0.24);
  --shadow: 0 1px 2px rgba(42,40,32,0.06), 0 6px 20px rgba(42,40,32,0.06);
}

/* Phase 4 private alpha: isolated support surface, hidden for non-allowlisted users server-side. */
.support-wrap { max-width: 1120px; }
.support-heading { display:flex; justify-content:space-between; align-items:flex-start; gap:1rem; }
.support-heading h1 { margin:.1rem 0; }
.support-alpha-badge { border:1px solid var(--accent); color:var(--accent); padding:.3rem .55rem; font:600 .75rem var(--mono); letter-spacing:.08em; }
.support-consent { margin-top:1.15rem; padding-top:1rem; border-top:1px solid var(--line); }
.support-consent h3 { margin:0 0 .7rem; font-size:1.05rem; }
.support-consent-choice { display:flex; align-items:flex-start; gap:.65rem; margin:.7rem 0; line-height:1.35; font-size:.84rem; color:var(--ink-soft); cursor:pointer; }
.support-consent-choice input { flex:none; width:18px; height:18px; margin:.1rem 0 0; accent-color:var(--accent); }
.support-consent .save-status { display:block; min-height:1.25rem; }
.support-consent .empty-hint { margin:.35rem 0 0; line-height:1.35; }
.support-app { display:grid; grid-template-columns:minmax(220px, 300px) minmax(0, 1fr); gap:1rem; align-items:start; }
.support-history { position:sticky; top:1rem; }
.support-history-item { display:flex; width:100%; flex-direction:column; gap:.2rem; padding:.7rem; margin:.35rem 0; text-align:left; border:1px solid var(--line); background:transparent; color:inherit; cursor:pointer; }
.support-history-item.active { border-color:var(--accent); }
.support-history-item small { color:var(--ink-soft); }
.support-chat { display:flex; min-width:0; flex-direction:column; gap:.85rem; }
.support-chat-toolbar { display:flex; justify-content:space-between; gap:1rem; align-items:flex-start; }
.support-chat-toolbar h2 { margin:.1rem 0; }
.support-safety-note { margin:0; padding:.7rem; border-left:3px solid var(--accent); background:var(--surface-2); color:var(--ink-soft); }
.support-chat .support-messages { width:100%; min-height:220px; max-height:55vh; overflow:auto; padding:0; }
.support-messages .chat-bubble.from-ai { box-sizing:border-box; width:100%; max-width:none; }
.support-chat .chat-input-row { display:grid; grid-template-columns:minmax(0, 1fr) auto; width:100%; gap:.6rem; align-items:stretch; }
.support-chat .chat-input-row textarea { width:100%; min-width:0; min-height:76px; margin:0; }
.support-chat .chat-input-row .save-btn { min-width:116px; align-self:stretch; }
@media (max-width: 760px) {
  .support-app { grid-template-columns:1fr; }
  .support-history { position:static; }
  .support-messages { min-height:180px; max-height:none; }
}
@media (max-width: 520px) {
  .support-chat .chat-input-row { grid-template-columns:1fr; }
  .support-chat .chat-input-row .save-btn { width:100%; min-height:44px; }
}

.pwa-update-banner {
  position: fixed;
  z-index: 1000;
  left: max(1rem, env(safe-area-inset-left));
  right: max(1rem, env(safe-area-inset-right));
  top: max(.75rem, env(safe-area-inset-top));
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: .8rem 1rem;
  width: auto;
  max-width: calc(100vw - 1.5rem);
  box-sizing: border-box;
  color: #fff;
  background: #30372b;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,.2);
}
.pwa-update-banner[hidden] { display: none; }
.pwa-update-banner button { min-height: 42px; }
body { padding-bottom: env(safe-area-inset-bottom); }

@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    --bg: #17160F;
    --surface: #201E15;
    --surface-2: #262418;
    --ink: #ECE6D6;
    --ink-soft: #B5AC96;
    --ink-faint: #ADA38D;
    --accent-on-surface: #E3A94A;
    --accent: #E3A94A;
    --accent-ink: #1B1509;
    --olive: #8B9B79;
    --rust: #CF8064;
    --good: #7FB37F;
    --line: rgba(236,230,214,0.14);
    --line-strong: rgba(236,230,214,0.24);
    --shadow: 0 1px 2px rgba(0,0,0,0.3), 0 10px 30px rgba(0,0,0,0.35);
  }
}

*{ box-sizing: border-box; }
[hidden]{ display: none !important; }
html, body{ margin: 0; }
body{
  background: var(--bg);
  color: var(--ink);
  font-family: 'Karla', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .eyebrow, nav .brand{ font-family: 'Big Shoulders Display', system-ui, sans-serif; }
.num, .mono{ font-family: 'IBM Plex Mono', ui-monospace, monospace; font-variant-numeric: tabular-nums; }

a{ color: inherit; }

.eyebrow{
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.5rem;
}

nav.topbar{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 10;
}
nav.topbar .brand{
  font-weight: 800;
  font-size: 1.3rem;
  letter-spacing: -0.01em;
}
nav.topbar .brand .num{ color: var(--accent); }
.nav-toggle{ display: none; }
nav.topbar .links{ display: flex; gap: 0.3rem; }
nav.topbar .links a{
  text-decoration: none;
  padding: 0.5rem 0.9rem;
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink-soft);
}
nav.topbar .links a.active{ background: var(--surface-2); color: var(--ink); }
nav.topbar .links a:hover{ color: var(--ink); }

@media (max-width: 720px){
  nav.topbar{
    align-items: center;
    flex-direction: row;
    gap: .75rem;
    padding: .7rem 1rem;
  }
  nav.topbar .brand{
    min-width: 0;
    font-size: 1.05rem;
    line-height: 1.15;
  }
  .nav-toggle{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    flex: 0 0 auto;
    min-height: 44px;
    padding: .45rem .75rem;
    border: 1px solid var(--line-strong);
    border-radius: 9px;
    color: var(--ink);
    background: var(--surface-2);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
  }
  .nav-toggle-icon{
    font-size: 1.25rem;
    line-height: 1;
  }
  nav.topbar .links{
    position: absolute;
    top: calc(100% + .4rem);
    left: 1rem;
    right: 1rem;
    display: none;
    flex-direction: column;
    width: auto;
    min-width: 0;
    gap: .1rem;
    padding: .45rem;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: var(--shadow);
  }
  nav.topbar .links.is-open{
    display: flex;
  }
  nav.topbar .links a{
    width: 100%;
    padding: .7rem .8rem;
    font-size: .95rem;
  }
  nav.topbar .links #logout-link{
    margin-top: .25rem;
    border-top: 1px solid var(--line);
    border-radius: 0 0 8px 8px;
  }
}

.day-navigator{
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.5rem;
  align-items: stretch;
}
.day-pills{
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.2rem;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  overscroll-behavior-x: contain;
}
.day-nav-arrow{
  width: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink-soft);
  font: 700 1.5rem/1 'Karla', sans-serif;
  cursor: pointer;
}
.day-nav-arrow:hover:not(:disabled){ color: var(--ink); border-color: var(--line-strong); }
.day-nav-arrow:disabled{ opacity: 0.35; cursor: default; }
@media (max-width: 480px){
  .day-navigator{ gap: 0.3rem; }
  .day-nav-arrow{ width: 32px; }
}
.day-pills a{
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.5rem 0.8rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  text-decoration: none;
  color: var(--ink-soft);
  min-width: 58px;
}
.day-pills a .dow{
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.day-pills a .num{
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink);
}
.day-pills a.today{ border-color: var(--accent); }
.day-pills a.active{
  background: var(--olive);
  border-color: var(--olive);
}
.day-pills a.active .dow, .day-pills a.active .num{ color: #fff; }
.day-markers{ display: flex; gap: 3px; min-height: 5px; margin-top: 1px; }
.day-markers span{ width: 5px; height: 5px; border-radius: 50%; }
.day-markers .log-dot{ background: var(--olive); }
.day-markers .activity-dot{ background: var(--rust); }
.day-pills a.active .day-markers span{ box-shadow: 0 0 0 1px rgba(255,255,255,.7); }

.wrap{
  max-width: 880px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.card{
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.2rem 1.4rem;
  box-shadow: var(--shadow);
}

section > h2{
  font-weight: 700;
  font-size: 1.4rem;
  margin: 0 0 0.9rem;
  letter-spacing: -0.01em;
}

/* ---- hero stat strip ---- */
.stat-strip{
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--line-strong);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  overflow: hidden;
}
.stat-strip .stat{
  background: var(--surface);
  padding: 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.stat-strip .stat .label{
  font-size: 0.68rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.stat-strip .stat .value{ font-size: 1.5rem; font-weight: 700; }
.stat-strip .stat .value small{ font-size: 0.8rem; color: var(--ink-soft); font-weight: 500; }
.stat-strip .stat.streak .value{ color: var(--rust); }
@media (max-width: 620px){ .stat-strip{ grid-template-columns: repeat(2, 1fr); } }

/* ---- progress bar to goal ---- */
.goal-bar{
  height: 14px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  overflow: hidden;
  position: relative;
}
.goal-bar .fill{
  height: 100%;
  background: linear-gradient(90deg, var(--olive), var(--accent));
  border-radius: 999px 0 0 999px;
  transition: width 0.4s ease;
}
.goal-labels{
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  font-size: 0.78rem;
  color: var(--ink-faint);
  margin-top: 0.4rem;
}
.goal-labels span:nth-child(2){ text-align: center; color: var(--ink-soft); }
.goal-labels span:last-child{ text-align: right; }

/* ---- compact Today tools ---- */
.today-tools{ display: flex; flex-direction: column; gap: 0.8rem; }
.today-tool-actions{ display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.65rem; }
.today-tool-button{
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.today-tool-button:hover, .today-tool-button[aria-expanded="true"]{ border-color: var(--accent); }
.today-tool-button[aria-expanded="true"]{ background: var(--surface-2); }
.today-tool-button svg{
  width: 23px;
  height: 23px;
  flex: none;
  stroke: var(--accent);
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.today-tool-button span{ min-width: 0; display: flex; flex-direction: column; }
.today-tool-button strong{ font-size: 0.95rem; }
.today-tool-button small{
  color: var(--ink-faint);
  font-size: 0.78rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.today-tool-panel{ margin: 0; }
.activity-form{
  display: grid;
  grid-template-columns: minmax(180px, 1.5fr) minmax(160px, 1fr) minmax(90px, .55fr);
  gap: 0.9rem;
  align-items: end;
}
.activity-form label{ display: flex; flex-direction: column; gap: 0.35rem; color: var(--ink-soft); font-size: 0.82rem; }
.activity-form select, .activity-form input,
.supplement-editor input{
  width: 100%;
  min-height: 42px;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
}
.activity-actions{ margin-top: 0.9rem; display: flex; gap: 0.7rem; align-items: center; flex-wrap: wrap; }
.activity-schedule-link{ margin: 0.9rem 0 0; }
.activity-remove{margin-left:.35rem;padding:.15rem .4rem;border:1px solid var(--line-strong);border-radius:6px;background:var(--surface);color:var(--ink-soft);font:inherit;font-size:.78rem;cursor:pointer}.activity-remove:hover{border-color:var(--accent);color:var(--ink)}
.activity-summary-item.recurring-activity{display:inline-flex;align-items:center;gap:.65rem;flex-wrap:wrap}.activity-summary-item.recurring-activity.is-disabled>span:first-child{color:var(--ink-soft);text-decoration:line-through;text-decoration-thickness:1px}.activity-switch{display:inline-flex;align-items:center;gap:.35rem;padding:.2rem .45rem;border:1px solid var(--line-strong);border-radius:999px;background:var(--surface);color:var(--ink-soft);font-size:.78rem;cursor:pointer}.activity-switch input{accent-color:var(--accent)}.activity-switch:has(input:checked){border-color:var(--accent);color:var(--ink)}
@media (max-width: 640px){
  .today-tool-actions{ grid-template-columns: 1fr 1fr; }
  .activity-form{ grid-template-columns: 1fr; }
}
@media (max-width: 380px){ .today-tool-actions{ grid-template-columns: 1fr; } }

/* ---- meal slots ---- */
.meal-row{
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--line);
}
.meal-row:last-child{ border-bottom: none; }
.meal-row .slot-label{
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
}
.meal-row .dish-ref{
  font-size: 0.9rem;
  color: var(--ink-soft);
  margin: 0.15rem 0 0.5rem;
}
.meal-choice-actions{
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  align-items: center;
  max-width: 100%;
}
.meal-choice-actions .plan-btn{ min-height: 38px; padding-inline: .7rem; }
@media (max-width:720px){
  .meal-choice-actions{
    display:grid;
    grid-template-columns:repeat(2,max-content);
    width:max-content;
  }
  .meal-choice-actions [data-slot-plan]{
    grid-column:1/-1;
    width:100%;
    min-height:42px;
  }
}
.meal-custom-entry{ width: 100%; }
.plan-btn{
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--ink-soft);
  border-radius: 8px;
  padding: 0.45rem 0.8rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.plan-btn.active{
  background: var(--olive);
  border-color: var(--olive);
  color: #fff;
}
.meal-row input[type="text"]{
  width: 100%;
  padding: 0.45rem 0.7rem;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.9rem;
}
.meal-row input[type="text"]:focus-visible, .plan-btn:focus-visible, button:focus-visible, input:focus-visible{
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.week-nav{ display: flex; gap: 0.5rem; margin-top: 0.7rem; }
.kcal-tag{
  font-size: 0.75rem;
  color: var(--ink-faint);
  white-space: nowrap;
}
.generate-controls{
  display: flex;
  gap: 1.2rem;
  flex-wrap: wrap;
  margin-bottom: 0.8rem;
  font-size: 0.9rem;
  color: var(--ink-soft);
}
.generate-controls input{
  margin-left: 0.4rem;
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--ink);
  font-family: inherit;
}
.generate-controls input[type="number"]{ width: 60px; }
.generate-training{ display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }

/* ---- supplement checklist ---- */
.supp-grid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}
@media (max-width: 560px){ .supp-grid{ grid-template-columns: 1fr; } }
.supp-item{
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  cursor: pointer;
}
.supp-item input{ width: 17px; height: 17px; accent-color: var(--accent); flex: none; }
.supp-item .name{ font-weight: 600; font-size: 0.9rem; }
.supp-item .timing{ font-size: 0.75rem; color: var(--ink-faint); display: block; }
.card-heading-row{ display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.card-heading-row h2{ margin-bottom: 0.9rem; }
.card-action-link{ color: var(--ink-soft); font-size: 0.85rem; }

/* ---- personal supplement routine ---- */
.supplement-editor{
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr auto;
  gap: 0.7rem;
  align-items: end;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--line);
}
.supplement-editor:last-child{ border-bottom: 0; }
.supplement-editor label{ display: flex; flex-direction: column; gap: 0.3rem; color: var(--ink-soft); font-size: 0.78rem; }
.supplement-editor-actions{ display: flex; gap: 0.4rem; align-items: center; min-height: 42px; }
.supplement-inactive{ opacity: 0.62; }
.supplement-add-form{ margin-top: 1rem; padding-top: 1rem; border-top: 1px dashed var(--line-strong); }
.menu-preferences-form{ display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:1rem;margin-top:1rem; }
.menu-preferences-form label{ display:flex;flex-direction:column;gap:.35rem;color:var(--ink-soft);font-size:.85rem; }
.menu-preferences-form label small{ color:var(--ink-faint);font-size:.78rem;line-height:1.4; }
.menu-preferences-form label.wide{ grid-column:1/-1; }
.menu-preferences-form input,.menu-preferences-form textarea,.menu-preferences-form select{ width:100%;padding:.65rem .75rem;border:1px solid var(--line-strong);border-radius:9px;background:var(--surface-2);color:var(--ink);font:inherit; }
.menu-preferences-form .preference-check{ grid-column:1/-1;flex-direction:row;align-items:center;color:var(--ink); }
.menu-preferences-form .preference-check input{ width:auto; }
.menu-preferences-form .preference-policy-options{ margin:0;padding:.75rem;border:1px solid var(--line);border-radius:9px; }
.menu-preferences-form .preference-policy-options legend{ color:var(--ink-soft);font-size:.85rem;padding:0 .25rem; }
.menu-preferences-form .preference-policy-options label{ flex-direction:row;align-items:center;color:var(--ink);margin:.35rem 0; }
.menu-preferences-form .preference-policy-options input{ width:auto; }
.input-with-unit{ display:flex;align-items:center;gap:.5rem; }
.input-with-unit input{ max-width:120px; }
.account-form-actions{ display:flex;align-items:center;gap:.7rem;margin-top:1rem;flex-wrap:wrap; }
.menu-preferences-apply{ margin-top:1rem;padding:1rem;border:1px solid var(--line);border-radius:12px;background:var(--surface-2); }
.menu-preferences-apply p{ margin:0 0 .75rem; }
.account-section{ padding:0; overflow:hidden; scroll-margin-top:5.5rem; }
.account-section-toggle{
  width:100%;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:1rem;
  padding:1.15rem 1.4rem;
  border:0;
  background:transparent;
  color:var(--ink);
  text-align:left;
  font:inherit;
  cursor:pointer;
}
.account-section-toggle:hover{ background:color-mix(in srgb,var(--surface-2) 55%,transparent); }
.account-section-toggle:focus-visible{ outline:2px solid var(--accent); outline-offset:-3px; }
.account-section-heading{ min-width:0; display:flex; flex-direction:column; gap:.15rem; }
.account-section-name{
  font-family:'Big Shoulders Display',system-ui,sans-serif;
  font-size:1.4rem;
  font-weight:700;
  line-height:1.2;
  letter-spacing:-.01em;
}
.account-section-summary{ color:var(--ink-soft); font-size:.86rem; line-height:1.35; }
.account-section-chevron{
  width:.72rem;
  height:.72rem;
  flex:0 0 auto;
  margin-right:.2rem;
  border-right:2px solid currentColor;
  border-bottom:2px solid currentColor;
  color:var(--ink-soft);
  transform:rotate(45deg);
  transition:transform .18s ease;
}
.account-section-toggle[aria-expanded="true"] .account-section-chevron{ transform:rotate(225deg); }
.account-section-content{ padding:0 1.4rem 1.4rem; border-top:1px solid var(--line); }
.account-section-description{ margin-top:1rem; }
.account-data-block{ padding:1.1rem 0; }
.account-data-block + .account-data-block{ border-top:1px solid var(--line); }
.account-data-block:first-child{ padding-top:1rem; }
.account-data-block:last-child{ padding-bottom:0; }
.account-data-block h3{ margin:0 0 .55rem; font-size:1.15rem; }
.account-data-danger{
  margin-inline:-.65rem;
  padding-inline:.65rem;
  border-left:3px solid color-mix(in srgb,var(--rust) 65%,var(--line));
  background:color-mix(in srgb,var(--rust) 4%,transparent);
}
@media (max-width: 720px){
  .account-wrap{ gap:.8rem; padding:1.25rem 1rem 3rem; }
  .account-wrap > section:first-child{ margin-bottom:.35rem; }
  .account-section-toggle{ min-height:68px; padding:.9rem 1rem; }
  .account-section-name{ font-size:1.22rem; }
  .account-section-summary{ font-size:.8rem; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  .account-section-content{ padding:0 1rem 1rem; }
  .account-section-description{ margin-top:.85rem; }
  .supplement-editor{ grid-template-columns: 1fr; }
  .supplement-editor-actions{ justify-content: flex-start; }
  .menu-preferences-form{ grid-template-columns:1fr; }
  .menu-preferences-form label.wide,.menu-preferences-form .preference-check{ grid-column:auto; }
}
@media (prefers-reduced-motion:reduce){ .account-section-chevron{ transition:none; } }

/* ---- squash toggle ---- */
.toggle-row{ display: flex; align-items: center; gap: 0.8rem; }
.switch{
  position: relative;
  width: 46px; height: 26px;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  cursor: pointer;
  flex: none;
}
.switch .knob{
  position: absolute; top: 2px; left: 2px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--ink-faint);
  transition: transform 0.2s ease, background 0.2s ease;
}
.switch.on{ background: var(--rust); border-color: var(--rust); }
.switch.on .knob{ transform: translateX(20px); background: #fff; }

/* ---- weight + water combined panel ---- */
.metrics-row{
  display: flex;
  gap: 2rem;
}
.metrics-row .metric{ flex: 1; }
.metrics-row h2{ margin-bottom: 0.6rem; }
@media (max-width: 480px){ .metrics-row{ flex-direction: column; gap: 1.2rem; } }

.measurements-card{
  width: 100%;
  max-width: none;
  align-self: stretch;
  padding: 0.85rem 1rem;
}
.measurements-card .metrics-row{
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5rem;
}
.measurements-card .metric{
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
}
.measurements-card .metric h2{
  min-width: 62px;
  margin: 0;
  padding-top: 0.55rem;
  font-size: 1.15rem;
}
.measurements-card .weight-input input{
  width: 86px;
  min-height: 42px;
  padding: 0.3rem 0.55rem;
  font-size: 1.2rem;
}
#weight-input{ width: 106px; }
.context-source{display:block;margin-top:.25rem;color:var(--ink-soft);font-size:.72rem}.daily-context-card{padding:1rem 1.2rem}.daily-context-card .card-heading-row{align-items:flex-start}.daily-context-card .card-heading-row h2{margin-bottom:.2rem}.daily-context-overview{width:100%;min-width:0}.daily-context-explanation{margin:.35rem 0 .7rem;color:var(--ink-soft);line-height:1.45}.daily-context-card .empty-hint{margin:0}.daily-context-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:.85rem;margin-top:1rem}.daily-context-grid label{display:flex;flex-direction:column;gap:.35rem;color:var(--ink-soft);font-size:.82rem}.daily-context-grid .context-source{font-weight:400}.commute-fields{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));grid-column:1/-1;gap:.85rem}.daily-context-grid input,.daily-context-grid select{width:100%;min-height:42px;padding:.55rem .7rem;border:1px solid var(--line-strong);border-radius:9px;background:var(--surface-2);color:var(--ink);font:inherit}.daily-context-grid .context-checkbox{flex-direction:row;align-items:center;align-self:end;min-height:42px;color:var(--ink);font-size:.95rem}.daily-context-grid .context-checkbox input{width:auto;min-height:auto}.context-preview{display:flex;align-items:center;justify-content:space-between;gap:1rem;margin-top:1rem;padding:.8rem 1rem;border-left:3px solid var(--accent);border-radius:8px;background:var(--surface-2)}
.menu-adaptation-actions{display:flex;align-items:center;gap:.6rem;flex-wrap:wrap;margin:.9rem 0 .5rem}

/* ---- menu adaptation modal ---- */
.modal-overlay{
  position: fixed; inset: 0; z-index: 200;
  background: rgba(22, 20, 13, 0.55);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.modal-card{
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 14px;
  padding: 1.4rem 1.5rem;
  max-width: 640px; width: 100%;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.3);
}
.modal-card h2{ margin: 0 0 .4rem; }
.modal-card > p{ margin: 0; color: var(--ink-soft); }
.modal-recommendation{
  margin: .6rem 0 0;
  padding: .6rem .9rem;
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  background: var(--surface-2);
}
.modal-highlight{ box-shadow: 0 0 0 2px var(--accent); }
#adaptation-modal-proposal{ margin-top: .6rem; }
#adaptation-modal-proposal .chat-bubble{ max-width: 100%; }
body.modal-open{ overflow: hidden; }
@media (max-width: 620px){ .modal-card{ padding: 1rem 1.1rem; } }
.product-label-modal-card{max-width:720px}.product-label-modal-heading{display:flex;justify-content:space-between;align-items:flex-start;gap:1rem}.product-label-modal-heading .eyebrow{margin:0 0 .2rem}.product-label-close{border:0;background:transparent;color:var(--ink-soft);font:inherit;font-size:1.7rem;line-height:1;cursor:pointer}.product-label-file,.product-label-new-fields>label,.product-label-log-fields label,#product-label-family-fields>label{display:flex;flex-direction:column;gap:.35rem;color:var(--ink-soft);font-size:.82rem}.product-label-file{margin-top:1rem}.product-label-file input,.product-label-new-fields input,.product-label-new-fields select,.product-label-log-fields input,.product-label-log-fields select,#product-label-family-fields input,#product-label-family-results{width:100%;min-height:42px;padding:.55rem .7rem;border:1px solid var(--line-strong);border-radius:9px;background:var(--surface-2);color:var(--ink);font:inherit}.product-label-actions{display:flex;align-items:center;gap:.6rem;flex-wrap:wrap;margin-top:1rem}.product-label-status{display:block;min-height:1.4em;margin-top:.8rem}.product-label-status.error{color:var(--rust)}.product-label-summary{display:flex;flex-direction:column;gap:.2rem;margin:.8rem 0}.product-label-summary span{color:var(--ink-soft);font-size:.82rem}.product-label-nutrition{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:1px;background:var(--line);border:1px solid var(--line);border-radius:10px;overflow:hidden}.product-label-nutrition>p{grid-column:1/-1;margin:0;padding:.55rem .7rem;background:var(--surface-2);color:var(--ink-soft);font-size:.8rem}.product-label-nutrition>div{display:flex;justify-content:space-between;gap:.6rem;padding:.55rem .7rem;background:var(--surface)}.product-label-nutrition span{color:var(--ink-soft)}.product-label-allergen-note{padding:.7rem .8rem;border-left:3px solid var(--accent);background:var(--surface-2);font-size:.85rem}.product-label-fieldset{border:0;padding:0;margin:1rem 0}.product-label-fieldset legend{font-weight:700;margin-bottom:.45rem}.product-label-choice{display:flex;align-items:flex-start;gap:.55rem;padding:.55rem .65rem;border:1px solid var(--line);border-radius:9px;margin-bottom:.4rem;cursor:pointer}.product-label-choice:has(input:checked){border-color:var(--accent);background:var(--surface-2)}.product-label-choice input{margin-top:.2rem;accent-color:var(--accent)}.product-label-choice span{display:flex;flex-direction:column}.product-label-choice small{color:var(--ink-soft)}.product-label-new-fields{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:.7rem}.product-label-new-fields .product-label-kind,.product-label-new-fields #product-label-family-fields{grid-column:1/-1}.product-label-family-search{display:flex;gap:.45rem}.product-label-family-search input{flex:1}.product-label-log-fields{display:grid;grid-template-columns:1.3fr 1fr .8fr;gap:.7rem}.meal-product-items{display:flex;flex-direction:column;gap:.35rem;margin-top:.2rem}.meal-product-item{display:flex;align-items:center;justify-content:space-between;gap:.7rem;padding:.55rem .65rem;border-left:3px solid var(--olive);border-radius:7px;background:var(--surface-2)}.meal-product-item>span{display:flex;flex-direction:column;min-width:0}.meal-product-item strong{font-size:.88rem}.meal-product-item small{color:var(--ink-soft)}
.product-label-file-picker{position:relative;display:flex;align-items:center;gap:.65rem;min-height:48px;padding:.35rem;border:1px solid var(--line-strong);border-radius:10px;background:var(--surface-2);cursor:pointer}.product-label-file-picker:hover{border-color:var(--accent)}.product-label-file-picker:focus-within{outline:2px solid var(--accent);outline-offset:2px}.product-label-file .product-label-file-input{position:absolute!important;width:1px!important;height:1px!important;min-height:0!important;padding:0!important;border:0!important;overflow:hidden;opacity:0;clip-path:inset(50%)}.product-label-file-button{flex:none;padding:.62rem .85rem;border-radius:8px;background:var(--accent);color:var(--accent-ink);font-size:.88rem;font-weight:700;text-align:center}.product-label-file-name{min-width:0;overflow:hidden;color:var(--ink-soft);font-size:.82rem;text-overflow:ellipsis;white-space:nowrap}.product-label-file-name.selected{color:var(--ink)}.product-label-barcode-fallback{margin:.8rem 0 1rem}.product-label-barcode-note{margin:0;padding:.7rem .8rem;border-left:3px solid var(--olive);border-radius:8px;background:var(--surface-2);color:var(--ink-soft);font-size:.86rem}.product-label-barcode-note strong{display:block;color:var(--ink)}.product-label-barcode-options{margin-top:.55rem;border:1px solid var(--line);border-radius:10px;background:var(--surface-2)}.product-label-barcode-options summary{padding:.7rem .8rem;color:var(--ink);font-weight:700;cursor:pointer}.product-label-barcode-options summary small{color:var(--ink-soft);font-weight:400}.product-label-barcode-fields{display:flex;flex-direction:column;gap:.7rem;padding:0 .8rem .8rem}.product-label-barcode-fields .product-label-file{margin-top:0}.product-label-barcode-fields>label{display:flex;flex-direction:column;gap:.35rem;color:var(--ink-soft);font-size:.82rem}.product-label-barcode-fields>label input{width:100%;min-height:42px;padding:.55rem .7rem;border:1px solid var(--line-strong);border-radius:9px;background:var(--surface);color:var(--ink);font:inherit}
.product-label-file-picker:has(.product-label-file-input:disabled){pointer-events:none;cursor:wait;opacity:.58}.product-label-extract[aria-busy="true"]::after{content:'';display:inline-block;width:.9em;height:.9em;margin-left:.55rem;border:2px solid currentColor;border-right-color:transparent;border-radius:50%;vertical-align:-.12em;animation:product-label-spin .7s linear infinite}@keyframes product-label-spin{to{transform:rotate(360deg)}}
.product-label-feedback{position:fixed;left:50%;bottom:calc(1rem + env(safe-area-inset-bottom));z-index:210;width:max-content;max-width:calc(100vw - 2rem);padding:.8rem 1rem;border:1px solid var(--olive);border-radius:10px;background:var(--surface);box-shadow:0 10px 30px rgba(0,0,0,.28);color:var(--ink);font-weight:700;transform:translateX(-50%)}.meal-product-item.just-added{outline:2px solid var(--accent);outline-offset:2px;background:color-mix(in srgb,var(--accent) 14%,var(--surface-2))}
@media (prefers-reduced-motion:reduce){.product-label-extract[aria-busy="true"]::after{animation-duration:1.4s}}
@media (max-width:620px){.product-label-nutrition,.product-label-new-fields,.product-label-log-fields{grid-template-columns:1fr}.product-label-family-search{align-items:stretch}.product-label-family-search .plan-btn{flex:none}.product-label-modal-card{max-height:96vh}.product-label-file-picker{align-items:stretch;flex-direction:column}.product-label-file-name{text-align:center}.meal-product-item{align-items:flex-start}}
@media (max-width: 620px){
  .measurements-card .metrics-row{ grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .7rem; }
  .measurements-card .metric{ align-items: flex-start; flex-direction: column; gap: 0.35rem; }
  .measurements-card .metric h2{ min-width: 0; padding-top: 0; }
  .measurements-card .weight-input input{width:82px}
  .measurements-card #weight-input{width:106px}
  .daily-context-grid,.commute-fields{grid-template-columns:1fr}.context-preview{align-items:flex-start;flex-direction:column}
  .daily-context-card{ padding: .8rem .9rem; }
  .daily-context-card .card-heading-row{ align-items: center; }
  .daily-context-card .card-heading-row h2{ margin: 0; font-size: 1.15rem; }
  .daily-context-card .card-heading-row .plan-btn{ flex: none; min-height: 42px; }
  .daily-context-overview{ margin-top: .35rem; }
  .daily-context-explanation{ display: none; }
  .daily-context-card #daily-context-summary{
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .daily-context-card.is-open .daily-context-explanation{ display: block; }
  .daily-context-card.is-open #daily-context-summary{
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
  }
}
@media (max-width: 480px){
  .measurements-card .metrics-row{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---- weight input ---- */
.weight-input{
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}
.weight-input input{
  width: 110px;
  font-size: 1.6rem;
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 600;
  padding: 0.4rem 0.6rem;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--ink);
}

textarea{
  width: 100%;
  min-height: 70px;
  padding: 0.6rem 0.8rem;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.9rem;
  resize: vertical;
}

.save-bar{
  position: fixed;
  z-index: 80;
  right: max(1rem, env(safe-area-inset-right));
  bottom: max(1rem, env(safe-area-inset-bottom));
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.7rem;
  align-items: center;
  max-width: calc(100vw - 2rem);
  padding: .55rem;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  background: var(--surface);
  box-shadow: 0 10px 32px rgba(0,0,0,.22);
}
.save-bar .save-status:empty{ display:none; }
.save-bar .save-status{ max-width: min(62vw, 28rem); }
.save-btn{
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
  border-radius: 10px;
  padding: 0.75rem 1.6rem;
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.save-btn:active{ transform: translateY(1px); }
.save-btn:disabled, .plan-btn:disabled{
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}
.save-status{ font-size: 0.85rem; color: var(--ink-soft); }

/* ---- heatmap ---- */
.heatmap{ display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 1fr); gap: 3px; overflow-x: auto; padding-bottom: 0.5rem; }
.heatmap .cell{ width: 13px; height: 13px; border-radius: 3px; background: var(--surface-2); border: 1px solid var(--line); }
.heatmap .cell[data-level="1"]{ background: color-mix(in srgb, var(--olive) 35%, var(--surface-2)); }
.heatmap .cell[data-level="2"]{ background: color-mix(in srgb, var(--olive) 65%, var(--surface-2)); }
.heatmap .cell[data-level="3"]{ background: var(--olive); }
.heatmap .cell[data-squash="1"]{ box-shadow: inset 0 0 0 2px var(--rust); }

.chart-wrap{ overflow-x: auto; }
.chart-wrap svg{ display: block; }

/* ---- seven-day menu ---- */
.menu-page-intro h1,.progress-page-intro h1{ margin:0 0 .35rem;font-size:2rem;line-height:1.15; }
.menu-page-intro .menu-range,.progress-page-intro p{ margin:0;color:var(--ink-soft); }
.menu-days{ display:flex;flex-direction:column;gap:1rem; }
.menu-day-card{ padding:0;overflow:hidden; }
.menu-day-card.today{ border-color:color-mix(in srgb,var(--accent) 65%,var(--line)); }
.menu-day-header{ display:flex;align-items:center;justify-content:space-between;gap:1rem;padding:1.1rem 1.3rem .8rem; }
.menu-day-header .eyebrow{ margin-bottom:.15rem; }
.menu-day-header h2{ margin:0;font-size:1.45rem; }
.menu-target{ flex:none;padding:.45rem .7rem;border-radius:999px;background:var(--surface-2);font-weight:600; }
.menu-activity-row{ padding:0 1.3rem .85rem;color:var(--ink-soft);font-size:.85rem; }
.menu-activity{ display:inline-block;margin-right:.8rem;color:var(--rust); }
.menu-meals{ border-top:1px solid var(--line); }
.menu-meal{ display:grid;grid-template-columns:105px minmax(0,1fr) auto;gap:1rem;align-items:start;padding:.8rem 1.3rem;border-bottom:1px solid var(--line); }
.menu-meal-label{ color:var(--ink-faint);font-size:.75rem;font-weight:700;letter-spacing:.06em;text-transform:uppercase; }
.menu-meal-dish{ line-height:1.4; }
.menu-meal-kcal{ color:var(--ink-soft);font-size:.8rem;white-space:nowrap; }
.menu-empty{ display:flex;flex-direction:column;gap:.15rem;padding:1.1rem 1.3rem;color:var(--ink-soft); }
.menu-empty strong{ color:var(--ink); }
.menu-open-day{ display:flex;align-items:center;justify-content:flex-end;gap:.35rem;padding:.75rem 1.3rem;text-decoration:none;color:var(--accent-on-surface);font-weight:700; }
.menu-open-day:hover{ background:var(--surface-2); }

/* ---- progress page ---- */
.progress-page-intro{ max-width:680px; }
.progress-goal-card{ padding:1.35rem 1.5rem; }
.progress-goal-values{ display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:1px;margin:-1.35rem -1.5rem 1.1rem;background:var(--line);border-bottom:1px solid var(--line); }
.progress-goal-values>div{ display:flex;flex-direction:column;gap:.25rem;padding:1rem 1.2rem;background:var(--surface); }
.progress-goal-values span{ color:var(--ink-faint);font-size:.7rem;letter-spacing:.07em;text-transform:uppercase; }
.progress-goal-values strong{ font-size:1.25rem; }
.progress-goal-bar{ height:12px; }
.progress-goal-bar .fill{ height:100%;background:linear-gradient(90deg,var(--olive),var(--accent));border-radius:inherit;transition:width .25s ease; }
.progress-goal-scale{ display:flex;justify-content:space-between;gap:1rem;margin-top:.45rem;color:var(--ink-faint);font-size:.75rem; }
.progress-goal-summary{ margin:.9rem 0 0;color:var(--ink-soft); }
.progress-projection-card{ display:grid;grid-template-columns:minmax(180px,.7fr) minmax(240px,1.3fr);gap:.8rem 1.5rem;align-items:start; }
.progress-projection-card h2{ margin:0;font-size:1.25rem; }
.progress-projection-primary{ margin:.1rem 0 0;font-size:1.05rem;line-height:1.45;color:var(--ink); }
.progress-projection-details{ grid-column:2;display:flex;gap:.45rem 1.25rem;flex-wrap:wrap;color:var(--ink-faint);font-size:.8rem; }
.progress-projection-details span{ display:inline-flex;gap:.35rem; }
.progress-period-heading{ align-items:flex-end; }
.progress-period-heading h2{ margin:0; }
.progress-period-heading>p{ margin:0;color:var(--ink-soft);font-size:.85rem;text-align:right; }
.progress-stat-strip .stat{ min-height:92px; }
.chart-legend{ color:var(--ink-faint);font-size:.8rem; }
.chart-legend i{ display:inline-block;width:20px;height:3px;margin-right:.35rem;border-radius:2px;background:var(--accent);vertical-align:middle; }
.progress-chart-actions{ display:flex;flex-direction:column;align-items:flex-end;gap:.65rem; }
.progress-chart-ranges{ display:flex;gap:.25rem;padding:.2rem;border:1px solid var(--line);border-radius:9px;background:var(--surface-2); }
.progress-chart-ranges button{ padding:.38rem .62rem;border:0;border-radius:6px;background:transparent;color:var(--ink-soft);font:600 .76rem Karla,sans-serif;cursor:pointer; }
.progress-chart-ranges button:hover{ color:var(--ink); }
.progress-chart-ranges button[aria-pressed="true"]{ background:var(--surface);color:var(--accent-on-surface);box-shadow:0 1px 3px rgba(0,0,0,.08); }
.progress-chart-ranges button:focus-visible{ outline:2px solid var(--accent);outline-offset:2px; }
.progress-chart-summary{ margin:.1rem 0 .75rem;color:var(--ink-soft);font-size:.86rem; }
.chart-wrap #weight-chart{ display:block;width:100%;height:240px; }
.journal-calendar-range{ color:var(--ink-faint);font-size:.8rem; }
.journal-calendar-legend{ display:flex;gap:1rem;flex-wrap:wrap;margin:-.2rem 0 1rem;color:var(--ink-soft);font-size:.78rem; }
.journal-calendar-legend span{ display:flex;align-items:center;gap:.35rem; }
.calendar-swatch{ width:13px;height:13px;border:1px solid var(--line);border-radius:3px;background:var(--surface-2); }
.calendar-swatch.level-1{ background:color-mix(in srgb,var(--olive) 35%,var(--surface-2)); }
.calendar-swatch.level-3{ background:var(--olive); }
.activity-marker{ width:8px;height:8px;border-radius:50%;background:var(--rust); }
.journal-calendar-weekdays,.journal-calendar{ display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:.4rem; }
.journal-calendar-weekdays{ margin-bottom:.4rem;color:var(--ink-faint);font-size:.7rem;text-align:center;text-transform:uppercase; }
.journal-day{ position:relative;display:flex;align-items:center;justify-content:center;min-height:38px;border:1px solid var(--line);border-radius:7px;background:var(--surface-2);color:var(--ink-soft);text-decoration:none;font-size:.8rem; }
.journal-day:hover{ border-color:var(--line-strong);transform:translateY(-1px); }
.journal-day[data-level="1"]{ background:color-mix(in srgb,var(--olive) 28%,var(--surface));color:var(--ink); }
.journal-day[data-level="2"]{ background:color-mix(in srgb,var(--olive) 55%,var(--surface));color:var(--ink); }
.journal-day[data-level="3"]{ background:var(--olive);border-color:var(--olive);color:#fff; }
.journal-day.future{ color:var(--ink-soft);background:transparent;border-style:dashed;cursor:default; }
.journal-day.future:hover{ transform:none;border-color:var(--line); }
.journal-day>i{ position:absolute;right:4px;top:4px;width:6px;height:6px;border-radius:50%;background:var(--rust);box-shadow:0 0 0 1px var(--surface); }

@media (max-width:620px){
  .menu-meal{ grid-template-columns:80px minmax(0,1fr);gap:.35rem .75rem; }
  .menu-meal-kcal{ grid-column:2; }
  .progress-goal-values{ grid-template-columns:repeat(2,minmax(0,1fr)); }
  .progress-period-heading{ align-items:flex-start;flex-direction:column; }
  .progress-period-heading>p{ text-align:left; }
  .progress-goal-scale{ font-size:.65rem; }
  .progress-projection-card{ grid-template-columns:1fr;gap:.55rem; }
  .progress-projection-details{ grid-column:1; }
  .progress-chart-actions{ width:100%;align-items:flex-start; }
  .progress-chart-ranges{ width:100%; }
  .progress-chart-ranges button{ flex:1;padding:.48rem .25rem; }
  .journal-calendar-weekdays,.journal-calendar{ gap:.25rem; }
  .journal-day{ min-height:34px; }
}

.empty-hint{ color: var(--ink-faint); font-size: 0.9rem; font-style: italic; }

/* ---- assistant chats ---- */
.chat-card{ display: flex; flex-direction: column; gap: 1rem; }
.chat-messages{
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  max-height: 55vh;
  overflow-y: auto;
  padding: 0.2rem;
}
.chat-bubble{
  max-width: 85%;
  padding: 0.7rem 1rem;
  border-radius: 14px;
  font-size: 0.95rem;
  white-space: pre-wrap;
}
.chat-bubble.from-ai{
  align-self: flex-start;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
}
.chat-bubble.from-user{
  align-self: flex-end;
  background: var(--olive);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-input-row{ display: flex; gap: 0.6rem; align-items: flex-end; }
.chat-input-row textarea{ flex: 1; min-height: 0; }

.edit-proposals{
  align-self: flex-start;
  max-width: 85%;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  padding: 0.7rem 0.9rem;
  font-size: 0.9rem;
}
.edit-proposal{ padding: 0.25rem 0; }
.edit-target-advisory{
  margin-top: 0.55rem;
  padding: 0.65rem 0.75rem;
  border-left: 3px solid var(--gold);
  border-radius: 0.35rem;
  background: var(--cream);
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}
.edit-proposal-actions{
  display: flex;
  gap: 0.6rem;
  align-items: center;
  margin-top: 0.5rem;
}
.edit-proposal-actions .save-status{ flex: 1; }
.edit-proposal .slot-label{
  font-size: 0.72rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-right: 0.3rem;
}

@media (max-width: 560px){
  .today-tool-panel .chat-messages{ width: 100%; min-width: 0; }
  .today-tool-panel .chat-bubble.from-ai,
  .today-tool-panel .edit-proposals{
    box-sizing: border-box;
    width: 100%;
    max-width: none;
  }
  .today-tool-panel .chat-bubble.from-user{ max-width: 92%; }
  .today-tool-panel .chat-input-row{
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    width: 100%;
  }
  .today-tool-panel .chat-input-row textarea{ min-width: 0; }
  .today-tool-panel .edit-proposal-actions{
    align-items: stretch;
    flex-direction: column;
  }
  .today-tool-panel .edit-proposal-actions .plan-btn{ width: 100%; }
}

/* ---- admin table ---- */
.table-wrap{ overflow-x: auto; }
.data-table{ width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.data-table th{
  text-align: left;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding: 0.5rem 0.7rem;
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
}
.data-table td{
  padding: 0.6rem 0.7rem;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.data-table tbody tr:last-child td{ border-bottom: none; }
/* Admin is a data-table page -- the 880px reading width squeezes the columns off-screen. */
.wrap.wide{ max-width: 1240px; }

/* ---- prose pages (privacy policy) ---- */
.wrap.prose{ max-width: 720px; }
.wrap.prose h3{ font-size: 1.15rem; margin: 0 0 0.6rem; }
.wrap.prose p{ margin: 0 0 0.8rem; line-height: 1.65; }
.wrap.prose p:last-child{ margin-bottom: 0; }
.wrap.prose ol, .wrap.prose ul{ margin: 0 0 0.8rem; padding-left: 1.3rem; line-height: 1.7; }
.wrap.prose li{ margin-bottom: 0.3rem; }

/* ---- destructive actions ---- */
.danger-card{ border-color: color-mix(in srgb, var(--rust) 35%, var(--line)); }
.danger-btn{
  background: transparent;
  color: var(--rust);
  border: 1px solid var(--rust);
  border-radius: 10px;
  padding: 0.6rem 1.2rem;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}
.danger-btn:hover:not(:disabled){ background: var(--rust); color: #fff; }
.danger-btn:disabled{ opacity: 0.45; cursor: not-allowed; }

.consent-note{
  font-size: 0.8rem;
  color: var(--ink-faint);
  text-align: center;
  line-height: 1.5;
  margin: 1rem 0 0;
}

.conversation{
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.9rem 1.1rem;
  margin-bottom: 1rem;
  background: var(--surface);
}
.conversation .chat-turn{ border-top: 1px solid var(--line); }
.conversation .chat-turn:first-of-type{ border-top: none; padding-top: 0; }

.plan-context{
  font-size: 0.82rem;
  color: var(--ink-faint);
  margin-bottom: 0.6rem;
}
.plan-context summary{ cursor: pointer; }
.plan-context pre{
  white-space: pre-wrap;
  font-size: 0.8rem;
  background: var(--surface-2);
  padding: 0.5rem 0.7rem;
  border-radius: 8px;
  margin: 0.4rem 0 0;
}

.chat-turn-edits{
  font-size: 0.82rem;
  color: var(--ink-soft);
  border-left: 2px solid var(--line-strong);
  padding: 0.3rem 0 0.3rem 0.7rem;
  margin-top: 0.3rem;
}
.edit-badge{
  display: inline-block;
  margin-right: 0.5rem;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--ink-faint);
}
.edit-badge.applied{ background: var(--good); color: #fff; }

.chat-turn{
  border-top: 1px solid var(--line);
  padding: 0.8rem 0;
}
.chat-turn:first-child{ border-top: none; }
.chat-turn-meta{
  display: flex;
  gap: 0.9rem;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 0.4rem;
}
.chat-turn-user, .chat-turn-ai{
  font-size: 0.9rem;
  white-space: pre-wrap;
  padding: 0.35rem 0.6rem;
  border-radius: 8px;
  margin-bottom: 0.3rem;
}
.chat-turn-user{ background: var(--surface-2); }
.chat-turn-ai{ color: var(--ink-soft); }
.generate-controls select{
  margin-left: 0.4rem;
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--ink);
  font-family: inherit;
}
.admin-badge{
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: var(--olive);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

footer.page-footer{
  max-width: 880px;
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
  color: var(--ink-faint);
  font-size: 0.85rem;
}

/* Links from app screens to the knowledge site */
.why-link{ font-size:.85rem; margin:.25rem 0 0; }
.why-link a{ color:var(--accent-on-surface); text-decoration:none; border-bottom:1px dotted currentColor; margin-right:.8rem; }
.why-link a:hover{ border-bottom-style:solid; }

/* ==== One system, two rooms: the language chosen for the public site (design-canvas-2026-09-04,
   "Табло + Списание") applied to the app's chrome and readouts. Appended so it wins the cascade. ==== */
:root{ --deep: #2B2723; --deep-ink: #F1EBE1; --deep-soft: #B9B0A2; --accent-hover: #CB9040; }
@media (prefers-color-scheme: dark){ :root:not([data-theme="light"]){ --deep: #2A2820; --accent-hover: #EFBB63; } }
:root[data-theme="dark"]{ --deep: #2A2820; --accent-hover: #EFBB63; }

nav.topbar{ background: var(--deep); border-bottom: 0; }
nav.topbar .brand{ color: var(--deep-ink); text-decoration: none; letter-spacing: .02em; }
nav.topbar .brand .num{ color: var(--accent); }
nav.topbar .links a{ color: var(--deep-soft); }
nav.topbar .links a:hover{ color: var(--deep-ink); }
nav.topbar .links a.active{ background: transparent; color: var(--accent-on-deep); box-shadow: inset 0 -2px 0 var(--accent); border-radius: 0; }
nav.topbar .links a:focus-visible{ outline: 2px solid var(--accent); outline-offset: 2px; }
.nav-toggle{ color: var(--deep-ink); background: transparent; border-color: var(--deep-soft); }
@media (max-width: 720px){
  nav.topbar .links{ background: var(--deep); border-color: var(--deep-soft); }
  nav.topbar .links a{ color: var(--deep-ink); }
  nav.topbar .links a.active{ box-shadow: none; color: var(--accent-on-deep); }
}

.eyebrow{ font-family: 'IBM Plex Mono', ui-monospace, monospace; font-weight: 500; font-size: .7rem; letter-spacing: .12em; color: var(--ink-soft); }

/* readout tiles: the day's numbers as the public calculators show them */
.stat-strip{ gap: .6rem; background: transparent; border: 0; border-radius: 0; overflow: visible; }
.stat-strip .stat{ border: 1px solid var(--line); border-radius: 8px; background: var(--surface); padding: .7rem .85rem; gap: .2rem; }
.stat-strip .stat .label{ font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: .64rem; letter-spacing: .1em; color: var(--ink-soft); }
.stat-strip .stat .value{ font-family: 'IBM Plex Mono', ui-monospace, monospace; font-variant-numeric: tabular-nums; font-size: 1.35rem; font-weight: 600; }
.stat-strip .stat.streak .value{ color: var(--ink); }
.stat-strip .stat.stat-hero{ background: var(--deep); border-color: var(--deep); color: var(--deep-ink); }
.stat-strip .stat.stat-hero .label{ color: var(--deep-soft); }
.stat-strip .stat.stat-hero .value{ color: var(--accent-on-deep); }
.stat-strip .stat.stat-hero .value small{ color: var(--deep-soft); }

/* the guided flow's step bar — the same segments as the public journey */
.step-segments{ display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; margin: .35rem 0 1rem; }
.step-segments span{ display: block; height: 8px; border-radius: 4px; background: var(--line-strong); }
.step-segments span.done{ background: var(--ink); }
.step-segments span.now{ background: var(--accent); }
.step-count{ font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: .74rem; letter-spacing: .06em; color: var(--ink-soft); }

.save-btn:hover{ background: var(--accent-hover); }

/* ==== second pass: cards, chips and labels in the same language (04.09.2026) ==== */
.card{ border-radius: 8px; box-shadow: none; }
section > h2, .menu-day-header h2{ font-weight: 800; }
.menu-page-intro h1, .progress-page-intro h1{ font-weight: 800; font-size: clamp(1.9rem, 4vw, 2.5rem); line-height: 1.02; }
.metrics-row h2, .meal-row .slot-label, .menu-meal-label, .kcal-tag{ font-family: 'IBM Plex Mono', ui-monospace, monospace; font-weight: 500; font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); }
.metrics-row h2{ margin-bottom: .45rem; }
.weight-input input{ border-radius: 6px; background: var(--surface); }
.day-nav-arrow, .day-pills a, .plan-btn, .meal-row input[type="text"]{ border-radius: 6px; }
.day-pills a .dow{ font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: .62rem; letter-spacing: .08em; }
.day-pills a .num{ font-family: 'IBM Plex Mono', ui-monospace, monospace; font-variant-numeric: tabular-nums; }
.day-pills a.active{ background: var(--deep); border-color: var(--deep); }
.day-pills a.active .dow{ color: var(--deep-soft); }
.day-pills a.active .num{ color: var(--accent); }
.day-pills a.active .day-markers span{ box-shadow: 0 0 0 1px rgba(241,235,225,.6); }
.plan-btn.active{ background: var(--deep); border-color: var(--deep); color: var(--accent); }
.menu-target{ font-family: 'IBM Plex Mono', ui-monospace, monospace; font-variant-numeric: tabular-nums; font-weight: 600; font-size: .85rem; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); }
.menu-day-card.today{ border-color: var(--accent); }
.menu-day-card.today .menu-target{ background: var(--deep); border-color: var(--deep); color: var(--accent-on-deep); }
.account-section-toggle:focus-visible{ outline-offset: -3px; }

/* Future days: weight, water and meals are logged on the day itself. The lock must look like a lock —
   the owner twice took the disabled fields for broken ones (25.08 and 04.09.2026). */
.future-day-notice{ margin: 0 0 1rem; font-size: .92rem; }
.future-day-notice a{ font-weight: 600; }
.weight-input input:disabled, .meal-row input[type="text"]:disabled, .plan-btn:disabled{ border-style: dashed; background: transparent; color: var(--ink-faint); cursor: not-allowed; }
.day-pills a.today .dow{ color: var(--accent); font-weight: 600; }

/* The selected day must be unmistakable: amber fill with dark text. Today keeps the outline and „днес“,
   so a resumed PWA sitting on tomorrow cannot be read as today (owner, 04.09.2026 15:55). */
.day-pills a.active{ background: var(--accent); border-color: var(--accent); }
.day-pills a.active .dow, .day-pills a.active .num{ color: var(--accent-ink); }
.day-pills a.active .day-markers span{ box-shadow: 0 0 0 1px rgba(42,32,19,.35); }
.day-pills a.today:not(.active) .dow{ color: var(--accent); }

/* ---- "Хапнах друго" → продукти с количества (04.09.2026) ---- */
.meal-items{ width: 100%; margin-top: .4rem; }
.meal-items:empty{ display: none; }
.meal-items-summary{ margin: 0; font-size: .9rem; color: var(--ink-soft); }
.meal-items-summary.error{ color: var(--rust); }
.link-btn{ background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; font: inherit; }
.meal-breakdown{ border: 1px solid var(--line); border-radius: 8px; padding: .6rem .7rem; background: var(--surface-2); display: flex; flex-direction: column; gap: .5rem; }
.meal-breakdown-title{ margin: 0; font-size: .85rem; color: var(--ink-soft); }
.meal-item-row{ display: flex; flex-direction: column; gap: .25rem; padding: .4rem 0; border-top: 1px solid var(--line); }
.meal-item-row:first-of-type{ border-top: 0; }
.meal-item-row.info{ opacity: .8; }
.meal-item-main{ display: flex; flex-wrap: wrap; gap: .4rem; align-items: baseline; }
.meal-item-label{ font-weight: 600; }
.meal-item-product{ color: var(--ink-soft); font-size: .9rem; }
.meal-item-product .unknown{ color: var(--rust); }
.meal-item-amount{ display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.meal-row .meal-item-amount input[type="number"]{ width: 6.5rem; min-height: 38px; padding: .3rem .5rem; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); color: var(--ink); font: inherit; }
.meal-item-amount select{ min-height: 38px; padding: .3rem .4rem; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); color: var(--ink); font: inherit; }
.meal-item-kcal{ min-width: 5rem; font-variant-numeric: tabular-nums; }
.meal-item-own-kcal{ display: inline-flex; align-items: center; gap: .25rem; min-width: 5rem; }
.meal-item-own-kcal input{ width: 4.5rem; }
.meal-item-kcal-unit{ font-size: .8rem; color: var(--ink-faint); }
.meal-item-scan{ font-size: .8rem; white-space: nowrap; }
.meal-item-remove{ background: none; border: 1px solid var(--line); border-radius: 6px; min-height: 38px; min-width: 38px; color: var(--ink-soft); cursor: pointer; }
.meal-item-note{ font-size: .8rem; color: var(--ink-faint); }
.meal-breakdown-actions{ display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.meal-breakdown-status{ font-size: .85rem; color: var(--ink-soft); }
.meals-eaten{ margin: .8rem 0 0; font-size: .9rem; color: var(--ink-soft); }
.meal-item-estimate{ font-size: .72rem; color: var(--rust); border: 1px solid currentColor; border-radius: 4px; padding: 0 .3rem; margin-left: .2rem; vertical-align: middle; }
.meal-consent{ border: 1px solid var(--line-strong); border-radius: 8px; padding: .6rem .7rem; background: var(--surface); display: flex; flex-direction: column; gap: .5rem; margin-bottom: .5rem; }
.meal-consent h3{ margin: 0; font-size: 1rem; }
.meal-consent-choice{ display: flex; gap: .5rem; align-items: flex-start; font-size: .9rem; line-height: 1.4; }
.meal-consent-choice input{ margin-top: .2rem; flex: 0 0 auto; }
.account-consent{ margin: .8rem 0; }

/* Mutually exclusive product capture methods, compact on phones. */
.product-scan-mode{margin:.65rem 0;border:1px solid var(--line);border-radius:10px;background:var(--surface-2)}
.product-scan-mode>summary{padding:.85rem;font-weight:700;cursor:pointer}
.product-scan-mode>summary[aria-disabled="true"]{cursor:wait;opacity:.65}
.product-scan-mode-body{padding:0 .85rem .85rem}
.product-scan-mode-body>p:first-child{margin-top:0}
.product-scan-progress{display:flex;align-items:center;gap:.7rem;padding:.85rem;margin-bottom:.7rem;border:1px solid var(--olive);border-radius:10px;background:var(--surface-2);font-weight:700}
.product-scan-spinner{flex:none;width:1.25rem;height:1.25rem;border:3px solid var(--line-strong);border-top-color:var(--olive);border-radius:50%;animation:product-label-spin .7s linear infinite}
@media(prefers-reduced-motion:reduce){.product-scan-spinner{animation:none}}
