:root {
  --blue: #526f78;
  --blue-soft: #e7f0f1;
  --purple: #655c78;
  --purple-soft: #ece8f2;
}

.dialog-note {
  margin: 18px 0 0;
  padding: 13px 15px;
  color: var(--muted);
  background: var(--surface-soft);
  border-radius: 12px;
  font-size: 12px;
}

.field > span em {
  margin-left: 4px;
  color: var(--muted);
  font-size: .9em;
  font-style: normal;
  font-weight: 400;
}

.client-note-panel {
  margin-bottom: 16px;
  padding: 16px;
}

.client-note-panel header {
  margin-bottom: 10px;
}

.client-note-panel header strong,
.client-note-panel header small {
  display: block;
}

.client-note-panel header strong {
  font-size: 12px;
}

.client-note-panel header small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.client-note-panel textarea {
  width: 100%;
  min-height: 58px;
  padding: 11px 12px;
  color: var(--text);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: 0;
  resize: vertical;
  font: inherit;
  font-size: 11.5px;
}

.client-note-panel textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(47, 107, 79, .08);
}

.client-note-panel footer {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
}

.client-card-v2 {
  min-height: 218px;
}

.client-card-metrics {
  margin: 20px 0 17px;
  padding: 14px 0;
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 18px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.client-note-preview {
  max-width: 380px;
  margin-top: 6px;
  display: -webkit-box;
  overflow: hidden;
  color: var(--text);
  font-size: 10px;
  font-weight: 500;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.client-card-metrics div {
  min-width: 0;
}

.client-card-metrics span,
.client-card-metrics strong {
  display: block;
}

.client-card-metrics span {
  color: var(--muted);
  font-size: 10.5px;
}

.client-card-metrics strong {
  margin-top: 4px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 13px;
}

.profile-head-v2 {
  box-shadow: none;
  border: 1px solid var(--line);
}

.share-status {
  margin-top: 12px;
  padding: 12px 15px;
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  color: var(--amber);
  background: var(--amber-soft);
  border-radius: 13px;
}

.share-status.is-live {
  color: var(--forest);
  background: var(--green-soft);
}

.share-status-dot {
  width: 8px;
  height: 8px;
  background: currentColor;
  border-radius: 50%;
}

.share-status strong,
.share-status small {
  display: block;
}

.share-status strong {
  font-size: 11.5px;
}

.share-status small {
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted);
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 10px;
}

.share-status em {
  padding: 5px 8px;
  color: var(--amber);
  background: var(--surface);
  border-radius: 999px;
  font-size: 9.5px;
  font-style: normal;
  font-weight: 600;
}

.client-tabs {
  margin-top: 18px;
}

.client-empty {
  min-height: 470px;
  padding: 68px 28px;
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
}

.client-empty h2,
.client-empty p {
  margin: 0;
}

.client-empty h2 {
  font-family: 'Prata', Georgia, serif;
  font-size: 28px;
  font-weight: 400;
}

.client-empty p {
  max-width: 590px;
  margin: 10px auto 21px;
  color: var(--muted);
}

.empty-mode-visual {
  position: relative;
  width: 74px;
  height: 74px;
  margin-bottom: 20px;
  display: grid;
  place-items: center;
  color: var(--green);
  background: var(--green-soft);
  border-radius: 23px;
}

.empty-mode-visual::after {
  content: '+';
  position: absolute;
  right: -5px;
  bottom: -5px;
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--green);
  border: 3px solid var(--surface);
  border-radius: 50%;
  font-size: 15px;
}

.empty-mode-visual svg {
  width: 34px;
  height: 34px;
}

.compact-empty {
  min-height: 360px;
}

.empty-journey {
  width: min(100%, 520px);
  margin-top: 30px;
  display: grid;
  grid-template-columns: 1fr 36px 1fr 36px 1fr;
  align-items: start;
}

.empty-journey > span {
  display: grid;
  justify-items: center;
  gap: 7px;
}

.empty-journey b {
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  color: var(--green);
  background: var(--green-soft);
  border-radius: 50%;
  font-size: 10px;
}

.empty-journey small {
  color: var(--muted);
  font-size: 9.5px;
}

.empty-journey i {
  height: 1px;
  margin-top: 13px;
  background: var(--line);
}

.setup-overview {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
}

.setup-main {
  padding: 25px 27px;
  box-shadow: none;
  border: 1px solid var(--line);
}

.compact-head {
  margin: 0 0 23px;
}

.compact-head h2 {
  font-size: 20px;
}

.setup-percent {
  color: var(--green);
  font-family: 'Prata', Georgia, serif;
  font-size: 28px;
  font-weight: 400;
}

.setup-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.setup-step {
  min-width: 0;
  padding: 15px 13px;
  background: var(--surface-soft);
  border: 1px solid transparent;
  border-radius: 13px;
}

.setup-step > span {
  width: 23px;
  height: 23px;
  margin-bottom: 10px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: var(--line);
  border-radius: 50%;
}

.setup-step.is-done {
  border-color: rgba(47, 107, 79, .12);
}

.setup-step.is-done > span {
  color: #fff;
  background: var(--green);
}

.setup-step svg {
  width: 13px;
  height: 13px;
}

.setup-step strong,
.setup-step small {
  display: block;
}

.setup-step strong {
  font-size: 11.5px;
}

.setup-step small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.45;
}

