/* Estilos só do painel */
body { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
h2 { font-size: 1.05rem; margin: 0 0 12px; }
.pad { padding: 18px; margin-bottom: 14px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.danger-text { color: var(--danger); }
.err { color: var(--danger); background: var(--danger-soft); padding: 10px 12px; border-radius: 12px; font-size: .9rem; margin: 0 0 12px; }
.demo { background: var(--accent-soft); color: var(--accent-strong); margin: 12px 16px 0; border-radius: 12px; padding: 10px 14px; font-size: .85rem; }

/* Login */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.login-box { width: 100%; max-width: 380px; padding: 24px; }
.login-logo { width: 100%; max-width: 260px; margin: 0 auto 6px; border-radius: 16px; }
.login-sub { text-align: center; margin: 0 0 20px; font-weight: 600; }
.demo-hint { text-align: center; margin: 12px 0 0; }
body:has(#login:not(.hidden)) { padding-bottom: 0; }

/* Contador */
.stat { display: flex; align-items: center; gap: 12px; padding: 16px 18px; margin-bottom: 14px; }
.stat > div { flex: 1; }
.stat-num { margin-bottom: 10px; }
.bar { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width .3s; }
.stat .btn { min-height: 40px; padding: 0 12px; }

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.actions .btn { min-height: 54px; font-size: 1.02rem; }
.menu-wrap { position: relative; }
.menu { position: absolute; top: calc(100% + 8px); left: 0; z-index: 15; width: min(320px, calc(100vw - 32px)); padding: 6px; }
.menu button { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; background: none; border: 0; padding: 12px; border-radius: 12px; }
.menu button:hover { background: var(--surface-2); }
.menu svg { width: 20px; height: 20px; color: var(--accent); flex: none; }
.menu small { display: block; color: var(--muted); font-size: .8rem; }

.row-filters { display: grid; gap: 10px; margin: 12px 0 6px; }
.row-filters .chips { min-width: 0; }
.row-filters select.sort { justify-self: start; }
select.sort { width: auto; min-height: 38px; padding: 6px 10px; font-size: .88rem; border-radius: 999px; background: var(--surface); }

/* Lista de produtos */
.group-h { display: flex; align-items: center; gap: 10px; margin: 20px 4px 10px; font-weight: 800; font-size: .82rem; letter-spacing: .08em; color: var(--muted); text-transform: uppercase; }
.group-h .count { font-weight: 600; letter-spacing: 0; text-transform: none; border: 1px solid var(--line); border-radius: 99px; padding: 2px 10px; }
.group-h::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.item { padding: 12px; margin-bottom: 10px; }
.item.off { opacity: .62; }
.item-main { display: flex; gap: 12px; align-items: center; }
.item-main .thumb { width: 52px; height: 52px; }
@media (max-width: 400px) { .item-main .thumb { width: 44px; height: 44px; } .item-btns .rb { width: 36px; height: 36px; } .item-btns { gap: 4px; } }
.item-info { flex: 1; min-width: 0; }
.item-info h3 { margin: 0 0 4px; font-size: 1rem; line-height: 1.25; }
.item-sub { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.toggle-opts { background: none; border: 0; padding: 2px 0; color: var(--muted); font-size: .85rem; display: inline-flex; align-items: center; gap: 2px; }
.toggle-opts svg { width: 14px; height: 14px; transition: rotate .2s; }
.item.open .toggle-opts svg { rotate: 180deg; }
.item-btns { display: flex; gap: 6px; }
.rb { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--surface-2); color: var(--muted); display: grid; place-items: center; }
.rb svg { width: 18px; height: 18px; }
.rb.on { background: var(--ok-soft); color: var(--ok); }
.rb.del:hover { background: var(--danger-soft); color: var(--danger); }

.opts-list { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 4px; }
.orow { display: flex; align-items: center; gap: 10px; padding: 8px 2px; border-bottom: 1px dashed var(--line); }
.orow:last-child { border-bottom: 0; }
.orow .swatch { width: 12px; height: 12px; border-radius: 50%; border: 1px solid rgba(0,0,0,.2); flex: none; }
.orow .o-name { flex: 1; min-width: 0; font-size: .9rem; }
.orow .o-price { text-align: right; font-weight: 700; font-size: .95rem; }
.orow .o-price small { display: block; font-weight: 500; color: var(--muted); font-size: .75rem; }
.orow.hid { opacity: .5; }
.orow .rb { width: 34px; height: 34px; }
.pos { color: var(--ok); } .neg { color: var(--danger); }

/* Navegação inferior */
.bottomnav {
  position: fixed; left: 50%; translate: -50% 0; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 25;
  display: flex; gap: 6px; padding: 6px; width: min(360px, calc(100% - 24px));
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow);
}
.bottomnav button { flex: 1; display: grid; justify-items: center; gap: 2px; padding: 8px; border: 0; border-radius: 16px; background: none; color: var(--muted); font-size: .75rem; font-weight: 600; }
.bottomnav svg { width: 22px; height: 22px; }
.bottomnav button[aria-current="page"] { background: var(--accent-soft); color: var(--accent-strong); }

/* Janelas (bottom sheet) */
dialog.sheet {
  width: 100%; max-width: 640px; max-height: 94dvh; margin: auto auto 0; padding: 0;
  border: 0; border-radius: 24px 24px 0 0; background: var(--surface); color: var(--text);
  box-shadow: 0 -10px 40px rgba(0,0,0,.25);
}
dialog.sheet[open] { display: flex; }
dialog.sheet form { display: flex; flex-direction: column; width: 100%; max-height: 94dvh; }
dialog.sheet::backdrop { background: rgba(10,12,16,.55); backdrop-filter: blur(2px); }
@media (min-width: 700px) { dialog.sheet { margin: auto; border-radius: 24px; } }
.sheet header { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.sheet header h2 { margin: 0; }
.sheet .x { font-size: 1rem; }
.sheet-body { padding: 18px; overflow-y: auto; flex: 1; }
.sheet footer { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; padding: 14px 18px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }

/* Linhas de opção no editor */
.opt-edit { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; margin-bottom: 10px; background: var(--surface-2); }
.opt-edit .input { background: var(--surface); min-height: 44px; }
.opt-edit label { display: grid; gap: 4px; font-size: .75rem; font-weight: 600; color: var(--muted); }
.opt-edit .opt-foot { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; font-size: .82rem; color: var(--muted); }
.opt-edit .opt-foot .btns { display: flex; gap: 6px; }

/* Interruptor */
.switch { display: flex; align-items: center; gap: 12px; margin-top: 6px; font-weight: 600; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { width: 48px; height: 28px; border-radius: 99px; background: var(--line); position: relative; flex: none; transition: background .2s; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: translate .2s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch input:checked + .track { background: var(--ok); }
.switch input:checked + .track::after { translate: 20px 0; }
.switch input:focus-visible + .track { outline: 3px solid var(--accent-soft); }

/* Precificação */
.step { display: flex; align-items: center; gap: 10px; font-weight: 700; margin: 18px 0 10px; }
.step:first-of-type { margin-top: 8px; }
.step b { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--accent); color: var(--accent-strong); display: grid; place-items: center; font-size: .8rem; }
.wrapchips { flex-wrap: wrap; overflow: visible; }
.margin-row { display: grid; grid-template-columns: auto auto 1fr; gap: 8px; margin-bottom: 14px; }
.seg.mini button { min-width: 48px; }
.info { background: var(--surface-2); border-radius: 14px; padding: 12px 14px; font-size: .9rem; color: var(--muted); margin: 6px 0 12px; }
.info b { color: var(--text); }

/* Revisão da importação */
.imp-group { border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; margin-bottom: 10px; }
.imp-group h4 { margin: 0 0 6px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: .95rem; }
.imp-group .tag { font-size: .7rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--ok-soft); color: var(--ok); }
.imp-group .tag.upd { background: var(--accent-soft); color: var(--accent-strong); }
.imp-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: .88rem; border-top: 1px dashed var(--line); }
.imp-row span { flex: 1; }
.imp-row .rb { width: 30px; height: 30px; }

/* Foto do produto no editor */
.photo-box { display: flex; gap: 14px; align-items: center; }
.photo-prev { width: 104px; height: 104px; border-radius: 16px; border: 1px solid var(--line); }
.photo-prev img { object-fit: cover; }
.photo-btns { display: grid; gap: 8px; flex: 1; }
.item-main .thumb img { object-fit: cover; }

/* Botões de escolha (cor, armazenamento, garantia, itens) */
.pick { display: flex; flex-wrap: wrap; gap: 6px; }
.pick button {
  min-height: 36px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); font-size: .85rem; font-weight: 600; color: var(--muted);
  display: inline-flex; align-items: center; gap: 6px;
}
.pick button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong); box-shadow: inset 0 0 0 1px var(--accent); }
.pick button.off { border-style: dashed; color: var(--danger); }
.pick .swatch { width: 12px; height: 12px; border-radius: 50%; border: 1px solid rgba(0,0,0,.2); }
.builder, .details-box { border: 1px solid var(--line); border-radius: 16px; padding: 14px; margin-bottom: 16px; background: var(--surface-2); }
.builder .pick button, .details-box .pick button { background: var(--surface); }
.builder-h { font-weight: 800; margin-bottom: 10px; }
.b-label { font-size: .75rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin: 10px 0 6px; }
.builder .btn { margin-top: 12px; }
.opt-edit .o-label { grid-column: 1 / -1; font-size: .75rem; font-weight: 600; color: var(--muted); }
.opt-edit .pick { grid-column: 1 / -1; }
textarea.notes { min-height: 80px; }
textarea.msg { min-height: 64px; }
.mt { margin-top: 18px; }
.warn { background: #FBEFD9; color: #8A5A0B; border-radius: 12px; padding: 10px 12px; font-size: .88rem; margin: -4px 0 14px; }
[data-theme="dark"] .warn { background: #3A2F1A; color: #F1C46B; }
.vars { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 10px; }
.vars button { min-height: 32px; padding: 0 10px; border-radius: 99px; border: 1px dashed var(--accent); background: var(--accent-soft); color: var(--accent-strong); font-size: .8rem; font-weight: 600; }
.preview { background: #DCF8C6; color: #111; border-radius: 12px 12px 12px 2px; padding: 10px 12px; font-size: .88rem; margin-bottom: 10px; white-space: pre-wrap; }
.preview:empty { display: none; }
.preview::before { content: "Prévia: "; font-weight: 700; color: #1a7f37; }
.code { font-family: ui-monospace, Consolas, monospace; font-size: .72rem; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
