/* ===== MODO VISUALIZAÇÃO - Fullscreen Dashboard ===== */

/* Estado quando modo visualização está ativo */
body.view-mode-active {
  overflow: hidden;
  background: #f0f2f5;
}

/* Esconde sidebar no modo visualização */
body.view-mode-active .sidebar,
body.view-mode-active .sidebar-toggle-container {
  display: none !important;
}

/* Esconde elementos do header que não queremos */
body.view-mode-active .header-center,
body.view-mode-active .header-right,
body.view-mode-active #user-menu-container,
body.view-mode-active .search-container {
  display: none !important;
}

/* Main content ocupa 100% da tela */
body.view-mode-active .main-content {
  margin-left: 0 !important;
  padding: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  max-width: 100vw !important;
  overflow: auto;
  background: #f0f2f5;
}

/* Header da página - fundo cinza igual ao resto */
body.view-mode-active header {
  background: #f0f2f5;
  padding: 16px 30px;
  border-bottom: none;
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

body.view-mode-active .header-left h1 {
  font-size: 20px;
  font-weight: 600;
  color: #333;
  margin: 0;
}

body.view-mode-active .header-left p {
  font-size: 13px;
  color: #666;
  margin: 4px 0 0 0;
}

/* Container principal */
body.view-mode-active .index-container,
body.view-mode-active .resultado-container,
body.view-mode-active .main-content > div {
  max-width: 100% !important;
  width: 100% !important;
  padding: 20px 30px;
  margin: 0;
}

body.view-mode-active #main-content-wrapper {
  padding: 0;
}

/* ===== PAINEL DE CONTROLES (canto inferior esquerdo) ===== */
.view-mode-controls {
  position: fixed;
  bottom: 20px;
  left: 20px;
  background: rgba(0, 0, 0, 0.9);
  border-radius: 12px;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  z-index: 100001;
  font-family: 'Poppins', sans-serif;
  color: white;
  min-width: 300px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}

.view-mode-controls.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

/* Estado minimizado */
.view-mode-controls.minimized {
  min-width: auto;
  padding: 10px 14px;
}

.view-mode-controls.minimized .view-mode-controls-body {
  display: none;
}

.view-mode-controls.minimized .view-mode-controls-header {
  padding-bottom: 0;
  border-bottom: none;
}

.view-mode-controls.minimized .view-mode-controls-header h4 span {
  display: none;
}

/* Título do painel */
.view-mode-controls-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.15);
  gap: 12px;
}

.view-mode-controls-header h4 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.view-mode-controls-header h4 i {
  color: #7f3f98;
}

/* Botões do header (minimizar) */
.view-mode-header-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}

.view-mode-minimize-btn {
  background: rgba(255,255,255,0.1);
  border: none;
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.view-mode-minimize-btn:hover {
  background: rgba(255,255,255,0.2);
}

/* Corpo do painel (escondido quando minimizado) */
.view-mode-controls-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Seção de controles */
.view-mode-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.view-mode-section-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(255,255,255,0.6);
  margin-bottom: 2px;
}

/* Seletor de tempo */
.view-mode-time-selector {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.view-mode-time-btn {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 11px;
  font-family: 'Poppins', sans-serif;
  cursor: pointer;
  transition: all 0.2s ease;
}

.view-mode-time-btn:hover {
  background: rgba(255,255,255,0.2);
}

.view-mode-time-btn.active {
  background: #7f3f98;
  border-color: #7f3f98;
}

/* Checkboxes de dashboards */
.view-mode-dashboard-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.view-mode-dashboard-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: rgba(255,255,255,0.05);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.view-mode-dashboard-item:hover {
  background: rgba(255,255,255,0.1);
}

.view-mode-dashboard-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #7f3f98;
  cursor: pointer;
}

.view-mode-dashboard-item label {
  font-size: 12px;
  cursor: pointer;
  flex: 1;
}

.view-mode-dashboard-item .dashboard-icon {
  font-size: 14px;
  opacity: 0.7;
}

/* Navegação de páginas com setas */
.view-mode-navigation {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px;
  background: rgba(127, 63, 152, 0.2);
  border-radius: 8px;
}

.view-mode-nav-btn {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.view-mode-nav-btn:hover:not(:disabled) {
  background: rgba(255,255,255,0.2);
  transform: scale(1.05);
}

.view-mode-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.view-mode-nav-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.view-mode-nav-info .page-name {
  font-size: 12px;
  font-weight: 500;
}

.view-mode-page-dots {
  display: flex;
  gap: 4px;
}

.view-mode-page-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
  transition: background 0.2s ease;
  cursor: pointer;
}

