@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

/* ── Tokens dark (padrão) ────────────────────────── */
:root {
  --bg:        #0b1120;
  --bg1:       #111827;
  --bg2:       #1a2235;
  --surface:   #1a2235;
  --surface2:  #1f2b40;
  --border:    rgba(255,255,255,.09);
  --border2:   rgba(255,255,255,.16);

  --text:      #f0f6ff;
  --text2:     #c8d8f0;
  --muted:     #7b93b8;
  --hint:      #455a78;

  --green:     #10b981;
  --greenL:    rgba(16,185,129,.15);
  --greenT:    rgba(16,185,129,.1);
  --blue:      #3b82f6;
  --blueL:     rgba(59,130,246,.15);
  --blueT:     rgba(59,130,246,.1);
  --purple:    #8b5cf6;
  --purpleL:   rgba(139,92,246,.15);
  --purpleT:   rgba(139,92,246,.1);
  --amber:     #f59e0b;
  --amberL:    rgba(245,158,11,.15);
  --amberT:    rgba(245,158,11,.1);
  --red:       #ef4444;
  --redL:      rgba(239,68,68,.15);
  --redT:      rgba(239,68,68,.1);
  --cyan:      #06b6d4;
  --cyanL:     rgba(6,182,212,.15);
  --cyanT:     rgba(6,182,212,.1);

  --sidebar:      260px;
  --sidebarMini:  72px;
  --radius:       16px;
  --shadow:       0 1px 3px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.2);
  --shadow2:      0 8px 32px rgba(0,0,0,.35);
  --font:         'Inter', system-ui, sans-serif;

  --sidebar-bg:   #0d1526;
  --sidebar-text: rgba(255,255,255,.55);
  --sidebar-act:  rgba(255,255,255,.1);
  --topbar-bg:    rgba(11,17,32,.88);
}

/* ── Tokens light ────────────────────────────────── */
body.light {
  --bg:        #f1f5f9;
  --bg1:       #ffffff;
  --bg2:       #f8fafc;
  --surface:   #ffffff;
  --surface2:  #f8fafc;
  --border:    #e2e8f0;
  --border2:   #cbd5e1;

  --text:      #0f172a;
  --text2:     #334155;
  --muted:     #64748b;
  --hint:      #94a3b8;

  --green:     #059669;
  --greenL:    #d1fae5;
  --greenT:    rgba(5,150,105,.1);
  --blue:      #2563eb;
  --blueL:     #dbeafe;
  --blueT:     rgba(37,99,235,.1);
  --purple:    #7c3aed;
  --purpleL:   #ede9fe;
  --purpleT:   rgba(124,58,237,.1);
  --amber:     #d97706;
  --amberL:    #fef3c7;
  --amberT:    rgba(217,119,6,.1);
  --red:       #dc2626;
  --redL:      #fee2e2;
  --redT:      rgba(220,38,38,.1);
  --cyan:      #0891b2;
  --cyanL:     #cffafe;
  --cyanT:     rgba(8,145,178,.1);

  --shadow:    0 1px 3px rgba(0,0,0,.07), 0 4px 16px rgba(0,0,0,.05);
  --shadow2:   0 8px 32px rgba(0,0,0,.1);

  --sidebar-bg:   #1e293b;
  --sidebar-text: rgba(255,255,255,.55);
  --sidebar-act:  rgba(255,255,255,.1);
  --topbar-bg:    rgba(241,245,249,.9);
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 14px;
  line-height: 1.5;
  transition: background .25s, color .25s;
}

button, input, select { font-family: inherit; }
button { cursor: pointer; border: 0; }

.app { min-height: 100vh; display: flex; max-width: 100vw; overflow-x: hidden; }

/* ── Sidebar ─────────────────────────────────────── */
.sidebar {
  width: var(--sidebar);
  min-height: 100vh;
  position: fixed; inset: 0 auto 0 0;
  background: var(--sidebar-bg);
  display: flex; flex-direction: column;
  transition: width .22s ease;
  z-index: 50;
  border-right: 1px solid rgba(255,255,255,.06);
}
body.menu-mini .sidebar { width: var(--sidebarMini); }

