/* Modo apresentação / tela cheia — visual only */

body.cap-presentation,
html.app-nav-pinned-boot body.cap-presentation {
  --brand: #334785;
  --brand-deep: #212e56;
  --teal: #008C8C;
  --ink: #1a2136;
  --muted: #748093;
  --line: #e7eaf1;
  --canvas: #eef1f7;
  --surface: #fff;
  --pos: #0b6b52;
  --neg: #8f2438;
  --cap-pres-bar-h: 52px;
  --app-nav-width: 0px;
  --font-ui: "Inter", system-ui, sans-serif;
  --font-num: "Space Grotesk", "Inter", system-ui, sans-serif;
  overflow: hidden;
  background: var(--canvas);
  font-family: var(--font-ui);
  color: var(--ink);
}

/* Rail oculta: conteúdo usa a largura cheia (anula pin/hover). */
body.cap-presentation .app-main {
  margin-left: 0;
  width: 100%;
}

/* Fallback quando Fullscreen API não está disponível */
body.cap-presentation.cap-presentation-overlay .cap-shell,
body.cap-presentation.cap-presentation-overlay .comercial-shell,
body.cap-presentation.cap-presentation-overlay .orc-app,
body.cap-presentation.cap-presentation-overlay .pf-shell {
  position: fixed;
  inset: 0;
  z-index: 9000;
  width: 100vw;
  height: 100vh;
  background: var(--canvas);
  padding-top: var(--cap-pres-bar-h);
}

/* —— Chrome escondido —— */
body.cap-presentation .app-main > header.topbar,
body.cap-presentation header.topbar,
body.cap-presentation > nav.main-nav,
body.cap-presentation > aside.app-sidebar,
body.cap-presentation > .app-nav-toggle,
body.cap-presentation > .app-sidebar-backdrop,
body.cap-presentation .app-mobile-menu,
body.cap-presentation .cap-sidebar,
body.cap-presentation .comercial-sidebar,
body.cap-presentation .orc-slicers,
body.cap-presentation .cap-filter-toggle,
body.cap-presentation .cap-topbar,
body.cap-presentation .comercial-topbar,
body.cap-presentation .orc-board-head,
body.cap-presentation .orc-filtros-ativos,
body.cap-presentation #avisoBox,
body.cap-presentation #capProgress,
body.cap-presentation #fcKpiPanel,
body.cap-presentation #finPremPanel,
body.cap-presentation #evolKpiPanel,
body.cap-presentation #capKpiStrip,
body.cap-presentation #kpisBox,
body.cap-presentation #extratoIndicadoresWrap,
body.cap-presentation #kpisSecundarios,
body.cap-presentation .cap-wbs-resize,
body.cap-presentation .comercial-resize-handle,
body.cap-presentation .orc-panel-resize,
body.cap-presentation .orc-split-v,
body.cap-presentation .comercial-panel-tools,
body.cap-presentation .cap-pres-enter,
body.cap-presentation #btnSummaryCopy,
body.cap-presentation .fc-card-desc,
body.cap-presentation .fc-cross-hint,
body.cap-presentation .fc-summary-hint,
body.cap-presentation .fc-plan-hint,
body.cap-presentation .fc-tipo-hint,
body.cap-presentation details.cap-panel,
body.cap-presentation details.comercial-panel,
body.cap-presentation .fin-row-tools,
body.cap-presentation #btnNovaLinhaFin,
body.cap-presentation .cap-panel-reset-btn,
body.cap-presentation .cap-panel-reset-tab-btn,
body.cap-presentation .orc-panel-reset,
body.cap-presentation .cap-export-btn,
body.cap-presentation #btnCopiarMatriz,
body.cap-presentation .pf-shell > .panel:not(#pfTablePanel),
body.cap-presentation .pf-toolbar-actions,
body.cap-presentation .legenda-inline,
body.cap-presentation .cap-legend-row,
body.cap-presentation .prem-hint-fx,
body.cap-presentation .prem-legend,
body.cap-presentation .prem-atualizado,
body.cap-presentation #filtrosAtivos,
body.cap-presentation #capCrossHint,
body.cap-presentation #crossFilterHint,
body.cap-presentation #placeholderObra {
  display: none !important;
}

