/* ===== Base ===== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--f-texto);
  font-size: 16px;
  line-height: 1.45;
  color: var(--ameixa);
  background: var(--creme) url('../assets/papel.webp') repeat;
  background-size: 256px;
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 { font-family: var(--f-titulo); font-weight: 700; line-height: 1.15; margin: 0; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
p { margin: 0; }
a { color: inherit; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--malva-texto); font-size: .9rem; }
.hand { font-family: var(--f-mao); font-size: 1.3rem; }
.ico { width: 22px; height: 22px; display: inline-block; vertical-align: middle; flex: none; }

/* ===== Estrutura ===== */
.topbar {
  position: sticky; top: 0; z-index: 20;
  height: calc(var(--topbar) + var(--safe-t));
  padding: var(--safe-t) var(--e4) 0;
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(251,225,236,.92);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: var(--traco);
}
.brand { font-family: var(--f-titulo); font-size: 1.35rem; font-weight: 700; text-decoration: none; }
.brand em { font-style: italic; font-weight: 500; color: var(--alerta); }
.sync-btn { display: flex; align-items: center; gap: 6px; font-size: .78rem; text-decoration: none; color: var(--malva-texto); }
.sync-btn .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--malva); }
.sync-btn .dot.ok { background: #6FBF8E; }
.sync-btn .dot.pend { background: var(--rosa); }

.view {
  max-width: 720px; margin: 0 auto;
  padding: var(--e4) var(--e4) calc(var(--tabbar) + var(--safe-b) + var(--e6));
  outline: none;
}
.view > * + * { margin-top: var(--e5); }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  height: calc(var(--tabbar) + var(--safe-b));
  padding-bottom: var(--safe-b);
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--creme);
  border-top: var(--traco);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: .7rem; text-decoration: none; color: var(--malva-texto);
}
.tabbar a .ico { width: 24px; height: 24px; }
.tabbar a.on { color: var(--ameixa); font-weight: 700; }
.tabbar a.on .ico { color: var(--alerta); }

/* ===== Título de seção com etiqueta manuscrita ===== */
.sec-title { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--e3); margin-bottom: var(--e3); }
.sec-title .lead { display: flex; flex-direction: column; gap: 2px; }
.sec-title a { font-size: .85rem; color: var(--malva-texto); white-space: nowrap; }

/* fita washi — assinatura visual (preto ameixa + rosa, como a referência) */
.washi {
  display: inline-block; align-self: flex-start;
  font-family: var(--f-mao); font-size: 1.2rem; line-height: 1;
  color: var(--rosa); background: var(--ameixa);
  padding: 4px 12px 5px; border-radius: 6px;
  transform: rotate(-2.5deg);
}
.washi.lilas { background: var(--lavanda); color: var(--ameixa); }
.washi.rosa { background: var(--blush); color: var(--ameixa); }

/* ===== Botões ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 20px;
  border: var(--traco); border-radius: 999px;
  background: var(--rosa); color: var(--ameixa);
  font-weight: 700; text-decoration: none; cursor: pointer;
  box-shadow: var(--sombra);
  transition: transform .08s, box-shadow .08s;
}
.btn:active { transform: scale(.97); }
.btn.sec { background: var(--lilas); }
.btn.ghost { background: transparent; box-shadow: none; border-color: transparent; color: var(--malva-texto); }
.btn.danger { background: var(--bebe); color: var(--alerta); border-color: var(--alerta); box-shadow: none; }
.btn.block { width: 100%; }
.btn.sm { min-height: 36px; padding: 0 14px; font-size: .88rem; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%;
  display: inline-grid; place-items: center;
  border: var(--traco); background: var(--creme); cursor: pointer; text-decoration: none;
}
.fab {
  position: fixed; right: var(--e4); z-index: 15;
  bottom: calc(var(--tabbar) + var(--safe-b) + var(--e4));
  width: 58px; height: 58px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--rosa); border: var(--traco); box-shadow: var(--sombra);
}
.fab .ico { width: 28px; height: 28px; }
.row { display: flex; gap: var(--e3); align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }

/* ===== Cards ===== */
.card {
  background: var(--branco);
  border: var(--traco); border-radius: var(--r-m);
  box-shadow: var(--sombra);
  padding: var(--e4);
}
.card.bebe { background: var(--bebe); }
.card.lilas { background: var(--lilas); }
.stack > * + * { margin-top: var(--e3); }

