:root {
  color-scheme: light;
  --bg: #f2f2f7;
  --surface: #ffffff;
  --text: #1c1c1e;
  --muted: #6e6e73;
  --line: #e5e5ea;
  --accent: #1f9d55;
  --accent-soft: #e3f5ea;
  --danger: #d93025;
  --thumb: #eef0f3;
  --shadow: 0 12px 40px rgba(0, 0, 0, .22);
  --bg-a: rgba(242, 242, 247, .78);
  --glass: rgba(255, 255, 255, .6);
  --glass-strong: rgba(246, 246, 250, .86);
  --glass-edge: rgba(255, 255, 255, .75);
  --glass-shadow: 0 8px 28px rgba(0, 0, 0, .14);
  --glow: rgba(31, 157, 85, .13);
  /* Cor dos botões cheios (pode ser mais clara que a cor do texto, como no tema rosa) e do que vai escrito neles */
  --fill: var(--accent);
  --on-fill: #fff;
  --fill-shadow: rgba(31, 157, 85, .38);
}
/* O tema é aplicado pelo script (automático, claro ou escuro) */
:root[data-theme=dark] {
    color-scheme: dark;
    --bg: #000000;
    --surface: #1c1c1e;
    --text: #f2f2f7;
    --muted: #98989f;
    --line: #2c2c2e;
    --accent: #34c26f;
    --accent-soft: #14301f;
    --danger: #ff6b5e;
    --thumb: #2c2c2e;
    --shadow: 0 12px 40px rgba(0, 0, 0, .7);
    --bg-a: rgba(0, 0, 0, .62);
    --glass: rgba(58, 58, 62, .55);
    --glass-strong: rgba(30, 30, 32, .86);
    --glass-edge: rgba(255, 255, 255, .14);
    --glass-shadow: 0 8px 28px rgba(0, 0, 0, .5);
    --glow: rgba(52, 194, 111, .16);
}

/* touch-action: manipulation desliga o zoom de toque duplo do Safari (rolar e pinçar continuam) */
* { box-sizing: border-box; touch-action: manipulation; }
html { -webkit-text-size-adjust: 100%; }
button { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
body {
  margin: 0;
  min-height: 100dvh;
  background: linear-gradient(to bottom, var(--glow), transparent 320px) no-repeat, var(--bg);
  color: var(--text);
  font: 17px/1.35 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; }
svg { display: block; }

.wrap { max-width: 560px; margin: 0 auto; }

/* Cabeçalho */
.top {
  position: sticky; top: 0; z-index: 5;
  padding: calc(env(safe-area-inset-top) + 14px) 20px 14px;
}
/* Vidro: o conteúdo desfoca ao passar por baixo do cabeçalho */
.top::before {
  content: ""; position: absolute; inset: 0 0 -18px 0; z-index: -1;
  background: linear-gradient(to bottom, var(--bg-a) 60%, transparent);
  -webkit-backdrop-filter: blur(20px) saturate(1.7);
  backdrop-filter: blur(20px) saturate(1.7);
  -webkit-mask-image: linear-gradient(to bottom, #000 68%, transparent);
  mask-image: linear-gradient(to bottom, #000 68%, transparent);
}
.top h1 { margin: 0; font-size: 34px; font-weight: 700; letter-spacing: -.4px; }
.top p { margin: 2px 0 10px; color: var(--muted); font-size: 15px; }
.bar { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--fill); border-radius: 4px; transition: width .35s cubic-bezier(.3, 1.4, .5, 1); }

.glass {
  background: var(--glass);
  -webkit-backdrop-filter: blur(22px) saturate(1.8);
  backdrop-filter: blur(22px) saturate(1.8);
  border: 1px solid var(--glass-edge);
  box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-edge);
}

/* Seções */
main { padding: 4px 16px calc(env(safe-area-inset-bottom) + 110px); }
.sec-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 20px 4px 8px; min-height: 32px;
}
.sec-head h2 { margin: 0; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.sec-head h2 b { font-weight: 600; color: var(--text); margin-left: 4px; }
.link { color: var(--accent); font-size: 15px; font-weight: 600; min-height: 32px; padding: 0 4px; }
.hint { margin: -2px 4px 8px; color: var(--muted); font-size: 14px; }

.list { list-style: none; margin: 0; padding: 0; background: var(--surface); border-radius: 24px; overflow: hidden; }
.empty { background: var(--surface); border-radius: 24px; padding: 22px 16px; color: var(--muted); font-size: 15px; text-align: center; }

/* Item */
.item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px 11px 14px;
  border-bottom: 1px solid var(--line);
  animation: in .22s ease-out;
}
.item:last-child { border-bottom: 0; }
@keyframes in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

