/* V1468 — Partes Interessadas: janelas mais compactas, formulário da parte interessada em blocos,
   botões Sim/Não e avisos dentro da janela aberta. */
.pi-modal { max-height: calc(100vh - 24px) !important; }
.pi-modal > header { padding: 11px 18px !important; }
.pi-modal > header h2 { font-size: 17px; color: #12315e; }
.pi-modal-sub { margin: 2px 0 0; font-size: 12px; color: #637b98; }
.pi-modal-body { padding: 12px 18px !important; scrollbar-width: thin; }
.pi-modal footer { padding: 10px 18px !important; }
.pi-modal .pi-field input, .pi-modal .pi-field select { height: 34px; padding-top: 5px; padding-bottom: 5px; }
.pi-modal .pi-form-grid { gap: 10px 12px; }
.pi-modal-aviso { margin: 0 0 10px !important; }
.pi-modal-aviso[hidden] { display: none !important; }

/* formulário da parte interessada */
.pi-modal--parte { width: min(960px, 100%) !important; }
.pi-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
.pi-span-4 { grid-column: 1 / -1; }
.pi-grid-4 .pi-span-2 { grid-column: span 2; }
.pi-form-resumo { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 10px; padding: 8px 12px; border: 1px solid #d6e2f0; border-radius: 9px; background: linear-gradient(180deg, #f5f9fe, #edf3fb); }
.pi-form-resumo span { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #6b7a8f; }
.pi-form-resumo b { font-size: 14px; color: #12315e; }
.pi-bloco { border: 0; margin: 0 0 10px; padding: 0; min-width: 0; }
.pi-bloco:last-of-type { margin-bottom: 0; }
.pi-bloco > legend { display: flex; align-items: center; gap: 7px; padding: 0; margin: 0 0 6px; font-size: 13px; font-weight: 700; color: #12315e; }
.pi-num { width: 19px; height: 19px; border-radius: 50%; background: #f07f1a; color: #fff; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 19px; }
.pi-field [hidden], .pi-field[hidden] { display: none !important; }
.pi-modal--parte textarea[name="justificativa"] { min-height: 34px; height: 34px; }
.pi-ajuda { min-height: 0; font-size: 11px; color: #637b98; }
.pi-ajuda:empty { display: none; }
.pi-ajuda.is-alerta { color: #a15c00; font-weight: 600; }
.pi-ajuda.is-erro { color: #b42318; font-weight: 700; }

/* botões Sim/Não e Tipo */
.pi-seg { display: flex; height: 34px; border: 1px solid #cbd8e9; border-radius: 7px; overflow: hidden; background: #fff; }
.pi-seg label { flex: 1 1 0; position: relative; margin: 0; cursor: pointer; min-width: 0; }
.pi-seg label + label { border-left: 1px solid #cbd8e9; }
.pi-seg input { position: absolute; opacity: 0; pointer-events: none; }
.pi-seg span { display: flex; align-items: center; justify-content: center; height: 100%; padding: 0 8px; font-size: 13px; font-weight: 600; color: #47607c; white-space: nowrap; transition: background-color .15s, color .15s; }
.pi-seg label:hover span { background: #f4f8fd; }
.pi-seg input:checked + span { background: #1766b3; color: #fff; }
.pi-seg input[value="false"]:checked + span { background: #6b7a8f; }
.pi-seg input:focus-visible + span { box-shadow: inset 0 0 0 2px #f07f1a; }

@media (max-width: 760px) {
  .pi-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .pi-form-resumo { flex-direction: column; align-items: flex-start; }
}

/* códigos automáticos (somente leitura) */
.pi-codigo-auto { display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 34px; box-sizing: border-box; padding: 0 10px; border: 1px dashed #c3d1e2; border-radius: 6px; background: #f5f8fc; color: #12315e; font-size: 13px; }
.pi-codigo-auto b { font-weight: 700; letter-spacing: .02em; }
.pi-codigo-auto em { font-style: normal; color: #637b98; }
.pi-codigo-auto small { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: #8a9bb0; }

/* V1469 — demais janelas (requisito, controle, monitoramento, revisão, ação, clima) e aba Resumo */
.pi-modal--largo { width: min(960px, 100%) !important; }
.pi-grid-4 .pi-span-3 { grid-column: span 3; }
.pi-grid-4 .pi-span-4 { grid-column: 1 / -1; }
.pi-modal textarea { min-height: 34px; line-height: 1.4; }
.pi-modal textarea[rows="1"] { height: 34px; }
.pi-modal textarea[rows="2"] { height: 56px; }
.pi-modal textarea[rows="3"] { height: 74px; }
.pi-nota { margin: 0 0 10px; padding: 7px 11px; font-size: 12px; color: #1d5587; background: #eef6ff; border: 1px solid #b9d5f2; border-radius: 7px; }
.pi-original { margin-top: 8px; border: 1px dashed #c3d1e2; border-radius: 7px; padding: 6px 10px; background: #f8fafd; }
.pi-original > summary { cursor: pointer; font-size: 12px; font-weight: 700; color: #47607c; }
.pi-original[open] > summary { margin-bottom: 6px; }
.pi-original .pi-field { display: flex; }

/* botões com cores por significado */
.pi-seg--crit input[value="baixa"]:checked + span { background: #1f7a3d; }
.pi-seg--crit input[value="media"]:checked + span { background: #c27a00; }
.pi-seg--crit input[value="alta"]:checked + span { background: #b42318; }
.pi-seg--crit input[value="urgente"]:checked + span { background: #7a1410; }
.pi-seg--resultado input[value="conforme"]:checked + span { background: #1f7a3d; }
.pi-seg--resultado input[value="atencao"]:checked + span { background: #c27a00; }
.pi-seg--resultado input[value="desvio"]:checked + span { background: #b42318; }
.pi-seg--resultado input[value="nao_aplicavel"]:checked + span { background: #6b7a8f; }
.pi-seg input[name="status"][value="encerrado"]:checked + span,
.pi-seg input[name="decisao"][value="nao_pertinente"]:checked + span { background: #6b7a8f; }
.pi-seg input[name="status_eficacia"][value="eficaz"]:checked + span { background: #1f7a3d; }
.pi-seg input[name="status_eficacia"][value="ineficaz"]:checked + span { background: #b42318; }
.pi-seg input[name="status_eficacia"][value=""]:checked + span { background: #6b7a8f; }
.pi-seg span { font-size: 12.5px; }

/* aba Resumo */
.pi-res-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 12px; }
.pi-res-card { margin: 0 !important; }
.pi-res-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.pi-res-head h2 { margin: 0 !important; }
.pi-res-itens { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.pi-res-item { display: flex; flex-direction: column; gap: 2px; padding: 7px 0; border-bottom: 1px solid #e8eef5; min-width: 0; }
.pi-res-item span { font-size: 11px; font-weight: 600; color: var(--text-muted, #637b98); }
.pi-res-item b { font-size: 13px; font-weight: 600; color: #173b63; overflow-wrap: anywhere; display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.pi-res-item.is-alerta b { color: #b42318; }
.pi-res-largo { grid-column: 1 / -1; }
.pi-res-largo b { font-weight: 500; white-space: pre-line; }
.pi-res-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.pi-res-kpi { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid #dce5f0; border-radius: 8px; background: #f8fafd; }
.pi-res-kpi b { font-size: 22px; line-height: 1; color: #12315e; min-width: 26px; }
.pi-res-kpi span { font-size: 12px; color: #47607c; line-height: 1.3; }
.pi-res-kpi.is-alerta { border-color: #f0d69d; background: #fff8e8; }
.pi-res-kpi.is-alerta b { color: #a15c00; }
.pi-res-kpi.is-ok b { color: #1f7a3d; }
.pi-res-kpi:first-child { grid-column: 1 / -1; background: #12315e; border-color: #12315e; }
.pi-res-kpi:first-child b, .pi-res-kpi:first-child span { color: #fff; }

@media (max-width: 900px) { .pi-res-grid { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .pi-grid-4 .pi-span-3 { grid-column: 1 / -1; } .pi-res-itens { grid-template-columns: 1fr; } }
.pi-codigo-auto em, .pi-codigo-auto b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pi-modal .pi-bloco { margin-bottom: 8px; }
.pi-modal .pi-bloco > legend { margin-bottom: 4px; }
.pi-modal .pi-grid-4 { gap: 8px 12px !important; }
.pi-modal .pi-field { gap: 3px; }
