/* ═══ SACOLA + PEDIDO EM ETAPAS ═══════════════════════════════════════════════
   Painel lateral em três faixas: cabeçalho (título + progresso) · etapa atual (rola) ·
   rodapé fixo com os botões principais — sempre ao alcance do polegar no celular. */
.bag { position: fixed; inset: 0; z-index: 166; }
.bag__backdrop {
  position: absolute; inset: 0; background: rgba(48, 40, 42, 0.42); opacity: 0; transition: opacity 0.5s;
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}
.bag__panel {
  --pad: clamp(1.25rem, 0.9rem + 1.4vw, 2rem);
  position: absolute; right: 0; top: 0; bottom: 0; width: min(500px, 100%); height: 100%; height: 100dvh;
  display: flex; flex-direction: column; background: var(--off);
  transform: translateX(102%); transition: transform 0.7s var(--ease-out);
  box-shadow: -30px 0 70px -30px rgba(63, 30, 35, 0.4);
}
.bag.is-open .bag__backdrop { opacity: 1; }
.bag.is-open .bag__panel { transform: none; }

/* cabeçalho */
.bag__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: 1.2rem var(--pad) 0.8rem; }
.bag__eyebrow { font-size: 0.78rem; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--rose); margin-bottom: 0.35rem; }
.bag__head h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(1.8rem, 1.5rem + 0.9vw, 2.2rem); line-height: 1.05; outline: none; }
.bag__head h2 span { font-family: var(--sans); font-size: 0.95rem; color: var(--ink-3); letter-spacing: 0.02em; }
.bag__close { flex: none; margin: -0.2rem -0.5rem 0 0; }

/* indicador de progresso: pontos ligados por um fio que se preenche */
.steps { position: relative; padding: 0.2rem var(--pad) 1rem; border-bottom: 1px solid var(--line); }
.steps ol { position: relative; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.steps__track { position: absolute; top: calc(0.2rem + 10px); left: calc(var(--pad) + (100% - 2 * var(--pad)) * 0.1); right: calc(var(--pad) + (100% - 2 * var(--pad)) * 0.1); height: 1px; background: var(--line-2); }
.steps__track span { position: absolute; inset: 0; background: var(--wine); transform: scaleX(0); transform-origin: left; transition: transform 0.7s var(--ease-out); }
.steps__item button { display: grid; justify-items: center; gap: 0.45rem; width: 100%; padding: 0; color: var(--ink-3); transition: color 0.4s; }
.steps__item button:not(:disabled) { cursor: pointer; }
.steps__item button:not(:disabled):hover { color: var(--wine); }
.steps__item button:disabled { cursor: default; }
.steps__dot {
  position: relative; z-index: 1; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%;
  background: var(--off); border: 1px solid var(--line-2); color: var(--off);
  transition: background 0.45s var(--ease-out), border-color 0.45s, box-shadow 0.45s, transform 0.45s var(--ease-out);
}
.steps__dot svg { width: 12px; height: 12px; opacity: 0; transform: scale(0.5); transition: opacity 0.3s, transform 0.4s var(--ease-out); stroke-width: 2; }
.steps__label { font-size: 0.8rem; letter-spacing: 0.02em; white-space: nowrap; }
.steps__item.is-done .steps__dot { background: var(--wine); border-color: var(--wine); }
.steps__item.is-done .steps__dot svg { opacity: 1; transform: none; }
.steps__item.is-done button { color: var(--ink-2); }
.steps__item.is-current .steps__dot { border-color: var(--wine); box-shadow: 0 0 0 4px rgba(110, 58, 65, 0.12); transform: scale(1.08); }
.steps__item.is-current .steps__dot::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--wine); }
.steps__item.is-current button { color: var(--wine); font-weight: 600; }
.bag.is-empty .steps { display: none; }