/* Estatísticas */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--e3); }
.stat { text-align: center; padding: var(--e3) var(--e2); text-decoration: none; }
.stat b { display: block; font-family: var(--f-titulo); font-size: 1.7rem; line-height: 1; }
.stat span { font-size: .78rem; color: var(--malva-texto); }

/* ===== Banner editorial (única área em colagem) ===== */
.banner {
  position: relative; overflow: hidden;
  min-height: 210px;
  border: var(--traco); border-radius: var(--r-l);
  background: var(--degrade);
  box-shadow: var(--sombra);
  padding: var(--e5) var(--e4);
  display: grid; grid-template-columns: 1fr 50%; align-items: end;
}
.banner .blob { position: absolute; border-radius: 50%; filter: blur(1px); opacity: .75; }
.banner .b1 { width: 180px; height: 150px; background: var(--lavanda); right: -30px; top: -40px; }
.banner .b2 { width: 120px; height: 120px; background: var(--bebe); left: -30px; bottom: -40px; }
.banner .b3 { width: 70px; height: 70px; background: var(--creme); right: 38%; top: 18px; opacity: .6; }
.banner .copy { position: relative; z-index: 2; align-self: center; }
.banner .copy h1 { font-size: 1.6rem; margin: 8px 0 6px; }
.banner .copy h1 em { font-weight: 500; }
.banner .copy p { font-size: .9rem; }
.banner .art { position: relative; z-index: 1; align-self: end; margin: 0 -8px -24px 0; }
.banner .art .ilus { width: 100%; height: auto; display: block; }
.banner .art .ilus-slot { aspect-ratio: 1; margin: 0 8px 24px 0; }
.banner.lilas { background: linear-gradient(120deg, var(--lilas), var(--azul)); }
.banner.bebe { background: var(--bebe); }

/* Divisor de bolhas (sabão) */
.lace-divider {
  height: 16px; margin: var(--e5) 0;
  background:
    radial-gradient(circle at 8px 8px, transparent 4px, var(--lavanda) 4.5px, var(--lavanda) 5.5px, transparent 6px) 0 0 / 40px 16px repeat-x,
    radial-gradient(circle at 28px 10px, var(--blush) 2.5px, transparent 3px) 0 0 / 40px 16px repeat-x;
  opacity: .8;
}

/* ===== Espaços de ilustração ===== */
.ilus { display: block; max-width: 100%; height: auto; }
.ilus-slot {
  width: 100%; display: grid; place-items: center; text-align: center;
  padding: 12px; border-radius: 24px;
  border: 1.5px dashed var(--malva);
  background: rgba(255,252,250,.55);
  font-family: var(--f-mao); font-size: 1.05rem; line-height: 1.15; color: var(--malva-texto);
}
.ilus-slot span::before { content: 'ilustração'; display: block; font-family: var(--f-texto); font-size: .62rem; letter-spacing: .12em; text-transform: uppercase; margin-bottom: 4px; }

/* ===== Etiquetas ===== */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 10px; border-radius: 999px;
  font-size: .75rem; font-weight: 700;
  background: var(--lilas); border: 1px solid var(--linha);
  white-space: nowrap;
}
.tag.st-cheio { background: var(--menta); }
.tag.st-medio { background: var(--lilas); }
.tag.st-baixo { background: var(--blush); }
.tag.st-esgotado { background: var(--ameixa); color: var(--blush); }
.tag.warn { background: var(--creme); color: var(--alerta); border-color: var(--alerta); }
.tag.soft { background: var(--bebe); border-color: var(--malva); font-weight: 500; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }

/* Chips de categoria (rolagem horizontal) */
.chips { display: flex; gap: var(--e2); overflow-x: auto; padding: 4px 2px 8px; margin: 0 calc(-1 * var(--e4)); padding-inline: var(--e4); scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  height: 38px; padding: 0 14px 0 6px;
  border: var(--traco); border-radius: 999px; background: var(--creme);
  font-size: .85rem; cursor: pointer; white-space: nowrap;
}
.chip svg { width: 26px; height: 26px; }
.chip.no-ico { padding-left: 14px; }
.chip.on { background: var(--rosa); font-weight: 700; }
.chip-check { display: inline-flex; }
.chip-check input { position: absolute; opacity: 0; pointer-events: none; }
.chip-check span { padding: 6px 12px; border: 1px solid var(--linha); border-radius: 999px; font-size: .85rem; background: var(--creme); cursor: pointer; }
.chip-check input:checked + span { background: var(--blush); font-weight: 700; }

