/* ═══════════════════════════════════════════════════════════════
   SVL — Design System
   Minimalista neutro · claro + escuro
   ═══════════════════════════════════════════════════════════════ */

/* ── Tokens: tema claro (padrão) ───────────────────────────────── */
:root {
  --bg:            #f6f6f7;
  --surface:       #ffffff;
  --surface-2:     #fafafa;
  --surface-3:     #f1f1f3;
  --border:        #e4e4e7;
  --border-strong: #d4d4d8;

  --text:          #18181b;
  --text-2:        #52525b;
  --text-3:        #a1a1aa;

  --accent:        #be185d;
  --accent-hover:  #9d174d;
  --accent-soft:   #fdf2f7;
  --accent-border: #f5d0e3;
  --on-accent:     #ffffff;

  --ok:            #15803d;
  --ok-soft:       #f0fdf4;
  --warn:          #b45309;
  --warn-soft:     #fffbeb;
  --danger:        #b91c1c;
  --danger-soft:   #fef2f2;
  --info:          #1d4ed8;
  --info-soft:     #eff6ff;

  --shadow-sm: 0 1px 2px rgba(16,16,20,.05);
  --shadow:    0 1px 3px rgba(16,16,20,.07), 0 1px 2px rgba(16,16,20,.04);
  --shadow-lg: 0 10px 32px rgba(16,16,20,.13), 0 2px 8px rgba(16,16,20,.06);

  --r-sm: 6px;
  --r:    9px;
  --r-lg: 14px;

  --sidebar-w: 236px;
  --topbar-h:  58px;
}

/* ── Tokens: tema escuro ───────────────────────────────────────── */
html[data-tema="escuro"] {
  --bg:            #0f0f11;
  --surface:       #18181b;
  --surface-2:     #1f1f23;
  --surface-3:     #27272b;
  --border:        #2a2a2f;
  --border-strong: #3f3f46;

  --text:          #f4f4f5;
  --text-2:        #a1a1aa;
  --text-3:        #71717a;

  --accent:        #ec4899;
  --accent-hover:  #f472b6;
  --accent-soft:   rgba(236,72,153,.12);
  --accent-border: rgba(236,72,153,.30);
  --on-accent:     #ffffff;

  --ok:            #4ade80;
  --ok-soft:       rgba(74,222,128,.12);
  --warn:          #fbbf24;
  --warn-soft:     rgba(251,191,36,.12);
  --danger:        #f87171;
  --danger-soft:   rgba(248,113,113,.12);
  --info:          #60a5fa;
  --info-soft:     rgba(96,165,250,.12);

  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow:    0 1px 3px rgba(0,0,0,.5);
  --shadow-lg: 0 12px 36px rgba(0,0,0,.6);
}

/* ── Reset ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 15px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;            /* trava o scroll horizontal */
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
  transition: background .2s, color .2s;
}

a { color: var(--accent); text-decoration: none; }
button { cursor: pointer; font-family: inherit; color: inherit; }
input, select, textarea { font-family: inherit; font-size: 1rem; color: inherit; }
img, svg { max-width: 100%; }
h1, h2, h3, h4 { font-weight: 650; line-height: 1.25; letter-spacing: -.011em; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ═══════════════════════════════════════════════════════════════
   LAYOUT — grid de 2 colunas, sem position:fixed no desktop
   ═══════════════════════════════════════════════════════════════ */
#app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
  width: 100%;
}
#app.oculto { display: none !important; }

/* ── Sidebar ───────────────────────────────────────────────────── */
#sidebar {
  grid-column: 1;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 200;
  transition: transform .22s ease;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 18px;
  height: var(--topbar-h);
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo > span:first-child { font-size: 1.45rem; line-height: 1; }
.sidebar-logo div div:first-child { font-weight: 700; font-size: 1.05rem; letter-spacing: -.02em; }
.sidebar-logo div div:last-child  { font-size: .7rem; color: var(--text-3); letter-spacing: .01em; }

