/* 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: auto minmax(0, 1fr) auto;   /* marca e ações na largura natural; quem rola é a barra (06/11) */
  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; }
}

/* ── Cálculo da comissão (28/10/2026): detalhe por pessoa, tabelas pequenas, formulários inline ── */
#page-rh .rh-regime { font-size: 0.9rem; font-weight: 600; padding: 7px 0; white-space: nowrap; }
#page-rh .rh-neg { color: var(--rx-alerta); font-weight: 600; }
#page-rh .rh-pos { color: #1f7a3a; font-weight: 600; }
[data-theme="dark"] #page-rh .rh-pos { color: #5ccb7a; }
#page-rh .rh-tab tr.rh-det td { background: var(--rx-card-2); white-space: normal; padding: 12px 16px 14px; cursor: default; }
#page-rh .rh-tab tr.rh-det:hover td { background: var(--rx-card-2); }
#page-rh .rh-det-grid { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(0, 1.6fr); gap: 18px; align-items: start; }
#page-rh .rh-det-acoes { display: flex; gap: 8px; margin-top: 12px; }
#page-rh .rh-mini { width: 100%; font-size: 0.8rem; border-collapse: collapse; font-variant-numeric: tabular-nums; }
#page-rh .rh-mini th { text-align: left; font-size: 0.68rem; color: var(--rx-fraco); font-weight: 600; padding: 4px 8px; border-bottom: 0.5px solid var(--rx-sep); white-space: nowrap; }
#page-rh .rh-mini td { padding: 4px 8px; border-bottom: 0.5px solid var(--rx-linha); vertical-align: top; }
#page-rh .rh-mini td.n, #page-rh .rh-mini th.n { text-align: right; white-space: nowrap; }
#page-rh .rh-mini tr.total td { font-weight: 700; border-top: 0.5px solid var(--rx-sep); }
#page-rh .rh-mini tr.rh-dev td { color: var(--rx-alerta); }
#page-rh .rh-mini + .rh-mini { margin-top: 10px; }
#page-rh .rh-link { background: none; border: 0; color: var(--rx-tint); font: inherit; font-size: 0.8rem; font-weight: 600; cursor: pointer; padding: 0 4px; }
#page-rh .rh-link:hover { text-decoration: underline; }
#page-rh .rh-btn-2 { background: var(--rx-fill); color: var(--rx-texto); }
#page-rh .rh-tab tr.rh-inativo td { opacity: 0.5; }
#page-rh .rh-formbox { border: 1px solid var(--rx-sep); }
#page-rh .rh-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px 14px; padding: 4px 16px 16px; }
#page-rh .rh-form label { display: block; font-size: 0.72rem; color: var(--rx-fraco); font-weight: 600; margin-bottom: 3px; }
#page-rh .rh-form input, #page-rh .rh-form select { width: 100%; font: inherit; font-size: 0.86rem; padding: 7px 9px; border: 1px solid var(--rx-sep); border-radius: var(--rx-radius-sm); background: var(--rx-card); color: var(--rx-texto); }
#page-rh .rh-form-larga { grid-column: 1 / -1; }
#page-rh .rh-form-acoes { grid-column: 1 / -1; display: flex; gap: 8px; }
@media (max-width: 900px) { #page-rh .rh-det-grid { grid-template-columns: 1fr; } }
/* Fechamento por pessoa (28/10/2026) */
#page-rh .rh-demo { padding-bottom: 14px; }
#page-rh .rh-demo-cab { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 14px 16px 6px; }
#page-rh .rh-demo-cab h3 { padding: 0; font-size: 1.25rem; }
#page-rh .rh-demo-tab { margin: 6px 0 0; }
#page-rh .rh-demo-tab td { padding: 6px 16px; font-size: 0.86rem; }
#page-rh .rh-demo-tab tr.rh-sep td { padding: 4px 0; border-bottom: 0; }
#page-rh .rh-demo-tab tr.rh-liq td { font-size: 1rem; background: var(--rx-card-2); padding: 10px 16px; }
#page-rh .rh-demo .rh-det-acoes { padding: 0 16px; align-items: center; flex-wrap: wrap; }
#page-rh .rh-fechado { outline: 1.5px solid #1f7a3a55; }
#page-rh .rh-tag-ok { background: #1f7a3a22; color: #1f7a3a; }
[data-theme="dark"] #page-rh .rh-tag-ok { color: #5ccb7a; }
#page-rh .rh-btn-ok { background: #1f7a3a; color: #fff; }
#page-rh .rh-livre { padding: 8px 16px 12px; }
#page-rh .rh-livre .rh-form { padding: 10px 0 4px; }
#page-rh .rh-alerta-box { color: var(--rx-alerta); font-weight: 600; }
#page-rh .rh-sec > .rh-nota { margin: 0 16px 8px; }
#page-rh .rh-tag-previa { background: #c0392b22; color: var(--rx-alerta); }
#page-rh .rh-chips { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 2px; }
#page-rh .rh-chip { font: inherit; font-size: 0.78rem; font-weight: 600; padding: 5px 10px; border-radius: 99px; border: 1px solid var(--rx-sep); background: var(--rx-card); color: var(--rx-fraco); cursor: pointer; }
#page-rh .rh-chip.on { background: var(--rx-azul); color: #fff; border-color: var(--rx-azul); }
/* Tabelas largas (Radar, vendas da pessoa): texto quebra linha, número e ação não (04/11/2026) */
#page-rh .rh-tab.rh-quebra td { white-space: normal; vertical-align: top; }
#page-rh .rh-tab.rh-quebra td.n, #page-rh .rh-tab.rh-quebra td:last-child, #page-rh .rh-tab.rh-quebra td .nome { white-space: nowrap; }
#page-rh .rh-tab.rh-quebra td:last-child { vertical-align: middle; }

/* Topo (06/11/2026, Design): marca e ações na largura natural; a barra de seções fica no meio e rola quando falta
   espaço, sem cortar o título. Abaixo de 900 px a barra desce para a 2ª linha esticada (@media de cima). */
#page-rh .rhx-secoes { min-width: 0; max-width: 100%; overflow-x: auto; }
@media (min-width: 901px) { #page-rh .rhx-secoes { justify-self: center; } }
/* Pessoas / Folha (09/11/2026) */
#page-rh .rh-import .rh-kpi { display: flex; flex-direction: column; gap: 8px; }
#page-rh .rh-import input[type=file] { font: inherit; font-size: 0.8rem; }
#page-rh .rh-inline { font: inherit; font-size: 0.86rem; width: 90px; text-align: right; padding: 5px 8px; border: 1px solid var(--rx-sep); border-radius: var(--rx-radius-sm); background: var(--rx-card); color: var(--rx-texto); }
#page-rh a.rh-btn { text-decoration: none; display: inline-block; }
/* Ponto × ausências (10/11/2026) */
#page-rh .rh-inline-larga { width: 260px; text-align: left; }
/* Pedidos da Isa (10/11/2026): período do fechamento, papéis juntos */
#page-rh .rh-periodo { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
#page-rh .rh-periodo input[type=date] { font: inherit; font-size: 0.85rem; padding: 6px 8px; border: 0; border-radius: var(--rx-radius-sm); background-color: var(--rx-fill-2); color: var(--rx-texto); }
#page-rh .rh-papel { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--rx-fraco); padding: 12px 16px 2px; }
#page-rh .rh-demo-tab tr.rh-total td { background: var(--rx-azul); color: #fff; font-size: 1.05rem; }
