/* ======================= INÍCIO ======================= */

/* ---------- editando um dia que não é hoje ---------- */
.edit-day-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 12px 15px 0;
  padding: 8px 8px 8px 14px;
  border-radius: 12px;
  background: var(--tint-warn);
  color: var(--tint-warn-ink);
  font-size: 12.5px;
  font-weight: 700;
}
.edit-day-banner[hidden] {
  display: none;
}

.summary {
  padding: 15px;
}
.sm-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
}
.sm-kcal b {
  font-family: "Baloo 2", sans-serif;
  font-size: 32px;
  line-height: 1;
  color: var(--ink);
}
.sm-kcal span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.sm-left {
  text-align: right;
  flex: 0 0 auto;
}
.sm-left b {
  display: block;
  font-family: "Baloo 2", sans-serif;
  font-size: 20px;
  line-height: 1;
  color: var(--blue-solid);
}
.sm-left span {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}
.sm-left.over b {
  color: var(--danger);
}
.sm-planned {
  margin: 9px 0 0;
  font-size: 12px;
  color: var(--muted);
}
.sm-macros {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 9px;
  margin-top: 13px;
}
.sm-macro {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.smm-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}
.smm-label i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: 0 0 auto;
}
.sm-macro b {
  font-size: 14.5px;
  line-height: 1.15;
  white-space: nowrap;
}
.sm-macro b small {
  font-size: 10.5px;
  font-weight: 500;
  color: var(--muted);
}

.home-tabs {
  margin: 12px 0;
}