.setup-actions {
  margin-top: 23px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.client-rules-summary {
  padding: 20px 22px;
  box-shadow: none;
  border: 1px solid var(--line);
}

.client-rules-summary header {
  margin-bottom: 12px;
}

.client-rules-summary header span,
.client-rules-summary header small {
  display: block;
}

.client-rules-summary header small,
.client-rules-summary p {
  margin: 0;
  color: var(--muted);
  font-size: 10.5px;
}

.client-rules-summary header small {
  margin-top: 3px;
}

.client-rules-summary dl {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.client-rules-summary dl div {
  padding: 11px 12px;
  background: var(--surface-soft);
  border-radius: 10px;
}

.client-rules-summary dt {
  color: var(--muted);
  font-size: 9.5px;
}

.client-rules-summary dd {
  margin: 3px 0 0;
  font-size: 11px;
  font-weight: 600;
}

.content-head {
  margin-bottom: 20px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}

.content-head h2,
.content-head p {
  margin: 0;
}

.content-head h2 {
  font-size: 22px;
}

.content-head p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.content-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.mode-card {
  min-width: 0;
  padding: 19px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 17px;
}

.mode-card.is-ready {
  border-color: rgba(47, 107, 79, .2);
}

.mode-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.mode-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  color: var(--green);
  background: var(--green-soft);
  border-radius: 12px;
}

.mode-icon svg {
  width: 20px;
  height: 20px;
}

.mode-parent {
  margin-top: 17px;
  color: var(--muted);
  font-size: 9.5px;
}

.mode-card h3 {
  margin: 4px 0 0;
  font-size: 16px;
}

.mode-macros {
  margin-top: 16px;
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
  background: var(--surface-soft);
  border-radius: 11px;
}

.mode-macros span {
  color: var(--muted);
  font-size: 8.5px;
}

.mode-macros strong {
  display: block;
  color: var(--text);
  font-size: 11.5px;
}

.mode-card-actions {
  margin-top: 17px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.mode-card-actions .button {
  min-height: 37px;
  padding-inline: 11px;
  font-size: 10.5px;
}

.mode-depth-note {
  margin-left: auto;
  color: var(--muted);
  font-size: 9px;
}

.mode-editor-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.mode-editor-head h1,
.mode-editor-head p {
  margin: 0;
}

.mode-editor-head h1 {
  font-family: 'Prata', Georgia, serif;
  font-size: clamp(30px, 4vw, 42px);
  font-weight: 400;
}

.mode-editor-head p {
  max-width: 650px;
  margin-top: 8px;
  color: var(--muted);
}

.mode-tabs {
  margin: 25px 0 12px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.mode-tabs button {
  min-width: 0;
  min-height: 61px;
  padding: 9px 10px;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  text-align: left;
  background: rgba(255, 255, 255, .48);
  border: 1px solid transparent;
  border-radius: 13px;
  cursor: pointer;
}

.mode-tabs button > span {
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 9px;
}

.mode-tabs button div {
  min-width: 0;
}

.mode-tabs button strong,
.mode-tabs button small {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.mode-tabs button strong {
  font-size: 10.5px;
}

.mode-tabs button small {
  margin-top: 2px;
  font-size: 8.5px;
}

.mode-tabs button.is-active {
  color: var(--forest);
  background: var(--surface);
  border-color: var(--line);
  box-shadow: var(--shadow-small);
}

.mode-tabs button.is-active > span {
  color: #fff;
  background: var(--green);
  border-color: var(--green);
}

.editor-guide {
  margin: -4px 0 14px;
  padding: 11px 14px;
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--blue);
  background: var(--blue-soft);
  border-radius: 12px;
}

.editor-guide > span {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: rgba(255,255,255,.65);
  border-radius: 9px;
}

.editor-guide svg {
  width: 16px;
}

.editor-guide strong,
.editor-guide p {
  margin: 0;
}

.editor-guide strong {
  font-size: 10.5px;
}

.editor-guide p {
  margin-top: 2px;
  font-size: 9.5px;
}

.mode-editor-panel {
  min-height: 560px;
  padding: 29px 31px 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.form-page-head {
  max-width: 720px;
  margin-bottom: 25px;
}

.form-page-head h2,
.form-page-head p {
  margin: 0;
}

.form-page-head h2 {
  font-size: 22px;
}

.form-page-head p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.roomy-grid {
  gap: 22px 24px;
}

.safety-callout {
  margin-bottom: 23px;
  padding: 13px 15px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--blue);
  background: var(--blue-soft);
  border-radius: 12px;
  font-size: 11px;
}

.safety-callout svg {
  width: 20px;
  flex: 0 0 auto;
}

.tag-field {
  min-width: 0;
  padding: 0 0 19px;
  border-bottom: 1px solid var(--line);
}

.safety-compact-grid .tag-field {
  min-height: 0;
  grid-column: 1 / -1;
}

.safety-compact-grid .tag-field:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.tag-field .field > small {
  margin-top: 6px;
  color: var(--muted);
  font-size: 9px;
}

.preset-caption {
  align-self: center;
  margin-right: 3px;
  color: var(--muted);
  font-size: 8.5px;
}

.tag-field .field textarea {
  min-height: 118px;
  background: var(--surface-soft);
  border-color: var(--line);
}

.tag-preview {
  min-height: 22px;
  margin-top: 9px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.tag-preview span {
  padding: 4px 7px;
  color: var(--forest);
  background: var(--green-soft);
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 600;
}

.tag-preview em {
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
}

.macro-editor {
  margin-top: 24px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.check-card {
  position: relative;
  padding: 13px 14px;
  display: flex;
  align-items: center;
  gap: 11px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 13px;
  cursor: pointer;
}

.check-card input {
  position: absolute;
  opacity: 0;
}

.check-card > span {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
}

.check-card input:checked + span {
  background: var(--green);
  border-color: var(--green);
}

.check-card input:checked + span::after {
  content: '';
  width: 8px;
  height: 4px;
  border-bottom: 2px solid #fff;
  border-left: 2px solid #fff;
  transform: translateY(-1px) rotate(-45deg);
}

.check-card strong,
.check-card small {
  display: block;
}

.check-card strong {
  font-size: 11px;
}

.check-card small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.macro-switch {
  margin-top: 23px;
}

.macro-workspace {
  transition: opacity .18s ease;
}

.macro-workspace.is-disabled {
  opacity: .38;
  pointer-events: none;
  user-select: none;
}

.macro-consistency {
  margin-top: 11px;
  padding: 12px 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: var(--amber-soft);
  border-radius: 12px;
}

.macro-consistency.is-balanced {
  background: var(--green-soft);
}

.macro-consistency > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.macro-consistency > div > span {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: var(--amber);
  background: var(--surface);
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
}

.macro-consistency.is-balanced > div > span {
  color: var(--green);
}

.macro-consistency p,
.macro-consistency strong,
.macro-consistency small {
  margin: 0;
  display: block;
}

.macro-consistency strong {
  font-size: 10.5px;
}

.macro-consistency small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.macro-consistency .button {
  flex: 0 0 auto;
}

.macro-editor > label {
  padding: 13px;
  background: var(--green-soft);
  border-radius: 13px;
}

.macro-editor > label > span {
  display: block;
  color: var(--green-dark);
  font-size: 10px;
  font-weight: 600;
}

.macro-editor > label > small {
  display: block;
  margin-top: -3px;
  color: var(--muted);
  font-size: 8.5px;
}

.macro-editor > label > div,
.distribution-grid label > div {
  position: relative;
}

.macro-editor input {
  width: 100%;
  height: 42px;
  padding: 0 35px 0 0;
  color: var(--forest);
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 19px;
  font-weight: 700;
}

.macro-editor b,
.distribution-grid b {
  position: absolute;
  right: 0;
  bottom: 12px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 500;
}

.distribution-section {
  margin-top: 25px;
  padding-top: 23px;
  border-top: 1px solid var(--line);
}

.distribution-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.distribution-wallet {
  --wallet-1: #4d8a69;
  --wallet-2: #b58a46;
  --wallet-3: #9a7094;
  --wallet-4: #6384a5;
  --wallet-5: #b66f68;
  margin-top: 17px;
}

.wallet-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.wallet-tab {
  min-width: 0;
  padding: 11px 10px 9px;
  display: grid;
  gap: 2px;
  color: var(--text);
  background: var(--surface-soft);
  border: 1px solid transparent;
  border-radius: 11px;
  text-align: left;
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease, transform .16s ease;
}

.wallet-tab:hover { transform: translateY(-1px); }

.wallet-tab.is-active {
  background: var(--green-soft);
  border-color: rgba(61, 124, 88, .22);
}

.wallet-tab strong,
.wallet-tab span,
.wallet-tab i { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wallet-tab strong { font-size: 11px; }
.wallet-tab span { color: var(--muted); font-size: 9px; }
.wallet-tab i { color: var(--muted); font-size: 8px; font-style: normal; }
.wallet-tab i.is-complete { color: var(--green); }
.wallet-tab i.is-over { color: var(--red); }

.wallet-budget {
  margin-top: 9px;
  padding: 15px;
  background: var(--surface-soft);
  border-radius: 13px;
}

.wallet-budget-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}

.wallet-budget-head > div { display: grid; gap: 3px; }
.wallet-budget-head span { color: var(--muted); font-size: 9px; }
.wallet-budget-head strong { color: var(--forest); font-size: 14px; }
.wallet-reserve { text-align: right; }
.wallet-reserve strong.is-complete { color: var(--muted); }
.wallet-reserve strong.is-over { color: var(--red); }

.wallet-strip {
  height: 13px;
  margin-top: 13px;
  display: flex;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.wallet-strip > i { min-width: 0; }
.wallet-strip-part.tone-1 { background: var(--wallet-1); }
.wallet-strip-part.tone-2 { background: var(--wallet-2); }
.wallet-strip-part.tone-3 { background: var(--wallet-3); }
.wallet-strip-part.tone-4 { background: var(--wallet-4); }
.wallet-strip-part.tone-5 { background: var(--wallet-5); }
.wallet-strip-free { background: repeating-linear-gradient(135deg, transparent 0 5px, rgba(45,77,57,.05) 5px 10px); }

.wallet-legend {
  margin-top: 7px;
  display: flex;
  gap: 14px;
  color: var(--muted);
  font-size: 8px;
}

.wallet-legend span { display: inline-flex; align-items: center; gap: 5px; }
.wallet-legend i { width: 7px; height: 7px; background: var(--green); border-radius: 50%; }
.wallet-legend span:last-child i { background: var(--surface); border: 1px solid var(--line); }

.wallet-actions {
  margin: 10px 0;
  display: flex;
  gap: 7px;
}

.wallet-actions .button { min-height: 35px; }

.wallet-meals { display: grid; gap: 7px; }

.wallet-meal {
  --meal-tone: var(--wallet-1);
  padding: 12px 13px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 11px;
}

.wallet-meal.tone-2 { --meal-tone: var(--wallet-2); }
.wallet-meal.tone-3 { --meal-tone: var(--wallet-3); }
.wallet-meal.tone-4 { --meal-tone: var(--wallet-4); }
.wallet-meal.tone-5 { --meal-tone: var(--wallet-5); }
.wallet-meal header { min-width: 0; }
.wallet-meal header > div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.wallet-meal header strong { font-size: 11px; }
.wallet-meal header span { color: var(--muted); font-size: 9px; white-space: nowrap; }

.wallet-meal-bar {
  height: 6px;
  margin-top: 8px;
  display: block;
  overflow: hidden;
  background: var(--surface-soft);
  border-radius: 999px;
}

.wallet-meal-bar b { height: 100%; display: block; background: var(--meal-tone); border-radius: inherit; transition: width .16s ease; }

.wallet-stepper {
  display: grid;
  grid-template-columns: 33px 48px 33px;
  align-items: center;
  gap: 4px;
}

.wallet-stepper button {
  width: 33px;
  height: 33px;
  display: grid;
  place-items: center;
  color: var(--forest);
  background: var(--surface-soft);
  border: 0;
  border-radius: 9px;
  font-size: 17px;
  cursor: pointer;
}

.wallet-stepper button:disabled { opacity: .35; cursor: default; }
.wallet-stepper strong { color: var(--meal-tone); text-align: center; font-size: 14px; font-variant-numeric: tabular-nums; }
.wallet-caption { margin-top: 9px; color: var(--muted); font-size: 8.5px; }

.diet-system-section {
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.protocol-heading h3,
.protocol-heading p {
  margin: 0;
}

.protocol-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.protocol-heading h3 {
  font-size: 15px;
}

.protocol-heading p {
  max-width: 720px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.protocol-heading .button {
  min-height: 0;
  padding: 4px 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  box-shadow: none;
  font-size: 11px;
  white-space: nowrap;
}

.protocol-heading + .field {
  margin-top: 14px;
}

.diet-system-section textarea,
.comment-fields textarea {
  min-height: 112px;
}

.diet-system-section textarea {
  min-height: 132px;
}

.diet-system-section .field > span,
.diet-system-section textarea {
  font-size: 11.5px;
}

.protocol-dialog {
  width: min(620px, calc(100% - 30px));
  padding: 27px;
}

.protocol-dialog-intro {
  margin: 0 0 18px;
  padding: 12px 14px;
  color: var(--muted);
  background: var(--surface-soft);
  border-radius: 11px;
  font-size: 11px;
  line-height: 1.5;
}

.protocol-dialog-section {
  padding: 17px 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
  border-top: 1px solid var(--line);
}

.protocol-dialog-section > div {
  grid-column: 1 / -1;
}

.protocol-dialog-section strong,
.protocol-dialog-section small {
  display: block;
}

.protocol-dialog-section strong {
  font-size: 12px;
}

.protocol-dialog-section small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.diet-system-section > small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 9px;
}

.system-presets {
  margin-top: 9px;
}

.system-presets > span {
  margin-right: 3px;
  color: var(--muted);
  font-size: 9px;
}

.distribution-section h3,
.distribution-section p {
  margin: 0;
}

.distribution-section h3 {
  font-size: 15px;
}

.distribution-section p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10.5px;
}

.distribution-grid {
  margin-top: 15px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.distribution-grid label {
  padding: 11px 12px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 11px;
}

.distribution-grid label > span {
  display: block;
  font-size: 9.5px;
}

.distribution-grid input {
  width: 100%;
  height: 36px;
  padding-right: 20px;
  color: var(--text);
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 15px;
  font-weight: 700;
}

.distribution-grid b {
  bottom: 10px;
}

.rules-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 13px;
}

.rule-field {
  min-width: 0;
  padding: 16px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.rule-field > div:first-child {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rule-field h3 {
  margin: 0;
  font-size: 11.5px;
}

.rule-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  background: var(--muted);
  border-radius: 50%;
}

.rule-danger .rule-dot {
  background: var(--red);
}

.rule-attention .rule-dot {
  background: var(--amber);
}

.rule-positive .rule-dot {
  background: var(--green);
}

.rule-required .rule-dot {
  background: var(--purple);
}

.rule-field textarea {
  width: 100%;
  min-height: 112px;
  margin-top: 11px;
  padding: 11px 12px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: 0;
  resize: vertical;
  font-size: 11.5px;
}

.rule-field > small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 9px;
}

.rule-field textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(47, 107, 79, .08);
}

.comment-fields {
  display: grid;
  gap: 17px;
}

.comment-fields .field > small {
  margin-top: 6px;
  color: var(--muted);
  font-size: 9px;
}

.muted-recommendation {
  padding: 15px;
  background: var(--surface-soft);
  border-radius: 13px;
}

.custom-system-label {
  grid-column: 1 / -1;
}

.toggle-group {
  display: grid;
  gap: 8px;
}

.toggle {
  position: relative;
  min-height: 54px;
  padding: 9px 11px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
}

.toggle input {
  position: absolute;
  opacity: 0;
}

.toggle > span {
  position: relative;
  width: 34px;
  height: 20px;
  flex: 0 0 auto;
  background: var(--line);
  border-radius: 99px;
}

.toggle > span::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 50%;
  transition: .18s ease;
}

.toggle input:checked + span {
  background: var(--green);
}

.toggle input:checked + span::after {
  transform: translateX(14px);
}

.toggle strong,
.toggle small {
  display: block;
}

.toggle strong {
  font-size: 10.5px;
}

.toggle small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 8.5px;
}

.slider-list {
  margin-top: 25px;
  padding-top: 22px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 28px;
  border-top: 1px solid var(--line);
}

.style-slider > div,
.style-slider > span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.style-slider strong {
  font-size: 11.5px;
}

.style-slider output {
  color: var(--green);
  font-size: 10px;
  font-weight: 600;
}

.style-slider input {
  width: 100%;
  margin: 11px 0 6px;
  accent-color: var(--green);
}

.style-slider small {
  color: var(--muted);
  font-size: 8.5px;
}

.mode-editor-footer {
  position: sticky;
  bottom: 0;
  margin: 28px -31px 0;
  padding: 16px 31px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  background: rgba(255, 255, 255, .95);
  border-top: 1px solid var(--line);
  border-radius: 0 0 18px 18px;
  backdrop-filter: blur(10px);
}

.mode-editor-footer > span {
  color: var(--muted);
  font-size: 10.5px;
}

.mode-editor-footer > div {
  display: flex;
  gap: 7px;
}

.mode-preview {
  padding-bottom: 5px;
}

.preview-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.preview-summary div {
  padding: 13px;
  background: var(--surface-soft);
  border-radius: 11px;
}

.preview-summary span,
.preview-summary strong {
  display: block;
}

.preview-summary span {
  color: var(--muted);
  font-size: 9px;
}

.preview-summary strong {
  margin-top: 4px;
  font-size: 11px;
}

.preview-safety {
  margin-top: 11px;
  padding: 12px 14px;
  color: var(--blue);
  background: var(--blue-soft);
  border-radius: 11px;
}

.preview-safety strong,
.preview-safety span {
  display: block;
}

.review-banner {
  margin-top: 12px;
  padding: 13px 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--forest);
  background: var(--green-soft);
  border-radius: 12px;
}

.review-banner.has-warnings {
  color: #7c5a1c;
  background: var(--amber-soft);
}

.review-banner > span {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: rgba(255,255,255,.7);
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
}

.review-banner strong,
.review-banner p {
  margin: 0;
}

.review-banner strong {
  font-size: 10.5px;
}

.review-banner p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9.5px;
}

.rule-review-grid {
  margin-top: 15px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.rule-review {
  min-width: 0;
  padding: 12px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 11px;
}

.rule-review.needs-confirmation {
  background: var(--blue-soft);
  border-color: transparent;
}

.rule-review span,
.rule-review strong,
.rule-review small {
  display: block;
}

.rule-review span {
  color: var(--muted);
  font-size: 8.5px;
}

.rule-review strong {
  margin-top: 5px;
  font-size: 10.5px;
  line-height: 1.35;
}

.rule-review small {
  margin-top: 5px;
  color: var(--green);
  font-size: 8.5px;
}

.rule-review.needs-confirmation small {
  color: var(--blue);
}

.protocol-review {
  margin-top: 12px;
  padding: 3px 14px;
  background: var(--surface-soft);
  border-radius: 11px;
}

.protocol-review > div {
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.protocol-review > div:last-child {
  border-bottom: 0;
}

.protocol-review span {
  color: var(--muted);
  font-size: 8.5px;
}

.protocol-review p {
  margin: 4px 0 0;
  font-size: 10px;
  line-height: 1.45;
}

.preview-safety strong {
  font-size: 10.5px;
}

.preview-safety span {
  margin-top: 3px;
  font-size: 9.5px;
}

.sample-day {
  margin-top: 20px;
}

.sample-day .section-head {
  margin: 0 0 9px;
}

.sample-meal {
  padding: 13px 0;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  border-top: 1px solid var(--line);
}

.sample-meal small,
.sample-meal strong {
  display: block;
}

.sample-meal small {
  color: var(--muted);
  font-size: 9px;
}

.sample-meal strong {
  margin-top: 2px;
  font-size: 11.5px;
}

.sample-meal p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 9.5px;
}

.target-meal strong {
  font-size: 13px;
}

.target-meal p {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
}

.target-meal p span,
.target-meal p em,
.target-share {
  padding: 4px 7px;
  color: var(--muted);
  background: var(--surface-soft);
  border-radius: 999px;
  font-size: 8.5px;
  font-style: normal;
}

.target-meal p b {
  color: var(--text);
}

.target-share {
  color: var(--forest);
  background: var(--green-soft);
  font-weight: 700;
}

.meal-symbol {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: #176441;
  background: #cfe8d5;
  border: 1px solid rgba(23, 100, 65, .12);
  border-radius: 13px;
}

.meal-symbol svg {
  width: 22px;
  height: 22px;
  stroke-width: 2.1;
}

.meal-symbol-snack1,
.meal-symbol-snack2 {
  color: #9a5a00;
  background: #ffebbd;
  border-color: rgba(154, 90, 0, .12);
}

.meal-symbol-lunch {
  color: #2f5f9c;
  background: #dceaff;
  border-color: rgba(47, 95, 156, .12);
}

.meal-symbol-dinner {
  color: #705192;
  background: #eadff6;
  border-color: rgba(112, 81, 146, .12);
}

.ai-label {
  width: max-content;
  padding: 4px 7px;
  color: var(--blue);
  background: var(--blue-soft);
  border-radius: 999px;
  font-size: 8.5px;
  font-weight: 600;
}

.preview-note {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.preview-ai-next {
  margin-top: 18px;
  padding: 15px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  color: #2f5f9c;
  background: #edf4ff;
  border: 1px solid rgba(47, 95, 156, .1);
  border-radius: 13px;
}

.preview-ai-next > span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: #dceaff;
  border-radius: 11px;
}

.preview-ai-next svg {
  width: 20px;
  height: 20px;
  stroke-width: 2.1;
}

.preview-ai-next strong,
.preview-ai-next p {
  margin: 0;
}

.preview-ai-next strong {
  font-size: 11px;
}

.preview-ai-next p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.5;
}

.calendar-control {
  margin-bottom: 14px;
  padding: 18px;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 25px;
  box-shadow: none;
  border: 1px solid var(--line);
}

.calendar-control > div > p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 9.5px;
}