.view-mode-page-dot:hover {
  background: rgba(255,255,255,0.5);
}

.view-mode-page-dot.active {
  background: #7f3f98;
}

/* Timer */
.view-mode-timer {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: rgba(255,255,255,0.7);
}

.view-mode-timer i {
  font-size: 12px;
}

/* Botão de sair */
.view-mode-exit-btn {
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-family: 'Poppins', sans-serif;
  font-size: 12px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
  margin-top: 4px;
}

.view-mode-exit-btn:hover {
  background: rgba(239, 68, 68, 0.3);
  border-color: rgba(239, 68, 68, 0.6);
}

/* ===== Ajustes de altura dos widgets no modo visualização ===== */
body.view-mode-active .widget.widget-contas,
body.view-mode-active .widget.widget-projetos {
  height: calc(50vh - 100px);
  min-height: 280px;
}

body.view-mode-active .widget.widget-main-kpi {
  height: auto;
  min-height: 200px;
}

/* ===== Responsivo ===== */

/* Full HD (1920x1080) */
@media (min-width: 1920px) {
  body.view-mode-active .index-container,
  body.view-mode-active .resultado-container {
    padding: 24px 40px;
  }

  body.view-mode-active .row-bottom {
    gap: 24px;
  }

  body.view-mode-active .widget {
    padding: 18px 20px;
  }

  body.view-mode-active .widget-title {
    font-size: 15px !important;
  }

  body.view-mode-active .modern-table {
    font-size: 12px;
  }

  body.view-mode-active .modern-table thead th {
    font-size: 10px;
  }
}

/* 2K (2560x1440) */
@media (min-width: 2560px) {
  body.view-mode-active .index-container,
  body.view-mode-active .resultado-container {
    padding: 30px 50px;
  }

  body.view-mode-active .widget {
    padding: 22px 24px;
  }

  body.view-mode-active .widget-title {
    font-size: 17px !important;
  }

  body.view-mode-active .modern-table {
    font-size: 13px;
  }

  body.view-mode-active .modern-table thead th {
    font-size: 11px;
  }
}

/* 4K (3840x2160) */
@media (min-width: 3840px) {
  body.view-mode-active .index-container,
  body.view-mode-active .resultado-container {
    padding: 40px 60px;
  }

  body.view-mode-active .widget {
    padding: 28px 30px;
  }

  body.view-mode-active .widget-title {
    font-size: 20px !important;
  }

  body.view-mode-active .modern-table {
    font-size: 15px;
  }

  body.view-mode-active .modern-table thead th {
    font-size: 13px;
  }
}

/* Tablets e telas menores */
@media (max-width: 1366px) {
  body.view-mode-active .index-container,
  body.view-mode-active .resultado-container {
    padding: 16px 20px;
  }

  body.view-mode-active .widget {
    padding: 12px 14px;
  }

  body.view-mode-active .widget-title {
    font-size: 12px !important;
  }

  body.view-mode-active .modern-table {
    font-size: 10px;
  }

  body.view-mode-active header {
    padding: 12px 20px;
  }

  body.view-mode-active .header-left h1 {
    font-size: 18px;
  }

  .view-mode-controls {
    min-width: 260px;
    padding: 12px 16px;
  }
}

