:root {
  --bg: #f4f5f8;
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --surface-3: #eef1f6;
  --text: #0f131a;
  --text-2: #343b48;
  --muted: #5e6775;
  --border: #e2e6ee;
  --border-strong: #cdd3df;
  --accent: #2752d6;
  --accent-hover: #1e43b8;
  --accent-soft: rgba(39, 82, 214, 0.09);
  --accent-ink: #ffffff;
  --ok: #157f3b;
  --ok-bg: #eaf6ee;
  --ok-border: #b4e0c2;
  --warn: #9a5b00;
  --warn-bg: #fef5e6;
  --warn-border: #f3d297;
  --err: #c92a2a;
  --err-bg: #fdecec;
  --err-border: #f5b9b9;
  --info: #1e4fd6;
  --info-bg: #edf2ff;
  --info-border: #c2d4ff;
  --ok-solid: #15803d;
  --ok-ink: #ffffff;
  --warn-solid: #f5a623;
  --warn-ink: #1d1300;
  --err-solid: #d42020;
  --err-ink: #ffffff;
  --topbar-bg: rgba(255, 255, 255, 0.86);
  --side-bg: #0d1017;
  --side-surface: #161b24;
  --side-border: #202634;
  --side-text: #eef1f7;
  --side-muted: #8b95a7;
  --shadow-sm: 0 1px 2px rgba(15, 19, 26, 0.04);
  --shadow: 0 1px 3px rgba(15, 19, 26, 0.06), 0 1px 2px rgba(15, 19, 26, 0.04);
  --shadow-lg: 0 16px 36px -6px rgba(15, 19, 26, 0.16), 0 4px 12px -2px rgba(15, 19, 26, 0.08);
  --radius: 10px;
  --radius-lg: 12px;
  color-scheme: light dark;
  accent-color: var(--accent);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0d12;
    --surface: #131720;
    --surface-2: #191e29;
    --surface-3: #222836;
    --text: #f1f4f9;
    --text-2: #c6cedb;
    --muted: #8c96a8;
    --border: #242a38;
    --border-strong: #323a4c;
    --accent: #3865eb;
    --accent-hover: #4b75f2;
    --accent-soft: rgba(56, 101, 235, 0.16);
    --accent-ink: #ffffff;
    --ok: #36c96d;
    --ok-bg: rgba(34, 160, 82, 0.14);
    --ok-border: rgba(54, 201, 109, 0.35);
    --warn: #f5a623;
    --warn-bg: rgba(245, 166, 35, 0.13);
    --warn-border: rgba(245, 166, 35, 0.32);
    --err: #ff6161;
    --err-bg: rgba(235, 55, 55, 0.16);
    --err-border: rgba(255, 97, 97, 0.38);
    --info: #6899fa;
    --info-bg: rgba(56, 101, 235, 0.16);
    --info-border: rgba(104, 153, 250, 0.32);
    --ok-solid: #16a34a;
    --err-solid: #e5383b;
    --topbar-bg: rgba(19, 23, 32, 0.86);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.25);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.35), 0 1px 2px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 18px 40px -6px rgba(0, 0, 0, 0.55);
  }
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  height: 100%;
  scroll-padding-top: calc(64px + env(safe-area-inset-top, 0px));
  scroll-padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px));
}

body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: contain;
  overflow-wrap: break-word;
}

#app {
  min-height: 100vh;
}

h1, h2, h3 {
  text-wrap: balance;
  letter-spacing: -0.02em;
}

p {
  text-wrap: pretty;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

:where(a, code, .mono) {
  overflow-wrap: anywhere;
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--muted);
}

