/* Layout "cabe na janela" do console Oghma. Carregado depois das demais folhas; mantém a identidade (monocromático, vidro, sem verde).
   Modo de ajuste (largura >= 1024 px): casca com 100dvh (barra lateral | área principal), área principal em coluna
   [cabeçalho, filtros, view 1fr, rodapé], cada view em grade/coluna que preenche o espaço e cards com min-height:0.
   Listas e tabelas são paginadas pelo espaço disponível (layout.js); rolagem interna só onde marcada com data-scroll-ok.
   Abaixo de 1024 px o fluxo volta a ser natural (rolagem vertical tolerada), sem rolagem horizontal. */
:root{--gap:clamp(8px,1.4vh,16px);--pad:clamp(10px,1.7vh,22px)}

/* ---------- fontes mínimas de 10 px em qualquer largura */
.nav-label{font-size:10px}
.kv span{font-size:10px}
.uf-tile span,.ind-map .uf-tile span{font-size:10px}
@media(max-width:760px){
  .metrics .card>span,th{font-size:10px}
  .topbar{font-size:10px}
  .sidebar{height:auto}
  .sidebar nav{flex-wrap:wrap;overflow:visible}
  .sidebar nav button{padding:6px 10px}
  main>footer{position:static}
  .uf-tile span{font-size:10px}
}
@media(min-width:761px) and (max-height:820px){.nav-label{font-size:10px}}
@media(max-width:520px){.uf-tile span{font-size:10px}}
/* Seção de alívio (título + lista) sem nenhum item visível, porque todos foram para outra página do card, não aparece: o item volta com o seu título. */
.ind-drivers-card .ind-relief:not(:has(li:not(.fit-off))){display:none}

/* ---------- utilitários de ajuste */
.fit-off,.tab-off{display:none!important}
.fit-pager{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:4px 10px;flex:none;width:100%;min-width:0;padding:6px 0 2px;margin-top:auto;font:500 11px/1.3 var(--mono);letter-spacing:.04em;color:var(--ink-3)}
.fit-pager[hidden]{display:none}
.fit-pager button{padding:2px 12px;font-size:15px;line-height:1.2}
.fit-pager{grid-column:1/-1}
.fit-scroll{overflow:auto!important}
.clamp-1,.clamp-2,.clamp-3{display:-webkit-box;-webkit-box-orient:vertical;overflow:hidden;text-overflow:ellipsis}
.clamp-1{-webkit-line-clamp:1}.clamp-2{-webkit-line-clamp:2}.clamp-3{-webkit-line-clamp:3}
.fit-tabs{margin-bottom:0;flex-wrap:wrap;border-radius:18px}
.fit-tabs button{white-space:nowrap}
.fit-panel{min-width:0}
.fit-fields>.fit-pager{grid-column:1/-1}
.scame-head{display:flex;align-items:center;gap:10px;margin:0 0 10px;font:500 10.5px/1.4 var(--mono);letter-spacing:.16em;color:var(--ink-3);text-transform:uppercase}
.scame-head b{display:inline-block;background:var(--ink);border-radius:var(--r-xs);padding:2px 8px;font:700 12px var(--mono);color:var(--on-ink);letter-spacing:0}
.report p.li-line{padding-left:1.4em;text-indent:-1.4em}
.report h4.scame-sub{font:600 12.5px/1.4 var(--sans);color:var(--ink);margin:10px 0 4px}
.report p strong{color:var(--ink);font-weight:600}
.report .scame-table{padding:0;border:0;background:none;box-shadow:none}

/* diálogos em qualquer largura: altura máxima da janela, conteúdo em abas/páginas (layout.js), sem rolagem própria */
dialog{max-height:calc(100dvh - 16px);overflow:hidden}
dialog[open]{display:flex;flex-direction:column}
dialog.wide{height:fit-content}
dialog>form{display:flex;flex-direction:column;min-height:0;flex:1 1 auto}
dialog .dialog-head{flex:none}
dialog .fit-tabs{flex:none;align-self:flex-start}
dialog .fit-panel{flex:1 1 auto;min-height:0;display:flex;flex-direction:column}
dialog .fit-panel>*{flex:none}
dialog .fit-panel>form{flex:1 1 auto;min-height:0;display:flex;flex-direction:column}
#event-body,#post-body{display:contents}
.ind-drivers .driver-title,.igssp-drivers .driver-title{text-overflow:ellipsis}