/* Animação de entrada */
@keyframes viewModeEnter {
  from {
    opacity: 0;
    transform: scale(0.98);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

body.view-mode-active .index-container,
body.view-mode-active .resultado-container {
  animation: viewModeEnter 0.3s ease-out;
}

/* ===== ESTILOS PARA PÁGINAS DENTRO DO IFRAME (viewmode=1) ===== */
/* Modo visualização: igual à página normal, só esconde sidebar/header */

/* Esconde sidebar e elementos de navegação */
html.viewmode-embed .sidebar,
html.viewmode-embed .sidebar-toggle-container,
body.viewmode-embed .sidebar,
body.viewmode-embed .sidebar-toggle-container {
  display: none !important;
}

html.viewmode-embed,
body.viewmode-embed {
  background: #f0f2f5 !important;
}

/* Main content ocupa 100% sem sidebar */
html.viewmode-embed .main-content,
body.viewmode-embed .main-content {
  margin-left: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
}

/* ===== DASHBOARD GERAL - MODO VISUALIZAÇÃO ===== */
/* Otimizado para TV */

body.viewmode-embed .index-container {
  max-width: 100% !important;
  padding: 0 24px !important;
  min-height: calc(100vh - 80px);
  display: flex;
  flex-direction: column;
}

/* Widget KPI principal (Resultados Silicon) - 56% da tela */
body.viewmode-embed .widget.widget-main-kpi {
  height: 56vh !important;
  min-height: 420px !important;
  max-height: 560px !important;
  padding: 16px 20px !important;
  overflow: visible !important;
}

body.viewmode-embed .widget.widget-main-kpi .card-chart-container {
  height: calc(56vh - 180px) !important;
  min-height: 240px !important;
}

body.viewmode-embed .widget.widget-main-kpi .kpi-metric .value {
  font-size: 16px !important;
}

body.viewmode-embed .widget.widget-main-kpi .kpi-metric .label {
  font-size: 10px !important;
}

/* Row bottom (tabelas) - ocupa o resto */
body.viewmode-embed .row-bottom {
  flex: 1 1 auto;
  min-height: 180px;
  gap: 14px;
  margin-top: 10px;
}

/* Widgets de tabela - ocupam espaço restante */
body.viewmode-embed .widget.widget-contas,
body.viewmode-embed .widget.widget-projetos {
  height: calc(44vh - 80px) !important;
  min-height: 220px !important;
  max-height: none !important;
  padding: 10px 14px !important;
}

/* Container da tabela expande */
body.viewmode-embed .widget.widget-contas .modern-table-container,
body.viewmode-embed .widget.widget-projetos .modern-table-container {
  max-height: calc(100% - 50px) !important;
  height: calc(100% - 50px) !important;
  flex: 1;
}

/* MOSTRAR paginação no modo visualização */
body.viewmode-embed .widget.widget-contas .pagination-bar,
body.viewmode-embed .widget.widget-projetos .pagination-bar {
  display: flex !important;
}

/* ===== RESULTADO GERAL - MODO VISUALIZAÇÃO ===== */
/* Ocupa toda a tela - header 40px, padding 20px em cima e baixo */

body.viewmode-embed .resultado-container {
  max-width: 100% !important;
  padding: 0 24px !important;
  min-height: calc(100vh - 80px) !important;
  display: flex !important;
  flex-direction: column !important;
}

/* Card principal KPI (Silicon Geral + Resultado Mês) - 50% da tela */
body.viewmode-embed .main-kpi-card {
  height: 50vh !important;
  min-height: 380px !important;
  max-height: 480px !important;
  padding: 16px 20px !important;
  flex-shrink: 0 !important;
}

body.viewmode-embed .main-kpi-card .card-chart-container {
  height: calc(50vh - 180px) !important;
  min-height: 200px !important;
}

body.viewmode-embed .main-kpi-card .card-header h3 {
  font-size: 16px !important;
}

body.viewmode-embed .main-kpi-card .kpi-metric .value {
  font-size: 16px !important;
}

body.viewmode-embed .main-kpi-card .kpi-metric .label {
  font-size: 10px !important;
}

body.viewmode-embed .main-kpi-card .kpi-metrics {
  gap: 8px !important;
}

body.viewmode-embed .main-kpi-card .kpi-metric {
  padding: 5px 8px !important;
}

/* Cards das BUs - GRID 5 COLUNAS, 58% da tela */
body.viewmode-embed #sub-kpi-container {
  display: grid !important;
  grid-template-columns: repeat(5, 1fr) !important;
  gap: 12px !important;
  margin-top: 12px !important;
  flex: 1 !important;
  align-content: stretch !important;
}

body.viewmode-embed #sub-kpi-container .kpi-card {
  height: calc(50vh - 60px) !important;
  min-height: 400px !important;
  max-height: none !important;
  padding: 12px 14px !important;
  width: 100% !important;
  display: flex !important;
  flex-direction: column !important;
}

body.viewmode-embed #sub-kpi-container .kpi-card .card-chart-container {
  flex: 1 !important;
  height: auto !important;
  min-height: 120px !important;
}

body.viewmode-embed #sub-kpi-container .kpi-card .card-header {
  margin-bottom: 8px !important;
  flex-shrink: 0 !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
}

body.viewmode-embed #sub-kpi-container .kpi-card .card-header h3 {
  font-size: 16px !important;
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
}

/* Indicadores das BUs - fontes maiores */
body.viewmode-embed #sub-kpi-container .kpi-card .kpi-metric .value {
  font-size: 14px !important;
}

body.viewmode-embed #sub-kpi-container .kpi-card .kpi-metric .label {
  font-size: 9px !important;
}

