/* ─── Fontes auto-hospedadas (static/fonts/) ───────────────────────────────
   Inter é servido localmente (não via CDN do Google) para não depender de
   rede/CDN externa — o ambiente corporativo passa por proxy MITM e pode
   bloquear a CDN de fontes, o que faria o Inter cair no fallback. */

/* GT Standard (fonte de título). Só o peso Bold está disponível nos
   originais do projeto; a faixa 500–900 cobre os usos 500 e 700 do CSS. */
@font-face {
  font-family: 'GT Standard';
  src: url('/static/fonts/GTStandard-LExtendedBold.ttf') format('truetype');
  font-weight: 500 900;
  font-style: normal;
  font-display: swap;
}

/* Inter (fonte de corpo) — pesos 300/400/500/600/700. */
@font-face {
  font-family: 'Inter';
  src: url('/static/fonts/InterLight-Regular.ttf') format('truetype');
  font-weight: 300; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('/static/fonts/Inter-Regular.ttf') format('truetype');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('/static/fonts/InterMedium-Regular.ttf') format('truetype');
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('/static/fonts/InterSemiBold-Regular.ttf') format('truetype');
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('/static/fonts/Inter-Bold.ttf') format('truetype');
  font-weight: 700; font-style: normal; font-display: swap;
}

/* ─── Tokens DXC ─── */
:root {
  --midnight:   #0E1020;
  --royal:      #004AAC;
  --true-blue:  #4995FF;
  --red:        #D14600;

  --bg:         #F0EDE9;
  --surface:    #FFFFFF;
  --sidebar-bg: #0E1020;
  --ink:        #0E1020;
  --muted:      #6B7280;
  --line:       #E5E7EB;

  --shadow-sm:  0 1px 2px rgba(14,16,32,.06);
  --shadow:     0 1px 4px rgba(14,16,32,.08), 0 6px 24px rgba(14,16,32,.07);
  --radius:     10px;
  --sidebar-w:  236px;
  /* Cores das abas (cadernos) — paleta DXC */
  --nb-navy:    #1B2F72;
  --nb-navy-hi: #2A47A8;
  --nb-orange:  #FF9A3C;
  --nb-orange-hi:#FFB35F;
  --nb-white:   #F6F3F0;
  --nb-white-hi:#FFFFFF;
  --nb-gray:    #7C8291;
  --nb-gray-hi: #A3A8B4;

  --font-title: 'GT Standard', Georgia, 'Times New Roman', serif;
  --font-body:  'Inter', 'Segoe UI', system-ui, sans-serif;
}

/* ─── Reset ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0 }
html, body { height: 100% }

body {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
}

/* ─── Layout ─── */
.layout {
  display: flex;
  min-height: 100vh;
}

/* ─── Sidebar ─── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 20;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform .22s cubic-bezier(.4,0,.2,1), width .22s cubic-bezier(.4,0,.2,1);
}

.sidebar-logo {
  padding: 16px 30px 12px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-logo svg {
  display: block;
  width: 100%;
  height: auto;
}
.sidebar-appname {
  margin-top: 2px;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: rgba(255,255,255,.70);
  text-align: center;
}

.sidebar nav {
  padding: 12px 0;
  flex: 1;
}
.nav-item {
  display: flex;
  align-items: center;
  padding: 10px 22px;
  color: rgba(255,255,255,.6);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: color .15s, background .15s;
  gap: 10px;
}
.nav-item:hover {
  color: #fff;
  background: rgba(255,255,255,.06);
}
.nav-item.active {
  color: #fff;
  background: rgba(73,149,255,.14);
  border-left-color: var(--true-blue);
}

.nav-item__icon {
  width: 18px; height: 18px;
  flex-shrink: 0;
  opacity: 0.85;
}
.nav-item:hover .nav-item__icon,
.nav-item.active .nav-item__icon { opacity: 1; }

.sidebar-footer {
  padding: 14px 18px 18px;
  border-top: 1px solid rgba(255,255,255,.07);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
}
.sidebar-user__avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, #FF7E51, #FFAE41);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}
.sidebar-user__info { min-width: 0; flex: 1; }
.sidebar-user__name {
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user__role {
  color: rgba(255,255,255,.5);
  font-size: 11.5px;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-footer__logout {
  color: rgba(255,255,255,.45);
  font-size: 11.5px;
  text-decoration: none;
  text-align: center;
  padding: 6px 0;
  border-radius: 4px;
  transition: all .15s;
}
.sidebar-footer__logout:hover {
  color: #fff;
  background: rgba(255,255,255,.04);
}

/* ─── Main content ─── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 36px 40px 60px;
  min-width: 0;
  transition: margin-left .22s cubic-bezier(.4,0,.2,1);
}

/* ─── Typography ─── */
h1 {
  font-family: var(--font-title);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -.3px;
  line-height: 1.2;
  color: var(--ink);
  margin-bottom: 4px;
}
h2 {
  font-family: var(--font-title);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.1px;
  color: var(--ink);
  margin-bottom: 12px;
}
h3 {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 10px;
}
.muted {
  color: var(--muted);
  font-size: 13px;
}
p.muted { margin-top: 2px; }

