:root {
  --food-c-bg: #f7f0e8;
  --food-c-panel: #fffdf8;
  --food-c-line: #d3c0b3;
  --food-c-text: #36261f;
  --food-c-wood: #5f3b2d;
  --food-c-green: #2f6f52;
  --food-c-red: #a82d3c;
}

.food-controller {
  position: relative;
  width: 100%;
  display: grid;
  gap: 5px;
  padding: 6px;
  border-top: 1px solid var(--food-c-line);
  color: var(--food-c-text);
  background: var(--food-c-bg);
  box-shadow: 0 -3px 14px rgba(63, 41, 32, .16);
}

.food-controller__selected-row {
  width: min(320px, 100%);
  min-width: 0;
  min-height: 34px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin-inline: auto;
}

.food-controller__resident-select {
  min-width: 0;
  width: 150px;
  height: 32px;
  overflow: hidden;
  padding: 0 24px 0 7px;
  border: 1px solid var(--food-c-line);
  border-radius: 4px;
  color: var(--food-c-text);
  background: var(--food-c-panel);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 900;
}

.food-controller__periods {
  display: grid;
  grid-template-columns: repeat(3, 25px);
  gap: 6px;
}

.food-controller button {
  min-width: 0;
  border: 1px solid var(--food-c-line);
  border-radius: 4px;
  color: var(--food-c-text);
  background: var(--food-c-panel);
  font: inherit;
  font-weight: 900;
}

.food-controller__periods button { width: 25px; height: 25px; padding: 0; font-size: 10px; }
.food-controller__periods button.is-active { border-color: var(--food-c-green); color: #fff; background: var(--food-c-green); }

.food-controller__fields {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px 0;
  margin-top: 10px;
}

.food-controller__field {
  width: 80px;
  min-width: 80px;
  display: grid;
  grid-template-columns: 20px 60px;
  align-items: center;
  gap: 0;
  font-size: 10px;
  font-weight: 900;
}

.food-controller__fields .food-controller__field > span {
  justify-self: stretch;
  line-height: 1.05;
  text-align: center;
  overflow-wrap: anywhere;
}

.food-wheel {
  position: relative;
  width: 100%;
  height: 40px;
  padding-block: 11px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  border: 2px solid var(--food-c-line);
  border-radius: 4px;
  background:
    linear-gradient(to bottom, rgba(31, 41, 55, .24), rgba(247, 240, 232, .1) 13px, transparent 14px),
    linear-gradient(to top, rgba(31, 41, 55, .24), rgba(247, 240, 232, .1) 13px, transparent 14px),
    var(--food-c-panel);
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}

.food-wheel::-webkit-scrollbar { display: none; }
.food-controller .food-wheel__option {
  width: 100%;
  height: 18px;
  display: block;
  padding: 0;
  scroll-snap-align: center;
  border: 0;
  border-radius: 0;
  color: #927e73;
  background: transparent;
  font-size: 10px;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
}

.food-controller .food-wheel__option.is-selected {
  color: var(--food-c-text);
  background: transparent;
  box-shadow: none;
  font-size: 15px;
  font-weight: 900;
}
.food-wheel[aria-disabled="true"] { opacity: .38; overflow-y: hidden; pointer-events: none; }

.food-controller__register-row {
  width: min(320px, 100%);
  display: flex;
  justify-content: center;
  gap: 60px;
  align-items: stretch;
  margin: 10px auto 20px;
  box-sizing: border-box;
}

.food-controller__register-row > button { width: 80px; height: 24px; align-self: end; font-size: 12px; }
.food-controller__nutrition.is-empty { visibility: hidden; }
.food-controller__nutrition > span { line-height: 1.15; text-align: center; }
.food-controller__medication.is-available { border-color: #b7791f; color: #7c4a03; background: #fff3c4; }
.food-controller__medication { position: relative; overflow: hidden; }
.food-controller__medication.is-pending,
.food-controller__medication.is-stamped { border-color: #b9a69a; color: var(--food-c-text); background: #fffaf2; box-shadow: inset 0 2px 4px rgba(63, 41, 32, .16); }
.food-controller__medication.is-skipped { color: #6b4f43; background: #e6ddd7; }
.food-controller__medication-label { position: relative; z-index: 1; }
.food-controller__medication-stamp {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 50%;
  min-width: 43px;
  max-width: calc(100% - 8px);
  padding: 3px 5px 2px;
  overflow: hidden;
  transform: translate(-50%, -50%) rotate(-9deg);
  border: 2px solid rgba(177, 28, 28, .78);
  border-radius: 50%;
  color: rgba(177, 28, 28, .86);
  background: rgba(255, 250, 242, .42);
  font-size: 11px;
  font-weight: 900;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.food-controller__medication-note { margin-left: 4px; font-size: 9px; }
.food-controller__register { border-color: var(--food-c-wood) !important; color: #fff !important; background: var(--food-c-wood) !important; }
.food-controller button:disabled { opacity: .38; }

.food-controller__status {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.food-staff-modal {
  position: fixed;
  z-index: 700;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 14px;
  background: rgba(32, 23, 19, .42);
}

.food-staff-modal.is-open { display: flex; }
.food-staff-modal__panel {
  width: min(360px, 100%);
  max-height: min(76dvh, 560px);
  display: grid;
  gap: 10px;
  padding: 12px;
  overflow: hidden;
  border: 1px solid var(--food-c-line);
  border-radius: 8px;
  color: var(--food-c-text);
  background: var(--food-c-panel);
  box-shadow: 0 14px 34px rgba(0, 0, 0, .26);
}

.food-staff-modal__list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  overflow-y: auto;
}

.food-staff-modal__list button,
.food-staff-modal__cancel {
  min-height: 42px;
  border: 1px solid var(--food-c-line);
  border-radius: 4px;
  color: var(--food-c-text);
  background: #fff;
  font-size: 12px;
  font-weight: 900;
}

.food-staff-modal__cancel { color: var(--food-c-red); }