.mono {
  font-family: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.small {
  font-size: 13px;
  line-height: 1.4;
}

/* ---------- layout admin desktop (sidebar) ---------- */
.sidebar {
  display: none;
}

@media (min-width: 1024px) {
  #app.admin-shell {
    display: flex;
    align-items: stretch;
    min-height: 100vh;
  }

  .sidebar {
    display: flex;
    flex-direction: column;
    width: 248px;
    flex: none;
    position: sticky;
    top: 0;
    height: 100vh;
    background: var(--side-bg);
    color: var(--side-text);
    border-right: 1px solid var(--side-border);
    padding: 18px 12px;
    z-index: 30;
    user-select: none;
  }

  .side-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 10px 16px;
    border-bottom: 1px solid var(--side-border);
    margin-bottom: 14px;
  }

  .side-logo {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: #2752d6;
    color: #fff;
    display: grid;
    place-items: center;
    flex: none;
    box-shadow: 0 2px 8px rgba(39, 82, 214, 0.4);
  }

  .side-logo svg {
    width: 20px;
    height: 20px;
  }

  .side-brand-txt b {
    display: block;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.01em;
    line-height: 1.2;
  }

  .side-brand-txt span {
    display: block;
    font-size: 11px;
    color: var(--side-muted);
    font-weight: 500;
  }

  .side-group {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--side-muted);
    padding: 10px 10px 6px;
  }

  .side-nav {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
  }

  .side-link {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 40px;
    padding: 8px 10px;
    border-radius: 8px;
    color: var(--side-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.15s, color 0.15s;
  }

  .side-link svg {
    width: 18px;
    height: 18px;
    flex: none;
    opacity: 0.85;
  }

  .side-link:hover {
    background: var(--side-surface);
    color: #fff;
  }

  .side-link.on {
    background: #2752d6;
    color: #fff;
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  }

  .side-link.on svg {
    opacity: 1;
  }

  .side-foot {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--side-border);
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .side-avatar {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: var(--side-surface);
    border: 1px solid var(--side-border);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    display: grid;
    place-items: center;
    flex: none;
  }

  .side-uinfo {
    flex: 1;
    min-width: 0;
  }

  .side-uinfo b {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .side-uinfo span {
    display: block;
    font-size: 11px;
    color: var(--side-muted);
  }

  .side-logout {
    min-height: 36px;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid var(--side-border);
    background: var(--side-surface);
    color: var(--side-text);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s;
  }

  .side-logout:hover {
    background: rgba(235, 55, 55, 0.18);
    border-color: rgba(255, 97, 97, 0.4);
    color: #ff8080;
  }

  .side-logout svg {
    width: 15px;
    height: 15px;
  }

  #app.admin-shell > .content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
  }

  #app.admin-shell #menu,
  #app.admin-shell #gocentral,
  #app.admin-shell .admintabs {
    display: none !important;
  }

  #app.admin-shell .topbar {
    padding: 14px 32px;
  }

  #app.admin-shell main {
    max-width: 1080px;
    width: 100%;
    padding: 24px 32px 64px;
  }

  #app.admin-shell main.wide {
    max-width: 1280px;
  }
}

/* ---------- topo ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  padding-top: max(10px, env(safe-area-inset-top, 0px));
  background: var(--topbar-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.topbar h1 {
  font-size: 17px;
  font-weight: 600;
  margin: 0;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar .sub {
  display: block;
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
  margin-top: 1px;
}

.iconbtn {
  width: 44px;
  height: 44px;
  flex: none;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}

.iconbtn:hover {
  background: var(--surface-2);
  border-color: var(--border);
}

.iconbtn:active {
  background: var(--surface-3);
}

.iconbtn svg {
  width: 21px;
  height: 21px;
}

main {
  padding: 16px 16px calc(96px + env(safe-area-inset-bottom, 0px));
  max-width: 760px;
  margin: 0 auto;
}

main.wide {
  max-width: 1200px;
}

/* ---------- botões ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 9px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: background-color 0.15s, border-color 0.15s, transform 0.1s, box-shadow 0.15s;
}

.btn:hover {
  background: var(--surface-2);
  border-color: var(--muted);
}

.btn:focus-visible,
.iconbtn:focus-visible,
.tabs button:focus-visible,
.admintabs button:focus-visible,
.order:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn:active {
  transform: translateY(1px);
}

.btn[disabled] {
  opacity: 0.48;
  pointer-events: none;
  box-shadow: none;
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.btn.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn.ok {
  background: var(--ok-solid);
  border-color: var(--ok-solid);
  color: var(--ok-ink);
}

.btn.ok:hover {
  filter: brightness(0.95);
}

.btn.danger {
  color: var(--err);
  border-color: var(--err-border);
  background: var(--err-bg);
}

.btn.danger:hover {
  border-color: var(--err);
}

.btn.block {
  width: 100%;
}

.btn.big {
  min-height: 52px;
  font-size: 16px;
  border-radius: var(--radius-lg);
}

.btn svg {
  width: 19px;
  height: 19px;
  flex: none;
}

.row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.row > .grow {
  flex: 1;
  min-width: 0;
}

.stack > * + * {
  margin-top: 10px;
}

/* ---------- campos ---------- */
.field {
  display: block;
  margin-bottom: 14px;
}

