:root {
  --gx-marinho: #001a4d;
  --gx-marinho-escuro: #001040;
  --gx-marinho-claro: #e8eefb;
  --gx-laranja: #f09000;
  --gx-ouro: #f09000;
  --gx-ok: #15803d;
  --gx-atencao: #d97706;
  --gx-risco: #b91c1c;
  --gx-texto: #13203a;
  --gx-muted: #5b6677;
  --gx-borda: rgba(17,24,39,.10);
  --gx-superficie: #f7f8fa;
  --gx-card: #fff;
  --gx-grid: rgba(136,135,128,.18);
  /* Fase 1 tokenizacao — tinta dos chips de estado (mesmo valor renderizado) */
  --gx-chip-verde-ink: #0f5c2e;
  --gx-chip-amarelo-ink: #6e4100;
  --gx-chip-vermelho-ink: #8a1515;
}

.gx-page {
  min-height: 100%;
  padding: 24px;
  background: var(--gx-superficie);
  color: var(--gx-texto);
  font-family: -apple-system, 'Segoe UI', Roboto, system-ui, sans-serif;
}

.gx-page__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.gx-page__head h1,
.gx-page__head h2,
.gx-page__head p {
  margin: 0;
}

.gx-page__head h1 {
  color: var(--gx-marinho-escuro);
  font-size: 24px;
  font-weight: 600;
  line-height: 1.2;
}

.gx-page__head p {
  margin-top: 6px;
  color: var(--gx-muted);
  font-size: 13px;
  line-height: 1.45;
}

.gx-period {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--gx-borda);
  border-radius: 12px;
  background: var(--gx-card);
}

.gx-period__item {
  min-height: 34px;
  padding: 8px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--gx-muted);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
}

.gx-period__item:hover,
.gx-period__item:focus-visible {
  color: var(--gx-marinho-escuro);
  outline: 2px solid rgba(0,26,77,.20);
  outline-offset: 1px;
}

.gx-period__item.is-active {
  background: var(--gx-marinho);
  color: var(--gx-card);
}

.gx-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.gx-kpi {
  padding: 18px;
  border: 1px solid var(--gx-borda);
  border-radius: 12px;
  background: var(--gx-card);
}

.gx-kpi:hover {
  box-shadow: 0 8px 24px rgba(17,24,39,.08);
}

.gx-kpi__label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--gx-muted);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
}

.gx-kpi__value {
  margin-top: 10px;
  color: var(--gx-texto);
  font-size: 26px;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: 0;
}

.gx-kpi__delta {
  margin-top: 8px;
  color: var(--gx-muted);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
}

.gx-kpi__delta.is-up {
  color: var(--gx-ok);
}

.gx-kpi__delta.is-down {
  color: var(--gx-risco);
}

.gx-grid-2,
.gx-grid-3 {
  display: grid;
  gap: 16px;
}

.gx-grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.gx-grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.gx-card {
  overflow: hidden;
  border: 1px solid var(--gx-borda);
  border-radius: 12px;
  background: var(--gx-card);
}

.gx-card:hover {
  box-shadow: 0 10px 28px rgba(17,24,39,.08);
}

.gx-card__title {
  padding: 16px 18px 0;
  color: var(--gx-marinho-escuro);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
}

.gx-card__body {
  padding: 16px 18px 18px;
}

.gx-chart {
  position: relative;
  width: 100%;
  min-height: 280px;
}

.gx-chart canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.gx-chart--donut {
  position: relative;
}

.gx-chart__total {
  position: absolute;
  inset: 50% auto auto 50%;
  display: grid;
  width: 92px;
  height: 92px;
  place-content: center;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: rgb(255 255 255 / 92%);
  color: var(--gx-marinho-escuro);
  text-align: center;
  pointer-events: none;
}

.gx-chart__total strong {
  font-size: 1.45rem;
  line-height: 1;
}

.gx-chart__total span {
  margin-top: 4px;
  color: var(--gx-muted);
  font-size: .72rem;
  text-transform: uppercase;
}

