/* Módulo RH — visual do PCP/Compras (06/10/2026, pedido do Guilherme: "mesmo padrão do PCP, compras,
   mesmo menu, sem muito ícone"). O MESMO sistema do public/css/compras.css (skill apple-design):
   cabeçalho + abas numa camada fixa e translúcida, seções no cabeçalho (controle segmentado), abas da
   seção embaixo, só texto; cartas sem borda, números tabulares, resposta no aperto. */
#page-rh {
  --rx-bg: #f5f5f7;
  --rx-card: #ffffff;
  --rx-card-2: #fafafc;
  --rx-linha: rgba(0, 0, 0, 0.07);
  --rx-sep: rgba(0, 0, 0, 0.13);
  --rx-texto: #1d1d1f;
  --rx-texto-2: #3a3a3c;
  --rx-fraco: #636366;
  --rx-fill: rgba(118, 118, 128, 0.14);
  --rx-fill-2: rgba(118, 118, 128, 0.08);
  --rx-hover: rgba(0, 0, 0, 0.028);
  --rx-azul: #15293a;
  --rx-primaria-ink: #ffffff;
  --rx-tint: #b4500f;
  --rx-focus: rgba(236, 106, 28, 0.32);
  --rx-alerta: #c0392b;
  --rx-chrome: rgba(245, 245, 247, 0.74);
  --rx-header: rgba(21, 41, 58, 0.9);
  --rx-header-solid: #15293a;
  --rx-radius: 14px;
  --rx-radius-sm: 9px;
  --rx-sombra: 0 0 0 0.5px rgba(0, 0, 0, 0.07), 0 1px 2px rgba(0, 0, 0, 0.04), 0 12px 28px -18px rgba(0, 0, 0, 0.2);
  background: var(--rx-bg);
  color: var(--rx-texto);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: background-color 250ms ease, color 250ms ease;
}
[data-theme="dark"] #page-rh {
  --rx-bg: #0e1013;
  --rx-card: #1b1d22;
  --rx-card-2: #212329;
  --rx-linha: rgba(255, 255, 255, 0.07);
  --rx-sep: rgba(255, 255, 255, 0.14);
  --rx-texto: #f5f5f7;
  --rx-texto-2: #d1d1d6;
  --rx-fraco: #a1a1a6;
  --rx-fill: rgba(118, 118, 128, 0.28);
  --rx-fill-2: rgba(118, 118, 128, 0.18);
  --rx-hover: rgba(255, 255, 255, 0.035);
  --rx-azul: #f3934f;
  --rx-primaria-ink: #1b1206;
  --rx-tint: #f3934f;
  --rx-focus: rgba(243, 147, 79, 0.38);
  --rx-alerta: #ff6b5e;
  --rx-chrome: rgba(14, 16, 19, 0.72);
  --rx-header: rgba(18, 35, 52, 0.88);
  --rx-header-solid: #122334;
  --rx-sombra: 0 0 0 0.5px rgba(255, 255, 255, 0.07), 0 12px 28px -18px rgba(0, 0, 0, 0.7);
}

/* ── Camada fixa: cabeçalho + abas ── */
#page-rh .rhx-chrome { position: sticky; top: 0; z-index: 100; }
#page-rh .rhx-chrome .header {
  position: static; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center; gap: 12px; padding: 10px 16px;
  background-color: var(--rx-header); background-image: none; border-bottom: 2px solid var(--orange); box-shadow: none;
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
}
#page-rh .rhx-marca { grid-column: 1; display: flex; align-items: center; gap: 10px; min-width: 0; }
#page-rh .rhx-logo { height: 24px; width: auto; flex: none; }
#page-rh .rhx-voltar {
  background: none; border: 0; color: #fff; cursor: pointer; font-size: 1.55rem; line-height: 1;
  padding: 2px 9px 5px; border-radius: 8px; transition: background-color 150ms ease, transform 100ms ease;
}
#page-rh .rhx-voltar:hover { background: rgba(255, 255, 255, 0.12); }
#page-rh .rhx-voltar:active { transform: scale(0.94); }
#page-rh .rhx-titulo {
  display: flex; align-items: baseline; gap: 8px; margin: 0; font-size: 1.22rem; font-weight: 700;
  letter-spacing: -0.022em; line-height: 1.15; color: #fff; padding-left: 12px;
  border-left: 1px solid rgba(255, 255, 255, 0.22); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#page-rh .rhx-secao { font-size: 0.98rem; font-weight: 500; letter-spacing: -0.012em; color: rgba(255, 255, 255, 0.76); }