.field > span {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 5px;
}

.input {
  width: 100%;
  min-height: 44px;
  padding: 9px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input:hover {
  border-color: var(--muted);
}

.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.input[readonly] {
  background: var(--surface-2);
  color: var(--muted);
}

textarea.input {
  min-height: 92px;
  resize: vertical;
}

/* ---------- login ---------- */
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: var(--bg);
}

.login-hero {
  display: none;
}

.login-pane {
  width: 100%;
  max-width: 400px;
}

.login .card {
  width: 100%;
  padding: 28px 24px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.login h1 {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 700;
}

.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 11px;
  background: var(--accent);
  display: grid;
  place-items: center;
  margin-bottom: 16px;
  box-shadow: 0 4px 12px rgba(39, 82, 214, 0.28);
}

.brand-mark svg {
  width: 24px;
  height: 24px;
  color: #ffffff;
}

@media (min-width: 960px) {
  .login {
    grid-template-columns: 1.05fr 1fr;
    padding: 0;
    align-items: stretch;
    justify-items: stretch;
  }

  .login-hero {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 48px 56px;
    background: linear-gradient(160deg, #0d111a 0%, #131b2e 60%, #17254a 100%);
    color: #eef2f9;
    border-right: 1px solid #20283a;
    position: relative;
    overflow: hidden;
  }

  .hero-top {
    display: flex;
    align-items: center;
    gap: 12px;
  }

  .hero-logo {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: #2752d6;
    color: #fff;
    display: grid;
    place-items: center;
    box-shadow: 0 4px 14px rgba(39, 82, 214, 0.45);
  }

  .hero-logo svg {
    width: 22px;
    height: 22px;
  }

  .hero-top b {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.01em;
  }

  .hero-badge {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 3px 8px;
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #b8c7e8;
  }

  .hero-mid {
    max-width: 480px;
    margin: 32px 0;
  }

  .hero-mid h2 {
    font-size: 28px;
    line-height: 1.2;
    font-weight: 700;
    margin: 0 0 12px;
    color: #ffffff;
  }

  .hero-lead {
    font-size: 15px;
    color: #9ba8c0;
    margin: 0 0 28px;
    line-height: 1.55;
  }

  .hero-benefits {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  .hero-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
  }

  .hero-item-ico {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(39, 82, 214, 0.28);
    border: 1px solid rgba(92, 138, 255, 0.35);
    color: #7ea4ff;
    display: grid;
    place-items: center;
    flex: none;
  }

  .hero-item-ico svg {
    width: 18px;
    height: 18px;
  }

  .hero-item b {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 2px;
  }

  .hero-item span {
    display: block;
    font-size: 13px;
    color: #9ba8c0;
    line-height: 1.4;
  }

  .hero-foot {
    font-size: 12px;
    color: #6f7d95;
  }

  .login-pane {
    display: grid;
    place-items: center;
    max-width: none;
    padding: 40px 24px;
  }

  .login .card {
    max-width: 400px;
    padding: 34px 32px;
  }
}

/* ---------- cartões ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.card.pad {
  padding: 16px;
}

/* ---------- abas ---------- */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  padding: 4px;
  border-radius: var(--radius);
  margin: 12px 0;
}