#sidebar nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
#sidebar nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-size: .885rem;
  font-weight: 500;
  white-space: nowrap;
  transition: background .13s, color .13s;
}
#sidebar nav a > span:first-child { font-size: 1.02rem; width: 20px; text-align: center; flex-shrink: 0; opacity: .85; }
#sidebar nav a:hover { background: var(--surface-3); color: var(--text); }
#sidebar nav a.ativo {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
#sidebar nav a.ativo > span:first-child { opacity: 1; }

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-nome {
  font-size: .855rem; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user-perfil { font-size: .72rem; color: var(--text-3); text-transform: capitalize; }
.btn-logout {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  font-size: 1rem;
  display: grid; place-items: center;
  flex-shrink: 0;
  transition: all .13s;
}
.btn-logout:hover { background: var(--danger-soft); color: var(--danger); border-color: transparent; }

/* ── Área principal ────────────────────────────────────────────── */
.main, #main {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  min-width: 0;
  width: 100%;
}

.topbar, #header {
  height: var(--topbar-h);
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 22px;
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}
.topbar-titulo, #header h1 {
  font-size: 1rem;
  font-weight: 650;
  letter-spacing: -.012em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-menu, #btn-menu {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  width: 34px; height: 34px;
  font-size: 1.05rem;
  place-items: center;
  flex-shrink: 0;
}

/* Botão de tema */
.btn-tema {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  width: 34px; height: 34px;
  display: grid; place-items: center;
  font-size: .95rem;
  color: var(--text-2);
  transition: all .13s;
  flex-shrink: 0;
}
.btn-tema:hover { background: var(--surface-3); color: var(--text); }

.ws-status { font-size: .6rem; color: var(--text-3); transition: color .2s; }
.ws-status.on  { color: var(--ok); }
.ws-status.off { color: var(--danger); }

#conteudo {
  flex: 1;
  padding: 24px;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
  animation: fadeUp .22s ease;
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

/* Overlay do menu mobile */
#sidebar-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 199;
  animation: fadeIn .18s ease;
}
#sidebar-backdrop.on { display: block; }
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }

/* ═══════════════════════════════════════════════════════════════
   COMPONENTES
   ═══════════════════════════════════════════════════════════════ */

/* ── Card ──────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: 20px 22px;
  margin-bottom: 18px;
}
.card-titulo {
  font-size: .93rem;
  font-weight: 650;
  color: var(--text);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -.008em;
}

/* ── Formulários ───────────────────────────────────────────────── */
.form-grupo { margin-bottom: 15px; }
.form-grupo label, .form-label {
  display: block;
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
  letter-spacing: .005em;
}
.form-grupo input, .form-grupo select, .form-grupo textarea, .input, select.input {
  width: 100%;
  padding: 9px 12px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  font-size: .91rem;
  color: var(--text);
  transition: border-color .14s, box-shadow .14s;
}
.form-grupo input::placeholder, .input::placeholder { color: var(--text-3); }
.form-grupo input:focus, .form-grupo select:focus, .form-grupo textarea:focus, .input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-grupo input:disabled, .input:disabled { background: var(--surface-3); color: var(--text-3); cursor: not-allowed; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 13px; }

/* ── Botões ────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 17px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  font-size: .875rem;
  font-weight: 600;
  letter-spacing: -.005em;
  white-space: nowrap;
  transition: background .14s, color .14s, border-color .14s, transform .08s;
}
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-rosa    { background: var(--accent); color: var(--on-accent); }
.btn-rosa:hover:not(:disabled) { background: var(--accent-hover); }
.btn-dark    { background: var(--text); color: var(--surface); }
.btn-dark:hover:not(:disabled) { opacity: .87; }
.btn-cinza   { background: var(--surface-3); color: var(--text); border-color: var(--border); }
.btn-cinza:hover:not(:disabled) { background: var(--border); }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { opacity: .88; }
.btn-success { background: var(--ok); color: #fff; }
.btn-success:hover:not(:disabled) { opacity: .88; }
.btn-outline { background: transparent; border-color: var(--border-strong); color: var(--text); }
.btn-outline:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.btn-sm      { padding: 5px 11px; font-size: .79rem; border-radius: var(--r-sm); }
.btn-icon    { padding: 0; width: 32px; height: 32px; border-radius: var(--r-sm); }

/* ── Tabelas ───────────────────────────────────────────────────── */
.tabela-wrap {
  overflow-x: auto;
  margin: 0 -22px;
  padding: 0 22px;
  max-width: calc(100% + 44px);
}
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
th {
  background: transparent;
  color: var(--text-3);
  font-weight: 600;
  font-size: .73rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  text-align: left;
  padding: 0 12px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text-2);
}
td:first-child { color: var(--text); font-weight: 500; }
tbody tr { transition: background .12s; }
tbody tr:hover td { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: none; }
.td-acoes { display: flex; gap: 6px; align-items: center; }