/* área da etapa e rodapé */
.bag__form { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.bag__stage {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0.2rem var(--pad) 1.2rem;
  scrollbar-width: thin; scrollbar-color: rgba(110, 58, 65, 0.25) transparent;
}
.bag__stage::-webkit-scrollbar { width: 6px; }
.bag__stage::-webkit-scrollbar-thumb { background: rgba(110, 58, 65, 0.22); border-radius: 6px; }
.bag__foot {
  display: grid; gap: 0.8rem; padding: 1.1rem var(--pad) max(1.2rem, env(safe-area-inset-bottom));
  background: var(--off-2); border-top: 1px solid var(--line);
}
.bag__foot[hidden] { display: none; }

/* botões */
.bag-cta { width: 100%; min-height: 56px; }
.bag-cta:active { transform: scale(0.985); }
.bag-cta .btn__icon { width: 20px; height: 20px; }
.bag-keep { justify-self: center; font-size: 0.92rem; }
.bag-nav { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0.7rem; }
.bag-back { min-height: 56px; padding: 0 1.2rem 0 0.9rem; gap: 0.3rem; }
.bag-back svg { width: 20px; height: 20px; position: relative; z-index: 1; transition: transform 0.4s var(--ease-out); }
@media (hover: hover) { .bag-back:hover svg { transform: translateX(-3px); } }
.bag-mini { display: flex; justify-content: space-between; align-items: baseline; font-size: 0.9rem; color: var(--ink-2); }
.bag-mini strong { font-family: var(--serif); font-size: 1.25rem; font-weight: 500; color: var(--wine); margin-left: 0.35rem; }

/* ─── Etapa 1: peças ─── */
.bag-lines { display: grid; }
.bag-line {
  position: relative; display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 1.2rem;
  padding: 1.15rem 0; border-bottom: 1px solid var(--line); overflow: hidden;
}
.bag-line:last-child { border-bottom: 0; }
.bag-line__img { display: block; width: 112px; aspect-ratio: 3 / 4; border-radius: var(--r-md); overflow: hidden; background: var(--blush); }
.bag-line__img img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.2s var(--ease-out); }
@media (hover: hover) { .bag-line:hover .bag-line__img img { transform: scale(1.05); } }
.bag-line__info { display: flex; flex-direction: column; gap: 0.55rem; min-width: 0; }
.bag-line__name { font-family: var(--serif); font-size: 1.32rem; line-height: 1.12; padding-right: 2.4rem; transition: color 0.3s; }
.bag-line__name:hover { color: var(--wine); }
.bag-line__unit { font-size: 0.9rem; color: var(--ink-3); margin-top: -0.25rem; }
.bag-line__opts { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.bag-sel {
  position: relative; display: inline-flex; align-items: center; gap: 0.35rem; min-height: 38px; padding: 0 0.85rem;
  border-radius: 999px; border: 1px solid var(--line-2); font-size: 0.88rem; color: var(--ink); transition: border-color 0.3s;
}
.bag-sel:hover, .bag-sel:focus-within { border-color: var(--wine); }
.bag-sel__k { color: var(--ink-3); font-size: 0.82rem; }
.bag-sel select { appearance: none; -webkit-appearance: none; border: 0; background: transparent; padding: 0 1.1rem 0 0; font: inherit; color: inherit; cursor: pointer; outline: none; }
.bag-sel svg { position: absolute; right: 0.7rem; width: 12px; height: 12px; pointer-events: none; color: var(--wine); }
.bag-sel--fixed { background: var(--off-2); border-color: transparent; }
.bag-line__row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.6rem 1rem; margin-top: auto; padding-top: 0.2rem; }
.bag-line__price { font-weight: 600; font-size: 1rem; }
.bag-line__remove {
  position: absolute; top: 1rem; right: 0; width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; color: var(--ink-3); transition: background 0.3s, color 0.3s, transform 0.3s var(--ease-out);
}
.bag-line__remove svg { width: 16px; height: 16px; }
.bag-line__remove:hover { background: var(--blush); color: var(--wine); transform: rotate(90deg); }
.bag-sum { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; }
.bag-sum__n { font-size: 0.95rem; color: var(--ink-2); padding-bottom: 0.3rem; }
.bag-sum__v { display: grid; justify-items: end; }
.bag-sum__v small { font-size: 0.8rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); }
.bag-sum__v strong { font-family: var(--serif); font-size: 2.1rem; line-height: 1.05; font-weight: 500; color: var(--wine); }