#page-rh .rhx-secao:not(:empty)::before { content: '›'; margin-right: 8px; font-weight: 400; color: rgba(255, 255, 255, 0.45); }
#page-rh .rhx-secoes {
  grid-column: 2; display: flex; gap: 2px; padding: 3px; border-radius: 10px;
  background: rgba(255, 255, 255, 0.1); box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.14);
  overflow-x: auto; scrollbar-width: none;
}
#page-rh .rhx-secoes::-webkit-scrollbar { display: none; }
#page-rh .rhx-secao-btn {
  flex: none; border: 0; background: transparent; cursor: pointer; color: rgba(255, 255, 255, 0.84);
  font: inherit; font-size: 0.86rem; font-weight: 500; padding: 5px 13px; border-radius: 8px; white-space: nowrap;
  transition: background-color 150ms ease, color 150ms ease, transform 100ms ease;
}
#page-rh .rhx-secao-btn:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
#page-rh .rhx-secao-btn:active { transform: scale(0.97); }
#page-rh .rhx-secao-btn.active { background: #ffffff; color: #15293a; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); }
#page-rh .rhx-acoes { grid-column: 3; display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
#page-rh .rhx-abas {
  display: flex; align-items: center; gap: 2px; padding: 6px 12px; background: var(--rx-chrome);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 1px 0 var(--rx-linha); overflow-x: auto; scrollbar-width: none;
}
#page-rh .rhx-abas::-webkit-scrollbar { display: none; }
#page-rh .rhx-aba {
  flex: none; margin: 0; padding: 6px 11px; border: 0; border-radius: 8px; background: transparent; cursor: pointer;
  font: inherit; font-size: 0.84rem; font-weight: 500; color: var(--rx-texto-2);
  transition: background-color 150ms ease, color 150ms ease, box-shadow 150ms ease, transform 100ms ease;
}
#page-rh .rhx-aba:hover { background: var(--rx-fill-2); color: var(--rx-texto); }
#page-rh .rhx-aba:active { transform: scale(0.97); background: var(--rx-fill); }
#page-rh .rhx-aba.active { background: var(--rx-card); color: var(--rx-texto); box-shadow: 0 0 0 0.5px var(--rx-sep), 0 1px 3px rgba(0, 0, 0, 0.1); }

/* ── Conteúdo ── */
#page-rh #rh-content { flex: 1; overflow-y: auto; color: var(--rx-texto); padding: 18px 20px 40px; }
#page-rh #rh-content.rhx-entra { animation: rhx-entra 200ms ease-out backwards; }
@keyframes rhx-entra { from { opacity: 0; } }
#page-rh .rh-load { padding: 40px 20px; text-align: center; color: var(--rx-fraco); font-size: 0.9rem; line-height: 1.6; }
#page-rh .rh-nota { color: var(--rx-fraco); font-size: 0.8rem; line-height: 1.5; margin: 0 0 14px; max-width: 980px; }
#page-rh .rh-alerta { color: var(--rx-alerta); font-weight: 600; }
#page-rh .rh-fraco { color: var(--rx-fraco); }

#page-rh .rh-filtros {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: end; padding: 10px 12px; margin-bottom: 14px;
  background: var(--rx-card); border-radius: var(--rx-radius); box-shadow: var(--rx-sombra);
}
#page-rh .rh-filtros label { display: block; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.02em; color: var(--rx-fraco); margin: 0 0 3px 2px; }
#page-rh .rh-filtros input, #page-rh .rh-filtros select {
  font: inherit; font-size: 0.875rem; padding: 8px 11px; border: 0; border-radius: var(--rx-radius-sm);
  background-color: var(--rx-fill-2); color: var(--rx-texto); transition: background-color 120ms ease, box-shadow 120ms ease;
}
#page-rh .rh-filtros input:focus, #page-rh .rh-filtros select:focus { outline: none; background-color: var(--rx-card); box-shadow: 0 0 0 3px var(--rx-focus); }
#page-rh .rh-filtros .rh-esp { flex: 1; }
#page-rh .rh-btn {
  border: 0; cursor: pointer; font: inherit; font-size: 0.84rem; font-weight: 600; padding: 8px 14px;
  border-radius: var(--rx-radius-sm); background: var(--rx-fill); color: var(--rx-texto);
  transition: transform 100ms ease, background-color 150ms ease;
}
#page-rh .rh-btn:hover { background: var(--rx-fill-2); }
#page-rh .rh-btn:active { transform: scale(0.97); }
#page-rh .rh-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--rx-focus); }