body.viewmode-embed #sub-kpi-container .kpi-card .kpi-metrics {
  gap: 5px !important;
  flex-shrink: 0 !important;
}

body.viewmode-embed #sub-kpi-container .kpi-card .kpi-metric {
  padding: 4px 6px !important;
}

/* ===== USO SALESFORCE - MODO VISUALIZAÇÃO ===== */
/* Tabelas de pessoas ocupam mais espaço */

body.viewmode-embed .salesforce-dashboard {
  gap: 20px;
}

body.viewmode-embed .dashboard-panel .table-container {
  max-height: calc(100vh - 300px) !important;
}

/* Painel de uso com altura fixa, tabelas expandem */
body.viewmode-embed .panel-uso-salesforce {
  flex-shrink: 0;
}

body.viewmode-embed .panel-pessoas,
body.viewmode-embed .panel-indicadores {
  flex: 1;
}

/* ============================================================ */
/* ===== OTIMIZAÇÃO PARA TVs 16:9 - MODO VISUALIZAÇÃO ===== */
/* ============================================================ */

/*
 * TVs típicas:
 * - Full HD: 1920x1080 (16:9)
 * - 4K UHD: 3840x2160 (16:9)
 *
 * Detecta proporção 16:9 usando aspect-ratio media query
 */

/* ===== TV FULL HD (1920x1080) ===== */
@media screen and (min-width: 1900px) and (max-width: 1930px) and (min-height: 1070px) and (max-height: 1090px),
       screen and (min-aspect-ratio: 16/9) and (max-aspect-ratio: 16/9) and (min-width: 1900px) {

  /* Header do view-mode bem compacto na TV */
  #view-mode-header {
    padding: 6px 24px !important;
  }

  #view-mode-header h1 {
    font-size: 16px !important;
  }

  #view-mode-header p {
    font-size: 10px !important;
  }

  #view-mode-header img {
    height: 26px !important;
  }

  /* Container principal */
  body.viewmode-embed .index-container {
    padding: 0 24px !important;
    max-width: 100% !important;
  }

  /* Widget KPI principal - um pouco maior */
  body.viewmode-embed .widget.widget-main-kpi {
    min-height: 200px !important;
    max-height: 240px !important;
    height: auto !important;
    padding: 12px 16px !important;
  }

  body.viewmode-embed .widget.widget-main-kpi .card-chart-container {
    height: 120px !important;
  }

  /* KPI metrics do widget principal */
  body.viewmode-embed .widget.widget-main-kpi .kpi-metric .value {
    font-size: 14px !important;
  }

  body.viewmode-embed .widget.widget-main-kpi .kpi-metric .label {
    font-size: 10px !important;
  }

  body.viewmode-embed .widget.widget-main-kpi .kpi-metrics {
    gap: 6px !important;
  }

  /* Row bottom - widgets de tabela ocupam o resto da tela */
  body.viewmode-embed .row-bottom {
    gap: 16px;
    margin-top: 12px;
    flex: 1;
  }

  body.viewmode-embed .widget.widget-contas,
  body.viewmode-embed .widget.widget-projetos {
    height: calc(100vh - 340px) !important;
    min-height: 380px !important;
    padding: 12px 16px !important;
  }

  /* Container das tabelas expande para ocupar todo espaço */
  body.viewmode-embed .widget.widget-contas .modern-table-container,
  body.viewmode-embed .widget.widget-projetos .modern-table-container {
    max-height: calc(100% - 40px) !important;
    height: calc(100% - 40px) !important;
  }

  /* Fontes das tabelas - compactas */
  body.viewmode-embed .modern-table {
    font-size: 10px !important;
  }

  body.viewmode-embed .modern-table thead th {
    font-size: 8px !important;
    padding: 4px 6px !important;
  }

  body.viewmode-embed .modern-table tbody td {
    padding: 5px 6px !important;
  }

  /* Títulos dos widgets */
  body.viewmode-embed .widget-title {
    font-size: 12px !important;
  }

  /* Status pills */
  body.viewmode-embed .status-pill {
    font-size: 9px !important;
    padding: 2px 6px !important;
  }

  /* Header da página interno */
  body.viewmode-embed header {
    padding: 8px 24px !important;
  }

  body.viewmode-embed .header-left h1 {
    font-size: 16px !important;
  }

  body.viewmode-embed .header-left p {
    font-size: 11px !important;
  }
}