/* ── Badges ────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .01em;
  white-space: nowrap;
}
.badge-verde  { background: var(--ok-soft);     color: var(--ok); }
.badge-rosa   { background: var(--accent-soft); color: var(--accent); }
.badge-cinza  { background: var(--surface-3);   color: var(--text-2); }
.badge-perigo { background: var(--danger-soft); color: var(--danger); }
.badge-warn   { background: var(--warn-soft);   color: var(--warn); }
.badge-azul   { background: var(--info-soft);   color: var(--info); }

/* ── Alertas ───────────────────────────────────────────────────── */
.alerta {
  padding: 11px 15px;
  border-radius: var(--r-sm);
  margin-bottom: 14px;
  font-size: .87rem;
  font-weight: 500;
  border: 1px solid transparent;
}
.alerta-erro { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 22%, transparent); }
.alerta-ok   { background: var(--ok-soft);     color: var(--ok);     border-color: color-mix(in srgb, var(--ok) 22%, transparent); }
.alerta-warn { background: var(--warn-soft);   color: var(--warn);   border-color: color-mix(in srgb, var(--warn) 22%, transparent); }

/* ── Modal ─────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(9,9,11,.5);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 18px;
  animation: fadeIn .16s ease;
}
.modal-overlay.oculto { display: none; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalIn .19s cubic-bezier(.2,.9,.3,1);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
.modal-lg { max-width: 860px; }
.modal-header {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.modal-header h2 { flex: 1; font-size: .98rem; font-weight: 650; color: var(--text); }
.modal-body { padding: 22px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
  flex-shrink: 0;
  background: var(--surface-2);
}

/* ── Tabs ──────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 3px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  overflow-x: auto;
}
.tabs button, .tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 15px;
  font-size: .875rem;
  font-weight: 550;
  color: var(--text-2);
  white-space: nowrap;
  transition: color .13s, border-color .13s;
  margin-bottom: -1px;
}
.tabs button:hover, .tab:hover { color: var(--text); }
.tabs button.ativo, .tab.ativo { color: var(--accent); border-bottom-color: var(--accent); font-weight: 650; }

/* ── Dashboard ─────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
  transition: box-shadow .16s, transform .16s;
}
.stat-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.stat-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent);
}
.stat-card .valor {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -.028em;
  color: var(--text);
  line-height: 1.15;
}
.stat-card .label { font-size: .775rem; color: var(--text-3); margin-top: 5px; font-weight: 500; }
.stat-card.verde::before  { background: var(--ok); }
.stat-card.verde  .valor  { color: var(--ok); }
.stat-card.warn::before   { background: var(--warn); }
.stat-card.warn   .valor  { color: var(--warn); }
.stat-card.perigo::before { background: var(--danger); }
.stat-card.perigo .valor  { color: var(--danger); }

/* ── PDV ───────────────────────────────────────────────────────── */
#pdv-layout {
  display: grid;
  grid-template-columns: minmax(0,1fr) 350px;
  gap: 16px;
  height: calc(100vh - var(--topbar-h) - 48px);
  min-height: 0;
}
#pdv-produtos { display: flex; flex-direction: column; gap: 12px; overflow: hidden; min-width: 0; }
#pdv-carrinho {
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  min-height: 0;
}
#campo-barcode {
  font-size: 1.05rem;
  padding: 12px 16px;
  background: var(--surface);
  border: 1.5px solid var(--accent);
  border-radius: var(--r);
  width: 100%;
  color: var(--text);
}
#campo-barcode:focus { outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
#lista-carrinho { flex: 1; overflow-y: auto; min-height: 0; }
.item-carrinho {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 15px;
  border-bottom: 1px solid var(--border);
}
.item-carrinho img { width: 42px; height: 42px; object-fit: cover; border-radius: var(--r-sm); background: var(--surface-3); flex-shrink: 0; }
.item-carrinho .info { flex: 1; min-width: 0; }
.item-carrinho .nome { font-size: .86rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-carrinho .var  { font-size: .75rem; color: var(--text-3); }
.item-carrinho .preco { font-size: .88rem; font-weight: 700; white-space: nowrap; }
#pdv-total { padding: 16px; border-top: 1px solid var(--border); background: var(--surface-2); flex-shrink: 0; }
#pdv-total .total-valor {
  font-size: 1.75rem; font-weight: 750;
  letter-spacing: -.03em; text-align: right; color: var(--text);
}

