/* Minha Despensa: mesmo estilo do Hábitos Financeiros e do AylaDog (barra colorida, fundo claro, cartões brancos).
   Para trocar a cor da marca, mude as variáveis --brand. */

:root {
  --brand: #2F7D5C;
  --brand-strong: #1F5E43;
  --brand-soft: #DDF0E6;
  --brand-tint: #F0F8F3;
  --brand-line: #B5DCC8;
  --out: #D25A4E;
  --out-strong: #A63A30;
  --out-soft: #FBE7E4;
  --bg: #F5F3EF;
  --card: #FFFEFC;
  --ink: #2E2A27;
  --muted: #6F6862;
  --faint: #A49D97;
  --line: #EAE6E1;
  --chip: #F0EDE9;
  --dark: #2E2A27;
  --green: #19A463;
  --green-strong: #11804C;
  --green-soft: #DCF4E6;
  --amber: #E29A12;
  --amber-strong: #8F5B00;
  --amber-soft: #FDF1D8;
  --red: #DC4646;
  --red-soft: #FCEBEB;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(40, 30, 20, .05), 0 2px 10px rgba(40, 30, 20, .03);
  --font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.4;
  color: var(--ink);
  background: var(--bg);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}
body.no-scroll { overflow: hidden; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; text-align: inherit; }
input, select, textarea { font: inherit; color: inherit; }
svg { display: block; flex: none; }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
b, strong { font-weight: 650; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
[hidden] { display: none !important; }

.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13.5px; }
.tiny { font-size: 12px; }
.center { text-align: center; }
.grow { flex: 1; min-width: 0; }
.mt { margin-top: 12px; }

.app { max-width: 560px; margin: 0 auto; min-height: 100dvh; }
main { padding: 12px 12px calc(96px + var(--safe-bottom)); }

