/* Bela Gestão — Bela UI, mobile first */
@font-face {
  font-family: 'Manrope';
  src: url('../fonts/Manrope-Variable.ttf') format('truetype');
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
}
:root {
  color-scheme: light;
  --pink: #b4235a; --pink-d: #8e1745; --pink-l: #fceef3; --pink-xl: #fff8fa;
  --ink: #2d2027; --muted: #725e68; --line: #e8ced8; --card: #fff; --bg: #fff8fa;
  --good: #2e7d5b; --good-bg: #e6f4ed; --bad: #b3264a; --bad-bg: #fdecef; --warn: #9a5c00; --warn-bg: #fff3dc;
  --berry-soft: #d96893; --plum: #4b2638;
  --r: 16px; --r-lg: 22px; --shadow: 0 8px 28px rgba(75, 38, 56, .08); --shadow-float: 0 14px 34px rgba(75, 38, 56, .14);
  --tabs-h: 68px;
  --safe-b: var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
  --safe-t: var(--safe-area-inset-top, env(safe-area-inset-top, 0px));
  --wa-font-family-body: 'Manrope', system-ui, sans-serif;
  --wa-color-brand-fill-loud: var(--pink);
  --wa-color-brand-on-loud: #fff;
}
/* Celulares novos desenham o app por baixo da barra de status (relógio/notificações): reserva esse espaço no topo. */
body::before { content: ''; position: fixed; top: 0; left: 0; right: 0; height: var(--safe-t); background: var(--pink); z-index: 40; pointer-events: none; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font: 16px/1.48 'Manrope', system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--ink); background: var(--bg);
  -webkit-text-size-adjust: 100%; overscroll-behavior-y: none;
}
#app { min-height: 100%; max-width: 720px; margin: 0 auto; position: relative; background: var(--bg); padding-top: var(--safe-t); }
#view { padding-bottom: calc(var(--tabs-h) + var(--safe-b) + 16px); outline: none; }
.boot { min-height: 100dvh; padding: 0 24px calc(var(--tabs-h) + 24px); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; color: var(--muted); }
.boot wa-spinner { font-size: 42px; color: var(--pink); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 24px; } h2 { font-size: 20px; } h3 { font-size: 17px; }
p { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid #f7a3c8; outline-offset: 2px; }

/* layout helpers */
.page { padding: 18px 16px 24px; display: flex; flex-direction: column; gap: 20px; }
.page-head { min-height: 48px; display: flex; align-items: center; gap: 8px; }
.page-head h1 { flex: 1; font-size: 22px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.update-review { gap: 16px; }
.update-list { margin: 0; padding-left: 22px; display: grid; gap: 10px; color: var(--ink); }
.update-list li { line-height: 1.45; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack-s { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; }
.gap { gap: 12px; } .gap-s { gap: 6px; }
.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.center { text-align: center; justify-content: center; }
.left { text-align: left; }
.pad { padding: 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.dim { opacity: .55; }
.spacer-bar { height: 96px; }
.link, .linkish { color: var(--pink-d); background: none; border: 0; padding: 4px 0; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.linkish { text-decoration: none; }
.ico { display: inline-block; vertical-align: middle; flex: none; line-height: 0; }
.ico svg { display: block; }

/* cards */
.card { background: var(--card); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); border: 1px solid color-mix(in srgb, var(--line) 72%, transparent); }
.warn-card { background: var(--warn-bg); border-color: #f3d9a4; }
.tip { background: var(--pink-l); border-color: #f7c6dc; box-shadow: none; }
.note { font-size: 13px; color: var(--muted); }
.hello { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.hello h1 { font-size: 26px; }
.install { display: flex; align-items: center; gap: 12px; background: linear-gradient(135deg, var(--pink), #f0508f); color: #fff; border: 0; }
.install:empty { display: none; }
.install .muted { color: rgba(255, 255, 255, .9); }
.install .btn, .install .btn.primary { background: #fff; color: var(--pink-d); border-color: #fff; box-shadow: none; }
.install .icon-btn { color: #fff; }
.start { background: linear-gradient(160deg, #fff, var(--pink-l)); }
.steps { margin: 8px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }

/* stats */
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat-top { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.stat-val { font-size: 22px; font-weight: 700; letter-spacing: -.3px; overflow-wrap: anywhere; }
.stat-sub { font-size: 12px; color: var(--muted); }
.home-stats { align-items: stretch; }
.home-stats .stat { min-height: 118px; justify-content: space-between; padding: 14px 12px; }
.home-stats .stat-top { min-width: 0; flex-wrap: wrap; line-height: 1.25; }
.home-stats .stat-val { line-height: 1.15; font-size: clamp(18px, 5vw, 22px); }
.home-stats .stat-sub { line-height: 1.3; overflow-wrap: anywhere; }
.delta { font-size: 12px; font-weight: 600; }
.delta.up, .up { color: var(--good); }
.delta.down, .down { color: var(--bad); }
.good { color: var(--good); } .bad { color: var(--bad); } .warn { color: var(--warn); }
.pos { color: var(--good); } .neg { color: var(--bad); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 18px;
  border-radius: 14px; border: 1.5px solid var(--pink); background: #fff; color: var(--pink-d); font-weight: 750; text-decoration: none; transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--pink); color: #fff; box-shadow: 0 8px 20px rgba(180, 35, 90, .24); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.danger-text { color: var(--bad); border-color: transparent; background: transparent; }
.btn.wa { background: #25a244; border-color: #25a244; color: #fff; }
.btn.small { min-height: 40px; padding: 6px 12px; font-size: 14px; border-radius: 12px; }
.btn.lg { min-height: 58px; font-size: 18px; border-radius: 16px; }
.btn.block { display: flex; width: 100%; }
.page-head .btn[hidden] { display: none; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 0; background: transparent; display: inline-flex; align-items: center; justify-content: center; color: var(--pink-d); flex: none; }
.icon-btn:active { background: var(--pink-l); }

/* inputs */
.field { display: flex; flex-direction: column; gap: 6px; }
.lbl { font-weight: 600; font-size: 14px; }
.hint { font-size: 12px; color: var(--muted); }
.input, select.input, textarea.input {
  width: 100%; min-height: 48px; padding: 10px 14px; font: inherit; color: var(--ink); background: #fff;
  border: 1.5px solid var(--line); border-radius: 14px; appearance: none; -webkit-appearance: none;
}
.input:focus { border-color: var(--pink); outline: none; box-shadow: 0 0 0 4px rgba(180, 35, 90, .11); }
.input.big { min-height: 56px; font-size: 18px; }
textarea.input { min-height: 96px; resize: vertical; }
select.input { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' fill='none' stroke='%23b01a58' stroke-width='2'%3E%3Cpath d='M1 1l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 38px; }
/* Teclado aberto no celular: some o menu e a barra de ações desce para o rodapé. */
@media (max-width: 720px) {
  body.typing .tabs { display: none; }
  body.typing .sticky-bar { bottom: 0; padding-bottom: calc(10px + var(--safe-b)); }
  body.typing #view { padding-bottom: 96px; }
  body.typing #toasts { bottom: 120px; }
}
.date-wrap { position: relative; }
.date-wrap > .input { padding-right: 52px; }
.date-wrap > .input.bad { border-color: var(--bad, #c62828); }
.date-native { position: absolute; right: 8px; bottom: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.date-btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border: 0; background: none; color: var(--pink-d); display: grid; place-items: center; border-radius: 10px; }

/* chips + segments */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips.scroll, .scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 2px 16px; }
.scroll::-webkit-scrollbar { display: none; }
.chip { flex: none; min-height: 42px; padding: 7px 15px; border-radius: 999px; border: 1.5px solid var(--line); background: #fff; font-weight: 650; font-size: 14px; color: var(--muted); }
.chip.on { background: var(--pink); border-color: var(--pink); color: #fff; }
.seg { display: flex; background: var(--pink-l); border-radius: 14px; padding: 4px; gap: 4px; }
.seg button { flex: 1; min-height: 42px; border: 0; background: transparent; border-radius: 10px; font-weight: 700; color: var(--pink-d); }
.seg button.on, .seg button.active { background: #fff; box-shadow: var(--shadow); }

/* lists */
.list { display: flex; flex-direction: column; gap: 10px; }
.list-tight { display: flex; flex-direction: column; gap: 6px; }
.list-sep > * + * { border-top: 1px solid var(--line); }
.row-item { display: flex; align-items: center; gap: 13px; padding: 14px 15px; background: var(--card); border: 1px solid color-mix(in srgb, var(--line) 78%, transparent); border-radius: var(--r); width: 100%; text-align: left; min-height: 72px; box-shadow: 0 5px 18px rgba(75, 38, 56, .055); }
.product-thumb { flex: 0 0 52px; width: 52px; height: 52px; object-fit: cover; border-radius: 14px; background: var(--pink-xl); border: 1px solid var(--line); display: grid; place-items: center; color: var(--pink-d); }
.product-thumb-sm { flex-basis: 42px; width: 42px; height: 42px; border-radius: 11px; }
.product-thumb-empty { display: grid; place-items: center; }
.list-sep .row-item { border: 0; border-radius: 0; background: transparent; }
button.row-item:active, a.row-item:active { background: var(--pink-xl); }
.ri-main { flex: 1; min-width: 0; }
.ri-title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ri-sub { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ri-side { text-align: right; font-weight: 700; flex: none; }
.use-row { display: flex; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.use-row:last-child { border-bottom: 0; }
.alert-card { display: flex; flex-direction: column; gap: 12px; margin-bottom: 10px; }
.alert-card .linkish { text-align: left; text-decoration: none; color: var(--ink); }
.alert-card .btn.ghost { min-height: 44px; }
button.use-row { background: none; border: 0; width: 100%; align-items: center; text-align: left; }
.avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--pink-l); color: var(--pink-d); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; flex: none; }
.avatar.lg { width: 64px; height: 64px; font-size: 22px; }
.client-head { display: flex; align-items: center; gap: 14px; }
.client-pick { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 64px; padding: 10px 14px; text-align: left; background: #fff; border: 2px dashed #f0b3cf; border-radius: var(--r); color: var(--pink-d); font-weight: 700; }
.client-pick.set { border: 1px solid var(--line); border-style: solid; color: var(--ink); box-shadow: var(--shadow); font-weight: 400; }
.page > section { display: flex; flex-direction: column; gap: 10px; }
.page > section > div > .chips { margin: 0; }
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--pink-l); color: var(--pink-d); white-space: nowrap; }
.badge.ok { background: var(--good-bg); color: var(--good); }
.badge.off { background: var(--bad-bg); color: var(--bad); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.row-item .badge, .ri-side .badge, .use-row > .badge { align-self: center; display: inline-block; }
.code { font-family: ui-monospace, Consolas, monospace; font-size: 12px; background: #f6edf1; color: var(--ink); padding: 2px 6px; border-radius: 6px; white-space: nowrap; }
.count { background: var(--pink); color: #fff; border-radius: 999px; font-size: 12px; font-weight: 700; padding: 2px 8px; min-width: 22px; text-align: center; }

/* search suggestions */
.psearch { position: relative; display: flex; flex-direction: column; gap: 6px; }
.search-wrap { position: relative; }
.search-wrap > .ico { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-wrap > .input { padding-left: 44px; }
.chip-toggle { align-self: flex-start; border: 0; background: none; padding: 4px 2px; min-height: 32px; text-align: left; color: var(--pink-d); font-size: 13px; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.si-main { flex: 1; min-width: 0; }
.si-side { text-align: right; display: flex; flex-direction: column; gap: 4px; align-items: flex-end; flex: none; }
.suggest { display: flex; flex-direction: column; background: #fff; border: 2px solid var(--pink-l); border-radius: 14px; margin-top: 6px; max-height: 46vh; overflow-y: auto; box-shadow: var(--shadow); }
.suggest-item { display: flex; align-items: center; gap: 10px; padding: 14px 12px; min-height: 56px; border: 0; border-bottom: 1px solid var(--line); background: #fff; text-align: left; width: 100%; flex: none; }
.suggest-item:last-child { border-bottom: 0; }
.suggest-item:active, .suggest-item.on { background: var(--pink-l); }
.suggest-item > .product-thumb { flex: 0 0 42px; width: 42px; }
.suggest-item > .si-main { flex: 1 1 auto; min-width: 0; }
[class^="si-"], [class*=" si-"] { font-size: 13px; }
.si-name { font-weight: 600; font-size: 15px; }
.si-code { font-family: ui-monospace, Consolas, monospace; color: var(--pink-d); font-weight: 700; }
.si-sub { color: var(--muted); }
.si-price { font-weight: 700; margin-left: auto; }
.suggest-empty { padding: 16px; text-align: center; color: var(--muted); }

/* sale / purchase items */
.item { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.item-top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.item-bot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.price-wrap { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.price-in { width: 124px; min-height: 42px; text-align: right; padding: 6px 10px; }
.line-total { font-weight: 700; }
.stepper { display: inline-flex; align-items: center; background: var(--pink-l); border-radius: 14px; }
.stepper button { width: 46px; height: 46px; border: 0; background: transparent; font-size: 24px; font-weight: 700; color: var(--pink-d); border-radius: 14px; }
.stepper button:active { background: #f8c3da; }
.step-val { min-width: 36px; text-align: center; font-weight: 700; font-size: 18px; }
.hint-box { background: var(--pink-xl); border: 1px dashed #f0b3cf; border-radius: 12px; padding: 10px 12px; font-size: 13px; color: var(--muted); }
.total { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.big-total { font-size: 26px; font-weight: 800; color: var(--pink-d); }
.sticky-bar { position: fixed; left: 0; right: 0; bottom: calc(var(--tabs-h) + var(--safe-b)); max-width: 720px; margin: 0 auto; padding: 10px 16px; background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -4px 14px rgba(176, 26, 88, .08); display: flex; flex-direction: column; gap: 8px; z-index: 20; }

/* bottom tabs */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; max-width: 720px; margin: 0 auto; height: calc(var(--tabs-h) + var(--safe-b)); padding: 4px 4px var(--safe-b); background: rgba(255,255,255,.97); backdrop-filter: blur(18px); border-top: 1px solid color-mix(in srgb, var(--line) 70%, transparent); display: grid; grid-template-columns: repeat(4, 1fr); z-index: 30; box-shadow: 0 -10px 30px rgba(75, 38, 56, .07); }
.tab { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; border-radius: 14px; background: none; color: var(--muted); font-size: 11px; font-weight: 650; min-height: 52px; }
.tab.active { color: var(--pink); }
.tab.active::before { content: ''; position: absolute; inset: 5px 12px; border-radius: 13px; background: var(--pink-l); z-index: -1; }
.tab-ico { display: inline-flex; transition: transform 180ms ease; }
.tab.active .tab-ico { transform: translateY(-1px) scale(1.06); }
.dot { position: absolute; top: 6px; left: calc(50% + 6px); background: var(--bad); color: #fff; font-style: normal; font-size: 10px; font-weight: 700; min-width: 18px; height: 18px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; padding: 0 4px; }
.dot[hidden] { display: none; }

/* menu */
.menu { display: flex; flex-direction: column; gap: 10px; }
.menu-item { display: flex; align-items: center; gap: 14px; padding: 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); min-height: 64px; width: 100%; text-align: left; }
.menu-item:active { background: var(--pink-xl); }
.menu-ico { width: 44px; height: 44px; border-radius: 14px; background: linear-gradient(145deg, #fff, var(--pink-l)); color: var(--pink-d); border: 1px solid rgba(180,35,90,.08); box-shadow: inset 0 1px 0 rgba(255,255,255,.9); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 14px 8px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); font-weight: 600; font-size: 14px; min-height: 84px; box-shadow: var(--shadow); text-align: center; }
.tile:active { background: var(--pink-xl); }

/* charts */
svg.bars { display: block; width: 100%; height: auto; }
svg.bars .bar { fill: var(--pink); }
svg.bars .bar.zero { fill: var(--line); }
svg.bars text { font-size: 10px; fill: var(--muted); }
.rank { display: flex; flex-direction: column; gap: 12px; }
.rank-row { display: flex; align-items: center; gap: 10px; }
.rank-n { width: 24px; height: 24px; border-radius: 50%; background: var(--pink-l); color: var(--pink-d); font-size: 12px; font-weight: 800; display: flex; align-items: center; justify-content: center; flex: none; }
.rank-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.rank-name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-val { font-size: 13px; font-weight: 700; flex: none; text-align: right; }
.meter { height: 8px; background: var(--pink-l); border-radius: 4px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--pink); border-radius: 4px; }

/* tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td { padding: 8px 10px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--line); }
.tbl th { background: var(--pink-l); color: var(--pink-d); position: sticky; top: 0; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.report-sheet { display: flex; flex-direction: column; gap: 12px; }
.grid3.sum { margin-top: 12px; }
.sum > div { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px 6px; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12px; color: var(--muted); }
.sum > div b { font-size: 14px; color: var(--ink); }
.tbl tfoot td { font-weight: 800; background: var(--pink-xl); }
.tbl tr.sum td { font-weight: 800; background: var(--pink-xl); }
.report-head { display: none; }
.foot { font-size: 11px; color: var(--muted); }

/* empty */
.empty { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 32px 16px; color: var(--muted); }
.empty-ico { width: 72px; height: 72px; border-radius: 50%; background: var(--pink-l); color: var(--pink); display: flex; align-items: center; justify-content: center; }
.empty h3 { color: var(--ink); }

/* sheets */
#sheets { position: relative; z-index: 100; }
.sheet-back { position: fixed; inset: 0; background: rgba(42, 31, 40, .5); z-index: 100; opacity: 0; transition: opacity .2s; }
.sheet-back.in { opacity: 1; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; margin: 0 auto; z-index: 101; background: #fff; width: 100%; max-width: 720px; max-height: 92vh; max-height: 92dvh; border-radius: 24px 24px 0 0; display: flex; flex-direction: column; transform: translateY(100%); transition: transform .22s ease-out; }
.sheet.in { transform: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 8px 8px 20px; }
.sheet-head h2 { font-size: 19px; }
.sheet-body { padding: 4px 20px calc(20px + var(--safe-b)); overflow-y: auto; -webkit-overflow-scrolling: touch; display: flex; flex-direction: column; gap: 14px; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* toasts */
#toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--tabs-h) + var(--safe-b) + 16px); display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 200; pointer-events: none; padding: 0 16px; }
.toast { background: #2a1f28; color: #fff; padding: 12px 18px; border-radius: 14px; font-weight: 600; font-size: 15px; max-width: 420px; text-align: center; box-shadow: 0 6px 20px rgba(0, 0, 0, .25); animation: up .2s ease-out; }
.toast.out { opacity: 0; transition: opacity .25s; }

@media (min-width: 721px) {
  body { background: #f6e6ee; }
  #app { box-shadow: 0 0 40px rgba(176, 26, 88, .12); }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* busca fixa no topo ao rolar */
.sticky-top { position: sticky; top: var(--safe-t); z-index: 15; background: var(--bg); margin: 0 -16px; padding: 8px 16px; display: flex; flex-direction: column; gap: 8px; box-shadow: 0 6px 10px -8px rgba(176, 26, 88, .25); }
.suggest-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; background: var(--pink-xl); border-bottom: 1px solid var(--line); position: sticky; top: 0; }
.suggest-item.create { background: var(--pink-xl); color: var(--pink-d); }
.suggest-item.create .si-name { display: flex; align-items: center; gap: 4px; }

/* venda: cliente minimizado */
.client-sec.done h2 { display: none; }
.client-chip { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 52px; padding: 8px 12px; background: var(--good-bg); border: 1px solid #bfe6d1; border-radius: var(--r); text-align: left; }
.client-chip .grow { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* venda: custo / margem / preço final */
.calc { display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: 8px; align-items: end; background: var(--pink-xl); border-radius: 12px; padding: 8px; }
.calc-cell { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.lbl-s { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .3px; }
.calc-cell b { font-size: 15px; min-height: 40px; display: flex; align-items: center; }
.mini-in { width: 100%; min-height: 40px; padding: 4px 8px; text-align: right; font-size: 15px; font-weight: 600; }
.calc-sub { font-size: 12px; color: var(--muted); }

/* pagamento detalhado / parcelas */
.pay-box { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; display: flex; flex-direction: column; gap: 12px; }
.inst-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.inst-row { display: flex; align-items: center; gap: 8px; padding: 8px 12px; font-size: 14px; border-bottom: 1px solid var(--line); }
.inst-row:last-child { border-bottom: 0; }
.inst-row .n { width: 34px; font-weight: 700; color: var(--pink-d); }
.inst-row .d { flex: 1; min-width: 0; }
.inst-row .v { text-align: right; font-weight: 700; }
.inst-row.paid { background: var(--good-bg); }
.sel { min-height: 46px; padding: 6px 10px; border: 2px solid var(--line); border-radius: 12px; background: #fff; font: inherit; width: 100%; }

/* a receber */
button.stat.tap { text-align: left; border: 1px solid var(--line); width: 100%; }
button.stat.tap:active { background: var(--pink-l); }
.recv { display: grid; gap: 12px; padding: 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); min-width: 0; }
.recv.late { border-color: #f1b8b8; background: #fffafa; }
.recv-main { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: start; text-align: left; background: none; border: 0; padding: 0; width: 100%; height: auto; block-size: auto; min-height: 0; max-height: none; white-space: normal; }
.recv-main .ri-main { display: grid; gap: 4px; min-width: 0; }
.recv-main .ri-title { white-space: normal; overflow-wrap: anywhere; line-height: 1.4; }
.recv-main .ri-sub { white-space: normal; overflow: visible; line-height: 1.4; }
.recv-main .ri-side { white-space: nowrap; line-height: 1.4; }
.recv-due { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.recv-due time { white-space: nowrap; }
.recv-actions { display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }
.recv-actions .btn { min-height: 44px; flex: 1 1 120px; }
.row-item-wrap { display: flex; flex-direction: column; gap: 6px; }
.restock { align-self: flex-end; }
.banner { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 12px 14px; background: var(--warn-bg); border: 1px solid #f3d9a4; border-radius: var(--r); }
.month-head { display: flex; justify-content: space-between; font-weight: 700; color: var(--muted); font-size: 14px; padding: 4px 2px; }
.seg button { font-size: 14px; padding: 0 4px; }

/* print (relatórios em PDF) */
@media print {
  body { background: #fff; }
  .tabs, .no-print, #toasts, .sticky-bar, .icon-btn, .page-head .btn { display: none !important; }
  #view { padding: 0; }
  #app { max-width: none; box-shadow: none; }
  .page { padding: 0; }
  .card, .table-wrap { box-shadow: none; }
  .report-head { display: block; margin-bottom: 8px; }
  .table-wrap { overflow: visible; border: 0; }
  .tbl th { position: static; background: #eee; color: #000; }
  .tbl th, .tbl td { white-space: normal; }
  .sheet-back { position: static; background: none; }
  .sheet { max-height: none; border-radius: 0; }
}

/* ---------- Bela UI: acesso e faixa de licença ---------- */
.faixa-slot:empty { display: none; }
.faixa-estado {
  margin: 10px 16px 0; padding: 11px 14px; min-height: 44px; display: flex; gap: 10px;
  align-items: center; flex-wrap: wrap; border-radius: 14px; background: var(--warn-bg); border-color: #efd59f; box-shadow: none;
}
.faixa-estado.is-compact { min-height: 36px; margin-top: 6px; padding: 6px 12px; background: var(--pink-l); border-color: var(--line); border-radius: 12px; color: var(--plum); }
.faixa-estado.is-readonly { background: var(--bad-bg); border-color: #efbcc8; }
.faixa-message { min-width: 170px; font-weight: 650; }
.faixa-details { min-height: 34px; padding: 5px 8px; border: 0; background: transparent; color: var(--pink-d); font: inherit; font-size: 12px; font-weight: 750; }
.vault-review.btn { min-height: 44px; }
.gate-access-page { min-height: calc(100dvh - var(--safe-t)); padding-top: 0; justify-content: flex-start; }
.gate-hero { margin: -1px -16px 2px; padding: 28px 22px 30px; border-radius: 0 0 30px 30px; color: #fff; background: linear-gradient(145deg, var(--pink-d), var(--pink) 58%, var(--berry-soft)); box-shadow: var(--shadow-float); }
.gate-brand-mark { width: 58px; height: 58px; object-fit: contain; flex: none; border-radius: 18px; box-shadow: 0 8px 20px rgba(55,17,38,.2); }
.gate-methods { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.gate-method-option { min-height: 46px; border: 1px solid var(--line); border-radius: 14px; background: #fff; color: var(--plum); font: inherit; font-weight: 700; }
.gate-method-option.active { background: var(--pink-l); border-color: var(--pink); color: var(--pink-d); }
.welcome-logo { width: 80px; height: 80px; object-fit: contain; border-radius: 23px; margin: 0 auto 4px; }
.install-logo { width: 44px; height: 44px; object-fit: contain; border-radius: 13px; flex: none; }
.gate-hero-copy { display: grid; gap: 4px; }
.gate-eyebrow { font-size: 12px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; color: rgba(255,255,255,.78); }
.gate-hero h1 { font-size: clamp(24px, 7vw, 30px); }
.gate-access-card { padding: 22px; border: 0; border-radius: var(--r-lg); box-shadow: var(--shadow-float); }
.gate-card-heading { display: grid; gap: 5px; }
.gate-card-title { font-size: 19px; }
.gate-identity-input { font-weight: 650; }
.gate-form-error { margin: 0; color: var(--bad); font-weight: 700; }
.gate-submit { min-height: 56px; }
.gate-privacy-note { padding: 11px 13px; border-radius: 12px; color: var(--muted); background: var(--pink-xl); border: 1px solid var(--line); }
.gate-entry-actions, .gate-secondary-links { display: grid; gap: 10px; }
.gate-secondary-links { grid-template-columns: 1fr 1fr; }
.gate-secondary-link { text-align: center; padding: 8px; font-size: 13px; }
.gate-trial-link { border-color: var(--line); }
.gate-help-copy { padding-inline: 18px; }

/* ---------- Bela UI: estoque ---------- */
.stock-page .sticky-top { gap: 12px; padding: 10px var(--stock-gutter, 16px); margin-inline: calc(-1 * var(--stock-gutter, 16px)); }
.inventory-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px;
  border: 1px solid #ecd8e2;
  border-radius: 17px;
  background: linear-gradient(120deg, #fffafe, #f7e7ee);
  box-shadow: 0 6px 19px #6823430b;
}
.inventory-action-copy { display: grid; gap: 2px; }
.inventory-action-copy span { color: #715361; font-size: .78rem; }
.inventory-action-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.inventory-action-buttons .btn { min-height: 44px; }
.stock-page .purchases-list-page { gap: 12px; min-width: 0; }
.stock-page .purchases-list-page h2 { margin: 0; }
.inventory-tabs { background: #f8e4ec; }
.inventory-tabs button { min-width: 0; }
.team-auth-form .field[hidden] { display: none; }
.purchase-invoice {
  display: grid;
  gap: 10px;
  padding: 13px;
  border: 1px solid #ecd8e2;
  border-radius: 15px;
  background: linear-gradient(120deg, #fffafe, #f8ecf1);
}
.purchase-invoice .invoice-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.purchase-invoice .invoice-picker input[hidden] { display: none; }
.purchase-invoice .invoice-picker .btn {
  flex: 1 1 132px;
  min-width: 0;
  min-height: 44px;
  padding-inline: 8px;
  justify-content: center;
  border-color: #e8cedc;
  background: #fff9fc;
  color: #71334f;
}
.purchase-invoice p { margin: 0; }
.purchase-invoice-warnings { margin: 0; padding-inline-start: 1.2rem; overflow-wrap: anywhere; }
.purchase-invoice-warnings li + li { margin-top: .25rem; }
.purchase-invoice-review { display: flex; align-items: start; gap: 9px; font-size: .82rem; }
.purchase-invoice-review[hidden] { display: none; }
.purchase-invoice-review input { margin-top: 3px; accent-color: #a63168; }
.inventory-summary { display: flex; overflow-x: auto; gap: 10px; margin-inline: calc(-1 * var(--stock-gutter, 16px)); padding: 0 var(--stock-gutter, 16px) 4px; scrollbar-width: none; }
.inventory-summary::-webkit-scrollbar { display: none; }
.inventory-summary .stat { min-width: 142px; box-shadow: none; }
.inventory-filters { flex-wrap: nowrap; overflow-x: auto; margin-inline: calc(-1 * var(--stock-gutter, 16px)); padding-inline: var(--stock-gutter, 16px); scrollbar-width: none; }
.product-list { gap: 12px; }
.product-card { align-items: center; }
.product-card .product-thumb { flex-basis: 64px; width: 64px; height: 64px; border-radius: 16px; }
.product-card .ri-title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.3; }
.product-card .ri-side { display: grid; justify-items: end; gap: 7px; }
.product-detail .stat { box-shadow: none; }

/* ---------- Bela UI: compras ---------- */
.purchase-page { gap: 12px; padding-top: 9px; }
.purchase-page .page-head { min-height: 42px; }
.purchase-page .page-head h1 { font-size: 21px; }
.purchase-top { display: grid; gap: 9px; }
.purchase-top > * { min-width: 0; max-width: 100%; }
.purchase-kind { width: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.purchase-kind::-webkit-scrollbar { display: none; }
.purchase-kind .chip { min-height: 36px; padding: 5px 13px; }
.purchase-intro { overflow: hidden; font-size: 13px; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }
.purchase-search .psearch { gap: 8px; }
.purchase-search .input.big { min-height: 52px; }
.purchase-details { overflow: hidden; border: 1px solid var(--line); border-radius: var(--r); background: #fff; }
.purchase-details summary { min-height: 50px; padding: 10px 14px; display: flex; align-items: center; gap: 9px; color: var(--pink-d); font-weight: 750; cursor: pointer; list-style: none; }
.purchase-details summary::-webkit-details-marker { display: none; }
.purchase-details[open] summary { border-bottom: 1px solid var(--line); }
.purchase-meta { padding: 14px; }
.purchase-items { display: grid; gap: 10px; }
.purchase-item { gap: 10px; padding: 12px; border-color: color-mix(in srgb, var(--line) 76%, transparent); box-shadow: var(--shadow); }
.purchase-item .item-top { gap: 6px; }
.purchase-item-name { min-width: 0; }
.purchase-item-name .ri-title { font-size: 15px; line-height: 1.25; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.purchase-item-name .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.purchase-quantity { padding-top: 0; }
.purchase-pricing { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 13px; background: var(--pink-xl); border: 1px solid var(--line); border-radius: 14px; }
.purchase-pricing > .field:nth-child(3) { grid-column: 1 / -1; }
.purchase-pricing.loan-pricing { grid-template-columns: 1fr; }
.purchase-money, .purchase-margin { font-variant-numeric: tabular-nums; text-align: right; font-weight: 700; }
.input-suffix { position: relative; }
.input-suffix .input { padding-right: 34px; }
.input-suffix > span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 700; pointer-events: none; }
.purchase-pricing-meta { gap: 8px; }
.purchase-default { min-height: 38px; padding: 5px 8px; border: 0; background: transparent; color: var(--pink-d); }
.purchase-source { background: #f5e8ee; }
.purchase-total { display: grid; gap: 1px; }
.purchase-total .total { font-size: 20px; color: var(--plum); }
.purchase-footer { flex-direction: row; align-items: center; }
.purchase-footer .btn { flex: 1; }
.purchase-history { gap: 12px; }
.purchase-history-item :is(.ri-title, .ri-sub) { white-space: normal; overflow-wrap: anywhere; }
.purchase-detail-row { align-items: center; }
.purchase-item .product-thumb, .purchase-detail-row .product-thumb { object-fit: contain; }
.purchase-search .suggest-item { min-height: 72px; padding-block: 8px; }
.purchase-search .suggest-item > .product-thumb { flex: 0 0 58px; width: 58px; height: 58px; border-radius: 14px; }
.purchase-search .suggest-item .si-name { font-size: 15px; line-height: 1.25; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.purchase-page.purchase-searching { gap: 8px; }
.purchase-page.purchase-searching .page-head { position: sticky; top: var(--safe-t); z-index: 17; margin: -9px -16px 0; padding: 9px 16px 7px; background: var(--bg); box-shadow: 0 5px 12px -10px rgba(75, 38, 56, .55); }
.purchase-page.purchase-searching .purchase-kind,
.purchase-page.purchase-searching .purchase-intro,
.purchase-page.purchase-searching .purchase-details { display: none; }
.purchase-page.purchase-searching .purchase-search { position: sticky; top: calc(var(--safe-t) + 50px); z-index: 16; margin: 0 -4px; padding: 5px 4px 8px; background: var(--bg); box-shadow: 0 8px 12px -12px rgba(75, 38, 56, .6); }
.purchase-page.purchase-searching .purchase-search .suggest { max-height: calc(100dvh - var(--safe-t) - var(--tabs-h) - 172px); }

/* ---------- Bela UI: configurações e Mais ---------- */
.settings-page { gap: 18px; }
.settings-form { gap: 18px; }
.settings-group { gap: 16px; box-shadow: 0 5px 20px rgba(75,38,56,.055); }
.settings-heading { display: grid; gap: 4px; }
.settings-heading h2 { font-size: 18px; color: var(--plum); }
.pricing-example { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pricing-example > span { padding: 10px 8px; border-radius: 12px; background: var(--pink-xl); color: var(--muted); font-size: 12px; text-align: center; }
.pricing-example b { display: block; margin-top: 2px; color: var(--ink); font-size: 14px; font-variant-numeric: tabular-nums; }
.settings-save { position: sticky; bottom: calc(var(--tabs-h) + var(--safe-b) + 10px); z-index: 12; box-shadow: var(--shadow-float); }
.danger-zone { border-color: #efbcc8; }
.menu-section-title { margin: 8px 3px 0; color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.more-menu { gap: 11px; }
.more-menu .menu-item { box-shadow: 0 5px 18px rgba(75,38,56,.055); }
.more-menu .menu-item > .grow { min-width: 0; }
.more-menu .menu-item > .grow .small { line-height: 1.35; white-space: normal; overflow-wrap: anywhere; }
.more-menu .menu-item > .ico { flex: none; margin-left: auto; }

/* ---------- Lista de vendas/compras como destinos principais ---------- */
.sales-list-page .page-head, .purchases-list-page .page-head { margin-bottom: 2px; }
.sales-list-page .list, .purchases-list-page .list { gap: 12px; }

/* ---------- Bela UI: nova venda ---------- */
.sell.page { gap: 14px; padding-top: 9px; overflow-x: clip; }
.sell > .page-head { min-height: 42px; }
.sell > .page-head h1 { font-size: 21px; }
.sell > section { gap: 8px; min-width: 0; }
.sell > section > h2 { font-size: 18px; }
.sell .client-chip { min-height: 48px; }
.sell .sticky-top { margin-inline: -10px; padding: 7px 10px; }
.sell .sticky-top .input.big { min-height: 52px; }
.sell .psearch, .sell .search-wrap, .sell .suggest { min-width: 0; max-width: 100%; }
.sell .suggest { overflow-x: hidden; max-height: 54vh; }
.sell .suggest-item { min-width: 0; min-height: 76px; padding: 8px 10px; gap: 10px; overflow: hidden; }
.sell .suggest-item > .product-thumb { flex: 0 0 58px; width: 58px; height: 58px; border-radius: 14px; }
.sell .suggest-item > .si-main { flex: 1 1 0; min-width: 0; }
.sell .suggest-item .si-name { overflow: hidden; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: 15px; line-height: 1.24; }
.sell .suggest-item .si-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sell .suggest-item > .si-side { flex: 0 0 86px; min-width: 0; max-width: 86px; gap: 5px; }
.sell .suggest-item .si-price { margin-left: 0; font-size: 13px; white-space: nowrap; }
.sell .suggest-item .badge { max-width: 86px; overflow: hidden; font-size: 11px; text-overflow: ellipsis; }
.sell .hint-box { padding: 12px; }

@media (min-width: 520px) {
  .purchase-pricing { grid-template-columns: repeat(3, 1fr); }
  .purchase-pricing > .field:nth-child(3) { grid-column: auto; }
}

@media (max-width: 380px) {
  .page { padding-inline: 14px; }
  .stock-page { --stock-gutter: 14px; }
  .gate-secondary-links, .grid2.purchase-meta, .pricing-fields { grid-template-columns: 1fr; }
  .pricing-example { grid-template-columns: 1fr; }
  .purchase-footer { align-items: stretch; flex-direction: column; }
  .purchase-footer .btn { width: 100%; }
  .tab { font-size: 10px; }
}