.range-form {
  display: grid;
  grid-template-columns: 130px 130px minmax(160px, 1fr) auto;
  align-items: end;
  gap: 8px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 7px;
}

.calendar-day {
  min-width: 0;
  min-height: 148px;
  padding: 11px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 13px;
}

.calendar-day.is-today {
  border-color: var(--green);
  box-shadow: inset 0 3px 0 var(--green);
}

.calendar-day.is-override {
  background: var(--blue-soft);
  border-color: rgba(82, 111, 120, .18);
}

.calendar-day header {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
}

.calendar-day header span {
  color: var(--muted);
  font-size: 9px;
  text-transform: capitalize;
}

.calendar-day header strong {
  grid-row: 1 / span 2;
  grid-column: 2;
  font-family: 'Prata', Georgia, serif;
  font-size: 22px;
  font-weight: 400;
}

.calendar-day header small {
  color: var(--muted);
  font-size: 8px;
}

.calendar-day > div {
  margin-top: 17px;
}

.calendar-day > div > strong,
.calendar-day > div > small {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.calendar-day > div > strong {
  font-size: 10px;
}

.calendar-day > div > small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 8.5px;
}

.calendar-day select {
  width: 100%;
  height: 28px;
  margin-top: 9px;
  padding: 0 5px;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  font-size: 8px;
}