/*
 * Expandir/recolher permanece ativo na apresentação.
 * .cap-tree-tools não é mais escondido por inteiro — só o chrome
 * (copiar, limpar, nova linha, etc.). Botões Expand/Collapse e
 * os carets da árvore (.cap-tree-btn / .versi-tree-toggle) ficam.
 */
body.cap-presentation .cap-tree-tools:not(:has(
  button[id*="Expand"],
  button[id*="Collapse"],
  button[id*="expand"],
  button[id*="collapse"]
)) {
  display: none !important;
}

body.cap-presentation .cap-tree-tools > :not(
  button[id*="Expand"],
  button[id*="Collapse"],
  button[id*="expand"],
  button[id*="collapse"]
) {
  display: none !important;
}

body.cap-presentation .cap-tree-btn,
body.cap-presentation .versi-tree-toggle,
body.cap-presentation .stock-expand-btn,
body.cap-presentation .cap-tree-tools button[id*="Expand"],
body.cap-presentation .cap-tree-tools button[id*="Collapse"],
body.cap-presentation .cap-tree-tools button[id*="expand"],
body.cap-presentation .cap-tree-tools button[id*="collapse"] {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  cursor: pointer !important;
}

body.cap-presentation .cap-tree-btn,
body.cap-presentation .versi-tree-toggle,
body.cap-presentation .stock-expand-btn {
  color: var(--ink, #1a2136) !important;
  font-size: 11px !important;
}

/*
 * Somente leitura (exceto planejado Transação/Fluxo).
 * .fc-plan-inp permanece editável + autosave em Apresentação.
 */
body.cap-presentation .fin-tipo-edit,
body.cap-presentation .fin-drag-handle,
body.cap-presentation .fin-tipo-label,
body.cap-presentation input.evol-inp-prev,
body.cap-presentation input.evol-inp-sienge,
body.cap-presentation input.evol-inp-manual {
  pointer-events: none !important;
  caret-color: transparent;
}

body.cap-presentation .fc-plan-inp {
  pointer-events: auto !important;
  caret-color: auto;
}

body.cap-presentation .fin-tipo-label {
  border: none !important;
  background: transparent !important;
}

/* Layout: um quadro maximizado */
body.cap-presentation .cap-shell,
body.cap-presentation .comercial-shell,
body.cap-presentation .orc-app,
body.cap-presentation .pf-shell {
  display: block;
  height: 100vh;
  padding-top: var(--cap-pres-bar-h);
  margin: 0;
  max-width: none;
  width: 100%;
  grid-template-columns: 1fr;
}

body.cap-presentation .cap-main,
body.cap-presentation .cap-main.fc-layout,
body.cap-presentation .fc-center,
body.cap-presentation .cap-body-scroll,
body.cap-presentation .comercial-main,
body.cap-presentation .comercial-body-scroll,
body.cap-presentation .orc-board,
body.cap-presentation .orc-tables,
body.cap-presentation .orc-row-split,
body.cap-presentation .pf-shell {
  display: block !important;
  width: 100% !important;
  max-width: none !important;
  height: calc(100vh - var(--cap-pres-bar-h)) !important;
  margin: 0 !important;
  padding: 0 !important;
  gap: 0 !important;
  overflow: hidden !important;
  background: transparent !important;
}

body.cap-presentation .cap-panel:not(.cap-pres-active),
body.cap-presentation .fc-summary-panel:not(.cap-pres-active),
body.cap-presentation #capVersiPanel:not(.cap-pres-active),
body.cap-presentation .comercial-panel:not(.cap-pres-active),
body.cap-presentation .orc-panel:not(.cap-pres-active),
body.cap-presentation #pfTablePanel:not(.cap-pres-active) {
  display: none !important;
}

body.cap-presentation .cap-pres-active {
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
  height: 100% !important;
  max-height: none !important;
  margin: 0 !important;
  border-radius: 0 !important;
  border: none !important;
  box-shadow: none !important;
  overflow: hidden !important;
  background: var(--surface) !important;
}

