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

:root {
  color-scheme: light;

  /* ===== AVANTE ERP — identidade visual ===== */
  --brand-dark: #0D47A1;     /* azul navy — sidebar, cabeçalhos, áreas institucionais */
  --brand-accent: #2563EB;   /* azul AVANTE — ação/navegação (cor principal de interação) */
  --brand-accent-hover: #1D4ED8;
  --brand-navy: #0D47A1;
  --brand-blue: #2563EB;

  --surface-1: #FFFFFF;      /* cards, formulários, tabelas */
  --surface-2: #F1F5F9;      /* hover/realce sutil */
  --page: #F8FAFC;           /* fundo geral das telas */
  --text-primary: #1F2937;   /* grafite — texto principal */
  --text-secondary: #4B5563; /* texto secundário */
  --muted: #687280;          /* texto auxiliar/neutro */
  --grid: #E5E7EB;           /* bordas, divisores */
  --baseline: #D1D5DB;       /* bordas de campos */
  --border: rgba(31, 41, 55, 0.10);
  --border-strong: rgba(31, 41, 55, 0.22);
  --borda: #E5E7EB;

  --series-1: #2a78d6; /* azul */
  --series-2: #eb6834; /* laranja */
  --series-3: #1baf7a; /* água */
  --series-4: #eda100; /* amarelo */
  --series-5: #e87ba4; /* magenta */
  --series-6: #008300; /* verde */
  --series-7: #4a3aa7; /* violeta */
  --series-8: #e34948; /* vermelho */

  /* Regra das cores AVANTE: azul = ação, verde = sucesso/confirmação,
     laranja = atenção, vermelho = problema/exclusão, cinza = neutro. */
  --good: #16A34A;
  --good-hover: #15803D;
  --warning: #F59E0B;
  --warning-hover: #D97706;
  --serious: #F59E0B;
  --critical: #EF4444;
  --critical-hover: #DC2626;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--page);
  color: var(--text-primary);
}

.oculto { display: none !important; }

/* ===== LOGIN ===== */
.tela-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--brand-dark), var(--brand-accent));
}
.login-card {
  background: var(--surface-1);
  padding: 40px;
  border-radius: 10px;
  width: 340px;
  max-width: 92vw;
  box-shadow: 0 20px 60px rgba(13,71,161,0.35);
}
.login-marca { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.login-marca svg { width: 34px; height: 34px; flex-shrink: 0; }
.login-marca-texto { font-family: 'Inter', system-ui, sans-serif; font-weight: 800; font-size: 17px; color: var(--text-primary); line-height: 1.15; }
.login-marca-texto span { display: block; font-size: 10.5px; font-weight: 600; color: var(--muted); letter-spacing: 0.02em; }
.login-card h1 { margin: 0 0 4px; font-size: 22px; font-weight: 800; }
.login-sub { margin: 0 0 24px; color: var(--text-secondary); font-size: 13px; }
.login-card label { display: block; font-size: 13px; color: var(--text-secondary); margin: 12px 0 4px; font-weight: 500; }
.login-card input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--baseline); border-radius: 6px; font-size: 14px;
}
.login-card input:focus { outline: none; border-color: var(--brand-accent); box-shadow: 0 0 0 3px rgba(37,99,235,0.15); }
.login-card button {
  width: 100%; margin-top: 20px; padding: 11px; border: none; border-radius: 6px;
  background: var(--brand-accent); color: #fff; font-size: 14px; font-weight: 700; cursor: pointer;
}
.login-card button:hover { background: var(--brand-accent-hover); }
.login-hint { margin-top: 16px; font-size: 11px; color: var(--muted); text-align: center; }
.erro-msg { color: var(--critical); font-size: 13px; min-height: 18px; margin-top: 8px; }
.campo-senha { position: relative; }
.campo-senha input { padding-right: 40px; }
.login-card button.toggle-senha {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 28px; height: 28px; margin-top: 0; background: none; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center; padding: 0;
  color: var(--text-secondary); border-radius: 6px;
}
.login-card button.toggle-senha:hover { background: var(--surface-2); color: var(--text-primary); }
.login-card .login-lembrar {
  display: flex; align-items: center; gap: 6px; margin: 14px 0 0;
  font-size: 13px; color: var(--text-secondary); cursor: pointer;
}
.login-card .login-lembrar input { width: auto; margin: 0; }