.publish-footer {
  margin-top: 15px;
  padding: 17px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.publish-footer strong,
.publish-footer span {
  display: block;
}

.publish-footer strong {
  font-size: 11.5px;
}

.publish-footer span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9.5px;
}

.settings-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.settings-panel h2,
.settings-panel p {
  margin: 0;
}

.settings-panel p {
  margin-top: 5px;
  color: var(--muted);
}

/* Client portal */

.client-portal {
  background: #f6f7f3;
}

.client-portal .app-shell {
  display: block;
}

.client-portal .sidebar {
  display: none;
}

.client-portal .main-content {
  max-width: 980px;
  padding: 30px clamp(18px, 5vw, 50px) 70px;
}

.portal-head {
  padding-bottom: 19px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}

.portal-brand,
.portal-logo {
  color: var(--forest);
  font-family: 'Prata', Georgia, serif;
  font-size: 26px;
}

.portal-person {
  display: flex;
  align-items: center;
  gap: 10px;
}

.portal-person .avatar {
  width: 37px;
  height: 37px;
}

.portal-person strong,
.portal-person small {
  display: block;
}

.portal-person strong {
  font-size: 11px;
}

.portal-person small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.portal-nav {
  margin: 17px 0 28px;
  display: flex;
  gap: 6px;
}

.portal-nav a {
  padding: 8px 13px;
  color: var(--muted);
  border-radius: 10px;
  font-size: 11px;
}

.portal-nav a.is-active {
  color: var(--forest);
  background: var(--green-soft);
  font-weight: 600;
}

.portal-state {
  min-height: calc(100vh - 100px);
  max-width: 690px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}

.portal-state h1,
.portal-state p {
  margin: 0;
}

.portal-state h1 {
  margin-top: 17px;
  font-family: 'Prata', Georgia, serif;
  font-size: clamp(32px, 6vw, 52px);
  font-weight: 400;
  line-height: 1.2;
}

.portal-state p {
  max-width: 570px;
  margin-top: 13px;
  color: var(--muted);
}

.waiting-visual {
  width: 82px;
  height: 82px;
  margin: 54px 0 23px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--green-soft);
  border-radius: 28px;
}

.waiting-visual span {
  width: 7px;
  height: 7px;
  background: var(--green);
  border-radius: 50%;
  animation: waiting-dot 1.3s ease-in-out infinite;
}

.waiting-visual span:nth-child(2) {
  animation-delay: .15s;
}

.waiting-visual span:nth-child(3) {
  animation-delay: .3s;
}

