/* ===== Base ===== */
:root{
  --purple:#7f3f98;
  --border-color:#e9e9e9;

  /* Header */
  --header-gap: 6px;
  --icon-size: 40px;
  --icon-nudge: -4px;

  /* Altura dos widgets - escala com viewport em telas grandes */
  --widget-h: 315px;
}
*{ box-sizing:border-box; }
html,body{
  margin:0; padding:0;
  font-family:"Poppins",system-ui,-apple-system,Segoe UI,Roboto,"Helvetica Neue",Arial;
  color:#222;
}

/* ===== Container geral ===== */
.index-container{
  width:100%;
  padding:0 15px;
  /* Sem max-width - usa 100% do espaço como outras páginas */
}

/* ===== Linhas ===== */
.row-top{
  display:grid;
  grid-template-columns: 1fr;
  gap:20px;
  margin-top:16px;
}

/* Row-top com news: 65% resultado + 35% news (apenas fora do viewmode) */
.row-top.row-top-with-news {
  grid-template-columns: 1fr auto;
  gap: 20px;
}

/* Widget Silicon News tem largura fixa */
.row-top.row-top-with-news .widget-silicon-news {
  width: 320px;
  flex-shrink: 0;
}

.row-bottom{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:20px;
  margin-top:16px;
}
/* Mantém 2 colunas; só empilha em telas bem pequenas */
@media (max-width:900px){
  .row-top{ grid-template-columns:1fr; }
  .row-top.row-top-with-news { grid-template-columns: 1fr; }
}
@media (max-width:840px){
  .row-bottom{ grid-template-columns:1fr; }
}

/* Ajuste de proporção visual: Oportunidades x Projetos (50/50 de largura, mas o
   widget de oportunidades com altura um pouco maior e projetos menor) */
.row-bottom .widget.widget-contas{ height: var(--widget-h); }
.row-bottom .widget.widget-projetos{ height: var(--widget-h); }

/* ===== Widget base ===== */
.widget{
  background:#fff;
  border:1px solid var(--border-color);
  border-radius:12px;
  padding:14px 16px;
  display:flex;
  flex-direction:column;
  height:100%;
  overflow:visible; /* evita cortar títulos elevados visualmente */
  isolation: auto; /* não cria novo contexto que possa "prender" z-index dos filtros */
}

/* Garante que o dropdown do usuário esteja sempre na frente dos widgets desta página */
header{ position: relative; z-index: 20000; }
.widget, .modern-table-container{ position: relative; z-index: 1; }

/* Altura controlada */
.widget.widget-gymrats,
.widget.widget-contas,
.widget.widget-projetos,
.widget.widget-main-kpi{
  height: var(--widget-h);
}

/* Evita que o card principal ultrapasse a altura do widget */
.widget.widget-main-kpi{ overflow: hidden; }

/* Evitar expansão do widget GymRats ao popular a tabela no index */
.widget.widget-gymrats .modern-table-container{
  max-height: calc(var(--widget-h) - 130px); /* reserva espaço para header + métricas */
  overflow-y: auto;
}

/* Header */
.widget-header{
  display:flex;
  align-items:center;
  gap:var(--header-gap) !important;
  margin-bottom:10px;
  position: relative;
  z-index: 3000;
}
.widget-title-wrap{
  display:flex;
  align-items:center;
  gap:var(--header-gap) !important;
  min-width:0;
  position: relative;
  z-index: 3000;
}
.widget-title-icon{
  width:var(--icon-size);
  height:var(--icon-size);
  flex-shrink:0;
  display:flex; align-items:center; justify-content:center;
  margin-right: var(--icon-nudge);
}
.widget-title-icon img{
  width:100%; height:100%;
  object-fit:contain; display:block;
}

