body { background: #f4f6f9; }
:root { --lsc: #2F674B; --lsc-escuro: #24533c; --lsc-claro: #6DA979; }
.app-nav { background: var(--lsc); }
.brand-sep { border-left: 1px solid rgba(255,255,255,.45); padding-left: .6rem; font-weight: 600; font-size: 1rem; }
.btn-primary { --bs-btn-bg: var(--lsc); --bs-btn-border-color: var(--lsc); --bs-btn-hover-bg: var(--lsc-escuro); --bs-btn-hover-border-color: var(--lsc-escuro);
  --bs-btn-active-bg: #1d4532; --bs-btn-active-border-color: #1d4532; --bs-btn-disabled-bg: var(--lsc); --bs-btn-disabled-border-color: var(--lsc); }
.btn-outline-primary { --bs-btn-color: var(--lsc); --bs-btn-border-color: var(--lsc); --bs-btn-hover-bg: var(--lsc); --bs-btn-hover-border-color: var(--lsc);
  --bs-btn-active-bg: var(--lsc-escuro); --bs-btn-active-border-color: var(--lsc-escuro); }
.progress-bar.bg-success, .bg-success { background-color: #198754 !important; }
a { color: #24533c; }
.form-check-input:checked { background-color: var(--lsc); border-color: var(--lsc); }
.nav-tabs .nav-link { color: var(--lsc); }
.page-link { color: var(--lsc); } .active > .page-link { background-color: var(--lsc); border-color: var(--lsc); }
/* modo aplicativo instalado: respeita o recorte/notch do celular */
@media (display-mode: standalone) { .app-nav { padding-top: env(safe-area-inset-top); } }
.card { border: 0; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.stat .num { font-size: 1.9rem; font-weight: 700; line-height: 1; }
.stat .lbl { font-size: .8rem; color: #6c757d; text-transform: uppercase; letter-spacing: .03em; }
.table-sm td, .table-sm th { vertical-align: middle; }
.table-responsive { background: #fff; border-radius: .5rem; }

/* Conferência (mobile first) */
#leitor { width: 100%; max-width: 480px; margin: 0 auto; border-radius: .5rem; overflow: hidden; }
#leitor video { border-radius: .5rem; }
/* Leitor de código das telas do SGME (câmera no celular; digitação no computador) */
[data-codigo-leitor] { width: 100%; max-width: 420px; margin: 0 auto; border-radius: .5rem; overflow: hidden; }
[data-codigo-leitor] video { border-radius: .5rem; }
.item-card dt { font-size: .75rem; color: #6c757d; text-transform: uppercase; font-weight: 600; }
.item-card dd { font-size: 1.05rem; margin-bottom: .6rem; word-break: break-word; }
.btn-xl { padding: .9rem 1rem; font-size: 1.15rem; font-weight: 600; }
.local-ok { border-left: 6px solid #198754; }
.local-dif { border-left: 6px solid #ffc107; }
.local-nao { border-left: 6px solid #dc3545; }
.foto-thumb { width: 72px; height: 72px; object-fit: cover; border-radius: .35rem; }
.contexto-bar { background: #fff; border-radius: .5rem; padding: .5rem .75rem; }
.dif { background: #fff3cd; }
@media (max-width: 576px) { main.container-lg { padding-left: .6rem; padding-right: .6rem; } }
.app-nav .nav-link { white-space: nowrap; }
@media (min-width: 1200px) and (max-width: 1500px) { .app-nav .nav-link { padding-left: .45rem !important; padding-right: .45rem !important; font-size: .9rem; } }
.app-nav .navbar-text { white-space: nowrap; }
.app-nav .dropdown-item.active, .app-nav .dropdown-item:active { background: var(--lsc); }

/* tabela com rolagem e cabeçalho fixo */
.tabela-rolagem { max-height: 70vh; overflow: auto; background: #fff; border-radius: .5rem; }
.tabela-rolagem thead th { position: sticky; top: 0; background: #fff; z-index: 1; }

/* contagem rápida, assinatura */
.rapida-box { background:#f6faf7; }
.rapida-on #leitor { outline: 3px solid #2F674B; border-radius: .5rem; }
.assinatura-canvas { width:100%; height:180px; border:1px dashed #9aa; border-radius:.5rem; background:#fff; touch-action:none; }
.flash-ok { animation: flashok .5s; } .flash-erro { animation: flasherro .6s; }
@keyframes flashok { 0%{background:#c9f2cf} 100%{background:transparent} }
@keyframes flasherro { 0%{background:#f8c9c9} 100%{background:transparent} }
.ocr-chip { cursor:pointer; }

/* ===== Layout no estilo do Shift: trilho de ícones + painel recolhível + produtos ===== */
:root { --trilho: 64px; --topo: 60px; --menu-w: 320px; }
body.com-trilho { padding-left: var(--trilho); }
.trilho { position: fixed; inset: 0 auto 0 0; width: var(--trilho); background: var(--lsc); display: flex; flex-direction: column; align-items: center; z-index: 1040; padding-bottom: env(safe-area-inset-bottom); }
.trilho-logo { width: 100%; height: var(--topo); display: flex; align-items: center; justify-content: center; background: var(--lsc-escuro); color: #fff; font-size: 1.6rem; text-decoration: none; }
.trilho-logo:hover { color: #fff; background: #1d4532; }
.trilho-btn { position: relative; width: 100%; height: 50px; border: 0; background: transparent; color: #fff; font-size: 1.25rem; display: flex; align-items: center; justify-content: center; text-decoration: none; opacity: .92; }
.trilho-btn:hover, .trilho-btn:focus-visible { background: rgba(255,255,255,.12); color: #fff; opacity: 1; }
.trilho-btn.ativo { background: rgba(255,255,255,.16); box-shadow: inset 3px 0 0 #fff; }
.trilho-badge { position: absolute; top: 8px; right: 10px; background: #ffc107; color: #212529; font-size: .62rem; font-weight: 700; border-radius: 9px; padding: 0 5px; line-height: 16px; min-width: 16px; }
.trilho-fim { margin-top: auto; width: 100%; display: flex; flex-direction: column; align-items: center; }
.trilho-hora { color: #fff; font-size: .82rem; padding: .35rem 0 .6rem; }
.topo { position: sticky; top: 0; z-index: 1020; height: var(--topo); background: #fff; border-bottom: 1px solid #e6e8eb; display: flex; align-items: center; gap: .75rem; padding: 0 1rem; padding-top: env(safe-area-inset-top); }
.topo-menu { border: 0; background: transparent; font-size: 1.5rem; color: var(--lsc); padding: 0 .25rem; }
.topo-marca { display: flex; align-items: baseline; gap: .75rem; text-decoration: none; }
.marca-produto b { font-style: italic; font-weight: 700; font-size: 1.6rem; color: var(--lsc); letter-spacing: -.02em; }
.marca-produto small { font-size: .78rem; font-weight: 600; color: #6DA979; letter-spacing: .04em; }
.topo-desc { color: #6c757d; font-size: .9rem; border-left: 1px solid #dee2e6; padding-left: .75rem; }
.topo-acoes { margin-left: auto; display: flex; align-items: center; gap: .5rem; }
.topo-icone { position: relative; color: var(--lsc); font-size: 1.3rem; padding: .25rem .5rem; }
.topo-badge { position: absolute; top: -2px; right: -2px; background: #dc3545; color: #fff; font-size: .62rem; font-weight: 700; border-radius: 9px; padding: 0 5px; line-height: 16px; }
.topo-usuario { border: 0; background: transparent; color: #343a40; font-size: .95rem; }
.menu-fundo { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 1045; opacity: 0; pointer-events: none; transition: opacity .2s; }
.menu-fundo.aberto { opacity: 1; pointer-events: auto; }
.menu-painel { position: fixed; top: 0; bottom: 0; left: 0; width: var(--menu-w); max-width: 92vw; background: var(--lsc); color: #fff; z-index: 1050; display: flex; flex-direction: column;
  transform: translateX(-105%); transition: transform .22s ease; box-shadow: 4px 0 18px rgba(0,0,0,.18); padding-top: env(safe-area-inset-top); }
.menu-painel.aberto { transform: none; }
.menu-topo { display: flex; align-items: center; gap: .5rem; min-height: var(--topo); padding: .5rem .9rem; background: var(--lsc-escuro); }
.menu-topo .marca-produto b, .produtos-pop .marca-produto b { color: #fff; }
.menu-topo .marca-produto small { color: #cfe7d6; }
.menu-titulo { display: flex; flex-direction: column; flex: 1; line-height: 1.1; }
.menu-sub { font-size: .95rem; padding-left: .9rem; border-left: 1px solid rgba(255,255,255,.4); margin-top: .25rem; }
.menu-voltar, .menu-fechar { border: 0; background: transparent; color: #fff; font-size: 1.2rem; padding: .25rem .4rem; }
.menu-busca { position: relative; padding: .85rem .9rem; }
.menu-busca input { width: 100%; border: 0; border-radius: 2px; padding: .55rem 2.2rem .55rem .7rem; font-size: .95rem; }
.menu-busca i { position: absolute; right: 1.6rem; top: 50%; transform: translateY(-50%); color: #6c757d; }
.menu-lista { flex: 1; overflow-y: auto; padding-bottom: .5rem; }
.menu-grupo { width: 100%; display: flex; align-items: center; gap: .85rem; border: 0; background: transparent; color: #fff; font-size: 1.05rem; padding: .8rem 1rem; text-align: left; }
.menu-grupo:hover { background: rgba(255,255,255,.1); }
.menu-grupo span { flex: 1; }
.menu-item { display: flex; align-items: center; padding-right: .4rem; }
.menu-item:hover, .menu-item.atual { background: rgba(255,255,255,.12); }
.menu-item.atual { box-shadow: inset 3px 0 0 #fff; }
.menu-item > a:first-child { flex: 1; display: flex; align-items: center; gap: .75rem; color: #fff; text-decoration: none; padding: .7rem 1rem; font-size: .98rem; }
.menu-item > a:first-child span { flex: 1; display: flex; flex-direction: column; }
.menu-item small { font-size: .72rem; opacity: .75; }
.menu-acao { border: 0; background: transparent; color: #fff; opacity: 0; padding: .4rem .45rem; font-size: .95rem; text-decoration: none; }
.menu-item:hover .menu-acao, .menu-acao.on, .menu-acao:focus-visible { opacity: .9; }
.menu-acao.estrela.on { color: #ffd54a; opacity: 1; }
@media (hover: none) { .menu-acao.estrela { opacity: .7; } }
.menu-item.off { color: rgba(255,255,255,.5); gap: .75rem; padding: .7rem 1rem; font-size: .98rem; cursor: default; }
.menu-item.off span { flex: 1; }
.menu-item.off em { font-size: .7rem; font-style: normal; border: 1px solid rgba(255,255,255,.35); border-radius: 9px; padding: 0 6px; }
.menu-badge { background: #ffc107; color: #212529; font-size: .7rem; border-radius: 9px; padding: 0 6px; line-height: 18px; }
.menu-vazio { padding: 1rem; font-size: .9rem; opacity: .85; }
.menu-produtos { border: 0; border-top: 1px solid rgba(255,255,255,.18); background: transparent; color: #fff; text-align: left; padding: .9rem 1rem; font-size: 1rem; }
.produtos-pop { position: fixed; z-index: 1060; width: 270px; background: #fff; border-radius: 4px; box-shadow: 0 6px 24px rgba(0,0,0,.18); display: none; padding-bottom: .5rem; }
.produtos-pop.aberto { display: block; }
.produtos-titulo { padding: .75rem 1rem; font-size: 1rem; border-bottom: 1px solid #eef0f2; }
.produto-item { display: flex; flex-direction: column; padding: .7rem 1rem .7rem 1.2rem; text-decoration: none; border-left: 3px solid transparent; margin: .25rem 0; }
.produto-item.ativo { border-left-color: var(--lsc); }
.produto-item:hover { background: #f4f8f5; }
.produtos-pop .marca-produto b { color: var(--lsc); }
.produto-desc { font-size: .75rem; color: #6c757d; }
.atalhos .atalho { display: block; padding: .6rem 0; border-bottom: 1px solid #eef0f2; text-decoration: none; }
.atalhos .atalho:last-child { border-bottom: 0; }
.atalho-nome { display: block; color: #212529; font-size: 1rem; }
.atalho-sub { display: block; color: #6c757d; font-size: .78rem; }
@media (max-width: 767.98px) {
  body.com-trilho { padding-left: 0; }
  .trilho { display: none; }
  .marca-produto b { font-size: 1.35rem; }
}
@media print { .trilho, .topo, .menu-painel, .produtos-pop, footer { display: none !important; } body.com-trilho { padding-left: 0; } }

/* Visor da câmera em tela cheia (Conferir): o quadro mostra onde a etiqueta precisa estar */
#camera-tela { position: fixed; inset: 0; z-index: 1085; background: #000; }
#camera-tela.d-none { display: none !important; }
#camera-tela #leitor { position: absolute !important; left: 0 !important; right: 0 !important; top: 50% !important; transform: translateY(-50%); width: 100% !important; height: auto !important; max-width: none !important; margin: 0 !important; border-radius: 0 !important; overflow: hidden !important; text-align: center; }
#camera-tela #leitor video { width: auto !important; height: auto !important; max-width: 100% !important; max-height: 100vh !important; display: block; margin: 0 auto; border-radius: 0 !important; }
#camera-tela #leitor > div { position: absolute !important; inset: 0 !important; width: 100% !important; height: 100% !important; }
#camera-tela .camera-topo, #camera-tela .camera-base { position: absolute; left: 0; right: 0; z-index: 2; padding: .6rem .75rem; }
#camera-tela .camera-topo { top: 0; display: flex; align-items: center; gap: .6rem; background: linear-gradient(rgba(0,0,0,.65), transparent); }
#camera-tela .camera-dica { color: #fff; font-weight: 600; font-size: .95rem; text-shadow: 0 1px 2px #000; }
#camera-tela .camera-base { bottom: 0; padding-bottom: calc(.75rem + env(safe-area-inset-bottom, 0px)); background: linear-gradient(transparent, rgba(0,0,0,.75)); }
#camera-tela .camera-alvo { position: absolute; left: 6%; right: 6%; top: 50%; height: 34%; transform: translateY(-50%); z-index: 1; pointer-events: none;
  border: 2px solid #fff; border-radius: .6rem; box-shadow: 0 0 0 100vmax rgba(0,0,0,.45); }

/* Tabelas: ordenação pelo cabeçalho, quantidade por página, paginação e linha de total (assets/tabelas.js) */
th.tb-ordenavel { cursor: pointer; user-select: none; white-space: nowrap; }
th.tb-ordenavel a { color: inherit; }
th.tb-ordenavel:hover { background-color: rgba(0,0,0,.04); }
th.tb-ordenavel .tb-seta { color: #9aa5a0; font-size: .75em; }
th.tb-ord-ativa .tb-seta { color: #0f5132; }
tr.tb-fora { display: none !important; }
tfoot.tb-total td { border-top: 2px solid #dee2e6; }