#page-rh .rh-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 18px; }
#page-rh .rh-kpi { background: var(--rx-card); border-radius: var(--rx-radius); box-shadow: var(--rx-sombra); padding: 14px 16px; }
#page-rh .rh-kpi .r { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.02em; color: var(--rx-fraco); }
#page-rh .rh-kpi .v { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.022em; margin-top: 4px; font-variant-numeric: tabular-nums; }
#page-rh .rh-kpi .s { font-size: 0.78rem; color: var(--rx-fraco); margin-top: 3px; }

#page-rh .rh-sec { background: var(--rx-card); border-radius: var(--rx-radius); box-shadow: var(--rx-sombra); margin-top: 16px; overflow: auto; }
#page-rh .rh-sec h3 { font-size: 1rem; font-weight: 600; letter-spacing: -0.012em; margin: 0; padding: 14px 16px 6px; }
#page-rh .rh-sec h3 small { font-size: 0.8rem; font-weight: 500; color: var(--rx-fraco); margin-left: 6px; }
#page-rh .rh-tab { width: 100%; font-size: 0.84rem; font-variant-numeric: tabular-nums; border-collapse: separate; border-spacing: 0; }
#page-rh .rh-tab th {
  position: sticky; top: 0; z-index: 1; background: var(--rx-card-2); color: var(--rx-fraco); text-align: left;
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.02em; padding: 9px 12px; border-bottom: 0.5px solid var(--rx-sep); white-space: nowrap;
}
#page-rh .rh-tab td { padding: 9px 12px; border-bottom: 0.5px solid var(--rx-linha); vertical-align: middle; white-space: nowrap; }
#page-rh .rh-tab tbody tr:last-child td { border-bottom: 0; }
#page-rh .rh-tab tbody tr:hover { background: var(--rx-hover); }
#page-rh .rh-tab td.n, #page-rh .rh-tab th.n { text-align: right; white-space: nowrap; }
#page-rh .rh-tab .nome { font-weight: 600; white-space: nowrap; }
#page-rh .rh-tab tr.clic { cursor: pointer; }
#page-rh .rh-tab tr.on td { background: color-mix(in srgb, var(--rx-tint) 8%, transparent); }
#page-rh .rh-tab tr.total td { font-weight: 700; background: var(--rx-card-2); border-top: 0.5px solid var(--rx-sep); }
#page-rh .rh-tag {
  display: inline-block; font-size: 0.7rem; font-weight: 600; padding: 2px 8px; border-radius: 99px;
  background: var(--rx-fill-2); color: var(--rx-texto-2); white-space: nowrap;
}

@media (max-width: 900px) {
  #page-rh .rhx-chrome .header { grid-template-columns: minmax(0, 1fr) auto; row-gap: 8px; }
  #page-rh .rhx-acoes { grid-column: 2; grid-row: 1; }
  #page-rh .rhx-secoes { grid-column: 1 / -1; grid-row: 2; justify-self: stretch; }
}
@media (max-width: 640px) {
  #page-rh #rh-content { padding: 12px 12px 28px; }
  #page-rh .rhx-secao { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  #page-rh *, #page-rh { animation: none !important; transition-duration: 0.01ms !important; }
}
@media (prefers-reduced-transparency: reduce) {
  #page-rh .rhx-chrome .header { background-color: var(--rx-header-solid); -webkit-backdrop-filter: none; backdrop-filter: none; }
  #page-rh .rhx-abas { background: var(--rx-bg); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