.thumb {
  flex: none; width: 54px; height: 54px; border-radius: 14px;
  background: var(--thumb) center / cover no-repeat;
  display: grid; place-items: center; font-size: 28px; line-height: 1;
}
.name { flex: 1; min-width: 0; text-align: left; padding: 6px 0; min-height: 44px; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; row-gap: 2px; }   /* preço e quantidade sempre na linha de baixo */
.total { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; min-height: 56px; }
.total span { display: flex; flex-direction: column; font-weight: 600; }
.total small { font-weight: 400; font-size: 13px; color: var(--muted); }
.total b { font-size: 19px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.meta { color: var(--muted); font-size: 14px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.name span { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

.act { flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; }
.act svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.act.check { border: 2px solid var(--line); color: transparent; width: 36px; height: 36px; margin: 4px; }
.act.check:active { border-color: var(--accent); color: var(--accent); }
.act.checked { background: var(--fill); color: var(--on-fill); width: 36px; height: 36px; margin: 4px; animation: pop .3s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes pop { from { transform: scale(.5); } to { transform: none; } }
.act:active { transform: scale(.9); }
.act.remove { color: var(--muted); }
.act.add { background: var(--accent-soft); color: var(--accent); width: 36px; height: 36px; margin: 4px; }

.done .name { color: var(--muted); text-decoration: line-through; }
.done .thumb { opacity: .5; }

/* Barra inferior */
.bottom {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  padding: 12px 16px calc(env(safe-area-inset-bottom) + 10px);
  pointer-events: none;
}
/* Barra flutuante: botão principal em cápsula + botão redondo de vidro */
.dock { display: flex; align-items: center; gap: 8px; max-width: 528px; margin: 0 auto; pointer-events: auto; }
.dock .primary { min-height: 52px; font-size: 16px; white-space: nowrap; }
/* Botões que trocam de tela (A comprar / Em casa); o da tela aberta fica verde */
.round.tab { width: 48px; height: 48px; color: var(--muted); }
.round.tab svg { stroke-linejoin: round; }
.round.tab.on { background: var(--fill); border-color: transparent; color: var(--on-fill); }
.primary {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  flex: 1; width: 100%; max-width: 528px; margin: 0 auto; min-height: 56px;
  border-radius: 999px; color: var(--on-fill); font-weight: 600;
  background: linear-gradient(to bottom, rgba(255, 255, 255, .24), rgba(255, 255, 255, 0) 60%), var(--fill);
  box-shadow: 0 10px 26px var(--fill-shadow), inset 0 1px 0 rgba(255, 255, 255, .4);
  transition: transform .15s;
}
.primary:active, .round:active { transform: scale(.96); }
.primary svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; }
.round { flex: none; width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; transition: transform .15s; }
.round svg, .ghost svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

/* Aviso com desfazer */
.toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(env(safe-area-inset-bottom) + 84px); z-index: 7;
  max-width: 528px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px 10px 20px; min-height: 52px; border-radius: 999px;
  background: rgba(44, 44, 46, .82); color: #fff; font-size: 15px;
  -webkit-backdrop-filter: blur(22px) saturate(1.8); backdrop-filter: blur(22px) saturate(1.8);
  border: 1px solid rgba(255, 255, 255, .14); box-shadow: 0 8px 28px rgba(0, 0, 0, .3);
  opacity: 0; transform: translateY(8px); pointer-events: none; transition: .2s;
}
.toast.on { opacity: 1; transform: none; pointer-events: auto; }
.toast button { color: #6ee7a0; font-weight: 600; min-height: 32px; padding: 0 10px; flex: none; }

/* Folha de adicionar/editar */
.veil { position: fixed; inset: 0; z-index: 8; background: rgba(0, 0, 0, .4); opacity: 0; pointer-events: none; transition: opacity .2s; }
.veil.on { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 8px; right: 8px; bottom: 8px; z-index: 9;
  max-width: 544px; margin: 0 auto;
  background: var(--glass-strong); border-radius: 38px;
  -webkit-backdrop-filter: blur(30px) saturate(1.8); backdrop-filter: blur(30px) saturate(1.8);
  border: 1px solid var(--glass-edge); box-shadow: var(--shadow);
  padding: 8px 18px max(18px, env(safe-area-inset-bottom));
  transform: translateY(calc(100% + 32px)); transition: transform .32s cubic-bezier(.3, 1.15, .4, 1);
  max-height: 88dvh; overflow-y: auto;
}
.sheet.on { transform: none; }
/* A rolagem de dentro da folha não "vaza" para a página; o fundo escurecido não arrasta nada */
.sheet { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.veil, .zoom, .scanner { touch-action: none; overscroll-behavior: contain; }
.grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 10px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.sheet-head h3 { margin: 0; font-size: 20px; }

.photo-row { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.photo-row .thumb { width: 96px; height: 96px; border-radius: 22px; font-size: 48px; background-color: var(--surface); }
.photo-btns { flex: 1; display: grid; gap: 8px; }
.ghost { min-height: 44px; border-radius: 999px; background: var(--surface); color: var(--accent); font-weight: 600; font-size: 15px; padding: 0 14px; }
.ghost.wide { width: 100%; min-height: 50px; display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 12px; }
.note { margin: -6px 4px 14px; font-size: 13px; color: var(--muted); }

:root[data-theme=dark] .ghost, :root[data-theme=dark] .photo-row .thumb { background-color: #2c2c2e; }

/* Menu de listas */
.title-row { display: flex; align-items: center; gap: 12px; }
.title-row h1 { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-btn { width: 46px; height: 46px; }
.lrow { animation: none; }
.lrow-mark { flex: none; width: 24px; color: var(--accent); }
.lrow-mark svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.lrow-name { flex: 1; min-width: 0; min-height: 50px; text-align: left; display: flex; flex-direction: column; justify-content: center; }
.lrow-name b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lrow-name small { color: var(--muted); font-size: 13px; }
.lrow.current .lrow-name b { color: var(--accent); }
.act.del, .link.del { color: var(--danger); }
.lrow { padding-left: 6px; }
.act.star { color: var(--muted); }
.act.star.on { color: #f5a623; animation: pop .3s cubic-bezier(.3, 1.6, .5, 1); }
.act.star.on svg { fill: currentColor; }
.sheet .hint { margin: -4px 4px 14px; }
.sheet .list { margin-bottom: 12px; }
.seg.three { grid-template-columns: repeat(3, 1fr); }

/* Imagem ampliada */
.zoom {
  position: fixed; inset: 0; z-index: 11; display: grid; place-items: center; padding: 24px;
  background: rgba(0, 0, 0, .45);
  -webkit-backdrop-filter: blur(24px) saturate(1.4); backdrop-filter: blur(24px) saturate(1.4);
  opacity: 0; pointer-events: none; transition: opacity .22s;
}
.zoom.on { opacity: 1; pointer-events: auto; }
.zoom-card { width: min(86vw, 400px); text-align: center; transform: scale(.8); transition: transform .32s cubic-bezier(.3, 1.3, .5, 1); }
.zoom.on .zoom-card { transform: none; }
.zoom-img {
  aspect-ratio: 1; border-radius: 40px;
  background: var(--surface) center / contain no-repeat;   /* contain: a foto aparece inteira, sem corte */
  border: 1px solid var(--glass-edge); box-shadow: var(--shadow); overflow: hidden;
  display: grid; place-items: center; font-size: min(44vw, 200px); line-height: 1;
}
.zoom-name { margin-top: 18px; color: #fff; font-size: 22px; font-weight: 600; text-shadow: 0 1px 10px rgba(0, 0, 0, .6); }
.zoom-x { position: absolute; top: calc(env(safe-area-inset-top) + 12px); right: 16px; color: #fff; }

/* Leitor de código de barras (simulado) */
.scanner {
  position: fixed; inset: 0; z-index: 12; background: #0b0b0c; color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px;
  padding: calc(env(safe-area-inset-top) + 16px) 24px calc(env(safe-area-inset-bottom) + 24px);
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.scanner.on { opacity: 1; pointer-events: auto; }
.scanner h3 { margin: 0; font-size: 22px; }
.scanner p { margin: 0; text-align: center; color: rgba(255, 255, 255, .7); font-size: 15px; max-width: 320px; }
.finder {
  position: relative; width: min(80vw, 340px); aspect-ratio: 3 / 2; border-radius: 30px; overflow: hidden;
  border: 3px solid rgba(255, 255, 255, .9);
  background: repeating-linear-gradient(90deg, rgba(255, 255, 255, .1) 0 3px, transparent 3px 7px, rgba(255, 255, 255, .1) 7px 8px, transparent 8px 14px);
}
.finder::after {
  content: ""; position: absolute; left: 8%; right: 8%; top: 50%; height: 2px;
  background: #ff453a; box-shadow: 0 0 14px 2px #ff453a;
  animation: scan 1.6s ease-in-out infinite alternate;
}
.finder video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: none; }
.finder.live { background: #000; }
.finder.live video { display: block; }
.scan-code { display: flex; gap: 10px; width: 100%; max-width: 340px; margin: 0; }
.scan-code input[type=text] {
  flex: 1; min-width: 0; margin: 0; min-height: 54px; border-radius: 999px; padding: 0 20px;
  background: rgba(255, 255, 255, .12); color: #fff; border-color: rgba(255, 255, 255, .2);
}
.scan-code input::placeholder { color: rgba(255, 255, 255, .5); }
.scan-code .pill { flex: none; padding: 0 22px; }

/* Fotos encontradas na internet */
.results { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.results button { aspect-ratio: 1; border-radius: 16px; background: #fff center / cover no-repeat; border: 1px solid var(--line); }

@keyframes scan { from { top: 16%; } to { top: 84%; } }
.scan-row { display: flex; gap: 10px; width: 100%; max-width: 340px; }
.pill {
  flex: 1; min-height: 54px; border-radius: 999px; font-weight: 600; color: #fff;
  background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .18);
}
.pill.go { background: var(--fill); border-color: transparent; }

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

label.field { display: block; font-size: 13px; color: var(--muted); margin: 0 4px 6px; }
input[type=text], input[type=email], input[type=password] {
  width: 100%; min-height: 50px; padding: 0 16px; margin-bottom: 14px;
  border: 1px solid var(--line); border-radius: 16px;
  background: var(--surface); color: var(--text); font: inherit;
}
input[type=text]:focus, input[type=email]:focus, input[type=password]:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.money { position: relative; }
.money span { position: absolute; left: 16px; top: 0; height: 50px; display: flex; align-items: center; color: var(--muted); pointer-events: none; }
.money input { padding-left: 48px; }
.stepper { display: flex; gap: 8px; margin-bottom: 14px; }
.stepper input { flex: 1; min-width: 0; margin-bottom: 0; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.step { flex: none; width: 50px; height: 50px; padding: 0; display: grid; place-items: center; }

.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 999px; background: var(--line); margin-bottom: 16px; }
.seg button { min-height: 40px; border-radius: 999px; font-size: 15px; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--text); }

/* Categorias: título de cada grupo dentro da lista e faixa de botões na folha do item */
.sub {
  display: flex; align-items: center; gap: 8px; padding: 8px 16px;
  background: var(--thumb); border-bottom: 1px solid var(--line);
  font-size: 13px; font-weight: 600; color: var(--muted);
}
.sub span { font-size: 16px; line-height: 1; }
.sub b { font-weight: 600; color: var(--text); }
.chips {
  display: flex; gap: 8px; overflow-x: auto; margin: 0 -18px 14px; padding: 0 18px 2px;
  scrollbar-width: none; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain;
}
.chips::-webkit-scrollbar { display: none; }
.chips button {
  flex: none; min-height: 40px; padding: 0 14px; border-radius: 999px; white-space: nowrap;
  background: var(--surface); border: 1px solid var(--line); font-size: 15px;
}
.chips button.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }

/* Tela de editar categorias (no menu) */
.cat-emoji { flex: none; width: 36px; text-align: center; font-size: 24px; line-height: 1; }
.ghost.warn { color: var(--danger); }

/* Perfil: bolinha com a foto (ou a inicial do nome) ao lado de "Minhas listas" e na tela de configurações */
.avatar {
  flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-soft) center / cover no-repeat; color: var(--accent);
  font-size: 17px; font-weight: 700; line-height: 1; border: 1px solid var(--glass-edge);
}
.avatar svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.avatar.big { width: 96px; height: 96px; font-size: 40px; }
.avatar.big svg { width: 48px; height: 48px; }
#menu-lists .sheet-head { gap: 14px; }
#menu-lists .sheet-head h3 { flex: 1; }

/* Compartilhar: o botão do cabeçalho fica verde quando a lista está compartilhada */
#share-btn.on { color: var(--accent); }
#share .note { margin: 4px 4px 0; word-break: break-all; }
#sh-off .primary { margin-bottom: 4px; }
.ghost svg { stroke-linejoin: round; }
/* Lista recebida só para visualizar: somem os botões que mudariam a lista */
.readonly .item .act, .readonly .dock .primary, .readonly .dock [data-do=scan], .readonly [data-do=reset] { display: none; }
.readonly .item { padding-right: 16px; }
/* Categorias da lista (tela de editar lista): todas à vista; as marcadas estão na lista */
.chips.wrap { flex-wrap: wrap; overflow: visible; margin: 0 0 10px; padding: 0; }
.chips.wrap button { color: var(--muted); }
.chips.wrap button.on { color: var(--accent); }
.chips.wrap button.on::before { content: "✓"; margin-right: 6px; font-weight: 700; }
.chips.wrap button:disabled { opacity: .6; }
/* Figuras à escolha ao criar ou editar uma categoria */
.emojis { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; margin-bottom: 16px; }
.emojis button {
  aspect-ratio: 1; border-radius: 12px; font-size: 24px; line-height: 1;
  background: var(--surface); border: 2px solid transparent;
}
.emojis button.on { background: var(--accent-soft); border-color: var(--accent); }

.danger { display: block; width: 100%; min-height: 48px; margin-top: 8px; color: var(--danger); font-weight: 600; }
[hidden] { display: none !important; }

/* Configurações e conta */
.sect { margin: 22px 4px 8px; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
#menu-settings .primary, #menu-auth .primary { margin-bottom: 12px; }
#menu-settings .note, #menu-auth .note { margin: 0 4px 12px; }
#menu-settings .hint { margin: 0 4px 12px; }
.primary.red { background: var(--danger); box-shadow: none; }
#sh-seg button { font-size: 14px; padding: 0 4px; }
#sh-mode { margin: -8px 4px 14px; }

/* Chave "Conferir preço", à direita do título "A comprar" */
.switch { display: flex; align-items: center; gap: 8px; min-height: 32px; font-size: 13px; font-weight: 600; color: var(--muted); }
.switch i { position: relative; flex: none; width: 44px; height: 26px; border-radius: 999px; background: var(--line); box-shadow: inset 0 0 0 1px rgba(120, 120, 128, .5); transition: background .2s; }   /* borda fina: sem ela a chave desligada some no fundo */
.switch i::after {
  content: ""; position: absolute; left: 2px; top: 2px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .2s;
}
.switch.on { color: var(--text); }
.switch.on i { background: var(--fill); }
.switch.on i::after { transform: translateX(18px); }
.readonly .switch { display: none; }
/* Preço à esquerda e, à direita, a unidade: quilo, unidade ou caixa */
.price-row { display: flex; gap: 8px; align-items: flex-start; }
.price-row .money { flex: 0 0 46%; min-width: 0; }
.price-row .seg { flex: 1; min-height: 50px; margin-bottom: 14px; }
/* Janela de conferir preço */
.pr-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.pr-info b { font-size: 18px; overflow-wrap: anywhere; }
.pr-info small { font-size: 14px; color: var(--muted); }
#price .photo-row .thumb { width: 72px; height: 72px; font-size: 36px; border-radius: 18px; background-position: center; background-size: cover; }
.pr-total { display: flex; justify-content: space-between; align-items: center; margin: 0 4px 16px; font-weight: 600; }
.pr-total span { display: flex; flex-direction: column; }
.pr-total small { font-weight: 400; font-size: 13px; color: var(--muted); }
.pr-total b { font-size: 19px; font-variant-numeric: tabular-nums; }

/* ---------- Tema de cor (Configurações > Aparência > Tema). O verde é o padrão, definido lá em cima. ---------- */
:root[data-color=rosa] { --accent: #c2477a; --accent-soft: #fde8f0; --fill: #f5b3cb; --on-fill: #5c1433; --fill-shadow: rgba(240, 150, 185, .5); --glow: rgba(245, 160, 195, .24); }
:root[data-color=rosa][data-theme=dark] { --accent: #f7a8c6; --accent-soft: #3a1a27; --fill: #f5b3cb; --on-fill: #4a1029; --fill-shadow: rgba(245, 179, 203, .22); --glow: rgba(245, 160, 195, .16); }
:root[data-color=marinho] { --accent: #2b4667; --accent-soft: #e4e9f0; --fill: #2b4667; --fill-shadow: rgba(43, 70, 103, .3); --glow: rgba(43, 70, 103, .13); }
:root[data-color=marinho][data-theme=dark] { --accent: #93b2d8; --accent-soft: #17222f; --fill: #355a85; --fill-shadow: rgba(0, 0, 0, .4); --glow: rgba(80, 120, 170, .18); }
:root[data-color=marrom] { --accent: #8a5a3c; --accent-soft: #f4eae2; --fill: #8a5a3c; --fill-shadow: rgba(138, 90, 60, .36); --glow: rgba(138, 90, 60, .13); }
:root[data-color=marrom][data-theme=dark] { --accent: #d6a684; --accent-soft: #2e2018; --fill: #9a6846; --fill-shadow: rgba(0, 0, 0, .4); --glow: rgba(170, 115, 80, .18); }
/* Azul marinho fosco: sem o brilho dos botões */
:root[data-color=marinho] .primary { background: var(--fill); box-shadow: 0 6px 18px var(--fill-shadow); }
/* Escolha do tema: uma bolinha de cada cor */
.colors { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 16px; }
.colors button { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 2px 8px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); font-size: 12px; font-weight: 600; color: var(--muted); line-height: 1.2; }
.colors button i { width: 30px; height: 30px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08); }
.colors button.on { border-color: var(--accent); color: var(--text); box-shadow: 0 0 0 1px var(--accent); }

/* Histórico de compras */
.hist-btn { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.hist-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#h-back { display: block; margin: -6px 0 8px; }
.hrow { border-bottom: 1px solid var(--line); }
.hrow:last-child { border-bottom: 0; }
.hrow button { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; padding: 10px 16px; text-align: left; }
.hrow span { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.hrow span b { font-weight: 600; }
.hrow small { font-size: 13px; color: var(--muted); }
.hrow > button > b { white-space: nowrap; font-variant-numeric: tabular-nums; }
.hrow svg { flex: none; width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.hitem { display: flex; align-items: center; gap: 12px; padding: 8px 16px; min-height: 60px; border-bottom: 1px solid var(--line); }
.hitem .thumb { width: 44px; height: 44px; font-size: 24px; border-radius: 12px; }
.hitem .name { min-height: 0; padding: 0; }
.hitem > b { white-space: nowrap; font-weight: 600; font-variant-numeric: tabular-nums; }
.hrow svg.hcart { width: 24px; height: 24px; stroke: var(--accent); }
.switch.on i { box-shadow: none; }

/* Teclado aberto (iPhone): a folha sobe para cima do teclado e cabe no espaço que sobra. --kb e --vvh vêm do script. */
.sheet { bottom: calc(8px + var(--kb, 0px)); max-height: min(88dvh, calc(var(--vvh, 100dvh) - 16px)); }
:root.kb .sheet { padding-bottom: 18px; transition: transform .32s cubic-bezier(.3, 1.15, .4, 1), bottom .2s; }

/* Mydee Plus e relatório de gastos */
.plus-list li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.plus-list li:last-child { border-bottom: 0; }
.plus-list li > span { font-size: 24px; line-height: 1.2; }
.plus-list li div { display: flex; flex-direction: column; gap: 2px; }
.plus-list small { font-size: 13px; color: var(--muted); }
#h-rep { margin-bottom: 12px; }
#hist .sub { justify-content: flex-start; }
.rrow { display: flex; align-items: center; gap: 12px; padding: 10px 16px; min-height: 56px; border-bottom: 1px solid var(--line); }
.rrow > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.rrow > div b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rrow small { font-size: 13px; color: var(--muted); }
.rrow > b { white-space: nowrap; font-variant-numeric: tabular-nums; }
.ricon { flex: none; width: 28px; text-align: center; font-size: 22px; }
.rbar { display: block; height: 5px; border-radius: 3px; background: var(--line); margin-top: 4px; overflow: hidden; }
.rbar i { display: block; height: 100%; border-radius: 3px; background: var(--fill); }
.rup { color: var(--danger); }
.rdown { color: var(--accent); }
.rnone { padding: 14px 16px; font-size: 14px; color: var(--muted); border-bottom: 1px solid var(--line); }