/* Segmentado */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: var(--traco); border-radius: 999px; overflow: hidden; background: var(--creme); }
.seg button, .seg label { border: 0; background: none; padding: 9px 4px; font-size: .82rem; cursor: pointer; text-align: center; }
.seg button + button, .seg label + label { border-left: 1px solid var(--linha); }
.seg .on, .seg input:checked + span { background: var(--blush); font-weight: 700; }
.seg label { padding: 0; display: flex; }
.seg label span { flex: 1; padding: 9px 4px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }

/* ===== Card de produto ===== */
.grid-produtos { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--e4); }
@media (min-width: 560px) { .grid-produtos { grid-template-columns: repeat(3, 1fr); } }
.pcard {
  display: flex; flex-direction: column;
  background: var(--branco); border: var(--traco); border-radius: var(--r-m);
  box-shadow: var(--sombra); overflow: hidden; text-decoration: none;
}
.pcard .pic {
  position: relative; aspect-ratio: 1 / .9;
  display: grid; place-items: center;
  border-bottom: var(--traco);
}
.pcard .pic svg { width: 58%; height: auto; }
.pcard .pic .tag { position: absolute; top: 8px; left: 8px; }
.pcard .info { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 2px; }
.pcard .info b { font-size: .95rem; line-height: 1.2; }
.pcard .info span { font-size: .78rem; color: var(--malva-texto); }
.pcard.esgotado .pic { filter: grayscale(.7); opacity: .7; }

/* Moldura oval para fotos */
.oval {
  width: 72%; aspect-ratio: 3 / 4; border-radius: 50%;
  overflow: hidden; border: var(--traco);
  box-shadow: 0 0 0 5px var(--creme), 0 0 0 6.5px var(--linha);
  background: var(--bebe);
}
.oval img { width: 100%; height: 100%; object-fit: cover; }
.pcard .oval { width: 62%; }

/* Lista compacta */
.list { list-style: none; margin: 0; padding: 0; }
.list li + li { border-top: 1px dashed var(--malva); }
.list a, .list .li {
  display: flex; align-items: center; gap: var(--e3);
  padding: 10px 2px; text-decoration: none;
}
.list .mini { width: 40px; height: 40px; flex: none; border-radius: 12px; display: grid; place-items: center; border: 1px solid var(--linha); }
.list .mini svg { width: 70%; }
.list .grow { flex: 1; min-width: 0; }
.list .grow b { display: block; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Detalhe */
.detail-hero {
  position: relative; display: grid; place-items: center;
  padding: var(--e5) var(--e4) var(--e6);
  border: var(--traco); border-radius: var(--r-l); box-shadow: var(--sombra);
}
.detail-hero svg.frasco { width: 120px; height: auto; }
.detail-hero .oval { width: 52%; max-width: 240px; }
.dl { display: grid; grid-template-columns: 1fr; gap: 10px; margin: 0; }
.dl div { display: grid; gap: 2px; }
.dl dt { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--malva-texto); }
.dl dd { margin: 0; white-space: pre-wrap; word-break: break-word; }

/* ===== Formulários ===== */
.form { display: grid; gap: var(--e4); }
.field { display: grid; gap: 6px; }
.field > span { font-size: .85rem; font-weight: 700; }
.field small { color: var(--malva-texto); font-size: .78rem; }
.input, select.input, textarea.input {
  width: 100%; min-height: 46px; padding: 10px 14px;
  border: var(--traco); border-radius: var(--r-s);
  background: var(--creme); font-size: 16px; /* evita zoom no iPhone */
  appearance: none; -webkit-appearance: none;
}
select.input { background-image: linear-gradient(45deg, transparent 50%, var(--ameixa) 50%), linear-gradient(135deg, var(--ameixa) 50%, transparent 50%); background-position: calc(100% - 20px) 20px, calc(100% - 14px) 20px; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 36px; }
textarea.input { min-height: 96px; resize: vertical; }
.input:focus { outline: 3px solid var(--blush); outline-offset: 1px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: var(--e3); }
.search { position: relative; }
.search .ico { position: absolute; left: 14px; top: 12px; color: var(--malva-texto); }
.search .input { padding-left: 44px; border-radius: 999px; }
.photo-pick { display: flex; align-items: center; gap: var(--e4); }
.photo-pick .oval { width: 84px; flex: none; }
.photo-pick .oval .ph { width: 100%; height: 100%; display: grid; place-items: center; color: var(--malva); }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { font-size: .85rem; font-weight: 700; padding: 0; margin-bottom: 6px; }