/* ─── Panel / Card ─── */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 24px 28px;
  margin-top: 24px;
}
.panel:first-child { margin-top: 0; }
.panel.sub {
  background: #FAFAFA;
  border-color: var(--line);
  box-shadow: none;
  margin-top: 20px;
  padding: 20px 24px;
}
.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

/* auth/login */
.auth {
  display: grid;
  place-items: center;
  min-height: 100vh;
  background: var(--bg);
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px;
  width: min(460px, 100%);
}
.card h1 { margin-bottom: 24px; }

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
  box-shadow: var(--shadow-sm);
}
.btn:hover {
  background: #F3F4F6;
  border-color: #D1D5DB;
}
.btn.primary {
  background: var(--royal);
  border-color: var(--royal);
  color: #fff;
  box-shadow: 0 1px 3px rgba(0,74,172,.25);
}
.btn.primary:hover {
  background: #0055C8;
  border-color: #0055C8;
}

/* ─── Forms ─── */
.form { display: grid; gap: 14px; margin-top: 16px; }
.form label, label {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 5px;
  letter-spacing: .2px;
}
input, textarea, .select {
  width: 100%;
  min-height: 38px;
  line-height: 1.4;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 13.5px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, .select:focus {
  border-color: var(--true-blue);
  box-shadow: 0 0 0 3px rgba(73,149,255,.15);
}
input:disabled, textarea:disabled { opacity: .5; cursor: not-allowed; background: #F9FAFB; }
.select { cursor: pointer; }

.grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.grid .full { grid-column: 1 / -1; }
@media (max-width: 760px) { .grid { grid-template-columns: 1fr } }

/* ─── Alert ─── */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid rgba(209,70,0,.30);
  background: rgba(209,70,0,.06);
  color: #7C2900;
  font-size: 13.5px;
  margin-bottom: 16px;
}
.alert.closed {
  background: #fef9c3;
  border-color: #ca8a04;
  color: #713f12;
  margin-bottom: 12px;
}

/* ─── Admin nav ─── */
.admin-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
  margin-top: 14px;
  padding: 6px 10px;
  background: var(--surface2, #f4f4f5);
  border-radius: 8px;
  border: 1px solid var(--line);
}
.admin-nav-group {
  display: flex;
  align-items: center;
  gap: 1px;
}
.admin-nav-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 0 6px 0 4px;
  white-space: nowrap;
}
.admin-nav-sep {
  width: 1px;
  height: 22px;
  background: var(--line);
  margin: 0 6px;
  flex-shrink: 0;
}
.admin-nav-item {
  padding: 4px 9px;
  border-radius: 5px;
  font-size: 12px;
  color: var(--fg);
  text-decoration: none;
  white-space: nowrap;
  transition: background .12s;
}
.admin-nav-item:hover { background: var(--line); }
.admin-nav-item.admin-nav-active,
.admin-nav-item.admin-nav-active:hover,
.admin-nav-item.admin-nav-active:visited {
  background: var(--primary, #2563eb);
  color: #fff;
}
.admin-nav-back {
  color: var(--muted);
  font-size: 12px;
}

/* ─── Table ─── */
.table-wrap {
  margin-top: 16px;
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid var(--line);
}

/* Botão estrela (líder de equipe) */
.btn-star {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 2px 4px;
  color: #D1A500;
  opacity: 0.45;
  transition: opacity .15s, transform .1s;
}
.btn-star:hover { opacity: 1; transform: scale(1.2); }
.table tbody tr.highlight .btn-star { opacity: 1; }
.table tbody tr.highlight td { background: #fffbea; }

/* Row state highlights — especificidade combinada com .res-table-wrap
   para vencer a regra do td:first-child sticky (sem precisar de !important). */
.table tbody tr.row-selected td,
.res-table-wrap .table tbody tr.row-selected td,
.res-table-wrap .table tbody tr.row-selected td:first-child {
  background: #dbeafe;
}

/* Análise: diferença de rates */
.table tbody td.rate-diff-highlight,
.res-table-wrap .table tbody td.rate-diff-highlight {
  background: #fee2e2;
}

/* Simulação: linha com domínio alterado */
.table tbody tr.sim-changed td,
.res-table-wrap .table tbody tr.sim-changed td,
.res-table-wrap .table tbody tr.sim-changed td:first-child { background: #fff7ed; }

/* Análise: oportunidade de domínio */
.table tbody tr.domain-opportunity td,
.res-table-wrap .table tbody tr.domain-opportunity td,
.res-table-wrap .table tbody tr.domain-opportunity td:first-child {
  background: #dcfce7;
}
.sugg {
  color: #15803d;
  font-size: 10px;
  font-weight: 600;
}

/* Botão de análise ativo */
.btn.btn-active {
  background: var(--primary, #2563eb);
  color: #fff;
  border-color: var(--primary, #2563eb);
}

/* Resources table: cresce com o conteúdo e usa a rolagem da PÁGINA no eixo
   vertical (sem faixa interna). Mantém só a rolagem horizontal para a tabela
   larga (eixo separado). */
.res-table-wrap {
  margin-top: 16px;
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid var(--line);
  /* Esconde a barra horizontal NATIVA: a rolagem horizontal visível é a barra
     flutuante (.table-hscroll). Evita duas barras no fim da lista. A rolagem
     por roda/trackpad/teclado continua funcionando. */
  scrollbar-width: none;        /* Firefox */
  -ms-overflow-style: none;     /* IE/Edge legado */
}
.res-table-wrap::-webkit-scrollbar { height: 0; width: 0; }  /* Chrome/Edge/Safari */

/* ─── Telas People Mgr / Recursos: cabeçalho travado via rolagem da PÁGINA ───
   O PAINEL inteiro é o contêiner de rolagem e ocupa a altura da viewport. Ao
   rolar para baixo, os indicadores e a busca sobem e somem naturalmente; quando
   o cabeçalho da tabela chega ao topo, o <thead> sticky (top:0) gruda ali e, a
   partir desse ponto, apenas as linhas rolam — com os títulos das colunas
   sempre visíveis. A 1ª coluna e a barra de ferramentas ficam fixas no eixo
   horizontal (sticky left) para a rolagem lateral da tabela não as arrastar. */
.panel--fill {
  max-height: calc(100vh - 96px);   /* desconta o padding vertical do .main-content (36+60) */
  overflow: auto;                    /* rola vertical (linhas) e horizontal (colunas largas) */
  overscroll-behavior: contain;
}
/* O wrapper da tabela NÃO pode ser contêiner de rolagem (senão capturaria o
   sticky do thead); quem rola é o painel. */
.panel--fill > .res-table-wrap {
  overflow: visible;
  border: none;
  border-radius: 0;
}
/* Barra de ferramentas (título, indicadores, busca, botões): acompanha a
   rolagem vertical (some ao subir), mas fica fixa no eixo horizontal. */
.panel--fill > *:not(.res-table-wrap) {
  position: sticky;
  left: 0;
}
/* A 1ª coluna congelada e o canto do cabeçalho ancoram à esquerda do PAINEL. */
.panel--fill .table td:first-child,
.panel--fill .table thead th:first-child { left: 0; }

/* Barra de rolagem horizontal "flutuante": fixa ao fundo da janela, sincronizada
   por JS com a rolagem horizontal da tabela (ver templates/_resource_hscroll.html).
   Permite rolar na horizontal sem precisar ir até o fim da lista. */
.table-hscroll {
  position: sticky;
  bottom: 0;
  z-index: 6;
  overflow-x: auto;
  overflow-y: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: none;
  border-radius: 0 0 8px 8px;
  display: none; /* o JS exibe só quando há overflow horizontal */
}
.table-hscroll > div { height: 1px; }

/* Sticky header row (all th) */
.res-table-wrap .table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface2, #f4f4f5);
  box-shadow: inset 0 -1px 0 var(--line, #e4e4e7), 0 2px 4px -2px rgba(0, 0, 0, 0.08);
}

/* Sticky first column (body cells) */
.res-table-wrap .table td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--surface);
  border-right: 1px solid var(--line);
}

/* Corner cell: sticky top AND left — must be on top of everything */
.res-table-wrap .table thead th:first-child {
  position: sticky;
  top: 0;
  left: 0;
  z-index: 3;
  background: var(--surface2, #f4f4f5);
  border-right: 1px solid var(--line);
}

.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
  background: var(--surface);
}
.table th {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: .5px;
  text-transform: uppercase;
  background: #FAFAFA;
}
.table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 13.5px;
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: #F9FAFB; }
.disabled-row td { opacity: .5; }
.disabled-row:hover td { background: transparent; }

/* ─── Pivot table: Limites Salariais ─── */
.lim-table-wrap { margin-top: 12px; }
.limits-pivot { min-width: auto; width: 100%; }

.limits-pivot th {
  padding: 5px 6px;
  font-size: 10px;
  letter-spacing: .2px;
}
.limits-pivot td { padding: 4px 6px; font-size: 11px; }

.limits-pivot .limits-state-col {
  min-width: 42px;
  position: sticky;
  left: 0;
  background: #FAFAFA;
  z-index: 2;
  font-size: 10px;
}
.limits-pivot .limits-state-cell {
  position: sticky;
  left: 0;
  background: var(--surface);
  z-index: 1;
  font-size: 11px;
  white-space: nowrap;
}
.limits-pivot tr:hover .limits-state-cell { background: #F9FAFB; }

.limits-pivot .limits-level-hdr {
  text-align: center;
  border-left: 1px solid var(--line);
  white-space: nowrap;
  padding: 4px 4px;
}
.limits-pivot .limits-sub {
  font-size: 9px;
  padding: 3px 5px;
  border-left: 1px solid var(--line);
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
}

.limits-pivot .limits-cell {
  cursor: pointer;
  white-space: nowrap;
  min-width: 62px;
}
.limits-pivot .limits-cell:hover { background: #EFF6FF; color: var(--royal); }
.limits-pivot .limits-empty {
  color: var(--muted);
  cursor: pointer;
  text-align: center;
  font-size: 11px;
}
.limits-pivot .limits-empty:hover { background: #F0FDF4; color: #166534; }

/* Import collapsible */
.lim-import-panel { padding: 10px 14px; }
.lim-import-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  user-select: none;
}
.lim-import-toggle svg { transition: transform .2s; }

/* Popover de edição */
.lim-popover {
  position: absolute;
  z-index: 200;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0,0,0,.13);
  width: 250px;
  padding: 12px 14px;
}
.lim-pop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 12.5px;
}
.lim-pop-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 14px;
  padding: 0;
  line-height: 1;
}
.lim-pop-close:hover { color: var(--ink); }
.lim-pop-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  margin: 6px 0 3px;
  letter-spacing: .2px;
  text-transform: uppercase;
}
.lim-pop-input {
  width: 100%;
  padding: 6px 10px;
  border-radius: 7px;
  border: 1px solid var(--line);
  font-size: 13px;
  font-family: var(--font-body);
  outline: none;
  box-sizing: border-box;
}
.lim-pop-input:focus { border-color: var(--true-blue); box-shadow: 0 0 0 3px rgba(73,149,255,.15); }
.lim-pop-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}
.lim-pop-status { font-size: 12px; color: var(--muted); }

