/* Gestao IGLU - painel da diretoria - identidade visual da marca (mesmos
   tokens dos demais paineis deste projeto), CSS proprio escrito do zero com
   responsividade real (mobile-first nos componentes principais). */

:root {
  --iglu-navy: #172c54;
  --iglu-gold: #7c6f4f;
  --iglu-coral: #fe884c;
  --iglu-amber: #f9a03f;
  --iglu-red: #fd644f;
  --iglu-green: #2f9e5b;
  --iglu-cream: #faebd0;

  --bg: #f4f7fc;
  --surface: #ffffff;
  --surface-muted: #e9f0fa;
  --border: #e7e0d0;
  --border-soft: #f0ead9;

  --text-primary: #1c2438;
  --text-secondary: #57607a;
  --text-muted: #90939e;
  --text-on-navy: #f4f6fb;

  --st-bom-bg: #e7f6ec; --st-bom-fg: #1f7a41;
  --st-alerta-bg: #fef1de; --st-alerta-fg: #9a6108;
  --st-ruim-bg: #fdeae7; --st-ruim-fg: #ad3120;
  --st-neutro-bg: #eef1f7; --st-neutro-fg: #3d4a63;

  --font-heading: 'Poppins', system-ui, -apple-system, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', monospace;

  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 2px rgba(23, 44, 84, .06), 0 1px 1px rgba(23, 44, 84, .04);
  --shadow-md: 0 6px 20px rgba(23, 44, 84, .08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background-color: var(--bg);
  /* FUNDO DO TEMA (03/10/2026). Era uma foto de salmao de 2,9 MB replicada em 5
     paineis = 14,4 MB baixados por usuario, e marca de UM cliente dentro do produto.
     A cor vem do matiz da marca e foi conferida por contraste: o card branco por cima
     fica em 1,21:1 (visivel) e o texto escuro em 12,57:1. Tom mais claro que este faz
     o card desaparecer no fundo - medido, nao achado. */
  background-image: linear-gradient(180deg, var(--plat-fundo-corpo, #d5e1f7) 0%, var(--plat-fundo-corpo-2, #e8eefa) 100%);
  background-size: cover;
  background-position: center 40%;
  background-attachment: fixed;
  background-repeat: no-repeat;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
}

img { max-width: 100%; }

.wrap {
  max-width: 1680px;
  margin: 0 auto;
  padding: 0 24px 48px;
}

/* ---------- header ---------- */

.app-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 24px;
  max-width: 1680px;
  margin: 0 auto;
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 12px; flex: 1 1 auto; min-width: 0; }
.brand-logo { height: 44px; width: auto; border-radius: 8px; flex-shrink: 0; }
.brand-text h1 { font-family: var(--font-heading); font-size: 19px; margin: 0; color: var(--iglu-navy); white-space: nowrap; }
.brand-text p { font-size: 12px; margin: 2px 0 0; color: var(--text-muted); white-space: nowrap; }

.nav-toggle {
  display: none;
  font-size: 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 42px; height: 42px;
  cursor: pointer;
  color: var(--iglu-navy);
  flex-shrink: 0;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1 1 100%;
  order: 3;
}

.tab {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.tab:hover { background: var(--surface-muted); }
.tab-active { background: var(--iglu-navy); color: var(--text-on-navy); }

.user-box { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-secondary); flex-shrink: 0; margin-left: auto; }
.user-box a { color: var(--plat-link, #125ccf); text-decoration: none; font-weight: 600; }

@media (max-width: 880px) {
  .app-header { padding: 14px 16px; }
  .nav-toggle { display: block; order: 2; }
  .user-box { order: 1; margin-left: 0; }
  .tabs { display: none; flex-direction: column; gap: 2px; }
  .tabs.tabs-aberta { display: flex; }
  .tab { display: block; text-align: left; padding: 10px 12px; }
  .wrap { padding: 0 14px 32px; }
  .brand-text h1 { font-size: 17px; }
}

/* ---------- cards / kpi ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

.card h2 {
  font-family: var(--font-heading);
  font-size: 16px;
  color: var(--iglu-navy);
  margin: 0 0 14px;
}

.card-construcao { text-align: center; padding: 60px 24px; color: var(--text-secondary); }
.card-construcao h2 { justify-content: center; }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.kpi {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.kpi .kpi-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .03em; font-weight: 600; }
.kpi .kpi-valor { font-family: var(--font-heading); font-size: 24px; color: var(--iglu-navy); font-variant-numeric: tabular-nums; overflow-wrap: break-word; }
.kpi .kpi-sub { font-size: 12px; color: var(--text-secondary); }
.kpi.kpi-alerta .kpi-valor { color: var(--plat-perigo-legivel, #b82d31); }
.kpi.kpi-ok .kpi-valor { color: var(--plat-sucesso-legivel, #19703c); }

@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
  .kpi { padding: 12px 14px; }
  .kpi .kpi-valor { font-size: 19px; }
  .card { padding: 14px; }
}

/* ---------- filtros ---------- */

.filtros {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 18px;
}
.filtros label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-secondary); font-weight: 600; }
.filtros input, .filtros select {
  font-family: var(--font-body); font-size: 14px;
  padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text-primary);
}
@media (max-width: 600px) {
  .filtros { flex-direction: column; align-items: stretch; }
  .filtros label { width: 100%; }
  .filtros input, .filtros select { width: 100%; }
}

/* ---------- botoes ---------- */

.btn-primary, .btn-secondary {
  font-family: var(--font-body); font-weight: 600; font-size: 13px;
  border: none; border-radius: var(--radius-md);
  padding: 9px 16px; cursor: pointer;
}
.btn-primary { background: var(--iglu-navy); color: var(--text-on-navy); }
.btn-primary:hover { background: #0f1e3c; }
.btn-secondary { background: var(--surface-muted); color: var(--iglu-navy); border: 1px solid var(--border); }

.chip-grupo { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip { font-size: 12px; font-weight: 600; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-secondary); text-decoration: none; cursor: pointer; }
.chip.chip-ativo { background: var(--iglu-navy); color: var(--text-on-navy); border-color: var(--iglu-navy); }

/* ---------- tabelas ---------- */

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 480px; }
table.tbl th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .03em;
  color: var(--text-on-navy); background: var(--iglu-navy);
  padding: 9px 12px; white-space: nowrap;
}
table.tbl td { padding: 8px 12px; border-bottom: 1px solid var(--border-soft); white-space: nowrap; }
table.tbl tbody tr:hover { background: var(--surface-muted); }
table.tbl td.num, table.tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Luiz Hungaro, 19/09/2026 - correcao real: "max-width" direto no <td> NAO
   funciona em tabela com table-layout:auto (padrao) - o navegador ignora e
   deixa a coluna crescer pelo conteudo mesmo assim. Fix de verdade: embrulhar
   o texto num elemento block/inline-block PROPRIO com max-width - ai sim o
   corte com reticencias (title = nome completo no hover) funciona. */