/* ===== TV 4K (3840x2160) ===== */
@media screen and (min-width: 3800px) and (min-height: 2100px),
       screen and (min-aspect-ratio: 16/9) and (max-aspect-ratio: 16/9) and (min-width: 3800px) {

  /* Header do view-mode mais compacto na TV 4K */
  #view-mode-header {
    padding: 16px 60px !important;
  }

  #view-mode-header h1 {
    font-size: 32px !important;
  }

  #view-mode-header p {
    font-size: 18px !important;
  }

  #view-mode-header img {
    height: 48px !important;
  }

  /* Container principal */
  body.viewmode-embed .index-container {
    padding: 0 80px !important;
    max-width: 100% !important;
  }

  /* Widget KPI principal maior */
  body.viewmode-embed .widget.widget-main-kpi {
    min-height: 500px !important;
    height: auto !important;
  }

  body.viewmode-embed .widget.widget-main-kpi .card-chart-container {
    height: 320px !important;
  }

  /* Row bottom - widgets de tabela maiores */
  body.viewmode-embed .row-bottom {
    gap: 48px;
    margin-top: 32px;
  }

  body.viewmode-embed .widget.widget-contas,
  body.viewmode-embed .widget.widget-projetos {
    height: calc(100vh - 700px) !important;
    min-height: 700px !important;
  }

  /* Container das tabelas expande */
  body.viewmode-embed .widget.widget-contas .modern-table-container,
  body.viewmode-embed .widget.widget-projetos .modern-table-container {
    max-height: calc(100% - 80px) !important;
  }

  /* Fontes ainda maiores para TV 4K (visualização à distância) */
  body.viewmode-embed .modern-table {
    font-size: 18px !important;
  }

  body.viewmode-embed .modern-table thead th {
    font-size: 15px !important;
    padding: 14px 16px !important;
  }

  body.viewmode-embed .modern-table tbody td {
    padding: 16px 18px !important;
  }

  /* Títulos dos widgets maiores */
  body.viewmode-embed .widget-title {
    font-size: 22px !important;
  }

  /* KPI metrics maiores */
  body.viewmode-embed .kpi-metric .value {
    font-size: 32px !important;
  }

  body.viewmode-embed .kpi-metric .label {
    font-size: 16px !important;
  }

  /* Status pills maiores */
  body.viewmode-embed .status-pill {
    font-size: 15px !important;
    padding: 6px 14px !important;
  }

  /* Widgets com padding maior */
  body.viewmode-embed .widget {
    padding: 24px 28px !important;
    border-radius: 16px !important;
  }

  /* Botões mini maiores */
  body.viewmode-embed .btn-mini {
    font-size: 13px !important;
    padding: 6px 14px !important;
  }
}