/* sobreposições abertas sob demanda (valores da série e metodologia) */
.mini-chart,#trend-chart{position:relative}
.mini-chart>details[open],#trend-chart>details[open]{position:absolute;inset:0;z-index:6;margin:0;padding:12px 16px;overflow:auto;border:1px solid var(--glass-edge);border-radius:14px;background:var(--glass-sheen),var(--glass-tint-strong);-webkit-backdrop-filter:var(--glass-blur);backdrop-filter:var(--glass-blur);box-shadow:var(--glass-shadow)}
.mini-chart>details[open]>summary,#trend-chart>details[open]>summary{margin-top:0}

/* ---------- modo de ajuste */
@media(min-width:1024px){
  /* casca */
  #workspace:not([hidden]){height:100dvh}
  .sidebar nav{flex:1 1 auto;display:flex;flex-direction:column;min-height:0}
  .sidebar nav button{flex:1 1 auto;max-height:34px;padding-top:0;padding-bottom:0;line-height:1.2}
  .sidebar nav button.active::before{top:22%;bottom:22%}
  .work-main{height:100dvh;display:flex;flex-direction:column;min-height:0}
  .topbar{position:relative;top:auto;flex:none;height:clamp(38px,5.4vh,56px)}
  main{flex:1 1 0;min-height:0;width:100%;max-width:2200px;margin:0 auto;display:flex;flex-direction:column;padding:var(--gap) clamp(14px,1.8vw,32px) 0}
  main>*{flex:none}
  main>.view{flex:1 1 0;min-height:0;min-width:0}
  #toast{margin-bottom:var(--gap);padding:8px 16px}
  .page-heading{margin:0 0 var(--gap);padding-bottom:clamp(6px,1.2vh,16px);align-items:center}
  .page-heading>div{display:flex;flex-wrap:wrap;align-items:baseline;column-gap:18px;min-width:0}
  .page-heading .eyebrow{flex-basis:100%}
  .page-heading h1{font-size:clamp(22px,3.4vh,40px);margin:2px 0 0;white-space:nowrap}
  .page-heading p{flex:1 1 260px;min-width:0;font-size:clamp(12px,1.5vh,14px);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .page-heading>button{padding:clamp(5px,.9vh,9px) 14px}
  /* rodapé (versão) vai para a base da barra lateral e libera a altura da área de trabalho */
  main>footer{position:fixed;z-index:21;left:24px;bottom:clamp(14px,1.8vh,22px);width:208px;margin:0;padding:6px 0 0;border-top:1px solid var(--line);display:block;letter-spacing:.16em}
  main>footer span{display:none}
  .sidebar{padding-bottom:calc(clamp(8px,1.8vh,16px) + 30px)}
  main{padding-bottom:clamp(8px,1.4vh,16px)}

  /* controles e filtros compactos */
  label{margin-bottom:clamp(8px,1.6vh,18px)}
  .filterbar{padding:clamp(7px,1.1vh,14px) clamp(10px,1.2vw,18px);gap:8px 12px;margin-bottom:0;border-radius:16px}
  .filterbar label{margin:0}
  .filterbar input,.filterbar select{padding:clamp(5px,.75vh,9px) 10px;margin-top:4px}
  .filterbar button,.section-actions button{padding:clamp(5px,.8vh,9px) 14px}
  .filterbar .switch{padding-bottom:6px}
  .filterbar .chip{padding:5px 12px}
  .filterbar .segmented .seg,.filterbar .segmented label span{padding:5px 12px}
  #filters{margin-bottom:var(--gap)}
  #evo-profiles{height:auto}
  .section-actions{margin:0;gap:16px}
  .tabs{margin-bottom:0}
  .tabs button{padding:clamp(4px,.7vh,7px) 16px}

  /* views: coluna que preenche o espaço; cards sem margem externa */
  .view{display:flex;flex-direction:column;gap:var(--gap);min-height:0}
  .view>*{flex:none;margin-bottom:0}
  .view .card{margin-bottom:0}
  .card{padding:var(--pad)}
  .card .empty{padding:clamp(10px,3vh,48px) 12px}
  .view>p.note{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;text-overflow:ellipsis;margin:0}
  .view>.pagination,.pagination{margin:0}

  /* tabelas: preenchem o card; linhas paginadas pelo espaço; colunas secundárias somem em contêineres estreitos */
  .table-card{overflow:hidden;container-type:inline-size;display:flex;flex-direction:column;padding:2px clamp(8px,1.2vw,18px)}
  .view>.table-card,#comop-ranking>.table-card,#scame-list-box>.table-card{flex:1 1 0;min-height:0}
  .table-card>table{flex:none}
  .table-card>.empty{margin:auto 0}
  th{padding:clamp(6px,1vh,13px) clamp(5px,.7vw,10px)}
  td{padding:clamp(4px,.8vh,10px) clamp(5px,.7vw,10px);max-width:none}
  td button{padding:4px 10px}
  .table-card .title-cell,.table-card td .sub-line{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;text-overflow:ellipsis}
  .table-card td .note{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1;overflow:hidden;text-overflow:ellipsis;overflow-wrap:anywhere}
  .table-card td>div>strong{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1;overflow:hidden;text-overflow:ellipsis}
  #alerts-table td:nth-child(4) div{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;text-overflow:ellipsis;white-space:normal}
  #alerts-table td:nth-child(3){max-width:none}
  .table-card .thumb{width:40px;height:40px}
  .table-card .post-cell{gap:10px}
  .sub{width:96px}

  /* painel analítico */
  #view-dashboard{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));grid-template-rows:auto auto auto minmax(0,1fr);gap:var(--gap)}
  #view-dashboard>.metrics{grid-column:1/-1;grid-template-columns:repeat(4,minmax(0,1fr));gap:var(--gap)}
  #view-dashboard>.metrics-comop{grid-template-columns:repeat(5,minmax(0,1fr));margin:0}
  #view-dashboard>.section-title{grid-column:1/-1;margin:0}
  #view-dashboard>.chart-grid{grid-column:1/3;grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:minmax(0,1fr);gap:var(--gap);min-height:0}
  #view-dashboard>article.card{grid-column:3}
  .chart-grid>.card,#view-dashboard>article.card{display:flex;flex-direction:column;min-height:0;min-width:0}
  .chart-grid>.card>p,#view-dashboard>article.card>p:not(.note){display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1;overflow:hidden;text-overflow:ellipsis;margin-bottom:6px}
  #trend-chart,#network-chart,#state-chart{flex:1 1 0;min-height:0}
  #network-chart{display:flex;flex-direction:column;gap:clamp(4px,1.2vh,16px)}
  #network-chart .network-row{margin-top:0}
  #state-chart{margin:8px 0;align-content:flex-start}
  #view-dashboard>article.card>p.note{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3;overflow:hidden;text-overflow:ellipsis;margin:0}

  /* KPIs compactos */
  .metrics{gap:var(--gap)}
  .metrics .card{padding:clamp(8px,1.4vh,20px) clamp(12px,1.2vw,22px)}
  .metrics .card>span,.metrics small{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;text-overflow:ellipsis}
  .metrics strong{font-size:clamp(22px,4.2vh,42px);margin:clamp(4px,1vh,16px) 0 clamp(2px,.7vh,10px)}

  /* gráficos SVG desenhados no tamanho do contêiner (redesenho no redimensionamento) */
  .mini-chart,#trend-chart{display:flex;flex-direction:column;min-height:0}
  .mini-chart>svg,#trend-chart>svg{flex:1 1 0;min-height:0;width:100%;height:auto;max-height:none}
  .mini-chart>.chart-legend{flex:none;margin-top:6px;gap:2px 12px;font-size:11px}
  #igssp-empty,.ind-layout>[id$="-empty"]{display:flex;align-items:center;justify-content:center}
  .mini-chart>details,#trend-chart>details{flex:none}
  .mini-chart>details>summary,#trend-chart>details>summary{margin-top:6px}

  /* Painel COMOP */
  #view-comop>.tabs{align-self:flex-start}
  #comop-ranking,#comop-evolution{flex:1 1 0;min-height:0;display:flex;flex-direction:column;gap:var(--gap)}
  #comop-ranking>*{flex:none;margin:0}
  #comop-evolution{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:auto minmax(0,1fr)}
  #evo-filters{grid-column:1/-1;margin:0}
  #comop-evolution>.card{display:flex;flex-direction:column;min-height:0;min-width:0}
  #evo-reactions,#evo-narratives{flex:1 1 0;min-height:0}
  #comop-evolution .card-head h2{margin-bottom:4px}

  /* IGSSP e indicadores: áreas [topo] / [mapa | KPIs | fatores] / [mapa | gráfico | fatores] / [metodologia | notas] */
  #view-igssp,.ind-view{display:grid;gap:var(--gap);grid-template-columns:minmax(0,clamp(220px,20vw,360px)) minmax(0,1.6fr) minmax(0,1fr);
    grid-template-rows:auto auto minmax(0,1fr) auto;grid-template-areas:"top top top" "states kpis kpis" "states chart drivers" "method notes notes"}
  #igssp-content,.igssp-grid,.ind-view>.ind-layout,.ind-main{display:contents}
  #view-igssp>.igssp-top,.ind-view>.ind-top{grid-area:top}
  #view-igssp>.igssp-states,.ind-states{grid-area:states}
  #igssp-kpis,.ind-kpis{grid-area:kpis;margin:0;grid-template-columns:repeat(4,minmax(0,1fr))}
  .igssp-chart-card,.ind-chart-card{grid-area:chart}
  .igssp-drivers-card,.ind-drivers-card{grid-area:drivers}
  #igssp-empty,.ind-layout>[id$="-empty"]{grid-row:2/4;grid-column:2/4;min-height:0;min-width:0}
  #igssp-method,.ind-view>.ind-method{grid-area:method}
  #igssp-notes,.ind-view>.igssp-notes{grid-area:notes;margin:0;align-self:center;min-width:0}
  #igssp-drivers{flex:1 1 0;min-height:0}
  .igssp-grid>.card,.ind-chart-card,.ind-drivers-card,.igssp-states{display:flex;flex-direction:column;min-height:0;min-width:0}
  .igssp-grid .card-head h2,.ind-view .card-head h2{margin-bottom:6px}
  #igssp-chart,.ind-chart{flex:1 1 0;min-height:0}
  #igssp-drivers-note,[id$="-drivers-note"]{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;text-overflow:ellipsis;margin:0 0 4px}
  .igssp-drivers{margin-top:6px;gap:8px}
  .igssp-drivers li{padding:8px 12px}
  .igssp-drivers .driver-title{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;text-overflow:ellipsis}
  .igssp-drivers .driver-bar{margin:5px 0}
  .igssp-top{display:flex;flex-wrap:wrap;align-items:flex-end;gap:10px 28px}
  .igssp-top>.card-head{flex:1 1 380px;min-width:0}
  .igssp-head p{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;text-overflow:ellipsis}
  .igssp-head h2{margin:0}
  .igssp-period{margin:0;flex:1 1 520px;max-width:820px;grid-template-columns:repeat(4,minmax(0,1fr))}
  .igssp-period label{margin:0}
  .igssp-period input,.igssp-period select{padding:clamp(5px,.75vh,9px) 10px;margin-top:4px}
  .igssp-states{padding:var(--pad)}
  .igssp-states .card-head .note{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;text-overflow:ellipsis}
  .igssp-states h2{margin-bottom:4px}
  .map-box{flex:1 1 0;min-height:0;container-type:size;display:flex;align-items:center;justify-content:center;margin:6px 0}
  .map-box>.igssp-map{--rows:8;width:min(100cqw,calc(100cqh * 6 / var(--rows)));max-width:none;margin:0;aspect-ratio:6/8;grid-template-rows:repeat(var(--rows),minmax(0,1fr));grid-auto-rows:minmax(0,1fr);gap:clamp(2px,1cqw,6px)}
  .map-box .uf-tile{aspect-ratio:auto;min-height:0;padding:0;gap:0;overflow:hidden}
  .map-box .uf-tile b{font-size:clamp(10px,min(3.4cqw,calc(3.4cqh * 6 / 8)),13px);line-height:1.05}
  .map-box .uf-tile span{font-size:clamp(10px,min(2.9cqw,calc(2.9cqh * 6 / 8)),12px);line-height:1.05}
  .igssp-map-legend{flex:none;gap:4px 12px}
  #igssp-map-note,.ind-map-note{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;text-overflow:ellipsis;margin:6px 0 0}
  .igssp-method{margin:0;padding:clamp(8px,1.2vh,14px) var(--pad)}
  .igssp-method>summary{margin:0}
  .igssp-method[open]{position:absolute;z-index:8;inset:0;overflow:auto;background:var(--glass-sheen),var(--glass-tint-strong);-webkit-backdrop-filter:var(--glass-blur);backdrop-filter:var(--glass-blur);border:1px solid var(--glass-edge);box-shadow:var(--glass-shadow)}
  .igssp-method[open]>div{column-width:420px;column-gap:36px}
  .igssp-method[open] h3{break-after:avoid}
  .igssp-method[open] table,.igssp-method[open] li,.igssp-method[open] p{break-inside:avoid}
  #view-igssp,.ind-view{position:relative}
  .igssp-notes p{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1;overflow:hidden;text-overflow:ellipsis}

  .ind-view .card{margin-bottom:0}
  .ind-top{display:flex;flex-wrap:wrap;align-items:flex-end;gap:10px 28px;padding:var(--pad)}
  .ind-top>.card-head{flex:1 1 380px;min-width:0}
  .ind-head p{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;text-overflow:ellipsis}
  .ind-period{margin:0}
  .ind-drivers-card .ind-sub{margin:8px 0 2px}
}
@media(min-width:1024px) and (max-width:1100px){
  main>footer{width:180px}
}
@media(min-width:1024px) and (max-width:1399px){
  /* telas estreitas: KPIs em largura total acima do gráfico e dos fatores */
  #view-igssp,.ind-view{grid-template-areas:"top top top" "states kpis kpis" "states chart drivers" "method notes notes"}
}
@media(min-width:1024px){
  /* o título e a descrição do índice já estão no cabeçalho da página: no topo ficam o selo de metodologia/escala e o período */
  .igssp-head>div,.ind-head>div{display:none}
  .igssp-top>.card-head,.ind-top>.card-head{flex:0 1 auto;order:2;margin-left:auto;align-self:center}
  .igssp-top>.igssp-period,.ind-top>.ind-period{order:1}
  #igssp-kpis small,.ind-kpis small{-webkit-line-clamp:1}
  #igssp-kpis .card,.ind-kpis .card{container-type:inline-size}
  #igssp-kpis strong,.ind-kpis strong{font-size:clamp(16px,min(3.6vh,17cqw),38px);white-space:nowrap}
  .table-card th{white-space:normal}
  .igssp-top,.ind-top{flex-wrap:nowrap}
  .igssp-top>.igssp-period,.ind-top>.ind-period{flex:1 1 auto;min-width:0}
  .igssp-top>.card-head,.ind-top>.card-head{flex:0 1 250px}
  .igssp-pill,.ind-scale{white-space:normal;line-height:1.35}
  #state-chart{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(100%,128px),1fr));gap:8px;align-content:start}
  #state-chart .state-chip{display:flex;justify-content:space-between;align-items:center;padding:6px 10px}
  #state-chart .state-chip strong{margin-left:10px}
  .map-box .uf-tile{border-radius:6px}
  .igssp-drivers .driver-meta{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;text-overflow:ellipsis}
  .igssp-drivers .driver-meta>span{margin-right:8px}
  .igssp-method>summary{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;list-style:none}
  .igssp-method>summary::-webkit-details-marker{display:none}
  .igssp-method>summary::before{content:"▸ "}
  .igssp-method[open]>summary::before{content:"▾ "}
}
@media(min-width:1024px) and (max-width:1399px){
  .igssp-top>.card-head{display:none}
}
.uf-tile .v-int{display:none}
@container (max-width:320px){
  .map-box .uf-tile .v-full{display:none}
  .map-box .uf-tile .v-int{display:inline}
}
@media(min-width:1024px){
  /* SCAME */
  #scame-list-box,#scame-detail{flex:1 1 0;min-height:0;display:flex;flex-direction:column;gap:var(--gap)}
  #scame-list-box>*{flex:none;margin:0}
  #scame-detail>.toolbar{margin:0;flex:none}
  #scame-detail>.report{flex:1 1 0;min-height:0;display:flex;flex-direction:column;padding:var(--pad)}
  .report-head{flex:none;padding-bottom:clamp(6px,1.2vh,18px);margin-bottom:clamp(6px,1.2vh,16px)}
  .report-head h2{font-size:clamp(18px,2.6vh,28px)}
  .report>.fit-tabs{flex:none;margin-bottom:clamp(6px,1.2vh,14px)}
  .report>.fit-panel{flex:1 1 0;min-height:0;display:flex;flex-direction:column}
  .report>.fit-panel>*{flex:none}
  .report>.fit-panel>h3:first-child{margin-top:0}
  .report>.fit-tabs~.fit-panel>.panel-title{display:none}
  .report-head h2{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;text-overflow:ellipsis}
  .section-actions button,.toolbar button{white-space:nowrap}
  .section-actions p{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;text-overflow:ellipsis}
  .pagination{gap:14px}
  .pagination button{padding:clamp(4px,.7vh,8px) 14px}
  td{overflow-wrap:break-word}
  .filterbar.wrap{display:grid;grid-template-columns:repeat(auto-fill,minmax(122px,1fr));align-items:end}
  .filterbar.wrap label{min-width:0}
  .filterbar.wrap .full{grid-column:1/-1}
  #post-filters label:has(input[name=q]),#profile-filters label:has(input[name=q]),#event-filters label:has(input[name=q]),#scame-filters label:has(input[name=q]){grid-column:span 2}
  #rank-filters .switch,#scame-filters .chip,#scame-filters .segmented{grid-column:span 2;justify-self:start}
  #posts-table td .sub-line{-webkit-line-clamp:1}
  #evo-filters .pp{grid-column:span 2}
  .report>.fit-panel .scame-card{flex:none}
  .report-foot{flex:none;margin-top:clamp(6px,1.2vh,16px);padding-top:clamp(4px,.8vh,12px)}
  .report-foot p{margin:0 0 2px}
  .report p,.report li{line-height:1.6;margin-bottom:6px}
  .report>form{flex:1 1 0;min-height:0;display:flex;flex-direction:column}
  .report>form>.fit-fields{flex:1 1 0;min-height:0;display:grid;grid-template-columns:repeat(auto-fill,minmax(min(100%,380px),1fr));gap:4px 18px;align-content:start}
  .report>form textarea{min-height:0;height:clamp(84px,22vh,300px);resize:none}
  .shots{grid-template-columns:repeat(auto-fill,minmax(min(100%,190px),1fr));align-content:start}
  .shots img{max-height:clamp(120px,24vh,260px);aspect-ratio:4/3;object-fit:cover;object-position:top center}     /* miniaturas homogêneas; o print mostra o topo da página */
  .shots figcaption{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3;overflow:hidden;text-overflow:ellipsis}

  /* Assistente: o histórico da conversa é a única área com rolagem própria (data-scroll-ok) */
  #view-assistant>.chat{flex:1 1 0;min-height:0;width:100%;display:flex;flex-direction:column}
  .chat-head{flex:none;margin-bottom:var(--gap);justify-content:flex-end}
  .chat-head>div{display:none}
  .chat-log{flex:1 1 0;min-height:0;height:auto}
  .chat-form{flex:none;margin-top:var(--gap)}
  .chat-form textarea{min-height:48px;resize:none}
  .chat>.note{margin:6px 0 0}

  /* Posts, eventos, perfis, registros */
  #view-items>#items-list{flex:1 1 0;min-height:0;display:flex;flex-direction:column;gap:clamp(6px,1vh,12px)}
  #items-list>.card{padding:clamp(8px,1.2vh,16px) var(--pad)}
  #items-list .record-head{margin-bottom:4px}
  #items-list .record-body{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;text-overflow:ellipsis;white-space:normal;line-height:1.5;font-size:13px;margin:0 0 2px}
  #items-list .record-id{display:none}
  #items-list .card>button{padding:4px 12px;font-size:12px}
  .search{margin:0}

  /* custos */
  #view-costs{display:grid;grid-template-columns:minmax(0,1.5fr) minmax(300px,1fr);grid-template-rows:auto minmax(0,1fr) auto;gap:var(--gap)}
  #view-costs>.cost-grid{display:contents}
  #view-costs>.cost-grid>.card:first-child{grid-column:1;grid-row:1/3;display:flex;flex-direction:column;min-height:0}
  #view-costs>.cost-grid>.card:last-child{grid-column:2;grid-row:1}
  #view-costs>#cost-table{grid-column:2;grid-row:2}
  #view-costs>p.note{grid-column:1/-1;grid-row:3}
  #cost-chart{flex:1 1 0;min-height:0}
  .budget-value{font-size:clamp(26px,4.2vh,40px)}
  .budget-form{margin-top:10px;padding-top:10px}
  .budget-form label{margin-bottom:8px}

  /* credenciais */
  #view-credentials{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.15fr);grid-template-rows:auto minmax(0,1fr)}
  #view-credentials>.section-actions{grid-column:1/-1}
  #view-credentials>.card{display:flex;flex-direction:column;min-height:0;min-width:0}
  #policies-table,#accounts-table{flex:1 1 0;min-height:0;display:flex;flex-direction:column;overflow:hidden;container-type:inline-size}
  #policies-table th,#accounts-table th{white-space:normal}

  /* saúde */
  .health-banner{display:flex;flex-wrap:wrap;align-items:center;column-gap:28px;row-gap:4px;padding:clamp(10px,1.6vh,22px) clamp(14px,1.6vw,26px);margin:0}
  .health-banner>h2{font-size:clamp(17px,2.4vh,22px)}
  .health-banner>.health-counts{margin:0 0 0 auto;gap:20px}
  .health-counts strong{font-size:clamp(24px,3.6vh,36px)}
  #health-groups{flex:1 1 0;min-height:0;display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,300px),1fr));grid-auto-rows:minmax(0,1fr);gap:var(--gap)}
  .health-group{display:flex;flex-direction:column;min-height:0;margin:0}
  .health-group>h2{margin-bottom:4px}
  .health-row{padding:clamp(5px,.9vh,12px) 0}
  .health-row .detail{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;text-overflow:ellipsis}

  /* configurações: abas e um painel que preenche o espaço; campos excedentes vão para subpáginas */
  #settings-groups{flex:1 1 0;min-height:0;display:flex;flex-direction:column;gap:var(--gap)}
  #settings-groups>.set-tabs{flex:none}
  #settings-groups>.set-panels{flex:1 1 0;min-height:0;display:flex;flex-direction:column}
  .settings-card:not([hidden]){flex:1 1 0;min-height:0;display:flex;flex-direction:column}
  .settings-card>.set-grid{flex:1 1 0;min-height:0;align-content:start}
  .settings-card>.set-sub,.settings-card>.set-test,.settings-card>.set-foot{flex:none}
  .set-tab{padding:clamp(4px,.7vh,8px) 14px}
  .set-help{margin-top:4px;line-height:1.4}

  /* diálogos: altura máxima da janela; conteúdo em abas/páginas em vez de rolar */
  dialog{max-height:calc(100dvh - 24px);padding:clamp(14px,2.4vh,28px);overflow:hidden}
  dialog[open]{display:flex;flex-direction:column}
  dialog>form{display:flex;flex-direction:column;min-height:0;flex:1 1 auto}
  dialog .dialog-head{flex:none;margin-bottom:clamp(8px,1.8vh,24px)}
  dialog label{margin-bottom:clamp(6px,1.2vh,14px)}
  dialog input,dialog select{padding:clamp(6px,.9vh,10px) 11px}
  dialog .dialog-actions{margin-top:clamp(8px,1.6vh,24px)}
  dialog .note{margin:4px 0}
  #profile-dialog{width:760px}
  #profile-form{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));column-gap:15px;align-content:start}
  #profile-form>.dialog-head,#profile-form>.note,#profile-form>.form-error,#profile-form>.dialog-actions,#profile-form>.form-grid{grid-column:1/-1}
  #profile-form>.checkbox{margin-bottom:8px}
  dialog.wide .fit-tabs{flex:none;align-self:flex-start;margin-bottom:clamp(8px,1.4vh,16px)}
  dialog.wide .fit-panel{flex:1 1 auto;min-height:0;display:flex;flex-direction:column}
  dialog.wide .fit-panel>*{flex:none}
  dialog.wide{height:fit-content}
  #event-body,#post-body{display:contents}
  .kv{gap:8px;margin-bottom:12px}
  .kv div{padding:7px 10px}
  .post-line{padding:clamp(8px,1.2vh,14px) 0}
  .post-line .thumb{width:56px;height:56px}
  .post-line>div:not(.meta){display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3;overflow:hidden;text-overflow:ellipsis}
  .post-split{display:grid;grid-template-columns:minmax(0,1.5fr) minmax(0,1fr);gap:18px;align-items:start;min-height:0}
  .post-split>.thumb.big{max-height:min(420px,calc(100dvh - 300px));margin:0;width:100%}
  .post-split>.post-shot{margin:0;min-width:0}
  .post-split>.post-shot .thumb.big{max-height:min(400px,calc(100dvh - 330px));margin:0;width:100%}
  .post-shot figcaption{display:flex;flex-wrap:wrap;gap:4px 12px;margin-top:6px;font-size:12px}
  #validate-form{border-top:0;margin-top:0;padding-top:0}
  #validate-form h3{margin-top:0}
  #record-json{max-height:none;flex:1 1 auto;min-height:0}
}

