/* ============ Liquid Glass ============ */
:root {
  --bg: #0b0d1a;
  --txt: #f5f7ff;
  --muted: rgba(235, 240, 255, .62);
  --accent: #6ee7ff;
  --ok: #4ade80;
  --warn: #fbbf24;
  --danger: #ff6b81;
  --glass: rgba(255, 255, 255, .10);
  --glass-strong: rgba(255, 255, 255, .16);
  --edge: rgba(255, 255, 255, .28);
  --r: 28px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --ease: cubic-bezier(.2, .9, .25, 1.15);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", Roboto, system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--txt); overflow: hidden; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
input { font: inherit; color: inherit; }
svg { width: 24px; height: 24px; flex: none; }
[hidden] { display: none !important; }

/* fundo: manchas de cor em movimento lento — é o que dá vida ao vidro */
.aurora { position: fixed; inset: -20%; z-index: 0; filter: blur(60px) saturate(140%); }
.aurora i { position: absolute; border-radius: 50%; opacity: .85; animation: drift 22s ease-in-out infinite alternate; }
.aurora i:nth-child(1) { width: 60vmax; height: 60vmax; left: -10%; top: -5%; background: radial-gradient(circle, #6d5bff, transparent 65%); }
.aurora i:nth-child(2) { width: 55vmax; height: 55vmax; right: -15%; top: 10%; background: radial-gradient(circle, #00c2ff, transparent 65%); animation-duration: 28s; }
.aurora i:nth-child(3) { width: 50vmax; height: 50vmax; left: 10%; bottom: -15%; background: radial-gradient(circle, #ff4fa3, transparent 65%); animation-duration: 25s; }
.aurora i:nth-child(4) { width: 35vmax; height: 35vmax; right: 5%; bottom: 5%; background: radial-gradient(circle, #ffb347, transparent 65%); animation-duration: 31s; }
@keyframes drift { to { transform: translate(8vmax, -6vmax) scale(1.15); } }

/* o material de vidro */
.glass {
  position: relative;
  background: linear-gradient(135deg, rgba(255,255,255,.16), rgba(255,255,255,.05));
  -webkit-backdrop-filter: blur(28px) saturate(190%);
  backdrop-filter: blur(28px) saturate(190%);
  border-radius: var(--r);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.55),
    inset 0 -1px 0 rgba(255,255,255,.08),
    inset 1px 0 0 rgba(255,255,255,.12),
    0 12px 40px rgba(0,0,0,.28);
  isolation: isolate;
}
/* borda com refração (brilho especular nas quinas) */
.glass::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(140deg, rgba(255,255,255,.75), rgba(255,255,255,.08) 35%, rgba(255,255,255,0) 55%, rgba(255,255,255,.35));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
/* reflexo superior suave */
.glass::after {
  content: ""; position: absolute; inset: 1px 1px 50% 1px; border-radius: inherit; pointer-events: none; z-index: -1;
  background: linear-gradient(180deg, rgba(255,255,255,.14), transparent);
}
button.glass, .glass-btn, .tile, .hero { transition: transform .35s var(--ease), background .2s; }
button.glass:active, .glass-btn:active { transform: scale(.94); }

/* ============ Views ============ */
.view {
  position: fixed; inset: 0; z-index: 1; overflow-y: auto;
  padding: calc(var(--safe-t) + 18px) 18px calc(var(--safe-b) + 24px);
  opacity: 0; pointer-events: none; transform: scale(1.04);
  transition: opacity .35s ease, transform .45s var(--ease);
}
.view.active { opacity: 1; pointer-events: auto; transform: none; }
.view > * { max-width: 560px; margin-left: auto; margin-right: auto; }

/* ============ Menu ============ */
.menu-head { display: flex; align-items: flex-end; justify-content: space-between; margin: 18px auto 22px; }
.eyebrow { margin: 0; color: var(--muted); font-size: 15px; font-weight: 500; }
h1 { margin: 2px 0 0; font-size: 44px; letter-spacing: -.03em; font-weight: 750; }
h2 { margin: 0; font-size: 20px; font-weight: 650; letter-spacing: -.01em; }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 99px; font-size: 13px; font-weight: 550; }
.pill b { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 10px currentColor; color: var(--warn); }
.pill.on b { background: var(--ok); color: var(--ok); }
.pill.off b { background: var(--danger); color: var(--danger); }

.card { padding: 20px; margin-bottom: 14px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; }
.stats div + div { border-left: 1px solid rgba(255,255,255,.12); }
.stats strong { display: block; font-size: 30px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stats span { font-size: 13px; color: var(--muted); }

.hero { display: flex; align-items: center; gap: 16px; width: 100%; padding: 22px; margin-bottom: 14px; text-align: left;
  background: linear-gradient(135deg, rgba(110,231,255,.32), rgba(124,92,255,.22)); }
.hero:active, .tile:active { transform: scale(.97); }
.hero-icon { display: grid; place-items: center; width: 62px; height: 62px; border-radius: 20px; background: rgba(255,255,255,.22);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.6); }
.hero-icon svg { width: 34px; height: 34px; }
.hero-txt b { display: block; font-size: 24px; font-weight: 700; }
.hero-txt small { color: rgba(255,255,255,.78); font-size: 14px; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.tile { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 18px; text-align: left; min-height: 120px; }
.tile svg { width: 28px; height: 28px; margin-bottom: auto; opacity: .95; }
.tile b { font-size: 17px; margin-top: 14px; }
.tile small { color: var(--muted); font-size: 13px; }
.tile.wide { grid-column: span 2; min-height: 0; flex-direction: row; align-items: center; gap: 14px; }
.tile.wide svg { margin: 0; }
.tile.wide b { margin: 0; }
.tile.wide small { margin-left: auto; }
.pend { text-align: center; color: var(--warn); font-size: 14px; margin-top: 18px; }

/* ============ Leitura ============ */
.scan { padding: 0; background: #000; overflow: hidden; }
.scan > * { max-width: none; }
#video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.shade { position: absolute; inset: 0; background: radial-gradient(ellipse 70% 32% at 50% 36%, transparent 60%, rgba(0,0,0,.55)); pointer-events: none; }
.scan-top { position: absolute; left: 0; right: 0; top: calc(var(--safe-t) + 12px); display: flex; align-items: center; gap: 10px; padding: 0 14px; z-index: 3; }
.round { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.round.on { background: rgba(255, 214, 102, .55); }

.seg { flex: 1; display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 99px; max-width: 340px; margin: 0 auto; }
.seg button { position: relative; z-index: 1; padding: 10px 6px; font-size: 14px; font-weight: 600; color: rgba(255,255,255,.75); transition: color .25s; }
.seg button.on { color: #0b0d1a; }
.seg-thumb { position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border-radius: 99px; z-index: 0;
  background: rgba(255,255,255,.92); box-shadow: 0 4px 16px rgba(0,0,0,.25), inset 0 1px 0 #fff; transition: transform .45s var(--ease); }
.seg.qtd .seg-thumb { transform: translateX(100%); }

.reticle { position: absolute; left: 50%; top: 36%; width: min(78vw, 360px); height: min(36vw, 170px); transform: translate(-50%, -50%); z-index: 2; pointer-events: none; transition: transform .3s var(--ease); }
.reticle i { position: absolute; width: 34px; height: 34px; border: 4px solid rgba(255,255,255,.92); filter: drop-shadow(0 0 6px rgba(0,0,0,.4)); transition: border-color .2s; }
.reticle i:nth-child(1) { left: 0; top: 0; border-right: 0; border-bottom: 0; border-top-left-radius: 18px; }
.reticle i:nth-child(2) { right: 0; top: 0; border-left: 0; border-bottom: 0; border-top-right-radius: 18px; }
.reticle i:nth-child(3) { left: 0; bottom: 0; border-right: 0; border-top: 0; border-bottom-left-radius: 18px; }
.reticle i:nth-child(4) { right: 0; bottom: 0; border-left: 0; border-top: 0; border-bottom-right-radius: 18px; }
.laser { position: absolute; left: 8%; right: 8%; top: 50%; height: 2px; border-radius: 2px; background: var(--accent); box-shadow: 0 0 14px var(--accent); animation: laser 1.8s ease-in-out infinite; }
@keyframes laser { 0%,100% { transform: translateY(-40px); opacity: .5; } 50% { transform: translateY(40px); opacity: 1; } }
.reticle.hit { transform: translate(-50%, -50%) scale(1.06); }
.reticle.hit i { border-color: var(--ok); }
.reticle.new i { border-color: var(--accent); }
.reticle.wait .laser { background: var(--warn); box-shadow: 0 0 14px var(--warn); animation-play-state: paused; }

.hint { position: absolute; left: 50%; top: calc(36% + min(18vw, 85px) + 22px); transform: translateX(-50%); z-index: 2; margin: 0;
  padding: 8px 16px; border-radius: 99px; font-size: 14px; font-weight: 550; white-space: nowrap; }

.sheet { position: absolute; left: 10px; right: 10px; bottom: calc(var(--safe-b) + 10px); z-index: 3; padding: 14px; border-radius: 32px;
  max-width: 540px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px;
  background: linear-gradient(160deg, rgba(30,34,60,.55), rgba(20,22,40,.45)); }

.qty-panel { display: none; flex-direction: column; gap: 10px; }
.scan.modo-qtd .qty-panel { display: flex; }
.qty-row { display: flex; align-items: center; gap: 10px; }
.qty-display { flex: 1; display: flex; align-items: baseline; gap: 10px; padding: 4px 8px; }
.qty-display span { font-size: 44px; font-weight: 750; letter-spacing: -.03em; font-variant-numeric: tabular-nums; min-width: 1.2ch; }
.qty-display span.neg { color: var(--danger); }
.qty-display small { color: var(--muted); font-size: 13px; }
.lock { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: rgba(255,255,255,.08); opacity: .55; transition: .2s; }
.lock.on { background: rgba(110,231,255,.3); opacity: 1; box-shadow: inset 0 1px 0 rgba(255,255,255,.5); }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.chips button { flex: 1; min-width: 44px; padding: 8px 0; border-radius: 99px; font-weight: 600; font-size: 15px; background: rgba(255,255,255,.12); box-shadow: inset 0 1px 0 rgba(255,255,255,.25); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.keypad button { height: 50px; border-radius: 16px; font-size: 22px; font-weight: 550; background: rgba(255,255,255,.1); box-shadow: inset 0 1px 0 rgba(255,255,255,.22); transition: transform .2s var(--ease), background .15s; }
.keypad button:active, .chips button:active { transform: scale(.92); background: rgba(255,255,255,.28); }

.last { display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 14px; border-radius: 22px; background: rgba(255,255,255,.1); box-shadow: inset 0 1px 0 rgba(255,255,255,.25); animation: pop .45s var(--ease); }
@keyframes pop { from { transform: scale(.94); opacity: .4; } }
.last-info { flex: 1; min-width: 0; }
.last-info b { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.last-info small { color: var(--muted); font-size: 12px; font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.last-qty { text-align: center; padding: 0 4px; }
.last-qty span { display: block; font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.last-qty small { font-size: 11px; color: var(--muted); }
.mini { height: 40px; min-width: 44px; padding: 0 10px; border-radius: 14px; font-weight: 700; background: rgba(110,231,255,.28); box-shadow: inset 0 1px 0 rgba(255,255,255,.45); display: grid; place-items: center; }
.mini.ghost { background: rgba(255,255,255,.1); }
.mini svg { width: 20px; height: 20px; }
.mini:active { transform: scale(.92); }

.sheet-actions { display: flex; gap: 8px; }
.glass-btn { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px; border-radius: 18px; font-size: 14px; font-weight: 600;
  background: rgba(255,255,255,.1); box-shadow: inset 0 1px 0 rgba(255,255,255,.25); }
.glass-btn svg { width: 20px; height: 20px; }

/* ============ Listas / Produtos ============ */
.bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.search { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-radius: 18px; margin-bottom: 14px; }
.search svg { width: 20px; height: 20px; opacity: .7; }
.search input { flex: 1; background: none; border: 0; outline: 0; padding: 14px 0; font-size: 16px; }
.list { list-style: none; padding: 0; margin: 0 auto; display: flex; flex-direction: column; gap: 8px; }
.list li { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 20px; cursor: pointer;
  background: rgba(255,255,255,.08); box-shadow: inset 0 1px 0 rgba(255,255,255,.16); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); }
.list li:active { background: rgba(255,255,255,.16); }
.list .info { flex: 1; min-width: 0; }
.list .info b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .info b.vazio { color: var(--muted); font-style: italic; font-weight: 500; }
.list .info small { color: var(--muted); font-size: 12px; font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.list .q { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.list .pendente { opacity: .6; }
.list .tag { font-size: 11px; padding: 2px 8px; border-radius: 99px; background: rgba(251,191,36,.25); color: var(--warn); margin-left: 6px; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* ============ Ajustes ============ */
.group { padding: 4px 0; margin-bottom: 14px; border-radius: 22px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 14px 18px; text-align: left; font-size: 16px; color: inherit; text-decoration: none; }
.row + .row { border-top: 1px solid rgba(255,255,255,.08); }
.row input:not(.switch) { background: rgba(255,255,255,.1); border: 0; outline: 0; border-radius: 12px; padding: 8px 12px; width: 48%; text-align: right; }
.row small { color: var(--muted); font-size: 13px; }
.row.link { color: var(--accent); }
.row.danger { color: var(--danger); }
.foot { color: var(--muted); font-size: 13px; text-align: center; }
.switch { appearance: none; -webkit-appearance: none; width: 52px; height: 32px; border-radius: 99px; background: rgba(255,255,255,.18); position: relative; flex: none; transition: background .25s; margin: 0; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 28px; height: 28px; border-radius: 50%; background: #fff; box-shadow: 0 3px 8px rgba(0,0,0,.3); transition: transform .35s var(--ease); }
.switch:checked { background: var(--ok); }
.switch:checked::after { transform: translateX(20px); }

/* ============ Modal / Toast ============ */
.modal { position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-end; justify-content: center; padding: 12px 12px calc(var(--safe-b) + 12px);
  background: rgba(5,6,15,.35); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: fade .25s; }
@keyframes fade { from { opacity: 0; } }
.dialog { width: 100%; max-width: 520px; max-height: 80vh; overflow-y: auto; padding: 22px; border-radius: 32px;
  background: linear-gradient(160deg, rgba(40,44,80,.72), rgba(20,22,44,.66)); animation: rise .45s var(--ease); }
@keyframes rise { from { transform: translateY(40px) scale(.96); opacity: 0; } }
.dialog h3 { margin: 0 0 4px; font-size: 20px; }
.dialog .sub { margin: 0 0 18px; color: var(--muted); font-size: 13px; font-family: ui-monospace, "SF Mono", Menlo, monospace; word-break: break-all; }
.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: 13px; color: var(--muted); margin: 0 0 6px 4px; }
.field input { width: 100%; padding: 14px 16px; border-radius: 16px; border: 0; outline: 0; font-size: 18px;
  background: rgba(255,255,255,.1); box-shadow: inset 0 1px 0 rgba(255,255,255,.2); }
.field input:focus { box-shadow: inset 0 0 0 2px var(--accent); }
.actions { display: flex; gap: 10px; margin-top: 6px; }
.btn { flex: 1; padding: 15px; border-radius: 18px; font-weight: 650; font-size: 16px; background: rgba(255,255,255,.12); box-shadow: inset 0 1px 0 rgba(255,255,255,.25); }
.btn.primary { background: linear-gradient(135deg, #6ee7ff, #7c5cff); color: #0b0d1a; box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 8px 24px rgba(110,140,255,.35); }
.btn.danger { color: var(--danger); flex: 0 0 auto; padding: 15px 18px; }
.btn:active { transform: scale(.96); }

.toast { position: fixed; left: 50%; top: calc(var(--safe-t) + 70px); transform: translateX(-50%); z-index: 30; padding: 12px 18px; border-radius: 99px;
  font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 12px; white-space: nowrap; max-width: calc(100vw - 24px);
  background: linear-gradient(135deg, rgba(40,44,80,.75), rgba(25,28,55,.7)); animation: drop .45s var(--ease); }
@keyframes drop { from { transform: translate(-50%, -24px) scale(.9); opacity: 0; } }
.toast button { padding: 6px 12px; border-radius: 99px; background: rgba(110,231,255,.3); font-weight: 700; font-size: 14px; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass { background: rgba(40,44,80,.92); }
}

/* modo quantidade: teclado ocupa a parte de baixo, mira sobe */
.scan.modo-qtd .reticle { top: calc(var(--safe-t) + 150px); height: min(30vw, 130px); transform: translate(-50%, 0); }
.scan.modo-qtd .reticle.hit { transform: translate(-50%, 0) scale(1.06); }
.scan.modo-qtd .hint { top: calc(var(--safe-t) + 92px); }
.scan.modo-qtd .shade { background: radial-gradient(ellipse 70% 20% at 50% 26%, transparent 60%, rgba(0,0,0,.55)); }
.scan.modo-qtd .keypad button { height: 46px; }
.scan.modo-qtd .qty-display span { font-size: 38px; }
@media (max-height: 700px) { .keypad button { height: 40px !important; } .chips { display: none; } }

/* ---------- Acesso (liberação de celulares) ---------- */
body:not(.admin) .so-admin, body.admin .nao-admin, body.aberto .com-senha { display: none !important; }
.acesso { line-height: 1.45; }
.acesso p { margin: 0 0 16px; }
.acesso .btn { width: 100%; }
.acesso .muted, .muted { color: var(--muted); font-size: 14px; }
.ac-titulo { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 650; }
.ac-codigo { font-size: 56px; font-weight: 750; letter-spacing: .25em; text-align: center; padding: 10px 0 18px; font-variant-numeric: tabular-nums; }
.ac-admin { justify-content: center; margin-top: 8px; background: none; }
.spin { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid rgba(255,255,255,.25); border-top-color: var(--accent); animation: girar .9s linear infinite; flex: none; }
@keyframes girar { to { transform: rotate(360deg); } }
.aviso { display: block; width: 100%; margin-top: 14px; padding: 16px 18px; border-radius: 22px; text-align: left; font-weight: 650; color: var(--warn); }
.aviso[hidden] { display: none; }
.list .st { font-size: 11px; padding: 2px 8px; border-radius: 99px; margin-left: 6px; font-weight: 600; }
.list .st.pendente { background: rgba(251,191,36,.25); color: var(--warn); }
.list .st.liberado { background: rgba(52,211,153,.22); color: var(--ok); }
.list .st.bloqueado { background: rgba(248,113,113,.22); color: var(--danger); }
.list li.ap { flex-wrap: wrap; cursor: default; }
.list li.ap .ap-acoes { display: flex; gap: 8px; width: 100%; }
.list li.ap .ap-acoes button { flex: 1; height: 38px; font-size: 14px; }
.list li.ap .ap-cod { font-size: 20px; font-weight: 700; letter-spacing: .12em; font-variant-numeric: tabular-nums; }
