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

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

:root {
  --bg:        #0f172a;
  --surface:   #1e293b;
  --surface2:  #263347;
  --border:    #334155;
  --text:      #f1f5f9;
  --text-muted:#94a3b8;
  --primary:   #f59e0b;
  --primary-d: #d97706;
  --success:   #22c55e;
  --danger:    #ef4444;
  --warning:   #f59e0b;
  --info:      #3b82f6;
  --sidebar-w: 220px;
}

html, body { height: 100%; }
body { font-family: 'Nunito', sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }

/* ── LAYOUT ── */
.app { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: var(--sidebar-w); background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; flex-shrink: 0; overflow-y: auto;
}
.sidebar-logo {
  padding: 20px 16px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-logo .icon { font-size: 28px; }
.sidebar-logo h1 { font-size: 14px; font-weight: 800; color: var(--primary); line-height: 1.2; }
.sidebar-logo p  { font-size: 11px; color: var(--text-muted); }

.sidebar-nav { padding: 8px 0; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; cursor: pointer; color: var(--text-muted);
  font-size: 13px; font-weight: 600; transition: all .15s;
  border-left: 3px solid transparent;
}
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: var(--surface2); color: var(--primary); border-left-color: var(--primary); }
.nav-item .nav-icon { width: 20px; text-align: center; font-size: 16px; }
.nav-badge {
  margin-left: auto; background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 800; padding: 2px 6px; border-radius: 10px;
}

.sidebar-footer { padding: 12px 16px; border-top: 1px solid var(--border); }
.user-info { display: flex; align-items: center; gap: 8px; }
.user-avatar {
  width: 32px; height: 32px; background: var(--primary); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px; color: #0f172a; flex-shrink: 0;
}
.user-name  { font-size: 13px; font-weight: 700; }
.user-role  { font-size: 11px; color: var(--text-muted); }
.btn-logout { margin-left: auto; background: none; border: none; cursor: pointer; color: var(--text-muted); font-size: 18px; }
.btn-logout:hover { color: var(--danger); }

/* ── CONTEÚDO ── */
.main { flex: 1; overflow-y: auto; display: flex; flex-direction: column; }

.topbar {
  padding: 16px 24px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface); flex-shrink: 0;
}
.topbar h2 { font-size: 18px; font-weight: 800; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }

.content { padding: 24px; flex: 1; }

/* ── CARDS ── */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 20px;
}
.card-label { font-size: 12px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.card-value { font-size: 28px; font-weight: 800; margin: 6px 0 2px; }
.card-sub   { font-size: 12px; color: var(--text-muted); }
.card.green .card-value { color: var(--success); }
.card.yellow .card-value { color: var(--warning); }
.card.red .card-value { color: var(--danger); }
.card.blue .card-value { color: var(--info); }

/* ── BOTÕES ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px; border: none; cursor: pointer;
  font-family: inherit; font-size: 13px; font-weight: 700; transition: all .15s;
}
.btn-primary  { background: var(--primary); color: #0f172a; }
.btn-primary:hover { background: var(--primary-d); }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-success  { background: var(--success); color: #fff; }
.btn-danger   { background: var(--danger); color: #fff; }
.btn-sm  { padding: 5px 10px;  font-size: 12px; }
.btn-xs  { padding: 3px 7px;   font-size: 11px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── TABELAS ── */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.table-toolbar {
  padding: 14px 16px; display: flex; gap: 10px; align-items: center;
  border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
table { width: 100%; border-collapse: collapse; }
th { padding: 10px 14px; text-align: left; font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; border-bottom: 1px solid var(--border); }
td { padding: 10px 14px; font-size: 13px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface2); }
.td-actions { display: flex; gap: 6px; }

/* ── INPUTS ── */
input, select, textarea {
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); font-family: inherit; font-size: 13px; padding: 9px 12px;
  transition: border-color .2s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); }
input::placeholder { color: var(--text-muted); }
.input-search { width: 240px; }