/* ─── Pills ─── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 13px;
  white-space: nowrap;
}
.pill.ok {
  border-color: rgba(161,230,255,.7);
  background: rgba(161,230,255,.12);
  color: #0369A1;
}
.pill.warn {
  border-color: rgba(255,174,65,.6);
  background: rgba(255,174,65,.10);
  color: #92400E;
}
.pill.bad {
  border-color: rgba(209,70,0,.35);
  background: rgba(209,70,0,.07);
  color: #7C2900;
}

/* ─── Misc ─── */
.row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.right { text-align: right; }
.table th.right,
.table td.right { text-align: right; }
.inline { display: inline; }
.empty { padding: 20px 14px; color: var(--muted); font-size: 13px; }
.search { margin-top: 16px; }

.search-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 16px;
}

.salary-toggle-btn {
  flex-shrink: 0;
  padding: 8px 10px;
  color: var(--muted);
}
.salary-toggle-btn:hover:not(:disabled) {
  color: var(--ink);
}

.link {
  background: none;
  border: none;
  padding: 0;
  color: var(--royal);
  cursor: pointer;
  text-decoration: none;
  font: inherit;
  font-size: 13px;
}
.link:hover { text-decoration: underline; }
.link.danger { color: var(--red); }

.thlink { color: var(--muted); text-decoration: none; font-size: 13px; }
.thlink:hover { color: var(--ink); text-decoration: underline; }