body.cap-presentation .cap-pres-active .cap-panel-head,
body.cap-presentation .cap-pres-active .fc-summary-head,
body.cap-presentation .cap-pres-active .fc-card-head,
body.cap-presentation .cap-pres-active .comercial-panel-head,
body.cap-presentation .cap-pres-active .comercial-chart-toolbar,
body.cap-presentation .cap-pres-active .orc-panel-h,
body.cap-presentation .cap-pres-active .pf-table-toolbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  padding: 8px 16px;
  min-height: 36px;
  border-bottom: 1px solid var(--line);
}

body.cap-presentation .cap-pres-active .fc-card-title {
  font-size: 15px;
}

body.cap-presentation .cap-pres-active .fc-card-head-text {
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 10px 14px;
}

body.cap-presentation .cap-pres-active .fc-card-legend,
body.cap-presentation .cap-pres-active .cap-periodo-legend {
  display: inline-flex !important;
  flex-wrap: nowrap;
  align-items: center;
  font-size: 11px;
  margin: 0;
  white-space: nowrap;
}

/* Período permanece legível em TV: cabeçalhos e divisor do corte */
body.cap-presentation .wbs-mes-h.cap-mes-realizado,
body.cap-presentation thead th.cap-mes-realizado,
body.cap-presentation thead th.fin-col-mes.cap-mes-realizado {
  background: #d9f0e8 !important;
  box-shadow: inset 0 -3px 0 #0b6b52 !important;
}
body.cap-presentation .wbs-mes-h.cap-mes-previsto,
body.cap-presentation thead th.cap-mes-previsto,
body.cap-presentation thead th.fin-col-mes.cap-mes-previsto {
  background: #e4e9f7 !important;
  box-shadow: inset 0 -3px 0 #334785 !important;
}
body.cap-presentation .wbs-mes-h.fc-mes-corte,
body.cap-presentation thead th.fc-mes-corte,
body.cap-presentation thead th.fin-col-mes.fc-mes-corte {
  background: #c8efeb !important;
  color: #008C8C !important;
  box-shadow: inset 0 -4px 0 #008C8C, inset 3px 0 0 #008C8C !important;
}
body.cap-presentation .wbs-mes-h.fc-mes-corte::after,
body.cap-presentation thead th.fc-mes-corte::after,
body.cap-presentation thead th.fin-col-mes.fc-mes-corte::after {
  font-size: 9px;
}
body.cap-presentation th.cap-mes-pos-corte-start,
body.cap-presentation td.cap-mes-pos-corte-start,
body.cap-presentation .fin-col-mes.cap-mes-pos-corte-start {
  border-left-width: 4px !important;
}

body.cap-presentation .cap-pres-active .cap-panel-body,
body.cap-presentation .cap-pres-active.fc-summary-panel,
body.cap-presentation .cap-pres-active .comercial-panel-body,
body.cap-presentation .cap-pres-active .orc-panel-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 8px 12px 12px;
  overflow: hidden;
}

body.cap-presentation .cap-pres-active .cap-panel-scroll,
body.cap-presentation .cap-pres-active .fin-table-wrap,
body.cap-presentation .cap-pres-active .fc-summary-wrap,
body.cap-presentation .cap-pres-active #finTablesWrap,
body.cap-presentation .cap-pres-active .comercial-panel-body-matrix,
body.cap-presentation .cap-pres-active .comercial-panel-body-chart,
body.cap-presentation .cap-pres-active .comercial-matrix-wrap,
body.cap-presentation .cap-pres-active .orc-panel-body,
body.cap-presentation .cap-pres-active .prem-table-wrap,
body.cap-presentation .cap-pres-active .table-wrap,
body.cap-presentation .cap-pres-active .evol-table-wrap,
body.cap-presentation .cap-pres-active .evol-curva-wrap {
  flex: 1 1 auto;
  min-height: 0 !important;
  max-height: none !important;
  height: auto !important;
  overflow: auto !important;
}

body.cap-presentation .cap-pres-active .evol-curva-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px 8px;
  border-bottom: 1px solid var(--line);
}

body.cap-presentation .cap-pres-active.evol-curva-panel .cap-panel-body {
  padding: 0;
}