.tabs button {
  flex: 1;
  min-height: 40px;
  border: 0;
  background: transparent;
  padding: 8px 10px;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background-color 0.15s, color 0.15s, box-shadow 0.15s;
}

.tabs button:hover {
  color: var(--text);
}

.tabs button.on {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.tabs .count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  border-radius: 99px;
  background: var(--accent);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.syncline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  margin: 8px 0 12px;
}

.syncline .grow {
  flex: 1;
}

/* ---------- lista de pedidos ---------- */
.order {
  display: block;
  width: 100%;
  text-align: left;
  padding: 14px 16px 14px 20px;
  margin-bottom: 10px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}

/* faixa lateral pelo prazo */
.order::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--border-strong);
}

.order.urg-warn::before {
  background: var(--warn-solid);
}

.order.urg-err::before {
  background: var(--err-solid);
}

.order .buyer {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 40%;
}

.order .chev {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  color: var(--muted);
  transform: rotate(180deg);
  flex: none;
  transition: color 0.15s, translate 0.15s;
}

.order .chev svg {
  width: 18px;
  height: 18px;
}

.order:hover .chev {
  color: var(--accent);
  translate: 2px 0;
}

.order .lines b.mono {
  font-size: 15px;
}

.order .lines .lbl {
  font-size: 10px;
}

.order:hover {
  border-color: var(--accent);
  box-shadow: 0 3px 10px rgba(15, 19, 26, 0.08);
}

.order:active {
  background: var(--surface-2);
}

