.usage-values { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 20px 0; }
.usage-values dt { font-size: 13px; }
.usage-values dd { margin: 6px 0 0; font-size: 20px; font-weight: 600; overflow-wrap: anywhere; }
#usage-dialog { width: 460px; max-width: calc(100% - 24px); }
#usage-content p { overflow-wrap: anywhere; }

:root {
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  color: #26312d;
  background: #f6f7f6;
  font-size: 14px;
  font-synthesis: none;
  letter-spacing: 0;
  --green: #18765c;
  --line: #e1e6e3;
  --muted: #6f7b74;
  --rose: #a34d65;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}
button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: inherit;
  cursor: pointer;
  line-height: 1.4;
}
button:hover {
  background: #f0f5f2;
}
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
button:focus-visible,
a:focus-visible {
  outline: 3px solid #94cabb;
  outline-offset: 2px;
}
.primary {
  background: var(--green);
  border-color: var(--green);
  color: white;
}
.primary:hover {
  background: #125c47;
}
.danger {
  color: #a73545;
  border-color: #dfb3ba;
}
.full {
  width: 100%;
}
.icon-button {
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 8px;
  border-color: transparent;
  flex-shrink: 0;
}
.icon-button:hover {
  border-color: var(--line);
}
svg {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
}
a {
  color: var(--green);
  text-decoration: none;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h1 {
  font-size: 26px;
  line-height: 1.35;
  font-weight: 650;
  margin-bottom: 0;
}
h2 {
  font-size: 18px;
  margin-bottom: 0;
  font-weight: 600;
}
h3 {
  font-size: 15px;
  margin-bottom: 8px;
  font-weight: 600;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 12px;
}
label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: #46534b;
  font-size: 13px;
}
input,
select,
textarea {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 9px 11px;
  border: 1px solid #d4dcd7;
  border-radius: 5px;
  background: white;
  color: #26312d;
}
input:focus,
select:focus,
textarea:focus {
  outline: 2px solid #b3d7c9;
  border-color: var(--green);
}
textarea {
  resize: vertical;
  min-height: 80px;
}
input::placeholder,
textarea::placeholder {
  color: #8a958e;
}
form {
  display: grid;
  gap: 18px;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.span-2 {
  grid-column: 1/-1;
}
[hidden] {
  display: none !important;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 18px;
  font-weight: 650;
  color: #253b30;
  white-space: nowrap;
}
.brand > svg {
  width: 29px;
  height: 29px;
  color: var(--green);
}
.auth-screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  gap: 28px;
}
.auth-panel {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 32px;
  width: min(420px, 100%);
}
.auth-panel h1 {
  font-size: 22px;
  margin-bottom: 24px;
}
.auth-panel .segmented {
  margin-bottom: 24px;
}
.auth-footer {
  color: var(--muted);
  font-size: 12px;
}
.segmented {
  display: flex;
  gap: 3px;
  background: #f1f4f2;
  padding: 4px;
  border-radius: 6px;
}
.segmented button {
  flex: 1;
  min-width: 0;
  border-color: transparent;
  background: transparent;
  font-size: 13px;
  padding: 7px 10px;
}
.segmented .selected {
  background: white;
  border-color: #dae3dd;
  color: var(--green);
  font-weight: 600;
}
.topbar {
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: white;
}
.account {
  display: flex;
  gap: 14px;
  align-items: center;
  font-size: 13px;
}
.account > span {
  min-width: 0;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar > .brand { flex-shrink: 0; }
.topbar > .account { min-width: 0; gap: 8px; margin-left: 12px; }
.account > button { flex-shrink: 0; }
.layout {
  display: grid;
  grid-template-columns: 196px minmax(0, 1fr);
  min-height: calc(100dvh - 68px);
}
.sidebar {
  background: #fcfdfc;
  border-right: 1px solid var(--line);
  padding: 26px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.sidebar nav {
  display: grid;
  gap: 6px;
}
.nav-item {
  justify-content: flex-start;
  gap: 12px;
  padding: 11px 13px;
  border: 0;
  background: transparent;
  color: #657369;
  min-height: 44px;
}
.nav-item.active {
  color: var(--green);
  background: #e6f1eb;
  font-weight: 600;
}
main {
  min-width: 0;
  width: 100%;
  max-width: 1280px;
  padding: 34px 40px 64px;
  margin: 0 auto;
}
.page-heading {
  display: flex;
  gap: 20px;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
}
.eyebrow {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 7px;
}
.date-control {
  display: flex;
  flex-direction: row;
  gap: 9px;
  align-items: center;
  background: white;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  flex-shrink: 0;
}
.date-control svg {
  color: var(--muted);
  width: 17px;
}
.date-control input {
  border: 0;
  padding: 9px 0;
  width: 136px;
  background: transparent;
}
.intake-targets { padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.target-actions { display: flex; gap: 8px; flex-shrink: 0; }
.target-values { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.target-values > div { min-width: 0; }
.target-values span { display: block; font-size: 13px; color: var(--muted); }
.target-values strong { display: block; font-size: 22px; font-weight: 600; line-height: 1.6; overflow-wrap: anywhere; }
.target-values small { display: block; font-size: 12px; font-weight: 400; color: var(--muted); }
.target-state { color: inherit; }
.target-details { margin: 12px 0; overflow-wrap: anywhere; }
.target-editor:not(:empty) { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 20px; }
.target-form fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.energy-form h3 { font-size: 16px; line-height: 1.6; margin: 0 0 12px; }
.energy-scope { margin: 16px 0; line-height: 1.8; }
.energy-scope ul { padding-left: 20px; }
.energy-result:not(:empty) { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.energy-result a { display: inline-flex; gap: 5px; align-items: center; }
.energy-result a svg { width: 14px; height: 14px; }
.plan-intake { padding: 16px 0; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-wrap: anywhere; }
.plan-intake h4 { font-size: 14px; margin: 0; }
.plan-intake button:not(.icon-button) { max-width: 100%; white-space: normal; }
.plan-intake-reference { margin: 12px 0; overflow-wrap: anywhere; }
.plan-nutrition-panel:not(:empty) { padding: 16px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.plan-nutrition-panel h4 { font-size: 14px; margin: 0 0 12px; }
.plan-nutrition-rows { margin: 0; display: grid; gap: 8px; }
.plan-nutrition-rows>div { display: grid; grid-template-columns: 64px minmax(0,1fr); gap: 8px; font-size: 13px; }
.plan-nutrition-rows dd { margin: 0; }
.plan-nutrition-details { margin: 12px 0; overflow-wrap: anywhere; }
.plan-nutrient-item { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
@media (max-width: 560px) {
  .target-values { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .target-values > div { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: center; }
  .target-values strong { font-size: 20px; text-align: right; }
  .intake-targets .section-heading { flex-wrap: wrap; }
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 24px 0;
  margin-bottom: 32px;
}
.metric {
  padding: 0 22px;
  border-right: 1px solid var(--line);
  min-width: 0;
}
.metric:first-child {
  padding-left: 0;
}
.metric:last-child {
  border: 0;
}
.metric-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 13px;
}
.metric-label svg {
  width: 16px;
  height: 16px;
}
.metric-value {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 29px;
  font-weight: 650;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.metric-value small {
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
}
.metric-note {
  font-size: 11px;
  color: var(--muted);
  margin: 9px 0 0;
}
.metric:nth-child(2) .metric-label svg {
  color: var(--rose);
}
.metric:nth-child(3) .metric-label svg {
  color: var(--green);
}
.section {
  margin: 0 0 30px;
}
.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.section-heading h2 {
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-heading h2 svg {
  color: var(--muted);
  width: 18px;
}
.section-heading > div {
  display: flex;
  gap: 10px;
  align-items: center;
}
.count {
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
}
.empty {
  padding: 38px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  text-align: center;
  border-bottom: 1px solid var(--line);
}
.empty > svg {
  width: 30px;
  height: 30px;
  color: #a1b3a7;
}
.empty p {
  margin: 0;
}
.empty.large {
  padding: 70px 18px;
  border: 0;
  max-width: 620px;
  margin: auto;
}
.empty.large h2 {
  color: #455b4d;
}
.record {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 17px 0;
  border-bottom: 1px solid var(--line);
}
.record-marker {
  width: 37px;
  height: 37px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e9f1ed;
  border-radius: 6px;
  color: var(--green);
}
.record-marker.training {
  background: #f4eaf0;
  color: var(--rose);
}
.record-main {
  flex: 1;
  min-width: 0;
}
.record-name {
  font-weight: 600;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.record-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.record-value {
  text-align: right;
  min-width: 70px;
  font-size: 13px;
}
.record-actions {
  display: flex;
  gap: 2px;
}
.pill {
  display: inline-block;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  background: #edf2ef;
  color: #5d7664;
  vertical-align: middle;
  margin-left: 7px;
  font-weight: 400;
}
.pill.planned {
  background: #f3edf0;
  color: #936476;
}
.notice {
  padding: 12px 16px;
  border-left: 3px solid #7eaa91;
  background: #eef4f0;
  color: #526859;
  font-size: 13px;
  line-height: 1.7;
  margin-bottom: 24px;
}
.notice.error {
  border-color: #b75a66;
  background: #fbf0f2;
  color: #a03241;
}
.form-error {
  font-size: 12px;
  color: #b43848;
  margin: 0;
  line-height: 1.6;
}
.form-error:empty {
  display: none;
}
.profile-form {
  max-width: 720px;
}
.profile-section {
  padding: 0 0 28px;
  border-bottom: 1px solid var(--line);
}
.profile-section h2 {
  margin-bottom: 20px;
}
.form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}
details {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}
summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
}
details[open] summary {
  margin-bottom: 17px;
}
.assistant-state {
  border-bottom: 1px solid var(--line);
  padding-bottom: 15px;
  color: var(--muted);
  font-size: 12px;
  display: flex;
  gap: 7px;
  align-items: center;
}
.assistant-composer {
  display: flex;
  gap: 12px;
  margin-top: 30px;
  border-top: 1px solid var(--line);
  padding-top: 20px;
}
.assistant-composer input {
  background: #f0f3f1;
}
.meal-item-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 36px;
  margin-bottom: 12px;
}
.meal-item-heading h3 {
  margin: 0;
}
.meal-item {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.meal-item:first-child {
  padding-top: 0;
}
.meal-item-fields {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 14px;
}
.meal-item details {
  border-top: 0;
  padding-top: 14px;
}
.add-food {
  justify-self: start;
  color: var(--green);
}
.draft-item {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.draft-item:first-child {
  padding-top: 0;
}
.amount-label {
  margin-top: 12px;
}
.draft-toolbar,
.draft-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.draft-actions {
  justify-content: flex-end;
}
.draft-actions .danger {
  margin-right: auto;
}
.draft-review {
  flex-direction: row;
  align-items: center;
}
.draft-review input {
  width: 18px;
  min-height: 18px;
  height: 18px;
  accent-color: var(--green);
}
.draft-questions {
  border-left: 3px solid var(--rose);
  padding: 4px 0 4px 12px;
  color: #79495a;
  overflow-wrap: anywhere;
}
.draft-questions ul {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.7;
}
.draft-list .record-name {
  font-size: 13px;
  font-weight: 500;
}
.draft-state {
  margin: 0;
}
.speech-controls { margin: 12px 0; border-top: 1px solid #dbe3df; padding-top: 12px; }
.speech-consent { display: flex; flex-direction: row; align-items: flex-start; gap: 8px; font-size: 13px; }
.speech-consent input { width: 16px; height: 16px; min-height: 16px; flex: 0 0 16px; margin-top: 2px; }
.speech-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 8px; min-height: 38px; }
.speech-toolbar [role="status"] { flex: 1 1 100px; overflow-wrap: anywhere; }
.speech-result { margin-top: 12px; }
.speech-result textarea { min-height: 76px; }
dialog {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 26px;
  width: min(580px, calc(100% - 28px));
  max-height: 90dvh;
  overflow: auto;
  box-shadow: 0 18px 80px #20352b24;
  color: #26312d;
}
dialog::backdrop {
  background: #14261d55;
}
.dialog-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
  gap: 12px;
}
.dialog-heading h2 {
  font-size: 19px;
}
#confirm-dialog {
  max-width: 380px;
}
#confirm-name {
  margin: 16px 0 24px;
  overflow-wrap: anywhere;
  color: var(--muted);
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}
#toast {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  background: #203e30;
  color: white;
  padding: 12px 22px;
  max-width: calc(100% - 30px);
  border-radius: 6px;
  box-shadow: 0 6px 20px #0002;
  text-align: center;
}
#toast.error {
  background: #933849;
}
.loading {
  padding: 50px;
  text-align: center;
  color: var(--muted);
}
@media (min-width: 1500px) {
  main {
    padding-top: 44px;
  }
  .page-heading {
    margin-bottom: 38px;
  }
}
@media (max-width: 1000px) {
  main {
    padding: 28px 24px;
  }
  .layout {
    grid-template-columns: 170px minmax(0, 1fr);
  }
  .sidebar {
    padding: 22px 10px;
  }
  .metric {
    padding: 0 13px;
  }
  .metric-value {
    font-size: 25px;
  }
  .record {
    gap: 9px;
  }
  .topbar {
    padding: 0 22px;
  }
}
@media (max-width: 700px) {
  .topbar {
    height: 60px;
    padding: 0 18px;
  }
  .brand {
    font-size: 17px;
  }
  .brand > svg {
    width: 25px;
    height: 25px;
  }
  .account > span {
    max-width: 100px;
  }
  .layout {
    display: block;
    min-height: calc(100dvh - 60px);
  }
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 2;
    display: block;
    padding: 6px 8px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    background: #fcfdfc;
  }
  .sidebar nav {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 2px;
  }
  .nav-item {
    flex-direction: column;
    gap: 5px;
    min-height: 55px;
    padding: 7px 2px;
    font-size: 11px;
  }
  .nav-item svg {
    width: 18px;
    height: 18px;
  }
  main {
    padding: 25px 18px 44px;
  }
  .page-heading {
    gap: 12px;
    margin-bottom: 24px;
    align-items: flex-end;
  }
  h1 {
    font-size: 23px;
  }
  .date-control {
    padding: 0 8px;
    gap: 6px;
  }
  .date-control input {
    width: 117px;
    font-size: 12px;
  }
  .date-control svg {
    width: 15px;
  }
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 0;
    margin-bottom: 25px;
  }
  .metric {
    padding: 19px 12px !important;
    border-right: 1px solid var(--line);
  }
  .metric:nth-child(2) {
    border-right: 0;
  }
  .metric:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }
  .metric-label {
    margin-bottom: 10px;
  }
  .metric-value {
    font-size: 27px;
  }
  .section-heading h2 {
    font-size: 17px;
  }
  .section-heading button {
    font-size: 12px;
    padding: 7px 10px;
  }
  .record {
    flex-wrap: wrap;
    gap: 10px;
  }
  .record-marker {
    width: 32px;
    height: 32px;
  }
  .record-main {
    flex-basis: calc(100% - 46px);
  }
  .record-value {
    margin-left: 42px;
    text-align: left;
    flex: 1;
  }
  .record-actions {
    margin-left: auto;
  }
  .record .record-value:empty {
    display: none;
  }
  .form-grid {
    gap: 16px 12px;
  }
  .auth-panel {
    padding: 26px 22px;
  }
  .auth-screen {
    gap: 24px;
  }
  .empty.large {
    padding: 50px 8px;
  }
  dialog {
    padding: 22px 18px;
  }
  .dialog-heading {
    margin-bottom: 18px;
  }
  .metric-note {
    font-size: 10px;
  }
  .assistant-composer {
    gap: 7px;
  }
}
@media (max-width: 360px) {
  .page-heading {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }
  .page-heading h1 {
    white-space: nowrap;
  }
}
@media (prefers-reduced-motion: no-preference) {
  button {
    transition:
      background 0.15s,
      border-color 0.15s;
  }
  dialog[open] {
    animation: appear 0.15s ease-out;
  }
  @keyframes appear {
    from {
      opacity: 0.4;
      transform: translateY(6px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
}
.draft-nutrition {
  border-top: 1px solid var(--line, #dce1df);
  border-bottom: 1px solid var(--line, #dce1df);
  padding: 14px 0;
  margin: 12px 0;
}
.draft-nutrition h3 { margin: 0; font-size: 14px; }
.nutrition-result { padding: 12px 0; border-top: 1px solid #e1e5e3; }
.nutrition-values { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; margin: 10px 0; }
.nutrition-values div { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 13px; }
.nutrition-values span { color: #68736d; }
.nutrition-values strong { font-weight: 600; overflow-wrap: anywhere; }
.nutrition-assumptions { padding-left: 20px; margin: 8px 0; font-size: 13px; }
.nutrition-details { font-size: 13px; margin-top: 8px; overflow-wrap: anywhere; }
.nutrition-details summary { cursor: pointer; color: #3e6f5c; }
.nutrition-question { font-size: 13px; color: #815c19; }
.nutrition-result p, .nutrition-status { overflow-wrap: anywhere; }
.metric-value.range-value { font-size: 20px; flex-wrap: wrap; overflow-wrap: anywhere; }
.manual-nutrition { border-top: 1px solid #dce1df; padding-top: 10px; margin-top: 12px; }
.manual-nutrition .draft-toolbar { gap: 8px; flex-wrap: wrap; }
.manual-nutrition-status { overflow-wrap: anywhere; }
.workout-item { padding: 18px 0; border-bottom: 1px solid #dce1df; }
.workout-item .form-grid { margin-top: 12px; }
.workout-calories { font-size: 13px; overflow-wrap: anywhere; }
.workout-options { margin-top: 12px; font-size: 13px; }
.workout-options summary { cursor: pointer; color: #3e6f5c; }
#workout-form .dialog-actions { flex-wrap: wrap; }
#workout-form .dialog-actions button { min-width: 90px; }
.workout-item-status, .workout-state, .workout-questions { overflow-wrap: anywhere; }
#workout-form .draft-toolbar { flex-wrap: wrap; gap: 10px; }
.knowledge-view { max-width: 900px; min-width: 0; }
.knowledge-modes { margin:0 0 20px; }
.knowledge-ask-form label { display:grid; gap:8px; }
.knowledge-ask-form textarea { width:100%; min-height:100px; resize:vertical; }
.knowledge-ask-actions { display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.knowledge-ask-actions button { display:inline-flex; align-items:center; gap:7px; }
.knowledge-answer { margin-top:20px; }
.knowledge-answer-message { font-size:14px; line-height:1.8; overflow-wrap:anywhere; }
.knowledge-view .section-heading { flex-wrap: wrap; gap: 12px; }
#knowledge-search { display: flex; align-items: flex-end; gap: 10px; margin: 22px 0 14px; }
.knowledge-query { flex: 1; min-width: 0; }
#knowledge-search button { width: 42px; height: 42px; flex: 0 0 42px; }
.knowledge-topics { width: fit-content; max-width: 100%; }
.knowledge-topics button { min-width: 68px; }
.knowledge-state { min-height: 20px; margin-top: 16px; }
.knowledge-notice { color: #6a6756; border-bottom: 1px solid var(--line, #dce1df); padding-bottom: 16px; }
.knowledge-result { padding: 22px 0; border-bottom: 1px solid var(--line, #dce1df); overflow-wrap: anywhere; }
.knowledge-result-heading { display: flex; align-items: baseline; gap: 12px; }
.knowledge-result h3 { margin: 0; font-size: 16px; }
.knowledge-topic { color: #865b2c; font-size: 12px; flex-shrink: 0; }
.knowledge-excerpt { font-size: 14px; line-height: 1.8; margin: 10px 0; }
.knowledge-result details { font-size: 13px; margin-top: 12px; }
.knowledge-result summary { color: #3e6f5c; cursor: pointer; }
.knowledge-meta { display: grid; grid-template-columns: 80px minmax(0,1fr); gap: 8px 12px; }
.knowledge-meta dt { color: #68736d; }
.knowledge-meta dd { margin: 0; }
.knowledge-links { display: flex; gap: 20px; flex-wrap: wrap; }
.knowledge-links a { display: inline-flex; align-items: center; gap: 5px; color: #3e6f5c; }
.knowledge-links svg { width: 15px; height: 15px; }
.knowledge-attribution { color: #68736d; margin: 12px 0 0; }
.plan-form fieldset, .training-plan-form fieldset { border:0; padding:0; margin:0; min-width:0; }
.plan-profile { display:grid; grid-template-columns:70px minmax(0,1fr); gap:8px 12px; font-size:13px; margin:20px 0; }
.plan-profile dt { color:#68736d; }
.plan-profile dd { margin:0; overflow-wrap:anywhere; }
.plan-check { display:flex; flex-direction:row; align-items:flex-start; gap:8px; font-size:13px; line-height:1.7; margin:12px 0; }
.plan-check input { width:16px; height:16px; min-height:16px; flex:0 0 16px; margin-top:3px; padding:0; }
.plan-foods { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:0 12px; }
.plan-actions { display:flex; flex-wrap:wrap; gap:10px; }
.plan-meal-tabs { display:flex; gap:6px; margin:12px 0; }
.plan-meal-tabs button { display:flex; flex-direction:column; gap:3px; flex:1; min-width:0; min-height:56px; white-space:nowrap; font-size:13px; padding:8px; }
.plan-meal-tabs button[aria-pressed="true"] { background:#e1eee6; border-color:#34765a; color:#24523e; }
.plan-consent-saved { display:flex; align-items:center; gap:8px; margin:12px 0; }
.plan-exclusions, .plan-evidence { font-size:13px; margin:16px 0; }
.plan-evidence summary, .plan-exclusions summary { cursor:pointer; color:#3e6f5c; }
.plan-result { padding:24px 0; border-top:1px solid #dce1df; overflow-wrap:anywhere; }
.plan-result h3 { font-size:16px; margin:0; }
.plan-portions { list-style:none; padding:0; margin:16px 0; }
.plan-portions li { display:flex; justify-content:space-between; gap:12px; padding:12px 0; border-bottom:1px solid #e1e5e3; }
.plan-portions li div { display:grid; gap:5px; min-width:0; }
.plan-portions li b { flex-shrink:0; font-size:14px; }
.plan-stop, .training-stop { margin-top:12px; }
.plan-status, .plan-error, .training-status, .training-error { overflow-wrap:anywhere; }
.knowledge-modes { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); }
.knowledge-modes button { min-width:0; padding-left:8px; padding-right:8px; }
.training-plan-form .form-grid { align-items:end; }
@media (max-width:420px) {
  .knowledge-modes { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .training-plan-form .form-grid { grid-template-columns:minmax(0,1fr); }
}
/* Unified coach workflow; existing plan tools keep their established layout. */
.photo-actions,.plan-actions { display:flex; gap:8px; flex-wrap:wrap; margin:12px 0; }
.photo-preview { display:block; width:100%; max-height:260px; object-fit:contain; aspect-ratio:4/3; background:#f2f5f4; }
.photo-preview[hidden] { display:none; }
.plan-portion-edit { margin:16px 0; padding:12px 0; border-top:1px solid #dbe2df; }
.plan-portion-row { display:grid; grid-template-columns:minmax(0,1fr) 90px 90px; gap:8px; align-items:end; margin:10px 0; }
.plan-portion-row label { min-width:0; font-size:12px; }
.plan-portion-row input { width:100%; min-width:0; }
@media(max-width:400px){.plan-portion-row{grid-template-columns:minmax(0,1fr) 66px 66px;}}
.coach-view { max-width: 920px; margin: 0 auto; }
.coach-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) 170px auto; gap: 16px; align-items: end; padding-bottom: 18px; border-bottom: 1px solid #dbe2df; }
.coach-toolbar label { min-width: 0; }
.coach-history { width: 100%; text-overflow: ellipsis; }
.coach-tools { display: flex; gap: 4px; }
.coach-context { padding: 16px 0; border-bottom: 1px solid #dbe2df; }
.coach-context:empty { display: none; }
.coach-facts { padding-left: 20px; max-height: 230px; overflow: auto; font-size: 13px; overflow-wrap: anywhere; }
.coach-messages { min-height: 130px; padding: 12px 0; }
.coach-empty { color: #67766f; padding: 24px 0; }
.coach-turn { padding: 10px 0 20px; border-bottom: 1px solid #e3e7e5; overflow-wrap: anywhere; }
.coach-turn h3 { font-size: 13px; margin: 12px 0 6px; }
.coach-turn p { white-space: pre-wrap; margin: 0; line-height: 1.7; }
.coach-inline-plan { margin-top: 16px; }
.coach-inline-plan .plan-form .form-grid { grid-template-columns: minmax(0, 1fr); }
.coach-inline-plan .plan-profile { margin: 16px 0; }
.coach-meal-history details { margin-top: 12px; }
.coach-action { margin: 12px 0; }
.coach-review:not(:empty) { border-bottom:1px solid #dbe2df; padding:16px 0 22px; }
.coach-review h3 { font-size:15px; }
.coach-review p,.coach-review li { overflow-wrap:anywhere; line-height:1.7; }
.coach-review-notes { padding-left:22px; font-size:13px; }
.coach-review-notes > li { padding:8px 0; border-bottom:1px solid #e3e7e5; }
.coach-review-notes blockquote { margin:0 0 8px; white-space:pre-wrap; }
.coach-review-notes ul { padding-left:18px; }
.coach-review button { margin:8px 8px 0 0; }
.coach-privacy { line-height:1.7; margin:12px 0; }
.coach-quick { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 12px; }
.coach-quick button { font-size: 13px; text-align: left; white-space: normal; }
.coach-compose { display: grid; grid-template-columns: minmax(0, 1fr) 44px; align-items: end; gap: 10px; }
.coach-input { width: 100%; min-height: 78px; resize: vertical; }
.coach-compose button { width: 44px; height: 44px; }
.coach-compose .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.coach-plan:not(:empty) { border-top: 1px solid #dbe2df; padding-top: 22px; margin-top: 18px; }
@media (max-width: 560px) {
  .coach-toolbar { grid-template-columns: minmax(0, 1fr) 136px; gap: 12px; }
  .coach-toolbar label:first-child { grid-column: 1 / -1; }
  .coach-tools { justify-content: flex-end; }
}
/* Chat meal suggestions are unframed replies, not editable plan panels. */
.quick-meal { padding: 12px 0; border-bottom: 1px solid #dde2df; }
.quick-meal h4 { margin: 0 0 10px; font-size: 16px; }
.quick-foods { list-style: none; padding: 0; margin: 0; }
.quick-foods li { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 2px 12px; padding: 6px 0; }
.quick-foods small { grid-column: 1 / -1; color: #626c65; overflow-wrap: anywhere; }
.quick-macros, .quick-total { line-height: 1.8; overflow-wrap: anywhere; }
.quick-reference { display: grid; grid-template-columns: repeat(auto-fit,minmax(160px,1fr)); gap: 12px; }
.quick-reference dt { font-weight: 600; }
.quick-reference dd { margin: 4px 0 0; font-size: 13px; line-height: 1.7; }
.quick-sources { padding: 10px 0; overflow-wrap: anywhere; }
.quick-consent { padding: 12px 0; }
.coach-consent { border-bottom: 1px solid var(--line); }
.coach-consent:empty { display: none; }
.quick-consent .plan-check { align-items: flex-start; }
.section-commands, .week-nav { display:flex; gap:8px; flex-wrap:wrap; }
.nutrition-standard, .intake-targets { min-width:0; }
.nutrition-standard { margin-top:32px; }
.nutrition-standard > .section-heading, .intake-targets > .section-heading { flex-wrap:wrap; gap:12px; }
.nutrition-editor:not(:empty) { border-top:1px solid #dde2df; padding-top:18px; margin-top:18px; }
.nutrition-editor fieldset { border:0; margin:0; padding:0; min-width:0; }
.nutrition-editor label { display:grid; gap:7px; font-size:14px; margin:12px 0; min-width:0; }
.nutrition-editor .plan-check { display:flex; align-items:flex-start; }
.nutrition-editor .dialog-actions { flex-wrap:wrap; }
.nutrition-editor input, .nutrition-editor select { width:100%; min-width:0; }
.nutrition-editor input[type="checkbox"] { width:17px; flex:0 0 17px; }
.nutrition-editor h3 { font-size:17px; }
.nutrition-preview { margin-top:16px; }
.nutrition-current p, .nutrition-editor p { line-height:1.7; overflow-wrap:anywhere; }
.nutrition-comparison { margin:18px 0; }
.body-toolbar, .body-commands, .body-row-actions { display:flex; align-items:center; gap:8px; }
@media(max-width:360px) {
  .sidebar nav { grid-template-columns:repeat(3,minmax(0,1fr)); }
  .sidebar .nav-item { flex-direction:row; min-height:40px; }
}
.body-toolbar { justify-content:space-between; flex-wrap:wrap; }
.body-toolbar .segmented button { flex:none; min-width:78px; white-space:nowrap; }
.body-commands { margin-left:auto; }
.body-metrics { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:20px; margin:20px 0; }
.body-metrics h3 { font-size:14px; font-weight:500; color:var(--muted); margin:0; }
.body-value { font-size:28px; font-weight:650; margin:8px 0; }
.body-value small, .body-recap-grid small { font-size:12px; font-weight:400; margin-left:6px; }
.body-metric-tabs { width:fit-content; margin-top:20px; }
.body-metric-tabs button { flex:none; min-width:72px; white-space:nowrap; }
.body-chart { width:100%; height:240px; margin-top:12px; }
.body-chart canvas { display:block; width:100%; height:240px; }
.body-recap-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:20px; margin:20px 0; }
.body-recap-grid dt { font-size:13px; color:var(--muted); }
.body-recap-grid dd { margin:8px 0; font-size:22px; }
.body-recap-grid small { display:block; margin:4px 0; }
.body-form { margin-top:20px; border-top:1px solid var(--line); padding-top:20px; }
.body-form h2 { margin:0 0 18px; font-size:18px; }
.body-form fieldset { border:0; margin:0; padding:0; min-width:0; }
.body-table table { width:100%; border-collapse:collapse; table-layout:fixed; font-size:13px; }
.body-table th, .body-table td { padding:12px 6px; text-align:left; border-bottom:1px solid var(--line); vertical-align:top; }
.body-table th:first-child { width:36%; }
.body-table th:last-child { width:84px; }
.body-table thead small { display:block; font-weight:400; color:var(--muted); }
.body-table tbody th { font-weight:500; }
.body-row-actions { gap:2px; }
.body-row-actions .icon-button { width:34px; height:34px; min-width:34px; padding:7px; }
.body-note { display:block; color:var(--muted); font-size:12px; font-weight:400; overflow-wrap:anywhere; margin-top:5px; }
@media(max-width:560px) {
  .body-recap-grid { gap:10px; }
  .body-metrics { gap:12px; }
  .body-table th, .body-table td { padding:10px 2px; font-size:12px; }
  .body-table th:first-child { width:35%; }
  .body-table th:last-child { width:70px; }
  .body-row-actions .icon-button { width:32px; height:36px; min-width:32px; padding:7px; }
}
.nutrition-comparison table { width:100%; border-collapse:collapse; table-layout:fixed; font-size:13px; }
.nutrition-comparison caption { text-align:left; font-weight:600; padding:0 0 10px; }
.nutrition-comparison th, .nutrition-comparison td { text-align:left; vertical-align:top; padding:10px 8px; border-bottom:1px solid #dde2df; overflow-wrap:anywhere; }
.nutrition-comparison th:first-child { width:15%; }
.coach-calculation { margin:14px 0; }
.coach-calculation button { margin:4px 4px 4px 0; white-space:normal; }
@media(max-width:560px) {
  .nutrition-comparison th, .nutrition-comparison td { padding:8px 4px; font-size:12px; }
  .nutrition-comparison th:first-child { width:18%; }
  .nutrition-current .form-actions { flex-wrap:wrap; }
}
.record-section > .section-heading { flex-wrap:wrap; }
.record-section > .section-heading h2 { white-space:nowrap; }
.training-week-heading { gap:12px; flex-wrap:wrap; }
.training-week-heading > div:first-child { display:block; }
.week-range { margin:8px 0 0; }
.training-week-grid { display:grid; grid-template-columns:repeat(7,minmax(0,1fr)); gap:8px; }
.week-day { display:grid; grid-template-rows:18px 28px minmax(20px,auto) minmax(20px,auto); gap:6px; padding:12px 6px; text-align:center; min-width:0; align-content:start; justify-content:stretch; overflow-wrap:anywhere; }
.week-day[aria-pressed="true"] { border-color:var(--green); box-shadow:inset 0 0 0 1px var(--green); background:#edf7f2; }
.week-day[aria-current="date"] strong { color:var(--green); text-decoration:underline; text-underline-offset:5px; }
.week-weekday, .week-day-state { font-size:12px; }
.week-weekday, .week-empty { color:#65736c; }
.week-day strong { font-size:19px; line-height:28px; }
.week-completed { color:#18765c; }
.week-planned { color:#90522a; }
.week-day-count { display:none; }
.training-week-totals { display:flex; gap:16px 28px; flex-wrap:wrap; margin:18px 0 10px; }
.training-week-totals dt { font-size:12px; color:#65736c; }
.training-week-totals dd { margin:5px 0 0; font-weight:600; }
.week-energy { margin-bottom:0; overflow-wrap:anywhere; }
.training-recommendation { margin:16px 0; border-top:1px solid var(--line); padding-top:14px; overflow-wrap:anywhere; }
.training-recommendation h3 { font-size:17px; }
.training-recommendation h4 { font-size:14px; margin:18px 0 8px; }
.training-exercises, .training-aerobic { padding-left:22px; }
.training-exercises li, .training-aerobic li { margin:12px 0; }
.training-exercises li > span { display:block; margin-top:5px; }
.training-recommendation li p { margin:5px 0; }
.training-sources { margin-top:14px; font-size:13px; }
.training-stale { color:#90522a; }
.meal-week .week-day-state { white-space:nowrap; font-size:11px; }
@media(max-width:700px) {
  .training-week-grid { gap:4px; }
  .week-day { padding:9px 2px; grid-template-rows:18px 28px 18px 18px; gap:4px; }
  .week-day-volume { display:none; }
  .week-day-count { display:inline; }
  .week-nav { gap:2px; }
}
/* Training suggestions remain part of the conversation, separate from records. */
.training-program { border-top: 1px solid #d7dce2; margin-top: 16px; padding-top: 12px; }
.training-program summary { cursor: pointer; line-height: 1.6; overflow-wrap: anywhere; }
.training-recommendation select { max-width: 100%; width: 100%; min-width: 0; }
.training-alternative, .training-split { display: grid; gap: 4px; max-width: 320px; font-size: 13px; margin-top: 8px; }
.program-days { list-style: none; padding: 0; }
.program-days > li { padding: 10px 0; border-bottom: 1px solid #e1e5e9; }
.program-volume { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; margin: 12px 0; }
.program-volume dd { margin: 4px 0 0; font-size: 13px; }
.training-gap { color: #78521b; }
.program-progression { margin: 14px 0; }
.program-progression ol { padding-left: 22px; }
.training-recommendation { overflow-wrap: anywhere; min-width: 0; }
.performance-fields { border: 0; padding: 8px 0; margin: 0; min-width: 0; }
.performance-fields[hidden] { display: none; }
.performance-fields > label { display: grid; gap: 6px; margin-bottom: 12px; }
.performance-fields > .check-label { display: flex; flex-direction: row; align-items: center; gap: 8px; margin-top: 12px; }
.performance .check-label input { width: 16px; height: 16px; min-height: 16px; flex: 0 0 16px; padding: 0; }
.performance-set { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)) 32px; gap: 6px; align-items: end; margin-bottom: 10px; }
.performance-set label { min-width: 0; font-size: 12px; }
.performance-set input { width: 100%; min-width: 0; padding: 7px 5px; }
.performance-set .icon-button { width: 32px; height: 36px; }
.performance select, .performance input { max-width: 100%; }
.performance-error { color: #a32929; font-size: 13px; }
.load-guidance { border-left: 2px solid #18765c; padding-left: 10px; margin: 10px 0; }
.load-guidance p { margin: 6px 0; }
@media (max-width: 480px) { .program-volume { grid-template-columns: repeat(2,minmax(0,1fr)); } }