.gx-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin: 14px 0 0;
  padding: 0;
  color: var(--gx-muted);
  font-size: 13px;
  line-height: 1.35;
  list-style: none;
}

.gx-legend__dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 6px;
  border-radius: 999px;
  background: var(--gx-marinho);
  vertical-align: -1px;
}

.gx-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.gx-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 6px 10px;
  border: 1px solid rgba(0,26,77,.18);
  border-radius: 999px;
  background: rgba(0,26,77,.08);
  color: var(--gx-marinho-escuro);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
}

.gx-chip--verde {
  border-color: rgba(21,128,61,.24);
  background: rgba(21,128,61,.10);
  color: var(--gx-chip-verde-ink);
}

.gx-chip--amarelo {
  border-color: rgba(217,119,6,.28);
  background: rgba(217,119,6,.14);
  color: var(--gx-chip-amarelo-ink);
}

.gx-chip--vermelho {
  border-color: rgba(185,28,28,.24);
  background: rgba(185,28,28,.10);
  color: var(--gx-chip-vermelho-ink);
}

.gx-load {
  display: grid;
  gap: 10px;
}

.gx-load__seg {
  display: block;
  min-height: 10px;
  border-radius: 999px;
  background: var(--gx-marinho);
}

.gx-load__seg:nth-child(2) {
  background: var(--gx-laranja);
}

.gx-load__seg:nth-child(3) {
  background: var(--gx-ok);
}

.gx-load__seg:nth-child(4) {
  background: var(--gx-atencao);
}

.gx-load__seg:nth-child(5) {
  background: var(--gx-risco);
}

.gx-table {
  width: 100%;
  border-collapse: collapse;
  color: var(--gx-texto);
  font-size: 13px;
}

.gx-table th,
.gx-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--gx-borda);
  text-align: left;
  vertical-align: middle;
}

.gx-table th {
  color: var(--gx-muted);
  font-weight: 600;
}

.gx-table tbody tr:hover {
  background: rgba(0,26,77,.05);
}

.gx-empty {
  display: grid;
  place-items: center;
  min-height: 140px;
  padding: 20px;
  border: 1px dashed rgba(17,24,39,.18);
  border-radius: 12px;
  background: rgba(255,255,255,.72);
  color: var(--gx-muted);
  font-size: 13px;
  line-height: 1.45;
  text-align: center;
}

@media (max-width: 720px) {
  .gx-page {
    padding: 16px;
  }

  .gx-page__head {
    display: grid;
  }

  .gx-period {
    width: 100%;
  }

  .gx-period__item {
    flex: 1 1 auto;
  }

  .gx-chart {
    min-height: 240px;
  }
}

/* ===================================================================
   UI_AESTHETIC_QA — complemento gx (CSS-only, sem logica)
   Define barras de carga horizontais ja usadas em
   operacoes/dashboard_operacional.html (gx-load__row/label/bar)
   e ajusta densidade dos cards de grafico.
   =================================================================== */

/* --- Linha de carga por responsavel (rotulo + barra empilhada) --- */
.gx-load__row {
  display: grid;
  grid-template-columns: minmax(120px, 28%) 1fr;
  align-items: center;
  gap: 12px;
}

.gx-load__label {
  color: var(--gx-texto);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gx-load__bar {
  display: flex;
  width: 100%;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--gx-grid);
}

.gx-load__bar .gx-load__seg {
  height: 100%;
  min-height: 0;
  border-radius: 0;
}

/* Segmentos coloridos por situacao quando combinados com gx-chip--* */
.gx-load__seg.gx-chip--verde { background: var(--gx-ok); }
.gx-load__seg.gx-chip--amarelo { background: var(--gx-atencao); }
.gx-load__seg.gx-chip--vermelho { background: var(--gx-risco); }

/* --- Densidade: grafico nao precisa ser gigante p/ pouco dado --- */
.gx-chart {
  min-height: 220px;
  max-height: 300px;
}

/* --- KPI: numero tabular alinha colunas --- */
.gx-kpi__value {
  font-variant-numeric: tabular-nums;
}

/* --- Card de tabela: cabecalho fixo leve quando rola --- */
.gx-card .gx-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--gx-card);
}