/* ===== AJUSTES GERAIS PARA PROPORÇÃO 16:9 - CABE EM UMA TELA ===== */
@media screen and (min-aspect-ratio: 16/10) and (max-aspect-ratio: 16/8) {

  /* Garante que o conteúdo usa todo o espaço sem scroll */
  body.viewmode-embed .main-content {
    width: 100% !important;
    max-width: 100% !important;
    height: 100vh !important;
    max-height: 100vh !important;
    overflow: hidden !important;
  }

  /* Header da página bem compacto */
  body.viewmode-embed header {
    padding: 6px 20px !important;
  }

  body.viewmode-embed .header-left h1 {
    font-size: 16px !important;
  }

  body.viewmode-embed .header-left p {
    font-size: 11px !important;
    margin-top: 2px !important;
  }

  /* === DASHBOARD GERAL (index) === */
  body.viewmode-embed .index-container {
    padding: 0 20px !important;
    height: calc(100vh - 45px) !important;
    max-height: calc(100vh - 45px) !important;
    overflow: hidden !important;
  }

  /* Widget KPI principal - levemente maior */
  body.viewmode-embed .widget.widget-main-kpi {
    height: auto !important;
    min-height: auto !important;
    max-height: 40vh !important;
    padding: 12px 16px !important;
  }

  body.viewmode-embed .widget.widget-main-kpi .card-chart-container {
    height: 20vh !important;
    min-height: 120px !important;
  }

  body.viewmode-embed .widget.widget-main-kpi .kpi-metric .value {
    font-size: 14px !important;
  }

  body.viewmode-embed .widget.widget-main-kpi .kpi-metric .label {
    font-size: 10px !important;
  }

  body.viewmode-embed .widget.widget-main-kpi .kpi-metrics {
    gap: 5px !important;
  }

  body.viewmode-embed .widget.widget-main-kpi .kpi-metric {
    padding: 4px 8px !important;
  }

  /* Row bottom - tabelas */
  body.viewmode-embed .row-bottom {
    grid-template-columns: 1fr 1fr !important;
    gap: 14px !important;
    margin-top: 10px !important;
    flex: 1 !important;
    max-height: 50vh !important;
  }

  body.viewmode-embed .widget.widget-contas,
  body.viewmode-embed .widget.widget-projetos {
    height: 100% !important;
    min-height: auto !important;
    max-height: 48vh !important;
    padding: 10px 14px !important;
  }

  body.viewmode-embed .widget.widget-contas .modern-table-container,
  body.viewmode-embed .widget.widget-projetos .modern-table-container {
    max-height: calc(100% - 38px) !important;
  }

  body.viewmode-embed .modern-table {
    font-size: 11px !important;
  }

  body.viewmode-embed .modern-table thead th {
    font-size: 9px !important;
    padding: 5px 6px !important;
  }

  body.viewmode-embed .modern-table tbody td {
    padding: 5px 6px !important;
  }

  body.viewmode-embed .widget-title {
    font-size: 12px !important;
    margin-bottom: 8px !important;
  }

  /* === RESULTADO GERAL === */
  body.viewmode-embed .resultado-container {
    padding: 0 20px !important;
    height: calc(100vh - 45px) !important;
    max-height: calc(100vh - 45px) !important;
    overflow: hidden !important;
  }

  /* Card principal KPI - levemente maior */
  body.viewmode-embed .main-kpi-card {
    height: auto !important;
    min-height: auto !important;
    max-height: 40vh !important;
    padding: 12px 16px !important;
  }

  body.viewmode-embed .main-kpi-card .card-chart-container {
    height: 18vh !important;
    min-height: 110px !important;
  }

  body.viewmode-embed .main-kpi-card .card-header h3 {
    font-size: 15px !important;
  }

  body.viewmode-embed .main-kpi-card .kpi-metric .value {
    font-size: 14px !important;
  }

  body.viewmode-embed .main-kpi-card .kpi-metric .label {
    font-size: 10px !important;
  }

  body.viewmode-embed .main-kpi-card .kpi-metrics {
    gap: 5px !important;
  }

  body.viewmode-embed .main-kpi-card .kpi-metric {
    padding: 4px 8px !important;
  }

  /* Cards das BUs - grid 5 colunas, levemente maior */
  body.viewmode-embed #sub-kpi-container {
    display: grid !important;
    grid-template-columns: repeat(5, 1fr) !important;
    gap: 12px !important;
    margin-top: 10px !important;
    max-height: 50vh !important;
  }

  body.viewmode-embed #sub-kpi-container .kpi-card {
    height: auto !important;
    min-height: auto !important;
    max-height: 48vh !important;
    padding: 10px 12px !important;
  }

  body.viewmode-embed #sub-kpi-container .kpi-card .card-chart-container {
    height: 16vh !important;
    min-height: 90px !important;
  }

  body.viewmode-embed #sub-kpi-container .kpi-card .card-header h3 {
    font-size: 13px !important;
  }

  body.viewmode-embed #sub-kpi-container .kpi-card .kpi-metric .value {
    font-size: 12px !important;
  }

  body.viewmode-embed #sub-kpi-container .kpi-card .kpi-metric .label {
    font-size: 9px !important;
  }

  body.viewmode-embed #sub-kpi-container .kpi-card .kpi-metrics {
    gap: 4px !important;
  }

  body.viewmode-embed #sub-kpi-container .kpi-card .kpi-metric {
    padding: 3px 6px !important;
  }
}

/* ===== CONTROLES DO VIEW MODE - TV ===== */
/* Controles maiores e mais visíveis na TV */
@media screen and (min-width: 1900px) and (min-aspect-ratio: 15/9) {

  .view-mode-controls {
    min-width: 360px !important;
    padding: 20px 24px !important;
    border-radius: 16px !important;
    bottom: 30px !important;
    left: 30px !important;
  }

  .view-mode-controls-header h4 {
    font-size: 15px !important;
  }

  .view-mode-section-title {
    font-size: 12px !important;
  }

  .view-mode-time-btn {
    padding: 8px 16px !important;
    font-size: 13px !important;
  }

  .view-mode-dashboard-item label {
    font-size: 14px !important;
  }

  .view-mode-nav-info .page-name {
    font-size: 14px !important;
  }

  .view-mode-exit-btn {
    padding: 14px 20px !important;
    font-size: 14px !important;
  }
}