.td-trunc {
  display: inline-block;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}
@media (max-width: 600px) {
  .td-trunc { max-width: 160px; }
}

.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.pill-bom { background: var(--st-bom-bg); color: var(--st-bom-fg); }
.pill-alerta { background: var(--st-alerta-bg); color: var(--st-alerta-fg); }
.pill-ruim { background: var(--st-ruim-bg); color: var(--st-ruim-fg); }
.pill-neutro { background: var(--st-neutro-bg); color: var(--st-neutro-fg); }

/* ---------- graficos ---------- */

.chart-box { position: relative; width: 100%; height: 300px; }
@media (max-width: 600px) { .chart-box { height: 240px; } }

.grid-2col { display: grid; grid-template-columns: 1.3fr 1fr; gap: 18px; }
@media (max-width: 980px) { .grid-2col { grid-template-columns: 1fr; } }

/* ---------- banners ---------- */

.banner { border-radius: var(--radius-md); padding: 14px 18px; margin-bottom: 18px; display: flex; flex-direction: column; gap: 4px; }
.banner-error { background: var(--st-ruim-bg); color: var(--st-ruim-fg); }
.banner strong { font-size: 14px; }
.banner span { font-size: 13px; }

/* ---------- login ---------- */

.login-body {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 20px;
  position: relative;
  overflow: hidden;
  background: var(--iglu-navy); /* preenchimento enquanto a imagem carrega */
}
.login-body::before {
  /* 03/10/2026 - o fundo do login e' gradiente do tema (era foto do salmao com blur).
     Sem filter: blur sobre gradiente so' custa pintura e nao muda nada visivel. */
  content: '';
  position: fixed; inset: 0;
  background-image: linear-gradient(160deg, var(--plat-login-1, #11203e) 0%, var(--plat-login-2, #172c54) 55%, var(--plat-login-3, #1d386b) 100%);
  background-size: cover;
  z-index: 0;
}
.login-box {
  position: relative; z-index: 1;
  background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-md);
  padding: 36px 32px; width: 100%; max-width: 360px; text-align: center;
}
.login-logo { height: 56px; margin-bottom: 14px; }
.login-box h1 { font-family: var(--font-heading); color: var(--iglu-navy); font-size: 20px; margin: 0 0 20px; }
.login-form { display: flex; flex-direction: column; gap: 14px; text-align: left; }
.login-form label { font-size: 12px; font-weight: 600; color: var(--text-secondary); display: flex; flex-direction: column; gap: 5px; }
.login-form input { font-size: 15px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.login-form .btn-primary { padding: 11px; font-size: 14px; margin-top: 6px; }

/* ---------- footer ---------- */

.app-footer { text-align: center; padding: 24px; color: var(--text-muted); font-size: 12px; }

/* ---------- hero (Home) - fundo de salmao, estilo vidro fosco (inspirado
   no dashboard PBI original: mesma imagem/opacidade/paleta, so que aplicado
   em cima do design system dos paineis atuais) ---------- */

.hero-bg {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  /* 03/10/2026 - FUNDO DO HERO. Ate hoje quem escurecia este bloco era a FOTO
     (object-fit:cover) por baixo do .hero-glass, que e' 90% translucido de proposito.
     Sem a foto, o texto branco daqui caia sobre o fundo claro da pagina: 1,20:1,
     ilegivel. O gradiente abaixo devolve o fundo escuro, agora vindo do tema:
     branco sobre #0b2c38 = 14,67:1 (medido). */
  background: linear-gradient(160deg, var(--plat-login-1, #11203e) 0%, var(--plat-login-2, #172c54) 55%, var(--plat-login-3, #1d386b) 100%);
  min-height: 620px;
  display: flex;
  align-items: flex-end;
  margin-bottom: 22px;
  box-shadow: var(--shadow-md);
}
.hero-bg img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; object-position: 46% 48%;
  z-index: 0;
}
.hero-bg::after {
  content: '';
  position: absolute; inset: 0;
  /* 23/09/2026 - reduzido: essa camada (por baixo do hero-glass) chegava a 68% escura
     e era a maior responsavel pelo peixe sumir atras da caixa, mesmo com o hero-glass
     quase transparente. */
  background: linear-gradient(180deg, rgba(10,20,40,0) 65%, rgba(10,20,40,.12) 85%, rgba(10,20,40,.18) 100%);
  z-index: 1;
}
.hero-glass {
  position: relative; z-index: 2;
  width: 100%;
  background: rgba(10, 20, 40, .10); /* 23/09/2026 - 90% translucido, pedido do Luiz */
  backdrop-filter: blur(2px); /* 23/09/2026 - reduzido de 10px, estava borrando demais o peixe */
  -webkit-backdrop-filter: blur(2px);
  border-top: 1px solid rgba(255,255,255,.15);
  padding: 18px 22px 20px;
}
.hero-filtros { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 14px; }
.hero-filtros label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: rgba(255,255,255,.75); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.hero-filtros input {
  font-family: var(--font-body); font-size: 13px; padding: 7px 9px;
  border: 1px solid rgba(255,255,255,.25); border-radius: var(--radius-sm);
  background: rgba(255,255,255,.1); color: #fff;
}
.hero-filtros input::placeholder { color: rgba(255,255,255,.6); }

.hero-kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.hero-kpi {
  background: rgba(23, 44, 84, .5);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  color: #fff;
  min-width: 0;
}
.hero-kpi .kpi-label { font-size: 11px; color: rgba(255,255,255,.72); text-transform: uppercase; letter-spacing: .03em; font-weight: 600; }
.hero-kpi .kpi-valor { font-family: var(--font-heading); font-size: 21px; color: #fff; font-variant-numeric: tabular-nums; }
.hero-kpi .kpi-sub { font-size: 11px; color: rgba(255,255,255,.68); }
.hero-kpi.kpi-alerta .kpi-valor { color: #ffb199; }
.hero-kpi.kpi-ok .kpi-valor { color: #a9f0c4; }

@media (max-width: 700px) {
  .hero-bg { min-height: 440px; border-radius: var(--radius-md); }
  .hero-glass { padding: 14px 14px 16px; }
  .hero-kpi-grid { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
  .hero-kpi .kpi-valor { font-size: 17px; }
}