/* Escala maior para TV */
body.cap-presentation .cap-wbs-table td,
body.cap-presentation .cap-wbs-table th,
body.cap-presentation .fin-table td,
body.cap-presentation .fin-table th,
body.cap-presentation .fc-summary-table td,
body.cap-presentation .fc-summary-table th,
body.cap-presentation .orc-tbl td,
body.cap-presentation .orc-tbl th,
body.cap-presentation .prem-table td,
body.cap-presentation .prem-table th,
body.cap-presentation .pf-table td,
body.cap-presentation .pf-table th,
body.cap-presentation .evol-table td,
body.cap-presentation .evol-table th,
body.cap-presentation .comercial-matrix td,
body.cap-presentation .comercial-matrix th {
  padding-top: 8px !important;
  padding-bottom: 8px !important;
}

body.cap-presentation .cap-wbs-chip,
body.cap-presentation .cap-wbs-val,
body.cap-presentation .fin-table td.num,
body.cap-presentation .fin-total-col,
body.cap-presentation .fin-anterior-col,
body.cap-presentation .fc-sum-num,
body.cap-presentation .fc-sum-val,
body.cap-presentation .orc-tbl .num,
body.cap-presentation .pf-table td,
body.cap-presentation .comercial-matrix .num {
  font-family: var(--font-num) !important;
  font-variant-numeric: tabular-nums;
  font-size: 14.5px !important;
  font-weight: 550;
}

body.cap-presentation .cap-wbs-table .cap-wbs-label,
body.cap-presentation .fin-tipo-label {
  font-size: 13.5px !important;
}

body.cap-presentation .fin-table thead th.fin-col-mes,
body.cap-presentation .cap-wbs-table thead th {
  font-size: 11px !important;
}

/* Heatmap um pouco mais forte (saturação) */
body.cap-presentation .fc-has-heat {
  filter: saturate(1.35) contrast(1.06);
}

/* Sparkline maior */
body.cap-presentation #fcSummarySpark {
  display: block !important;
  height: 88px;
  margin: 8px 12px 4px;
}

body.cap-presentation #fcSummarySpark .fc-spark-svg {
  width: 100%;
  height: 88px;
}

body.cap-presentation #fcSummarySpark .fc-spark-line {
  stroke-width: 2.4;
}

/* —— Barra slim —— */
.cap-pres-bar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10000;
  height: var(--cap-pres-bar-h, 52px);
  padding: 0 14px;
  box-sizing: border-box;
  align-items: center;
  gap: 12px;
  background: linear-gradient(180deg, #fbfcfe 0%, #f3f5fa 100%);
  border-bottom: 1px solid var(--line, #e7eaf1);
  box-shadow: 0 1px 8px rgba(33, 46, 86, 0.08);
  font-family: "Inter", system-ui, sans-serif;
  color: var(--ink, #1a2136);
}

body.cap-presentation .cap-pres-bar {
  display: flex;
}

.cap-pres-meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 0 1 280px;
}

.cap-pres-obra {
  font-size: 13px;
  font-weight: 650;
  color: var(--brand-deep, #212e56);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cap-pres-corte {
  font-size: 11px;
  color: var(--muted, #748093);
  font-variant-numeric: tabular-nums;
}

.cap-pres-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1 1 auto;
  justify-content: center;
}

.cap-pres-tab {
  border: 1px solid var(--line, #e7eaf1);
  background: #fff;
  color: var(--ink, #1a2136);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 550;
  cursor: pointer;
}

.cap-pres-tab[aria-selected="true"] {
  background: var(--brand, #334785);
  border-color: var(--brand, #334785);
  color: #fff;
}

.cap-pres-tab:focus-visible {
  outline: 2px solid var(--teal, #008C8C);
  outline-offset: 2px;
}

.cap-pres-exit {
  flex: 0 0 auto;
  border: 1px solid var(--line, #e7eaf1);
  background: #fff;
  color: var(--brand-deep, #212e56);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.cap-pres-exit:hover {
  border-color: var(--brand, #334785);
}

.cap-pres-exit:focus-visible {
  outline: 2px solid var(--teal, #008C8C);
  outline-offset: 2px;
}

/* Botão de entrada (páginas) */
.cap-pres-enter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.cap-pres-enter .cap-pres-ico {
  font-size: 13px;
  line-height: 1;
}