/* ── Busca ─────────────────────────────────────────────────────── */
.busca-wrap { position: relative; }
.busca-wrap input { padding-right: 36px; }
.busca-wrap .icon-busca {
  position: absolute; right: 11px; top: 50%;
  transform: translateY(-50%); color: var(--text-3); pointer-events: none; font-size: .9rem;
}
.resultados-busca {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px);
  z-index: 50;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow-lg);
  max-height: 330px; overflow-y: auto;
}
.resultado-item {
  padding: 10px 14px; cursor: pointer;
  display: flex; align-items: center; gap: 11px;
  border-bottom: 1px solid var(--border);
  transition: background .12s;
}
.resultado-item:last-child { border-bottom: none; }
.resultado-item:hover { background: var(--surface-2); }
.resultado-item img { width: 38px; height: 38px; object-fit: cover; border-radius: var(--r-sm); background: var(--surface-3); }

/* ── Grade ─────────────────────────────────────────────────────── */
.grade-matrix { border-collapse: separate; border-spacing: 0; }
.grade-matrix th, .grade-matrix td {
  border: 1px solid var(--border);
  padding: 7px 11px;
  text-align: center;
  font-size: .82rem;
}
.grade-matrix th { background: var(--surface-2); color: var(--text-2); text-transform: none; letter-spacing: 0; }
.grade-cell { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.qtd-badge { font-size: .72rem; font-weight: 700; padding: 2px 7px; border-radius: 10px; }
.qtd-ok    { background: var(--ok-soft);     color: var(--ok); }
.qtd-baixo { background: var(--warn-soft);   color: var(--warn); }
.qtd-zero  { background: var(--danger-soft); color: var(--danger); }

/* ── PIX ───────────────────────────────────────────────────────── */
.pix-box { text-align: center; padding: 18px; }
.pix-box img { max-width: 220px; border: 1px solid var(--border); border-radius: var(--r); background: #fff; padding: 8px; }
.pix-copia {
  word-break: break-all; font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: .73rem; background: var(--surface-3); color: var(--text-2);
  padding: 11px; border-radius: var(--r-sm); margin-top: 12px; user-select: all;
}

/* ── Login ─────────────────────────────────────────────────────── */
#tela-login {
  min-height: 100vh;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  position: relative;
}
#tela-login::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(700px circle at 15% 10%,  var(--accent-soft), transparent 55%),
    radial-gradient(600px circle at 88% 88%, var(--accent-soft), transparent 55%);
  pointer-events: none;
}
.login-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 40px 34px;
  width: 100%;
  max-width: 388px;
  box-shadow: var(--shadow-lg);
  animation: modalIn .3s cubic-bezier(.2,.9,.3,1);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-titulo, .login-logo .titulo {
  font-size: 1.5rem; font-weight: 750;
  letter-spacing: -.035em; color: var(--text); margin-top: 6px;
}
.login-sub, .login-logo .sub { font-size: .83rem; color: var(--text-3); margin-top: 2px; }