.sidebar-head {
  min-height: 68px;
  display: flex; align-items: center; gap: 12px;
  padding: 16px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.logo {
  width: 38px; height: 38px; border-radius: 12px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--green), #34d399);
  display: grid; place-items: center;
  font-weight: 800; font-size: 13px; color: #fff; letter-spacing: -.3px;
}
.brand { min-width: 0; }
.brand h1 { font-size: 15px; font-weight: 800; color: #fff; letter-spacing: -.3px; }
.brand span { display: block; margin-top: 2px; font-size: 11px; color: rgba(255,255,255,.35); }

body.menu-mini .brand,
body.menu-mini .nav-label,
body.menu-mini .nav-section-label,
body.menu-mini .clock-box,
body.menu-mini .login-text {
  opacity: 0; pointer-events: none; width: 0; overflow: hidden; white-space: nowrap;
}

/* mini-btn removido — chevron (sidebar-toggle) faz essa função */

.sidebar-nav { padding: 12px 10px; flex: 1; overflow: auto; }

.nav-section-label {
  padding: 10px 10px 5px;
  color: rgba(255,255,255,.28);
  font-size: 10px; text-transform: uppercase;
  font-weight: 700; letter-spacing: 1px; white-space: nowrap;
}
.nav-item {
  min-height: 42px; display: flex; align-items: center;
  gap: 10px; padding: 9px 12px;
  color: var(--sidebar-text);
  border-radius: 11px; margin-bottom: 2px;
  cursor: pointer; transition: all .15s; position: relative;
}
.nav-item:hover { color: rgba(255,255,255,.85); background: rgba(255,255,255,.06); }
.nav-item.active {
  color: #fff; background: var(--sidebar-act);
}
/* Barra verde esquerda: visível no modo expandido, oculta no modo mini */
.nav-item.active::before {
  content: '';
  position: absolute; left: 0; top: 6px; bottom: 6px;
  width: 3px; border-radius: 0 3px 3px 0;
  background: var(--green);
  transition: opacity .15s;
}
.nav-icon {
  width: 20px; height: 20px;
  display: grid; place-items: center; flex-shrink: 0;
  color: inherit;
}
.nav-icon svg { width: 20px; height: 20px; }
.nav-label { font-size: 13px; font-weight: 600; white-space: nowrap; }
.nav-badge {
  margin-left: auto; font-size: 10px; font-weight: 700;
  color: #fff; background: var(--red);
  padding: 2px 7px; border-radius: 999px; min-width: 20px; text-align: center;
}
body.menu-mini .nav-badge { position: absolute; right: 4px; top: 4px; padding: 2px 5px; font-size: 9px; }

/* ── Modo mini: item ativo mostra ring verde ao redor do ícone ── */
body.menu-mini .nav-item.active::before { opacity: 0; }
body.menu-mini .nav-item.active {
  background: transparent;
}
body.menu-mini .nav-item.active .nav-icon {
  background: var(--sidebar-act);
  border-radius: 10px;
  outline: 2px solid var(--green);
  outline-offset: 1px;
  width: 36px; height: 36px;
}
/* Hover no modo mini: ring sutil */
body.menu-mini .nav-item:hover .nav-icon {
  background: rgba(255,255,255,.08);
  border-radius: 10px;
}
/* Centraliza o item no modo mini */
body.menu-mini .nav-item {
  justify-content: center;
  padding: 9px 0;
}

.sidebar-bottom { padding: 12px; border-top: 1px solid rgba(255,255,255,.07); }

.clock-box {
  background: rgba(255,255,255,.05);
  border-radius: 12px; padding: 11px 14px; margin-bottom: 8px;
}
.clock-time {
  font-size: 20px; font-weight: 600; color: #fff;
  letter-spacing: .5px;
  font-variant-numeric: tabular-nums;
}
.clock-date { color: rgba(255,255,255,.38); margin-top: 3px; font-size: 11px; text-transform: capitalize; }

.login-btn, .refresh-btn {
  width: 100%; display: flex; justify-content: center; align-items: center;
  gap: 7px; min-height: 38px; border-radius: 11px;
  font-size: 12px; font-weight: 700; margin-top: 6px; transition: all .15s;
}
.login-btn {
  background: rgba(16,185,129,.18); color: #34d399;
  border: 1px solid rgba(52,211,153,.2);
}
.login-btn:hover { background: rgba(16,185,129,.28); }
.refresh-btn {
  background: rgba(255,255,255,.06); color: rgba(255,255,255,.55);
  border: 1px solid rgba(255,255,255,.1);
}
.refresh-btn:hover { background: rgba(255,255,255,.1); color: #fff; }
.refresh-btn svg, .theme-btn svg { width: 16px; height: 16px; }
body.menu-mini .login-btn,
body.menu-mini .refresh-btn { width: 44px; padding: 0; }

/* ── Botão de tema ───────────────────────────────── */
.theme-btn {
  width: 100%; display: flex; justify-content: center; align-items: center;
  gap: 7px; min-height: 34px; border-radius: 11px;
  font-size: 11px; font-weight: 700; margin-top: 6px;
  background: rgba(255,255,255,.05); color: rgba(255,255,255,.45);
  border: 1px solid rgba(255,255,255,.08); transition: all .15s;
}
.theme-btn:hover { background: rgba(255,255,255,.1); color: rgba(255,255,255,.75); }
body.menu-mini .theme-btn { width: 44px; padding: 0; }
body.menu-mini .theme-btn span { display: none; }

/* ── Main ────────────────────────────────────────── */
.main {
  margin-left: var(--sidebar);
  width: calc(100% - var(--sidebar));
  max-width: calc(100vw - var(--sidebar));
  min-width: 0;
  min-height: 100vh;
  overflow-x: hidden;
  transition: margin .22s ease, width .22s ease;
}
body.menu-mini .main {
  margin-left: var(--sidebarMini);
  width: calc(100% - var(--sidebarMini));
  max-width: calc(100vw - var(--sidebarMini));
}

/* ── Topbar ──────────────────────────────────────── */
.topbar {
  height: 64px; position: sticky; top: 0; z-index: 20;
  background: var(--topbar-bg);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 0 24px;
  transition: background .25s;
}
.top-title h2 { font-size: 18px; font-weight: 800; letter-spacing: -.4px; color: var(--text); }
.top-title span { color: var(--green); }
.top-title p { color: var(--muted); font-size: 11px; margin-top: 2px; }
.top-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.filter, .date-filter {
  background: var(--surface);
  color: var(--text); border: 1px solid var(--border2);
  border-radius: 10px; min-height: 36px; padding: 0 12px;
  outline: none; font-size: 12px; font-weight: 600; transition: border .15s;
}
.filter:focus, .date-filter:focus { border-color: var(--blue); }
.filter option { background: var(--bg1); color: var(--text); }
.date-filter { display: none; }
.date-filter.show { display: block; }

.top-btn {
  height: 36px; padding: 0 14px; border-radius: 10px;
  background: var(--blueT); color: var(--blue);
  border: 1px solid rgba(59,130,246,.25);
  font-size: 12px; font-weight: 700; transition: background .15s;
}
.top-btn:hover { background: var(--blueL); }

/* Ponto de status de sincronização — fica ao lado do título da página.
   Substitui o antigo "Ao vivo" e o chip "Novos dados". Três estados:
   verde (ok), laranja (sincronizando/pendente), vermelho (erro). */
.sync-dot {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  margin-left: 9px; vertical-align: middle;
  transition: background .25s, box-shadow .25s;
}
.sync-dot.sync-ok {
  background: var(--green); box-shadow: 0 0 0 3px var(--greenT);
}
.sync-dot.sync-pending {
  background: var(--amber, #f59e0b); box-shadow: 0 0 0 3px rgba(245,158,11,.18);
  animation: syncPulse 1.2s ease-in-out infinite;
}
.sync-dot.sync-error {
  background: var(--red, #ef4444); box-shadow: 0 0 0 3px rgba(239,68,68,.18);
}
@keyframes syncPulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }

/* Overlay que bloqueia cliques durante carregamentos iniciados pelo usuário.
   Transparente de propósito: o feedback visual é o toast "Atualizando dados...";
   o overlay só impede interação com dados a meio caminho. z-index 99 fica
   abaixo do toast (100) e da tela de login (200). */
.loading-overlay {
  position: fixed; inset: 0; z-index: 99;
  display: none; background: transparent;
  cursor: progress;
}
.loading-overlay.show { display: block; }
.last-update { color: var(--muted); font-size: 11px; }

/* ── Pages ───────────────────────────────────────── */
.page { display: none; padding: 24px; flex-direction: column; gap: 20px; min-width: 0; overflow-x: hidden; }
.page.active { display: flex; }

/* ── Hero ────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, #0d1f3c 0%, #0b2a1e 100%);
  border-radius: 20px; padding: 28px 32px;
  display: flex; justify-content: space-between; align-items: center;
  gap: 24px; overflow: hidden; position: relative;
  box-shadow: var(--shadow2);
  border: 1px solid rgba(16,185,129,.15);
}
.hero::before {
  content: ''; position: absolute; right: -60px; top: -60px;
  width: 240px; height: 240px; border-radius: 50%;
  background: radial-gradient(circle, rgba(16,185,129,.18), transparent 70%);
  pointer-events: none;
}
.hero h3 { font-size: 22px; font-weight: 800; color: #fff; letter-spacing: -.5px; margin-bottom: 6px; }
.hero h3 span { color: #34d399; }
.hero p { color: rgba(255,255,255,.45); font-size: 13px; }
.hero-metrics { display: flex; gap: 28px; z-index: 1; }
.hero-metric small {
  display: block; color: rgba(255,255,255,.45);
  text-transform: uppercase; font-size: 10px; letter-spacing: .8px;
  font-weight: 700; margin-bottom: 5px;
}
.hero-metric strong {
  font-size: 20px; font-weight: 700; color: #fff;
  letter-spacing: -.4px; font-variant-numeric: tabular-nums;
}

/* ── Grid ────────────────────────────────────────── */
.grid { display: grid; gap: 16px; }
.grid > * { min-width: 0; }
.cols-4 { grid-template-columns: repeat(4,1fr); }
.cols-3 { grid-template-columns: repeat(3,1fr); }
.cols-2 { grid-template-columns: repeat(2,1fr); }

@media(max-width:960px) {
  .cols-2 { grid-template-columns: 1fr; }
  .cols-3 { grid-template-columns: repeat(2,1fr); }
}

.grid-flex { display: flex; flex-wrap: wrap; gap: 16px; }
.grid-flex > * { flex: 1 1 320px; min-width: 0; }
.grid-flex.flex-4 > * { flex: 1 1 220px; min-width: 0; }
.grid-flex.dash-main > *:first-child { flex: 1.6 1 380px; min-width: 0; }
.grid-flex.dash-main > *:last-child  { flex: 1 1 280px; min-width: 0; }
.grid-flex.wide2 > *:first-child { flex: 1 1 320px; min-width: 0; }
.grid-flex.wide2 > *:last-child  { flex: 1.35 1 360px; min-width: 0; }
.wide   { grid-template-columns: 1.5fr 1fr; }
.wide2  { grid-template-columns: 1fr 1.35fr; }

/* ── Cards KPI ───────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  position: relative; overflow: hidden; min-width: 0;
  box-shadow: var(--shadow); transition: box-shadow .2s, transform .2s;
}
.card:hover { box-shadow: var(--shadow2); transform: translateY(-1px); }

.card-icon {
  width: 42px; height: 42px; border-radius: 13px;
  display: grid; place-items: center;
  margin-bottom: 14px; background: var(--greenL); color: var(--green);
  position: relative; z-index: 1;
}
.card-icon svg { width: 22px; height: 22px; }
.card.blue   .card-icon { background: var(--blueL);   color: var(--blue); }
.card.purple .card-icon { background: var(--purpleL); color: var(--purple); }
.card.amber  .card-icon { background: var(--amberL);  color: var(--amber); }
.card.red    .card-icon { background: var(--redL);    color: var(--red); }
.card.cyan   .card-icon { background: var(--cyanL);   color: var(--cyan); }

.card-label {
  color: var(--muted); font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .8px; margin-bottom: 7px;
  position: relative; z-index: 1;
}
.card-value {
  font-size: 26px; font-weight: 700;
  letter-spacing: -.8px; font-variant-numeric: tabular-nums;
  line-height: 1; color: var(--text);
  position: relative; z-index: 1;
}
.card-sub { margin-top: 9px; color: var(--muted); font-size: 12px; position: relative; z-index: 1; }

/* ── Panels ──────────────────────────────────────── */
.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden; display: flex; flex-direction: column;
  min-height: 0; min-width: 0; max-width: 100%;
}
/* Painéis com gráficos precisam de altura mínima */
.panel[style*="min-height"], #nvDashLinha, #nvDashAreaFatCusto, #nvDashCategorias { min-height: 260px; }
/* Painéis de formulário nova venda: overflow visible para autocomplete */
#nvCardCliente, #nvCardProduto { overflow: visible; }
/* O .panel-body herda overflow-x:hidden da regra global, o que recorta o
   dropdown de sugestões (que é position:absolute e ultrapassa a altura do
   card curto). Só nestes dois cards liberamos o overflow para a lista
   aparecer inteira. O z-index:60 das sugestões garante que fiquem por cima
   dos cards seguintes. Demais cards (itens, whatsapp) mantêm o recorte. */
#nvCardCliente .panel-body, #nvCardProduto .panel-body { overflow: visible; }

.panel-head {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; flex-wrap: wrap; min-width: 0;
  box-sizing: border-box; overflow: hidden;
}
.panel-title { font-weight: 700; font-size: 14px; color: var(--text); letter-spacing: -.2px; }
.panel-sub { color: var(--muted); font-size: 11px; margin-top: 2px; }
.panel-badge {
  padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700;
  color: var(--red); background: var(--redL);
}
.panel-body { padding: 18px; flex: 1; min-width: 0; box-sizing: border-box; overflow-x: hidden; }
.table-wrap { overflow: auto; max-height: 360px; }

/* ── Tabela ──────────────────────────────────────── */
table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 600px; }
thead { position: sticky; top: 0; z-index: 4; }
th {
  color: var(--muted); text-transform: uppercase; font-size: 10px;
  letter-spacing: .7px; text-align: left; padding: 10px 12px;
  border-bottom: 1px solid var(--border2);
  position: sticky; top: 0; z-index: 4;
  background: var(--surface);
  font-weight: 700; white-space: nowrap;
}
td { padding: 11px 12px; border-bottom: 1px solid var(--border); color: var(--text2); font-size: 13px; }
tr:last-child td { border-bottom: 0; }
tr:hover td { background: var(--surface2); }
td.num {
  font-weight: 600; font-variant-numeric: tabular-nums;
  color: var(--text); white-space: nowrap; font-size: 12px;
}
.tbl-empty { text-align: center; padding: 36px !important; color: var(--hint); font-size: 13px; }

/* ── Chips ───────────────────────────────────────── */
.chip, .type-chip {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px; padding: 3px 9px;
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; white-space: nowrap; letter-spacing: .4px;
}
.chip-green { color: var(--green); background: var(--greenL); }
.chip-red   { color: var(--red);   background: var(--redL); }
.chip-amber { color: var(--amber); background: var(--amberL); }
.chip-blue  { color: var(--blue);  background: var(--blueL); }
.tc-green { color: var(--green);  background: var(--greenT); }
.tc-blue  { color: var(--blue);   background: var(--blueT); }
.tc-amber { color: var(--amber);  background: var(--amberT); }
.tc-red   { color: var(--red);    background: var(--redT); }
.tc-muted { color: var(--muted);  background: rgba(100,116,139,.12); }

/* ── Progress / Ranking ──────────────────────────── */
.progress-list, .forn-list { display: flex; flex-direction: column; gap: 14px; }
.progress-head, .forn-head {
  display: flex; justify-content: space-between; gap: 10px;
  margin-bottom: 6px; font-size: 13px; font-weight: 600; color: var(--text2);
}
.progress-head span:last-child,
.forn-head span:last-child { color: var(--text); font-weight: 700; font-size: 12px; }
.bar { height: 7px; border-radius: 999px; background: var(--border2); overflow: hidden; }
.fill        { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--green), #34d399); }
.fill.purple { background: linear-gradient(90deg, var(--purple), #a78bfa); }
.fill.amber  { background: linear-gradient(90deg, var(--amber), #fbbf24); }
.fill.blue   { background: linear-gradient(90deg, var(--blue), #60a5fa); }

/* ── Meta cards ──────────────────────────────────── */
.meta-card {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 13px; padding: 16px; margin-bottom: 12px;
}
.meta-row {
  display: flex; justify-content: space-between; gap: 12px;
  margin-bottom: 8px; font-size: 12px; font-weight: 600; color: var(--muted);
}
.meta-row strong { font-size: 15px; color: var(--text); }

/* ── Summary grid ────────────────────────────────── */
.summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.summary-mini {
  padding: 14px; border-radius: 12px;
  background: var(--surface2); border: 1px solid var(--border);
}
.summary-mini small { color: var(--muted); text-transform: uppercase; font-size: 10px; font-weight: 700; letter-spacing: .6px; }
.summary-mini strong { display: block; margin-top: 5px; font-size: 16px; font-weight: 700; color: var(--text); }

/* ── Highlight ───────────────────────────────────── */
.highlight {
  margin-top: 12px; padding: 20px; border-radius: 14px;
  background: linear-gradient(135deg, var(--greenT), var(--blueT));
  border: 1px solid rgba(16,185,129,.2);
}
.highlight small { color: var(--green); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; }
.highlight strong { display: block; margin-top: 6px; font-size: 30px; font-weight: 800; letter-spacing: -1px; color: var(--text); }

/* ── Alertas ─────────────────────────────────────── */
.alert-card {
  padding: 13px 15px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface2); margin-bottom: 8px;
}
.alert-card.alto  { background: var(--redL);   border-color: rgba(239,68,68,.3); }
.alert-card.medio { background: var(--amberL); border-color: rgba(245,158,11,.3); }
.alert-title { font-weight: 700; margin-bottom: 3px; font-size: 13px; color: var(--text); }
.alert-desc  { color: var(--muted); font-size: 12px; }

/* ── Gráficos ────────────────────────────────────── */
.chart-wrap { width: 100%; position: relative; }
.chart-wrap canvas { width: 100% !important; }

/* ── Busca de clientes ───────────────────────────── */
.search-box { display: flex; gap: 10px; margin-bottom: 4px; }
.search-input {
  flex: 1; height: 42px; border-radius: 12px;
  border: 1px solid var(--border2); background: var(--surface);
  padding: 0 16px; font-size: 14px; color: var(--text);
  outline: none; transition: border .15s, box-shadow .15s;
}
.search-input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blueT); }
.search-input::placeholder { color: var(--hint); }

.client-grid { display: grid; grid-template-columns: 300px 1fr; gap: 16px; }
.client-list { display: flex; flex-direction: column; gap: 6px; max-height: 560px; overflow: auto; }
.client-item {
  padding: 12px 14px; border-radius: 11px;
  background: var(--surface); border: 1px solid var(--border);
  cursor: pointer; transition: all .15s;
}
.client-item:hover { border-color: var(--blue); }
.client-item.active { border-color: var(--blue); background: var(--blueT); }
.client-item-name { font-weight: 700; font-size: 13px; color: var(--text); margin-bottom: 3px; }
.client-item-meta { font-size: 11px; color: var(--muted); display: flex; gap: 10px; }

.client-detail { display: flex; flex-direction: column; gap: 14px; }
.client-detail-empty {
  display: flex; align-items: center; justify-content: center;
  min-height: 300px; color: var(--hint); font-size: 13px;
  border: 2px dashed var(--border2); border-radius: var(--radius);
}
.client-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin-bottom: 18px; }
.client-stat {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px;
}
.client-stat small { color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; }
.client-stat strong { display: block; margin-top: 5px; font-size: 17px; font-weight: 700; color: var(--text); }

/* ── Loading ─────────────────────────────────────── */
.loading {
  position: fixed; right: 20px; bottom: 20px; z-index: 100;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); padding: 11px 18px 11px 14px; border-radius: 12px;
  font-size: 12px; font-weight: 600; box-shadow: var(--shadow2);
  display: none; align-items: center; gap: 10px;
}
.loading.show { display: flex; animation: loadingIn .2s ease; }
@keyframes loadingIn { from { opacity:0; transform: translateY(8px); } to { opacity:1; transform: translateY(0); } }
.loading::before {
  content: ''; width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid var(--border2); border-top-color: var(--green);
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Auth box ────────────────────────────────────── */
.auth-box {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.6); backdrop-filter: blur(16px);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.auth-card {
  width: min(420px,100%); background: var(--surface);
  border: 1px solid var(--border); border-radius: 22px;
  padding: 32px; box-shadow: var(--shadow2); text-align: center;
}
.auth-card h2 { font-size: 21px; font-weight: 800; margin-bottom: 8px; color: var(--text); }
.auth-card p { color: var(--muted); line-height: 1.6; font-size: 13px; margin-bottom: 20px; }
.auth-card button {
  width: 100%; min-height: 44px; border-radius: 12px;
  background: var(--green); color: #fff;
  font-weight: 700; font-size: 14px; transition: opacity .15s;
}
.auth-card button:hover { opacity: .88; }
body.authed .auth-box { display: none; }

/* ── Responsivo 1280px ───────────────────────────── */
@media(max-width:1280px) {
  .cols-4 { grid-template-columns: repeat(2,1fr); }
  .wide, .wide2 { grid-template-columns: 1fr; }
  .hero { flex-direction: column; align-items: flex-start; }
  .hero-metrics { width: 100%; flex-wrap: wrap; }
  .client-grid { grid-template-columns: 1fr; }
}

/* ── Breakpoint médio (tablets) ──────────────────── */
@media(max-width:1024px) {
  .cols-4 { grid-template-columns: repeat(2,1fr); }
  .grid-flex.flex-4 > * { flex: 1 1 200px; }
}

/* ── Sidebar toggle (chevron flutuante — estilo app.vendas) ── */
.sidebar-toggle {
  position: fixed;
  top: 50%;
  left: calc(var(--sidebar) - 15px);
  z-index: 70;
  width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--border2);
  background: var(--surface);
  color: var(--text2);
  display: grid; place-items: center;
  box-shadow: 0 4px 16px rgba(0,0,0,.35);
  transform: translateY(-50%);
  cursor: pointer;
  transition: left .28s cubic-bezier(.22,1,.36,1),
              background .18s, border-color .18s, color .18s;
}
.sidebar-toggle:hover { background: var(--green); border-color: var(--green); color: #fff; }
.sidebar-toggle svg { width: 15px; height: 15px; transition: transform .28s cubic-bezier(.22,1,.36,1); }
/* Desktop: mostra o chevron (indica encolher/expandir), esconde o hambúrguer.
   No mobile (media query abaixo) inverte — o hambúrguer comunica "menu". */
.sidebar-toggle-burger { display: none; }
/* Modo recolhido: chevron aponta para a direita */
body.menu-mini .sidebar-toggle { left: calc(var(--sidebarMini) - 15px); }
body.menu-mini .sidebar-toggle svg { transform: rotate(180deg); }

/* ── Botão hambúrguer mobile + overlay ─────────────── */
/* .mobile-menu-btn removido — hambúrguer substituído pelo sidebar-toggle */
.sidebar-overlay {
  display: none; position: fixed; inset: 0; z-index: 55;
  background: rgba(0,0,0,.5); backdrop-filter: blur(2px);
}

/* ── Mobile ≤760px ───────────────────────────────── */
@media(max-width:760px) {
  /* Sidebar: gaveta deslizante */
  .sidebar {
    transform: translateX(-100%);
    transition: transform .25s ease;
    width: min(280px, 84vw) !important;
    z-index: 60;
  }
  body.sidebar-mobile-aberta .sidebar  { transform: translateX(0); }
  body.sidebar-mobile-aberta .sidebar-overlay { display: block; }

  /* Conteúdo ocupa tela toda */
  .main, body.menu-mini .main {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100vw !important;
    /* overflow-x:hidden no .main quebra o position:sticky da trilha (um
       ancestral com overflow != visible vira o container de ancoragem do
       sticky). A contenção horizontal fica por conta do .page e do .app,
       que já têm overflow-x:hidden. Sem isto, os steps não fixam ao rolar. */
    overflow-x: visible !important;
  }

  /* No mobile, o botão de menu vira hambúrguer maior, à esquerda do título,
     integrado à topbar (não mais flutuando no canto direito). */
  .sidebar-toggle {
    top: 14px; transform: none;
    left: 14px;
    width: 38px; height: 38px; border-radius: 10px;
  }
  .sidebar-toggle-chevron { display: none; }
  .sidebar-toggle-burger { display: block; }
  .sidebar-toggle svg { width: 20px; height: 20px; }
  /* Quando a gaveta abre, o botão vira "fechar" (chevron) e desliza junto */
  body.sidebar-mobile-aberta .sidebar-toggle {
    left: calc(min(280px, 84vw) - 15px);
    width: 30px; height: 30px; border-radius: 50%;
  }
  body.sidebar-mobile-aberta .sidebar-toggle-burger { display: none; }
  body.sidebar-mobile-aberta .sidebar-toggle-chevron { display: block; }

  /* No mobile, o accordion exibe labels mesmo com menu-mini */
  body.menu-mini .nav-label,
  body.menu-mini .nav-section-label,
  body.menu-mini .brand,
  body.menu-mini .clock-box,
  body.menu-mini .login-text { opacity: 1; width: auto; pointer-events: auto; }
  body.menu-mini .sidebar { width: min(280px,84vw) !important; }
  body.menu-mini .nav-sub  { display: block; }
  body.menu-mini .nav-accordion-arrow { display: inline; }

  /* Grids colapsam para 1 coluna */
  .cols-4, .cols-3, .cols-2,
  .grid-flex, .grid-flex.flex-4,
  .wide, .wide2, .dash-main { grid-template-columns: 1fr !important; }
  .grid-flex > *, .grid-flex.flex-4 > * { flex: 1 1 100% !important; }

  /* Topbar empilha, deixa espaço pro hambúrguer */
  .topbar {
    height: auto;
    padding: 14px 14px 14px 62px;
    flex-direction: column; align-items: stretch; gap: 10px;
  }
  .top-title h2 { font-size: 16px; }
  .top-actions { width: 100%; flex-wrap: wrap; gap: 6px; }
  .top-actions .filter { flex: 1 1 100%; min-width: 0; min-height: 40px; font-size: 13px; }
  .top-actions .date-filter { flex: 1 1 auto; min-width: 0; min-height: 40px; }
  .top-actions .top-btn { flex: 0 0 auto; }
  /* Tela cheia não faz sentido em celular; last-update também some.
     O status de sync fica no ponto colorido ao lado do título. */
  #fullscreenBtn { display: none; }
  .last-update { display: none; }

  /* Cards e painéis mais compactos */
  .page { padding: 14px; gap: 14px; overflow-x: visible; }
  .card { padding: 16px; }
  .card-value { font-size: 22px; }
  .panel-body { padding: 14px; }

  /* KPI cards menores */
  .kpi-card { padding: 16px 16px 0; }
  .kpi-value { font-size: 20px; }

  /* Hero empilha */
  .hero { flex-direction: column; align-items: flex-start; padding: 20px; }
  .hero-metrics { width: 100%; flex-wrap: wrap; gap: 16px; }

  /* 1 coluna em telas específicas */
  .client-grid, .client-stats, .perfis-grid { grid-template-columns: 1fr !important; }
  .summary-grid { grid-template-columns: 1fr; }

  /* Modais ocupam quase a tela toda */
  .baixa-modal, .imei-modal, .cb-modal { width: 94vw !important; max-width: 94vw !important; }

  /* Tabelas: fonte menor, mantém scroll horizontal */
  th { font-size: 9px; padding: 8px; }
  td { font-size: 12px; padding: 9px 8px; }
  td.num { font-size: 11px; }
  table { min-width: 420px; }

  /* Nova Venda: campos em coluna única */
  .nv-field-row { flex-direction: column !important; }
  .nv-field, .nv-field-grow, .nv-field-md, .nv-field-sm {
    min-width: 0 !important; width: 100% !important; flex: 1 1 100% !important;
  }

  /* Barra de ações */
  .nv-acoes-bar { justify-content: stretch; }
  .nv-acoes-bar .top-btn { flex: 1; text-align: center; }

  /* Grid do resumo de produto */
  .nv-resumo-grid { grid-template-columns: 1fr 1fr !important; }

  /* Barras horizontais dos gráficos */
  .nv-bar-label { width: 90px; font-size: 11px; }
  .nv-bar-value { width: 64px; font-size: 11px; }



  /* Rosca: empilha verticalmente */
  .nv-rosca-wrap { flex-direction: column; align-items: center; }
  .nv-rosca-legenda { min-width: 0; width: 100%; }
  .nv-rosca-svg { width: 160px; height: 160px; }

  /* Barras verticais menores */
  .nv-vbar-chart { gap: 8px; padding: 8px 14px 14px; }
  .nv-vbar-val { font-size: 9px; }
  .nv-vbar-lbl { font-size: 10px; }

  /* Gráficos SVG no mobile: preenchem a largura do painel, sem scroll,
     altura automática mantendo proporção (sem distorcer). */
  .nv-line-chart-wrap, .fat-chart-wrap { overflow-x: hidden; }
  .fat-chart, .nv-line-chart { width: 100%; min-width: 0; height: auto; }
}

/* ── Telas estreitas <420px ──────────────────────── */
@media(max-width:420px) {
  .page { padding: 10px; }
  .card-value, .kpi-value { font-size: 19px; }
  .top-title h2 { font-size: 14px; }
  .nv-resumo-grid { grid-template-columns: 1fr !important; }
  .nv-bar-label { width: 70px; font-size: 10px; }
  .nv-bar-value { width: 52px; font-size: 10px; }
  table { min-width: 380px; }
}

/* ── KPI Cards ───────────────────────────────────── */
.kpi-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 20px 0;
  box-shadow: var(--shadow); overflow: hidden; position: relative;
  transition: box-shadow .2s, transform .2s;
  display: flex; flex-direction: column; min-width: 0;
}
.kpi-card:hover { box-shadow: var(--shadow2); transform: translateY(-1px); }
.kpi-top {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 10px;
}
.kpi-label {
  font-size: 11px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .8px;
}
.kpi-icon {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center; flex-shrink: 0;
}
.kpi-icon svg { width: 18px; height: 18px; }
.kpi-value {
  font-size: 24px; font-weight: 800; color: var(--text);
  letter-spacing: -.8px; line-height: 1; margin-bottom: 6px;
}
.kpi-sub { font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.kpi-spark { display: block; width: 100%; height: 44px; margin-top: 4px; overflow: hidden; }
.kpi-spark .spark-svg { display: block; width: 100%; height: 100%; }

/* ── Gráfico Faturamento+Lucro SVG ──────────────── */
.fat-chart-wrap { width: 100%; overflow-x: auto; }
.fat-chart { display: block; width: 100%; height: auto; }
.fat-grid { stroke: rgba(255,255,255,.05); stroke-width: 1; }
body.light .fat-grid { stroke: rgba(0,0,0,.05); }
.fat-x { fill: var(--muted); font-size: 10px; text-anchor: middle; font-family: inherit; }
.fat-y { fill: var(--muted); font-size: 10px; text-anchor: end; font-family: inherit; }

/* ── Dashboard main grid ─────────────────────────── */
.dash-main { grid-template-columns: 1.6fr 1fr; }
@media(max-width:1280px) { .dash-main { grid-template-columns: 1fr; } }

/* ── Vendas dashboard cols-2 colapsa em tablet ─── */
@media(max-width:960px) {
  .nv-tela .grid.cols-2 { grid-template-columns: 1fr !important; }
  .nv-tela .grid { gap: 14px; }
}

/* ── Scrollbars ──────────────────────────────────── */
* { scrollbar-width: thin; scrollbar-color: var(--border2) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--border2); border-radius: 999px;
  border: 2px solid transparent; background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover { background: var(--muted); background-clip: padding-box; }
*::-webkit-scrollbar-corner { background: transparent; }
body.light * { scrollbar-color: rgba(0,0,0,.2) transparent; }
body.light *::-webkit-scrollbar-thumb { background: rgba(0,0,0,.18); background-clip: padding-box; }
body.light *::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,.32); background-clip: padding-box; }

/* ── Saldo ───────────────────────────────────────── */
.saldo-grid { display: flex; flex-direction: column; gap: 8px; }
.saldo-row { display: flex; justify-content: space-between; align-items: center; }
.saldo-label { font-size: 13px; color: var(--text2); font-weight: 600; }
.saldo-val { font-size: 14px; font-weight: 700; color: var(--text); }
.saldo-val.muted { color: var(--muted); }
.saldo-sub { font-size: 11px; color: var(--muted); margin-top: -2px; }
.saldo-divider { height: 1px; background: var(--border); margin: 8px 0; }
.saldo-final {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--green); border-radius: 12px; padding: 14px 18px; margin-top: 6px;
}
.saldo-final span { font-size: 11px; font-weight: 800; color: #fff; letter-spacing: .8px; text-transform: uppercase; }
.saldo-final strong { font-size: 20px; font-weight: 800; color: #fff; }

/* ── Paginação ───────────────────────────────────── */
.pagination { display: flex; align-items: center; justify-content: center; gap: 4px; padding: 16px 12px 6px; flex-wrap: wrap; }
.pag-btn {
  min-width: 32px; height: 32px; padding: 0 8px;
  border: 1px solid var(--border); background: var(--surface2);
  color: var(--text2); border-radius: 8px; cursor: pointer;
  font-size: 13px; font-weight: 600; font-family: inherit;
  display: grid; place-items: center; transition: all .15s;
}
.pag-btn:hover:not(:disabled):not(.active) { background: var(--border2); color: var(--text); }
.pag-btn.active { background: var(--green); border-color: var(--green); color: #fff; }
.pag-btn:disabled { opacity: .35; cursor: not-allowed; }
.pag-dots { color: var(--muted); padding: 0 2px; font-size: 13px; }

/* ── Roles / Tags ────────────────────────────────── */
.client-roles { display: flex; gap: 5px; flex-wrap: wrap; margin: 4px 0; }
.role-tag { font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: .4px; }
.role-cli { background: rgba(16,185,129,.15); color: #10b981; }
.role-for { background: rgba(245,158,11,.15); color: #f59e0b; }
.role-rev { background: rgba(139,92,246,.15); color: #8b5cf6; }

/* ── Modal IMEI ──────────────────────────────────── */
.imei-modal-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,.65); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; padding: 24px;
  animation: fadeIn .15s ease;
}
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
.imei-modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px;
  width: 100%; max-width: 720px; max-height: 88vh; overflow-y: auto;
  box-shadow: 0 32px 80px rgba(0,0,0,.6);
  animation: slideUp .18s cubic-bezier(.16,1,.3,1);
}
@keyframes slideUp { from { transform: translateY(20px); opacity:0; } to { transform: translateY(0); opacity:1; } }
.imei-modal-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 22px 24px 20px; border-bottom: 1px solid var(--border); gap: 12px;
}
.imei-modal-title { font-size: 20px; font-weight: 800; color: var(--text); line-height: 1.2; }
.imei-modal-sub   { font-size: 11px; color: var(--muted); margin-top: 4px; letter-spacing: .3px; }
.imei-modal-badge { font-size: 11px; font-weight: 700; padding: 5px 14px; border-radius: 999px; letter-spacing: .5px; white-space: nowrap; }
.imei-modal-close {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--muted); cursor: pointer; font-size: 13px;
  display: grid; place-items: center; transition: all .15s;
}
.imei-modal-close:hover { background: var(--red); color: #fff; border-color: var(--red); }
.imei-modal-body { display: grid; grid-template-columns: 1fr 1fr; gap: 0; padding: 0; }
.ficha-col { padding: 20px 24px 24px; border-right: 1px solid var(--border); }
.ficha-col:last-child { border-right: none; }
.ficha-section { font-size: 10px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; padding: 16px 0 8px; margin-bottom: 2px; border-bottom: 1px solid var(--border); }
.ficha-col .ficha-section:first-child { padding-top: 0; }
.ficha-row { display: flex; justify-content: space-between; align-items: baseline; padding: 7px 0; border-bottom: 1px solid var(--border2); gap: 8px; }
.ficha-row:last-child { border-bottom: none; }
.ficha-label { font-size: 12px; color: var(--muted); flex-shrink: 0; }
.ficha-val   { font-size: 13px; font-weight: 600; color: var(--text); text-align: right; word-break: break-word; }
.ficha-empty { font-size: 13px; color: var(--muted); padding: 16px 0; text-align: center; }
@media(max-width: 600px) {
  .imei-modal-body { grid-template-columns: 1fr; }
  .ficha-col { border-right: none; border-bottom: 1px solid var(--border); }
  .ficha-col:last-child { border-bottom: none; }
}

/* ── Busca IMEI ──────────────────────────────────── */
.imei-search-bar { display: flex; gap: 8px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 10px 14px; box-shadow: var(--shadow); }
.imei-search-wrap { flex: 1; display: flex; align-items: center; gap: 10px; background: var(--surface2); border: 1px solid var(--border); border-radius: 10px; padding: 0 12px; height: 40px; transition: border-color .15s; }
.imei-search-wrap:focus-within { border-color: var(--green); }
.imei-search-icon { width: 16px; height: 16px; color: var(--muted); flex-shrink: 0; }
.imei-search-wrap input { flex: 1; background: none; border: none; outline: none; color: var(--text); font-size: 13px; font-family: inherit; }
.imei-search-wrap input::placeholder { color: var(--muted); }
.imei-search-wrap button { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 14px; padding: 2px 4px; border-radius: 4px; transition: color .15s; }
.imei-search-wrap button:hover { color: var(--red); }
.imei-search-bar > button { height: 40px; padding: 0 20px; border-radius: 10px; background: var(--green); border: none; color: #fff; font-size: 13px; font-weight: 700; cursor: pointer; font-family: inherit; white-space: nowrap; transition: opacity .15s; }
.imei-search-bar > button:hover { opacity: .85; }
.imei-search-bar > button:disabled { opacity: .5; cursor: not-allowed; }

/* ── Auth form ───────────────────────────────────── */
.auth-logo { width: 56px; height: 56px; border-radius: 16px; background: var(--green); color: #fff; display: grid; place-items: center; font-size: 22px; font-weight: 800; margin: 0 auto 18px; }
.auth-form { display: flex; flex-direction: column; gap: 12px; margin: 20px 0 8px; }
.auth-input { height: 46px; padding: 0 16px; border-radius: 11px; background: var(--surface2); border: 1px solid var(--border); color: var(--text); font-size: 14px; font-family: inherit; transition: border-color .15s; }
.auth-input:focus { outline: none; border-color: var(--green); }
.auth-input::placeholder { color: var(--muted); }
.auth-erro { color: var(--red); font-size: 12.5px; min-height: 16px; text-align: left; }
.auth-btn { height: 46px; border-radius: 11px; border: none; background: var(--green); color: #fff; font-size: 14.5px; font-weight: 700; cursor: pointer; font-family: inherit; transition: opacity .15s; }
.auth-btn:hover { opacity: .9; }
.auth-btn:disabled { opacity: .6; cursor: not-allowed; }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 20px 0 14px; color: var(--muted); font-size: 12px; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.auth-btn-secondary { width: 100%; height: 42px; border-radius: 11px; background: var(--surface2); border: 1px solid var(--border); color: var(--text2); font-size: 13.5px; font-weight: 600; cursor: pointer; font-family: inherit; transition: all .15s; }
.auth-btn-secondary:hover { background: var(--border2); color: var(--text); }

/* ── User box ────────────────────────────────────── */
.user-box { display: flex; align-items: center; gap: 10px; background: var(--surface2); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; }
.user-avatar { width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0; background: var(--green); color: #fff; display: grid; place-items: center; font-size: 15px; font-weight: 800; }
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: var(--muted); }
.user-logout { width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0; background: none; border: 1px solid var(--border); color: var(--muted); cursor: pointer; font-size: 15px; display: grid; place-items: center; transition: all .15s; }
.user-logout:hover { background: var(--red); color: #fff; border-color: var(--red); }
body[data-perfil="vendedor"] .sensivel,
body[data-perfil="visualizador"] .sensivel { display: none !important; }
body.menu-mini .user-box { flex-direction: column; gap: 0; padding: 8px; justify-content: center; }
body.menu-mini .user-info { display: none; }
body.menu-mini .user-logout { margin-top: 8px; width: 30px; height: 30px; }
body.menu-mini .user-avatar { margin: 0 auto; width: 30px; height: 30px; font-size: 13px; border-radius: 8px; }

/* ── Config ──────────────────────────────────────── */
.config-tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.config-tab { padding: 10px 18px; background: none; border: none; color: var(--muted); font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit; position: relative; border-bottom: 2px solid transparent; transition: color .15s; }
.config-tab:hover { color: var(--text2); }
.config-tab.active { color: var(--text); border-bottom-color: var(--green); }
.config-pane { display: none; }
.config-pane.active { display: block; }
.perfis-grid { display: grid; grid-template-columns: 300px 1fr; gap: 16px; }
@media(max-width: 720px) { .perfis-grid { grid-template-columns: 1fr; } }
.perfil-item { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-radius: 10px; cursor: pointer; border: 1px solid transparent; transition: all .15s; margin-bottom: 6px; }
.perfil-item:hover { background: var(--surface2); }
.perfil-item.active { background: var(--surface2); border-color: var(--green); }
.perfil-item-nome { font-size: 14px; font-weight: 600; color: var(--text); }
.perfil-item-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }
.perfil-badge-sys { font-size: 9px; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: rgba(139,92,246,.15); color: #8b5cf6; text-transform: uppercase; }
.btn-novo-perfil, .btn-salvar-perm { padding: 7px 14px; border-radius: 9px; border: none; font-size: 12.5px; font-weight: 700; cursor: pointer; font-family: inherit; transition: opacity .15s; }
.btn-novo-perfil { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-novo-perfil:hover { background: var(--border2); }
.btn-salvar-perm { background: var(--green); color: #fff; }
.btn-salvar-perm:hover { opacity: .9; }
.perm-grupo { margin-bottom: 20px; }
.perm-grupo-titulo { font-size: 11px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; padding-bottom: 8px; margin-bottom: 8px; border-bottom: 1px solid var(--border); }
.perm-check { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; cursor: pointer; transition: background .12s; }
.perm-check:hover { background: var(--surface2); }
.perm-check input { width: 16px; height: 16px; cursor: pointer; accent-color: var(--green); }
.perm-check-label { font-size: 13px; color: var(--text); }
.perm-check.disabled { opacity: .5; pointer-events: none; }

/* ── Botão Dar Baixa / Modal Baixa ──────────────── */
.top-btn-primary { background: var(--green); color: #fff; border: none; font-weight: 700; }
.top-btn-primary:hover { opacity: .9; }
.baixa-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 1000; backdrop-filter: blur(2px); }
.baixa-modal { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; width: 460px; max-width: 94vw; max-height: 90vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.4); }
.baixa-modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.baixa-modal-title { font-size: 17px; font-weight: 700; color: var(--text); }
.baixa-modal-close { background: none; border: none; color: var(--muted); font-size: 18px; cursor: pointer; width: 30px; height: 30px; border-radius: 8px; }
.baixa-modal-close:hover { background: var(--surface2); color: var(--text); }
.baixa-modal-body { padding: 20px; }
.baixa-label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .5px; }
.baixa-input { width: 100%; padding: 11px 13px; border-radius: 10px; background: var(--surface2); border: 1px solid var(--border); color: var(--text); font-size: 14px; font-family: inherit; margin-bottom: 14px; }
.baixa-input:focus { outline: none; border-color: var(--green); }
.baixa-valor { font-size: 20px; font-weight: 700; }
.baixa-cliente-lista { max-height: 280px; overflow: auto; }
.baixa-cliente-opt { padding: 11px 13px; border-radius: 10px; cursor: pointer; border: 1px solid transparent; margin-bottom: 4px; }
.baixa-cliente-opt:hover { background: var(--surface2); border-color: var(--border); }
.baixa-cliente-opt-nome { font-size: 14px; font-weight: 600; color: var(--text); }
.baixa-cliente-opt-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.baixa-buscando { padding: 14px; text-align: center; color: var(--muted); font-size: 13px; }
.baixa-cliente-sel { display: flex; justify-content: space-between; align-items: center; background: var(--surface2); border-radius: 12px; padding: 12px 14px; margin-bottom: 16px; }
.baixa-cliente-nome { font-size: 15px; font-weight: 700; color: var(--text); }
.baixa-cliente-total { font-size: 12px; color: var(--muted); margin-top: 2px; }
.baixa-cliente-total strong { color: var(--red); }
.baixa-trocar { background: none; border: 1px solid var(--border); color: var(--muted); padding: 6px 12px; border-radius: 8px; font-size: 12px; cursor: pointer; font-family: inherit; }
.baixa-trocar:hover { background: var(--border2); color: var(--text); }
.baixa-modo { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.baixa-radio { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); cursor: pointer; }
.baixa-radio input { accent-color: var(--green); }
.baixa-preview { background: var(--surface2); border-radius: 12px; padding: 14px; margin-bottom: 16px; border: 1px solid var(--border); max-height: 260px; overflow-y: auto; }
.baixa-prev-titulo { font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 8px; text-transform: uppercase; }
.baixa-prev-linha { display: flex; justify-content: space-between; font-size: 13px; color: var(--text); padding: 6px 0; border-bottom: 1px solid var(--border); }
.baixa-prev-linha:last-child { border-bottom: none; }
.baixa-prev-linha small { color: var(--muted); }
.baixa-prev-linha b.ok { color: var(--green); }
.baixa-prev-linha.excedente { color: #f59e0b; font-weight: 600; }
.baixa-prev-linha.ativa { background: rgba(16,185,129,.08); border-radius: 6px; padding-left: 6px; padding-right: 6px; }
.baixa-prev-abate { color: var(--green); font-weight: 600; font-size: 13px; }
.baixa-prev-abate small { color: var(--muted); font-weight: 400; }
.baixa-prev-pend { color: var(--muted); font-size: 13px; }
.baixa-prev-vazio { padding: 14px; text-align: center; color: var(--muted); font-size: 13px; }
.baixa-confirmar { width: 100%; padding: 13px; border-radius: 10px; border: none; background: var(--green); color: #fff; font-size: 15px; font-weight: 700; cursor: pointer; font-family: inherit; }
.baixa-confirmar:hover { opacity: .9; }
.baixa-confirmar:disabled { opacity: .4; cursor: not-allowed; }
.baixa-ok { width: 56px; height: 56px; border-radius: 50%; background: rgba(16,185,129,.15); color: var(--green); font-size: 28px; display: grid; place-items: center; margin: 8px auto 14px; }
.baixa-result-msg { text-align: center; font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 14px; }
.baixa-result-detalhe { background: var(--surface2); border-radius: 12px; padding: 14px; margin-bottom: 16px; }
.baixa-aviso { margin-top: 10px; padding: 11px 14px; border-radius: 10px; margin-bottom: 12px; background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.35); color: #ef4444; font-size: 13px; font-weight: 600; }
.baixa-data-opcoes { display: flex; gap: 8px; margin-bottom: 10px; }
.baixa-data-btn { flex: 1; padding: 9px 12px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface2); color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit; transition: all .15s; }
.baixa-data-btn:hover { color: var(--text); border-color: var(--border2); }
.baixa-data-btn.active { background: var(--green); color: #fff; border-color: var(--green); }
.baixa-upload-btn { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 14px 16px; border-radius: 11px; border: 1.5px dashed var(--border2); background: var(--surface2); color: var(--text2); font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit; transition: all .15s; margin-bottom: 12px; }
.baixa-upload-btn:hover { border-color: var(--green); color: var(--text); background: var(--surface); }
.baixa-upload-icon { font-size: 18px; }
.baixa-upload-btn.tem-arquivo { border-style: solid; border-color: var(--green); color: var(--green); background: rgba(16,185,129,.08); }

/* ── Clientes ────────────────────────────────────── */
.cliente-busca-wrap { position: relative; margin-bottom: 18px; max-width: 600px; }
.cliente-busca-resultados { position: absolute; top: 100%; left: 0; right: 0; z-index: 50; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; margin-top: 6px; max-height: 360px; overflow-y: auto; box-shadow: 0 12px 40px rgba(0,0,0,.35); display: none; }
.cliente-result-item { padding: 11px 14px; cursor: pointer; border-bottom: 1px solid var(--border); }
.cliente-result-item:last-child { border-bottom: none; }
.cliente-result-item:hover { background: var(--surface2); }
.cliente-result-nome { font-size: 14px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 8px; }
.cliente-result-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.cliente-result-vazio { padding: 14px; text-align: center; color: var(--muted); font-size: 13px; }
.client-detail-full { width: 100%; }
.cliente-baixa-btn { padding: 8px 14px; border-radius: 9px; border: none; cursor: pointer; font-size: 13px; font-weight: 700; font-family: inherit; white-space: nowrap; }
.imei-cell { font-family: 'SF Mono', 'Consolas', monospace; font-size: 12px; color: var(--muted); }
.cliente-filtros { display: flex; gap: 8px; padding: 14px 18px 0; flex-wrap: wrap; }
.cliente-filtro-btn { padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface2); color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit; transition: all .15s; display: inline-flex; align-items: center; gap: 6px; }
.cliente-filtro-btn:hover { color: var(--text); border-color: var(--border2); }
.cliente-filtro-btn.active { background: var(--green); color: #fff; border-color: var(--green); }
.cliente-filtro-btn span { font-size: 11px; font-weight: 700; opacity: .8; background: rgba(0,0,0,.15); padding: 1px 7px; border-radius: 999px; }
.cliente-tabela-scroll { max-height: 540px; overflow-y: auto; padding: 0 18px; margin-top: 12px; }
.cliente-tabela-scroll table { width: 100%; border-collapse: collapse; }
.cliente-tabela-scroll thead th { position: sticky; top: 0; z-index: 2; background: var(--surface); backdrop-filter: blur(4px); }
.cliente-pag { padding: 14px 18px; border-top: 1px solid var(--border); display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; }
.cliente-busca-row { display: flex; gap: 10px; padding: 12px 18px 0; align-items: stretch; }
.cliente-busca-input { flex: 1 1 auto; padding: 10px 14px; border-radius: 9px; height: 42px; background: var(--surface2); border: 1px solid var(--border); color: var(--text); font-size: 13px; font-family: inherit; }
.cliente-busca-input:focus { outline: none; border-color: var(--green); }
.cliente-data-input { flex: 0 0 180px; padding: 10px 14px; border-radius: 9px; height: 42px; background: var(--surface2); border: 1px solid var(--border); color: var(--text); font-size: 13px; font-family: inherit; }
.cliente-data-input:focus { outline: none; border-color: var(--green); }
.cliente-limpar-btn { flex: 0 0 auto; padding: 0 18px; border-radius: 9px; height: 42px; border: 1px solid var(--border); background: none; color: var(--muted); font-size: 13px; cursor: pointer; font-family: inherit; }
.cliente-limpar-btn:hover { background: var(--surface2); color: var(--text); }
.venda-row { cursor: pointer; transition: background .12s; }
.venda-row:hover { background: var(--surface2); }

/* ── Modais de venda / comprovante ──────────────── */
.venda-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 1100; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(2px); }
.venda-modal { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; width: 520px; max-width: 94vw; max-height: 88vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.4); }
.venda-modal-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.venda-modal-title { font-size: 16px; font-weight: 700; color: var(--text); }
.venda-modal-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.venda-modal-close { background: none; border: none; color: var(--muted); font-size: 18px; cursor: pointer; width: 30px; height: 30px; border-radius: 8px; }
.venda-modal-close:hover { background: var(--surface2); color: var(--text); }
.venda-modal-body { padding: 16px 20px 20px; }
.venda-det-grupo { margin-bottom: 18px; }
.venda-det-titulo { font-size: 11px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; margin-bottom: 10px; }
.venda-det-row { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; color: var(--text); }
.venda-det-row:last-child { border-bottom: none; }
.venda-hist-item { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; color: var(--text); }
.venda-hist-item small { color: var(--muted); margin-left: 6px; }
.venda-hist-vazio, .venda-hist-loading { font-size: 13px; color: var(--muted); padding: 6px 0; }
.venda-ver-comprovante { margin-left: 8px; padding: 2px 10px; border-radius: 7px; border: 1px solid var(--border); background: var(--surface2); color: var(--green); font-size: 11px; font-weight: 700; cursor: pointer; font-family: inherit; }
.venda-ver-comprovante:hover { background: var(--green); color: #fff; }
.compr-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.75); z-index: 1200; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(3px); }
.compr-modal { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; width: 720px; max-width: 94vw; max-height: 92vh; display: flex; flex-direction: column; box-shadow: 0 24px 70px rgba(0,0,0,.5); overflow: hidden; }
.compr-modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--border); font-weight: 700; color: var(--text); }
.compr-modal-actions { display: flex; gap: 8px; align-items: center; }
.compr-btn { padding: 6px 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface2); color: var(--text); font-size: 13px; cursor: pointer; font-family: inherit; text-decoration: none; display: inline-flex; align-items: center; }
.compr-btn:hover { background: var(--border); }
.compr-modal-body { padding: 16px; overflow: auto; display: flex; align-items: center; justify-content: center; background: var(--bg); min-height: 300px; }
.compr-img { max-width: 100%; max-height: 78vh; border-radius: 8px; }
.compr-pdf { width: 100%; height: 78vh; border: none; border-radius: 8px; background: #fff; }

/* ── Histórico de pagamentos ─────────────────────── */
.venda-hist-rico { flex-direction: column; align-items: stretch; gap: 6px; padding: 12px 0; }
.venda-hist-linha1 { display: flex; justify-content: space-between; align-items: center; }
.venda-hist-valor { font-size: 15px; font-weight: 700; color: var(--green); }
.venda-hist-linha2 { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.venda-hist-tag { font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: var(--surface2); color: var(--text2); border: 1px solid var(--border); }
.venda-hist-meta { font-size: 12px; color: var(--muted); }
.venda-hist-valortag { display: flex; align-items: center; gap: 10px; }
.venda-estornar-btn { padding: 5px 12px; border-radius: 7px; cursor: pointer; font-family: inherit; font-size: 12px; font-weight: 600; margin-left: 8px; background: rgba(239,68,68,.12); color: #ef4444; border: 1px solid rgba(239,68,68,.3); }
.venda-estornar-btn:hover { background: rgba(239,68,68,.2); border-color: #ef4444; }
.venda-hist-estornada { display: inline-block; margin-left: 10px; font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: rgba(239,68,68,.15); color: #ef4444; letter-spacing: 0.5px; }

/* ── Modal cancelar baixa ────────────────────────── */
.cb-modal-overlay { display: none; position: fixed; inset: 0; z-index: 1150; background: rgba(0,0,0,.5); align-items: center; justify-content: center; }
.cb-modal { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; width: 420px; max-width: 92vw; box-shadow: 0 20px 60px rgba(0,0,0,.4); overflow: hidden; }
.cb-modal-head { padding: 16px 20px; font-size: 16px; font-weight: 700; color: var(--text); border-bottom: 1px solid var(--border); }
.cb-modal-body { padding: 18px 20px; }
.cb-modal-texto { font-size: 13px; color: var(--text2); margin: 0 0 14px; line-height: 1.5; }
.cb-modal-label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.cb-modal-input { width: 100%; box-sizing: border-box; padding: 9px 11px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface2); color: var(--text); font-family: inherit; font-size: 13px; resize: vertical; }
.cb-modal-input:focus { outline: none; border-color: var(--blue); }
.cb-modal-acoes { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px 18px; border-top: 1px solid var(--border); }
.cb-btn-voltar { padding: 9px 16px; border-radius: 8px; cursor: pointer; font-family: inherit; font-size: 13px; font-weight: 600; background: var(--surface2); color: var(--text2); border: 1px solid var(--border); }
.cb-btn-voltar:hover { background: var(--surface); color: var(--text); }
.cb-btn-confirmar { padding: 9px 16px; border-radius: 8px; cursor: pointer; font-family: inherit; font-size: 13px; font-weight: 600; background: #ef4444; color: #fff; border: none; }
.cb-btn-confirmar:hover { background: #dc2626; }
.cb-btn-confirmar:disabled { opacity: .6; cursor: default; }
.cb-toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); padding: 12px 20px; border-radius: 10px; font-size: 13px; font-weight: 600; color: #fff; z-index: 1100; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; box-shadow: 0 10px 30px rgba(0,0,0,.3); }
.cb-toast-show { opacity: 1; transform: translateX(-50%) translateY(0); }
.cb-toast-ok { background: #16a34a; }
.cb-toast-erro { background: #ef4444; }
.cb-afetadas { margin: 0 0 14px; padding: 12px; border-radius: 8px; background: var(--surface2); border: 1px solid var(--border); font-size: 13px; }
.cb-afetadas-titulo { color: var(--text); font-weight: 600; margin-bottom: 8px; line-height: 1.4; }
.cb-afetadas-lista { margin: 0 0 10px; padding: 0; list-style: none; color: var(--text2); }
.cb-afetada-item { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 5px 0; border-bottom: 1px solid var(--border); }
.cb-afetada-item:last-child { border-bottom: none; }
.cb-afetada-nome { color: var(--text2); font-size: 12px; line-height: 1.3; }
.cb-afetada-val { color: var(--text); font-weight: 700; white-space: nowrap; }
.cb-afetadas-total { display: flex; justify-content: space-between; align-items: center; margin: 8px 0 0; padding-top: 10px; border-top: 1px solid var(--border); font-size: 13px; }
.cb-afetadas-total span { color: var(--muted); }
.cb-afetadas-total strong { color: var(--text); font-size: 15px; }
.cb-afetadas-erro { color: #f59e0b; font-size: 12px; }
.cb-check { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; font-size: 13px; color: var(--text); margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.cb-check input { margin-top: 2px; cursor: pointer; flex-shrink: 0; }

/* ── Formas de pagamento ─────────────────────────── */
.formas-tabela { display: flex; flex-direction: column; gap: 5px; max-width: 560px; }
.forma-row { display: flex; align-items: center; gap: 10px; padding: 7px 12px; border-radius: 9px; background: var(--surface2); border: 1px solid var(--border); }
.forma-row.inativa { opacity: 0.55; }
.forma-ordem { display: flex; flex-direction: column; gap: 2px; }
.forma-mov { width: 24px; height: 20px; border-radius: 5px; cursor: pointer; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: 9px; line-height: 1; padding: 0; }
.forma-mov:hover:not(:disabled) { color: var(--text); border-color: var(--green); }
.forma-mov:disabled { opacity: 0.3; cursor: default; }
.forma-nome { flex: 1; font-size: 13px; font-weight: 600; color: var(--text); }
.forma-tag-inativa { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: rgba(239,68,68,.15); color: #ef4444; margin-left: 8px; }
.forma-acoes { display: flex; align-items: center; gap: 8px; }
.forma-btn-edit { width: 26px; height: 26px; border-radius: 6px; cursor: pointer; border: 1px solid var(--border); background: var(--surface); font-size: 12px; }
.forma-btn-edit:hover { border-color: var(--green); }
.forma-btn-toggle { padding: 5px 11px; border-radius: 6px; cursor: pointer; font-family: inherit; border: 1px solid var(--border); background: var(--surface); color: var(--text2); font-size: 11px; font-weight: 600; }
.forma-btn-toggle:hover { border-color: var(--green); color: var(--text); }

/* ── Usuários ────────────────────────────────────── */
.usuarios-tabela { display: flex; flex-direction: column; gap: 6px; }
.usuario-row { display: flex; align-items: center; gap: 14px; padding: 10px 14px; border-radius: 10px; background: var(--surface2); border: 1px solid var(--border); }
.usuario-row.inativo { opacity: 0.5; }
.usuario-info { flex: 1; min-width: 0; }
.usuario-nome { font-size: 14px; font-weight: 600; color: var(--text); }
.usuario-email { font-size: 12px; color: var(--muted); }
.usuario-tag-inativo { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: rgba(239,68,68,.15); color: #ef4444; margin-left: 6px; }
.usuario-perfil { font-size: 12px; font-weight: 600; color: var(--text2); padding: 4px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); white-space: nowrap; }
.usuario-acoes { display: flex; align-items: center; gap: 6px; }
.usuario-btn { height: 30px; padding: 0 10px; border-radius: 7px; cursor: pointer; font-family: inherit; border: 1px solid var(--border); background: var(--surface); color: var(--text2); font-size: 12px; font-weight: 600; }
.usuario-btn:hover { border-color: var(--green); color: var(--text); }
.usuario-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 1100; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(2px); }
.usuario-modal { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; width: 400px; max-width: 94vw; box-shadow: 0 20px 60px rgba(0,0,0,.4); }
.usuario-modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); font-weight: 700; color: var(--text); }
.usuario-modal-close { background: none; border: none; color: var(--muted); font-size: 18px; cursor: pointer; }
.usuario-modal-body { padding: 18px 20px; }
.usuario-aviso-senha { font-size: 12px; color: var(--muted); margin: 10px 0; padding: 10px; border-radius: 8px; background: var(--surface2); }

/* ── Auditoria ───────────────────────────────────── */
.auditoria-filtros { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 14px 0; margin-bottom: 8px; }
.aud-filtro { height: 36px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface2); color: var(--text); font-family: inherit; font-size: 13px; }
.aud-filtro.aud-valor { width: 100px; }
.aud-btn-filtrar, .aud-btn-limpar { height: 36px; padding: 0 16px; border-radius: 8px; cursor: pointer; font-family: inherit; font-size: 13px; font-weight: 600; }
.aud-btn-filtrar { background: var(--green); color: #04130c; border: none; }
.aud-btn-filtrar:hover { filter: brightness(1.08); }
.aud-btn-limpar { background: var(--surface); color: var(--text2); border: 1px solid var(--border); }
.aud-btn-limpar:hover { border-color: var(--green); color: var(--text); }
.aud-tabela { display: flex; flex-direction: column; }
.aud-head, .aud-row { display: grid; grid-template-columns: 150px 180px 160px 1fr; gap: 12px; padding: 10px 12px; align-items: center; }
.aud-head { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--border); }
.aud-row { border-bottom: 1px solid var(--border); font-size: 13px; color: var(--text); }
.aud-row:hover { background: var(--surface2); }
.aud-col-data { color: var(--text2); font-variant-numeric: tabular-nums; }
.aud-col-det { color: var(--text2); font-size: 12px; word-break: break-word; }
.aud-muted { color: var(--muted); }
.aud-tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--surface2); color: var(--text2); border: 1px solid var(--border); }
.aud-tag-dar_baixa { background: rgba(34,197,94,.15); color: #22c55e; border-color: transparent; }
.aud-tag-login { background: rgba(99,102,241,.15); color: #818cf8; border-color: transparent; }
.aud-tag-trocar_senha { background: rgba(234,179,8,.15); color: #eab308; border-color: transparent; }
.auditoria-paginacao { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 16px 0; }
.aud-pg-btn { height: 34px; padding: 0 14px; border-radius: 8px; cursor: pointer; border: 1px solid var(--border); background: var(--surface); color: var(--text2); font-family: inherit; font-size: 13px; font-weight: 600; }
.aud-pg-btn:hover:not(:disabled) { border-color: var(--green); color: var(--text); }
.aud-pg-btn:disabled { opacity: 0.4; cursor: default; }
.aud-pg-info { font-size: 12px; color: var(--muted); }
.aud-tag-click { cursor: pointer; transition: filter .15s; }
.aud-tag-click:hover { filter: brightness(1.2); text-decoration: underline; }
.aud-det-modal { width: 480px; max-width: 94vw; }
.aud-det-linha { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.aud-det-linha span { color: var(--muted); }
.aud-det-linha strong { color: var(--text); text-align: right; }
.aud-det-sub { margin: 16px 0 8px; font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--muted); }
.aud-det-vendas { display: flex; flex-direction: column; gap: 8px; }
.aud-det-venda { padding: 10px 12px; border-radius: 9px; background: var(--surface2); border: 1px solid var(--border); }
.aud-det-venda-prod { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.aud-det-venda-vals { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--text2); }
.aud-det-venda-vals strong { color: var(--green); }
.aud-det-status { font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--surface); color: var(--text2); }

/* ══════════════════════════════════════════════════════════════
   MÓDULO DE VENDAS — Accordion sidebar + 5 telas
══════════════════════════════════════════════════════════════ */

/* ── Accordion na sidebar ─────────────────────────────────── */
.nav-item-accordion { position: relative; }
.nav-accordion-arrow { margin-left: auto; font-size: 14px; color: var(--sidebar-text); transition: transform .2s ease; flex-shrink: 0; line-height: 1; }
.nav-item-accordion.aberto .nav-accordion-arrow { transform: rotate(90deg); }
.nav-sub { overflow: hidden; max-height: 0; transition: max-height .25s ease; }
.nav-sub.aberto { max-height: 300px; }
.nav-sub-item { min-height: 36px; display: flex; align-items: center; gap: 10px; padding: 7px 12px 7px 26px; color: var(--sidebar-text); border-radius: 9px; margin-bottom: 1px; cursor: pointer; transition: all .15s; }
.nav-sub-item:hover { color: rgba(255,255,255,.85); background: rgba(255,255,255,.05); }
.nav-sub-item.active { color: #fff; background: rgba(255,255,255,.08); border-left: 2px solid var(--green); padding-left: 24px; }
.nav-sub-icon {
  width: 16px; height: 16px;
  display: grid; place-items: center; flex-shrink: 0; opacity: .7;
  color: inherit;
}
.nav-sub-icon svg { width: 16px; height: 16px; }
.nav-sub-item.active .nav-sub-icon { opacity: 1; }
body.menu-mini .nav-sub { display: none; }
body.menu-mini .nav-accordion-arrow { display: none; }

/* ── Telas internas ───────────────────────────────────────── */
.nv-tela { display: none; flex-direction: column; gap: 20px; min-width: 0; max-width: 100%; }
/* Nova venda: coluna centralizada, teto de largura só nesta sub-tela.
   1100px foi escolhido pra caber a trilha (40px) + gap (18px) + coluna
   dos painéis com folga confortável, sem espremer o formulário. Outras
   sub-telas (dashboard, estoque, histórico) continuam ponta a ponta —
   você aceitou essa inconsistência antes de eu aplicar. */
#nvtela-nova-venda { max-width: 1100px; width: 100%; margin-left: auto; margin-right: auto; }
.nv-tela.active { display: flex; }

/* ── Formulário Nova Venda ────────────────────────────────── */
.nv-body {
  padding: 15px 18px 18px !important;
  display: flex; flex-direction: column; gap: 14px;
  min-width: 0; width: 100%; box-sizing: border-box; overflow-x: hidden;
}
.nv-field-row {
  display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end;
  width: 100%; box-sizing: border-box;
}
.nv-field       { display: flex; flex-direction: column; min-width: 0; }
.nv-field-grow  { flex: 1 1 200px; min-width: 0; }
.nv-field-md    { flex: 0 0 180px; width: 180px; max-width: 100%; }
.nv-field-sm    { flex: 0 0 130px; width: 130px; max-width: 100%; }
.panel-head > .nv-field { flex: 0 0 auto; min-width: 160px; max-width: 200px; }

/* Nova Venda: campos "grow" e o campo de IMEI esticam até preencher toda
   a linha por padrão (flex:1 ou div de bloco sem largura definida), o que
   fica desproporcional pra dados curtos (nome, IMEI, valor). Limitando só
   nos 3 painéis de passo (Cliente/Produto/Valores) — NÃO na classe
   genérica, que também é usada em Histórico e Lucro & Metas.
   Só acima de 760px: no mobile já existe regra própria forçando 100%. */
@media (min-width: 761px) {
  #nvCardCliente .nv-field-grow,
  #nvCardProduto .nv-field-grow,
  #nvCardValores .nv-field-grow,
  #nvBoxAparelho .nv-field {
    max-width: 440px;
  }
  /* Valor da venda é a exceção: mesma classe .nv-field-grow das buscas,
     mas é um dado curto (moeda), não um nome/modelo — não precisa dos
     mesmos 440px. Sobrescreve só este campo via id do wrapper (maior
     precedência que a classe acima, sem !important, sem duplicar regra). */
  #nvCampoValorVenda {
    max-width: 300px;
  }
}

/* ── Colapso: "Itens da venda" e "Preview WhatsApp" ──────────────
   São painéis de RESULTADO (consequência do que foi preenchido nos
   3 passos), não de entrada — por isso ficam recolhidos até terem
   conteúdo, e tratados como peso visual secundário.
   Escopado só a #nvCardItens e #nvCardWhats — NÃO mexe em .panel-body
   genérico (usado em outros ~39 painéis do sistema fora desta tela). */
#nvCardItens .panel-body,
#nvCardWhats .panel-body {
  max-height: 800px;
  overflow: hidden;
  transition: max-height .22s ease, padding-top .22s ease, padding-bottom .22s ease;
}
#nvCardItens.nv-recolhido .panel-body,
#nvCardWhats.nv-recolhido .panel-body {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
}

.nv-collapse-toggle {
  background: transparent; border: none; cursor: pointer; color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0;
  transition: background .15s, color .15s;
  visibility: hidden; /* só aparece quando o painel tem conteúdo — ver .nv-tem-conteudo */
}
.nv-collapse-toggle:hover { background: var(--surface2); color: var(--text); }
.nv-collapse-toggle svg { transition: transform .2s; }
#nvCardItens.nv-tem-conteudo .nv-collapse-toggle,
#nvCardWhats.nv-tem-conteudo .nv-collapse-toggle {
  visibility: visible;
}
#nvCardItens.nv-recolhido .nv-collapse-toggle svg,
#nvCardWhats.nv-recolhido .nv-collapse-toggle svg {
  transform: rotate(-90deg);
}

.nv-label { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin-bottom: 6px; }

/* ── Acabamento visual (aproximação do mockup aprovado) ───────── */

/* Eyebrow "Passo N" acima do título de cada painel de passo */
.nv-step-eyebrow {
  font-size: 10px; font-weight: 700; letter-spacing: .8px;
  text-transform: uppercase; color: var(--muted); margin-bottom: 2px;
}

/* Títulos dos 3 painéis de passo com mais presença (17px, como o mockup).
   Escopado por id — o .panel-title genérico dos outros ~39 painéis do
   sistema continua em 14px. */
#nvCardCliente .panel-title,
#nvCardProduto .panel-title,
#nvCardValores .panel-title {
  font-size: 17px; font-weight: 800; letter-spacing: -.3px;
}

/* Pílula segmentada Aparelho/Caneta. O <select> original continua no DOM
   (escondido) como fonte da verdade — 8 pontos do JS leem o .value dele.
   Os botões apenas setam o select e disparam o evento change. */
.nv-select-oculto { display: none; }
.nv-tipo-pilula {
  display: inline-flex; gap: 4px; background: var(--surface2);
  border-radius: 10px; padding: 4px;
}
.nv-tipo-btn {
  border: none; background: transparent; color: var(--muted);
  font-family: inherit; font-size: 12.5px; font-weight: 700;
  padding: 7px 14px; border-radius: 8px; cursor: pointer;
  transition: background .15s, color .15s;
}
.nv-tipo-btn.ativo { background: var(--green); color: #fff; }

/* Contador de itens como badge pílula (era texto solto no subtítulo) */
#nvContadorItens {
  display: inline-block; font-size: 11px; font-weight: 700;
  color: var(--muted); background: var(--surface2);
  padding: 2px 10px; border-radius: 999px; margin-top: 2px;
}
#nvCardItens.nv-tem-conteudo #nvContadorItens {
  color: var(--green); background: var(--greenT);
}

/* Zona de resultado vazia: borda tracejada (sinaliza "ainda sem conteúdo",
   peso visual menor que os painéis de entrada) */
#nvCardItens:not(.nv-tem-conteudo),
#nvCardWhats:not(.nv-tem-conteudo) {
  border-style: dashed;
}