.order .head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.order .sn {
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.order .lines {
  margin-top: 10px;
  font-size: 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.order .lines div {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 10px;
}

.order .lines .q {
  font-weight: 700;
  min-width: 26px;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.order .lines .sep-dot {
  color: var(--muted);
  opacity: 0.6;
}

.order .foot {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

/* ---------- chips / badges ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}

.chip:not(.mono)::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  flex: none;
}

.chip.ok {
  background: var(--ok-bg);
  color: var(--ok);
  border-color: var(--ok-border);
}

.chip.ok::before {
  background: var(--ok);
}

.chip.warn {
  background: var(--warn-bg);
  color: var(--warn);
  border-color: var(--warn-border);
}

.chip.warn::before {
  background: var(--warn);
}

.chip.err {
  background: var(--err-bg);
  color: var(--err);
  border-color: var(--err-border);
}

.chip.err::before {
  background: var(--err);
}

.chip.info {
  background: var(--info-bg);
  color: var(--info);
  border-color: var(--info-border);
}

.chip.info::before {
  background: var(--info);
}

/* ---------- banners e estados vazios ---------- */
.banner {
  padding: 11px 14px;
  border-radius: var(--radius);
  font-size: 13.5px;
  line-height: 1.45;
  margin: 10px 0;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.banner.warn {
  background: var(--warn-bg);
  color: var(--warn);
  border-color: var(--warn-border);
}

.banner.err {
  background: var(--err-bg);
  color: var(--err);
  border-color: var(--err-border);
}

.banner.info {
  background: var(--info-bg);
  color: var(--info);
  border-color: var(--info-border);
}

.empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
}

.empty svg {
  width: 40px;
  height: 40px;
  opacity: 0.45;
  margin-bottom: 8px;
}

.card .empty {
  border: 0;
  background: transparent;
}

/* ---------- barra inferior ---------- */
.bottombar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
  background: var(--topbar-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
}

.bottombar .inner {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ---------- conferência (câmera, retorno e itens) ---------- */
.cam {
  position: relative;
  background: #07090d;
  border-radius: var(--radius-lg);
  overflow: hidden;
  aspect-ratio: 4 / 3;
  max-height: 34vh;
  width: 100%;
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
}

.cam video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Moldura de leitor com 4 cantos */
.cam .frame {
  position: absolute;
  inset: 18% 10%;
  pointer-events: none;
}

.cam .frame::before,
.cam .frame::after,
.cam .frame i::before,
.cam .frame i::after {
  content: "";
  position: absolute;
  width: 26px;
  height: 26px;
  border-color: rgba(255, 255, 255, 0.92);
  border-style: solid;
}

.cam .frame::before {
  top: 0;
  left: 0;
  border-width: 3px 0 0 3px;
  border-top-left-radius: 8px;
}

.cam .frame::after {
  top: 0;
  right: 0;
  border-width: 3px 3px 0 0;
  border-top-right-radius: 8px;
}

.cam .frame i::before {
  bottom: 0;
  left: 0;
  border-width: 0 0 3px 3px;
  border-bottom-left-radius: 8px;
}

.cam .frame i::after {
  bottom: 0;
  right: 0;
  border-width: 0 3px 3px 0;
  border-bottom-right-radius: 8px;
}

/* Linha de mira discreta */
.cam .aim {
  position: absolute;
  left: 14%;
  right: 14%;
  top: 50%;
  height: 1.5px;
  background: linear-gradient(90deg, transparent 0%, rgba(96, 152, 255, 0.9) 20%, rgba(255, 255, 255, 0.95) 50%, rgba(96, 152, 255, 0.9) 80%, transparent 100%);
  box-shadow: 0 0 8px rgba(56, 101, 235, 0.75);
  pointer-events: none;
}

.cam .camctl {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: flex;
  gap: 6px;
}

.cam .camctl button {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(13, 16, 23, 0.72);
  backdrop-filter: blur(6px);
  color: #ffffff;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.cam .camctl button svg {
  width: 20px;
  height: 20px;
}

.cam .camctl button.on {
  background: #f5a623;
  border-color: #f5a623;
  color: #0d1017;
}

.cam .msg {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #ffffff;
  background: rgba(11, 13, 18, 0.78);
  text-align: center;
  padding: 16px;
  font-size: 14px;
}

.cam.flash-ok::after,
.cam.flash-err::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  animation: flash 0.45s ease-out forwards;
}

.cam.flash-ok::after {
  background: rgba(21, 127, 59, 0.55);
}

.cam.flash-err::after {
  background: rgba(201, 42, 42, 0.65);
}

@keyframes flash {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* Layout da conferência: empilhado no celular, duas colunas no computador */
.conf-left,
.conf-right {
  min-width: 0;
}

@media (min-width: 960px) {
  main.conf {
    max-width: 1180px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
    gap: 24px;
    align-items: start;
    padding-top: 24px;
  }
  main.conf .conf-left {
    position: sticky;
    top: 84px;
  }
  main.conf .cam {
    max-height: none;
  }
  main.conf .feedback {
    margin-bottom: 0;
  }
  main.conf .conf-right > :first-child {
    margin-top: 0;
  }
  main.conf ~ .bottombar .inner {
    max-width: 1148px;
  }
}

/* Retorno da bipagem (#fb) */
.feedback {
  margin: 12px 0;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: background-color 0.15s, border-color 0.15s;
}

.feedback .fb-main {
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
}

.feedback .fb-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid;
  place-items: center;
  flex: none;
}

.feedback .fb-icon svg {
  width: 24px;
  height: 24px;
}

.feedback .fb-body {
  flex: 1;
  min-width: 0;
}

.feedback .fb-title {
  font-weight: 700;
  font-size: 18px;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.feedback small {
  display: block;
  font-weight: 500;
  font-size: 14px;
  color: var(--muted);
  margin-top: 3px;
  line-height: 1.35;
}

/* estados: blocos de cor sólida, para ler de longe */
.feedback.ok,
.feedback.warn,
.feedback.err {
  border-color: transparent;
  box-shadow: var(--shadow);
}

.feedback.ok {
  background: var(--ok-solid);
  color: var(--ok-ink);
}

.feedback.warn {
  background: var(--warn-solid);
  color: var(--warn-ink);
}

.feedback.err {
  background: var(--err-solid);
  color: var(--err-ink);
  padding: 18px 16px;
  box-shadow: 0 0 0 4px var(--err-bg), var(--shadow);
  animation: shake 0.35s ease-out;
}

.feedback.ok .fb-icon,
.feedback.warn .fb-icon,
.feedback.err .fb-icon {
  background: rgba(255, 255, 255, 0.2);
  color: inherit;
}

.feedback.warn .fb-icon {
  background: rgba(0, 0, 0, 0.1);
}

.feedback.ok small,
.feedback.warn small,
.feedback.err small {
  color: inherit;
  opacity: 0.92;
}

.feedback.ok .fb-title,
.feedback.warn .fb-title {
  font-size: 20px;
  font-weight: 800;
}

.feedback.err .fb-icon {
  width: 52px;
  height: 52px;
}

.feedback.err .fb-icon svg {
  width: 30px;
  height: 30px;
}

.feedback.err .fb-title {
  font-size: 23px;
  font-weight: 800;
  letter-spacing: 0;
}

.feedback.err small {
  font-size: 15px;
  font-weight: 600;
}

/* botões que finishConf() adiciona dentro do #fb */
.feedback .row .btn {
  background: var(--surface);
  color: var(--text);
  border-color: transparent;
}

.feedback .row .btn.danger {
  background: var(--surface);
  color: var(--err);
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}

@media (prefers-reduced-motion: reduce) {
  .feedback.err {
    animation: none;
  }
}

/* Progresso do pedido */
.conf-progress {
  margin: 4px 0 12px;
}

.conf-progress-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

#ptxt {
  font-size: 15px;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.progress {
  height: 10px;
  border-radius: 99px;
  background: var(--surface-3);
  overflow: hidden;
}

.progress > i {
  display: block;
  height: 100%;
  background: var(--ok-solid);
  border-radius: 99px;
  transition: width 0.25s ease;
}

/* Itens do pedido na conferência */
.item {
  display: flex;
  gap: 12px;
  padding: 14px 14px 14px 18px;
  margin-bottom: 10px;
  align-items: stretch;
  position: relative;
  overflow: hidden;
  transition: background-color 0.2s, border-color 0.2s, transform 0.2s;
}

.item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  background: var(--border-strong);
}

.item .info {
  flex: 1;
  min-width: 0;
}

.item .codes {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.item .code {
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.15;
}

.item .code b {
  font-weight: 700;
  color: var(--text);
  word-break: break-all;
}

.item .code.sku b {
  font-size: 28px;
  letter-spacing: -0.02em;
}

.item .code.fab b {
  font-size: 21px;
}

.lbl {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  flex: none;
}

.item .name {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
  font-size: 13px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.item .name span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.item .name img {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  object-fit: cover;
  flex: none;
  border: 1px solid var(--border);
}

.item .cnt {
  flex: none;
  min-width: 84px;
  padding: 8px 10px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.item .cnt b {
  display: block;
  font-size: 40px;
  font-weight: 700;
  line-height: 1;
  color: var(--text);
  letter-spacing: -0.03em;
}

.item .cnt b small {
  font-size: 22px;
  font-weight: 600;
  color: var(--muted);
}

.item .cnt span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.item .cnt span svg {
  width: 14px;
  height: 14px;
}

/* item completo: verde inteiro */
.item.done {
  border-color: var(--ok-border);
  background: var(--ok-bg);
}

.item.done::before {
  background: var(--ok-solid);
}

.item.done .code b,
.item.done .lbl,
.item.done .name {
  color: var(--ok);
}

.item.done .cnt {
  background: var(--ok-solid);
  border-color: transparent;
}

.item.done .cnt b,
.item.done .cnt b small,
.item.done .cnt span {
  color: var(--ok-ink);
}

.item.bad::before {
  background: var(--warn-solid);
}

.item.bad {
  border-color: var(--warn-border);
}

.item.hit {
  animation: hit 0.45s ease-out;
  border-color: var(--ok);
}

@keyframes hit {
  0% { transform: scale(1.025); }
  100% { transform: scale(1); }
}

@media (max-width: 380px) {
  .item .code.sku b { font-size: 24px; }
  .item .code.fab b { font-size: 18px; }
  .item .cnt { min-width: 72px; }
  .item .cnt b { font-size: 34px; }
}

/* ---------- etiqueta ---------- */
.labelbox {
  text-align: center;
  padding: 36px 20px;
}

.labelbox .big-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
}

.labelbox .big-icon svg {
  width: 36px;
  height: 36px;
}

.labelbox .big-icon.ok {
  background: var(--ok-solid);
  color: var(--ok-ink);
  box-shadow: 0 0 0 8px var(--ok-bg);
}

.labelbox .big-icon.err {
  background: var(--err-solid);
  color: var(--err-ink);
  box-shadow: 0 0 0 8px var(--err-bg);
}

.labelbox:has(.big-icon.ok) {
  border-color: var(--ok-border);
  background: linear-gradient(180deg, var(--ok-bg), var(--surface) 70%);
}

.labelbox:has(.big-icon.err) {
  border-color: var(--err-border);
  background: linear-gradient(180deg, var(--err-bg), var(--surface) 70%);
}

.labelbox p.mono {
  display: inline-block;
  font-size: 17px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  margin: 4px 0 10px;
}

.labelbox ~ .stack .btn.big {
  min-height: 56px;
}

.labelbox .big-icon.wait {
  background: var(--info-bg);
  border: 1px solid var(--info-border);
}

.labelbox h2 {
  margin: 0 0 6px;
  font-size: 21px;
  font-weight: 700;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------- menu / modal / toast ---------- */
.sheet-bg {
  position: fixed;
  inset: 0;
  background: rgba(9, 12, 18, 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.2s ease-out;
}

.sheet {
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  border-radius: 16px 16px 0 0;
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom, 0px));
  translate: 0 0;
  transition: translate 0.22s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease-out;
}

@starting-style {
  .sheet-bg {
    opacity: 0;
  }
  .sheet {
    translate: 0 24px;
    opacity: 0;
  }
}

@media (min-width: 600px) {
  .sheet-bg {
    align-items: center;
    padding: 16px;
  }
  .sheet {
    border-radius: var(--radius-lg);
    padding: 24px;
  }
  @starting-style {
    .sheet {
      translate: 0 12px;
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  .sheet-bg,
  .sheet {
    transition-duration: 0.05s;
    translate: none;
  }
}

.sheet h3 {
  margin: 0 0 14px;
  font-size: 18px;
  font-weight: 700;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  padding: 12px 10px;
  border: 0;
  background: none;
  text-align: left;
  font-size: 15px;
  font-weight: 500;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-color 0.15s;
}

.menu-item:hover {
  background: var(--surface-2);
}

.menu-item:active {
  background: var(--surface-3);
}

.menu-item svg {
  width: 20px;
  height: 20px;
  color: var(--muted);
  flex: none;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  background: #141821;
  color: #ffffff;
  border: 1px solid #2b3242;
  padding: 11px 16px;
  border-radius: var(--radius);
  z-index: 60;
  max-width: calc(100% - 32px);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 1;
  transition: opacity 0.2s ease-out, transform 0.2s ease-out;
}

@starting-style {
  .toast {
    opacity: 0;
    transform: translate(-50%, 10px);
  }
}

.toast.err {
  background: var(--err);
  border-color: var(--err);
  color: #ffffff;
}

/* ---------- administração ---------- */
.admintabs {
  display: flex;
  gap: 18px;
  overflow-x: auto;
  margin: 0 0 16px;
  padding: 0 2px;
  border-bottom: 1px solid var(--border);
  scrollbar-width: none;
}

.admintabs::-webkit-scrollbar {
  display: none;
}

.admintabs button {
  flex: none;
  min-height: 44px;
  padding: 10px 4px;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  border-radius: 0;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.admintabs button:hover {
  color: var(--text);
}

.admintabs button.on {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: transparent;
}

.list-row {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background-color 0.12s;
}

.list-row:first-child {
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.list-row:last-child {
  border-bottom: 0;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.list-row:only-child {
  border-radius: var(--radius-lg);
}

.list-row:hover {
  background: var(--surface-2);
}

.list-row:active {
  background: var(--surface-3);
}

.list-row .grow {
  flex: 1;
  min-width: 0;
}

.eans {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

table.rep {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

table.rep th,
table.rep td {
  padding: 10px 8px;
  text-align: right;
  border-bottom: 1px solid var(--border);
}

table.rep tbody tr:last-child td {
  border-bottom: 0;
}

table.rep th:first-child,
table.rep td:first-child {
  text-align: left;
}

table.rep th {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 600;
}

.kv {
  display: grid;
  grid-template-columns: minmax(120px, auto) 1fr;
  gap: 10px 16px;
  font-size: 14px;
  margin: 0;
  align-items: baseline;
}

.kv dt {
  color: var(--muted);
  font-weight: 500;
}

.kv dd {
  margin: 0;
  word-break: break-all;
  font-weight: 500;
}

/* ---------- central de controle ---------- */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin: 8px 0 16px;
}

@media (min-width: 900px) {
  .kpis {
    grid-template-columns: repeat(5, 1fr);
  }
}

.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
}

.kpi span {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  order: -1;
}

.kpi b {
  display: block;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.kpi b small {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  margin-left: 4px;
}

.kpi.warn b {
  color: var(--warn);
}

.kpi.ok b {
  color: var(--ok);
}

.kpi.err b {
  color: var(--err);
}

.cgrid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px 24px;
}

.cgrid > section {
  min-width: 0;
}

@media (min-width: 920px) {
  .cgrid {
    grid-template-columns: 400px minmax(0, 1fr);
    align-items: start;
  }
}

.seprow {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
}

.seprow:last-child {
  border-bottom: 0;
}

.seprow > input[type="checkbox"],
.orow > input[type="checkbox"] {
  width: 20px;
  height: 20px;
  flex: none;
  cursor: pointer;
}

.quota {
  flex: none;
  width: 78px;
  text-align: center;
}

.quota span {
  display: block;
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 3px;
}

.quota .input {
  min-height: 40px;
  text-align: center;
  padding: 6px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.otable-head {
  display: none;
}

.orow {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  transition: background-color 0.12s;
}

.orow:last-child {
  border-bottom: 0;
}

.orow:hover {
  background: var(--surface-2);
}

.orow > .grow,
.seprow > .grow {
  flex: 1;
  min-width: 0;
}

.seprow > .grow > .row {
  flex-wrap: wrap;
  row-gap: 4px;
}

.orow.sel {
  background: var(--info-bg);
}

.orow .owner {
  width: 156px;
  flex: none;
  min-height: 40px;
  padding: 6px 10px;
  font-size: 13.5px;
}

.ocol-sn {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ocol-items {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 4px;
}

.ocol-status {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 4px;
}

@media (min-width: 768px) {
  .ocol-group {
    display: contents;
  }

  .otable-head {
    display: grid;
    grid-template-columns: 24px minmax(145px, 1.15fr) minmax(180px, 1.7fr) minmax(120px, 1fr) 156px;
    gap: 12px;
    align-items: center;
    padding: 10px 16px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    font-size: 11.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
  }

  .orow.table-row {
    display: grid;
    grid-template-columns: 24px minmax(145px, 1.15fr) minmax(180px, 1.7fr) minmax(120px, 1fr) 156px;
    gap: 12px;
    align-items: center;
  }

  .orow.table-row .ocol-items,
  .orow.table-row .ocol-status {
    margin-top: 0;
  }

  .orow.table-row .owner {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .ctool .row {
    flex-wrap: wrap;
  }
  .ctool #cto {
    min-width: 120px !important;
    flex: 1;
  }
  .orow {
    flex-wrap: wrap;
  }
  .orow .owner {
    width: 100%;
  }
}

.section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 20px 0 8px;
}

/* ---------- fotos da bipagem (tela da etiqueta, admin) ---------- */
.photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.photo {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 8px;
  text-align: left;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  cursor: zoom-in;
  min-width: 0;
}

.photo:hover {
  border-color: var(--accent);
}

.photo .ph {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-3);
  display: grid;
  place-items: center;
  margin-bottom: 4px;
}

.photo .ph img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo .ph .spinner {
  width: 22px;
  height: 22px;
}

.photo > span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
