/* ======================= DIETA ======================= */

/* ---------- faixa de dias da semana ---------- */
.weekstrip {
  flex: 0 0 auto;
  display: flex;
  gap: 5px;
}
.wd-btn {
  flex: 1 1 0;
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--bar-bg);
  border-radius: 12px;
  padding: 7px 2px 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}
.wd-letter {
  font-weight: 700;
  font-size: 14px;
  color: var(--ink);
  line-height: 1.1;
}
.wd-kcal {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.1;
}
.wd-btn.today .wd-letter::after {
  content: "";
  display: block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--coral);
  margin: 1px auto 0;
}
.wd-btn.active {
  background: var(--blue);
  border-color: transparent;
  box-shadow: 0 6px 16px rgba(21, 101, 216, 0.32);
}
.wd-btn.active .wd-letter,
.wd-btn.active .wd-kcal {
  color: var(--on-accent);
}
.wd-btn.active.today .wd-letter::after {
  background: var(--card-2);
}

/* ---------- totais do dia ---------- */
.day-totals {
  padding: 14px;
}
.dt-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.dt-kcal {
  font-family: "Baloo 2", sans-serif;
  font-size: 26px;
  line-height: 1;
  color: var(--ink);
}
.dt-goal {
  font-size: 13px;
  color: var(--muted);
  margin-left: 4px;
}
.dt-pct {
  font-size: 13px;
  font-weight: 700;
  color: var(--blue-solid);
}
.dt-pct.over {
  color: var(--danger);
}
.dt-macros {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-top: 12px;
}
.dt-macro {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.dtm-top {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}
.dtm-top i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: 0 0 auto;
}
.dt-macro b {
  font-size: 14px;
  line-height: 1.15;
}
.dtm-goal {
  font-size: 10.5px;
  color: var(--muted);
  min-height: 13px;
}

/* média da semana — só os dias que têm dieta montada entram na conta */
.dt-avg {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin: 12px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}
.dta-label {
  flex: 1 1 100%;
  font-weight: 700;
  font-size: 11px;
}
.dt-avg b {
  font-size: 15px;
  color: var(--ink);
}
.dta-diff {
  margin-left: auto;
  font-weight: 700;
  color: var(--blue-solid);
}
.dta-diff.over {
  color: var(--danger);
}

/* ---------- refeição ---------- */
.meal {
  position: relative;
  background: var(--card);
  border-radius: 16px;
  box-shadow: var(--sh-md);
  padding: 12px;
  margin-top: 12px;
}
.meal-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.mh-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 7px;
}
.mh-name {
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mh-time {
  font-size: 12px;
  color: var(--muted);
  flex: 0 0 auto;
}
.mh-kcal {
  font-size: 13px;
  font-weight: 700;
  color: var(--blue-solid);
  flex: 0 0 auto;
}
.meal-menu {
  top: 42px;
  right: 8px;
}

/* ---------- item ---------- */
.items {
  display: flex;
  flex-direction: column;
}
.item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 0;
  border-bottom: 1px solid var(--field);
}
.item:last-child {
  border-bottom: 0;
}
.it-name {
  flex: 1 1 auto;
  min-width: 0;
  text-align: left;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  font-size: 14px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.it-name.stale {
  color: var(--muted);
  font-style: italic;
}
/* type=text + inputmode=decimal: o type=number rejeita vírgula no teclado
   pt-BR. 16px é obrigatório por causa do user-scalable=no. */
.it-qty {
  flex: 0 0 62px;
  width: 62px;
  text-align: right;
  background: var(--field);
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 6px 8px;
  font-size: 16px;
  color: var(--ink);
}
.it-qty:focus {
  background: var(--card-2);
  border-color: var(--line);
  outline: none;
}
.it-unit {
  flex: 0 0 auto;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  padding: 4px 2px;
  min-width: 22px;
}
/* 54px cabe "1.234 kcal". O que sobrou dos 62 originais foi para o nome do
   alimento, que ficou espremido quando a linha ganhou o botão de substitutos. */
.it-kcal {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  min-width: 54px;
  text-align: right;
}

/* Ícone dos substitutos. Apagado quando não há nenhum e aceso quando há —
   o estado precisa aparecer na linha, senão só se descobre abrindo. Mesmos
   28px do "×" ao lado: dois ícones vizinhos de tamanhos diferentes leem como
   hierarquia que não existe. */
.it-sub {
  width: 28px;
  height: 28px;
  font-size: 15px;
  color: var(--muted);
  opacity: 0.5;
}
.it-sub.tem {
  color: var(--teal);
  opacity: 1;
}

/* ---------- substitutos de um item ---------- */
.sub-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}
.sub-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-height: 46px;
  justify-content: center;
  background: var(--field);
  border: 0;
  border-radius: 12px;
  padding: 6px 12px;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  text-align: left;
}
.sub-main b {
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sub-main span {
  font-size: 11.5px;
  color: var(--muted);
}

/* ---------- passo do substituto ---------- */
.ss-qty {
  margin: 12px 0 8px;
  font-family: "Baloo 2", sans-serif;
  font-size: 26px;
  line-height: 1.1;
  text-align: center;
  color: var(--teal);
}
.ss-cmp {
  margin-top: 12px;
  background: var(--field);
  border-radius: 12px;
  padding: 4px 12px;
}
.ss-cmp-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
  border-top: 1px solid var(--line);
  font-size: 12px;
}
.ss-cmp-row:first-child {
  border-top: 0;
}
.ss-cmp-row > span:first-child {
  flex: 1;
  color: var(--muted);
}
.ss-cmp-row b {
  font-size: 12.5px;
  white-space: nowrap;
}
.it-del {
  width: 28px;
  height: 28px;
  font-size: 18px;
  color: var(--tint-danger-ink);
}

.add-item {
  margin-top: 10px;
  width: 100%;
  border-style: dashed;
  color: var(--blue-solid);
}

.day-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 14px 0 6px;
}

/* ---------- seletor de alimento ---------- */
.pick-list {
  display: flex;
  flex-direction: column;
  margin-top: 10px;
}
.pick-row {
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--field);
  cursor: pointer;
  padding: 10px 2px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Fica sempre no fim da lista, tracejado: é a saída para fora da base, não
   mais um alimento dela. Sem borda de baixo porque encerra a lista. */
.pk-novo {
  width: 100%;
  min-height: 46px;
  margin-top: 10px;
  background: none;
  border: 1px dashed var(--line);
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  color: var(--muted);
  padding: 0 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pick-row:active {
  background: var(--field);
}
.pk-name {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
}
.pk-sub {
  font-size: 12px;
  color: var(--muted);
}

.qs-preview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  background: var(--field);
  border-radius: 12px;
  padding: 12px;
  margin-top: 6px;
}
.qs-preview div {
  text-align: center;
  min-width: 0;
}
.qs-preview b {
  display: block;
  font-size: 16px;
  line-height: 1.2;
}
.qs-preview span {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}

/* ---------- base de alimentos ---------- */
.food-search {
  flex: 0 0 auto;
}
.food-cats {
  flex: 0 0 auto;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}
.food-cats::-webkit-scrollbar {
  display: none;
}
.food-cats .chip {
  flex: 0 0 auto;
}
.food-list {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border-radius: 16px;
  box-shadow: var(--sh-md);
  overflow: hidden;
}
.food-row {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--field);
  cursor: pointer;
  padding: 11px 12px;
}
.food-row:last-child {
  border-bottom: 0;
}
.food-row:active {
  background: var(--field);
}
.fr-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.fr-name {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
}
.fr-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}
.fr-kcal {
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 700;
  color: var(--blue-solid);
}