/* ── Trilha dos 3 passos (Nova Venda) ──────────────────────────
   Substitui o número inline no título de cada painel (removido do
   HTML). Nesta etapa (3a) o visual é só estrutural — as 3 bolinhas
   ficam com a mesma cor. A diferenciação por estado (concluído /
   ativo / pendente) é a próxima etapa (3b), que precisa saber se
   cada passo tem dado preenchido — isso não dá pra fazer só com
   CSS (campo 2 mistura <select> com <input>, confirmado antes). */
.nv-wizard-layout {
  display: grid; grid-template-columns: 1fr 40px; gap: 18px; align-items: start;
}
/* Trilha vem antes dos painéis no HTML (leitura por leitores de tela
   segue a sequência lógica: passo 1, 2, 3, depois o conteúdo). Aqui
   só reordeno visualmente: painéis ocupam a coluna 1 (esquerda larga),
   trilha ocupa a coluna 2 (direita estreita). */
.nv-wizard-layout > .nv-rail { grid-column: 2; grid-row: 1; }
.nv-wizard-layout > .nv-wizard-steps { grid-column: 1; grid-row: 1; }

/* Ações, Itens da venda, WhatsApp ficam fora da grid da trilha, mas
   precisam terminar na mesma linha vertical que os painéis de passo.
   58px = largura da trilha (40px) + gap (18px). Se algum dia esses
   valores mudarem no .nv-wizard-layout acima, este também precisa
   ser ajustado — ou virarem uma CSS variable. */