@keyframes waiting-dot {
  0%, 60%, 100% { transform: translateY(0); opacity: .4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

.practitioner-chip {
  margin-top: 27px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 9px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.practitioner-chip > span {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  color: var(--green-dark);
  background: var(--green-soft);
  border-radius: 50%;
  font-size: 9px;
  font-weight: 700;
}

.practitioner-chip strong,
.practitioner-chip small {
  display: block;
}

.practitioner-chip strong {
  font-size: 10.5px;
}

.practitioner-chip small {
  color: var(--muted);
  font-size: 8.5px;
}

.today-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 25px;
}

.today-hero h1,
.today-hero p {
  margin: 0;
}

.today-hero h1 {
  font-family: 'Prata', Georgia, serif;
  font-size: clamp(32px, 6vw, 50px);
  font-weight: 400;
}

.today-hero p {
  max-width: 610px;
  margin-top: 8px;
  color: var(--muted);
}

.today-target {
  flex: 0 0 auto;
  text-align: right;
}

.today-target span,
.today-target small {
  display: block;
}

.today-target span {
  color: var(--green);
  font-family: 'Prata', Georgia, serif;
  font-size: 32px;
}

.today-target small {
  color: var(--muted);
  font-size: 9px;
}

.today-progress {
  margin: 25px 0 15px;
  padding: 13px 15px;
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  align-items: center;
  gap: 15px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 13px;
}

.today-progress > span {
  height: 7px;
  background: linear-gradient(to right, var(--green) var(--day-progress), var(--line) var(--day-progress));
  border-radius: 99px;
}

.today-progress strong,
.today-progress small {
  display: block;
}

.today-progress strong {
  font-size: 10.5px;
}

.today-progress small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.portal-meals {
  min-width: 0;
  display: grid;
  gap: 13px;
}

.portal-meal {
  min-width: 0;
  width: 100%;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.portal-meal > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 15px;
}

.portal-meal > header > div {
  display: flex;
  gap: 11px;
}

.portal-meal h2,
.portal-meal header p {
  margin: 0;
}

.portal-meal h2 {
  font-size: 15px;
}

.portal-meal header p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9.5px;
}

.portal-meal > header > span {
  color: var(--muted);
  font-size: 9px;
}

.portal-meal > header > .approved-label {
  padding: 5px 8px;
  color: var(--green);
  background: var(--green-soft);
  border-radius: 999px;
  font-weight: 650;
}

.dish-card {
  min-width: 0;
  margin-top: 16px;
  display: grid;
  grid-template-columns: 145px minmax(0, 1fr);
  gap: 18px;
}

.dish-art {
  min-height: 142px;
  display: grid;
  place-items: center;
  color: var(--green);
  background:
    radial-gradient(circle at 25% 25%, rgba(255, 255, 255, .9) 0 8%, transparent 9%),
    linear-gradient(145deg, #dceadc, #edf3e9);
  border-radius: 16px;
}

.dish-art-lunch {
  color: var(--blue);
  background: linear-gradient(145deg, var(--blue-soft), #f4f7f4);
}

.dish-art-dinner {
  color: var(--purple);
  background: linear-gradient(145deg, var(--purple-soft), #f5f1f0);
}

.dish-art svg {
  width: 42px;
  height: 42px;
}

.dish-copy {
  min-width: 0;
}

.dish-copy h3,
.dish-copy p {
  margin: 0;
}

.dish-copy h3 {
  margin-top: 10px;
  font-family: 'Prata', Georgia, serif;
  font-size: 22px;
  font-weight: 400;
  line-height: 1.3;
}

.dish-copy p {
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
}

.dish-meta {
  margin-top: 15px;
  display: flex;
  gap: 7px;
}

.dish-meta span {
  padding: 5px 8px;
  color: var(--muted);
  background: var(--surface-soft);
  border-radius: 999px;
  font-size: 9px;
}

.dish-options {
  min-width: 0;
  max-width: 100%;
  margin-top: 15px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.dish-options button {
  min-width: 0;
  min-height: 42px;
  padding: 7px 9px;
  display: flex;
  align-items: center;
  gap: 7px;
  overflow: hidden;
  color: var(--muted);
  text-align: left;
  background: var(--surface-soft);
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  font-size: 8.5px;
}

.dish-options button > span {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  background: var(--line);
  border-radius: 50%;
}

.dish-options button.is-active {
  color: var(--forest);
  background: var(--green-soft);
  border-color: rgba(47, 107, 79, .15);
  font-weight: 600;
}

.dish-options button.is-active > span {
  background: var(--green);
}

.portal-meal-actions {
  margin-top: 13px;
  display: flex;
  justify-content: flex-end;
  gap: 7px;
}

.portal-meal-actions .button {
  min-height: 37px;
  font-size: 10px;
}

.portal-approved-ingredients {
  margin-top: 15px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
}

.portal-approved-ingredients span {
  color: var(--line-strong);
}

.portal-approved-macros {
  margin-top: 12px;
  padding-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-top: 1px solid var(--line);
}

.portal-approved-macros span {
  padding: 6px 9px;
  color: var(--muted);
  background: var(--surface-soft);
  border-radius: 9px;
  font-size: 9px;
}

.portal-approved-macros b {
  color: var(--ink);
  font-size: 11px;
}

.portal-help {
  margin-top: 15px;
  padding: 17px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  color: var(--blue);
  background: var(--blue-soft);
  border-radius: 15px;
}

.portal-help > span {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  background: var(--surface);
  border-radius: 11px;
}

.portal-help svg {
  width: 19px;
}

.portal-help strong {
  font-size: 11px;
}

.portal-help p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 9.5px;
}

.week-hero h1,
.week-hero p {
  margin: 0;
}

.week-hero h1 {
  font-family: 'Prata', Georgia, serif;
  font-size: 40px;
  font-weight: 400;
}

.week-hero p {
  margin-top: 7px;
  color: var(--muted);
}

.portal-week {
  margin-top: 25px;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.portal-week a {
  min-width: 0;
  min-height: 150px;
  padding: 14px 10px;
  display: flex;
  align-items: center;
  flex-direction: column;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 13px;
  text-align: center;
}

.portal-week a.is-today {
  color: var(--forest);
  border-color: var(--green);
}

.portal-week span {
  font-size: 9px;
  text-transform: capitalize;
}

.portal-week strong {
  margin-top: 10px;
  color: var(--text);
  font-family: 'Prata', Georgia, serif;
  font-size: 27px;
  font-weight: 400;
}

.portal-week small {
  margin-top: auto;
  overflow: hidden;
  color: inherit;
  font-size: 8.5px;
}

.swap-dialog {
  width: min(570px, calc(100% - 30px));
}

.swap-dialog textarea {
  min-height: 110px;
}

.swap-options {
  margin-top: 17px;
}

@media (max-width: 1050px) {
  .mode-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .setup-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .calendar-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .range-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

}

@media (max-width: 820px) {
  .setup-overview {
    grid-template-columns: 1fr;
  }

  .mode-tabs {
    display: flex;
    overflow-x: auto;
    padding-bottom: 6px;
  }

  .mode-tabs button {
    min-width: 170px;
  }

  .calendar-control {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .share-status {
    grid-template-columns: 9px minmax(0, 1fr);
  }

  .share-status em {
    grid-column: 2;
    width: max-content;
  }

  .setup-steps,
  .mode-grid,
  .rules-grid,
  .rule-review-grid,
  .slider-list,
  .client-rules-summary dl {
    grid-template-columns: 1fr;
  }

  .setup-actions,
  .content-head,
  .mode-editor-head,
  .publish-footer,
  .distribution-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .content-head-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
  }

  .setup-actions .button,
  .content-head .button,
  .publish-footer .button,
  .distribution-heading .button {
    width: 100%;
  }

  .protocol-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .client-note-panel footer .button {
    width: 100%;
  }

  .protocol-heading .button {
    align-self: flex-start;
  }

  .protocol-dialog-section {
    grid-template-columns: 1fr;
  }

  .protocol-dialog {
    padding: 20px;
  }

  .protocol-dialog-section .button {
    width: 100%;
  }

  .mode-editor-panel {
    padding: 22px 17px 0;
  }

  .mode-editor-footer {
    margin-inline: -17px;
    padding-inline: 17px;
    align-items: stretch;
    flex-direction: column;
  }

  .mode-editor-footer > div {
    display: grid;
    grid-template-columns: 1fr 1.4fr;
  }

  .mode-editor-footer .button {
    padding-inline: 8px;
  }

  .macro-editor,
  .preview-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .macro-consistency {
    align-items: stretch;
    flex-direction: column;
  }

  .macro-consistency .button {
    width: 100%;
  }

  .safety-compact-grid .tag-field:nth-child(3) {
    grid-column: auto;
  }

  .distribution-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .wallet-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wallet-budget-head { align-items: flex-start; flex-direction: column; gap: 8px; }
  .wallet-reserve { text-align: left; }
  .wallet-actions { display: grid; grid-template-columns: 1fr; }
  .wallet-meal { grid-template-columns: 1fr; gap: 10px; }
  .wallet-stepper { justify-content: center; }

  .empty-journey {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .empty-journey i {
    display: none;
  }

  .calendar-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .range-form {
    grid-template-columns: 1fr;
  }

  .portal-head {
    align-items: flex-start;
  }

  .portal-person {
    max-width: 190px;
  }

  .today-hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .today-target {
    text-align: left;
  }

  .today-progress {
    grid-template-columns: 1fr;
  }

  .dish-card {
    grid-template-columns: 1fr;
  }

  .dish-art {
    min-height: 110px;
  }

  .dish-options {
    display: flex;
    overflow-x: auto;
  }

  .dish-options button {
    min-width: 190px;
  }

  .portal-meal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .portal-week {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.menu-empty-state {
  min-height: 430px;
  padding: 54px 32px;
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}

.menu-ai-mark,
.empty-menu-icon {
  width: 54px;
  height: 54px;
  margin-bottom: 17px;
  display: grid;
  place-items: center;
  color: var(--green);
  background: var(--green-soft);
  border-radius: 18px;
}

.menu-ai-mark svg,
.empty-menu-icon svg {
  width: 27px;
  height: 27px;
}

.menu-empty-state h2,
.menu-empty-state p {
  margin: 0;
}

.menu-empty-state h2 {
  margin-top: 8px;
  font-size: 25px;
}

.menu-empty-state > p {
  max-width: 560px;
  margin-top: 9px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.menu-start-control {
  width: min(100%, 440px);
  margin-top: 25px;
  padding: 13px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
  background: var(--surface-soft);
  border-radius: 15px;
}

.menu-start-control .button {
  min-height: 42px;
}

.menu-boundaries {
  margin-top: 23px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.menu-boundaries span,
.ai-provider-pill {
  padding: 6px 9px;
  color: var(--muted);
  background: var(--surface-soft);
  border-radius: 999px;
  font-size: 9px;
}

.menu-content-head {
  align-items: center;
}

.menu-content-head .content-head-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.menu-issues {
  margin-bottom: 12px;
  display: grid;
  gap: 7px;
}

.menu-issues > div {
  padding: 11px 13px;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  color: #7c5a1c;
  background: var(--amber-soft);
  border-radius: 11px;
  font-size: 10.5px;
}

.menu-issues .is-critical {
  color: var(--red);
  background: var(--red-soft);
}

.menu-review-progress {
  margin-bottom: 14px;
  padding: 15px 17px;
  box-shadow: none;
  border: 1px solid var(--line);
}

.menu-review-progress > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  font-size: 11px;
}

.menu-review-progress > div span,
.menu-review-progress small {
  color: var(--muted);
}

.menu-review-progress > i {
  height: 5px;
  margin: 10px 0 7px;
  display: block;
  overflow: hidden;
  background: var(--surface-soft);
  border-radius: 999px;
}

.menu-review-progress > i span {
  height: 100%;
  display: block;
  background: var(--green);
  border-radius: inherit;
  transition: width .25s ease;
}

.menu-review-progress small {
  font-size: 9.5px;
}

.menu-day-tabs {
  margin-bottom: 18px;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 7px;
}

.menu-day-tabs button {
  min-width: 0;
  padding: 10px 5px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  text-align: center;
}

.menu-day-tabs span,
.menu-day-tabs strong,
.menu-day-tabs small {
  display: block;
}

.menu-day-tabs span {
  font-size: 8.5px;
  text-transform: uppercase;
}

.menu-day-tabs strong {
  margin: 3px 0;
  color: var(--text);
  font-size: 16px;
}

.menu-day-tabs small {
  overflow: hidden;
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu-day-tabs button.is-active {
  color: var(--green);
  background: var(--green-soft);
  border-color: transparent;
  box-shadow: inset 0 -2px var(--green);
}

.menu-day-tabs button.is-reviewed small {
  color: var(--green);
}

.menu-day-head {
  margin: 0 2px 12px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}

.menu-day-head h3,
.menu-day-head span {
  margin: 0;
}

.menu-day-head h3 {
  margin-top: 3px;
  font-size: 18px;
}

.menu-day-head > span {
  color: var(--muted);
  font-size: 10px;
}

.generated-meals {
  display: grid;
  gap: 10px;
}

.generated-meal-card {
  padding: 17px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 15px;
}

.generated-meal-card > header {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
}

.generated-meal-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: #176441;
  background: #cfe8d5;
  border: 1px solid rgba(23, 100, 65, .12);
  border-radius: 13px;
}

.generated-meal-icon svg {
  width: 22px;
  height: 22px;
  stroke-width: 2.1;
}

.generated-meal-icon.meal-symbol-snack1,
.generated-meal-icon.meal-symbol-snack2 {
  color: #9a5a00;
  background: #ffebbd;
  border-color: rgba(154, 90, 0, .12);
}

.generated-meal-icon.meal-symbol-lunch {
  color: #2f5f9c;
  background: #dceaff;
  border-color: rgba(47, 95, 156, .12);
}

.generated-meal-icon.meal-symbol-dinner {
  color: #705192;
  background: #eadff6;
  border-color: rgba(112, 81, 146, .12);
}

.generated-meal-card header span,
.generated-meal-card h3,
.generated-meal-card p {
  margin: 0;
}

.generated-meal-card header div > span {
  color: var(--muted);
  font-size: 9px;
}

.generated-meal-card h3 {
  margin-top: 2px;
  font-size: 14px;
}

.generated-meal-card > p {
  margin: 10px 0 8px 49px;
  color: var(--muted);
  font-size: 10.5px;
}

.macro-delta {
  padding: 5px 7px;
  border-radius: 999px;
  font-size: 8.5px;
  font-weight: 700;
}

.macro-delta.is-ok {
  color: var(--green);
  background: var(--green-soft);
}

.macro-delta.is-warning {
  color: #8a641c;
  background: var(--amber-soft);
}

.generated-ingredients {
  margin-left: 49px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  color: var(--text);
  font-size: 10px;
}

.generated-ingredients span {
  color: var(--line-strong);
}

.generated-meal-meta {
  margin: 13px 0 0 49px;
  padding-top: 11px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  border-top: 1px solid var(--line);
}

.generated-meal-meta span {
  min-width: 52px;
  padding: 6px 8px;
  background: var(--surface-soft);
  border-radius: 8px;
  color: var(--muted);
  font-size: 8.5px;
}

.generated-meal-meta span b {
  color: var(--text);
  font-size: 10px;
}

.generated-meal-meta em {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 8.5px;
  font-style: normal;
}

.generated-meal-meta em:first-of-type {
  margin-left: auto;
}

.generated-meal-meta svg,
.generated-meal-card footer svg {
  width: 14px;
  height: 14px;
}

.generated-meal-note {
  margin: 11px 0 0 49px;
  padding: 9px 11px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--forest);
  background: var(--green-soft);
  border-radius: 10px;
}

.generated-meal-note > span {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
}

.generated-meal-note svg {
  width: 17px;
  height: 17px;
}

.generated-meal-note p {
  font-size: 9.5px;
  line-height: 1.4;
}

.generated-meal-note strong {
  margin-right: 5px;
}

.generated-warning {
  margin: 8px 0 0 49px;
  color: #8a641c;
  font-size: 8.5px;
}

.generated-meal-card footer {
  margin: 13px 0 0 49px;
  display: flex;
  gap: 8px;
}

.generated-meal-card footer .button {
  min-height: 34px;
  padding: 7px 11px;
  font-size: 9.5px;
}

.menu-day-review,
.menu-publish-footer {
  margin-top: 14px;
  padding: 15px 17px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: var(--surface-soft);
  border-radius: 13px;
}

.menu-day-review.is-reviewed {
  background: var(--green-soft);
}

.menu-day-review strong,
.menu-day-review span,
.menu-publish-footer strong,
.menu-publish-footer span {
  display: block;
}

.menu-day-review strong,
.menu-publish-footer strong {
  font-size: 11px;
}

.menu-day-review span,
.menu-publish-footer span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9.5px;
}

.menu-publish-footer {
  margin-top: 20px;
  position: sticky;
  bottom: 12px;
  background: rgba(255,255,255,.94);
  border: 1px solid var(--line);
  box-shadow: 0 12px 34px rgba(43,67,52,.12);
  backdrop-filter: blur(12px);
  z-index: 5;
}

.menu-generating {
  min-height: 440px;
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}

.menu-generating > span {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  color: var(--green);
  background: var(--green-soft);
  border-radius: 18px;
  animation: menu-pulse 1.4s ease-in-out infinite;
}

.menu-generating svg {
  width: 28px;
  height: 28px;
}

.menu-generating h2 {
  margin: 17px 0 5px;
  font-size: 22px;
}

.menu-generating p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.menu-generating > div {
  margin-top: 17px;
  display: flex;
  gap: 5px;
}

.menu-generating i {
  width: 6px;
  height: 6px;
  background: var(--green);
  border-radius: 50%;
  animation: menu-dot 1s ease-in-out infinite;
}

.menu-generating i:nth-child(2) { animation-delay: .12s; }
.menu-generating i:nth-child(3) { animation-delay: .24s; }

.meal-edit-dialog,
.meal-replace-dialog {
  width: min(600px, calc(100% - 30px));
}

.meal-nutrition-fields {
  margin-top: 15px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.replace-reasons {
  margin: 0 0 17px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  border: 0;
}

.replace-reasons legend {
  width: 100%;
  margin-bottom: 5px;
  font-size: 11px;
  font-weight: 600;
}

.replace-reasons label input {
  position: absolute;
  opacity: 0;
}

.replace-reasons label span {
  padding: 7px 10px;
  display: block;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  font-size: 9.5px;
}

.replace-reasons label input:checked + span {
  color: var(--green);
  background: var(--green-soft);
  border-color: rgba(47,107,79,.16);
}

@keyframes menu-pulse {
  50% { transform: scale(1.06); box-shadow: 0 0 0 10px rgba(47,107,79,.06); }
}

@keyframes menu-dot {
  50% { transform: translateY(-4px); opacity: .45; }
}

@media (max-width: 760px) {
  .menu-day-tabs {
    display: flex;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .menu-day-tabs button {
    min-width: 78px;
  }

  .generated-meal-card > p,
  .generated-ingredients,
  .generated-meal-meta,
  .generated-meal-note,
  .generated-warning,
  .generated-meal-card footer {
    margin-left: 0;
  }

  .generated-meal-meta em:first-of-type {
    margin-left: 0;
  }

  .menu-day-review,
  .menu-publish-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .menu-day-review .button,
  .menu-publish-footer .button {
    width: 100%;
  }
}

@media (max-width: 520px) {
  .menu-empty-state {
    padding: 38px 18px;
  }

  .menu-start-control,
  .meal-nutrition-fields {
    grid-template-columns: 1fr 1fr;
  }

  .menu-start-control .field,
  .menu-start-control .button {
    grid-column: 1 / -1;
  }

  .generated-meal-card {
    padding: 15px;
  }

  .generated-meal-card > header {
    grid-template-columns: 36px minmax(0, 1fr);
  }

  .macro-delta {
    grid-column: 2;
    justify-self: start;
  }

  .generated-meal-card footer {
    display: grid;
    grid-template-columns: 1fr;
  }
}

/* Structured AI protocol preview */

.ai-protocol-preview {
  display: grid;
  gap: 14px;
}

.ai-protocol-preview .form-page-head {
  margin-bottom: 2px;
}

.ai-protocol-intro {
  padding: 18px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 13px;
  color: var(--forest);
  background: linear-gradient(135deg, #e9f4eb, #f4f8ef);
  border-radius: 15px;
}

.ai-protocol-intro > span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,.72);
  border-radius: 11px;
}

.ai-protocol-intro svg {
  width: 21px;
  height: 21px;
}

.ai-protocol-intro strong,
.ai-protocol-intro p {
  margin: 0;
}

.ai-protocol-intro strong {
  font-size: 12px;
}

.ai-protocol-intro p {
  margin-top: 4px;
  font-size: 10px;
  line-height: 1.55;
}

.ai-protocol-section {
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 15px;
}

.ai-protocol-section > header {
  margin-bottom: 14px;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 11px;
}

.ai-protocol-section > header > span {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  color: var(--green);
  background: var(--green-soft);
  border-radius: 9px;
  font-size: 9px;
  font-weight: 700;
}

.ai-protocol-section h3,
.ai-protocol-section header p {
  margin: 0;
}

.ai-protocol-section h3 {
  font-size: 13px;
}

.ai-protocol-section header p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.45;
}

.ai-protocol-rules {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.ai-protocol-rules.compact {
  grid-template-columns: 1fr;
}

.ai-protocol-rules article,
.ai-protocol-source {
  padding: 12px 13px;
  background: var(--surface-soft);
  border-radius: 11px;
}

.ai-protocol-rules article > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ai-protocol-rules strong,
.ai-protocol-rules em,
.ai-protocol-rules p,
.ai-protocol-source span,
.ai-protocol-source p {
  margin: 0;
  display: block;
}

.ai-protocol-rules strong,
.ai-protocol-source span {
  font-size: 9.5px;
  font-weight: 700;
}

.ai-protocol-rules em {
  color: var(--red);
  font-size: 7.5px;
  font-style: normal;
}

.ai-protocol-rules p,
.ai-protocol-source p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.5;
  white-space: pre-line;
}

.ai-protocol-source {
  margin-bottom: 9px;
  background: var(--green-soft);
}

.ai-protocol-source.is-muted {
  margin: 9px 0 0;
  background: var(--surface-soft);
}

.ai-protocol-meals {
  display: grid;
  gap: 6px;
}

.ai-protocol-meals article {
  padding: 10px 12px;
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  background: var(--surface-soft);
  border-radius: 10px;
}

.ai-protocol-meals article > span {
  color: var(--green);
  font-size: 8px;
  font-weight: 700;
}

.ai-protocol-meals strong,
.ai-protocol-meals p,
.ai-protocol-meals em {
  margin: 0;
  display: block;
}

.ai-protocol-meals strong {
  font-size: 10px;
}

.ai-protocol-meals p,
.ai-protocol-meals em {
  color: var(--muted);
  font-size: 8.5px;
  font-style: normal;
}

.ai-protocol-meals p {
  margin-top: 2px;
}

.ai-protocol-meals em {
  white-space: nowrap;
}

.ai-protocol-note,
.ai-protocol-empty {
  padding: 10px 12px;
  color: var(--muted);
  background: var(--surface-soft);
  border-radius: 10px;
  font-size: 9px;
  line-height: 1.45;
}

.ai-protocol-note {
  margin-top: 8px;
  color: var(--forest);
  background: var(--green-soft);
}

@media (max-width: 620px) {
  .ai-protocol-rules {
    grid-template-columns: 1fr;
  }

  .ai-protocol-meals article {
    grid-template-columns: 24px minmax(0, 1fr);
  }

  .ai-protocol-meals em {
    grid-column: 2;
  }
}

/* GPT interpretation as a working protocol, not a set of cards */

.mode-protocol-head {
  margin: 18px 0 22px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.mode-protocol-head h1,
.mode-protocol-head p {
  margin: 0;
}

.mode-protocol-head h1 {
  margin-top: 5px;
  font-size: 30px;
  line-height: 1.15;
}

.mode-protocol-head p {
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
}

.mode-protocol-sheet {
  padding: 28px 32px 25px;
  background: var(--surface);
  border-radius: 18px;
  box-shadow: 0 12px 35px rgba(47, 64, 52, .05);
}

.protocol-page-head {
  padding-bottom: 17px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
}

.protocol-page-head h2,
.protocol-page-head p {
  margin: 0;
}

.protocol-page-head h2 {
  margin-top: 5px;
  font-size: 19px;
  line-height: 1.25;
}

.protocol-page-head p {
  max-width: 630px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.55;
}

.protocol-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.protocol-meta > span {
  color: var(--muted);
  font-size: 9px;
  white-space: nowrap;
}

.protocol-document {
  max-width: 820px;
}

.protocol-document-section {
  padding: 24px 0;
  display: grid;
  grid-template-columns: 158px minmax(0, 1fr);
  gap: 24px;
  border-bottom: 1px solid var(--line);
}

.protocol-document-section > header {
  display: flex;
  align-items: baseline;
  gap: 9px;
}

.protocol-document-section > header span {
  color: var(--green);
  font-size: 9px;
  font-weight: 700;
}

.protocol-document-section h3,
.protocol-document-section p,
.protocol-document-section blockquote {
  margin: 0;
}

.protocol-document-section h3 {
  font-size: 11px;
  line-height: 1.4;
}

.protocol-section-body > p,
.protocol-section-body > blockquote {
  font-size: 11.5px;
  line-height: 1.65;
  white-space: pre-line;
}

.protocol-meal-logic {
  margin-top: 16px;
}

.protocol-meal-logic > div {
  padding: 11px 0;
  display: grid;
  grid-template-columns: 105px minmax(0, 1fr) 210px;
  align-items: baseline;
  gap: 14px;
  border-top: 1px solid var(--line);
}

.protocol-meal-logic strong,
.protocol-meal-logic p,
.protocol-meal-logic span {
  margin: 0;
  font-size: 9.5px;
  line-height: 1.5;
}

.protocol-meal-logic p {
  color: var(--text);
}

.protocol-meal-logic span {
  color: var(--muted);
  text-align: right;
}

.protocol-products {
  margin: 0;
}

.protocol-section-body > p + .protocol-logic-lines {
  margin-top: 16px;
}

.protocol-products > div {
  padding: 10px 0;
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 15px;
  border-top: 1px solid var(--line);
}

.protocol-products > div:first-child {
  padding-top: 0;
  border-top: 0;
}

.protocol-products dt,
.protocol-products dd {
  margin: 0;
  font-size: 10px;
  line-height: 1.55;
}

.protocol-products dt {
  color: var(--muted);
  font-weight: 600;
}

.protocol-condition-guidance {
  margin-top: 14px;
}

.protocol-condition-guidance article {
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.protocol-condition-guidance header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.protocol-condition-guidance strong,
.protocol-condition-guidance p {
  margin: 0;
}

.protocol-condition-guidance strong {
  font-size: 10.5px;
}

.protocol-condition-guidance header span {
  padding: 4px 7px;
  color: var(--amber);
  background: var(--amber-soft);
  border-radius: 999px;
  font-size: 8px;
  font-weight: 600;
  white-space: nowrap;
}

.protocol-condition-guidance header span.is-applied {
  color: var(--forest);
  background: var(--green-soft);
}

.protocol-condition-guidance p,
.protocol-no-conditions {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
}

.protocol-document-section blockquote {
  padding-left: 16px;
  color: var(--forest);
  border-left: 3px solid var(--green);
  font-weight: 600;
}

.protocol-advice,
.protocol-questions {
  max-width: 820px;
  padding: 23px 0 3px 182px;
}

.protocol-advice h3,
.protocol-questions h3 {
  margin: 0 0 7px;
  font-size: 11px;
}

.protocol-advice > div,
.protocol-questions > div {
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.protocol-advice strong,
.protocol-advice p,
.protocol-questions strong,
.protocol-questions p {
  margin: 0;
  font-size: 10px;
  line-height: 1.55;
}

.protocol-advice strong::before {
  content: '↗';
  margin-right: 7px;
  color: var(--green);
}

.protocol-advice .is-attention strong::before,
.protocol-questions strong {
  color: var(--amber);
}

.protocol-advice p,
.protocol-questions p {
  margin-top: 3px;
  color: var(--muted);
}

.protocol-loading,
.protocol-error {
  min-height: 380px;
  padding: 44px 0;
  max-width: 820px;
}

.protocol-loading > span {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: var(--green);
  background: var(--green-soft);
  border-radius: 13px;
}

.protocol-loading > span svg {
  width: 23px;
  height: 23px;
}

.protocol-loading strong,
.protocol-loading p,
.protocol-error strong,
.protocol-error p {
  margin: 0;
}

.protocol-loading > div:nth-child(2) {
  margin-top: 13px;
}

.protocol-loading strong,
.protocol-error strong {
  font-size: 12px;
}

.protocol-loading p,
.protocol-error p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
}

.protocol-skeleton {
  margin-top: 28px;
  display: grid;
  gap: 12px;
}

.protocol-skeleton i {
  height: 9px;
  background: linear-gradient(90deg, var(--surface-soft), #e9efea, var(--surface-soft));
  background-size: 220% 100%;
  border-radius: 999px;
  animation: protocol-shimmer 1.3s linear infinite;
}

.protocol-skeleton i:nth-child(2) { width: 87%; }
.protocol-skeleton i:nth-child(3) { width: 94%; }
.protocol-skeleton i:nth-child(4) { width: 73%; }
.protocol-skeleton i:nth-child(5) { width: 82%; }

@keyframes protocol-shimmer {
  to { background-position: -220% 0; }
}

.protocol-error {
  min-height: 280px;
}

.protocol-error .button {
  margin-top: 16px;
}

.protocol-local-review {
  max-width: 820px;
  padding: 15px 0;
  color: var(--amber);
  border-bottom: 1px solid var(--line);
}

.protocol-local-review strong,
.protocol-local-review p {
  margin: 0;
  font-size: 9.5px;
  line-height: 1.5;
}

.protocol-local-review p {
  margin-top: 3px;
  color: var(--muted);
}

.protocol-footnote {
  max-width: 820px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.5;
}

.protocol-next-actions {
  margin-top: 22px;
  padding-top: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-top: 1px solid var(--line);
}

.protocol-next-actions > div:last-child {
  display: flex;
  align-items: center;
  gap: 8px;
}

.protocol-next-actions strong,
.protocol-next-actions span {
  display: block;
}

.protocol-next-actions strong {
  font-size: 11px;
}

.protocol-next-actions span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9.5px;
}

@media (max-width: 760px) {
  .mode-protocol-head {
    align-items: stretch;
    flex-direction: column;
  }

  .mode-protocol-head .content-head-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .mode-protocol-sheet {
    padding: 22px 18px;
  }

  .protocol-next-actions,
  .protocol-next-actions > div:last-child {
    align-items: stretch;
    flex-direction: column;
  }

  .protocol-page-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .protocol-document-section {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .protocol-meal-logic > div {
    grid-template-columns: 85px minmax(0, 1fr);
  }

  .protocol-meal-logic span {
    grid-column: 2;
    text-align: left;
  }

  .protocol-advice,
  .protocol-questions {
    padding-left: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .waiting-visual span {
    animation: none;
  }

  .menu-generating > span,
  .menu-generating i,
  .protocol-skeleton i {
    animation: none;
  }
}

/* MVP workflow hardening */

.client-toolbar {
  margin: 18px 0 14px;
  padding: 10px;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 150px;
  gap: 9px;
  box-shadow: none;
  border: 1px solid var(--line);
}

.client-toolbar input,
.client-toolbar select {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  color: var(--text);
  background: var(--surface-soft);
  border: 1px solid transparent;
  border-radius: 10px;
  outline: 0;
  font: inherit;
  font-size: 10.5px;
}

.client-toolbar input:focus,
.client-toolbar select:focus {
  background: var(--surface);
  border-color: var(--green);
}

.client-management {
  margin: -7px 0 14px;
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.button-danger-quiet {
  color: var(--red);
  background: transparent;
}

.confirmation-check {
  margin-top: 18px;
  border-color: rgba(35, 111, 75, .22);
  background: var(--green-soft);
}

.compact-check {
  min-height: 70px;
  align-self: end;
}

.inheritance-bar {
  margin: -3px 0 18px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  background: var(--blue-soft);
  border-radius: 10px;
  font-size: 9.5px;
}

.mode-tabs button.has-override small {
  color: var(--green);
}

.calendar-week-nav {
  margin: 4px 0 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.calendar-week-nav strong {
  font-size: 10.5px;
  font-weight: 600;
}

.calendar-next-step {
  margin-top: 15px;
  padding: 15px 17px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  background: var(--green-soft);
  border-radius: 13px;
}

.calendar-next-step > span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: var(--green);
  background: var(--surface);
  border-radius: 10px;
}

.calendar-next-step svg {
  width: 19px;
  height: 19px;
}

.calendar-next-step strong,
.calendar-next-step p {
  margin: 0;
}

.calendar-next-step strong {
  font-size: 10.5px;
}

.calendar-next-step p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.menu-week-overview {
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  box-shadow: none;
}

.menu-week-overview header {
  margin-bottom: 7px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
}

.menu-week-overview h3,
.menu-week-overview header small {
  margin: 0;
}

.menu-week-overview h3 {
  margin-top: 2px;
  font-size: 13px;
}

.menu-week-overview header small {
  color: var(--muted);
  font-size: 8.5px;
}

.menu-week-overview > button {
  width: 100%;
  padding: 9px 5px;
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) 65px;
  align-items: center;
  gap: 10px;
  color: var(--text);
  background: transparent;
  border: 0;
  border-top: 1px solid var(--line);
  cursor: pointer;
  text-align: left;
}

.menu-week-overview > button p {
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu-week-overview > button span,
.menu-week-overview > button em {
  font-size: 9px;
  font-style: normal;
}

.menu-week-overview > button em {
  color: var(--green);
  text-align: right;
}

.menu-generation {
  max-width: 720px;
  margin: 0 auto;
  padding: 34px;
  text-align: center;
  border: 1px solid var(--line);
  box-shadow: none;
}

.menu-generation h2,
.menu-generation > p {
  margin: 0;
}

.menu-generation h2 {
  margin-top: 12px;
  font-size: 22px;
}

.menu-generation > p {
  max-width: 500px;
  margin: 6px auto 20px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.55;
}

.generation-progress {
  margin-bottom: 14px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
}

.generation-progress i {
  height: 6px;
  overflow: hidden;
  background: var(--surface-soft);
  border-radius: 999px;
}

.generation-progress i span {
  height: 100%;
  display: block;
  background: var(--green);
  border-radius: inherit;
  transition: width .25s ease;
}

.generation-progress strong {
  font-size: 10px;
}

.generation-days {
  margin-bottom: 16px;
  display: grid;
  gap: 6px;
  text-align: left;
}

.generation-days article {
  padding: 9px 10px;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  background: var(--surface-soft);
  border-radius: 9px;
}

.generation-days article > span {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: var(--surface);
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
}

.generation-days article.is-complete > span {
  color: white;
  background: var(--green);
}

.generation-days article.is-failed > span {
  color: var(--red);
  background: var(--red-soft);
}

.generation-days strong,
.generation-days small {
  display: block;
}

.generation-days strong {
  font-size: 9.5px;
  text-transform: capitalize;
}

.generation-days small {
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted);
  font-size: 8.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.generated-warnings {
  display: grid;
  gap: 4px;
}

.portal-recommendations {
  margin: 17px 0;
  padding: 17px;
  display: flex;
  gap: 12px;
  color: var(--forest);
  background: #edf5ee;
  border-radius: 14px;
}

.portal-recommendations > span {
  width: 28px;
  flex: 0 0 28px;
}

.portal-recommendations svg {
  width: 24px;
  height: 24px;
}

.portal-recommendations strong,
.portal-recommendations p {
  margin: 0;
}

.portal-recommendations strong {
  font-size: 11px;
}

.portal-recommendations p {
  margin-top: 4px;
  font-size: 10px;
  line-height: 1.55;
  white-space: pre-line;
}

.portal-recipe {
  margin-top: 12px;
  padding: 11px 13px;
  background: var(--surface-soft);
  border-radius: 10px;
}

.portal-recipe summary {
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
}

.portal-recipe ol {
  margin: 10px 0 0;
  padding-left: 20px;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.55;
}

@media (max-width: 760px) {
  .client-toolbar,
  .calendar-next-step {
    grid-template-columns: 1fr;
  }

  .calendar-week-nav {
    align-items: stretch;
    flex-direction: column;
    text-align: center;
  }

  .menu-week-overview > button {
    grid-template-columns: 85px minmax(0, 1fr);
  }

  .menu-week-overview > button em {
    display: none;
  }

  .menu-generation {
    padding: 25px 16px;
  }
}

@media (max-width: 520px) {
  .client-management {
    align-items: stretch;
    flex-direction: column;
  }

  .inheritance-bar,
  .menu-week-overview header {
    align-items: flex-start;
    flex-direction: column;
  }
}