/* ===== Estado vazio ===== */
.empty { text-align: center; display: grid; justify-items: center; gap: var(--e3); padding: var(--e5) var(--e4); }
.empty .art { width: 170px; }
.empty .art .ilus { width: 100%; height: auto; }
.empty .art .ilus-slot { aspect-ratio: 1; }
.empty p { max-width: 32ch; }

/* ===== Grade de módulos ===== */
.mod-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--e3); }
.mod {
  position: relative; display: flex; flex-direction: column; gap: 6px;
  padding: var(--e3); min-height: 120px;
  border: var(--traco); border-radius: var(--r-m); background: var(--branco);
  text-decoration: none; box-shadow: var(--sombra);
}
.mod .mi { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; border: 1px solid var(--linha); }
.mod .mi .ico { width: 24px; height: 24px; }
.mod b { font-size: .95rem; }
.mod small { font-size: .74rem; color: var(--malva-texto); line-height: 1.3; }
.mod .tag { position: absolute; top: 10px; right: 10px; font-size: .62rem; }

/* ===== Folha inferior e toast ===== */
.sheet { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; background: rgba(41,32,43,.38); }
.sheet .panel {
  width: 100%; max-width: 560px;
  background: var(--creme); border: var(--traco); border-bottom: 0;
  border-radius: var(--r-l) var(--r-l) 0 0;
  padding: var(--e5) var(--e4) calc(var(--e5) + var(--safe-b));
  animation: up .18s ease-out;
}
.sheet .panel h3 { margin-bottom: 6px; }
.sheet .panel .row { margin-top: var(--e4); }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
.toast {
  position: fixed; left: 50%; z-index: 60;
  bottom: calc(var(--tabbar) + var(--safe-b) + 18px);
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ameixa); color: var(--bebe);
  padding: 10px 18px; border-radius: 999px; font-size: .88rem;
  transition: opacity .2s, transform .2s; max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Cabeçalho de página */
.page-head { display: flex; align-items: center; gap: var(--e3); }
.page-head h1 { flex: 1; font-size: 1.45rem; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Ilustrações de objeto nos cards */
.pcard .pic .ilus { width: auto; height: auto; max-width: 82%; max-height: 88%; object-fit: contain; }
.detail-hero .ilus { width: auto; max-width: 70%; max-height: 240px; }
.list .mini .ilus { max-width: 100%; max-height: 100%; }
.chip .ilus { width: auto; height: 28px; }
.banner .art .ilus { filter: drop-shadow(0 4px 10px rgba(165,129,153,.18)); }

/* ===== Ilustrações com fundo de papel (estilo "papel") ===== */
.ilus.papel {
  border-radius: 22px;
  box-shadow: 0 0 0 5px var(--branco), 0 0 0 6.5px var(--linha), var(--sombra);
  background: var(--creme);
}
.banner .art .ilus.papel { margin: 6px 6px 0 0; transform: rotate(2.5deg); }
.banner .art:has(.papel) { margin: 0; align-self: center; }
.empty .art .ilus.papel { transform: rotate(-2deg); }
.empty .art:has(.papel) { width: 200px; margin-bottom: 8px; }
/* objetos: o papel preenche a área da imagem do card */
.pcard .pic:has(.papel) { padding: 0; }
.pcard .pic .ilus.papel { width: 100%; height: 100%; max-width: none; max-height: none; object-fit: cover; border-radius: 0; box-shadow: none; }
.detail-hero:has(.papel) { padding: var(--e4); }
.detail-hero .ilus.papel { max-width: 75%; max-height: 300px; }
.chip .ilus.papel, .list .mini .ilus.papel { border-radius: 50%; box-shadow: none; object-fit: cover; }
.chip .ilus.papel { width: 28px; height: 28px; }
.list .mini:has(.papel) { overflow: hidden; }
.list .mini .ilus.papel { width: 100%; height: 100%; border-radius: 0; }

/* Banner no mesmo papel das ilustrações: a imagem se funde ao fundo */
.banner, .banner.lilas, .banner.bebe { background: #FCF4EE url('../assets/papel.webp') repeat; background-size: 256px; }
.banner .blob { display: none; }
.banner .art .ilus.papel {
  transform: none; margin: 0; border-radius: 0; box-shadow: none; background: none;
  -webkit-mask-image: radial-gradient(ellipse 68% 68% at 50% 50%, #000 50%, transparent 100%);
          mask-image: radial-gradient(ellipse 68% 68% at 50% 50%, #000 50%, transparent 100%);
}