.nv-wizard-footer { margin-right: 58px; display: flex; flex-direction: column; gap: 20px; }
@media(max-width:760px) {
  .nv-wizard-footer { margin-right: 0; }
}
.nv-wizard-steps { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.nv-rail {
  position: sticky; top: 20px; display: flex; flex-direction: column; align-items: center;
  height: 100%; padding: 22px 0;
}
.nv-rail-dot {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; color: var(--muted); background: var(--surface2);
  border: 1px solid var(--border2);
  transition: background .18s, color .18s, border-color .18s;
}
.nv-rail-dot.nv-rail-dot-done {
  background: var(--green); color: #fff; border-color: var(--green);
}
.nv-rail-line { width: 2px; flex: 1; min-height: 32px; background: var(--border2); margin: 3px 0; }

/* Mobile: trilha vira horizontal, acima dos painéis */
@media(max-width:760px) {
  .nv-wizard-layout { grid-template-columns: 1fr; }
  /* Reseta as forças de coluna do desktop — no mobile a grid tem uma
     coluna só, e trilha + painéis empilham na ordem natural do HTML. */
  .nv-wizard-layout > .nv-rail,
  .nv-wizard-layout > .nv-wizard-steps { grid-column: auto; grid-row: auto; }
  .nv-rail {
    position: sticky; top: 0; z-index: 25;
    flex-direction: row; height: auto; width: 100%;
    padding: 12px 4px;
    background: var(--topbar-bg);
    backdrop-filter: blur(16px);
    box-sizing: border-box;
    margin-bottom: 4px;
  }
  .nv-rail-line { width: auto; flex: 1; height: 2px; min-height: 0; margin: 0 4px; }
}
.nv-input { width: 100%; max-width: 100%; min-height: 38px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border2); background: var(--surface2); color: var(--text); font-family: inherit; font-size: 13px; font-weight: 500; outline: none; transition: border .15s, box-shadow .15s; box-sizing: border-box; }
.nv-input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blueT); }
.nv-input::placeholder { color: var(--hint); }
.nv-input-valor { font-size: 15px; font-weight: 700; }
.nv-select { cursor: pointer; }
.nv-select option { background: var(--bg1); }