/* quantidade (também usada na página de produto) */
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line-2); border-radius: 999px; height: 52px; }
.qty button { width: 44px; height: 100%; font-size: 1.2rem; color: var(--wine); border-radius: 999px; transition: background 0.3s; }
.qty button:hover:not(:disabled) { background: var(--blush); }
.qty button:disabled { color: var(--ink-3); opacity: 0.45; cursor: not-allowed; }
.qty output { min-width: 1.6rem; text-align: center; font-weight: 600; }
.qty--sm { height: 40px; }
.qty--sm button { width: 38px; font-size: 1.05rem; }

/* vazia */
.bag-empty { display: grid; justify-items: center; gap: 1rem; padding: 4.5rem 1rem; text-align: center; }
.bag-empty__icon { width: 68px; height: 68px; border-radius: 50%; display: grid; place-items: center; background: var(--blush); color: var(--wine); }
.bag-empty__icon svg { width: 28px; height: 28px; }
.bag-empty .serif { font-size: 1.9rem; line-height: 1.1; }
.bag-empty p:not(.serif) { color: var(--ink-2); max-width: 21rem; }

/* ─── Etapas 2 e 3: campos ─── */
.bag-intro { color: var(--ink-2); font-size: 0.98rem; margin: 1.1rem 0 1.4rem; max-width: 26rem; }
.bag-fields { display: grid; gap: 1.1rem; }
.field { display: grid; gap: 0.45rem; min-width: 0; }
.field__label { font-size: 0.8rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); }
.field__label i { font-style: normal; font-weight: 500; letter-spacing: 0.02em; text-transform: none; color: var(--ink-3); margin-left: 0.25rem; }
.field input, .field select {
  width: 100%; min-width: 0; min-height: 54px; padding: 0 1.05rem; font-size: 1rem; color: var(--ink);
  border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--white);
  transition: border-color 0.3s, box-shadow 0.3s, background-color 0.3s;
}
.field input::placeholder { color: var(--ink-3); opacity: 0.75; }
.field select {
  appearance: none; -webkit-appearance: none; padding-right: 2.2rem; cursor: pointer;
  background: var(--white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%236E3A41' stroke-width='1.4'/%3E%3C/svg%3E") no-repeat right 0.9rem center / 12px;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--wine); box-shadow: 0 0 0 4px rgba(110, 58, 65, 0.12); }
.field [aria-invalid="true"] { border-color: #A3343F; background-color: #FFF8F8; }
.field__err { font-style: normal; font-size: 0.86rem; color: #A3343F; }
.field__err:empty { display: none; }
.field__hint { font-size: 0.86rem; color: var(--ink-3); }
.field__hint:empty { display: none; }
.field__hint[data-state="loading"] { color: var(--ink-2); }
.field__hint[data-state="ok"] { color: #4E6B4C; }
.field__hint[data-state="warn"] { color: #8A5A1F; }
.field input.is-filled { animation: af-filled 1.3s var(--ease-out); }
@keyframes af-filled { 0% { background-color: var(--blush); } 100% { background-color: var(--white); } }
.field-row { display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr); gap: 0.8rem; align-items: start; }
.field-row--uf { grid-template-columns: minmax(0, 1fr) 6.6rem; }
.field-cep { display: grid; gap: 0.3rem; }
.field-cep__help { justify-self: start; font-size: 0.86rem; color: var(--wine); text-decoration: underline; text-underline-offset: 3px; }

/* ─── Etapa 4: pagamento em cartões ─── */
.pay { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.8rem; border-radius: var(--r-md); }
.pay-card { position: relative; display: block; cursor: pointer; }
.pay-card input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.pay-card__box {
  position: relative; display: grid; align-content: start; gap: 0.3rem; height: 100%; min-height: 132px; padding: 1.15rem 1.1rem;
  border-radius: var(--r-md); border: 1px solid var(--line-2); background: var(--white);
  transition: border-color 0.4s var(--ease-out), background-color 0.4s, box-shadow 0.5s var(--ease-out), transform 0.5s var(--ease-out);
}
.pay-card__icon { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 0.5rem; border-radius: 50%; background: var(--off-2); color: var(--wine); transition: background 0.4s, color 0.4s; }
.pay-card__icon svg { width: 24px; height: 24px; }
.pay-card__name { font-size: 1rem; font-weight: 600; color: var(--ink); line-height: 1.25; }
.pay-card__note { font-size: 0.84rem; color: var(--ink-3); line-height: 1.35; }
.pay-card__check {
  position: absolute; top: 0.9rem; right: 0.9rem; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  border: 1px solid var(--line-2); color: var(--off); transition: background 0.35s, border-color 0.35s;
}
.pay-card__check svg { width: 14px; height: 14px; stroke-width: 2; transform: scale(0); transition: transform 0.4s var(--ease-out); }
@media (hover: hover) { .pay-card:hover .pay-card__box { border-color: rgba(110, 58, 65, 0.45); transform: translateY(-2px); } }
.pay-card input:checked + .pay-card__box {
  border-color: var(--wine); background: linear-gradient(160deg, #FFFFFF 0%, var(--blush) 140%);
  box-shadow: 0 0 0 1px var(--wine), 0 16px 32px -20px rgba(63, 30, 35, 0.55); transform: translateY(-2px);
}
.pay-card input:checked + .pay-card__box .pay-card__icon { background: var(--wine); color: var(--off); }
.pay-card input:checked + .pay-card__box .pay-card__check { background: var(--wine); border-color: var(--wine); }
.pay-card input:checked + .pay-card__box .pay-card__check svg { transform: none; }
.pay-card input:focus-visible + .pay-card__box { box-shadow: 0 0 0 4px rgba(110, 58, 65, 0.2); }
[data-pay-group][aria-invalid="true"] .pay-card__box { border-color: #A3343F; }
.pay-err { display: block; margin-top: 0.7rem; }
.troco { margin-top: 1.2rem; }
.troco[hidden] { display: none; }
.bag-safe { display: flex; gap: 0.6rem; align-items: flex-start; margin-top: 1.6rem; font-size: 0.88rem; color: var(--ink-2); }
.bag-safe svg { flex: none; width: 20px; height: 20px; color: var(--wine); }

/* ─── Etapa 5: revisão ─── */
.rv { padding: 1.2rem 0; border-bottom: 1px solid var(--line); }
.rv__head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 0.7rem; }
.rv__head h3 { font-family: var(--serif); font-weight: 500; font-size: 1.3rem; }
.rv__head h3 span { font-family: var(--sans); font-size: 0.9rem; color: var(--ink-3); font-weight: 400; }
.rv__edit { font-size: 0.9rem; color: var(--wine); text-decoration: underline; text-decoration-color: rgba(110, 58, 65, 0.35); text-underline-offset: 4px; transition: text-decoration-color 0.3s; }
.rv__edit:hover { text-decoration-color: currentColor; }
.rv__txt { color: var(--ink-2); font-size: 0.98rem; line-height: 1.6; overflow-wrap: anywhere; }
.rv__pay { display: flex; align-items: center; gap: 0.7rem; color: var(--ink); }
.rv__pay-ic { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--blush); color: var(--wine); }
.rv__pay-ic svg { width: 20px; height: 20px; }
.rv-items { display: grid; gap: 0.8rem; }
.rv-items li { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 0.9rem; align-items: center; }
.rv-items img { width: 52px; aspect-ratio: 3 / 4; height: auto; object-fit: cover; border-radius: var(--r-sm); background: var(--blush); }
.rv-items__txt { display: grid; gap: 0.15rem; min-width: 0; }
.rv-items__txt b { font-weight: 500; font-size: 0.98rem; line-height: 1.3; }
.rv-items__txt span { font-size: 0.86rem; color: var(--ink-3); }
.rv-items strong { font-weight: 600; font-size: 0.95rem; white-space: nowrap; }
.rv-total {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-top: 1.4rem; padding: 1.2rem 1.3rem;
  border-radius: var(--r-md); background: var(--white); border: 1px solid rgba(110, 58, 65, 0.14);
}
.rv-total span { font-size: 0.82rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-2); }
.rv-total strong { font-family: var(--serif); font-size: 2.1rem; font-weight: 500; color: var(--wine); line-height: 1; }
.bag-note { margin-top: 1rem; font-size: 0.88rem; color: var(--ink-3); line-height: 1.5; }

/* ─── Conclusão ─── */
.done { display: grid; justify-items: center; gap: 1rem; padding: 2.6rem 0.4rem 1rem; text-align: center; }
.done__mark { display: grid; place-items: center; width: 78px; height: 78px; border-radius: 50%; background: var(--wine); color: var(--off); box-shadow: 0 0 0 10px rgba(110, 58, 65, 0.1); margin-bottom: 0.4rem; }
.done__mark svg { width: 36px; height: 36px; stroke-width: 1.8; }
.done__title { font-size: 2rem; line-height: 1.1; }
.done > p:not(.serif) { color: var(--ink-2); max-width: 24rem; }
.done__row { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.6rem; margin-top: 0.4rem; }
.done__msg { width: 100%; margin-top: 0.6rem; text-align: left; }
.done__msg summary { cursor: pointer; font-size: 0.92rem; color: var(--wine); text-align: center; list-style: none; }
.done__msg summary::-webkit-details-marker { display: none; }
.done__msg textarea {
  width: 100%; margin-top: 0.8rem; resize: vertical; padding: 0.9rem; border-radius: var(--r-sm); border: 1px solid var(--line-2);
  font: 0.86rem/1.55 var(--sans); color: var(--ink-2); background: var(--white);
}

/* ─── telas menores ─── */
@media (max-width: 560px) {
  .bag__panel { width: 100%; }
  .bag-line { grid-template-columns: 96px minmax(0, 1fr); gap: 1rem; padding: 1.2rem 0; }
  .bag-line__img { width: 96px; }
  .bag-line__name { font-size: 1.2rem; }
  .bag-line__remove { top: 1rem; }
  .bag-sel { min-height: 36px; padding: 0 0.75rem; font-size: 0.86rem; }
  .bag__foot { gap: 0.6rem; padding-top: 0.9rem; }
  .bag-sum__v strong { font-size: 1.85rem; }
  .pay-card__box { min-height: 124px; padding: 1rem 0.95rem; }
}
@media (max-width: 400px) {
  .steps__item:not(.is-current) .steps__label { opacity: 0; }
  .steps__item.is-current .steps__label { overflow: visible; }
  .bag-back .btn__label { display: none; }
  .bag-back { padding: 0 1rem; }
  .pay { gap: 0.6rem; }
  .pay-card__note { display: none; }
  .pay-card__box { min-height: 112px; }
}
@media (max-width: 340px) { .field-row:not(.field-row--uf) { grid-template-columns: minmax(0, 1fr); } }
@media (prefers-reduced-motion: reduce) { .field input.is-filled { animation: none; } }
@media (max-width: 360px) {
  .bag-cta { padding-inline: 0.9rem; letter-spacing: 0.06em; }
  .bag-nav .bag-cta .btn__icon { display: none; }
  .bag-cta .btn__label { white-space: nowrap; }
}

/* ─── avisos ligados ao estoque e ao registro do pedido ─── */
.bag-line__warn { flex-basis: 100%; margin: 0; font-size: 0.86rem; color: #A3343F; }
.bag-line__price .price-was { font-weight: 400; }
.bag-alert { margin-top: 1rem; padding: 0.9rem 1rem; border-radius: var(--r-sm); background: #FFF4F4; border: 1px solid rgba(163, 52, 63, 0.25); color: #8E2B35; font-size: 0.92rem; line-height: 1.5; }
.bag-alert[hidden] { display: none; }
.bag-alert .text-btn { margin-left: 0.3rem; color: var(--wine); font-weight: 600; }
.done__code { font-size: 0.95rem; color: var(--ink-2); letter-spacing: 0.02em; }
.done__code b { color: var(--wine); font-weight: 600; letter-spacing: 0.06em; }
.bag-cta:disabled { opacity: 0.75; cursor: progress; }