/* ---------- barra superior ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--brand); color: #fff;
  padding: calc(var(--safe-top) + 6px) 6px 6px;
  display: grid; grid-template-columns: 48px 1fr 48px; align-items: center;
}
.brand { display: flex; align-items: center; justify-content: center; gap: 7px; font-size: 20px; font-weight: 750; letter-spacing: -.4px; }
.brand .ic { width: 24px; height: 24px; }
.tb-btn { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: #fff; }
.tb-btn:active { background: rgba(255, 255, 255, .18); }
.offline-bar {
  display: none; align-items: center; justify-content: center; gap: 8px;
  background: var(--dark); color: #fff;
  font-size: 13px; font-weight: 550;
  padding: 7px 12px;
}
body.offline .offline-bar { display: flex; }

/* ---------- cartões ---------- */
.card { position: relative; background: var(--card); border-radius: var(--radius); padding: 18px 16px; margin-bottom: 12px; box-shadow: var(--shadow); }
.card-title { font-size: 15.5px; font-weight: 650; margin-bottom: 8px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-title .link { font-size: 14px; }
h1.page { font-size: 20px; font-weight: 700; letter-spacing: -.2px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 4px 4px 12px; min-height: 36px; }
.link { color: var(--brand-strong); font-weight: 600; font-size: 14px; }

/* olá + indicadores */
.hello-row { display: flex; align-items: center; gap: 14px; }
.hello { font-size: 15px; color: var(--muted); }
.hello b { display: block; font-size: 21px; color: var(--ink); margin-top: 1px; letter-spacing: -.2px; }
.kpis { display: flex; gap: 22px; margin-top: 16px; flex-wrap: wrap; }
.kpi { display: flex; flex-direction: column; }
.kpi .l { font-size: 13px; color: var(--muted); }
.kpi.warn .v { color: var(--amber-strong); }
.kpi.alert .v { color: var(--out); }
.kpi .v { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.start { background: var(--brand-tint); border: 1px solid var(--brand-line); border-radius: 14px; padding: 16px; margin-top: 16px; }
.start h3 { font-size: 16px; margin-bottom: 4px; }
.start p { color: var(--muted); font-size: 14px; margin-bottom: 12px; }
.party { background: var(--amber-soft); border: 1px solid #f3d798; border-radius: 14px; padding: 14px 16px; margin-top: 14px; display: flex; gap: 12px; align-items: center; font-size: 14.5px; }
.party .ic { color: var(--amber-strong); }

/* ---------- avatar e ícones redondos ---------- */
.avatar { border-radius: 50%; object-fit: cover; background: var(--brand-soft); color: var(--brand-strong); display: grid; place-items: center; flex: none; overflow: hidden; font-weight: 700; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.ci { width: 38px; height: 38px; border-radius: 50%; background: var(--c, #999); color: #fff; display: grid; place-items: center; flex: none; }
.ci .ic { width: 19px; height: 19px; }
.ci.sm { width: 32px; height: 32px; }
.ci.sm .ic { width: 16px; height: 16px; }
.ci.lg { width: 54px; height: 54px; }
.ci.lg .ic { width: 26px; height: 26px; }

/* ---------- linhas de lista ---------- */
.row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); width: 100%; text-align: left; cursor: pointer; }
.row:last-child { border-bottom: 0; }
.row .t { display: block; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .s { display: block; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .s.wrap { white-space: normal; }
.row .chev { color: var(--faint); }
.row-thumb { width: 38px; height: 38px; border-radius: 10px; object-fit: cover; flex: none; }
.right { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex: none; }
.right .d { font-size: 12.5px; color: var(--muted); white-space: nowrap; }

/* situação (pílulas) */
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; line-height: 1; padding: 5px 8px; border-radius: 7px; background: var(--chip); color: var(--muted); font-weight: 650; white-space: nowrap; }
.pill.st-atrasado { background: var(--red-soft); color: var(--red); }
.pill.st-hoje, .pill.st-breve { background: var(--amber-soft); color: var(--amber-strong); }
.pill.st-ok { background: var(--green-soft); color: var(--green-strong); }

/* botão redondo "feito" (igual ao "pago" do Hábitos) */
.st { width: 30px; height: 30px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--line); display: grid; place-items: center; color: #c9c4be; flex: none; transition: background .15s, color .15s; }
.st:hover, .st:active { background: var(--green-soft); color: var(--green-strong); box-shadow: none; }

/* ---------- botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 18px; border-radius: 12px;
  background: var(--brand); color: #fff; font-weight: 650; font-size: 15px;
  transition: filter .15s, transform .1s;
}
.btn:active { filter: brightness(.94); transform: scale(.99); }
.btn:disabled { background: #dcd8d3; color: #8f8983; }
.btn.block { width: 100%; display: flex; }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn-soft { background: var(--brand-soft); color: var(--brand-strong); }
.btn-ghost { background: var(--card); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.btn-danger { background: var(--red-soft); color: var(--red); }
.btn-row { display: flex; gap: 10px; margin-top: 6px; }
.btn-row .btn { flex: 1; }
.icon-btn { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; box-shadow: inset 0 0 0 1px var(--line); background: var(--card); flex: none; }
.icon-btn.ghost { box-shadow: none; background: transparent; }
.link-btn { display: flex; align-items: center; gap: 4px; margin: 14px auto 0; color: var(--muted); font-size: 14px; text-decoration: underline; }

/* atalhos de registro */
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.quick button { min-height: 46px; border-radius: 12px; box-shadow: inset 0 0 0 1px var(--line); display: flex; align-items: center; justify-content: flex-start; gap: 10px; padding: 0 12px; font-weight: 600; font-size: 14px; background: #fff; }
.quick .ci { width: 28px; height: 28px; }
.quick .ci .ic { width: 15px; height: 15px; }

/* ---------- abas (segmentos) ---------- */
.seg { display: flex; background: var(--chip); border-radius: 12px; padding: 3px; gap: 3px; margin-bottom: 12px; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg a, .seg button { flex: 1 0 auto; min-height: 36px; padding: 0 10px; border-radius: 9px; font-weight: 550; font-size: 14px; color: var(--muted); display: flex; align-items: center; justify-content: center; white-space: nowrap; }
.seg a.on, .seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }

/* ---------- estados vazios ---------- */
.empty { text-align: center; padding: 14px 8px 4px; }
.empty-ic { width: 54px; height: 54px; margin: 0 auto 14px; border-radius: 50%; background: var(--dark); color: #9FD9BC; display: grid; place-items: center; box-shadow: 0 0 0 7px var(--chip); }
.empty h3 { font-size: 16.5px; margin-bottom: 6px; }
.empty p { color: var(--muted); font-size: 14px; margin: 0 auto 14px; max-width: 290px; }

/* ---------- folhas (painéis que sobem) ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 70; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(26, 22, 18, .45); opacity: 0; transition: opacity .2s; }
.sheet {
  position: relative; width: 100%; max-width: 560px; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--card); border-radius: 22px 22px 0 0; padding: 4px 18px calc(18px + var(--safe-bottom));
  transform: translateY(100%); transition: transform .26s cubic-bezier(.2, .8, .2, 1);
}
.sheet::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 2px; background: #dedad5; margin: 6px auto 4px; }
.sheet-wrap.open .sheet-backdrop { opacity: 1; }
.sheet-wrap.open .sheet { transform: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 0 12px; }
.sheet-head h2 { font-size: 19px; font-weight: 700; letter-spacing: -.2px; }
.sheet-head .icon-btn { margin-right: -8px; box-shadow: none; background: transparent; }
.sheet-text { margin: -4px 0 14px; font-size: 14.5px; color: var(--muted); }
@media (min-width: 620px) {
  .sheet-wrap { align-items: center; }
  .sheet { border-radius: 22px; max-height: 88dvh; padding-bottom: 20px; transform: translateY(20px) scale(.98); opacity: 0; transition: transform .2s, opacity .2s; }
  .sheet::before { display: none; }
  .sheet-wrap.open .sheet { opacity: 1; }
}
.menu-list { display: grid; gap: 2px; padding-bottom: 4px; }
.menu-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 6px; border-radius: 12px; font-size: 15.5px; font-weight: 550; text-align: left; }
.menu-item:hover { background: #f6f4f1; }
.menu-item .ci { width: 34px; height: 34px; }
.menu-item .ci .ic { width: 17px; height: 17px; }
.menu-item > .ic { color: var(--muted); margin: 0 7px; }
.menu-item.danger { color: var(--red); }
.menu-item.danger > .ic { color: var(--red); }

/* ---------- formulários ---------- */
.fld { display: block; margin-bottom: 14px; min-width: 0; }
.lbl { display: flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 550; margin-bottom: 6px; }
.inp {
  width: 100%; min-height: 48px; border: 1px solid var(--line); border-radius: 12px; background: #fff;
  padding: 0 14px; font-size: 16px; outline: none; text-align: left;
  transition: border-color .15s, box-shadow .15s;
}
.inp:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }
.inp::placeholder { color: var(--faint); }
textarea.inp { min-height: 76px; padding: 12px 14px; resize: vertical; display: block; }
input[type=date].inp { display: block; line-height: 46px; -webkit-appearance: none; appearance: none; min-width: 0; }
input[type=date].inp::-webkit-date-and-time-value { text-align: left; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-sec { font-size: 12px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; border-top: 1px solid var(--line); padding-top: 16px; margin: 6px 0 12px; scroll-margin-top: 8px; }
.form-sec:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.hint { font-size: 13px; color: var(--muted); margin: -6px 0 14px; }
.hint:empty { display: none; }
.info-box { background: #f3f1ed; border-radius: 12px; padding: 12px 14px; font-size: 13.5px; display: flex; gap: 10px; align-items: flex-start; margin-bottom: 14px; }
.info-box .ic { color: var(--muted); margin-top: 1px; }
.info-box:empty { display: none; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: -4px 0 14px; }
.chip { min-height: 34px; padding: 0 12px; border-radius: 17px; box-shadow: inset 0 0 0 1px var(--line); background: #fff; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.chip.on { background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand-line); color: var(--brand-strong); font-weight: 550; }
.radio-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.radio-chips label { position: relative; }
.radio-chips input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.radio-chips span { min-height: 38px; padding: 0 14px; border-radius: 19px; box-shadow: inset 0 0 0 1px var(--line); background: #fff; font-size: 14.5px; display: inline-flex; align-items: center; cursor: pointer; }
.radio-chips input:checked + span { background: var(--brand-soft); box-shadow: inset 0 0 0 1.5px var(--brand); color: var(--brand-strong); font-weight: 600; }
.radio-chips input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.attach { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.attach-thumb { width: 64px; height: 64px; border-radius: 12px; overflow: hidden; background: var(--chip); }
.attach-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- avisos ---------- */
.toast {
  position: fixed; left: 50%; top: calc(var(--safe-top) + 12px); z-index: 500;
  transform: translate(-50%, -160%); transition: transform .3s cubic-bezier(.2, .8, .2, 1);
  display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .16); padding: 10px 16px 10px 10px; font-size: 14.5px; font-weight: 550;
  max-width: calc(100vw - 32px); width: max-content;
}
.toast.show { transform: translate(-50%, 0); }
.toast-ic { width: 30px; height: 30px; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center; flex: none; }
.toast.err .toast-ic { background: var(--red); }

/* ---------- login ---------- */
.splash { min-height: 60dvh; display: grid; place-items: center; }
.spinner.sm { width: 18px; height: 18px; border-width: 2.5px; flex: none; }
.spinner.light { border-color: rgba(255, 255, 255, .25); border-top-color: #fff; }
.spinner { width: 30px; height: 30px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.login { min-height: 100dvh; display: flex; flex-direction: column; background: radial-gradient(900px 420px at 85% 0%, #dcefe4 0%, rgba(220, 239, 228, 0) 60%), #fffdfa; }
.login-bar { background: var(--brand); color: #fff; padding: calc(var(--safe-top) + 14px) 16px 14px; display: flex; justify-content: center; }
.login-body { flex: 1; width: 100%; max-width: 420px; margin: 0 auto; padding: 32px 20px calc(var(--safe-bottom) + 20px); display: flex; flex-direction: column; justify-content: center; gap: 18px; }
.login-card { background: #fff; border-radius: 20px; box-shadow: 0 1px 2px rgba(40, 30, 20, .05), 0 8px 30px rgba(40, 30, 20, .07); padding: 26px 22px; text-align: center; }
.login-photo { width: 84px; height: 84px; border-radius: 50%; margin: 0 auto 14px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-strong); box-shadow: 0 0 0 7px var(--brand-tint); }
.login-title { font-size: 22px; font-weight: 750; letter-spacing: -.4px; }
.login-lead { color: var(--muted); font-size: 14.5px; margin: 6px 0 18px; }
.gbtn { width: 100%; min-height: 50px; display: flex; align-items: center; justify-content: center; gap: 12px; background: #fff; color: #1f1f1f; border-radius: 12px; box-shadow: inset 0 0 0 1px #dadce0; font-weight: 650; font-size: 15.5px; }
.gbtn:active { background: #f7f7f7; }
.gbtn:disabled { opacity: .7; }
.login-err { color: var(--red); font-size: 14px; font-weight: 550; margin-top: 12px; }
.trust { list-style: none; display: grid; gap: 10px; padding: 0 6px; }
.trust li { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; color: var(--muted); }
.trust .ic { color: var(--brand-strong); margin-top: 1px; }
.denied-ic { width: 54px; height: 54px; margin: 0 auto 14px; border-radius: 50%; background: var(--red-soft); color: var(--red); display: grid; place-items: center; }


/* ---------- barra de baixo ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
  max-width: 560px; margin: 0 auto;
  background: rgba(255, 254, 252, .96); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding: 4px 4px calc(4px + var(--safe-bottom));
}
.tabbar a { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0 4px; font-size: 11.5px; font-weight: 600; color: var(--faint); }
.tabbar a.on { color: var(--brand-strong); }
.tabbar a:active { color: var(--brand); }
.tab-scan .scan-fab {
  width: 58px; height: 58px; margin-top: -26px; border-radius: 50%;
  display: grid; place-items: center; background: var(--brand); color: #fff;
  box-shadow: 0 0 0 5px var(--bg), 0 6px 16px rgba(31, 94, 67, .35);
}
.tabbar a.tab-scan.on .scan-fab { background: var(--brand-strong); }
.tabbar .badge {
  position: absolute; top: 1px; left: calc(50% + 6px);
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--out); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
}
.avatar.sm { width: 32px; height: 32px; font-size: 14px; box-shadow: 0 0 0 2px rgba(255, 255, 255, .55); }

/* ---------- início ---------- */
.hello-card .hello b { display: inline; font-size: inherit; color: var(--ink); }
.hello-card .hello { font-size: 18px; color: var(--ink); font-weight: 600; }
.kpis { justify-content: space-between; gap: 8px; margin-top: 14px; }
.kpi { flex: 1; padding: 10px 12px; border-radius: 12px; background: var(--chip); }
.kpi .v { font-size: 22px; line-height: 1.1; }
.kpi .l { font-size: 12.5px; }
.kpi.warn { background: var(--amber-soft); }
.kpi.alert { background: var(--out-soft); }
.big-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.big-act { display: flex; align-items: center; gap: 10px; padding: 14px 12px; border-radius: 14px; color: #fff; font-size: 15px; }
.big-act b { display: block; font-size: 16px; }
.big-act small { display: block; font-size: 12px; opacity: .85; }
.big-act .ic { flex: none; width: 36px; height: 36px; padding: 7px; border-radius: 50%; background: rgba(255, 255, 255, .2); }
.big-act.out { background: var(--out); }
.big-act.in { background: var(--brand); }
.big-act:active { filter: brightness(.94); }
.how ol { padding-left: 20px; display: grid; gap: 8px; font-size: 14.5px; color: var(--muted); }
.how b { color: var(--ink); }
.start .link-btn { margin-top: 12px; }

/* ---------- produto: foto e linha ---------- */
.thumb { display: grid; place-items: center; flex: none; border-radius: 12px; background: var(--tc, var(--chip)); overflow: hidden; line-height: 1; }
.thumb img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.prow { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.prow:last-child { border-bottom: 0; }
.prow .t, .crow .t, .lrow .t, .pick .t, .mrow .t, .row .t { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; font-weight: 600; font-size: 15px; line-height: 1.25; overflow: hidden; overflow-wrap: anywhere; }
.prow .s, .crow .s, .lrow .s, .pick .s, .mrow .s, .row .s { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.prow.out .thumb { filter: grayscale(1); opacity: .55; }
.prow.out .t { color: var(--muted); }
.pill.st-out { background: var(--out-soft); color: var(--out-strong); }
.pill.st-warn { background: var(--amber-soft); color: var(--amber-strong); }
.stepper { display: flex; align-items: center; gap: 2px; flex: none; }
.stp { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--chip); color: var(--ink); }
.stp:active { background: var(--brand-soft); color: var(--brand-strong); }
.stp:disabled { opacity: .35; }
.stq { min-width: 42px; text-align: center; display: flex; flex-direction: column; line-height: 1.05; }
.stq b { font-size: 17px; font-variant-numeric: tabular-nums; }
.stq small { font-size: 10.5px; color: var(--muted); }

/* ---------- estoque ---------- */
.toolbar { display: flex; gap: 8px; margin-bottom: 10px; }
.search { position: relative; flex: 1; min-width: 0; }
.search > span { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.search .inp { padding-left: 40px; min-height: 44px; }
.sort-btn { position: relative; width: 44px; height: 44px; flex: none; border-radius: 12px; display: grid; place-items: center; background: #fff; box-shadow: inset 0 0 0 1px var(--line); color: var(--muted); }
.sort-btn select { position: absolute; inset: 0; opacity: 0; font-size: 16px; }
.filter-chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -12px 12px; padding: 0 12px; }
.filter-chips::-webkit-scrollbar { display: none; }
.fchip { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 12px; border-radius: 17px; background: #fff; box-shadow: inset 0 0 0 1px var(--line); font-size: 14px; font-weight: 550; white-space: nowrap; }
.fchip small { font-size: 12px; color: var(--faint); font-weight: 650; }
.fchip.on { background: var(--dark); color: #fff; box-shadow: none; }
.fchip.on small { color: rgba(255, 255, 255, .7); }
.fchip.warn:not(.on) small { color: var(--amber-strong); }
.fchip.alert:not(.on) small { color: var(--out); }
.list-card { padding-top: 12px; padding-bottom: 6px; }
.group-title { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; padding-bottom: 4px; }
.group-title small { font-size: 12px; color: var(--faint); font-weight: 650; }
.group-title .link { margin-left: auto; text-transform: none; letter-spacing: 0; }
.g-emoji { font-size: 16px; }
.day-title { font-size: 13px; font-weight: 700; color: var(--muted); margin: 14px 4px 8px; }
.day-title:first-child { margin-top: 2px; }

/* ---------- histórico ---------- */
.mrow { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 0; border-bottom: 1px solid var(--line); text-align: left; }
.mrow:last-child { border-bottom: 0; }
.md { font-size: 16px; font-variant-numeric: tabular-nums; flex: none; }
.md.neg { color: var(--out); }
.md.pos { color: var(--green-strong); }

/* ---------- ficha do produto ---------- */
.pd-head { display: flex; align-items: center; gap: 14px; }
.pd-head h3 { font-size: 18px; font-weight: 700; letter-spacing: -.2px; line-height: 1.25; }
.pd-head .pill { margin-top: 6px; }
.pd-qty { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 16px 0 6px; padding: 12px; border-radius: 16px; background: var(--chip); }
.qbtn { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: #fff; color: var(--out); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); flex: none; }
.qbtn.plus { color: var(--brand-strong); }
.qbtn:disabled { opacity: .4; }
.qbtn:active { transform: scale(.96); }
.qval { flex: 1; display: flex; flex-direction: column; align-items: center; line-height: 1.1; text-align: center; }
.qval b { font-size: 34px; font-weight: 750; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.qval span { font-size: 13.5px; color: var(--muted); }
.qval small { display: inline-flex; align-items: center; gap: 4px; margin-top: 5px; font-size: 12px; font-weight: 600; color: var(--brand-strong); }
.kvs { margin: 8px 0 4px; }
.kv { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.kv:last-child { border-bottom: 0; }
.kv dt { color: var(--muted); flex: none; }
.kv dd { text-align: right; overflow-wrap: anywhere; font-weight: 550; }
.kv dd small { display: block; font-size: 12px; color: var(--muted); font-weight: 500; }
.mlist .mrow:last-child { border-bottom: 0; }

/* ---------- formulário do produto ---------- */
.pf-photo { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.pf-photo-btns { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.pf-photo-btns .link-btn { margin: 6px 0 0; font-size: 13px; }
.qty-row { display: grid; grid-template-columns: 150px 1fr; gap: 10px; align-items: center; }
.num-step { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 12px; background: #fff; overflow: hidden; }
.num-step button { width: 44px; height: 46px; flex: none; display: grid; place-items: center; color: var(--brand-strong); }
.num-step button:active { background: var(--brand-tint); }
.num-step .inp { border: 0; border-radius: 0; text-align: center; padding: 0 2px; min-height: 46px; box-shadow: none; font-weight: 650; font-variant-numeric: tabular-nums; }
.num-step.big { max-width: 260px; margin: 6px auto 12px; }
.num-step.big .inp { font-size: 28px; min-height: 64px; }
.num-step.big button { width: 64px; height: 64px; }
.codes { display: flex; flex-wrap: wrap; gap: 6px; }
.codes:not(:empty) { margin-bottom: 8px; }
.code-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 4px 5px 10px; border-radius: 10px; background: var(--chip); font-size: 14px; font-variant-numeric: tabular-nums; }
.code-chip .ic:first-child { color: var(--muted); }
.code-chip button { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; color: var(--muted); }
.code-add { display: flex; gap: 8px; }
.code-add .icon-btn { width: 48px; height: 48px; color: var(--brand-strong); }
.join-link { display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px 14px; margin-bottom: 14px; border-radius: 12px; background: var(--brand-tint); color: var(--brand-strong); font-weight: 600; font-size: 14.5px; box-shadow: inset 0 0 0 1px var(--brand-line); }
.join-link span { flex: 1; }
.info-box.ok { background: var(--green-soft); }
.info-box.ok .ic { color: var(--green-strong); }
.info-box .spinner { margin-top: 1px; }
.sticky-actions { position: sticky; bottom: calc(-18px - var(--safe-bottom)); background: var(--card); padding: 12px 0 calc(6px + var(--safe-bottom)); margin-bottom: calc(-6px - var(--safe-bottom)); border-top: 1px solid var(--line); }
.big-code { font-size: 22px; text-align: center; letter-spacing: 1.5px; font-variant-numeric: tabular-nums; min-height: 58px; }
.pick-list { margin-top: 10px; max-height: 55dvh; overflow-y: auto; }
.pick { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 2px; border-bottom: 1px solid var(--line); text-align: left; }
.pick .ic:last-child { color: var(--faint); }
.install h3 { font-size: 15px; margin: 4px 0 4px; }
.install p { font-size: 14.5px; color: var(--muted); margin-bottom: 14px; }
.install b { color: var(--ink); }

/* ---------- leitor ---------- */
.scan-page .mode-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 14px; background: var(--chip); margin-bottom: 12px; }
.mode-toggle button { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; border-radius: 11px; font-weight: 700; font-size: 16px; color: var(--muted); }
.mode-toggle button.mt-saida.on { background: var(--out); color: #fff; box-shadow: 0 2px 8px rgba(210, 90, 78, .35); }
.mode-toggle button.mt-entrada.on { background: var(--brand); color: #fff; box-shadow: 0 2px 8px rgba(47, 125, 92, .35); }
.scan-box { position: relative; width: 100%; aspect-ratio: 4 / 3; border-radius: 18px; overflow: hidden; background: #141412; color: #fff; }
.scan-box.small { aspect-ratio: 4 / 3; }
.scan-box video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-frame { position: absolute; left: 12%; right: 12%; top: 28%; bottom: 28%; border-radius: 14px; box-shadow: 0 0 0 999px rgba(0, 0, 0, .28); pointer-events: none; }
.scan-frame::before { content: ""; position: absolute; inset: 0; border-radius: 14px; border: 3px solid rgba(255, 255, 255, .9); -webkit-mask: linear-gradient(#000 0 0) top left / 28px 28px no-repeat, linear-gradient(#000 0 0) top right / 28px 28px no-repeat, linear-gradient(#000 0 0) bottom left / 28px 28px no-repeat, linear-gradient(#000 0 0) bottom right / 28px 28px no-repeat; mask: linear-gradient(#000 0 0) top left / 28px 28px no-repeat, linear-gradient(#000 0 0) top right / 28px 28px no-repeat, linear-gradient(#000 0 0) bottom left / 28px 28px no-repeat, linear-gradient(#000 0 0) bottom right / 28px 28px no-repeat; }
.scan-line { position: absolute; left: 8px; right: 8px; top: 50%; height: 2px; border-radius: 1px; background: #ff5a4a; box-shadow: 0 0 10px #ff5a4a; animation: scanline 1.8s ease-in-out infinite; }
.scan-page[data-mode=entrada] .scan-line { background: #4fe0a0; box-shadow: 0 0 10px #4fe0a0; }
@keyframes scanline { 0%, 100% { transform: translateY(-34px); opacity: .55; } 50% { transform: translateY(34px); opacity: 1; } }
.scan-wait { position: absolute; inset: 0; display: grid; place-items: center; background: #141412; }
.scan-err { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 20px 26px; text-align: center; font-size: 14.5px; line-height: 1.45; color: rgba(255, 255, 255, .9); }
.scan-err .ic { opacity: .7; }
.btn-light { background: #fff; color: var(--ink); }
.scan-flash { position: absolute; left: 10px; right: 10px; bottom: 10px; padding: 11px 14px; border-radius: 12px; font-weight: 650; font-size: 15px; color: #fff; text-align: center; transform: translateY(140%); transition: transform .22s cubic-bezier(.2, .8, .2, 1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scan-flash.show { transform: none; }
.scan-flash.out { background: var(--out); }
.scan-flash.in { background: var(--brand); }
.scan-flash.err { background: #3a3633; }
.scan-hint { text-align: center; font-size: 14px; color: var(--muted); margin: 10px 8px 12px; }
.scan-tools { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.tool { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-radius: 12px; background: var(--card); box-shadow: var(--shadow); font-size: 12.5px; font-weight: 600; color: var(--ink); text-align: center; }
.tool .ic { color: var(--brand-strong); }
.tool.on { background: var(--amber-soft); }
.tool.on .ic { color: var(--amber-strong); }
.log-empty { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 6px 0; }
.log-empty .ic { color: var(--faint); }
.log-sum { margin: -4px 0 6px; }
.lrow { display: flex; align-items: center; gap: 6px; border-bottom: 1px solid var(--line); }
.lrow:last-child { border-bottom: 0; }
.lrow-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 9px 0; text-align: left; }
.lrow.neg .s b { color: var(--out); }
.lrow.pos .s b { color: var(--green-strong); }
.lrow.zero .s b { color: var(--muted); }
.lrow.undone .lrow-main { opacity: .45; text-decoration: line-through; }
.mini { min-width: 38px; height: 34px; padding: 0 8px; border-radius: 10px; display: grid; place-items: center; background: var(--chip); font-weight: 700; font-size: 14px; color: var(--ink); flex: none; }
.mini:active { background: var(--brand-soft); }

/* ---------- compras ---------- */
.add-item { display: flex; gap: 8px; margin-bottom: 12px; }
.add-item .btn { width: 48px; padding: 0; flex: none; }
.crow { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.crow:last-child { border-bottom: 0; }
.crow-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; text-align: left; }
.ck { width: 28px; height: 28px; flex: none; border-radius: 8px; display: grid; place-items: center; box-shadow: inset 0 0 0 2px #cfc9c2; color: transparent; background: #fff; }
.ck.on { background: var(--brand); box-shadow: none; color: #fff; }
.crow.done .t { text-decoration: line-through; color: var(--faint); }
.crow.done .thumb { opacity: .5; }
.red { color: var(--out); }
.icon-btn.sm { width: 34px; height: 34px; color: var(--faint); }
.tip { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; color: var(--muted); margin: 4px 6px 0; }
.tip .ic { flex: none; margin-top: 1px; }
.tip a { color: var(--brand-strong); }

@media (min-width: 620px) {
  .tabbar { bottom: 12px; border-radius: 20px; border: 1px solid var(--line); box-shadow: 0 8px 30px rgba(40, 30, 20, .08); left: 12px; right: 12px; }
}