/* ── Autocomplete ─────────────────────────────────────────── */
.nv-autocomplete-wrap { position: relative; }
.nv-suggestions { display: none; position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--border2); border-radius: 12px; box-shadow: var(--shadow2); z-index: 60; max-height: 320px; overflow-y: auto; overscroll-behavior: contain; }
.nv-suggestions::-webkit-scrollbar { width: 8px; }
.nv-suggestions::-webkit-scrollbar-track { background: transparent; }
.nv-suggestions::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 8px; border: 2px solid var(--surface); }
.nv-suggestions::-webkit-scrollbar-thumb:hover { background: var(--muted); }
.nv-suggestions { scrollbar-width: thin; scrollbar-color: var(--border2) transparent; }
.nv-suggestions.show { display: block; }
.nv-suggestion-item { display: flex; flex-direction: column; gap: 2px; padding: 11px 14px; cursor: pointer; border-bottom: 1px solid var(--border); transition: background .1s; }
.nv-suggestion-item:last-child { border-bottom: none; }
.nv-suggestion-item:hover, .nv-suggestion-item.active { background: var(--blueT); }
.nv-suggestion-item strong { font-size: 13px; color: var(--text); font-weight: 600; }
.nv-suggestion-item small { font-size: 11px; color: var(--muted); }
.nv-sug-linha { display: flex; align-items: center; gap: 6px; }
.nv-sug-codigo { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; color: var(--text); }
.nv-sug-seta { color: var(--muted); flex-shrink: 0; }