/* ── Spinner ───────────────────────────────────────────────────── */
.spinner {
  width: 26px; height: 26px;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .65s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.carregando { display: flex; justify-content: center; padding: 44px; }

/* ── Paginação ─────────────────────────────────────────────────── */
.paginacao { display: flex; gap: 5px; justify-content: center; margin-top: 20px; flex-wrap: wrap; }
.paginacao button {
  min-width: 33px; padding: 6px 11px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text-2);
  font-size: .82rem; font-weight: 550;
  transition: all .13s;
}
.paginacao button:hover:not(.ativo) { border-color: var(--border-strong); color: var(--text); }
.paginacao button.ativo { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }

/* ── Diversos ──────────────────────────────────────────────────── */
.img-produto { width: 46px; height: 46px; object-fit: cover; border-radius: var(--r-sm); background: var(--surface-3); }
.cor-dot {
  display: inline-block; width: 13px; height: 13px;
  border-radius: 50%; border: 1px solid var(--border-strong);
  vertical-align: middle; margin-right: 6px;
}
.vazio { text-align: center; padding: 44px 20px; color: var(--text-3); font-size: .89rem; }

/* ── Toast ─────────────────────────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 22px; right: 20px;
  z-index: 9999; display: flex; flex-direction: column; gap: 9px;
}
.toast {
  padding: 12px 17px;
  border-radius: var(--r);
  font-size: .86rem;
  font-weight: 550;
  color: #fff;
  box-shadow: var(--shadow-lg);
  animation: slideIn .24s cubic-bezier(.2,.9,.3,1);
  max-width: 330px;
}
.toast-ok   { background: #16a34a; }
.toast-erro { background: #dc2626; }
.toast-warn { background: #d97706; }
.toast-info { background: #2563eb; }
@keyframes slideIn { from { transform: translateX(110%); opacity: 0; } to { transform: none; opacity: 1; } }

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVO
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  #pdv-layout { grid-template-columns: 1fr; height: auto; }
  #pdv-carrinho { min-height: 340px; }
}

@media (max-width: 768px) {
  html { font-size: 14.5px; }

  #app { grid-template-columns: minmax(0, 1fr); }

  #sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 260px;
    height: 100dvh;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }
  #sidebar.aberto { transform: translateX(0); }

  .main, #main { grid-column: 1; }
  .btn-menu, #btn-menu { display: grid; }
  .topbar, #header { padding: 0 15px; }
  #conteudo { padding: 15px; }
  .card { padding: 16px; border-radius: var(--r); }
  .tabela-wrap { margin: 0 -16px; padding: 0 16px; max-width: calc(100% + 32px); }
  .stats-grid { grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: 11px; }
  .stat-card { padding: 15px 16px; }
  .stat-card .valor { font-size: 1.35rem; }
  .form-row { grid-template-columns: 1fr; }
  .modal-body { padding: 17px; }
  .modal-header, .modal-footer { padding: 13px 17px; }
  #toast-container { left: 14px; right: 14px; bottom: 14px; }
  .toast { max-width: none; }
}

@media (max-width: 420px) {
  .stats-grid { grid-template-columns: 1fr; }
  .login-card { padding: 32px 22px; }
}

/* ═══════════════════════════════════════════════════════════════
   UTILITÁRIOS
   ═══════════════════════════════════════════════════════════════ */
