/* Souza Smart — estilos compartilhados */
:root {
  --laranja: #EE7623;
  --laranja-esc: #B9520B;
  --laranja-claro: #FFF1E7;
  --azul: #1C2C84;
  --azul-esc: #141F63;
  --azul-claro: #E9ECFA;
  --bg: #F3F5FB;
  --branco: #ffffff;
  --texto: #111827;
  --cinza: #4B5563;
  --cinza-claro: #6B7280;
  --borda: #E2E6F0;
  --verde: #0F7A43;
  --verde-claro: #E4F5EC;
  --vermelho: #B42318;
  --vermelho-claro: #FDECEA;
  --amarelo-claro: #FFF6D6;
  --amarelo: #8A5A00;
  --raio: 14px;
  --sombra: 0 4px 18px rgba(28, 44, 132, 0.08);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: 'Poppins', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--texto);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.5;
}
img { max-width: 100%; display: block; }
a { color: var(--azul); }
a:hover { color: var(--azul-esc); }
h1, h2, h3 { line-height: 1.2; margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 20px; }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 20px; border: 0; border-radius: 10px;
  background: var(--azul); color: #fff; font-weight: 600; cursor: pointer;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--azul-esc); color: #fff; }
.btn:disabled { opacity: .6; cursor: wait; }
.btn-laranja { background: var(--laranja-esc); }
.btn-laranja:hover { background: #9A4409; }
.btn-sec { background: var(--azul-claro); color: var(--azul); }
.btn-sec:hover { background: #DCE1F7; color: var(--azul-esc); }
.btn-perigo { background: var(--vermelho-claro); color: var(--vermelho); }
.btn-perigo:hover { background: #F9D9D5; color: var(--vermelho); }
.btn-whats { background: #0F7A43; }
.btn-whats:hover { background: #0B5E33; }
.btn-peq { min-height: 36px; padding: 6px 12px; font-size: 14px; border-radius: 8px; }
.btn-icone {
  width: 44px; height: 44px; border: 0; border-radius: 10px; background: transparent;
  font-size: 26px; line-height: 1; cursor: pointer; color: var(--cinza);
}
.btn-icone:hover { background: var(--azul-claro); color: var(--azul); }
.btn svg, .chip svg { width: 18px; height: 18px; flex-shrink: 0; }

/* ---------- Formulários ---------- */
.campo { display: flex; flex-direction: column; gap: 6px; }
.campo label { font-size: 13px; font-weight: 600; color: var(--cinza); }
.campo input, .campo select, .campo textarea, .busca {
  width: 100%; min-height: 44px; padding: 10px 12px;
  border: 1.5px solid var(--borda); border-radius: 10px; background: #fff;
}
.campo textarea { min-height: 84px; resize: vertical; }
.campo input:focus, .campo select:focus, .campo textarea:focus, .busca:focus {
  outline: none; border-color: var(--azul); box-shadow: 0 0 0 3px rgba(28, 44, 132, .15);
}
.campo-check { flex-direction: row; align-items: center; gap: 10px; min-height: 44px; }
.campo-check input { width: 20px; height: 20px; min-height: 0; accent-color: var(--azul); }
.campo-check label { font-size: 15px; color: var(--texto); font-weight: 500; }
.dica { font-size: 12px; color: var(--cinza-claro); }
.grade-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.grade-form .inteiro { grid-column: 1 / -1; }
@media (max-width: 560px) { .grade-form { grid-template-columns: 1fr; } }

/* ---------- Chips / etiquetas ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 40px; padding: 8px 16px; border-radius: 999px; border: 1.5px solid var(--borda);
  background: #fff; cursor: pointer; font-weight: 600; font-size: 14px; color: var(--cinza);
  display: inline-flex; align-items: center; gap: 6px;
}
.chip:hover { border-color: var(--azul); color: var(--azul); }
.chip.ativo { background: var(--azul); border-color: var(--azul); color: #fff; }
.etiqueta {
  display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--azul-claro); color: var(--azul); white-space: nowrap;
}
.etiqueta.verde { background: var(--verde-claro); color: var(--verde); }
.etiqueta.vermelho { background: var(--vermelho-claro); color: var(--vermelho); }
.etiqueta.amarelo { background: var(--amarelo-claro); color: var(--amarelo); }
.etiqueta.laranja { background: var(--laranja-claro); color: var(--laranja-esc); }
.etiqueta.cinza { background: #EEF0F4; color: var(--cinza); }

/* ---------- Cartões ---------- */
.cartao { background: #fff; border-radius: var(--raio); box-shadow: var(--sombra); padding: 20px; }
.vazio { text-align: center; color: var(--cinza); padding: 40px 20px; }

/* ---------- Marca ---------- */
.marca { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.marca img { width: 44px; height: 44px; border-radius: 11px; }
.marca strong { font-size: 20px; font-weight: 700; display: block; line-height: 1.1; }
.marca span { font-size: 12px; opacity: .85; }

/* ---------- Aviso modo demonstração ---------- */
.aviso-demo {
  background: var(--amarelo-claro); color: var(--amarelo); font-size: 13px; font-weight: 500;
  padding: 8px 20px; text-align: center;
}

/* ---------- Toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(20px);
  background: var(--texto); color: #fff; padding: 12px 20px; border-radius: 10px;
  font-weight: 500; opacity: 0; pointer-events: none; transition: .25s; z-index: 1000;
  max-width: calc(100% - 40px); text-align: center;
}
#toast.visivel { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.erro { background: var(--vermelho); }

/* =====================================================
   CATÁLOGO PÚBLICO
   ===================================================== */
.cat-topo { background: var(--azul); color: #fff; }
.cat-topo .container { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 76px; }
.cat-hero { background: var(--azul); color: #fff; padding: 28px 0 56px; }
.cat-hero h1 { font-size: clamp(28px, 5vw, 44px); font-weight: 700; }
.cat-hero h1 em { font-style: normal; color: #FFB27A; }
.cat-hero p { margin: 10px 0 0; color: #D3DBFF; max-width: 620px; }
.cat-msg {
  margin-top: 18px; display: inline-block; background: var(--laranja); color: var(--azul-esc);
  font-weight: 700; padding: 10px 18px; border-radius: 10px;
}
.cat-filtros { margin-top: -30px; }
.cat-filtros .cartao { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.cat-filtros .busca { flex: 1 1 240px; }
.cat-grade {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px;
  margin: 24px 0 48px;
}
.produto { background: #fff; border-radius: var(--raio); box-shadow: var(--sombra); overflow: hidden; display: flex; flex-direction: column; }
.produto-foto { aspect-ratio: 1 / 1; background: var(--azul-claro); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.produto-foto img { width: 100%; height: 100%; object-fit: cover; }
.produto-foto .sem-foto { width: 38%; opacity: .5; }
.produto-info { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.produto-info h3 { font-size: 16px; font-weight: 600; }
.produto-info .detalhe { font-size: 13px; color: var(--cinza); }
.preco { font-size: 22px; font-weight: 700; color: var(--azul); }
.preco-antigo { font-size: 14px; color: var(--cinza-claro); text-decoration: line-through; margin-right: 6px; font-weight: 500; }
.produto-acoes { margin-top: auto; padding-top: 8px; }
.produto-acoes .btn { width: 100%; }
.esgotado .produto-foto { filter: grayscale(1); opacity: .7; }
.cat-rodape { background: var(--azul-esc); color: #D3DBFF; padding: 36px 0; font-size: 14px; }
.cat-rodape .container { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.cat-rodape strong { color: #fff; display: block; margin-bottom: 4px; }
.cat-rodape a { color: #fff; }
.cat-rodape .area { font-size: 12px; opacity: .8; }

/* =====================================================
   PAINEL ADMINISTRATIVO
   ===================================================== */
.login-tela { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: var(--azul); }
.login-caixa { width: 100%; max-width: 380px; background: #fff; border-radius: 18px; padding: 32px 28px; display: flex; flex-direction: column; gap: 16px; }
.login-caixa .marca { justify-content: center; margin-bottom: 6px; }
.login-caixa .marca span { color: var(--cinza); }
.login-caixa h1 { font-size: 20px; text-align: center; }
.login-erro { color: var(--vermelho); font-size: 14px; min-height: 20px; margin: 0; }

.app-topo { background: var(--azul); color: #fff; position: sticky; top: 0; z-index: 50; }
.app-topo .container { display: flex; align-items: center; justify-content: space-between; min-height: 64px; gap: 12px; }
.app-topo .marca img { width: 38px; height: 38px; border-radius: 10px; }
.app-topo .marca strong { font-size: 18px; }
.app-nav { display: flex; gap: 4px; }
.app-nav button {
  display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 14px; border: 0;
  border-radius: 10px; background: transparent; color: #D3DBFF; font-weight: 600; cursor: pointer;
}
.app-nav button svg { width: 20px; height: 20px; }
.app-nav button:hover { background: rgba(255,255,255,.08); color: #fff; }
.app-nav button.ativo { background: var(--laranja); color: var(--azul-esc); }
.app-conteudo { padding-top: 24px; padding-bottom: 110px; }
.cab-secao { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.cab-secao h1 { font-size: 26px; color: var(--azul); }
.barra { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.barra .busca { flex: 1 1 220px; width: auto; }
.barra select { min-height: 44px; border: 1.5px solid var(--borda); border-radius: 10px; padding: 0 12px; background: #fff; }

@media (max-width: 860px) {
  .app-nav {
    position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--borda);
    justify-content: space-around; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); z-index: 60;
  }
  .app-nav button { flex-direction: column; gap: 2px; font-size: 11px; padding: 6px 4px; color: var(--cinza); flex: 1; }
  .app-nav button:hover { background: var(--azul-claro); color: var(--azul); }
  .app-nav button.ativo { background: var(--azul-claro); color: var(--azul); }
}

/* Indicadores */
.indicadores { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 22px; }
.indicador { background: #fff; border-radius: var(--raio); box-shadow: var(--sombra); padding: 18px; display: flex; flex-direction: column; gap: 4px; }
.indicador .rotulo { font-size: 13px; color: var(--cinza); font-weight: 600; }
.indicador .valor { font-size: 26px; font-weight: 700; color: var(--azul); }
.indicador .sub { font-size: 12px; color: var(--cinza-claro); }
.indicador.destaque { background: var(--azul); }
.indicador.destaque .rotulo, .indicador.destaque .sub { color: #D3DBFF; }
.indicador.destaque .valor { color: #fff; }
.duas-colunas { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 860px) { .duas-colunas { grid-template-columns: 1fr; } }
.cartao h2 { font-size: 17px; color: var(--azul); margin-bottom: 12px; }

/* Listas */
.lista { display: flex; flex-direction: column; gap: 10px; }
.linha {
  background: #fff; border-radius: 12px; box-shadow: var(--sombra); padding: 12px 14px;
  display: flex; align-items: center; gap: 14px;
}
.linha-mini { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--borda); font-size: 14px; }
.linha-mini:last-child { border-bottom: 0; }
.miniatura { width: 56px; height: 56px; border-radius: 10px; background: var(--azul-claro); object-fit: cover; flex-shrink: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.miniatura img { width: 100%; height: 100%; object-fit: cover; }
.miniatura .sem-foto { width: 50%; opacity: .5; }
.linha-info { flex: 1; min-width: 0; }
.linha-info strong { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.linha-info .meta { font-size: 13px; color: var(--cinza); display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
.linha-valor { text-align: right; font-weight: 700; color: var(--azul); white-space: nowrap; }
.linha-valor small { display: block; font-weight: 500; color: var(--cinza); font-size: 12px; }
.linha-acoes { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.qtd { font-weight: 700; }
.qtd.baixo { color: var(--vermelho); }
.cancelada { opacity: .6; }
.cancelada .linha-valor { text-decoration: line-through; }
@media (max-width: 640px) {
  .linha { flex-wrap: wrap; }
  .linha-info { flex-basis: calc(100% - 70px); }
  .linha-valor { text-align: left; }
  .linha-acoes { width: 100%; justify-content: flex-start; }
}

/* Diálogo */
dialog {
  border: 0; border-radius: 18px; padding: 0; width: min(640px, calc(100% - 24px));
  max-height: calc(100vh - 24px); box-shadow: 0 20px 60px rgba(17, 24, 39, .3);
}
dialog.largo { width: min(980px, calc(100% - 24px)); }
dialog::backdrop { background: rgba(20, 31, 99, .45); }
dialog form { display: flex; flex-direction: column; max-height: calc(100vh - 24px); }
.dlg-cab { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 10px 22px; border-bottom: 1px solid var(--borda); }
.dlg-cab h2 { font-size: 19px; color: var(--azul); }
.dlg-corpo { padding: 18px 22px; overflow-y: auto; }
.dlg-rodape { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 22px 16px; border-top: 1px solid var(--borda); flex-wrap: wrap; }

/* Foto no formulário */
.foto-campo { display: flex; gap: 14px; align-items: center; }
.foto-campo .miniatura { width: 88px; height: 88px; }

/* PDV */
.pdv { display: grid; grid-template-columns: 1.1fr 1fr; gap: 20px; }
@media (max-width: 760px) { .pdv { grid-template-columns: 1fr; } }
.pdv h3 { font-size: 15px; color: var(--azul); margin-bottom: 10px; }
.pdv-resultados { display: flex; flex-direction: column; gap: 6px; max-height: 300px; overflow-y: auto; margin-top: 10px; }
.pdv-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1.5px solid var(--borda);
  border-radius: 10px; background: #fff; cursor: pointer; text-align: left; width: 100%; min-height: 48px;
}
.pdv-item:hover { border-color: var(--azul); }
.pdv-item:disabled { opacity: .5; cursor: not-allowed; }
.pdv-item .nome { flex: 1; font-weight: 600; font-size: 14px; }
.pdv-item .nome small { display: block; font-weight: 500; color: var(--cinza); }
.carrinho { display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.carrinho-linha { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--bg); border-radius: 10px; }
.carrinho-linha .nome { flex: 1; font-size: 14px; font-weight: 600; min-width: 0; }
.carrinho-linha .nome small { display: block; color: var(--cinza); font-weight: 500; }
.contador { display: flex; align-items: center; gap: 4px; }
.contador button { width: 34px; height: 34px; border-radius: 8px; border: 1.5px solid var(--borda); background: #fff; cursor: pointer; font-size: 18px; font-weight: 700; color: var(--azul); }
.contador span { min-width: 26px; text-align: center; font-weight: 700; }
.totais { margin-top: 14px; border-top: 1px solid var(--borda); padding-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.total-final { display: flex; justify-content: space-between; align-items: center; font-size: 22px; font-weight: 700; color: var(--azul); }
.linha-desconto { display: flex; gap: 8px; }
.linha-desconto input { flex: 1; }
.linha-desconto select { width: 80px; }

/* OS */
.status-Recebido, .status-Em-análise { background: var(--azul-claro); color: var(--azul); }
.status-Aguardando-aprovação, .status-Aguardando-peça { background: var(--amarelo-claro); color: var(--amarelo); }
.status-Em-reparo { background: var(--laranja-claro); color: var(--laranja-esc); }
.status-Pronto { background: var(--verde-claro); color: var(--verde); }
.status-Entregue { background: #EEF0F4; color: var(--cinza); }
.status-Cancelado { background: var(--vermelho-claro); color: var(--vermelho); }
.os-numero { font-weight: 700; color: var(--laranja-esc); }

/* Impressão */
@media print {
  .app-topo, .app-nav, .aviso-demo, #toast { display: none !important; }
}

/* Ajustes: imagem padrão, cabeçalho e filtros no celular */
.produto-foto img.sem-foto, .miniatura img.sem-foto { width: 38%; height: auto; object-fit: contain; }
.miniatura img.sem-foto { width: 50%; }
.marca > div { min-width: 0; }
@media (max-width: 600px) {
  .cat-topo .marca span { display: none; }
  .cat-topo .marca strong { white-space: nowrap; }
  #btnWhatsTopo span { display: none; }
  #btnWhatsTopo { padding: 10px 14px; }
  #btnWhatsTopo svg { width: 22px; height: 22px; }
  .cat-filtros .chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
  .cat-filtros .chip { flex-shrink: 0; }
  .cat-grade { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .produto-info { padding: 10px 12px 12px; }
  .produto-info h3 { font-size: 14px; }
  .preco { font-size: 18px; }
  .produto-acoes .btn { font-size: 13px; padding: 8px 10px; white-space: normal; }
}

/* Menu de modelo (películas e outros produtos com variações) */
.modelo-sel {
  width: 100%; min-height: 44px; padding: 8px 10px; margin: 2px 0 4px;
  border: 1.5px solid var(--borda); border-radius: 10px; background: #fff; font-size: 13px; color: var(--texto); text-overflow: ellipsis;
}
.modelo-sel:focus { outline: none; border-color: var(--azul); box-shadow: 0 0 0 3px rgba(28, 44, 132, .15); }

/* Leitor de código de barras */
dialog.leitor { width: min(440px, calc(100% - 24px)); }
.leitor-caixa { padding: 18px; display: flex; flex-direction: column; gap: 14px; align-items: stretch; text-align: center; }
.leitor-caixa h2 { font-size: 16px; color: var(--azul); }
#leitorVideo { width: 100%; min-height: 240px; background: #111; border-radius: 12px; overflow: hidden; }
#leitorVideo video { width: 100% !important; border-radius: 12px; }

@media (max-width: 560px) {
  .dlg-rodape { gap: 8px; padding: 10px 16px 14px; }
  .dlg-rodape .btn { min-height: 42px; padding: 8px 14px; font-size: 14px; }
}

/* Fotos da ordem de serviço */
.os-fotos { display: flex; flex-wrap: wrap; gap: 10px; }
.os-fotos:empty { display: none; }
.os-foto { position: relative; width: 84px; height: 84px; }
.os-foto-ver { width: 100%; height: 100%; padding: 0; border: 1.5px solid var(--borda); border-radius: 10px; overflow: hidden; cursor: zoom-in; background: var(--bg); }
.os-foto-ver img { width: 100%; height: 100%; object-fit: cover; }
.os-foto-x { position: absolute; top: -8px; right: -8px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: var(--vermelho); color: #fff; font-size: 18px; line-height: 1; cursor: pointer; }
dialog.foto-grande { width: min(720px, calc(100% - 24px)); }
dialog.foto-grande form { padding: 12px; gap: 10px; align-items: center; }
dialog.foto-grande img { max-width: 100%; max-height: calc(100vh - 120px); border-radius: 10px; }

/* Formulário de OS */
.os-sec { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--azul); border-bottom: 2px solid var(--laranja); padding-bottom: 6px; margin: 10px 0 0; }
.os-sec:first-child { margin-top: 0; }
.os-rot { font-size: 13px; font-weight: 600; color: var(--cinza); }
.os-itens { display: flex; flex-direction: column; gap: 8px; }
.os-item { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; background: var(--bg); padding: 8px; border-radius: 10px; }
.os-item input { min-height: 40px; padding: 6px 10px; border: 1.5px solid var(--borda); border-radius: 8px; background: #fff; flex: 1 1 160px; min-width: 0; }
.os-item .os-item-qtd { flex: 0 0 56px; text-align: center; }
.os-item .os-item-valor { flex: 0 0 96px; }
.os-item-tag { flex: 0 0 auto; }
.os-add-item { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.os-add-item .busca { flex: 1 1 200px; }
.os-total { font-size: 24px; font-weight: 700; color: var(--azul); min-height: 44px; display: flex; align-items: center; }