/* ---------- login também cabe na janela */
@media(min-width:761px){
  .login-layout{min-height:100dvh;padding:clamp(16px,5vh,6vw) 7vw}
  .login-story h1{font-size:clamp(40px,min(5.2vw,8.5vh),86px);margin:clamp(14px,3.4vh,36px) 0 clamp(12px,2.6vh,28px)}
  .seal{margin:clamp(18px,4.4vh,46px) 0 clamp(16px,3.8vh,40px)}
  .login-card{padding:clamp(22px,4.4vh,40px)}
  .logo{margin-bottom:clamp(18px,4vh,40px)}
}

/* ---------- abaixo de 1024 px: fluxo natural, sem rolagem horizontal */
@media(max-width:1023px){
  .mini-chart>svg,#trend-chart>svg{width:100%;height:clamp(180px,42vw,300px)}
  .table-card{overflow:hidden;container-type:inline-size}
  td{max-width:none}
  dialog{max-height:calc(100dvh - 16px)}
  dialog.wide>.fit-panel{min-height:0}
  .map-box{display:flex;justify-content:center}
  .map-box>.igssp-map{width:min(100%,440px)}
  #event-body,#post-body{display:contents}
}

/* ---------- colunas secundárias por largura do contêiner da tabela */
@container (max-width:440px){
  th,td{padding-left:4px;padding-right:4px}
}
@container (max-width:1180px){
  #rank-table .c-sub-scores,#rank-table .c-coment,#profiles-table .c-periodicidade,#profiles-table .c-comentarios,#events-table .c-perfis{display:none}
}
@container (max-width:900px){
  #rank-table .c-alcance-pot,#rank-table .c-narrativa,#events-table .c-narrativa,#events-table .c-posts,#posts-table .c-narrativa,#posts-table .c-polaridade,
  #profiles-table .c-tipo,#profiles-table .c-seguidores,#profiles-table .c-posts,#runs-table .c-diagnostico,#sources-table .c-operacao,#scame-table .c-gerado-em{display:none}
}
@container (max-width:640px){
  #rank-table .c-tipo,#events-table .c-tipo,#posts-table .c-tema,#posts-table .c-revisao,#profiles-table .c-uf,#profiles-table .c-polaridade,#alerts-table .c-telegram,
  #scame-table .c-nivel-hostil,#runs-table .c-registros,#sources-table .c-limite{display:none}
}

@media print{
  .fit-off,.tab-off{display:revert!important}
  .report .panel-title{display:revert!important}
  .fit-pager,.fit-tabs{display:none!important}
  main,.work-main,#workspace{height:auto!important;display:block!important}
  .view:not([hidden]),#scame-detail:not([hidden]),.report,.report>.fit-panel{display:block!important;height:auto!important;min-height:0!important;flex:none!important}
  .report-head h2,.report p,.report li{-webkit-line-clamp:unset!important;display:block!important;overflow:visible!important}
  main>footer{position:static!important}
}