.balloon {
  position: fixed;
  z-index: 9999;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  max-width: 320px;
  font-size: 13px;
  box-shadow: var(--shadow);
}
.plan-hour.over { border-color: rgba(209,70,0,.55); }

code { color: var(--royal); font-size: 12.5px; }

/* ─── Document upload grid ─── */
.doc-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 14px;
}
.doc-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.doc-row:last-child { border-bottom: none; }
.doc-row:hover { background: #FAFAFA; }
.doc-name {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
}
.doc-name small {
  display: block;
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
  margin-top: 2px;
}
.doc-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  white-space: nowrap;
}
.doc-status.sent   { color: #0369A1; }
.doc-status.pending { color: var(--muted); }
.doc-status .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.doc-status.sent   .dot { background: #0369A1; }
.doc-status.pending .dot { background: #D1D5DB; }
.doc-action {
  display: flex;
  align-items: center;
  gap: 8px;
}
.doc-action input[type=file] {
  width: auto;
  font-size: 12.5px;
  padding: 6px 10px;
  color: var(--muted);
  border-color: var(--line);
  background: #FAFAFA;
  cursor: pointer;
}

/* ─── Close OS section ─── */
.close-os-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 20px;
  padding: 14px 18px;
  border-radius: 8px;
  background: rgba(209,70,0,.04);
  border: 1px solid rgba(209,70,0,.20);
}
.btn.danger {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}
.btn.danger:hover {
  background: #B83D00;
  border-color: #B83D00;
}

/* ─── Chart legend ─── */
.chart-legend {
  display: flex;
  gap: 18px;
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
  flex-wrap: wrap;
}
.legend-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
  flex-shrink: 0;
}

/* ─── Value coloring (variance, margin) ─── */
.val-good { color: #0f6a2e; font-weight: 500; }
.val-bad  { color: var(--red); font-weight: 500; }
.margin-ok   { color: #0369A1; font-weight: 600; }
.margin-warn { color: #92400E; font-weight: 600; }
.margin-bad  { color: var(--red); font-weight: 700; }

/* ─── Closed OS badge in list ─── */
.badge-closed {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 4px;
  background: #F3F4F6;
  color: var(--muted);
  border: 1px solid var(--line);
  margin-left: 7px;
  vertical-align: middle;
  letter-spacing: .2px;
}

/* ─── Sort arrow indicator ─── */
.sort-arrow {
  font-size: 10px;
  margin-left: 3px;
  opacity: .7;
}

/* ─── Painel lateral: orelinhas (sidebar + chat IA) ─── */
.panel-handle {
  position: fixed;
  left: calc(var(--sidebar-w) - 1px);
  z-index: 30;
  width: 22px;
  height: 40px;
  background: var(--sidebar-bg);
  border: none;
  border-radius: 0 8px 8px 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,.55);
  font-size: 13px;
  line-height: 1;
  padding: 0;
  box-shadow: 3px 0 8px rgba(0,0,0,.18);
  transition: left .22s cubic-bezier(.4,0,.2,1), color .15s, background .15s;
}
.panel-handle:hover { color: #fff; background: #2E4B7A; }
.panel-handle--sidebar { top: 14px; }
.panel-handle--ai-chat { top: 64px; }
/* Compat: classe antiga ainda usada por base.html */
.sidebar-toggle-btn { position: fixed; top: 14px; left: calc(var(--sidebar-w) - 1px); z-index: 30; width: 22px; height: 40px; background: var(--sidebar-bg); border: none; border-radius: 0 8px 8px 0; cursor: pointer; display: flex; align-items: center; justify-content: center; color: rgba(255,255,255,.55); font-size: 13px; line-height: 1; padding: 0; box-shadow: 3px 0 8px rgba(0,0,0,.18); transition: left .22s cubic-bezier(.4,0,.2,1), color .15s, background .15s; }
.sidebar-toggle-btn:hover { color: #fff; background: #2E4B7A; }

/* ─── Camada AI chat (mesma posição/largura da sidebar) ─── */
.ai-chat {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: #fff;
  border-right: 1px solid #d5dce5;
  z-index: 20;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform .22s cubic-bezier(.4,0,.2,1);
  box-shadow: 4px 0 12px rgba(0,0,0,.08);
}
.ai-chat__head { padding: 14px 16px; border-bottom: 1px solid #e3e7ee; display: flex; align-items: center; gap: 8px }
.ai-chat__title { font-family: var(--font-title); font-weight: 600; font-size: 14px; color: #1F3A5F; white-space: nowrap }
.ai-chat__head .ai-chat__clear { margin-left: auto; font-size: 11px; color: #888; background: none; border: 0; cursor: pointer; white-space: nowrap }
.ai-chat__history { flex: 1; overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; background: #FAFCFE }
.ai-chat__msg { padding: 8px 12px; border-radius: 10px; font-size: 13px; line-height: 1.5; max-width: 95% }
.ai-chat__msg--user { background: #1F3A5F; color: #fff; align-self: flex-end; border-bottom-right-radius: 3px }
.ai-chat__msg--assistant { background: #fff; color: #1F3A5F; align-self: flex-start; border: 1px solid #d5dce5; border-bottom-left-radius: 3px }
.ai-chat__msg--tool { background: #FFF8E5; color: #8A6D14; align-self: flex-start; font-size: 12px; border-left: 3px solid #F0AD4E; padding: 6px 10px; border-radius: 0 6px 6px 0 }
.ai-chat__msg--erro { background: #FCEEED; color: #B53A2D; align-self: flex-start; font-size: 12px }
.ai-chat__msg pre { background: #F4F4F4; padding: 6px 8px; border-radius: 4px; font-family: 'SF Mono', Consolas, monospace; font-size: 11px; overflow-x: auto; margin: 4px 0; white-space: pre-wrap; word-break: break-word }
.ai-chat__msg code { background: #F4F4F4; padding: 1px 4px; border-radius: 3px; font-family: 'SF Mono', Consolas, monospace; font-size: 11px }

/* ─── Markdown renderizado dentro das mensagens assistant ─── */
.ai-chat__msg--assistant p { margin: 0 0 6px 0 }
.ai-chat__msg--assistant p:last-child { margin-bottom: 0 }
.ai-chat__msg--assistant strong { color: #0B2244 }
.ai-chat__msg--assistant ul,
.ai-chat__msg--assistant ol { margin: 4px 0 6px 18px; padding: 0 }
.ai-chat__msg--assistant li { margin: 2px 0 }
.ai-chat__msg--assistant table.md-table { width: 100%; border-collapse: collapse; margin: 6px 0; font-size: 12px; background: #fff }
.ai-chat__msg--assistant table.md-table th { background: #1F3A5F; color: #fff; padding: 4px 6px; text-align: left; font-weight: 600; border: 1px solid #1F3A5F }
.ai-chat__msg--assistant table.md-table td { padding: 3px 6px; border: 1px solid #D5DCE5; vertical-align: top }
.ai-chat__msg--assistant table.md-table tbody tr:nth-child(even) td { background: #FAFCFE }
.ai-chat__confirm { display: flex; gap: 6px; margin-top: 6px }
.ai-chat__confirm button { font-size: 11px; padding: 3px 8px; border-radius: 3px; border: 1px solid #d5dce5; cursor: pointer }
.ai-chat__confirm button.primary { background: #1F7A3A; color: #fff; border-color: #1F7A3A }
.ai-chat__confirm button.danger { background: #fff; color: #B53A2D; border-color: #B53A2D }
.ai-chat__form { padding: 10px 12px; border-top: 1px solid #e3e7ee; background: #fff; display: flex; gap: 6px }
.ai-chat__form textarea { flex: 1; resize: none; min-height: 60px; max-height: 160px; padding: 6px 8px; border: 1px solid #d5dce5; border-radius: 5px; font-family: inherit; font-size: 12px; line-height: 1.4 }
.ai-chat__form textarea::placeholder { font-size: 11px; color: #888 }
.ai-chat__empty { color: #888; font-style: italic; font-size: 12px; text-align: center; padding: 20px 10px }

/* ─── Config IA: linhas de papéis (checkbox alinhado ao texto) ─── */
.ai-roles-form .ai-role-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; line-height: 1.4; }
.ai-roles-form .ai-role-row input[type="checkbox"] { width: 16px; height: 16px; flex: 0 0 16px; margin: 0; }
.ai-roles-form .ai-role-row span { font-size: 13px; }

/* ─── Cabeçalhos sortable/filterable (Recursos) ─── */
#res-table thead th { user-select: none; }
#res-table thead th.sortable .th-label { cursor: pointer; }
#res-table thead th .th-sort { display: inline-block; width: 9px; font-size: 9px; opacity: 0; margin-left: 3px; vertical-align: baseline; }
#res-table thead th:hover .th-sort { opacity: .35; }
#res-table thead th.sort-asc .th-sort, #res-table thead th.sort-desc .th-sort { opacity: 1; color: #1F3A5F; }
#res-table thead th.sort-asc .th-sort::after { content: '▲'; }
#res-table thead th.sort-desc .th-sort::after { content: '▼'; }
#res-table thead th .th-filter { display: inline-block; cursor: pointer; opacity: 0; font-size: 10px; margin-left: 3px; color: #888; transition: opacity .12s; vertical-align: baseline; }
#res-table thead th:hover .th-filter { opacity: .7; }
#res-table thead th.filter-active .th-filter { opacity: 1; color: #1F3A5F; }
.th-popover { position: fixed; z-index: 200; background: #fff; border: 1px solid #d5dce5; border-radius: 5px; padding: 6px; box-shadow: 0 4px 14px rgba(0,0,0,.14); min-width: 170px; font-weight: normal; }
.th-popover input { width: 100%; padding: 4px 6px; font-size: 12px; border: 1px solid #d5dce5; border-radius: 4px; box-sizing: border-box; }
.th-popover .pop-row { display: flex; gap: 4px; margin-top: 5px; }
.th-popover button { font-size: 11px; padding: 3px 8px; border: 1px solid #d5dce5; background: #fff; border-radius: 3px; cursor: pointer; }
.th-popover button.primary { background: #1F3A5F; color: #fff; border-color: #1F3A5F; }

/* ─── Estados de visibilidade (sidebar | chat | nenhum) ─── */
.layout.panel--sidebar .sidebar { transform: translateX(0); }
.layout.panel--sidebar .ai-chat { transform: translateX(-100%); }
.layout.panel--sidebar .main-content { margin-left: var(--sidebar-w); }

.layout.panel--ai-chat .sidebar { transform: translateX(-100%); }
.layout.panel--ai-chat .ai-chat { transform: translateX(0); }
.layout.panel--ai-chat .main-content { margin-left: var(--sidebar-w); }

.layout.panel--none .sidebar { transform: translateX(-100%); }
.layout.panel--none .ai-chat { transform: translateX(-100%); }
.layout.panel--none .main-content { margin-left: 0; }
.layout.panel--none .panel-handle,
.layout.panel--none .sidebar-toggle-btn { left: 0; border-radius: 0 8px 8px 0; }

/* Compat: estado antigo `sidebar-collapsed` continua escondendo a sidebar */
.layout.sidebar-collapsed .sidebar { transform: translateX(-100%); }
.layout.sidebar-collapsed .main-content { margin-left: 0; }
.layout.sidebar-collapsed .sidebar-toggle-btn,
.layout.sidebar-collapsed .panel-handle { left: 0; border-radius: 0 8px 8px 0; }

/* ─── Responsive sidebar ─── */
@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }
  .sidebar { display: none; }
  .sidebar-toggle-btn { display: none; }
  .main-content { margin-left: 0; padding: 20px 16px 40px; }
  .panel--fill { max-height: calc(100vh - 60px); }  /* padding vertical do .main-content (20+40) */
}



/* ─── Barra lateral em árvore (estrutura do OneNote, fundo escuro original) ─
   Cada aba (chevron + barra na cor da aba) recolhe/expande e seus itens
   ficam embaixo, com a barrinha na mesma cor. A barra azul-marinho do People
   Management ganha contorno laranja para não sumir no fundo escuro.
   O item da página atual fica destacado, em negrito. */
.sidebar {
  --sb-ink: rgba(255,255,255,.86); --sb-ink-2: rgba(255,255,255,.5); --sb-line: rgba(255,255,255,.08);
  --sb-hover: rgba(255,255,255,.06); --sb-card: rgba(255,255,255,.11);
  overflow-y: hidden;
}

.nb {
  flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden;
  padding: 10px 8px 12px;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.18) transparent;
}
.nb-book { --bk: var(--nb-navy); --bk-edge: transparent; border-top: 1px solid var(--sb-line); padding: 4px 0; }
.nb-book:first-of-type { border-top: 0; }
.nb-tab--navy   { --bk: var(--nb-navy); --bk-edge: var(--nb-orange); }
.nb-tab--orange { --bk: var(--nb-orange); }
.nb-tab--white  { --bk: #FFFFFF; }
.nb-tab--gray   { --bk: var(--nb-gray); }

.nb-book__row {
  all: unset; box-sizing: border-box; cursor: pointer;
  display: flex; align-items: center; gap: 8px; width: 100%;
  min-height: 40px; padding: 6px 8px 6px 4px; border-radius: 6px;
  font: 500 14px/1.25 var(--font-body); color: var(--sb-ink);
  transition: background .12s;
}
.nb-book__row:hover { background: var(--sb-hover); }
.nb-book__row:focus-visible { outline: 2px solid var(--nb-orange); outline-offset: -2px; }
.nb-book.is-active > .nb-book__row {
  background: var(--sb-card); color: #fff;
}
.nb-book__chev {
  width: 16px; height: 16px; flex: none; color: rgba(255,255,255,.6);
  transition: transform .18s ease;
}
.nb-book.is-open .nb-book__chev { transform: rotate(90deg); }
.nb-book__bar {
  width: 8px; height: 22px; flex: none; background: var(--bk);
  border-radius: 8px 2px 2px 8px / 11px 2px 2px 11px;
  box-shadow: inset 0 0 0 1.5px var(--bk-edge);
}
.nb-book__label-txt { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.nb-book__body {
  display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows .22s cubic-bezier(.2,.8,.2,1);
}
.nb-book.is-open > .nb-book__body { grid-template-rows: 1fr; }
.sidebar .nb-book__inner { min-height: 0; overflow: hidden; padding: 0; flex: none; }
.sidebar .nb-book.is-open .nb-book__inner { padding: 2px 0 4px; }

.nb-sec {
  display: flex; align-items: center; gap: 12px;
  min-height: 38px; padding: 6px 10px 6px 30px; margin: 1px 0;
  border-radius: 6px; color: var(--sb-ink); text-decoration: none;
  font-size: 14px; line-height: 1.25;
  transition: background .12s;
}
.nb-sec:hover { background: var(--sb-hover); color: #fff; }
.nb-sec.active {
  background: var(--sb-card); color: #fff; font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06);
}
.nb-sec__tab {
  width: 6px; height: 16px; flex: none; background: var(--bk);
  box-shadow: inset 0 0 0 1px var(--bk-edge);
  border-radius: 7px 2px 2px 7px / 9px 2px 2px 9px;
}
.nb-sec__label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nb-group {
  padding: 10px 10px 3px 30px; font-size: 10.5px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: rgba(255,255,255,.36);
}
.nav-badge {
  background: #D14600; color: #fff; font-size: 10px; font-weight: 700;
  padding: 1px 6px; border-radius: 99px; line-height: 1.5;
}
.nb.no-anim .nb-book__body, .nb.no-anim .nb-book__chev { transition: none; }
@media (prefers-reduced-motion: reduce) {
  .nb-book__body, .nb-book__chev { transition: none; }
}