.oculto     { display: none !important; }
.flex       { display: flex; }
.flex-1     { flex: 1; }
.itens-cen  { align-items: center; }
.gap-8      { gap: 8px; }
.gap-12     { gap: 12px; }
.mt-8       { margin-top: 8px; }
.mt-16      { margin-top: 16px; }
.mb-12      { margin-bottom: 12px; }
.texto-dir  { text-align: right; }
.texto-cen  { text-align: center; }
.texto-rosa { color: var(--accent); }
.texto-sec  { color: var(--text-2); }
.texto-sm   { font-size: .8rem; }
.negrito    { font-weight: 700; }
.w-100      { width: 100%; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ═══════════════════════════════════════════════════════════════
   COMPATIBILIDADE
   Nomes antigos usados pelos módulos JS. Mantidos para que as
   telas já prontas continuem funcionando com o design novo.
   ═══════════════════════════════════════════════════════════════ */

/* ── Variáveis herdadas ──────────────────────────────────────── */
:root, html[data-tema="escuro"] {
  --borda:        var(--border);
  --cinza-borda:  var(--border);
  --cinza:        var(--text-3);
  --cinza-light:  var(--surface-3);
  --fundo:        var(--surface-2);
  --branco:       var(--surface);
  --texto:        var(--text);
  --texto-sec:    var(--text-2);
  --rosa:         var(--accent);
  --rosa-dark:    var(--accent);
  --rosa-claro:   var(--text-3);
  --rosa-light:   var(--accent-soft);
  --rosa-bg:      var(--accent-soft);
  --success:      var(--ok);
  --warning:      var(--warn);
  /* --danger e --info já existem nos tokens principais — não redeclarar
     aqui: "--danger: var(--danger)" cria referência circular e o CSS
     invalida a variável, deixando botões e alertas sem cor. */
  --sombra:       var(--shadow);
  --radius:       var(--r);
  --sidebar-w:    236px;
  --header-h:     58px;
}

/* ── Modal no padrão antigo: .modal é o fundo, .modal-box é a caixa ── */
.modal {
  position: fixed; inset: 0;
  background: rgba(9,9,11,.5);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 18px;
  animation: fadeIn .16s ease;
  /* neutraliza os estilos de "caixa" quando .modal é usado como fundo */
  border: none;
  border-radius: 0;
  box-shadow: none;
  max-width: none;
  max-height: none;
  overflow: visible;
}
.modal.oculto { display: none !important; }

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 22px;
  animation: modalIn .19s cubic-bezier(.2,.9,.3,1);
}

/* Quando o padrão novo é usado (.modal-overlay > .modal), .modal volta a ser a caixa */
.modal-overlay > .modal {
  position: static;
  inset: auto;
  background: var(--surface);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  padding: 0;
  max-width: 540px;
  max-height: 90vh;
  overflow: hidden;
  animation: modalIn .19s cubic-bezier(.2,.9,.3,1);
}

.modal-titulo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1rem;
  font-weight: 650;
  letter-spacing: -.01em;
  color: var(--text);
  padding-bottom: 14px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.btn-fechar {
  margin-left: auto;
  background: transparent;
  border: none;
  color: var(--text-3);
  font-size: 1.15rem;
  line-height: 1;
  width: 28px; height: 28px;
  border-radius: var(--r-sm);
  display: grid; place-items: center;
  transition: background .13s, color .13s;
  flex-shrink: 0;
}
.btn-fechar:hover { background: var(--surface-3); color: var(--text); }

/* ── Grid de formulário ──────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}
.form-grid .span2 { grid-column: span 2; }
@media (max-width: 620px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span2 { grid-column: span 1; }
}

/* ── Badges e textos herdados ────────────────────────────────── */
.badge-ok    { background: var(--ok-soft);     color: var(--ok); }
.texto-ok    { color: var(--ok);     font-weight: 600; }
.texto-perigo{ color: var(--danger); font-weight: 600; }
.texto-warn  { color: var(--warn);   font-weight: 600; }

/* ── Botões de forma de pagamento (PDV) ──────────────────────── */
.forma-btn {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 13px 10px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  font-size: .8rem; font-weight: 600; color: var(--text-2);
  transition: all .14s;
}
.forma-btn:hover { border-color: var(--border-strong); color: var(--text); }
.forma-btn.ativo {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

/* ── Etiquetas ───────────────────────────────────────────────── */
.etiq-check { display: flex; align-items: center; gap: 9px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.etiq-qty   { width: 68px; padding: 5px 8px; border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--surface); color: var(--text); font-size: .85rem; }

/* ── Cabeçalho de seção antigo ───────────────────────────────── */
.perigo { color: var(--danger); }
.verde  { color: var(--ok); }
.warn   { color: var(--warn); }
