:root {
  --mbp-laranja: #f5a926;
  --mbp-grafite: #424242;
  --mbp-laranja-claro: #fcefd3;
  --bs-body-font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --bs-primary: #424242;
  --bs-primary-rgb: 66, 66, 66;
}
body { background: #f3f2ef; color: #2b2b2b; }

.faixa-marca { height: 8px; background: var(--mbp-laranja); }
.logo-box { background: #fff; border: 1px solid #dcd9d3; border-radius: 6px; padding: 8px 12px; display: inline-flex; }
.logo-box img { height: 52px; width: auto; }
.sobretitulo { font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: #8a5a00; font-weight: 600; }

.capa img { width: 100%; height: auto; border-radius: 8px; border: 1px solid #dcd9d3; }

.btn-primary { --bs-btn-bg: var(--mbp-grafite); --bs-btn-border-color: var(--mbp-grafite);
  --bs-btn-hover-bg: #2e2e2e; --bs-btn-hover-border-color: #2e2e2e;
  --bs-btn-active-bg: #222; --bs-btn-active-border-color: #222; }
.btn-outline-primary { --bs-btn-color: var(--mbp-grafite); --bs-btn-border-color: var(--mbp-grafite);
  --bs-btn-hover-bg: var(--mbp-grafite); --bs-btn-hover-border-color: var(--mbp-grafite);
  --bs-btn-active-bg: var(--mbp-grafite); }
.form-control:focus, .form-check-input:focus, .form-select:focus {
  border-color: var(--mbp-laranja); box-shadow: 0 0 0 .2rem rgba(245, 169, 38, .3); }
.form-check-input:checked { background-color: var(--mbp-grafite); border-color: var(--mbp-grafite); }

.aviso-importante { border-left: 4px solid var(--mbp-laranja); padding-left: 12px; }

/* Contatos WhatsApp */
.whats { display: flex; gap: 12px; align-items: center; text-decoration: none; color: inherit;
  border: 1.5px solid #dcd9d3; border-radius: 8px; padding: 12px 14px; background: #fff; height: 100%; }
.whats:hover { border-color: #25d366; color: inherit; }
.whats.ativo { border-color: var(--mbp-laranja); background: var(--mbp-laranja-claro); }
.whats .bi-whatsapp { font-size: 2rem; color: #25d366; line-height: 1; }
.whats .numero { font-family: ui-monospace, Consolas, monospace; }

/* Questões */
.questao { background: #fff; border: 1px solid #dcd9d3; border-radius: 8px; padding: 16px 18px; }
.questao.is-invalid { border-color: var(--bs-danger); }
.questao .num { font-family: ui-monospace, Consolas, monospace; color: #8a5a00; margin-right: 8px; font-size: .9rem; }
.questao .form-label, .questao legend { font-weight: 600; font-size: 1rem; }
.obrig { color: var(--bs-danger); }
.grupo-titulo { font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: #6c6c6c; font-weight: 600; margin: 18px 0 2px; }

/* Escolha de unidade */
.unidade-opcao { position: relative; display: block; border: 1.5px solid #dcd9d3; border-radius: 8px; padding: 14px 16px; cursor: pointer; background: #fafaf8; }
.unidade-opcao input { position: absolute; opacity: 0; }
.unidade-opcao:has(input:checked) { border-color: var(--mbp-laranja); background: var(--mbp-laranja-claro); }
.unidade-opcao:has(input:focus-visible) { outline: 2px solid var(--mbp-grafite); outline-offset: 2px; }
.unidade-opcao strong { display: block; font-size: 1.1rem; }

/* Lista de arquivos escolhidos */
.lista-arquivos { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.lista-arquivos .chip { background: var(--mbp-laranja-claro); border-radius: 4px; padding: 3px 8px; font-size: .85rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Modal de confirmação */
.resumo dt { font-weight: 600; font-size: .9rem; color: #555; margin-top: 10px; }
.resumo dt:first-child { margin-top: 0; }
.resumo dd { margin: 2px 0 0; padding-bottom: 10px; border-bottom: 1px solid #eee; white-space: pre-wrap; word-break: break-word; }
.resumo dd ul { margin: 0; padding-left: 1.2rem; white-space: normal; }
.resumo-arquivos { display: flex; flex-direction: column; gap: 6px; white-space: normal; }
.resumo-arquivo { display: flex; align-items: center; gap: 10px; font-size: .9rem; }
.resumo-arquivo img { width: 56px; height: 56px; object-fit: cover; border-radius: 4px; border: 1px solid #dcd9d3; flex: none; }
.resumo-arquivo .bi { width: 56px; text-align: center; font-size: 1.8rem; color: #6c6c6c; flex: none; }
#modal-confirmacao .modal-header { border-top: 6px solid var(--mbp-laranja); }

/* Galeria de anexos no comprovante */
.anexos-grupo { padding: 12px 0; border-top: 1px solid #eee; }
.anexos-grupo:first-of-type { border-top: 0; padding-top: 4px; }
.num-anexo { font-family: ui-monospace, Consolas, monospace; color: #8a5a00; margin-right: 8px; }
.galeria { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.galeria-item { margin: 0; min-width: 0; }
.galeria-item > a { display: block; aspect-ratio: 1; border: 1px solid #dcd9d3; border-radius: 6px; overflow: hidden; background: #f7f7f5; }
.galeria-item img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.galeria-item > a:hover img { transform: scale(1.04); }
.galeria-icone { display: flex; align-items: center; justify-content: center; height: 100%; font-size: 2.6rem; color: #6c6c6c; }
.galeria-item figcaption { font-size: .8rem; margin-top: 4px; display: flex; flex-direction: column; }
.galeria-item .nome { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Carrossel de fotos (modal) */
#modal-fotos .carrossel-img { width: 100%; height: 75vh; object-fit: contain; background: #111; }
#modal-fotos .carrossel-legenda { display: flex; justify-content: space-between; gap: 12px; padding: 10px 16px; background: #1b1b1b; }
#modal-fotos .carrossel-legenda .text-truncate { min-width: 0; }
#modal-fotos .carousel-control-prev, #modal-fotos .carousel-control-next { width: 10%; bottom: 44px; }
#modal-fotos .carousel-control-prev-icon, #modal-fotos .carousel-control-next-icon { background-color: rgba(0,0,0,.5); border-radius: 50%; padding: 18px; background-size: 55%; }
@media (max-width: 576px) { #modal-fotos .carrossel-img { height: 60vh; } }

/* Área de gestão (admin) */
:root { --un-sudeste: #2f6fc0; --un-nordeste: #c97d00; }
.menu-admin .nav-link { color: var(--mbp-grafite); padding: .4rem .9rem; }
.menu-admin .nav-link.active { background: var(--mbp-grafite); color: #fff; }
.badge-un-sudeste { background: var(--un-sudeste); color: #fff; }
.badge-un-nordeste { background: var(--un-nordeste); color: #fff; }
.kpi { background: #fff; border: 1px solid #dcd9d3; border-radius: 8px; padding: 14px 16px; }
.kpi-rotulo { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: #6c6c6c; font-weight: 600; }
.kpi-valor { font-size: 1.9rem; font-weight: 700; line-height: 1.15; margin-top: 4px; font-variant-numeric: tabular-nums; word-break: break-word; }
.kpi-valor:not(:only-child) { margin-bottom: 2px; }
.kpi-detalhe { font-size: .8rem; color: #6c6c6c; }
.col-6.col-lg-3 .kpi-valor { font-size: clamp(1.1rem, 2.4vw, 1.9rem); }
.kpi .kpi-valor.kpi-texto { font-size: 1.05rem; font-weight: 600; margin-top: 8px; }
.grafico { position: relative; width: 100%; }
.tabela-relatorio td, .tabela-relatorio th { font-variant-numeric: tabular-nums; }
.tabela-relatorio td:first-child, .tabela-relatorio th:first-child { padding-left: 1rem; }
.barra-pct { display: inline-block; width: 60px; height: 6px; background: #ecebe8; border-radius: 3px; margin-right: 8px; vertical-align: middle; overflow: hidden; }
.barra-pct span { display: block; height: 100%; background: #5b6470; border-radius: 3px; }
.marca-un { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--cor); margin-right: 5px; }
@media print {
  .kpi, .questao { break-inside: avoid; }
  .container { max-width: none !important; }
}

/* Comprovante */
.protocolo-num { font-family: ui-monospace, Consolas, monospace; font-size: 1.6rem; color: #1e7a46; }
.texto-protocolo { white-space: pre-wrap; font-family: ui-monospace, Consolas, monospace; font-size: .85rem;
  background: #f7f7f5; border: 1px solid #dcd9d3; border-radius: 6px; padding: 12px; max-height: 340px; overflow: auto; }
.miniatura { width: 90px; height: 90px; object-fit: cover; border-radius: 6px; border: 1px solid #dcd9d3; }

@media print {
  .no-print, .faixa-marca, footer { display: none !important; }
  body { background: #fff; }
  .texto-protocolo { max-height: none; border: 0; }
  .galeria-item { break-inside: avoid; }
}
