/* Painel da Ouvidoria (pm-ouvidoria.js), dentro do painel de Chamados. Usa as variáveis --cg-*. */

/* Barra lateral: grupo Ouvidoria */
.pm-cg-label--ouv { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--cg-line); }
.pm-cg-nav--ouv button.is-active { background: #ece6f7; color: #5b3d99; }
.pm-cg-nav--ouv .pm-cg-count { background: #8a56c2; }
@media (min-width: 1025px) {
  .pm-cg.is-side-closed .pm-cg-label--ouv { max-height: 0; margin: 0; padding: 0; border: 0; overflow: hidden; opacity: 0; }
}

/* Área */
.pm-cg-ouv { display: none; min-height: 0; padding: 16px 22px 26px; overflow-y: auto; }
.pm-cg[data-view="ouvidoria"] .pm-cg-ouv { display: block; animation: pm-cg-rise .28s var(--cg-ease); }
.pm-ov-pagina { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.pm-ov-carregando { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 260px; color: var(--cg-muted); }
.pm-ov-carregando span { width: 18px; height: 18px; border: 2px solid var(--cg-line); border-top-color: var(--cg-blue); border-radius: 50%; animation: pm-ov-gira .8s linear infinite; }
@keyframes pm-ov-gira { to { transform: rotate(360deg); } }
.pm-ov-erro { margin-bottom: 12px; padding: 10px 14px; border-radius: 12px; background: #fbe6e4; color: #8f2b24; font-size: 13px; }
.pm-ov-erro button { border: 0; background: none; color: inherit; font-weight: 700; text-decoration: underline; }
.pm-ov-vazio { min-height: 220px; padding: 20px; }
.pm-ov-vazio p { max-width: 360px; }

.pm-ov-acoes-topo { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.pm-ov-acoes-topo > .pm-cg-btn:first-child { margin-right: auto; }
.pm-ov-botoes { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pm-ov-resumo { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pm-ov-resumo strong { font-size: 15px; font-weight: 700; }

/* KPIs e caixas */
.pm-ov-kpis { margin-bottom: 0; }
.pm-ov-kpi { text-align: left; }
button.pm-ov-kpi { cursor: pointer; }
.pm-ov-kpi.is-destaque { border-color: #d7c7f0; background: #f6f1fd; }
.pm-ov-kpi.is-destaque strong { color: #5b3d99; }
.pm-ov-kpi.is-alerta-kpi small { color: var(--cg-red); font-weight: 500; }
.pm-ov-grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.pm-ov-box { min-width: 0; }

.pm-ov-colunas { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; height: 150px; padding-top: 8px; }
.pm-ov-coluna { display: grid; grid-template-rows: minmax(0, 1fr) auto; align-items: end; gap: 4px; min-width: 0; text-align: center; }
.pm-ov-coluna i { display: block; width: 100%; min-height: 0; border-radius: 4px 4px 2px 2px; background: #b9cdea; transition: background .15s; }
.pm-ov-coluna:hover i, .pm-ov-coluna.is-hoje i { background: var(--cg-blue); }
.pm-ov-coluna small { overflow: hidden; color: var(--cg-muted); font-size: 10px; }
.pm-ov-coluna:nth-child(odd) small { visibility: hidden; }
.pm-ov-coluna.is-hoje small { visibility: visible; color: var(--cg-ink); font-weight: 700; }

.pm-ov-hbars { display: grid; gap: 8px; }
.pm-ov-hbar { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) auto 42px; align-items: center; gap: 8px; font-size: 13px; }
.pm-ov-hbar-nome { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm-ov-hbar-trilho { height: 8px; overflow: hidden; border-radius: 4px; background: #efece6; }
.pm-ov-hbar-trilho i { display: block; height: 100%; border-radius: 4px; }
.pm-ov-hbar b { font-weight: 600; text-align: right; }
.pm-ov-hbar small { color: var(--cg-muted); font-size: 11px; text-align: right; }

.pm-ov-mini-lista { display: grid; gap: 6px; }
.pm-ov-mini { display: grid; gap: 2px; width: 100%; padding: 9px 10px; border: 1px solid var(--cg-line); border-radius: 11px; background: #fff; text-align: left; transition: border-color .15s, background .15s; }
.pm-ov-mini:hover { border-color: #c9cfd8; background: #fbfaf8; }
.pm-ov-mini strong { overflow: hidden; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.pm-ov-mini small { overflow: hidden; color: var(--cg-muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.pm-ov-mini-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }

/* Filtros e tabelas */
.pm-ov-filtros { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 12px 14px; border-bottom: 1px solid var(--cg-line); }
.pm-ov-periodo { display: inline-flex; align-items: center; gap: 4px; }
.pm-ov-periodo small { color: var(--cg-muted); font-size: 12px; }
.pm-ov-data { max-width: 140px; padding: 0 8px; }
.pm-ov-tabela td small { display: block; color: var(--cg-muted); font-size: 11px; }
.pm-ov-tabela td strong { font-weight: 500; }
.pm-ov-linha { cursor: pointer; }
.pm-ov-acoes-linha { text-align: right; }
.pm-ov-acoes-linha .pm-cg-link + .pm-cg-link { margin-left: 12px; }
.pm-ov-sit { display: inline-grid; gap: 2px; }
.pm-ov-abas { flex-wrap: wrap; }
.pm-ov-abas b { font-weight: 500; opacity: .7; }

/* Encaminhamentos por secretaria */
.pm-ov-secs { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.pm-ov-sec { display: grid; gap: 2px; padding: 11px 13px; border: 1px solid var(--cg-line); border-radius: 14px; background: var(--cg-card); text-align: left; transition: border-color .15s, box-shadow .15s; }
.pm-ov-sec:hover { border-color: #c9cfd8; }
.pm-ov-sec.is-on { border-color: var(--cg-blue); box-shadow: 0 0 0 1px var(--cg-blue); }
.pm-ov-sec strong { font-size: 15px; }
.pm-ov-sec small { overflow: hidden; color: var(--cg-muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.pm-ov-sec span { margin-top: 4px; font-size: 12px; }
.pm-ov-sec em { color: var(--cg-red); font-style: normal; font-weight: 500; }
.pm-ov-sec i { color: var(--cg-muted); font-style: normal; }

/* Sigilo */
.pm-ov-sigilo { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border: 1px solid #ddd0f2; border-radius: 14px; background: #f6f1fd; color: #4d3a73; font-size: 13px; }
.pm-ov-sigilo .pm-cg-ico { margin-top: 1px; color: #6f4bb0; }
.pm-ov-sigilo strong { font-weight: 700; }
.pm-ov-sigilo--lateral { font-size: 12px; }
.pm-ov-relato { white-space: pre-wrap; overflow-wrap: anywhere; }
.pm-ov-input--mini { min-height: 30px !important; padding: 2px 6px !important; font-size: 13px; text-align: right; }
.pm-cg-page dd a { color: var(--cg-blue); }

/* Formulários */
.pm-ov-campo { display: grid; gap: 5px; min-width: 0; }
.pm-ov-campo > span { font-size: 13px; font-weight: 500; }
.pm-ov-campo > small { color: var(--cg-muted); font-size: 11px; }
.pm-ov-input, .pm-ov-form-corpo input[type="date"], .pm-ov-form-corpo input[type="time"] {
  width: 100%; min-height: 40px; padding: 8px 10px; border: 1px solid var(--cg-line); border-radius: 10px; background: #fff;
}
.pm-ov-input:focus, .pm-ov-form-corpo input:focus { border-color: var(--cg-blue); outline: 0; box-shadow: 0 0 0 3px var(--cg-blue-soft); }
textarea.pm-ov-input { resize: vertical; }
.pm-ov-form-grade { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.pm-ov-seg { grid-auto-columns: minmax(0, 1fr); }
.pm-ov-seg button { padding: 0 4px; font-size: 12.5px; white-space: nowrap; }
.pm-ov-canal { display: grid; grid-template-columns: minmax(0, 1fr) 130px; gap: 6px; }
.pm-ov-grupo { display: grid; gap: 10px; margin: 0; padding: 12px; border: 1px solid var(--cg-line); border-radius: 12px; background: #fbfaf8; }
.pm-ov-grupo legend { padding: 0 6px; font-size: 13px; font-weight: 700; }
.pm-ov-grupo legend small { color: var(--cg-muted); font-weight: 400; }
.pm-ov-info { padding: 9px 10px; border-radius: 10px; background: var(--cg-blue-soft); color: #1f5a9c; font-size: 13px; }
.pm-ov-form .pm-ov-form-painel { width: min(480px, 100%); }
.pm-ov-form-corpo { display: grid; gap: 12px; flex: 1; min-height: 0; padding: 16px 20px 24px; overflow-y: auto; }
.pm-ov-form-corpo .pm-cg-link--danger { justify-self: center; }
.pm-ov-modal-largo { width: min(560px, 100%) !important; }

.pm-ov-toast { position: absolute; bottom: 22px; left: 50%; z-index: 12; padding: 10px 18px; border-radius: 12px; background: #17202c; color: #fff; font-size: 13px; box-shadow: 0 8px 24px rgb(23 32 44 / 30%); transform: translateX(-50%); animation: pm-cg-rise .25s var(--cg-ease); transition: opacity .4s, transform .4s; }
.pm-ov-toast.is-saindo { opacity: 0; transform: translate(-50%, 8px); }

/* Relatórios */
.pm-ov-rel { grid-template-columns: 330px minmax(0, 1fr); align-items: start; }
.pm-ov-rel-form { position: sticky; top: 0; display: grid; gap: 12px; }
.pm-ov-rel-form h3 { font-size: 16px; }
.pm-ov-rel-form h4 { margin: 4px 0 0; padding-top: 10px; border-top: 1px solid var(--cg-line); color: var(--cg-muted); font-size: 11px; font-weight: 500; letter-spacing: .05em; text-transform: uppercase; }
.pm-ov-rel-filtros { display: grid; gap: 10px; }
.pm-ov-rel-preview { min-height: 70vh; overflow: hidden; border: 1px solid var(--cg-line); border-radius: 16px; background: #eef0f3; }
.pm-ov-rel-frame { display: block; width: 100%; height: calc(100dvh - 190px); min-height: 520px; border: 0; background: #f2f4f7; }

@media (max-width: 1180px) {
  .pm-ov-grid3 { grid-template-columns: minmax(0, 1fr); }
  .pm-ov-rel { grid-template-columns: minmax(0, 1fr); }
  .pm-ov-rel-form { position: static; }
}
@media (max-width: 767px) {
  .pm-cg-ouv { padding: 10px 12px calc(18px + env(safe-area-inset-bottom)); position: relative; z-index: 0; isolation: isolate; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
  .pm-ov-acoes-topo { align-items: stretch; flex-direction: column; }
  .pm-ov-acoes-topo > .pm-cg-btn { width: 100%; }
  .pm-ov-botoes { width: 100%; }
  .pm-ov-botoes > * { flex: 1; }
  .pm-ov-abas { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .pm-ov-abas button { flex: none; }
  .pm-ov-filtros { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .pm-ov-filtros > * { flex: none; }
  .pm-ov-colunas { height: 110px; gap: 2px; }
  .pm-ov-coluna small { display: none; }
  .pm-ov-form-grade { grid-template-columns: minmax(0, 1fr); }
  .pm-ov-canal { grid-template-columns: minmax(0, 1fr); }
  .pm-ov-seg { grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pm-ov-form-corpo { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
  .pm-ov-tabela td:nth-child(n) { order: initial; display: block; grid-column: auto; justify-self: start; max-width: none; color: inherit; font-size: 13px; white-space: normal; }
  .pm-ov-tabela td:nth-child(n):empty { display: none; }
  .pm-ov-tabela tr { grid-template-columns: minmax(0, 1fr); }
  .pm-ov-acoes-linha { text-align: left; }
  .pm-ov-rel-frame { height: 70dvh; }
}

/* Fichas (dl) e página de detalhe dentro da Ouvidoria: mesmo visual da página do chamado */
.pm-cg-ouv .pm-cg-pagebar { margin-bottom: 0; }
.pm-cg-ouv dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 12px; margin-top: 10px; font-size: 13px; }
.pm-cg-ouv dt { color: var(--cg-muted); }
.pm-cg-ouv dd { font-weight: 500; overflow-wrap: anywhere; text-align: right; }
.pm-cg-ouv dd a { color: var(--cg-blue); text-decoration: none; }
.pm-cg-ouv dd select { width: auto; margin-left: auto; }
.pm-cg-ouv .pm-cg-box > .pm-cg-link { display: inline-block; margin-top: 10px; }

/* Concluídos pelas secretarias (validação) */
.pm-ov-info-fluxo { border-color: #c9e4d3; background: #f0faf4; color: #24563a; }
.pm-ov-info-fluxo .pm-cg-ico { color: #16794a; }
.pm-ov-val-lista { display: grid; gap: 12px; }
.pm-ov-val { display: grid; gap: 8px; padding: 16px 18px; }
.pm-ov-val-top { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.pm-ov-val-top small, .pm-ov-val-foot small { color: var(--cg-muted, #64748b); font-size: 12px; }
.pm-ov-val h3 { margin: 0; font-size: 15px; font-weight: 700; }
.pm-ov-val-desc { margin: 0; font-size: 13px; color: #475569; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.pm-ov-val-conclusao { padding: 10px 12px; border-radius: 12px; background: #f1f6ff; border: 1px solid #d6e3fb; }
.pm-ov-val-conclusao small { display: block; margin-bottom: 3px; font-size: 11px; font-weight: 700; color: #244e9c; text-transform: uppercase; letter-spacing: .03em; }
.pm-ov-val-conclusao p { margin: 0; font-size: 13px; white-space: pre-wrap; }
.pm-ov-val-foot { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.pm-ov-tabela td small { display: block; margin-top: 2px; color: var(--cg-muted, #64748b); font-size: 11px; }
