.modal-back.portion-back {
  align-items: end;
  bottom: auto;
  z-index: 70;
  max-width: 100%;
  overflow-x: clip;
}
.modal-back.portion-back > .portion-form-sheet {
  justify-self: stretch;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 12px max(16px, env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
.portion-head {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  flex: none;
  background: #fff;
  padding-bottom: 6px;
}
.portion-back-btn {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 12px;
  background: #f0f2ef;
  color: #0b3514;
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
}
.portion-title { min-width: 0; }
.portion-kicker {
  margin: 0;
  color: #647066;
  font-size: 12px;
  font-weight: 800;
}
.portion-save { font-size: 22px; line-height: 1; min-width: 44px; }
.portion-syrup {
  margin: 10px 0 4px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f4f7f2;
  color: #102a16;
  font-size: 13px;
  line-height: 1.45;
}
.portion-syrup p { margin: 0 0 4px; }
.portion-syrup p:last-child { margin: 0; color: #647066; }
.portion-title h2 {
  margin: 0;
  color: #102a16;
  font-size: 17px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.portion-title .food-source { display: inline-block; margin-top: 4px; }
.portion-save {
  width: auto;
  min-height: 40px;
  padding: 8px 14px;
  border: 0;
  border-radius: 12px;
  background: #0b3514;
  color: #fff;
  font-weight: 800;
}
.portion-form {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
}
.portion-scroll {
  min-height: 0;
  overflow: auto;
}
.portion-rowline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  max-width: 100%;
  min-height: 56px;
  padding: 8px 0;
  border-bottom: 1px solid #e1e8df;
}
.portion-rowline > label {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  color: #102a16;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.portion-value {
  flex: 0 1 52%;
  min-width: 0;
  max-width: 58%;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #e1e8df;
  border-radius: 12px;
  background: #f4f7f2;
  color: #0b3514;
  font-weight: 700;
  text-align: right;
}
button.portion-value {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  font: inherit;
  font-weight: 700;
}
#portionUnitLabel {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.portion-value input,
.portion-value select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #0b3514;
  font-size: 16px;
  font-weight: 700;
  text-align: right;
}
.portion-value select { appearance: none; }
.portion-unit-list {
  display: grid;
  gap: 6px;
  margin: 8px 0 4px;
}
.portion-unit-list[hidden] { display: none; }
.portion-unit-list.is-open { animation: portionListIn var(--motion-fast) var(--ease-out) both; }
@keyframes portionListIn {
  from { opacity: 0; transform: translate3d(0, -6px, 0); }
  to { opacity: 1; transform: none; }
}
.portion-unit-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #e1e8df;
  border-radius: 12px;
  background: #f4f7f2;
  color: #102a16;
  font-weight: 700;
  text-align: left;
}
.portion-unit-option > span:last-child {
  min-width: 0;
  overflow-wrap: anywhere;
}
.portion-ico {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  color: #0b3514;
}
.portion-ico svg { display: block; width: 28px; height: 28px; }
.portion-ico.is-spoon { width: auto; gap: 2px; }
.portion-badge {
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
}
.portion-unit-option.is-selected {
  background: #0b3514;
  border-color: #0b3514;
  color: #fff;
}
.portion-unit-option.is-selected .portion-ico { color: #fff; }
.portion-totals {
  flex: none;
  background: #fff;
  padding-top: 10px;
}
.portion-ring { width: 148px; height: 148px; display: block; margin: 0 auto; }
.portion-ring text { font-family: inherit; }
#portionKcal { font-size: 28px; font-weight: 800; fill: #0b3514; }
.portion-ring-caption { font-size: 12px; font-weight: 700; fill: #647066; }
.portion-measure {
  margin: 0 0 8px;
  text-align: center;
  color: #647066;
  font-size: 13px;
  font-weight: 700;
}
.portion-macros {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  text-align: center;
}
.portion-macro b {
  display: block;
  color: #0b3514;
  font-size: 18px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.portion-macro b small { color: #647066; font-size: 12px; font-weight: 650; }
.portion-macro > span { display: block; margin-top: 2px; color: #102a16; font-weight: 800; }
.portion-macro em { display: block; margin-top: 2px; color: #647066; font-style: normal; font-size: 13px; font-weight: 700; }
.portion-compact {
  display: none;
  margin: 0 0 4px;
  color: #0b3514;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.4;
  text-align: center;
}
.portion-form-sheet.is-typing .portion-ring-wrap,
.portion-form-sheet.is-typing .portion-macros { display: none; }
.portion-form-sheet.is-typing .portion-compact { display: block; }
.portion-form-sheet.is-typing .portion-form { overflow: auto; flex: 1 1 auto; min-height: 0; }
.portion-form-sheet.is-typing .portion-scroll { overflow: visible; flex: none; }
@media (max-width: 430px) {
  .portion-form-sheet .portion-form { overflow: auto; }
  .portion-form-sheet .portion-scroll { overflow: visible; flex: none; }
}