/* ── MODAIS ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.7);
  display: none; align-items: center; justify-content: center; z-index: 1000; padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto;
}
.modal-header {
  padding: 20px 24px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-size: 16px; font-weight: 800; }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 20px; cursor: pointer; }
.modal-close:hover { color: var(--danger); }
.modal-body { padding: 20px 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }
.modal-lg { max-width: 780px; }

/* ── FORM ── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.form-group input, .form-group select, .form-group textarea { width: 100%; }

/* ── BADGES ── */
.badge {
  display: inline-block; padding: 3px 8px; border-radius: 6px;
  font-size: 11px; font-weight: 700;
}
.badge-green  { background: #14532d44; color: #4ade80; }
.badge-red    { background: #7f1d1d44; color: #f87171; }
.badge-yellow { background: #78350f44; color: #fbbf24; }
.badge-blue   { background: #1e3a5f44; color: #60a5fa; }
.badge-gray   { background: #33415544; color: #94a3b8; }

/* ── TOAST ── */
#toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 12px 18px; border-radius: 10px; font-size: 13px; font-weight: 600;
  max-width: 320px; animation: slideIn .2s ease; box-shadow: 0 4px 20px rgba(0,0,0,.4);
}
.toast.ok   { background: #14532d; color: #4ade80; border: 1px solid #166534; }
.toast.err  { background: #7f1d1d; color: #f87171; border: 1px solid #991b1b; }
.toast.warn { background: #78350f; color: #fbbf24; border: 1px solid #92400e; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── CARRINHO ── */
.cart-wrap { display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start; }
.cart-items { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.cart-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.cart-item:last-child { border-bottom: none; }
.cart-item-name { flex: 1; font-weight: 700; }
.cart-item-qty { width: 60px; text-align: center; }
.cart-summary { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 20px; position: sticky; top: 0; }
.cart-line { display: flex; justify-content: space-between; padding: 6px 0; font-size: 13px; }
.cart-line.total { font-size: 18px; font-weight: 800; border-top: 1px solid var(--border); margin-top: 8px; padding-top: 12px; }

/* ── ALERTA VENCIMENTO ── */
.alerta-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.alerta-item:last-child { border-bottom: none; }
.dias-badge { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px; flex-shrink: 0; }
.dias-badge.vencido  { background: #7f1d1d44; color: #f87171; }
.dias-badge.urgente  { background: #78350f44; color: #fbbf24; }
.dias-badge.ok       { background: #14532d44; color: #4ade80; }

/* ── SCANNER ── */
.scanner-bar {
  background: #1a2744; border: 2px dashed var(--primary); border-radius: 10px;
  padding: 14px 16px; display: flex; align-items: center; gap: 12px; margin-bottom: 16px;
}
.scanner-bar input { flex: 1; background: transparent; border: none; font-size: 15px; }
.scanner-bar input:focus { outline: none; }

/* ── EMPTY STATE ── */
.empty { text-align: center; padding: 48px 24px; color: var(--text-muted); }
.empty .empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty p { font-size: 14px; }

/* ── TABS ── */
.tabs { display: flex; gap: 4px; background: var(--surface); border-radius: 10px; padding: 4px; margin-bottom: 20px; }
.tab-btn {
  flex: 1; padding: 8px 12px; border: none; background: none; color: var(--text-muted);
  cursor: pointer; font-family: inherit; font-size: 13px; font-weight: 700; border-radius: 7px;
  transition: all .15s;
}
.tab-btn.active { background: var(--surface2); color: var(--primary); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ── CHART ── */
.chart-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 20px; }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── CAMPOS DINÂMICOS ── */
.campos-extras-container { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.campo-extra-row { display: flex; gap: 8px; align-items: center; }
.campo-extra-row input { flex: 1; }
.campo-extra-row .btn-remove-campo {
  background: none; border: 1px solid var(--border); border-radius: 6px;
  color: var(--danger); cursor: pointer; font-size: 14px; padding: 6px 10px;
  flex-shrink: 0; transition: all .15s;
}
.campo-extra-row .btn-remove-campo:hover { background: var(--danger); color: #fff; }

/* ── SECTION DIVIDER ── */
.section-divider {
  font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .8px;
  color: var(--primary); padding: 12px 0 8px; border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

/* ── BOTÃO GHOST ── */
.btn-ghost {
  background: none; border: 1px dashed var(--border); color: var(--text-muted);
  font-size: 12px; padding: 6px 12px;
}
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }

/* ── FOTO CLIENTE ── */
.foto-area { display: flex; align-items: flex-start; gap: 16px; }
.foto-preview {
  width: 90px; height: 90px; border-radius: 10px; border: 2px dashed var(--border);
  background: var(--bg); display: flex; align-items: center; justify-content: center;
  font-size: 32px; flex-shrink: 0; overflow: hidden; cursor: pointer;
}
.foto-preview img { width: 100%; height: 100%; object-fit: cover; }
.foto-area .form-group { flex: 1; }

/* ── CARD CLIENTE ── */
.cliente-card {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-bottom: 1px solid var(--border);
}
.cliente-avatar {
  width: 40px; height: 40px; border-radius: 50%; background: var(--surface2);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 16px; color: var(--primary); flex-shrink: 0; overflow: hidden;
}
.cliente-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

/* ── ATRIBUTOS TÉCNICOS ── */
.atribs-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.atrib-row { display: flex; flex-direction: column; gap: 4px; }
.atrib-row label { font-size: 11px; color: var(--text-muted); font-weight: 600; }
.atrib-select-wrap { display: flex; gap: 6px; }
.atrib-select-wrap select { flex: 1; }
.btn-add-opcao {
  background: none; border: 1px solid var(--border); border-radius: 6px;
  color: var(--primary); cursor: pointer; font-size: 16px; padding: 0 10px; flex-shrink: 0;
  transition: all .15s;
}
.btn-add-opcao:hover { background: var(--primary); color: #0f172a; }

/* ── BADGE INCOMPLETO ── */
.badge-orange { background: #7c2d1244; color: #fb923c; }

/* ── BADGES EXTRAS ── */
.badge-purple { background: #4c1d9544; color: #a78bfa; }
.badge-indigo { background: #312e8144; color: #818cf8; }

/* ── ORC ITEM ROW ── */
.orc-item-row {
  display: grid;
  grid-template-columns: 1fr 70px 90px 90px 90px 36px;
  gap: 6px;
  align-items: center;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.orc-item-row input, .orc-item-row select { padding: 6px 8px; font-size: 12px; }

.btn-remove-item {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--danger);
  cursor: pointer;
  font-size: 14px;
  padding: 4px 8px;
  transition: all .15s;
}
.btn-remove-item:hover { background: var(--danger); color: #fff; }

/* ── CÂMERA MODAL ── */
#camera-reader { border-radius: 8px; overflow: hidden; background: #000; min-height: 200px; }
#camera-reader video { border-radius: 8px; }

/* ── AUTOCOMPLETE ── */
.autocomplete-wrap { position: relative; }
.autocomplete-dropdown {
  position: absolute; top: 100%; left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-top: none; border-radius: 0 0 8px 8px;
  z-index: 600; max-height: 220px; overflow-y: auto;
  display: none; box-shadow: 0 8px 24px rgba(0,0,0,.4);
}
.autocomplete-dropdown.show { display: block; }
.autocomplete-item {
  padding: 9px 14px; cursor: pointer; font-size: 13px;
  border-bottom: 1px solid var(--border); transition: background .1s;
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover { background: var(--surface2); }
.autocomplete-item strong { color: var(--primary); }

/* ── LANÇAMENTO AVULSO ── */
.avulso-bar {
  background: var(--surface2); border: 1px dashed var(--border); border-radius: 10px;
  padding: 10px 14px; display: flex; align-items: center; gap: 8px;
  margin-bottom: 12px; flex-wrap: wrap;
}
.avulso-bar input {
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); font-family: inherit; font-size: 13px; padding: 7px 10px;
}
.avulso-bar input:focus { outline: none; border-color: var(--primary); }

/* ── SERVIÇO AVULSO BAR ── */
.servico-bar { border-color: var(--primary); border-style: solid; }
.servico-bar span { color: var(--primary); }

/* ── CART SECTION TITLES ── */
.cart-section-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  color: var(--text-muted); letter-spacing: 0.5px;
  padding: 8px 0 4px; border-bottom: 1px solid var(--border);
  margin: 4px 0 6px;
}

/* ── INSTALAÇÃO NO CARRINHO ── */
.cart-item-install {
  font-size: 11px; color: var(--text-muted);
  display: flex; align-items: center; gap: 6px; margin-top: 4px;
}
.cart-item-install input[type=checkbox] { accent-color: var(--primary); width: 14px; height: 14px; }
.cart-item-install label { cursor: pointer; }
.cart-item-install .install-preco { color: var(--success); font-weight: 700; }

/* ── INPUT BRL ── */
input.brl-input {
  text-align: right; font-variant-numeric: tabular-nums; letter-spacing: .3px;
}
input.brl-input::placeholder { text-align: left; }

/* ── TOGGLE DESCONTO (R$ / %) ── */
.desc-toggle {
  display: inline-flex; border: 1px solid var(--border); border-radius: 6px;
  overflow: hidden; vertical-align: middle;
}
.toggle-btn {
  background: none; border: none; padding: 2px 8px; font-size: 11px;
  font-weight: 700; cursor: pointer; color: var(--text-muted);
  transition: background .15s, color .15s;
}
.toggle-btn.active {
  background: var(--primary); color: #fff;
}

/* ── AUTOCOMPLETE ITEM INDISPONÍVEL ── */
.item-sem-estoque { opacity: .55; cursor: not-allowed !important; }
.item-sem-estoque:hover { background: none !important; }

/* ── RESUMO PARCELAS NO MODAL ── */
.parc-resumo-item {
  flex: 1; min-width: 100px;
  padding: 8px 12px;
  background: var(--surface);
  border-radius: 8px;
  border: 1px solid var(--border);
}
.parc-resumo-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .4px; }
.parc-resumo-val   { font-size: 16px; font-weight: 800; margin-top: 2px; }

/* ── WIDGET ANIVERSARIANTES ── */
.aniversario-widget {
  background: linear-gradient(135deg, #fff7ed, #fef3c7);
  border: 1px solid #f59e0b;
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 16px;
}
.aniversario-header {
  font-size: 14px; font-weight: 700; color: #92400e;
  display: flex; align-items: center; gap: 8px; margin-bottom: 10px;
}
.aniv-mes-select {
  font-size: 13px; font-weight: 600; color: #92400e;
  background: transparent; border: 1px solid #f59e0b;
  border-radius: 6px; padding: 2px 6px; cursor: pointer;
}
.aniv-count {
  background: #f59e0b; color: #fff;
  font-size: 11px; font-weight: 800;
  border-radius: 50%; width: 20px; height: 20px;
  display: inline-flex; align-items: center; justify-content: center;
}
.aniv-lista { display: flex; flex-wrap: wrap; gap: 8px; }
.aniv-card {
  display: flex; align-items: center; gap: 10px;
  background: #fff; border: 1px solid #fde68a;
  border-radius: 8px; padding: 8px 12px; min-width: 200px; flex: 1;
}
.aniv-card.aniv-hoje {
  border-color: #f59e0b; background: #fffbeb;
  box-shadow: 0 0 0 2px rgba(245,158,11,.3);
}
.aniv-dia {
  font-size: 22px; font-weight: 900; color: #f59e0b;
  min-width: 32px; text-align: center;
}
.aniv-info { flex: 1; }
.aniv-info strong { display: block; font-size: 13px; color: var(--text); }
.aniv-info span   { font-size: 11px; color: var(--text-muted); }
.aniv-badge { font-size: 12px; white-space: nowrap; }
.aniv-empty { font-size: 13px; color: #92400e; }

/* ── BACKUP / RESTAURAÇÃO ── */
.backup-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 28px; display: flex; flex-direction: column; gap: 12px;
  max-width: 520px;
}
.backup-card h3 { font-size: 16px; font-weight: 800; margin-bottom: 4px; }
.backup-card p  { font-size: 13px; color: var(--text-muted); }
.backup-stats {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px;
  margin-bottom: 16px;
}
.backup-stat {
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px; text-align: center;
}
.backup-stat .n { font-size: 22px; font-weight: 800; color: var(--primary); }
.backup-stat .l { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }

/* ── RELATÓRIOS NOVOS ── */
.rank-table td:first-child { font-weight: 700; }
.rank-table .pos { color: var(--primary); font-weight: 900; font-size: 16px; min-width: 28px; }
.rank-badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 700; }
.rank-badge.ouro   { background: #78350f; color: #fbbf24; }
.rank-badge.prata  { background: #1e3a5f; color: #93c5fd; }
.rank-badge.bronze { background: #431407; color: #fb923c; }

/* ══════════════════════════════════════════════════════════════
   v0.6.0 — TEMAS / PALETAS DE CORES
   ══════════════════════════════════════════════════════════════ */

/* Tema 2 — Claro / Suave */
[data-theme="claro"] {
  --bg:        #f1f5f9;
  --surface:   #ffffff;
  --surface2:  #e2e8f0;
  --border:    #cbd5e1;
  --text:      #0f172a;
  --text-muted:#64748b;
  --primary:   #f59e0b;
  --primary-d: #d97706;
  --success:   #16a34a;
  --danger:    #dc2626;
  --warning:   #d97706;
  --info:      #2563eb;
}
[data-theme="claro"] .user-avatar { color: #fff; }
[data-theme="claro"] .btn-primary { color: #fff; }

/* Tema 3 — Noturno Roxo */
[data-theme="noturno"] {
  --bg:        #030712;
  --surface:   #111827;
  --surface2:  #1f2937;
  --border:    #374151;
  --text:      #f9fafb;
  --text-muted:#9ca3af;
  --primary:   #8b5cf6;
  --primary-d: #7c3aed;
  --success:   #10b981;
  --danger:    #ef4444;
  --warning:   #f59e0b;
  --info:      #6366f1;
}

/* Tema 4 — Alto Contraste */
[data-theme="alto-contraste"] {
  --bg:        #000000;
  --surface:   #111111;
  --surface2:  #222222;
  --border:    #555555;
  --text:      #ffffff;
  --text-muted:#cccccc;
  --primary:   #facc15;
  --primary-d: #eab308;
  --success:   #4ade80;
  --danger:    #f87171;
  --warning:   #fb923c;
  --info:      #60a5fa;
}

/* Tema 5 — Corporativo Azul */
[data-theme="corporativo"] {
  --bg:        #0a1628;
  --surface:   #0f2144;
  --surface2:  #163160;
  --border:    #1e3a6e;
  --text:      #e8f0fe;
  --text-muted:#93b4d1;
  --primary:   #4a9eff;
  --primary-d: #2b7ede;
  --success:   #34d399;
  --danger:    #f87171;
  --warning:   #fbbf24;
  --info:      #60a5fa;
}

/* ── BOTÃO TEMA (topbar) ── */
.btn-tema {
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text); border-radius: 8px; padding: 6px 10px;
  font-size: 16px; cursor: pointer; transition: all .15s;
  flex-shrink: 0;
}
.btn-tema:hover { background: var(--primary); color: #000; border-color: var(--primary); }

/* ── PAINEL DE TEMAS ── */
.tema-painel {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 300;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 16px; box-shadow: 0 8px 32px rgba(0,0,0,.4);
  min-width: 260px;
}
.tema-painel h4 { font-size: 13px; font-weight: 700; color: var(--text-muted); margin-bottom: 12px; text-transform: uppercase; letter-spacing: .5px; }
.tema-grade { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tema-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px; cursor: pointer;
  border: 2px solid transparent; transition: border-color .15s, box-shadow .15s;
  background: var(--bg); font-size: 13px; font-weight: 600; color: var(--text);
}
.tema-btn:hover { border-color: var(--border); }
.tema-btn.ativo  { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(245,158,11,.2); }
.tema-amostra {
  width: 28px; height: 28px; border-radius: 6px; flex-shrink: 0;
  border: 1px solid rgba(255,255,255,.15);
}

/* ── TEMAS TOPBAR WRAPPER ── */
.topbar { position: relative; }

/* ══════════════════════════════════════════════════════════════
   v0.6.0 — ESTOQUE MÍNIMO EM LOTE
   ══════════════════════════════════════════════════════════════ */
.estoque-alerta-pulse {
  animation: pulse-danger 1.5s ease-in-out infinite;
}
@keyframes pulse-danger {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,.4); }
  50%       { box-shadow: 0 0 0 8px rgba(239,68,68,.0); }
}

/* checkbox seleção de produto em lote */
.prod-checkbox { width: 16px; height: 16px; cursor: pointer; accent-color: var(--primary); }

/* ══════════════════════════════════════════════════════════════
   v0.6.0 — CALENDÁRIO & RELATÓRIOS ANALÍTICOS
   ══════════════════════════════════════════════════════════════ */

/* Botões de período */
.periodo-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.periodo-btn {
  padding: 6px 14px; border-radius: 20px; border: 1px solid var(--border);
  background: var(--surface2); color: var(--text-muted);
  font-size: 12px; font-weight: 700; cursor: pointer; transition: all .15s;
}
.periodo-btn:hover   { border-color: var(--primary); color: var(--primary); }
.periodo-btn.ativo   { background: var(--primary); color: #000; border-color: var(--primary); }

/* Grid de métricas analíticas */
.metricas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.metrica-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 16px;
}
.metrica-card.destaque { border-color: var(--primary); }
.metrica-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; font-weight: 600; }
.metrica-valor { font-size: 22px; font-weight: 800; margin: 6px 0 2px; color: var(--text); }
.metrica-sub   { font-size: 11px; color: var(--text-muted); }
.metrica-card.verde  .metrica-valor { color: var(--success); }
.metrica-card.azul   .metrica-valor { color: var(--info); }
.metrica-card.amarelo .metrica-valor { color: var(--warning); }
.metrica-card.vermelho .metrica-valor { color: var(--danger); }

/* Calendário interativo */
.cal-wrap {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 18px; margin-bottom: 24px;
}
.cal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.cal-titulo { font-size: 16px; font-weight: 800; }
.cal-nav {
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text); border-radius: 8px; padding: 4px 12px;
  cursor: pointer; font-size: 16px; line-height: 1;
}
.cal-nav:hover { background: var(--primary); color: #000; border-color: var(--primary); }
.cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px;
}
.cal-dow {
  text-align: center; font-size: 11px; font-weight: 700;
  color: var(--text-muted); padding: 4px 0; text-transform: uppercase;
}
.cal-dia {
  aspect-ratio: 1; border-radius: 8px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all .15s; position: relative;
  border: 1px solid transparent;
}
.cal-dia:hover:not(.cal-vazio):not(.cal-fora) {
  border-color: var(--primary); transform: scale(1.05);
}
.cal-dia.cal-fora { color: var(--text-muted); opacity: .35; cursor: default; }
.cal-dia.cal-vazio { cursor: default; }
.cal-dia.cal-hoje {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 2px rgba(245,158,11,.3);
  font-weight: 900;
}
.cal-dia.cal-selecionado {
  background: var(--primary) !important; color: #000 !important; font-weight: 900;
}
/* Heatmap: intensidade por faturamento */
.cal-dia.heat-1  { background: rgba(34,197,94,.12); }
.cal-dia.heat-2  { background: rgba(34,197,94,.25); }
.cal-dia.heat-3  { background: rgba(34,197,94,.42); }
.cal-dia.heat-4  { background: rgba(34,197,94,.62); }
.cal-dia.heat-5  { background: rgba(34,197,94,.82); color: #0f172a; }
.cal-dia .cal-dot {
  font-size: 8px; color: var(--text-muted); margin-top: 1px; line-height: 1;
}

/* Grafico de horários */
.horarios-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 18px; }
.horarios-titulo { font-size: 14px; font-weight: 800; margin-bottom: 14px; }
.horarios-grid {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px;
}
@media (min-width: 600px) { .horarios-grid { grid-template-columns: repeat(8, 1fr); } }
@media (min-width: 900px) { .horarios-grid { grid-template-columns: repeat(12, 1fr); } }
.hora-bloco {
  display: flex; flex-direction: column; align-items: center;
  gap: 4px; padding: 6px 4px;
}
.hora-bar-wrap { width: 100%; height: 60px; display: flex; align-items: flex-end; }
.hora-bar {
  width: 100%; border-radius: 4px 4px 0 0;
  background: var(--info); opacity: .7; transition: height .4s ease;
  min-height: 2px;
}
.hora-bar.pico { background: var(--primary); opacity: 1; }
.hora-label { font-size: 10px; color: var(--text-muted); font-weight: 600; }
.hora-qtd   { font-size: 9px; color: var(--text-muted); }

/* Painel customizado de datas */
.custom-periodo {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px; background: var(--surface2); border-radius: 10px;
  border: 1px solid var(--border); margin-bottom: 16px;
}
.custom-periodo label { font-size: 12px; color: var(--text-muted); }

/* ═══════════════ V0.7.0 — CAIXA ═══════════════════════════════ */
.caixa-status {
  padding: 12px 18px; border-radius: 10px; font-size: 14px; font-weight: 600;
  border: 1px solid var(--border);
}
.caixa-status.aberto  { background: rgba(34,197,94,.1);  border-color: var(--success); color: var(--success); }
.caixa-status.fechado { background: rgba(156,163,175,.1); border-color: var(--border);  color: var(--text-muted); }

/* ═══════════════ V0.7.0 — ATIVOS ══════════════════════════════ */
.badge-purple { background: rgba(168,85,247,.15); color: #a855f7; }

/* ═══════════════ V0.7.0 — AUDITORIA ═══════════════════════════ */
#tbody-auditoria tr td { font-size: 12px; padding: 7px 10px; }
#tbody-auditoria pre  { max-height: 200px; overflow-y: auto; }

/* ═══════════════ V0.8.0 — SKU SUGERIDOR ══════════════════════ */
.sku-sugerido-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 12px; background: rgba(245,158,11,.08);
  border: 1px solid rgba(245,158,11,.25); border-radius: 8px; margin-top: 8px;
}
.sku-label  { font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.sku-code   {
  font-family: 'Courier New', monospace; font-size: 13px; font-weight: 700;
  color: var(--primary); letter-spacing: .5px; flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ═══════════════ V0.8.0 — NOTAS FISCAIS ══════════════════════ */
.modal-wide { max-width: 860px; width: 95vw; }
#tbody-nf tr td { font-size: 12px; }
#tbody-detalhe-nf-itens tr td { font-size: 12px; padding: 6px 8px; border-bottom: 1px solid var(--border); }

/* ═══════════════ V0.9.0 — COMPATIBILIDADE DE VEÍCULOS ════════ */
#bloco-aplicacoes .section-divider {
  font-size: 13px; font-weight: 700; color: var(--text-primary);
  padding: 8px 0 6px; border-bottom: 1px solid var(--border); margin-bottom: 12px;
}
/* Formulário de aplicação — labels de hierarquia */
#form-aplicacao label[style*="font-weight:700"] {
  display: block; margin-bottom: 4px;
}
/* Indicador de cascata (①②③) */
#form-aplicacao label { font-weight: 600; }
#tabela-aplicacoes th {
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .4px;
}
#tabela-aplicacoes tbody tr:hover { background: var(--surface2); }
#tabela-aplicacoes tbody tr td    { border-bottom: 1px solid var(--border); }

/* Devolução — info da venda */
#dev-venda-info {
  border: 1px solid var(--border);
  animation: fadeIn .2s ease;
}
/* Tab Devoluções — tabela */
#tbody-devolucoes td { font-size: 13px; padding: 8px 10px; }
#tbody-devolucoes code { font-size: 11px; background: var(--surface2); padding: 2px 6px; border-radius: 4px; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }



/* ═══════════════ V1.1.0 — USUÁRIOS E RBAC ════════════════════ */
.badge-ok  { background: #14532d44; color: #4ade80; }
.badge-err { background: #7f1d1d44; color: #f87171; }

/* Grade de checkboxes de permissões no modal de usuário */
.perm-item {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; cursor: pointer; padding: 6px 10px;
  border: 1px solid var(--border); border-radius: 8px;
  transition: background .15s;
}
.perm-item:hover { background: var(--surface2); }
.perm-item input[type="checkbox"] { accent-color: var(--accent); width: 15px; height: 15px; }