/* Botão mini preto ("Ver mais >") para os headers */
.btn-mini{
  display:inline-flex !important;
  align-items:center !important;
  gap:6px !important;
  padding:2px 6px !important;
  border-radius:999px !important;
  font-size:9px !important;
  font-weight:600 !important;
  background:#222 !important;
  color:#fff !important;
  border:1px solid #222 !important;
  cursor:pointer !important;
  text-decoration:none !important;
  line-height:1 !important;
}
.btn-mini:hover{ background:#111 !important; border-color:#111 !important; color:#fff !important; }
.btn-mini i{ font-size:9px !important; }

/* Posicionamento: imediatamente ao lado do título */
.widget-header .btn-mini{ margin-left:8px; }
.kpi-card-header .btn-mini:first-of-type{ margin-left:auto; }
.kpi-card-header .btn-mini + .btn-mini{ margin-left:8px; }

/* Alinhamento vertical com o título/paginação deslocados */
.widget .widget-header .btn-mini{ transform: translateY(-12px); }

/* Remover borda interna e otimizar ocupação do card KPI principal do index */
.widget-main-kpi .kpi-card{
  border: 0 !important;
  background: transparent !important;
  padding: 8px 10px !important;
}
.widget-main-kpi .kpi-card .kpi-card-header{ margin-bottom: 10px; }
.widget-main-kpi .kpi-card .card-chart-container{ height: 120px; }
/* Ajustar fonte dos valores KPI no widget principal para melhor aproveitamento do espaço */
.widget-main-kpi .kpi-metric .value{ font-size: 15px !important; }
.widget-header .widget-title,
.compact .widget-header .widget-title{
  margin:0;
  font-weight:600;
  font-size:13.5px !important;
  line-height:1.1;
  color:#000;
  /* Alinhar com comportamento do resultado-geral (não cortar título) */
  white-space: normal;
  overflow: visible;
  text-overflow: initial;
}

/* ===== Chips de métricas (neutros, centralizados, sem ícones) ===== */
.metrics-row{
  display:grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap:8px;
  margin:4px 0 4px 0; /* reduz o espaço abaixo dos cards para aproximar a tabela */
}
@media (min-width: 1280px){
  .metrics-row{ grid-template-columns: repeat(4, minmax(0,1fr)); }
}

/* ===== Escala para monitores grandes ===== */
/* Full HD+ (1080p) - widgets crescem proporcionalmente */
@media (min-width: 1440px) and (min-height: 900px) {
  :root {
    --widget-h: min(420px, 42vh);
  }
  .row-bottom {
    gap: 24px;
  }
  .widget.widget-main-kpi .card-chart-container {
    height: 160px;
  }
}

/* Monitores grandes (1440p+) */
@media (min-width: 1920px) and (min-height: 1000px) {
  :root {
    --widget-h: min(520px, 48vh);
  }
  .index-container {
    padding: 0 30px;
  }
  .row-top, .row-bottom {
    gap: 28px;
  }
  .widget {
    padding: 18px 22px;
    border-radius: 14px;
  }
  .widget.widget-main-kpi .card-chart-container {
    height: 200px;
  }
  .widget-title {
    font-size: 15px !important;
  }
  .modern-table {
    font-size: 12px;
  }
  .modern-table thead th {
    font-size: 10px;
  }
}

/* 2K+ (2560x1440) */
@media (min-width: 2500px) and (min-height: 1400px) {
  :root {
    --widget-h: min(650px, 52vh);
  }
  .index-container {
    padding: 0 50px;
  }
  .row-top, .row-bottom {
    gap: 36px;
  }
  .widget {
    padding: 24px 28px;
    border-radius: 16px;
  }
  .widget.widget-main-kpi .card-chart-container {
    height: 260px;
  }
  .widget-title {
    font-size: 17px !important;
  }
  .modern-table {
    font-size: 14px;
  }
  .modern-table thead th {
    font-size: 11px;
    padding: 8px 10px;
  }
  .modern-table tbody td {
    padding: 8px 10px;
  }
}
.metrics-row--center{ text-align:center; }
.metric-chip{
  border:1px solid #ececf3;
  border-radius:14px;
  padding:8px 10px;
  background:#fbfbfe;
  display:flex;
  flex-direction:column;
  align-items:flex-start;
}
.metric-chip--center{ align-items:center; }
.metric-chip__value{
  font-weight:700;
  font-size:14px;
  line-height:1.1;
  color:#222;
}
.metric-chip__label{
  margin-top:2px;
  font-size:10px;
  color:#7a7a7a;
}

/* Marcatexto de porcentagens (mesmo estilo do GymRats) */
.pct-badge{ padding:2px 6px; border-radius:6px; font-weight:800; color:#fff; display:inline-block; }
.pct-low{ background:#e53935; }
.pct-mid{ background:#f6ad55; color:#1a1a1a; }
.pct-high{ background:#2f855a; color:#fff; }
.pct-over{ background:#2f855a; }

/* ===== Container de tabela ===== */
.modern-table-container{
  width:100%;
  overflow-x:auto;
  overflow-y:auto; /* volta a permitir scroll interno do conteúdo */
  -webkit-overflow-scrolling: touch;
  flex:1 1 auto;
  min-height:0;
  margin-top: 0; /* aproxima ainda mais a tabela do header */
  position: relative;
  z-index: 1;
}

/* ===== Tabelas ===== */
/* todas as tabelas com colunas auto */
.modern-table{
  width:100%;
  border-collapse:collapse;
  table-layout:auto;     /* <- chave para todas as colunas auto */
  white-space:nowrap;
  font-size:11px;
  min-width:0;           /* permite encolher sem largura mínima */
}
.modern-table thead th{
  text-align:center; /* centraliza cabeçalho */
  color:#888;
  font-size:9.5px;
  font-weight:600;
  text-transform:uppercase;
  padding:4px 6px; /* restaurado */
  border-bottom:1px solid var(--border-color);
}
.modern-table thead th:empty{
  padding:0 4px;
}
.modern-table tbody td{
  padding:5px 6px; /* restaurado */
  border-top:1px solid #f5f5f5;
  vertical-align:middle;
  overflow:hidden;
  text-overflow:ellipsis;
  text-align:center; /* centraliza as células das linhas */
}

/* Nova estratégia: permitir quebra de linha nas células das tabelas do index
   para mostrar palavras completas, mantendo a 1ª coluna sem quebra */
#contas-quentes-table th,
#contas-quentes-table td,
#projetos-engenharia-table th,
#projetos-engenharia-table td{
  white-space: normal;
  overflow: visible;
  text-overflow: initial;
  word-break: break-word;
}

/* Mantém a 1ª coluna sem quebra apenas para Projetos.
   Para Oportunidades Quentes permitimos quebra (2-3 linhas) para caber melhor. */
#projetos-engenharia-table td:first-child,
#projetos-engenharia-table th:first-child{
  white-space: nowrap;
}

/* Força quebra e limita largura da coluna Conta (Oportunidades Quentes) */
#contas-quentes-table td:first-child .cell-wrap--conta{
  display:block;
  max-width: 28ch;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* Tabela completa da página funilquente */
#contas-quentes-table-full td:first-child .cell-wrap--conta{
  display:block;
  max-width: 36ch;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* Valor (2ª coluna) deve caber em 1 linha no index */
#contas-quentes-table th:nth-child(2),
#contas-quentes-table td:nth-child(2){
  white-space: nowrap;
}

/* Tabelas do index: reduzir fonte levemente nas duas widgets (apenas no index) */
.widget.widget-contas .modern-table{ font-size: 10px; }
.widget.widget-contas .modern-table thead th{ font-size: 8.5px; }
.widget.widget-projetos .modern-table{ font-size: 10px; }
.widget.widget-projetos .modern-table thead th{ font-size: 8.5px; }

/* Cabeçalho: primeira coluna alinhada à esquerda, demais centralizadas */
#contas-quentes-table thead th:first-child,
#projetos-engenharia-table thead th:first-child{ text-align: center; }

/* Primeira coluna (Cliente/Projeto) = auto + nowrap (para não quebrar nomes) */
#contas-quentes-table td:first-child,
#contas-quentes-table th:first-child,
#projetos-engenharia-table td:first-child,
#projetos-engenharia-table th:first-child{
  white-space:nowrap;
}

/* ===== GymRats: ocupar MENOS espaço sem reduzir tamanho visual ===== */
.tight-first-cols th:nth-child(1),
.tight-first-cols td:nth-child(1),
.tight-first-cols th:nth-child(2),
.tight-first-cols td:nth-child(2){
  padding-left:2px;
  padding-right:2px;
  /* empurra o mínimo de largura possível mantendo o conteúdo */
}

/* posição = número Poppins + medalha */
.gymrats-rank{
  display:inline-flex; align-items:center; gap:2px;
  font-weight:700; font-size:12px; color:#222; /* tamanho mantido */
}
.gymrats-medal{ font-size:12px; line-height:1; }

/* avatar mantido em 16px, mas com pouco espaço ao redor */
.avatar{
  width:16px; height:16px; border-radius:50%; display:block;
}
.avatar--placeholder{
  background:
    radial-gradient(circle at 30% 30%, rgba(255,255,255,.35), rgba(255,255,255,0) 60%),
    linear-gradient(135deg, #cfcfe8, #a6a6d8);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.08);
}

/* alinhamentos numéricos */
#gymrats-table th:nth-child(4),
#gymrats-table td:nth-child(4),
#gymrats-table th:nth-child(5),
#gymrats-table td:nth-child(5),
#gymrats-table th:nth-child(6),
#gymrats-table td:nth-child(6),
#gymrats-table th:nth-child(7),
#gymrats-table td:nth-child(7){ text-align:center; }

/* ===== Status pills ===== */
.status-pill{
  display:inline-block;
  font-size:9px;
  font-weight:600;
  padding:2px 6px;
  border-radius:999px;
  background:#f1f1f4; color:#555;
  white-space: nowrap;
}
.status-no-prazo{ background:#E5F2FF; color:#0066CC; } /* Azul */
.status-atrasado{ background:#FCE8E8; color:#B42318; } /* Vermelho */
.status-em-risco{ background:#FFF4E5; color:#B35A00; } /* Laranja */
.status-incipiente{ background:#FFF9E5; color:#B38600; } /* Amarelo */
.status-concluido{ background:#EAFCEF; color:#1E7B35; } /* Verde */

/* Saving background (index & full) */
.saving-low{ background:#FCE8E8; color:#B42318; border-radius:8px; padding:2px 6px; display:inline-block; cursor: help; }
.saving-mid{ background:#FFF4E5; color:#B35A00; border-radius:8px; padding:2px 6px; display:inline-block; cursor: help; }
.saving-high{ background:#EAFCEF; color:#1E7B35; border-radius:8px; padding:2px 6px; display:inline-block; cursor: help; }
.status-negociacao {background:#FFF4E5; color:#B35A00;}
.status-proposta   {background:#EAF7FF; color:#005A99;}
.status-fechamento {background:#EAFCEF; color:#1E7B35;}
.status-qualificacao{background:#F3E9FF; color:#5923A6;}

/* ===== Progress bar ===== */
.progress-cell{ min-width:120px; }
.completion-bar-container{
  width:100%; height:4px; border-radius:2px; overflow:hidden; background:#e9ecef;
}
.completion-bar{
  height:100%;
  background:linear-gradient(90deg,#F6C847 0%,#F03200 65%,#7F3F98 100%);
}

/* Risco (dot) para tabela compacta de projetos no index */
.risk-dot{ display:inline-block; width:10px; height:10px; border-radius:50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); position: relative; cursor: pointer; }
.risk-green{ background:#16a34a; }
.risk-yellow{ background:#f59e0b; }
.risk-red{ background:#ef4444; }

/* Tooltip para risk-dot - usando sistema JavaScript (index.html) */

/* Escopo badge para página completa */
.scope-badge{ display:inline-block; padding:2px 6px; border:1px solid #cfd4dc; border-radius:6px; background:#fff; font-weight:600; font-size:10px; }

/* Cronograma header strip */
.cronog-wrap .cronog-axis span{ white-space:nowrap; }

/* KPI principal */
.kpi-card .card-chart-container{ height:130px; }

/* ===== Paginação ===== */
.pagination-bar{ margin-top:10px; display:flex; justify-content:flex-end; }
.pagination-inner{
  display:inline-flex; align-items:center; gap:8px;
  background:#f8f8f9; border:1px solid #ececec; border-radius:999px; padding:6px 10px;
}
.pg-status{ font-size:11px; color:#666; }
.pg-btn{
  appearance:none; border:0; width:28px; height:28px; border-radius:999px;
  display:inline-flex; align-items:center; justify-content:center;
  background:linear-gradient(180deg,#fff,#f2f2f5);
  box-shadow:0 1px 1px rgba(0,0,0,.05), inset 0 0 0 1px #e6e6ea;
  cursor:pointer; transition:transform .08s ease, box-shadow .15s ease, background .15s ease, opacity .15s ease;
}
.pg-btn i{ font-size:12px; color:#7f3f98; }
.pg-btn:hover:not(:disabled){ transform:translateY(-1px); box-shadow:0 4px 10px rgba(0,0,0,.08), inset 0 0 0 1px #e0e0e6; background:linear-gradient(180deg,#fff,#ececf3); }
.pg-btn:active:not(:disabled){ transform:translateY(0); box-shadow:inset 0 2px 6px rgba(0,0,0,.08); }
.pg-btn:disabled{ opacity:.45; cursor:not-allowed; }

/* ===== Ajustes solicitados: paginação no topo direito e menor (Contas Quentes e Execução) ===== */
/* Removemos o espaço no topo do container, pois a paginação passará a ficar
   no topo direito do WIDGET (alinhada ao título), e não dentro do container. */
.widget.widget-contas .modern-table-container,
.widget.widget-projetos .modern-table-container{
  position: static;
  padding-top: 0;
}

/* Alinhar paginação à altura do título (topo do widget, canto direito) */
.widget.widget-contas,
.widget.widget-projetos{ position: relative; }

/* Não precisamos reservar espaço quando a paginação participa do fluxo flex do header */
.widget.widget-contas .widget-header,
.widget.widget-projetos .widget-header{
  padding-right: 0;
}

/* Paginação alinhada com o título usando o próprio fluxo flex do header */
.widget.widget-contas .pagination-bar,
.widget.widget-projetos .pagination-bar{
  position: static;
  margin-left: 0; /* fica ao lado do título, antes do botão */
  margin-top: 0;
}

/* Redução do tamanho da paginação para ficar mais discreta */
.widget.widget-contas .pagination-inner,
.widget.widget-projetos .pagination-inner{
  gap: 6px;
  padding: 4px 8px;
  background: #f8f8f9;
  border: 1px solid #ececec;
  border-radius: 999px;
}

.widget.widget-contas .pg-status,
.widget.widget-projetos .pg-status{
  font-size: 10px;
  color: #666;
}

/* Reordenar ações: botão "Ver mais" no canto direito, paginação imediatamente à esquerda */
.widget.widget-contas .widget-header .header-actions-wrap,
.widget.widget-projetos .widget-header .header-actions-wrap{
  margin-left: 8px; /* aproxima do título */
  display: flex;
  align-items: center;
  gap: 8px;
  flex-direction: row; /* ordem natural: paginação + (botão absoluto à direita) */
  position: relative;
  padding-right: 92px; /* reserva espaço para o botão absoluto à direita */
}

/* Posiciona o botão "Ver mais" no canto direito do widget, mantendo a paginação junto ao título */
.widget.widget-contas .widget-header .btn-mini,
.widget.widget-projetos .widget-header .btn-mini{
  position: absolute;
  right: 0;
  top: 0; /* fixa no topo */
  transform: none; /* remove descida */
}

/* GymRats: garantir botão no topo direito também */
.widget.widget-gymrats .widget-header{ position: relative; padding-right: 92px; }
.widget.widget-gymrats .widget-header .btn-mini{
  position: absolute;
  right: 0;
  top: 0;
  transform: none;
}

.widget.widget-contas .pg-btn,
.widget.widget-projetos .pg-btn{
  width: 22px;
  height: 22px;
  background: linear-gradient(180deg,#fff,#f2f2f5);
  box-shadow: 0 1px 1px rgba(0,0,0,.05), inset 0 0 0 1px #e6e6ea;
  border: none;
  border-radius: 999px;
  cursor: pointer;
}

.widget.widget-contas .pg-btn i,
.widget.widget-projetos .pg-btn i{
  font-size: 11px;
  color: #7f3f98;
}

/* Garantir que os títulos dos widgets fiquem sempre por cima de qualquer conteúdo */
.widget-header .widget-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-grow: 1;
  min-width: 0;
}

.widget-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  gap: 16px; 
}

.header-actions-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
  position: relative;
  z-index: 3000;
}

/* ===== SMOOTH APPEARANCE - Aparecimento suave dos elementos ===== */

/* Animação de fade-in elegante */
@keyframes smoothFadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Gráficos aparecem com fade suave */
.card-chart-container canvas {
  animation: smoothFadeIn 0.5s ease-out;
}

/* KPI Cards aparecem suavemente */
.kpi-card {
  animation: smoothFadeIn 0.4s ease-out;
}

/* Métricas KPI com transição suave */
.kpi-metric {
  animation: smoothFadeIn 0.35s ease-out;
  animation-fill-mode: both;
}
.kpi-metric:nth-child(1) { animation-delay: 0.05s; }
.kpi-metric:nth-child(2) { animation-delay: 0.1s; }
.kpi-metric:nth-child(3) { animation-delay: 0.15s; }
.kpi-metric:nth-child(4) { animation-delay: 0.2s; }

/* Progress bar com animação de preenchimento */
.progress-bar {
  animation: progressGrow 0.8s ease-out;
  transform-origin: left;
}

@keyframes progressGrow {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

/* Tabelas aparecem com fade suave */
.modern-table tbody tr {
  animation: smoothFadeIn 0.3s ease-out;
  animation-fill-mode: both;
}
.modern-table tbody tr:nth-child(1) { animation-delay: 0.03s; }
.modern-table tbody tr:nth-child(2) { animation-delay: 0.06s; }
.modern-table tbody tr:nth-child(3) { animation-delay: 0.09s; }
.modern-table tbody tr:nth-child(4) { animation-delay: 0.12s; }
.modern-table tbody tr:nth-child(5) { animation-delay: 0.15s; }
.modern-table tbody tr:nth-child(6) { animation-delay: 0.18s; }
.modern-table tbody tr:nth-child(7) { animation-delay: 0.21s; }

/* Widgets com transição suave de opacidade */
.widget {
  opacity: 1;
  transition: opacity 0.3s ease;
}

/* Tooltips são gerenciadas por JavaScript no index.html */

/* ===== WIDGET SILICON NEWS ===== */
.widget.widget-silicon-news {
  height: var(--widget-h);
  overflow: hidden;
}

.widget.widget-silicon-news .widget-header {
  margin-bottom: 8px;
  flex-shrink: 0;
}

.widget.widget-silicon-news .widget-title-icon {
  font-size: 18px;
  width: auto;
  margin-right: 4px;
}

.widget.widget-silicon-news .widget-title {
  font-size: 12px !important;
}

.news-widget-content {
  display: flex;
  flex-direction: column;
  height: calc(100% - 40px);
  overflow: hidden;
}

.news-widget-content > .news-badge {
  text-align: center;
  margin-bottom: 8px;
  flex-shrink: 0;
}

.news-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 600;
  color: #7F3F98;
  background: #f8f4ff;
  padding: 2px 8px;
  border-radius: 10px;
}

.news-widget-main {
  text-align: center;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0; /* Permite que flex-shrink funcione */
}

.news-main-image {
  width: 100%;
  min-height: 50px;
  max-height: 120px;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 8px;
  flex-shrink: 0;
}

.news-widget-main h4 {
  font-size: 13px;
  font-weight: 600;
  color: #222;
  margin: 10px 0 6px 0;
  flex-shrink: 0;
}

.news-widget-main h4 .highlight-text {
  background: linear-gradient(135deg, #1a1a2e 0%, #2d2d44 100%);
  color: #fff;
  padding: 4px 10px;
  border-radius: 6px;
  display: inline-block;
}

.news-widget-main p {
  font-size: 10px;
  color: #666;
  margin: 0;
  line-height: 1.3;
  flex-shrink: 0;
}

.news-widget-cta {
  display: block;
  text-align: center;
  padding: 6px;
  background: #222;
  color: #fff;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s ease;
  margin-top: auto; /* Empurra para o fundo */
  flex-shrink: 0;
}

.news-widget-cta:hover {
  background: #000;
  color: #fff;
}

/* Silicon News - Ajustes para telas pequenas (MacBook) */
@media (max-width: 1600px) {
  .row-top.row-top-with-news .widget-silicon-news {
    width: 260px;
  }
  .news-badge {
    font-size: 8px;
    padding: 2px 6px;
  }
  .news-main-image {
    max-height: 80px;
    min-height: 40px;
    margin-bottom: 6px;
  }
  .news-widget-main h4 {
    font-size: 11px;
    margin: 6px 0 4px 0;
  }
  .news-widget-main h4 .highlight-text {
    padding: 3px 8px;
    border-radius: 4px;
  }
  .news-widget-main p {
    font-size: 9px;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .news-widget-cta {
    padding: 5px;
    font-size: 9px;
  }
}

/* Telas muito pequenas - esconde descrição */
@media (max-width: 1400px) {
  .row-top.row-top-with-news .widget-silicon-news {
    width: 220px;
  }
  .news-widget-main p {
    display: none;
  }
  .news-main-image {
    max-height: 70px;
  }
}

/* Silicon News - Ajustes para telas grandes */
@media (min-width: 1440px) and (min-height: 900px) {
  .widget.widget-silicon-news .widget-title {
    font-size: 13px !important;
  }
  .news-main-image {
    max-height: 140px;
  }
  .news-widget-main h4 {
    font-size: 14px;
  }
  .news-widget-main p {
    font-size: 11px;
    line-height: 1.4;
  }
}

@media (min-width: 1920px) and (min-height: 1000px) {
  .row-top.row-top-with-news .widget-silicon-news {
    width: 360px;
  }
  .widget.widget-silicon-news .widget-title {
    font-size: 14px !important;
  }
  .news-main-image {
    max-height: 160px;
  }
  .news-widget-main h4 {
    font-size: 15px;
    margin-bottom: 8px;
  }
  .news-widget-main p {
    font-size: 12px;
    line-height: 1.5;
  }
}

@media (min-width: 2500px) and (min-height: 1400px) {
  .row-top.row-top-with-news .widget-silicon-news {
    width: 420px;
  }
  .widget.widget-silicon-news .widget-title {
    font-size: 16px !important;
  }
  .news-main-image {
    max-height: 200px;
  }
  .news-widget-main h4 {
    font-size: 17px;
    margin-bottom: 10px;
  }
  .news-widget-main p {
    font-size: 13px;
    line-height: 1.5;
  }
}

/* ===== VIEWMODE: Esconde widget Silicon News ===== */
.viewmode-embed .widget-silicon-news {
  display: none !important;
}

/* Viewmode: row-top volta a 1 coluna (apenas Resultado Silicon) */
.viewmode-embed .row-top.row-top-with-news {
  grid-template-columns: 1fr;
}

/* ===== SKELETON LOADERS - Performance Optimization ===== */
.skeleton-loader {
  animation: skeleton-pulse 1.5s ease-in-out infinite;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  border-radius: 4px;
}

@keyframes skeleton-pulse {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Skeleton para tabelas */
.skeleton-row {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #f5f5f5;
}

.skeleton-cell {
  height: 16px;
  border-radius: 4px;
}

.skeleton-cell.w-30 { width: 30%; }
.skeleton-cell.w-20 { width: 20%; }
.skeleton-cell.w-15 { width: 15%; }
.skeleton-cell.w-10 { width: 10%; }

/* Skeleton para KPI widget */
.skeleton-kpi {
  padding: 20px;
}

.skeleton-kpi-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.skeleton-kpi-title {
  height: 24px;
  width: 200px;
}

.skeleton-kpi-value {
  height: 32px;
  width: 150px;
}

.skeleton-kpi-cards {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
}

.skeleton-kpi-card {
  flex: 1;
  height: 80px;
  border-radius: 8px;
}

.skeleton-chart {
  height: 200px;
  border-radius: 8px;
  margin-top: 16px;
}

/* Esconde skeleton quando dados carregam */
.data-loaded .skeleton-container {
  display: none;
}

.skeleton-container + .real-content {
  display: none;
}

.data-loaded .skeleton-container + .real-content,
.data-loaded .real-content {
  display: block;
}

/* Transição suave */
.widget-contas tbody,
.widget-projetos tbody,
#main-kpi-widget-container {
  transition: opacity 0.3s ease;
}

.widget-contas.loading tbody,
.widget-projetos.loading tbody {
  opacity: 0.5;
}

/* ===== Year Selector ===== */
.year-selector {
  position: relative;
  display: inline-flex !important;
  align-items: center !important;
  vertical-align: middle !important;
  height: auto !important;
}

/* Year selector com btn-mini - RESET TOTAL, usa apenas btn-mini */
.year-selector-btn.btn-mini {
  all: unset;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  padding: 2px 6px !important;
  border-radius: 999px !important;
  font-size: 9px !important;
  font-weight: 600 !important;
  background: #6b7280 !important;
  border: 1px solid #6b7280 !important;
  color: #fff !important;
  cursor: pointer !important;
  text-decoration: none !important;
  white-space: nowrap !important;
  box-sizing: border-box !important;
}

.year-selector-btn.btn-mini:hover {
  background: #4b5563 !important;
  border-color: #4b5563 !important;
}

/* Botão Mensal/Trimestral - cor de filtro */
.kpi-card-header button.btn-mini[id="toggle-view-main"] {
  background: #6b7280 !important;
  border-color: #6b7280 !important;
}

.kpi-card-header button.btn-mini[id="toggle-view-main"]:hover {
  background: #4b5563 !important;
  border-color: #4b5563 !important;
}

.year-selector-btn.btn-mini .year-selector-arrow {
  font-size: 7px !important;
  margin-left: -2px !important;
}

/* Estilo padrão (páginas que não usam btn-mini) */
.year-selector-btn:not(.btn-mini) {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #fff;
  border: 1px solid var(--border-color, #e9e9e9);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: #333;
  transition: all 0.2s ease;
}

.year-selector-btn:not(.btn-mini):hover {
  background: #f5f5f5;
  border-color: #ccc;
}

.year-selector.open .year-selector-btn {
  border-color: var(--purple, #7f3f98);
  box-shadow: 0 0 0 2px rgba(127, 63, 152, 0.1);
}

.year-selector-arrow {
  font-size: 10px;
  transition: transform 0.2s ease;
}

.year-selector.open .year-selector-arrow {
  transform: rotate(180deg);
}

.year-selector-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 100%;
  background: #fff;
  border: 1px solid #e9e9e9;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.2s ease;
}

.year-selector-dropdown.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.year-selector-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  color: #333;
  transition: background 0.15s ease;
}

.year-selector-option:first-child {
  border-radius: 6px 6px 0 0;
}

.year-selector-option:last-child {
  border-radius: 0 0 6px 6px;
}

.year-selector-option:hover {
  background: #f5f5f5;
}

.year-selector-option.active {
  background: rgba(127, 63, 152, 0.08);
  color: var(--purple, #7f3f98);
  font-weight: 500;
}

.year-selector-option i {
  font-size: 10px;
  color: var(--purple, #7f3f98);
}