/* ---------- listas de hoje ---------- */
.today-list {
  display: flex;
  flex-direction: column;
}
.today-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--field);
}
.today-row:last-child {
  border-bottom: 0;
}
.tr-check {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 2px solid var(--line);
  background: var(--card-2);
  cursor: pointer;
  color: var(--on-accent);
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  display: grid;
  place-items: center;
  padding: 0;
}
.today-row.done .tr-check {
  background: var(--c-fiber);
  border-color: var(--c-fiber);
}
.tr-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.tr-name {
  font-size: 14.5px;
  font-weight: 600;
}
.tr-sub {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tr-kcal {
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 700;
  color: var(--blue-solid);
}
.today-row.done .tr-name {
  text-decoration: line-through;
  color: var(--muted);
}

/* ---------- itens da refeição ---------- */
.meal-row {
  flex-wrap: wrap;
}
.meal-row .tr-main {
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-align: left;
  color: inherit;
  align-items: flex-start;
}
.meal-row .tr-main::after {
  content: "▾";
  position: absolute;
  right: 0;
  color: var(--muted);
  font-size: 10px;
}
.meal-row.is-open .tr-main::after {
  content: "▴";
}
/* Sempre no DOM (é o alvo de soltura do arraste); a refeição fechada só
   esconde. Ver o comentário de updateMealRow em js/views/home.js. */
.tr-items {
  flex: 1 0 100%;
  display: none;
  flex-direction: column;
  gap: 4px;
  padding: 6px 0 2px 36px;
}
.meal-row.is-open .tr-items {
  display: flex;
}

/* Durante o arraste TODA refeição vira alvo, inclusive a fechada — que ganha
   uma faixa com altura de dedo no lugar da lista escondida. */
.dragging .tr-items {
  display: flex;
  min-height: 44px;
}
.dragging .meal-row:not(.is-open) .tr-items {
  border: 1px dashed var(--line);
  border-radius: 10px;
  align-items: center;
  justify-content: center;
}
.dragging .meal-row:not(.is-open) .tr-items::after {
  content: "soltar aqui";
  font-size: 11.5px;
  color: var(--muted);
}
/* com item dentro, o rótulo sai da frente */
.dragging .meal-row:not(.is-open) .tr-items:has(.item-check)::after {
  content: none;
}
.dragging .meal-row:not(.is-open) .tr-items .item-check {
  width: 100%;
}
.tr-items.sorting {
  background: var(--field);
  border-radius: 10px;
}
/* A linha é um contêiner com DOIS botões: o corpo (marca/desmarca) e o ⋮
   (ajustes de hoje). Ver o comentário de itemRow em js/views/home.js. */
.item-check {
  display: flex;
  align-items: center;
  /* 44px: alvo mínimo confortável com o celular na mão, de pé */
  min-height: 44px;
  background: var(--field);
  border-radius: 10px;
  padding-right: 3px;
}
.ic-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  background: none;
  border: 0;
  padding: 0 4px 0 11px;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  text-align: left;
}
.ic-more {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  font-size: 17px;
  color: var(--muted);
}
.ic-box {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  border: 2px solid var(--line);
  background: var(--card-2);
  color: var(--on-accent);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  display: grid;
  place-items: center;
}
.item-check.done .ic-box {
  background: var(--c-fiber);
  border-color: var(--c-fiber);
}
.ic-txt {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.ic-name {
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.item-check.done .ic-name {
  text-decoration: line-through;
  color: var(--muted);
}
.ic-qty {
  flex: 0 0 auto;
  font-size: 12px;
  color: var(--muted);
}

/* ---------- ajustes do dia (diet_day_overrides) ---------- */
/* A marca só aparece quando existe: linha vazia não ocupa altura, então o item
   sem desvio fica exatamente com a mesma cara de antes. */
.ic-tag {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ic-tag:empty {
  display: none;
}
.item-check.adjusted {
  box-shadow: inset 2px 0 0 var(--teal);
}
.item-check.skipped {
  opacity: 0.55;
}
.item-check.skipped .ic-name {
  text-decoration: line-through;
}
.item-check.skipped .ic-box {
  background: var(--card-2);
  border-color: var(--line);
  color: var(--muted);
}

/* ---------- folha "Só para hoje" (js/ui/diet-swap.js) ---------- */
.ds-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.ds-name {
  font-size: 15px;
}
.ds-sub {
  font-size: 12.5px;
  color: var(--muted);
}
.ds-opt {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  background: var(--field);
  border: 0;
  border-radius: 12px;
  padding: 8px 12px;
  margin-bottom: 6px;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  text-align: left;
}
.ds-opt.active {
  box-shadow: inset 0 0 0 2px var(--teal);
}
.ds-opt.off {
  opacity: 0.5;
  cursor: default;
}
.ds-mark {
  flex: 0 0 auto;
  font-size: 13px;
  color: var(--teal);
}
.ds-txt {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.ds-txt b {
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ds-txt span {
  font-size: 11.5px;
  color: var(--muted);
}
/* Tracejado de propósito: é a saída para fora da lista pronta, e ler como
   "mais uma opção" faria a pessoa procurar o alimento entre os substitutos. */
.ds-outro {
  width: 100%;
  min-height: 46px;
  background: none;
  border: 1px dashed var(--line);
  border-radius: 12px;
  margin-top: 2px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  color: var(--muted);
}
.ss-guardar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 13px;
  cursor: pointer;
}
.ss-guardar input {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  accent-color: var(--teal);
}
.ds-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.ds-chip {
  min-height: 40px;
  background: var(--field);
  border: 0;
  border-radius: 999px;
  padding: 0 14px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  color: inherit;
}
.ds-chip.is-back {
  color: var(--muted);
}
.ds-danger,
.ds-reset {
  width: 100%;
  min-height: 46px;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
}
.ds-danger {
  background: var(--tint-danger);
  color: var(--tint-danger-ink);
}
.ds-reset {
  margin-top: 8px;
  background: none;
  color: var(--muted);
  font-weight: 400;
}

/* ---------- séries do treino ---------- */
.ex-row {
  align-items: flex-start;
}
/* Largura calibrada para 4 pílulas caberem numa linha só — 3 e 4 séries é o
   caso comum, e uma quarta sozinha na linha de baixo deixa buraco e alonga a
   linha do exercício à toa. */
.set-pills {
  flex: 0 0 auto;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: 56%;
}
/* 42×40 em vez dos 28×28 antigos: este é o alvo que se acerta suado, de pé,
   entre séries — e agora ele carrega a carga junto com o número. */
.set-pill {
  min-width: 42px;
  height: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card-2);
  cursor: pointer;
  color: var(--muted);
  padding: 0 4px;
  font-family: inherit;
  touch-action: manipulation;
  transition: transform 0.12s ease;
}
.sp-n {
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}
.sp-kg {
  font-size: 9.5px;
  line-height: 1;
  opacity: 0.8;
}
.set-pill.done {
  background: var(--c-fiber);
  border-color: var(--c-fiber);
  color: var(--on-accent);
}
/* feedback do toque longo: o alvo encolhe enquanto o dedo segura */
.set-pill.longpress {
  transform: scale(0.9);
}
@media (prefers-reduced-motion: reduce) {
  .set-pill {
    transition: none;
  }
}
