:root {
  --azul: #0b5ed7;
  --azul-escuro: #063f91;
  --azul-profundo: #042a63;
  --verde: #16875a;
  --vermelho: #dc3545;
  --laranja: #f59e0b;
  --cinza-fundo: #eef2f8;
  --cinza-card: #ffffff;
  --cinza-borda: #dbe3ee;
  --texto: #1c2536;
  --texto-suave: #64748b;
  --sombra: 0 10px 26px rgba(15, 42, 90, 0.08);
  --sombra-forte: 0 16px 34px rgba(15, 42, 90, 0.14);
  --raio: 18px;
  --fonte: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

html { width: 100%; min-height: 100%; overflow-x: hidden; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
*, *::before, *::after { box-sizing: border-box; }

body {
  width: 100%; min-height: 100%; margin: 0; overflow-x: hidden;
  background: var(--cinza-fundo); font-family: var(--fonte);
  color: var(--texto); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}

.app { width: 100%; max-width: 1180px; margin: 0 auto; padding: 16px; }

/* ===================== HEADER ===================== */
header.topbar {
  width: 100%; background: linear-gradient(135deg, var(--azul-profundo), var(--azul));
  color: #fff; padding: 24px; border-radius: var(--raio); box-shadow: var(--sombra-forte); margin-bottom: 18px;
  display: flex; flex-wrap: wrap; gap: 20px; align-items: center; justify-content: space-between;
}
.institution { display: flex; align-items: center; gap: 16px; min-width: 0; }
.logo-box { width: 64px; height: 64px; border-radius: 14px; background: #fff; display: flex; align-items: center; justify-content: center; overflow: hidden; flex: 0 0 auto; }
.logo-box img { width: 90%; height: auto; }
.institution-copy { min-width: 0; }
.environment { display: inline-block; background: rgba(255,255,255,0.16); border: 1px solid rgba(255,255,255,0.35); padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; letter-spacing: 0.5px; margin-bottom: 6px; }
.institution-copy h1 { margin: 0; font-size: clamp(20px, 3.5vw, 26px); line-height: 1.2; font-weight: 700; overflow-wrap: anywhere; }
.institution-copy p { margin: 4px 0 0; font-size: 15px; opacity: 0.95; }
.institution-copy small { opacity: 0.8; }

.header-widgets { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.date-widget, .weather-widget {
  background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.28);
  border-radius: 14px; padding: 12px 16px; display: flex; gap: 10px; align-items: center; min-width: 190px;
}
.date-widget div, .weather-widget div { display: flex; flex-direction: column; line-height: 1.35; }
.date-widget strong, .weather-widget strong { font-size: 15px; }
.date-widget b, .weather-widget b { font-weight: normal; font-size: 13px; opacity: 0.9; }
.date-widget span, .weather-widget span { font-size: 12px; opacity: 0.85; }
.widget-icon, .weather-icon { font-size: 22px; }

/* Sessão / logout — injetado por auth.js */
.sessao-usuario { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 0 2px 12px; }
.sessao-email { font-size: 12.5px; color: var(--texto-suave); font-weight: 600; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sessao-sair { min-height: auto; padding: 6px 16px; font-size: 12px; font-weight: 700; background: #fff; border: 1px solid var(--cinza-borda); color: var(--azul-escuro); border-radius: 20px; }
.sessao-sair:hover { filter: none; background: #f0f5fc; border-color: #cfdcf0; }

/* ===================== NAV / ACESSO RÁPIDO ===================== */
.section-heading { display: flex; align-items: center; gap: 12px; margin: 20px 0 14px; }
.section-heading h2 { margin: 0; font-size: 20px; font-weight: 700; color: var(--azul-escuro); white-space: nowrap; }
.section-heading span { flex: 1; height: 1px; background: var(--cinza-borda); }

.quick-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; margin-bottom: 24px; }
.quick-card {
  background: var(--cinza-card); border: 1px solid #e8edf5; border-radius: 16px; padding: 18px;
  box-shadow: var(--sombra); text-decoration: none; color: var(--texto); cursor: pointer;
  display: flex; flex-direction: column; gap: 8px; transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.quick-card:hover { transform: translateY(-2px); box-shadow: var(--sombra-forte); border-color: #cfdcf0; }
.quick-card .icon { font-size: 26px; }
.quick-card strong { font-size: 15px; font-weight: 700; }
.quick-card small { color: var(--texto-suave); font-size: 12.5px; line-height: 1.4; }
.quick-card .badge-count { display:inline-block; background:var(--vermelho); color:#fff; font-size:11px; font-weight:700; border-radius:20px; padding:2px 8px; margin-left:6px; }

/* ===================== DASHBOARD AO VIVO ===================== */
.hmef-live-dashboard { background: var(--cinza-card); border: 1px solid #e8edf5; border-radius: var(--raio); box-shadow: var(--sombra); padding: 20px; margin-bottom: 24px; }
.hmef-live-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; flex-wrap: wrap; gap: 10px; }
.hmef-live-header strong { color: var(--azul-escuro); font-size: 16px; font-weight: 700; }
.hmef-live-header small { color: var(--texto-suave); margin-left: 8px; }
.hmef-live-dot { display:inline-block; width:9px; height:9px; border-radius:50%; background: var(--verde); margin-right:6px; box-shadow: 0 0 0 4px rgba(22,135,90,0.14); }
.hmef-refresh-button { background: var(--azul); color:#fff; border:none; border-radius:10px; padding:8px 14px; font-weight:700; cursor:pointer; }
.hmef-filtro-periodo { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.hmef-filtro-periodo select { min-height: 38px; padding: 8px 10px; font-size: 13px; width: auto; min-width: 110px; }

.hmef-status { font-size: 13px; color: var(--texto-suave); margin-bottom: 14px; }

.hmef-terminais-botao {
  min-height: 0; padding: 4px 12px; font-size: 14px; font-weight: 700;
  background: #eaf2fd; color: var(--azul-escuro); border-radius: 20px;
}
.hmef-terminais-botao:hover { background: var(--azul); color: #fff; }

.hmef-produtos-filtro { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.hmef-produtos-rotulo { font-size: 13px; color: var(--texto-suave); font-weight: 600; }
.hmef-produtos-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.hmef-produto-chip { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; min-height: 38px; border-radius: 999px; border: 1px solid #cfdaea; background: #fff; color: var(--texto-suave); font-size: 13px; font-weight: 600; cursor: pointer; user-select: none; transition: background .15s, border-color .15s, color .15s; }
.hmef-produtos-chips .hmef-produto-chip { margin: 0; display: inline-flex; width: auto; }
.hmef-produtos-chips .hmef-produto-chip input { width: 16px; height: 16px; min-height: 0; padding: 0; margin: 0; accent-color: var(--azul-escuro); cursor: pointer; }
.hmef-produto-todos { background: none; border: none; color: var(--azul); font-size: 13px; font-weight: 600; cursor: pointer; padding: 8px 6px; min-height: 38px; text-decoration: underline; }
.hmef-produto-chip.ativo { background: #eaf1fb; border-color: var(--azul); color: var(--azul-escuro); }
.hmef-consumo-acoes { display: flex; gap: 8px; flex-wrap: wrap; }
.hmef-consumo-acoes .hmef-refresh-button { background: var(--azul-escuro); }

.hmef-modal-fundo {
  position: fixed; inset: 0; background: rgba(4, 42, 99, 0.45); z-index: 1000;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.hmef-modal-caixa {
  width: 100%; max-width: 400px; background: var(--cinza-card); border-radius: var(--raio);
  box-shadow: var(--sombra-forte); padding: 22px 24px;
}
/* Padrão para modal com conteúdo que pode crescer (listas, checklists, várias
   entradas): a caixa toda vira uma coluna com altura máxima; cabeçalho e o
   rodapé de botões ficam fixos, só o meio rola. Evita o botão "Fechar" sumir
   da tela em telas menores. */
.hmef-modal-caixa-rolavel { max-height: 88vh; display: flex; flex-direction: column; padding-bottom: 0; }
.hmef-modal-caixa-rolavel > h3 { flex: 0 0 auto; }
.hmef-modal-caixa-rolavel > p { flex: 0 0 auto; }
.hmef-modal-corpo-rolavel { overflow-y: auto; flex: 1 1 auto; min-height: 0; padding-right: 2px; }
.hmef-modal-rodape-fixo { flex: 0 0 auto; display: flex; justify-content: flex-end; gap: 10px; padding: 14px 0; background: var(--cinza-card); position: sticky; bottom: 0; }
.hmef-status.error { color: var(--vermelho); }

.hmef-metrics-grid { display: grid; grid-template-columns: repeat(6, minmax(0,1fr)); gap: 12px; margin-bottom: 20px; }
.hmef-metric-card { background: #f6f9fd; border: 1px solid #e5eaf3; border-radius: 14px; padding: 14px; display: flex; gap: 10px; align-items: center; }
.hmef-metric-clicavel { cursor: pointer; transition: box-shadow .15s ease, border-color .15s ease; }
.hmef-metric-clicavel:hover { box-shadow: var(--sombra); border-color: #cfdcf0; }
.hmef-metric-card.attention { background: #fff8ec; border-color: #fbe3b8; }
.hmef-metric-icon { font-size: 22px; }
.hmef-metric-card strong { font-size: 20px; font-weight: 700; display: block; }
.hmef-metric-card small { color: var(--texto-suave); font-size: 12px; }

.hmef-dashboard-details { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
.hmef-data-card { background: #f6f9fd; border: 1px solid #e5eaf3; border-radius: 14px; padding: 16px; }
.hmef-card-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.hmef-card-heading h3 { margin: 0; font-size: 15px; font-weight: 700; color: var(--azul-escuro); }
.hmef-card-heading span { font-size: 12px; color: var(--texto-suave); }

.hmef-resumo-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 18px; }
.hmef-resumo-tile { background: #f6f9fd; border: 1px solid #e5eaf3; border-radius: 16px; padding: 22px 18px; text-align: center; }
.hmef-resumo-icon { font-size: 28px; display: block; margin-bottom: 8px; }
.hmef-resumo-tile strong { font-size: 30px; font-weight: 700; display: block; color: var(--azul-escuro); line-height: 1.1; }
.hmef-resumo-tile small { color: var(--texto-suave); font-size: 13px; display: block; margin-top: 4px; }
.hmef-resumo-barra { height: 6px; border-radius: 4px; background: #e5eaf3; margin-top: 14px; overflow: hidden; }
.hmef-resumo-barra-fill { height: 100%; border-radius: 4px; background: var(--azul); width: 0%; transition: width .4s ease; }

.hmef-table-wrap { overflow-x: auto; }
.hmef-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.hmef-table th { text-align: left; color: var(--texto-suave); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; padding: 6px 8px; border-bottom: 1px solid var(--cinza-borda); }
.hmef-table td { padding: 8px; border-bottom: 1px solid #eef1f5; }

/* ===================== CAIXA DE NOVIDADES ===================== */
.hmef-novidades { width: 100%; max-width: 580px; max-height: 90vh; display: flex; flex-direction: column; background: var(--cinza-card); border-radius: 22px; box-shadow: 0 24px 60px rgba(4, 42, 99, 0.35); overflow: hidden; }
.hmef-novidades-topo { display: flex; align-items: center; gap: 14px; padding: 22px 24px; color: #fff; background: linear-gradient(135deg, var(--azul-profundo), var(--azul)); }
.hmef-novidades-icone { width: 48px; height: 48px; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; font-size: 24px; border-radius: 14px; background: rgba(255,255,255,0.16); border: 1px solid rgba(255,255,255,0.35); }
.hmef-novidades-topo h3 { margin: 0; font-size: 20px; font-weight: 700; color: #fff; }
.hmef-novidades-topo p { margin: 3px 0 0; font-size: 13px; opacity: 0.9; }
.hmef-novidades-corpo { padding: 8px 24px 4px; overflow-y: auto; background: #f8fafd; }
.hmef-novidades-data { display: flex; align-items: center; gap: 10px; margin: 16px 0 10px; }
.hmef-novidades-data::after { content: ""; flex: 1; height: 1px; background: var(--cinza-borda); }
.hmef-novidades-data span { font-size: 11.5px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; color: var(--azul-escuro); background: #e6effc; padding: 4px 12px; border-radius: 20px; }
.hmef-novidades-item { display: flex; gap: 12px; align-items: flex-start; background: #fff; border: 1px solid #e8edf5; border-radius: 14px; padding: 12px 14px; margin-bottom: 10px; box-shadow: 0 2px 8px rgba(15, 42, 90, 0.04); }
.hmef-novidades-item-icone { width: 38px; height: 38px; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; font-size: 19px; border-radius: 12px; background: #eef4fd; }
.hmef-novidades-item-titulo { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hmef-novidades-item-titulo strong { font-size: 14.5px; color: var(--texto); }
.hmef-novidades-item p { margin: 3px 0 0; font-size: 13px; line-height: 1.5; color: var(--texto-suave); }
.hmef-novidades-tag { font-size: 10.5px; font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase; padding: 2px 8px; border-radius: 20px; }
.hmef-novidades-tag.tag-novo { background: #e3f6ec; color: var(--verde); }
.hmef-novidades-tag.tag-melhoria { background: #e6effc; color: var(--azul-escuro); }
.hmef-novidades-tag.tag-regra { background: #fff3dc; color: #b45309; }
.hmef-novidades-rodape { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 24px; border-top: 1px solid #e8edf5; background: #fff; }
.hmef-novidades-rodape small { color: var(--texto-suave); font-size: 12px; }
.hmef-novidades-rodape button { min-height: 44px; padding: 10px 28px; }

.hmef-table tr.hmef-linha-total td { font-weight: 700; color: var(--azul-escuro); background: #eaf1fb; border-top: 2px solid var(--azul); border-bottom: none; }

.hmef-modal-caixa-larga { max-width: min(94vw, 900px); }
.hmef-table-wrap-alta { max-height: 60vh; overflow-y: auto; }
.hmef-table-wrap-alta .hmef-table th { position: sticky; top: 0; background: var(--cinza-card); z-index: 1; }
.hmef-table-wrap-alta .hmef-table td:nth-child(1),
.hmef-table-wrap-alta .hmef-table td:nth-child(2) { white-space: nowrap; }
.hmef-table-wrap-alta .hmef-table tbody tr:nth-child(even) { background: #f8fafc; }

.hmef-pending-list { display: flex; flex-direction: column; gap: 10px; }
.hmef-pending-item { display: flex; gap: 10px; background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 10px; align-items: flex-start; }
.hmef-pending-clicavel { cursor: pointer; transition: box-shadow .15s ease, border-color .15s ease; }
.hmef-pending-clicavel:hover { box-shadow: var(--sombra); border-color: #cfdcf0; }
.hmef-priority { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 20px; white-space: nowrap; }
.hmef-priority.high { background: #fee2e2; color: #991b1b; }
.hmef-priority.medium { background: #ffedd5; color: #9a3412; }
.hmef-priority.low { background: #dcfce7; color: #166534; }
.hmef-pending-item strong { font-size: 13px; }
.hmef-pending-item p { margin: 2px 0; font-size: 12.5px; color: var(--texto); }
.hmef-pending-item small { color: var(--texto-suave); font-size: 11.5px; }
.hmef-empty { color: var(--texto-suave); font-size: 13px; padding: 8px 0; }
.hmef-empty.error { color: var(--vermelho); }

/* ===================== CARDS GENÉRICOS (formulário e páginas internas) ===================== */
.card { width: 100%; min-width: 0; background: var(--cinza-card); border-radius: var(--raio); box-shadow: var(--sombra); padding: 20px; border: 1px solid #e8edf5; margin-bottom: 18px; }
.card h2 { margin: 0 0 16px; font-size: clamp(19px, 3.5vw, 22px); font-weight: 700; line-height: 1.25; color: var(--azul-escuro); overflow-wrap: anywhere; }
.card h3 { margin: 18px 0 10px; font-size: 17px; font-weight: 700; line-height: 1.3; color: var(--verde); overflow-wrap: anywhere; }
.card p { margin: 5px 0 15px; color: var(--texto-suave); font-size: 14px; line-height: 1.45; }

.grid-2, .grid-3, .setores-grid { display: grid; width: 100%; align-items: start; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.grid-2 > *, .grid-3 > *, .setores-grid > * { min-width: 0; }

label { display: block; max-width: 100%; font-weight: 600; font-size: 14px; line-height: 1.35; margin: 10px 0 6px; color: #3a4457; overflow-wrap: anywhere; }

input, select, textarea {
  display: block; width: 100%; max-width: 100%; min-width: 0; min-height: 50px; margin: 0; padding: 13px 14px;
  border: 1px solid var(--cinza-borda); border-radius: 12px; font-family: var(--fonte);
  font-size: 16px; line-height: 1.25; color: var(--texto); background-color: #ffffff; outline: none; box-shadow: none;
}
select { position: relative; z-index: 2; cursor: pointer; -webkit-appearance: menulist; -moz-appearance: menulist; appearance: auto; padding-right: 12px; }
input[type="date"] { min-width: 0; }
input:focus, select:focus, textarea:focus { border-color: var(--azul); box-shadow: 0 0 0 3px rgba(11, 94, 215, 0.14); }
input:disabled, input[readonly], select:disabled, textarea:disabled { opacity: 1; color: #4b5563; background: #f5f5f5; cursor: not-allowed; }
textarea { min-height: 90px; resize: vertical; overflow-wrap: anywhere; }

button {
  max-width: 100%; min-height: 48px; border: none; border-radius: 14px; padding: 13px 16px; font-family: inherit;
  font-size: 15px; font-weight: 700; line-height: 1.25; cursor: pointer; background: var(--verde); color: #fff;
  transition: filter .2s ease, transform .2s ease; touch-action: manipulation;
}
button:hover { filter: brightness(0.95); transform: translateY(-1px); }
button:active { transform: translateY(0); }
button.secundario { background: var(--azul); }
button.perigo { background: var(--vermelho); }
button.largo { width: 100%; margin-top: 20px; font-size: 17px; padding: 16px; }
button.voltar { background: rgba(255,255,255,0.16); border: 1px solid rgba(255,255,255,0.35); color: #fff; }

/* Botão de anexar arquivo — substitui o botão feio padrão do navegador */
.upload-input-oculto { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.upload-arquivo { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; min-height: 50px; }
.upload-botao {
  display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; cursor: pointer;
  background: var(--azul); color: #fff; font-weight: 700; font-size: 14px;
  padding: 12px 18px; border-radius: 12px; margin: 0; transition: filter .2s ease, transform .2s ease;
}
.upload-botao:hover { filter: brightness(0.95); transform: translateY(-1px); }
.upload-botao:active { transform: translateY(0); }
.upload-nome { font-size: 13px; color: var(--texto-suave); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Blocos recolhíveis pros grids por setor — menos "planilha" na tela */
.setor-accordion { margin-top: 4px; }
.setor-accordion summary {
  cursor: pointer; list-style: none; font-weight: 600; font-size: 14px; color: var(--azul);
  padding: 12px 14px; background: #f0f5fc; border: 1px solid #dce6f5; border-radius: 12px;
  display: flex; align-items: center; justify-content: space-between;
}
.setor-accordion summary::-webkit-details-marker { display: none; }
.setor-accordion summary::after { content: "▾"; transition: transform .15s ease; }
.setor-accordion[open] summary::after { transform: rotate(180deg); }
.setor-accordion[open] summary { border-radius: 12px 12px 0 0; margin-bottom: 12px; }
.setor-accordion .setores-grid { margin-top: 0; }

.setores-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.setor-linha { display: grid; grid-template-columns: minmax(0, 1fr) 90px; align-items: center; gap: 10px; width: 100%; min-width: 0; background: #f6f9fd; border: 1px solid #e5eaf3; padding: 10px; border-radius: 12px; }
.setor-linha span { min-width: 0; font-weight: 600; font-size: 14px; line-height: 1.3; overflow-wrap: anywhere; }
.setor-linha input { width: 100%; min-width: 0; padding: 9px; text-align: center; }

.pendencia-box { width: 100%; min-width: 0; background: linear-gradient(180deg, #eaf7f0, #ffffff); border: 1px solid #cdeadb; border-radius: var(--raio); padding: 16px; margin-top: 10px; }

/* Seções do formulário de plantão que abrem/recolhem ao clicar (da 3 em diante) */
.secao-recolhivel > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; }
.secao-recolhivel > summary::-webkit-details-marker { display: none; }
.secao-recolhivel > summary h2 { margin: 0; flex: 1; }
.secao-recolhivel > summary::after { content: "▾"; color: var(--azul); font-size: 20px; line-height: 1; transition: transform .15s ease; }
.secao-recolhivel[open] > summary::after { transform: rotate(180deg); }
.secao-recolhivel[open] > summary { margin-bottom: 16px; }
[hidden] { display: none !important; }
/* "Voltar às caixas": o botão .voltar padrão é translúcido (feito para o cabeçalho azul); aqui fica sobre fundo claro, então é azul cheio */
.voltar.voltar-caixas { background: var(--azul-escuro, #063f91); color: #fff; border: 1px solid var(--azul-escuro, #063f91); border-radius: 12px; padding: 10px 18px; font-weight: 700; margin: 0 0 14px; box-shadow: 0 4px 12px rgba(6,63,145,0.22); }
.voltar.voltar-caixas:hover { filter: brightness(1.12); }
.secao-recolhivel.painel-fixo > summary { cursor: default; }
.secao-recolhivel.painel-fixo > summary::after { display: none; }
.adm-contagem { font-weight: 700; color: var(--azul); }
/* Caixa que leva a outra tela (mesmo visual das seções recolhíveis, com seta para o lado) */
.secao-link { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; cursor: pointer; }
.secao-link > div { flex: 1; min-width: 0; }
.secao-link h2 { margin: 0; }
.secao-link p { margin: 6px 0 0; font-size: 13.5px; color: var(--texto-suave); }
.secao-link::after { content: "›"; color: var(--azul); font-size: 28px; line-height: 1; }
.secao-link:hover { box-shadow: 0 6px 18px rgba(6,63,145,0.14); }
.secao-status { font-size: 11.5px; font-weight: 700; padding: 3px 10px; border-radius: 20px; background: #eef2f7; color: var(--texto-suave); white-space: nowrap; }
.secao-status.preenchido { background: #e3f6ec; color: var(--verde); }

.auditoria-barra { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

.assinatura-caixa { width: 100%; height: 160px; background: #fff; border: 1.5px dashed var(--cinza-borda); border-radius: 12px; margin-top: 6px; touch-action: none; }
.assinatura-caixa canvas { width: 100%; height: 100%; display: block; border-radius: 12px; }
.lista-pendencias { width: 100%; min-width: 0; margin-top: 14px; }
.item-pendencia { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; width: 100%; min-width: 0; background: #fff; border: 1px solid #e5e7eb; border-left: 6px solid var(--verde); border-radius: 14px; padding: 12px; margin-bottom: 10px; box-shadow: 0 4px 12px rgba(0,0,0,0.05); }
.item-pendencia.alta { border-left-color: var(--vermelho); }
.item-pendencia.media { border-left-color: var(--laranja); }
.item-pendencia.baixa { border-left-color: var(--verde); }
.badge { display: inline-block; max-width: 100%; padding: 5px 9px; border-radius: 20px; font-size: 12px; font-weight: 700; }
.badge.alta { background: #fee2e2; color: #991b1b; }
.badge.media { background: #ffedd5; color: #9a3412; }
.badge.baixa { background: #dcfce7; color: #166534; }

.admin-acoes { display: flex; gap: 6px; flex-wrap: wrap; }
.admin-acoes button { min-height: 34px; padding: 7px 10px; font-size: 12.5px; }

.pendencia-acoes { display: flex; align-items: flex-start; }
.conclusao-form { width: 240px; max-width: 100%; }
.conclusao-form label { margin: 8px 0 4px; font-size: 12.5px; }
.conclusao-form textarea { min-height: 60px; }
.conclusao-form input, .conclusao-form textarea { padding: 9px 10px; min-height: 38px; font-size: 13.5px; }
.conclusao-botoes { display: flex; gap: 8px; margin-top: 10px; }
.conclusao-botoes button { min-height: 38px; padding: 8px 12px; font-size: 13px; flex: 1; }

.link-observacoes {
  background: transparent; color: var(--azul); font-weight: 600; font-size: 12.5px;
  padding: 6px 0; min-height: auto; text-align: left; width: auto;
}
.link-observacoes:hover { filter: none; transform: none; text-decoration: underline; }
.observacao-item { background: #f6f9fd; border: 1px solid #e5eaf3; border-radius: 10px; padding: 8px 10px; margin-bottom: 8px; font-size: 13px; }
.observacao-item strong { font-size: 12.5px; }
.observacao-item .obs-data { font-size: 11.5px; color: var(--texto-suave); }
.observacao-item p { margin: 4px 0 0; }

.incident-clicavel { cursor: pointer; transition: box-shadow .15s ease, transform .15s ease; }
.incident-clicavel:hover { box-shadow: 0 6px 16px rgba(0,0,0,0.08); transform: translateY(-1px); }

#mensagem { width: 100%; margin-top: 16px; text-align: center; font-weight: 700; }

/* ===================== TOAST ===================== */
.toast {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -46%); width: max-content; max-width: min(520px, calc(100vw - 32px));
  background: var(--azul-profundo); color: #fff; padding: 22px 28px; border-radius: 16px;
  font-size: 16px; font-weight: 700; line-height: 1.4; text-align: center; z-index: 1000;
  box-shadow: 0 0 0 100vmax rgba(15, 23, 42, .4), 0 18px 48px rgba(0, 0, 0, .3);   /* aviso no MEIO da tela (padrão de todos os apps) */
  opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease;
}
.toast.visible { opacity: 1; transform: translate(-50%, -50%); pointer-events: auto; cursor: pointer; }

/* ===================== LOGIN ===================== */
.tela-login { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.login-box {
  width: 100%; max-width: 380px; background: var(--cinza-card); border-radius: var(--raio); box-shadow: var(--sombra-forte);
  border: 1px solid #e8edf5; padding: 32px 28px; text-align: center;
}
.login-logo { width: 56px; height: 56px; margin: 0 auto 16px; border-radius: 14px; background: #eef4fd; display: flex; align-items: center; justify-content: center; color: var(--azul-escuro); font-size: 15px; }
.login-box h1 { margin: 0 0 4px; font-size: 22px; font-weight: 700; color: var(--azul-escuro); }
.login-box p { margin: 0 0 22px; font-size: 13px; color: var(--texto-suave); }
.login-box form { text-align: left; }
.login-mensagem { margin-top: 14px; text-align: center; font-size: 13px; font-weight: 600; color: var(--vermelho); min-height: 18px; }

.campo-senha { position: relative; }
.campo-senha input { padding-right: 46px; }
.alternar-senha {
  position: absolute; top: 0; right: 0; bottom: 0; width: 46px; min-height: 0;
  background: transparent; border: none; padding: 0; font-size: 18px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; opacity: 0.6;
}
.alternar-senha:hover { opacity: 1; filter: none; transform: none; }

.link-esqueci-senha {
  display: block; width: auto; min-height: 0; margin: 12px auto 0; padding: 4px;
  background: transparent; border: none; color: var(--azul); font-size: 13px; font-weight: 600;
  text-decoration: underline; cursor: pointer;
}
.link-esqueci-senha:hover { filter: none; transform: none; opacity: 0.8; }

/* ===================== PÁGINAS INTERNAS (intercorrências, placeholders) ===================== */
.page-header {
  width: 100%; background: linear-gradient(135deg, var(--azul-profundo), var(--azul)); color: #fff;
  padding: 22px 24px; border-radius: var(--raio); box-shadow: var(--sombra-forte); margin-bottom: 20px;
  display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
}
.page-header h1 { margin: 0; font-size: 22px; font-weight: 700; }
.page-header p { margin: 4px 0 0; font-size: 13px; opacity: 0.9; }

.filter-bar { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)) auto auto; gap: 12px; align-items: end; margin-bottom: 18px; }
.filter-bar label { font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--texto-suave); margin: 0 0 4px; }

.incident { background:#fff; border:1px solid #e5e7eb; border-left: 6px solid var(--azul); border-radius:14px; padding:14px; margin-bottom:10px; display:grid; grid-template-columns: 140px 1fr 160px 200px; gap:14px; align-items: start; }
.incident.critical { border-left-color: var(--vermelho); }
.incident-date strong { display:block; font-size:14px; }
.incident-date span { font-size:12px; color: var(--texto-suave); }
.incident-info strong { display:block; margin-bottom:4px; }
.incident-info p { margin:0; font-size:13.5px; color: var(--texto); }
.incident-meta strong { display:block; font-size:11px; font-weight: 700; text-transform:uppercase; color: var(--texto-suave); }
.incident-acoes { display: flex; flex-direction: column; align-items: flex-start; }
.incident-acoes button { min-height: 38px; padding: 8px 12px; font-size: 13px; }
.badge.baixa { background: #dcfce7; color: #166534; }
.state { padding: 30px; text-align:center; color: var(--texto-suave); }
.state.error { color: var(--vermelho); }

.placeholder-box { background:#fff; border:1px dashed var(--cinza-borda); border-radius: var(--raio); padding: 40px; text-align:center; color: var(--texto-suave); }
.placeholder-box .icon { font-size: 40px; display:block; margin-bottom: 10px; }

/* ===================== RESPONSIVO ===================== */
@media (max-width: 1100px) {
  .grid-2, .grid-3, .setores-grid { grid-template-columns: minmax(0, 1fr); }
  .quick-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .hmef-metrics-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .hmef-resumo-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .hmef-dashboard-details { grid-template-columns: minmax(0,1fr); }
  .filter-bar { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .incident { grid-template-columns: minmax(0,1fr); }
}

@media (max-width: 700px) {
  .app { padding: 10px; }
  header.topbar { padding: 18px 16px; border-radius: 0 0 var(--raio) var(--raio); margin: -10px -10px 14px; }
  .card { padding: 16px; border-radius: 15px; }
  .quick-grid { grid-template-columns: minmax(0,1fr); }
  .hmef-metrics-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  button { width: 100%; }
  .grid-2 > div, .grid-3 > div { width: 100%; display: block; }
  .sessao-email { max-width: 120px; }
}

@media (max-width: 420px) {
  .setor-linha { grid-template-columns: minmax(0, 1fr) 74px; gap: 8px; padding: 9px; }
  .setor-linha span { font-size: 13px; }
  .setor-linha input { min-height: 44px; padding: 8px 6px; }
  input, select, textarea { font-size: 16px; }
}

/* Indicador de higiene das mãos (mL por paciente-dia) */
.hmef-maos-anvisa { background: #eaf1fb; border: 1px solid #cfe0f7; border-radius: 12px; padding: 10px 14px; margin: 8px 0 12px; font-size: 13px; color: var(--texto); }
.hmef-maos-anvisa strong { color: var(--azul-escuro); }
.hmef-maos-grafico { position: relative; height: 230px; margin: 6px 0 12px; }
.hmef-cmp-grafico { height: 280px; }
.hmef-cmp-pers { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--texto-suave); }
.hmef-maos-nota { font-size: 12px; color: var(--texto-suave); margin: 10px 2px 0; line-height: 1.5; }
.hmef-table-clicavel tbody tr[data-unidade] { cursor: pointer; }
.hmef-table-clicavel tbody tr[data-unidade]:hover td { background: #f3f7fd; }
.hmef-maos-subtotal td { font-weight: 700; background: #f4f7fc; color: var(--azul-escuro); }
.hmef-maos-ok { color: var(--verde); font-weight: 700; }
.hmef-maos-baixo { color: var(--vermelho); font-weight: 700; }
.hmef-maos-aguardando { color: var(--texto-suave); font-style: italic; }
.hmef-maos-modal { width: min(1100px, 96vw); max-width: 1100px; }

/* janela centralizada (padrão HMEF) */
.hmef-modal-fundo { overflow-y: auto; }
.hmef-modal-fundo > .hmef-modal-caixa { margin: auto; }

/* Corrigir registros (ADM/Gestor) */
.cf-grade { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.cf-campo { min-width: 0; }
.cf-campo.cf-largo { grid-column: 1 / -1; }
.cf-campo textarea { min-height: 84px; }
.cf-mapa { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.cf-setor { display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; font-weight: 600; }
.cf-setor input { padding: 6px 8px; }
.admin-perfil { padding: 6px 8px; border-radius: 8px; font-size: 13px; max-width: 170px; }
@media (max-width: 640px) { .cf-grade { grid-template-columns: minmax(0, 1fr); } }