/* ===== APP LAYOUT ===== */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 230px; background: var(--brand-dark); color: #fff; display: flex; flex-direction: column;
  flex-shrink: 0; transition: width 0.18s ease;
}
.sidebar-topo { padding: 20px 16px 12px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.logo { font-size: 16px; font-weight: 800; font-family: 'Inter', system-ui, sans-serif; display: flex; align-items: center; gap: 8px; letter-spacing: -0.01em; }
.logo svg { width: 22px; height: 22px; flex-shrink: 0; }
.logo-suffix { color: #93C5FD; font-weight: 700; margin-left: 3px; }
.loja-atual { font-size: 12px; color: #AFC3E8; margin-top: 4px; width: 100%; }

/* Seta de recolher/expandir — por padrão o menu abre RETRAÍDO (só ícones);
   clicar na seta alterna e a preferência fica salva (ver js/app.js:
   configurarSidebarColapsavel). */
.btn-toggle-sidebar {
  width: 24px; height: 24px; border-radius: 6px; border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.08); color: #fff; display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0; padding: 0;
}
.btn-toggle-sidebar:hover { background: rgba(255,255,255,0.18); }
.btn-toggle-sidebar svg { transition: transform 0.18s ease; }
.sidebar:not(.colapsada) .btn-toggle-sidebar svg { transform: rotate(180deg); }

nav#menu { flex: 1; padding: 8px 0; overflow-y: auto; overflow-x: hidden; }
.menu-grupo { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: #7C97C9; padding: 14px 16px 4px; white-space: nowrap; font-weight: 600; }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 10px 16px;
  background: none; border: none; color: #D9E3F5; font-size: 13.5px; cursor: pointer; border-left: 3px solid transparent;
  text-decoration: none; box-sizing: border-box;
}
.menu-item:hover { background: rgba(255,255,255,0.08); }
.menu-item.ativo { background: rgba(255,255,255,0.14); border-left-color: #93C5FD; color: #fff; font-weight: 600; }
.menu-item-icone { flex-shrink: 0; width: 18px; text-align: center; }
.menu-item-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar-rodape { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,0.12); font-size: 12.5px; }
#usuario-nome-logado { margin-bottom: 8px; color: #D9E3F5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-rodape button {
  width: 100%; padding: 8px; border-radius: 6px; border: 1px solid rgba(255,255,255,0.24);
  background: transparent; color: #fff; cursor: pointer; font-size: 12.5px; white-space: nowrap; overflow: hidden;
}
.sidebar-rodape button:hover { background: rgba(255,255,255,0.1); }

/* ===== Sidebar retraída (padrão) — só ícones ===== */
.sidebar.colapsada { width: 64px; }
.sidebar.colapsada .sidebar-topo { flex-direction: column; padding: 14px 6px 10px; }
.sidebar.colapsada .logo { font-size: 13px; }
.sidebar.colapsada .logo-texto,
.sidebar.colapsada .loja-atual,
.sidebar.colapsada .menu-grupo,
.sidebar.colapsada .menu-item-label,
.sidebar.colapsada #usuario-nome-logado { display: none; }
.sidebar.colapsada .menu-item { justify-content: center; padding: 12px 0; gap: 0; }
.sidebar.colapsada .sidebar-rodape { padding: 12px 6px; }
.sidebar.colapsada .sidebar-rodape button { font-size: 0; padding: 8px 0; }
.sidebar.colapsada #btn-logout::before { content: "🚪"; font-size: 15px; }
.sidebar.colapsada #btn-instalar-app::before { content: "📲"; font-size: 15px; }

/* Em telas estreitas (celular) a versão EXPANDIDA (230px) não cabe do lado do
   conteúdo sem espremer tudo — vira um painel flutuante por cima (o conteúdo
   embaixo fica na largura normal, como se o menu estivesse retraído). A
   versão retraída (64px, o padrão) continua no fluxo normal, sem esse problema. */
@media (max-width: 640px) {
  .sidebar:not(.colapsada) {
    position: fixed; top: 0; left: 0; height: 100vh; z-index: 50;
    box-shadow: 4px 0 24px rgba(13,71,161,0.35);
  }
}

.conteudo { flex: 1; padding: 24px 28px; overflow-y: auto; max-height: 100vh; }

/* ===== COMPONENTES GERAIS ===== */
.cabecalho-view { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.cabecalho-view h2 { margin: 0; font-size: 20px; font-weight: 800; }
.cabecalho-view .acoes { display: flex; gap: 8px; }

.btn {
  padding: 10px 16px; border-radius: 6px; border: 1px solid var(--baseline); background: var(--surface-1);
  cursor: pointer; font-size: 13.5px; font-weight: 500; color: var(--text-primary); min-height: 40px;
}
.btn:hover { background: var(--surface-2); }
.btn-primario { background: var(--brand-accent); border-color: var(--brand-accent); color: #fff; font-weight: 700; }
.btn-primario:hover { background: var(--brand-accent-hover); border-color: var(--brand-accent-hover); }
.btn-perigo { background: var(--critical); border-color: var(--critical); color: #fff; font-weight: 700; }
.btn-perigo:hover { background: var(--critical-hover); border-color: var(--critical-hover); }
.btn-sucesso { background: var(--good); border-color: var(--good); color: #fff; font-weight: 700; }
.btn-sucesso:hover { background: var(--good-hover); border-color: var(--good-hover); }
.btn-atencao { background: var(--warning); border-color: var(--warning); color: #fff; font-weight: 700; }
.btn-atencao:hover { background: var(--warning-hover); border-color: var(--warning-hover); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.cartao {
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px; padding: 18px;
  box-shadow: 0 1px 2px rgba(31,41,55,0.04);
  overflow-x: auto;
}

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  text-align: left; padding: 10px 12px; color: var(--muted); font-weight: 600; font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.03em; border-bottom: 1px solid var(--grid);
}
tbody td { padding: 10px 12px; border-bottom: 1px solid var(--grid); }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: none; }

input, select, textarea {
  font-family: inherit; padding: 8px 10px; border: 1px solid var(--baseline); border-radius: 6px; font-size: 13.5px;
  color: var(--text-primary);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand-accent); box-shadow: 0 0 0 3px rgba(37,99,235,0.12); }

.grade-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.grade-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--text-secondary); font-weight: 500; }
.grade-form .full { grid-column: 1 / -1; }

.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700;
}
.badge-ok { background: rgba(22,163,74,0.12); color: var(--good); }
.badge-alerta { background: rgba(245,158,11,0.16); color: #92400E; }
.badge-critico { background: rgba(239,68,68,0.12); color: var(--critical); }
.badge-neutro { background: var(--surface-2); color: var(--text-secondary); }

/* ===== KPIs / DASHBOARD ===== */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 22px; }
.kpi-card { background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px; padding: 16px 18px; }
.kpi-card .rotulo { font-size: 12px; color: var(--muted); margin-bottom: 6px; font-weight: 500; }
.kpi-card .valor { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi-card .valor.bom { color: var(--good); }
.kpi-card .valor.ruim { color: var(--critical); }

.graficos-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.graficos-grid .cartao { min-height: 300px; }
.graficos-grid h3 { margin: 0 0 12px; font-size: 14px; font-weight: 700; }
.grafico-full { grid-column: 1 / -1; }

/* ===== PDV — venda por toque (categoria + produto) ===== */
.pdv-touch {
  position: relative;
  margin: -24px -28px;
  width: calc(100% + 56px);
  height: 100vh;
  display: flex;
  background: var(--page);
  overflow: hidden;
}

/* rail de categorias */
.pdv-touch-cat {
  width: 104px; flex-shrink: 0; background: var(--surface-1); border-right: 1px solid var(--border);
  padding: 12px 8px; display: flex; flex-direction: column; gap: 6px; overflow-y: auto;
}
.pdv-touch-cat-item {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px;
  border-radius: 10px; border: 1px solid var(--border); background: var(--surface-1); min-height: 64px;
  justify-content: center; font-size: 11px; font-weight: 600; text-align: center; cursor: pointer;
  color: var(--text-primary); line-height: 1.2;
}
.pdv-touch-cat-item:hover { background: var(--surface-2); }
.pdv-touch-cat-item.ativa { color: #fff; border-color: transparent; background: var(--brand-accent); }
.pdv-touch-cat-item svg { flex-shrink: 0; }

/* coluna central */
.pdv-touch-main { flex: 1; display: flex; flex-direction: column; min-width: 0; position: relative; }
.pdv-touch-header {
  display: flex; align-items: center; gap: 12px; padding: 14px 18px; background: var(--brand-dark); color: #fff; flex-wrap: wrap;
}
.pdv-touch-header h2 { margin: 0; font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.pdv-touch-header .texto-secundario { color: #C3D3EE; font-size: 11.5px; }

.pdv-touch-busca { display: flex; align-items: center; gap: 10px; background: var(--surface-1); border-bottom: 1px solid var(--border); padding: 10px 18px; position: relative; }
.pdv-touch-busca svg { flex-shrink: 0; color: var(--muted); }
.pdv-touch-busca input { flex: 1; border: none; outline: none; background: transparent; font-size: 14px; padding: 6px 0; box-shadow: none; }
.pdv-touch-busca input:focus { box-shadow: none; }
.pdv-touch-busca input.pdv-leitura-ok { animation: pdv-flash-ok 0.4s ease; }
.pdv-touch-busca input.pdv-leitura-erro { animation: pdv-flash-erro 0.4s ease; }
.pdv-touch-busca-resultados {
  position: absolute; left: 18px; right: 18px; top: 100%; z-index: 20; background: var(--surface-1);
  border: 1px solid var(--border); border-radius: 0 0 10px 10px; box-shadow: 0 10px 24px rgba(31,41,55,.14);
  max-height: 320px; overflow-y: auto;
}
.pdv-touch-busca-resultados .item-resultado { padding: 10px 14px; cursor: pointer; border-bottom: 1px solid var(--grid); font-size: 13.5px; }
.pdv-touch-busca-resultados .item-resultado:last-child { border-bottom: none; }
.pdv-touch-busca-resultados .item-resultado:hover { background: var(--surface-2); }

.pdv-touch-grid { flex: 1; overflow-y: auto; padding: 18px 20px; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 20px; align-content: start; background: var(--page); }
.pdv-touch-prod {
  background: var(--surface-1); border: 1px solid var(--grid); border-radius: 10px; padding: 10px;
  display: flex; flex-direction: column; gap: 6px; cursor: pointer; position: relative;
  box-shadow: 0 1px 2px rgba(31,41,55,.06); text-align: left; font-family: inherit; min-height: 44px;
}
.pdv-touch-prod:hover { box-shadow: 0 6px 16px rgba(31,41,55,.12); border-color: var(--baseline); transform: translateY(-1px); }
.pdv-touch-prod:active { transform: scale(0.98); }
.pdv-touch-prod-foto { width: 100%; aspect-ratio: 1/1; border-radius: 8px; display: flex; align-items: center; justify-content: center; overflow: hidden; background: var(--surface-2); }
.pdv-touch-prod-foto img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pdv-touch-prod-nome { font-size: 13px; font-weight: 700; line-height: 1.25; }
.pdv-touch-prod-preco { font-size: 13.5px; color: var(--brand-accent); font-weight: 700; }
.pdv-touch-prod-tag { position: absolute; top: 8px; left: 8px; padding: 3px 8px; border-radius: 999px; font-size: 10px; font-weight: 700; background: var(--brand-dark); color: #fff; }
.pdv-touch-prod-estoque { font-size: 11px; color: var(--warning); font-weight: 700; }

/* comanda / carrinho */
.pdv-touch-carrinho { width: 340px; flex-shrink: 0; display: flex; flex-direction: column; background: var(--surface-1); border-left: 1px solid var(--border); overflow-y: auto; }
.pdv-touch-carrinho-header { display: flex; align-items: center; gap: 10px; padding: 16px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 14px; flex-shrink: 0; }
.pdv-touch-carrinho-badge { margin-left: auto; background: var(--brand-accent); color: #fff; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; }
.pdv-touch-carrinho-lista { padding: 4px 14px; display: flex; flex-direction: column; gap: 8px; }
.pdv-touch-carrinho-vazio { color: var(--muted); font-size: 13px; text-align: center; padding: 28px 8px; }
.pdv-touch-item { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--grid); }
.pdv-touch-item-nome { flex: 1; font-size: 12.5px; font-weight: 600; min-width: 0; }
.pdv-touch-item-nome .badge { margin-left: 4px; }
.pdv-touch-item .qtd-input { width: 56px; text-align: center; padding: 5px; font-size: 12.5px; }
.pdv-touch-item-preco { font-size: 12.5px; font-weight: 700; min-width: 62px; text-align: right; }
.pdv-touch-item-remover { background: none; border: none; color: var(--muted); cursor: pointer; padding: 4px; display: flex; }
.pdv-touch-item-remover:hover { color: var(--critical); }

.pdv-touch-secao { padding: 12px 14px; border-top: 1px solid var(--border); }
.pdv-touch-secao-titulo { font-size: 11px; font-weight: 700; letter-spacing: .03em; color: var(--muted); text-transform: uppercase; margin-bottom: 8px; }
.pdv-touch-cliente-chip {
  display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 8px; border: 1px dashed var(--baseline);
  font-size: 12.5px; color: var(--text-secondary); cursor: pointer; background: var(--page);
}
.pdv-touch-cliente-chip.selecionado { border-style: solid; border-color: var(--brand-accent); color: var(--text-primary); background: rgba(37,99,235,0.08); }
.pdv-touch-cliente-cpf {
  display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--page);
}
.pdv-touch-cliente-cpf svg { flex-shrink: 0; color: var(--muted); }
.pdv-touch-cliente-cpf input { flex: 1; border: none; outline: none; background: transparent; font-size: 13px; padding: 2px 0; box-shadow: none; }
.pdv-touch-cliente-cpf input:focus { box-shadow: none; }

.pdv-touch-desconto-linha { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.pdv-touch-desconto-input { display: flex; align-items: center; gap: 6px; }
.pdv-touch-desconto-input input { width: 76px; text-align: right; }
.pdv-touch-desconto-tipo { display: flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.pdv-touch-desconto-tipo-btn {
  width: auto; margin-top: 0; padding: 6px 10px; border: none; background: var(--page); color: var(--text-secondary);
  font-size: 12px; font-weight: 700; cursor: pointer;
}
.pdv-touch-desconto-tipo-btn + .pdv-touch-desconto-tipo-btn { border-left: 1px solid var(--border); }
.pdv-touch-desconto-tipo-btn.ativo { background: var(--brand-dark); color: #fff; }
.pdv-touch-checkbox-inline { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--text-primary); }
.pdv-touch-checkbox-inline input { width: 17px; height: 17px; cursor: pointer; }
.pdv-touch-totais { padding: 12px 14px; border-top: 1px solid var(--border); }
.pdv-touch-linha-total { display: flex; justify-content: space-between; font-size: 12.5px; padding: 3px 0; color: var(--text-secondary); }
.pdv-touch-total { display: flex; justify-content: space-between; align-items: baseline; font-size: 22px; font-weight: 800; margin-top: 4px; }
.pdv-touch-pagamentos-lista { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.pdv-touch-pagamento-linha { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; background: var(--page); border-radius: 8px; padding: 6px 10px; }
.pdv-touch-pagamento-add { display: flex; gap: 6px; }
.pdv-touch-pagamento-add select { flex: 1.3; min-width: 0; }
.pdv-touch-pagamento-add input { flex: 1; min-width: 0; }

/* Meios de recebimento em blocos (mesmo gesto de tocar num produto pra
   adicionar) — o operador digita o valor (opcional) e toca no bloco. Cada
   forma ganha uma cor consistente (ver pdv.js: classeCorForma) — dinheiro em
   navy, cartão em azul, os demais em contorno neutro — pra reconhecimento
   rápido antes mesmo de ler o texto. */
.pdv-modal-pagamento-valor { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 4px 0 10px; }
.pdv-modal-pagamento-valor label { font-size: 11px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); }
.pdv-modal-pagamento-valor input { width: 150px; text-align: right; font-size: 15px; font-weight: 700; padding: 8px 10px; }
.pdv-modal-pagamento-formas { display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 10px; margin-bottom: 14px; }
.pdv-forma-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  background: var(--surface-1); border: 1px solid var(--baseline); border-radius: 10px; padding: 14px 8px;
  cursor: pointer; font-family: inherit; box-shadow: 0 1px 2px rgba(31,41,55,.05); min-height: 76px;
  color: var(--text-primary);
}
.pdv-forma-tile:hover { box-shadow: 0 6px 16px rgba(31,41,55,.14); border-color: var(--brand-accent); transform: translateY(-1px); }
.pdv-forma-tile:active { transform: scale(0.97); }
.pdv-forma-tile-icone { color: var(--brand-dark); display: flex; }
.pdv-forma-tile-nome { font-size: 12.5px; font-weight: 700; text-align: center; line-height: 1.2; }
/* variações de cor por forma de pagamento (ver classeCorForma em pdv.js/mesas.js) */
.pdv-forma-tile.forma-dinheiro { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.pdv-forma-tile.forma-dinheiro .pdv-forma-tile-icone { color: #fff; }
.pdv-forma-tile.forma-dinheiro:hover { background: #0b3a85; border-color: #0b3a85; }
.pdv-forma-tile.forma-cartao { background: var(--brand-accent); border-color: var(--brand-accent); color: #fff; }
.pdv-forma-tile.forma-cartao .pdv-forma-tile-icone { color: #fff; }
.pdv-forma-tile.forma-cartao:hover { background: var(--brand-accent-hover); border-color: var(--brand-accent-hover); }
.pdv-modal-fiscal { display: flex; flex-direction: column; gap: 10px; padding: 12px; margin-bottom: 14px; background: var(--page); border-radius: 8px; border: 1px solid var(--border); }
.pdv-modal-fiscal-flag { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; cursor: pointer; }
.pdv-modal-fiscal-flag input { width: 18px; height: 18px; cursor: pointer; }
.pdv-modal-fiscal-cpf { display: flex; flex-direction: column; gap: 4px; font-size: 11px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); }
.pdv-modal-fiscal-cpf input { text-transform: none; font-size: 14px; font-weight: 600; padding: 8px 10px; letter-spacing: normal; }
.pdv-touch-rodape { padding: 14px; border-top: 1px solid var(--border); flex-shrink: 0; display: flex; flex-direction: column; gap: 8px; }
.pdv-touch-finalizar { width: 100%; background: var(--good); color: #fff; border: none; border-radius: 8px; padding: 14px; font-size: 14.5px; font-weight: 800; min-height: 48px; cursor: pointer; }
.pdv-touch-finalizar:hover { background: var(--good-hover); }
.pdv-touch-finalizar:disabled { opacity: .5; cursor: not-allowed; }

.pdv-touch-faixa-offline { position: absolute; left: 0; right: 0; top: 0; z-index: 30; }


.aviso-caixa-fechado {
  background: rgba(245,158,11,0.12); border: 1px solid rgba(245,158,11,0.4); border-radius: 8px;
  padding: 16px; color: #92400E; margin-bottom: 16px;
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,0.5); display: flex; align-items: center; justify-content: center; z-index: 50;
}
.modal-caixa {
  background: var(--surface-1); border-radius: 10px; padding: 22px; width: 420px; max-width: 92vw; max-height: 88vh; overflow-y: auto;
}
.modal-caixa h3 { margin-top: 0; font-weight: 800; }
.modal-acoes { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

.pdv-modal-pagamento { width: 560px; }
.pdv-modal-pagamento-total { font-size: 14px; color: var(--text-secondary); margin-bottom: 14px; }
.pdv-modal-pagamento-total strong { color: var(--text-primary); font-size: 17px; }
.pdv-modal-pagamento-resumo { display: flex; gap: 12px; margin-top: 12px; }
.pdv-modal-pagamento-resumo > div { flex: 1; background: var(--page); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.pdv-modal-pagamento-resumo > div span:first-child { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.pdv-modal-pagamento-resumo > div span:last-child { font-size: 15px; font-weight: 700; }
.pdv-modal-pagamento-resumo > div.quitado span:last-child { color: var(--good); }
.pdv-modal-pagamento-resumo > div.troco span:last-child { color: var(--good); }

.texto-secundario { color: var(--text-secondary); font-size: 13px; }
.texto-muted { color: var(--muted); font-size: 12px; }
.mt-16 { margin-top: 16px; }

/* ===== RECIBO (ver/reimprimir pedido do caixa — só leitura) ===== */
.recibo-modal { width: 480px; }
.recibo-cabecalho { text-align: center; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px dashed var(--border); }
.recibo-cabecalho h3 { margin-bottom: 2px; }
.recibo-itens-tabela { margin: 12px 0; }
.recibo-itens-tabela th, .recibo-itens-tabela td { padding: 6px 4px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.recibo-itens-tabela th:nth-child(2), .recibo-itens-tabela td:nth-child(2),
.recibo-itens-tabela th:nth-child(3), .recibo-itens-tabela td:nth-child(3),
.recibo-itens-tabela th:nth-child(4), .recibo-itens-tabela td:nth-child(4) { text-align: right; }
.recibo-totais { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--border); }
.recibo-totais > div, .recibo-pagamentos > div { display: flex; justify-content: space-between; font-size: 13px; padding: 2px 0; }
.recibo-total-linha { font-size: 15.5px !important; font-weight: 800; margin-top: 4px; }
.recibo-pagamentos { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--border); }

@media print {
  body.imprimindo-recibo .app,
  body.imprimindo-recibo .modal-overlay > *:not(.recibo-modal),
  body.imprimindo-recibo .recibo-modal > *:not(.recibo-print-area),
  body.imprimindo-recibo #tela-login {
    display: none !important;
  }
  body.imprimindo-recibo .modal-overlay {
    position: static !important; background: none !important; display: block !important;
  }
  body.imprimindo-recibo .recibo-modal {
    width: 100% !important; max-width: 100% !important; box-shadow: none !important; padding: 0 !important;
  }
  body.imprimindo-recibo .recibo-print-area { color: #000 !important; }
}
.vazio { text-align: center; padding: 40px; color: var(--muted); }

/* ===== Adições: fila offline do PDV, feedback de leitura de código, Central de Autorizações ===== */
.faixa-offline {
  background: #FEF3C7;
  color: #92400E;
  border: 1px solid #FCD34D;
  border-radius: 6px;
  padding: 8px 14px;
  margin-bottom: 12px;
  font-size: 13px;
  font-weight: 600;
}
.pdv-busca input.pdv-leitura-ok { animation: pdv-flash-ok 0.4s ease; }
.pdv-busca input.pdv-leitura-erro { animation: pdv-flash-erro 0.4s ease; }
@keyframes pdv-flash-ok {
  0% { box-shadow: 0 0 0 3px rgba(22,163,74,0.35); }
  100% { box-shadow: none; }
}
@keyframes pdv-flash-erro {
  0% { box-shadow: 0 0 0 3px rgba(239,68,68,0.35); }
  100% { box-shadow: none; }
}

/* ===== Mesas + Comanda Eletrônica ===== */
.mesas-grade {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 16px;
}
.mesa-card {
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px; padding: 16px 12px;
  display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer;
  transition: box-shadow .15s ease, transform .1s ease, border-color .15s ease; text-align: center;
}
.mesa-card:hover { box-shadow: 0 6px 16px rgba(31,41,55,.14); transform: translateY(-1px); }
.mesa-card:active { transform: scale(0.98); }
.mesa-card.livre { border-color: var(--border); }
.mesa-card.ocupada { border-color: var(--warning); background: color-mix(in srgb, var(--warning) 8%, var(--surface-1)); }
.mesa-card-numero { font-size: 22px; font-weight: 800; color: var(--text-primary); display:flex; align-items:center; justify-content:center; }
.mesa-card-status { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.mesa-card.ocupada .mesa-card-status { color: #92400E; }
.mesa-card-total { font-size: 13.5px; font-weight: 700; color: var(--text-primary); }
.mesa-card-cap { font-size: 11.5px; color: var(--muted); }

.comanda-itens-lista { display: flex; flex-direction: column; gap: 8px; }
.comanda-item-linha { background: var(--page); border-radius: 8px; padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; }
.comanda-item-topo { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; }
.comanda-item-nome { font-weight: 600; }
.comanda-item-rodape { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; color: var(--text-secondary); }
.comanda-item-obs { font-size: 11.5px; color: var(--warning-hover); background: rgba(245,158,11,0.1); border-radius: 6px; padding: 4px 8px; margin: 2px 0; }
.comanda-item-obs-editar { background: none; border: none; color: var(--brand-accent); cursor: pointer; font-size: 11px; padding: 0; margin-left: 6px; text-decoration: underline; }
.comanda-item-obs-add { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 11px; padding: 2px 0; text-align: left; text-decoration: underline; }

/* Divisão de conta por item (arrastar produto pra uma pessoa) */
.comanda-split-pessoas { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin-bottom: 10px; }
.comanda-split-pessoa {
  border: 1px solid var(--grid); border-radius: 8px; padding: 8px; background: var(--page);
  min-height: 60px; transition: border-color .12s ease, background .12s ease;
}
.comanda-split-pessoa.drag-over { border-color: var(--brand-accent); background: rgba(37,99,235,0.08); }
.comanda-split-pessoa-nome { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.comanda-split-pessoa-valor { font-size: 15px; font-weight: 800; margin: 2px 0 6px; }
.comanda-split-pessoa-itens { display: flex; flex-direction: column; gap: 4px; }
.comanda-split-chip {
  display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 11.5px;
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 6px; padding: 3px 6px; cursor: grab;
}
.comanda-split-chip button { background: none; border: none; color: var(--muted); cursor: pointer; padding: 0; display: flex; }
.comanda-split-chip button:hover { color: var(--critical); }
.comanda-split-compartilhado {
  border: 1px dashed var(--baseline); border-radius: 8px; padding: 8px; margin-bottom: 4px;
  transition: border-color .12s ease, background .12s ease;
}
.comanda-split-compartilhado.drag-over { border-color: var(--brand-accent); background: rgba(37,99,235,0.06); }
.comanda-split-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px;
  padding: 6px 4px; border-bottom: 1px solid var(--grid); cursor: grab;
}
.comanda-split-item:last-child { border-bottom: none; }
.comanda-split-item select { font-size: 11.5px; padding: 3px 4px; }

/* ===== Cozinha (KDS) ===== */
.kds-colunas { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; align-items: start; }
.kds-coluna { background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px; padding: 12px; min-height: 200px; }
.kds-coluna-header { display: flex; align-items: center; justify-content: space-between; font-size: 13px; font-weight: 700; margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.kds-coluna-lista { display: flex; flex-direction: column; gap: 10px; }
.kds-card { background: var(--page); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; border-left: 3px solid var(--brand-accent); }
.kds-card-topo { display: flex; align-items: center; justify-content: space-between; font-size: 12px; font-weight: 700; }
.kds-card-produto { font-size: 14px; font-weight: 700; }
.kds-card-obs { font-size: 12px; color: var(--warning); font-style: italic; }
.kds-card-btn { width: 100%; padding: 7px; font-size: 12.5px; }
@media (max-width: 900px) {
  .kds-colunas { grid-template-columns: 1fr; }
}
.central-autorizacoes-card { border-left: 4px solid var(--warning); }

/* ===== Venda rápida em celular =====
   Desktop/tablet: 3 colunas fixas lado a lado (categorias 104px | grade de
   produtos | carrinho 340px) com rolagem interna em cada uma, tudo dentro de
   100vh. Isso não cabe na largura de um celular — abaixo de 760px empilha
   tudo em coluna única (categorias viram uma faixa horizontal no topo,
   carrinho vai pro final) e a rolagem passa a ser a da página inteira
   (.conteudo), não mais interna a cada painel. */
@media (max-width: 760px) {
  .grade-form { grid-template-columns: 1fr; }
  .graficos-grid { grid-template-columns: 1fr; }
  .conteudo { padding: 16px; }
  .pdv-touch {
    flex-direction: column;
    height: auto;
    min-height: calc(100vh - 32px);
    overflow: visible;
    margin: -16px; width: calc(100% + 32px);
  }
  .pdv-touch-cat {
    width: 100%; flex-direction: row; overflow-x: auto; overflow-y: hidden;
    border-right: none; border-bottom: 1px solid var(--border); padding: 8px;
  }
  .pdv-touch-cat-item { flex-shrink: 0; min-width: 74px; }
  .pdv-touch-main { flex: none; }
  .pdv-touch-grid { overflow-y: visible; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .pdv-touch-busca { position: sticky; top: 0; z-index: 5; }
  .pdv-touch-carrinho {
    width: 100%; border-left: none; overflow-y: visible;
    border-top: 4px solid var(--brand-accent);
  }
}