/* ── Toggle Dropshipp ─────────────────────────────────────── */
.nv-toggle-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border-radius: 10px; background: var(--surface2); border: 1px solid var(--border); cursor: pointer; }
.nv-toggle-row input[type=checkbox] { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; cursor: pointer; accent-color: var(--green); }
.nv-toggle-row strong { font-size: 13px; color: var(--text); display: block; }
.nv-toggle-row small { font-size: 11px; color: var(--muted); }
.nv-dropshipp-box { padding: 14px; border-radius: 10px; background: var(--surface2); border: 1px solid var(--border); }

/* ── Resumo produto ───────────────────────────────────────── */
.nv-produto-resumo { background: var(--surface2); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; min-width: 0; overflow: hidden; }
.nv-resumo-topo { display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.nv-resumo-produto { font-size: 16px; font-weight: 600; color: var(--text); line-height: 1.25; min-width: 0; word-break: break-word; overflow-wrap: break-word; }
.nv-resumo-custo { flex-shrink: 0; background: rgba(59,130,246,.15); color: #3b82f6; font-size: 14px; font-weight: 700; padding: 6px 12px; border-radius: 8px; white-space: nowrap; }
.nv-resumo-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 12px; font-size: 12px; color: var(--muted); }
.nv-resumo-meta-item { display: inline-flex; align-items: center; gap: 5px; min-width: 0; }
.nv-resumo-meta-item svg { color: var(--muted); flex-shrink: 0; }
.nv-resumo-meta-item span { word-break: break-word; overflow-wrap: break-word; }
.nv-resumo-meta-sep { color: var(--border); }
.nv-resumo-detalhes { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.nv-resumo-detalhes small { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.nv-resumo-detalhes span { font-size: 13px; color: var(--text); word-break: break-word; overflow-wrap: break-word; }
.nv-aviso-custo { margin-top: 10px; padding: 9px 12px; border-radius: 9px; background: var(--amberT); border: 1px solid rgba(245,158,11,.25); font-size: 12px; color: var(--amber); font-weight: 600; }

/* ── Badge lucro ──────────────────────────────────────────── */
.nv-lucro-badge { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; padding: 8px 14px; border-radius: 10px; background: var(--surface2); border: 1px solid var(--border); }
.nv-lucro-badge small { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.nv-lucro-badge strong { font-size: 18px; font-weight: 700; color: var(--text); letter-spacing: -.4px; font-variant-numeric: tabular-nums; }
.nv-lucro-badge strong.positivo { color: var(--green); }
.nv-lucro-badge strong.negativo { color: var(--red); }
.nv-lucro-detalhe { font-size: 12px; color: var(--muted); margin: 0; }

/* ── Ações + Carrinho ─────────────────────────────────────── */
.nv-acoes-bar { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.nv-item-venda { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; border-radius: 11px; background: var(--surface2); border: 1px solid var(--border); margin-bottom: 8px; }
.nv-item-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.nv-item-top strong { font-size: 13px; font-weight: 700; color: var(--text); }
.nv-item-remove { padding: 4px 10px; border-radius: 7px; background: var(--redT); color: var(--red); border: 1px solid rgba(239,68,68,.2); font-size: 11px; font-weight: 700; cursor: pointer; flex-shrink: 0; transition: background .15s; }
.nv-item-remove:hover { background: var(--redL); }
.nv-item-meta { display: flex; flex-wrap: wrap; gap: 8px; }
.nv-item-meta span { font-size: 11px; color: var(--muted); padding: 3px 8px; border-radius: 6px; background: var(--surface); border: 1px solid var(--border); }
.nv-item-meta .nv-lucro-chip { color: var(--green); background: var(--greenT); border-color: rgba(16,185,129,.2); font-weight: 700; }
.nv-item-meta .nv-flag-chip { color: var(--amber); background: var(--amberT); border-color: rgba(245,158,11,.2); }

/* ── Tag cliente ──────────────────────────────────────────── */
.nv-cliente-tag { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 9px; background: var(--greenT); border: 1px solid rgba(16,185,129,.25); font-size: 12px; font-weight: 700; color: var(--green); }

/* ── WhatsApp textarea ────────────────────────────────────── */
.nv-whats-textarea { width: 100%; box-sizing: border-box; min-height: 180px; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border2); background: var(--surface2); color: var(--text); font-family: inherit; font-size: 12px; line-height: 1.6; resize: vertical; outline: none; }
.nv-whats-textarea:focus { border-color: var(--blue); }
.nv-whats-textarea::placeholder { color: var(--hint); }

/* ── Estoque ──────────────────────────────────────────────── */
.nv-stock-item { padding: 14px 16px; border-radius: 11px; background: var(--surface2); border: 1px solid var(--border); margin-bottom: 8px; display: flex; flex-direction: column; gap: 8px; }
.nv-stock-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.nv-stock-top strong { font-size: 13px; font-weight: 700; color: var(--text); }
.nv-stock-status { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--greenT); color: var(--green); border: 1px solid rgba(16,185,129,.2); }
.nv-stock-status.reservado { background: var(--amberT); color: var(--amber); border-color: rgba(245,158,11,.2); }
.nv-stock-meta { display: flex; flex-wrap: wrap; gap: 8px; }
.nv-stock-meta span { font-size: 11px; color: var(--muted); padding: 3px 8px; border-radius: 6px; background: var(--surface); border: 1px solid var(--border); }
.nv-btn-vender { align-self: flex-start; padding: 6px 14px; border-radius: 8px; background: var(--blue); color: #fff; border: none; font-size: 12px; font-weight: 700; cursor: pointer; transition: opacity .15s; }
.nv-btn-vender:hover { opacity: .85; }

/* ── Histórico ────────────────────────────────────────────── */
.nv-hist-item { padding: 14px 16px; border-radius: 11px; background: var(--surface2); border: 1px solid var(--border); margin-bottom: 8px; display: flex; flex-direction: column; gap: 8px; }
.nv-hist-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.nv-hist-top strong { font-size: 13px; font-weight: 700; color: var(--text); }
.nv-hist-data { font-size: 11px; color: var(--muted); }
.nv-hist-meta { display: flex; flex-wrap: wrap; gap: 8px; }
.nv-hist-meta span { font-size: 11px; color: var(--muted); padding: 3px 8px; border-radius: 6px; background: var(--surface); border: 1px solid var(--border); }
.nv-hist-meta .nv-hist-lucro { color: var(--green); background: var(--greenT); border-color: rgba(16,185,129,.2); font-weight:700; }
.nv-hist-meta .nv-hist-imei { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; color: var(--text2); }

/* ── Dashboard vendas — filtro ────────────────────────────── */

/* ── Hero card do dashboard vendas ───────────────────────── */
.nv-hero-card { flex-shrink: 0; }
.nv-hero-card .panel-body { padding: 20px 24px !important; }
.nv-hero-card .panel-body > div:first-child { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }

/* ── Barras horizontais ───────────────────────────────────── */
.nv-bar-chart { display: flex; flex-direction: column; gap: 10px; }
.nv-bar-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.nv-bar-label { width: 130px; flex-shrink: 0; font-size: 12px; color: var(--text2); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nv-bar-track { flex: 1; height: 8px; border-radius: 999px; background: var(--border2); overflow: hidden; }
.nv-bar-fill { height: 100%; border-radius: 999px; width: 0; background: linear-gradient(90deg, var(--blue), #60a5fa); transition: width .5s ease; }
.nv-bar-value { width: 80px; flex-shrink: 0; text-align: right; font-size: 12px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }

/* ── Tooltip das barras horizontais ─── */
.nv-bar-tip { position: relative; cursor: pointer; border-radius: 8px; transition: background .12s; }
.nv-bar-tip:hover { background: var(--surface2); }
.nv-bar-tip:hover .nv-bar-fill { filter: brightness(1.22); }
.nv-bar-tooltip {
  display: none; position: absolute; right: 0; top: 50%;
  transform: translateY(-50%);
  background: var(--surface); border: 1px solid var(--border2);
  border-radius: 9px; padding: 6px 12px;
  font-size: 12px; font-weight: 700; color: var(--text);
  white-space: nowrap; box-shadow: var(--shadow2);
  z-index: 40; pointer-events: none; font-variant-numeric: tabular-nums;
  animation: nvTipIn .1s ease;
}
@keyframes nvTipIn { from { opacity:0; transform:translateY(-50%) translateX(4px); } to { opacity:1; transform:translateY(-50%) translateX(0); } }
.nv-bar-tip:hover .nv-bar-tooltip { display: block; }

/* Tooltip flutuante para gráficos de linha (segue o cursor) */
.chart-tooltip {
  position: fixed; z-index: 9999; pointer-events: none;
  display: none; background: var(--surface);
  border: 1px solid var(--border2); border-radius: 9px;
  padding: 8px 12px; font-size: 12px; color: var(--text);
  white-space: nowrap; box-shadow: var(--shadow2);
  font-variant-numeric: tabular-nums; line-height: 1.5;
}
.chart-tooltip .ct-titulo { font-weight: 700; margin-bottom: 3px; }
.chart-tooltip .ct-linha { display: flex; align-items: center; gap: 6px; }
.chart-tooltip .ct-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.chart-hit { cursor: pointer; }

/* ── Tooltip das barras verticais (dia da semana) ─── */
.nv-vbar-col { position: relative; }
.nv-vbar-tooltip {
  display: none; position: absolute; bottom: calc(100% + 8px); left: 50%;
  transform: translateX(-50%);
  background: var(--surface); border: 1px solid var(--border2);
  border-radius: 9px; padding: 6px 12px;
  font-size: 12px; font-weight: 700; color: var(--text);
  white-space: nowrap; box-shadow: var(--shadow2);
  z-index: 40; pointer-events: none; font-variant-numeric: tabular-nums;
  animation: nvTipIn .1s ease;
}
.nv-vbar-col:hover .nv-vbar-tooltip { display: block; }

/* ── Gráfico de linha SVG ─────────────────────────────────── */
.nv-line-chart-wrap { overflow-x: auto; }
.nv-line-chart { display: block; width: 100%; height: auto; }
.nv-line-grid { stroke: rgba(255,255,255,.05); stroke-width: 1; }
body.light .nv-line-grid { stroke: rgba(0,0,0,.05); }
.nv-line-x { fill: var(--muted); font-size: 10px; text-anchor: middle; font-family: inherit; }
.nv-line-y { fill: var(--muted); font-size: 10px; text-anchor: end; font-family: inherit; }

/* ── Rosca SVG (idêntica ao app.vendas) ──────────────────── */
.nv-rosca-wrap { display: flex; align-items: center; justify-content: center; gap: 18px; flex-wrap: wrap; min-height: 220px; }
.nv-rosca-svg { width: 190px; height: 190px; flex-shrink: 0; }
.nv-rosca-seg { transition: opacity .18s ease, stroke-width .18s ease; cursor: pointer; }
.nv-rosca-svg:hover .nv-rosca-seg:not(.rosca-hl) { opacity: .35; }
.nv-rosca-seg.rosca-hl { stroke-width: 24; }
.nv-rosca-item.rosca-hl { background: var(--surface2); }
.nv-rosca-centro-lbl { fill: var(--muted); font-size: 11px; text-anchor: middle; font-weight: 700; }
.nv-rosca-centro-val { fill: var(--text); font-size: 14px; text-anchor: middle; font-weight: 800; }
.nv-rosca-legenda { flex: 1; min-width: 180px; display: flex; flex-direction: column; gap: 8px; }
.nv-rosca-item { display: flex; align-items: center; gap: 8px; font-size: 12px; transition: background .15s ease; border-radius: 8px; padding: 3px 6px; margin: -3px -6px; cursor: pointer; }
.nv-rosca-cor { width: 11px; height: 11px; border-radius: 3px; flex-shrink: 0; }
.nv-rosca-nome { color: var(--text); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nv-rosca-val { margin-left: auto; color: var(--muted); font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ── Barras verticais (dia da semana) ─────────────────────── */
.nv-vbar-chart { display: flex; align-items: flex-end; justify-content: center; gap: 18px; height: 180px; padding: 12px 18px 18px; max-width: 760px; margin: 0 auto; }
.nv-vbar-col { flex: 1 1 0; max-width: 92px; min-width: 0; display: flex; flex-direction: column; align-items: center; height: 100%; }
.nv-vbar-track { flex: 1; width: 100%; max-width: 46px; display: flex; align-items: flex-end; margin: 0 auto; }
.nv-vbar-fill { width: 100%; border-radius: 8px 8px 0 0; min-height: 2px; cursor: pointer; background: linear-gradient(180deg, #34d399, var(--green)); transition: height .8s cubic-bezier(.22,1,.36,1), filter .18s ease, transform .18s ease; }
.nv-vbar-col:hover .nv-vbar-fill { filter: brightness(1.18); transform: scaleY(1.02); transform-origin: bottom; }
.nv-vbar-col:hover .nv-vbar-val { color: var(--text); }
.nv-vbar-val { font-size: 10px; font-weight: 700; color: var(--muted); margin-top: 6px; white-space: nowrap; }
.nv-vbar-lbl { font-size: 11px; font-weight: 800; color: var(--text); margin-top: 2px; }

/* ── Tela de Metas ────────────────────────────────────────── */
.meta-stack-erp { display: flex; flex-direction: column; gap: 14px; }
.nv-meta-bloco { padding: 18px 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.nv-meta-cabecalho { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.nv-meta-cabecalho small { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.nv-meta-cabecalho strong { font-size: 20px; font-weight: 700; letter-spacing: -.4px; font-variant-numeric: tabular-nums; color: var(--text); }
.nv-meta-alvo { font-size: 12px; color: var(--muted); font-weight: 600; }
.nv-progress-track { height: 12px; border-radius: 999px; background: var(--border2); overflow: hidden; margin-bottom: 6px; }
.nv-progress-bar { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--green), #34d399); transition: width .5s ease; }
.nv-progress-bar.nv-pb-amarelo { background: linear-gradient(90deg, var(--amber), #fbbf24); }
.nv-progress-bar.nv-pb-vermelho { background: linear-gradient(90deg, var(--red), #f87171); }
.nv-meta-pct { font-size: 12px; font-weight: 700; color: var(--muted); }
.nv-meta-aviso { padding: 13px 16px; border-radius: 12px; font-size: 13px; font-weight: 600; line-height: 1.5; background: var(--blueT); border: 1px solid rgba(59,130,246,.2); color: var(--blue); }
.nv-meta-aviso.verde { background: var(--greenT); border-color: rgba(16,185,129,.2); color: var(--green); }
.nv-meta-falta { display: flex; justify-content: space-between; align-items: center; }
.nv-meta-resultado { margin-top: 10px; padding: 12px 14px; border-radius: 10px; background: var(--surface2); border: 1px solid var(--border); font-size: 13px; color: var(--text2); }
.nv-meta-resultado strong { color: var(--text); font-weight: 700; }

/* ── Histórico: ações de venda ─────────────────────── */
.nv-hist-acoes { margin-top: 10px; display: flex; gap: 8px; }
.nv-hist-btn {
  padding: 6px 14px; border-radius: 8px; font-size: 12px; font-weight: 600;
  cursor: pointer; border: 1px solid var(--border2); background: var(--surface2);
  color: var(--text2); transition: all .15s;
}
.nv-hist-cancelar:hover { background: rgba(239,68,68,.12); border-color: var(--red); color: var(--red); }

/* ── Cancelamento de venda (reaproveita o estilo cb-* do cancelar baixa) ── */
.cb-lucro-perdido { color: var(--red) !important; }
.cb-modal-obs { font-size: 12px; color: var(--muted); line-height: 1.5; margin-top: 6px; }

/* ── Coluna de vencimento (tela de pagamentos / cobrança) ── */
.venc-cell { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.venc-cell.venc-inline { flex-direction: row; align-items: center; gap: 8px; }
.venc-data { font-size: 12.5px; color: var(--text2); font-variant-numeric: tabular-nums; }
.venc-badge { font-size: 10.5px; font-weight: 700; }
.venc-muted { color: var(--muted); }

/* Animação de entrada dos status de vencimento */
@keyframes vencPop {
  0%   { opacity: 0; transform: translateY(4px) scale(.92); }
  60%  { opacity: 1; transform: translateY(0)   scale(1.04); }
  100% { opacity: 1; transform: translateY(0)   scale(1); }
}
.venc-anim { animation: vencPop .34s cubic-bezier(.34,1.56,.64,1) both; }
@media (prefers-reduced-motion: reduce) {
  .venc-anim { animation: none; }
}


/* ── Abas internas (Vencido / A vencer) ── */
.subtabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); padding: 0 6px; }
.subtab { padding: 13px 18px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; display: flex; align-items: center; gap: 8px; transition: color .15s; user-select: none; }
.subtab:hover { color: var(--text); }
.subtab.active { color: var(--text); border-bottom-color: var(--red); }
.subtab.active[data-subtab="avencer"] { border-bottom-color: var(--amber); }
.subtab-badge { padding: 1px 8px; border-radius: 20px; font-size: 10.5px; font-weight: 700; }
.subtab-badge.red   { background: var(--redL);   color: var(--red); }
.subtab-badge.amber { background: var(--amberL); color: var(--amber); }
.subpane { display: none; }
.subpane.active { display: block; animation: paneFade .2s ease both; }
@keyframes paneFade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .subpane.active { animation: none; } }


/* ── Modal de edição de venda (Fatia 1) ── */
.nv-edit-resumo { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.nv-edit-resumo > div { display: flex; justify-content: space-between; align-items: center; gap: 16px; font-size: 13px; }
.nv-edit-resumo span { color: var(--muted); }
.nv-edit-resumo strong { color: var(--text); font-weight: 600; text-align: right; }
.nv-edit-aviso { margin-top: 12px; padding: 9px 12px; border-radius: 9px; font-size: 12.5px; font-weight: 600; }
.nv-edit-aviso.erro { color: var(--red); background: var(--redL); }
.nv-edit-aviso.prejuizo { color: var(--amber); background: var(--amberL); }
.cb-btn-voltar { padding: 9px 16px; border-radius: 8px; cursor: pointer; font-family: inherit; font-size: 13px; font-weight: 600; background: var(--surface2); color: var(--text2); border: 1px solid var(--border); }
.cb-btn-voltar:hover { background: var(--border); }


/* ── Abas dentro do modal de edição de venda (Fatia 2) ── */
.nv-edit-tabs { display: flex; gap: 0; padding: 0 20px; border-bottom: 1px solid var(--border); }
.nv-edit-tab { padding: 11px 16px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--muted); background: none; border: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.nv-edit-tab:hover { color: var(--text); }
.nv-edit-tab.active { color: var(--text); border-bottom-color: var(--blue); }
.nv-edit-pane { display: none; }
.nv-edit-pane.active { display: block; animation: paneFade .2s ease both; }
.nv-edit-pane-acoes { display: flex; justify-content: flex-end; margin-top: 16px; }
.nv-troca-resultado { margin-top: 10px; padding: 10px 12px; border-radius: 9px; font-size: 13px; line-height: 1.5; }
.nv-troca-resultado.ok { background: var(--greenL); color: var(--text); }
.nv-troca-resultado.erro { background: var(--redL); color: var(--red); font-weight: 600; }


/* ── Campo sem permissão de edição (opaco) ── */
.nv-campo-bloqueado { opacity: .5; cursor: not-allowed; background: var(--surface) !important; }


/* ── Autocomplete de cliente no modal de edição ── */
.nv-det-autocomplete { position: relative; }
.nv-det-sugestoes { display: none; position: absolute; top: 100%; left: 0; right: 0; z-index: 10; margin-top: 4px; background: var(--surface); border: 1px solid var(--border2); border-radius: 9px; max-height: 220px; overflow-y: auto; box-shadow: 0 8px 24px rgba(0,0,0,.3); }
.nv-det-sug-item { padding: 9px 12px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; border-bottom: 1px solid var(--border); }
.nv-det-sug-item:last-child { border-bottom: none; }
.nv-det-sug-item:hover { background: var(--surface2); }
.nv-det-sug-item strong { font-size: 13px; color: var(--text); }
.nv-det-sug-item small { font-size: 11px; color: var(--muted); }

/* ── Botão Cobrar (WhatsApp) ── */
.btn-cobrar { display: inline-flex; align-items: center; gap: 5px; padding: 9px 10px; border-radius: 12px; font-size: 11.5px; font-weight: 700; color: #fff; background: #d32525; text-decoration: none; transition: opacity .15s; white-space: nowrap; }
.btn-cobrar:hover { opacity: .85; }


/* ── Modal Editar Pessoa ─────────────────────────── */
.pessoa-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 1000; backdrop-filter: blur(2px); }
.pessoa-modal { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; width: 480px; max-width: 94vw; max-height: 90vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.4); }
.pessoa-modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.pessoa-modal-title { font-size: 17px; font-weight: 700; color: var(--text); }
.pessoa-modal-close { background: none; border: none; color: var(--muted); font-size: 18px; cursor: pointer; width: 30px; height: 30px; border-radius: 8px; }
.pessoa-modal-close:hover { background: var(--surface2); color: var(--text); }
.pessoa-modal-body { padding: 20px; }
.pessoa-modal-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.pessoa-modal-row.full { grid-template-columns: 1fr; }
.pessoa-modal-checks { display: flex; gap: 16px; margin-bottom: 14px; }
.pessoa-modal-check { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text); cursor: pointer; }
.pessoa-modal-check input { accent-color: var(--green); width: 16px; height: 16px; cursor: pointer; }
.pessoa-modal-acoes { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 20px; border-top: 1px solid var(--border); }
.pessoa-modal-btn { padding: 10px 20px; border-radius: 10px; font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit; border: 1px solid var(--border); }
.pessoa-modal-btn.cancelar { background: var(--surface2); color: var(--text); }
.pessoa-modal-btn.cancelar:hover { background: var(--border2); }
.pessoa-modal-btn.salvar { background: var(--green); color: #fff; border-color: var(--green); }
.pessoa-modal-btn.salvar:hover { opacity: .9; }
.pessoa-modal-btn:disabled { opacity: .5; cursor: not-allowed; }
.pessoa-modal-erro { color: var(--red); font-size: 12px; margin-top: -8px; margin-bottom: 10px; }
.cliente-editar-btn { background: none; border: 1px solid var(--border); color: var(--muted); padding: 6px 12px; border-radius: 8px; font-size: 12px; cursor: pointer; font-family: inherit; }
.cliente-editar-btn:hover { background: var(--border2); color: var(--text); }