/* ===========================
   Compare (layout RH clean)
   =========================== */

:root {
  --bg: #f3f6fb;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: rgba(15, 23, 42, 0.12);
  --shadow: 0 10px 28px rgba(15, 23, 42, 0.08);

  --brand: #2563eb; /* azul topo */
  --brand2: #1d4ed8;
  --ok: #16a34a;
  --warn: #f59e0b;
  --bad: #ef4444;
  --chip: rgba(37, 99, 235, 0.12);

  --maxw: 100%; /* modo wide */ /* alinhar com o site principal (ajuste se necessário) */

  /* Mantém consistência com a barra superior do app principal */
  --app-header-height: 64px;
}

* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    Segoe UI,
    Roboto,
    Arial,
    "Apple Color Emoji",
    "Segoe UI Emoji";
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden; /* evita barra horizontal */

  /* evita que o conteúdo fique por baixo da barra fixa */
  padding-top: var(--app-header-height);
}

/* =========================================================
   HEADER (padronizado com o app principal)
   ========================================================= */

.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2000;
  height: var(--app-header-height);
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand2) 100%);
  box-shadow: 0 6px 22px rgba(2, 6, 23, 0.15);
  color: #e3e8f0;
}

.header-content {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  height: 100%;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.header-brand {
  display: flex;
  /* align-items: center; -- duplicate removed */
  /* gap: 12px; -- duplicate removed */
  min-width: 0;
}

.brand-text {
  min-width: 0;
}

.brand-text h1 {
  margin: 0;
  font-weight: 800;
  font-size: 1.35rem;
  line-height: 1.15;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-text p {
  margin: 2px 0 0;
  font-size: 0.85rem;
  opacity: 0.9;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Botão Menu (igual ao app principal) */
.sidebar-toggle {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  color: #1d4ed8;
  background: #dbeafe; /* primary-100 */
  border: none;
  box-shadow: none;
  transition: background 160ms ease;
}

.sidebar-toggle:hover {
  background: #bfdbfe; /* primary-200 */
}

.sidebar-toggle .material-icons {
  font-size: 18px;
  line-height: 1;
}

/* Badges do header (mesma ideia do app principal) */
.header-badges {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stat-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(6px);
  line-height: 1;
}

.stat-badge .material-icons {
  font-size: 16px;
  opacity: 0.95;
}

.badge-value {
  font-weight: 800;
}

.badge-label {
  font-size: 12px;
  opacity: 0.92;
}

.stat-badge-btn {
  cursor: pointer;
}

.stat-badge-btn:hover {
  background: rgba(255, 255, 255, 0.18);
}

@media (max-width: 1100px) {
  .header-badges {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
}

.page {
  max-width: var(--maxw);
  margin: 18px auto 28px;
  padding: 0 18px 24px;
}

.grid {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 16px;
  align-items: start;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.card-hd {
  padding: 14px 16px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}
.card-title {
  font-weight: 900;
}
.card-subtitle {
  color: var(--muted);
  font-size: 12.5px;
}

.uploads {
  padding-bottom: 12px;
  overflow: hidden;
}

.expander {
  margin: 12px 12px 0;
  border: 1px dashed rgba(15, 23, 42, 0.15);
  border-radius: 16px;
  background: rgba(2, 6, 23, 0.015);
}
.expander > summary {
  list-style: none;
  padding: 12px 14px;
  cursor: pointer;
  display: flex;
  gap: 10px;
  align-items: baseline;
  justify-content: space-between;
  font-weight: 900;
}
.expander > summary::-webkit-details-marker {
  display: none;
}

.expander .meta {
  font-weight: 700;
  color: var(--muted);
  font-size: 12px;
}

.expander-body {
  padding: 12px 14px 14px;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
}

.dropzone {
  border: 2px dashed #2563eb;
  background: #e0e7ef;
  border-radius: 16px;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  text-align: center;
}

.dropzone:hover {
  background: #dbeafe;
}

.dz-left {
  width: 100%;
}
.dz-right {
  width: 100%;
  display: flex;
  justify-content: center;
}

.dropzone.dragover {
  border-color: #16a34a;
  background: #bbf7d0;
}

.dz-title {
  font-weight: 900;
}
.dz-hint {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}
.checkline {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
  color: var(--muted);
  font-weight: 700;
}
.checkline input {
  width: 16px;
  height: 16px;
}

.file {
  display: none;
}

.btn {
  border: 1px solid rgba(15, 23, 42, 0.16);
  background: #fff;
  padding: 10px 12px;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 900;
  /* font-size: 13px; -- duplicate removed */
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.btn:hover {
  transform: translateY(-0.5px);
}
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn.primary {
  background: rgba(37, 99, 235, 0.12);
  border-color: rgba(37, 99, 235, 0.28);
}
.btn.success {
  background: rgba(22, 163, 74, 0.12);
  border-color: rgba(22, 163, 74, 0.3);
}

.filelist {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* File item: layout (nome/tamanho em cima; ações embaixo) */
.fileitem {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  background: #fff;
}
.fileitem .filemeta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.fileitem .name {
  font-weight: 700;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fileitem .size {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}
.fileitem .fileactions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap; /* manter Cabeçalho + Linhas + Remover na mesma linha */
  overflow-x: auto; /* em telas muito estreitas, permite scroll horizontal */
  -webkit-overflow-scrolling: touch;
}
.fileitem .badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(2, 6, 23, 0.03);
  font-weight: 700;
  font-size: 10.5px;
}
.fileitem .lines-mini {
  opacity: 0.95;
}
.fileitem .header-mini {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 7px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: rgba(255, 255, 255, 0.85);
  font-weight: 700;
  font-size: 10.5px;
  color: rgba(2, 6, 23, 0.8);
}
.fileitem .header-mini input {
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
}
.fileitem .remove {
  margin-left: auto;
  border: 1px solid rgba(239, 68, 68, 0.25);
  background: rgba(239, 68, 68, 0.08);
  color: #000a1a; /* Even darker for accessibility */
  padding: 4px 8px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 900;
  font-size: 10.5px;
}
.mini-expander {
  margin-top: 10px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
}
.mini-expander > summary {
  padding: 10px 12px;
  cursor: pointer;
  font-weight: 900;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  list-style: none;
}
.mini-expander > summary::-webkit-details-marker {
  display: none;
}
.mini-body {
  padding: 10px 12px;
  color: #1e293b;
  font-size: 13px;
  background: #f8fafc;
}

.right {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.kpi {
  padding: 12px 14px;
}
.kpi-hd {
  color: var(--muted);
  font-weight: 900;
  font-size: 12.5px;
}
.kpi-val {
  font-size: 26px;
  font-weight: 1000;
  margin-top: 4px;
}

.actions {
  padding: 14px 16px;
}
.actions-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.actions-title {
  font-weight: 1000;
}
.actions-sub {
  color: var(--muted);
  font-size: 12.5px;
  margin-top: 2px;
}
.actions-right {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.accordion {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.expander-result {
  margin: 0;
  border-style: solid;
  border-color: rgba(15, 23, 42, 0.08);
  background: #fff;
}
.expander-result > summary {
  padding: 14px 16px;
}

.table-wrap {
  overflow: auto;
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
thead th {
  position: sticky;
  top: 0;
  background: rgba(37, 99, 235, 0.1);
  border-bottom: 1px solid rgba(15, 23, 42, 0.1);
  padding: 10px 10px;
  text-align: left;
  font-weight: 1000;
}
tbody td {
  padding: 9px 10px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  white-space: nowrap;
}
tbody tr:nth-child(odd) {
  background: rgba(2, 6, 23, 0.015);
}

.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 12px;
  border: 1px solid transparent;
}
.st-ok {
  background: rgba(
    22,
    163,
    74,
    0.38
  ); /* Increased opacity for better contrast */
  border-color: rgba(22, 163, 74, 0.38);
  color: #02290f; /* Much darker green for accessibility */
}
.st-bad {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.25);
  color: #1a0000; /* Much darker red for accessibility */
}
.st-warn {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.3);
  color: #4a2d06;
}
.st-info {
  background: rgba(37, 99, 235, 0.1);
  border-color: rgba(37, 99, 235, 0.25);
  color: #ffffff; /* Changed to white for maximum contrast */
}

.num-pos {
  color: #0f6b2d;
  font-weight: 900;
}
.num-neg {
  color: #b91c1c;
  font-weight: 900;
}

/* =========================================================
   Diferença (tabela HTML)
   A tabela renderiza: <span class="num pos|neg|ok">...
   Então estilizamos .num.pos / .num.neg / .num.ok para ficar
   igual ao relatório XLSX (positivo verde, negativo vermelho, zero neutro).
   ========================================================= */

.num.pos {
  color: #0f6b2d;
  font-weight: 900;
}

.num.neg {
  color: #b91c1c;
  font-weight: 900;
}

.num.ok {
  color: #374151; /* cinza neutro */
  font-weight: 800;
}

.exec {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 12px;
}
.exec .panel {
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 16px;
  background: #fff;
  padding: 12px 14px;
}
.exec .panel h3 {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 1000;
}
.exec .muted {
  color: var(--muted);
  font-size: 12.5px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 3000;
}
.modal-backdrop.show {
  display: flex;
}

dialog::backdrop {
  background: transparent;
}

.modal {
  width: min(980px, 100%);
  background: #fff;
  border-radius: 18px;
  border: 1px solid rgba(15, 23, 42, 0.14);
  box-shadow: 0 24px 80px rgba(2, 6, 23, 0.35);
  overflow: hidden;
}
.modal-hd {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  background: rgba(37, 99, 235, 0.1);
  border-bottom: 1px solid rgba(15, 23, 42, 0.1);
}
.modal-title {
  font-weight: 1000;
}
.icon-btn {
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: #fff;
  border-radius: 12px;
  padding: 8px 10px;
  cursor: pointer;
  font-weight: 900;
}
.modal-bd {
  padding: 14px 16px 6px;
}
.modal-ft {
  padding: 12px 16px 16px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.about-card {
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 16px;
  padding: 12px 14px;
  background: #fff;
}
.about-h {
  font-weight: 1000;
  margin-bottom: 8px;
}
.about-card ul {
  margin: 0;
  padding-left: 18px;
  color: #1f2937;
}
.about-card li {
  margin: 6px 0;
}

code {
  background: rgba(2, 6, 23, 0.06);
  padding: 2px 6px;
  border-radius: 8px;
}

@media (max-width: 1060px) {
  .grid {
    grid-template-columns: 1fr;
  }
  .kpis {
    grid-template-columns: 1fr;
  }
  .header-content {
    flex-wrap: wrap;
    justify-content: flex-start;
  }
  .exec {
    grid-template-columns: 1fr;
  }
}

/* Per-file header option (discreet, next to Remove) */
.fileleft {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2px;
}
.fileleft .name {
  font-weight: 800;
  font-size: 13px;
  color: #0f172a;
}
.fileleft .size {
  font-size: 12px;
  color: #64748b;
}

.fileactions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.header-mini {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: rgba(2, 6, 23, 0.03);
  font-weight: 800;
  font-size: 12px;
  color: #ffffff; /* Changed to white for maximum contrast with background */
  user-select: none;
}
.header-mini input {
  width: 14px;
  height: 14px;
  accent-color: #2563eb;
}

/* badge removed per expander */
/* Removed duplicate selector */

/* Preview table (mais organizada) */
.preview-wrap {
  overflow: auto;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 12px;
  background: #fff;
}

.preview-wrap.preview-scroll {
  max-height: 360px; /* ~10 linhas visíveis + cabeçalho */
  overflow-y: auto;
}
.preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.preview-table thead th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  text-align: left;
  padding: 8px 10px;
  font-weight: 800;
  color: #0f172a;
}
.preview-table td {
  padding: 7px 10px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  color: #0f172a;
}

/* Alternância por mudança de Matrícula (pré-visualização) */
.preview-table tbody tr.mat-alt {
  background: rgba(15, 23, 42, 0.035);
}
.preview-table tr:last-child td {
  border-bottom: none;
}
.preview-table .num {
  text-align: right;
  white-space: nowrap;
}
.preview-table .mono {
  font-variant-numeric: tabular-nums;
  font-family:
    ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
}

/* Exec refinado */
.exec .panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
/* Removed duplicate .pill selector; definition is at line 98 */
.kgrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}
@media (min-width: 900px) {
  .kgrid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.kcard {
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 14px;
  padding: 10px 12px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 1),
    rgba(248, 250, 252, 1)
  );
}
.klabel {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  font-weight: 800;
  margin-bottom: 6px;
}
.kval {
  font-size: 18px;
  font-weight: 900;
  color: #0f172a;
  line-height: 1.1;
  margin-bottom: 4px;
}
.toplist {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 6px;
}
.toplist li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.toplist .tag {
  font-size: 11px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(2, 6, 23, 0.05);
}
.toplist .num {
  font-variant-numeric: tabular-nums;
  font-family:
    ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
}
.legend {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.card-hd-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
#btnDiag.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 12px;
}

/* Diagnóstico (modal) */
.diag-section {
  margin-top: 10px;
}
.diag-sec-title {
  font-weight: 900;
  color: #0f172a;
  margin: 10px 2px 8px;
}
.diag-card {
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 14px;
  padding: 10px 12px;
  background: #fff;
  margin-bottom: 10px;
}
.diag-hd {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.diag-name {
  font-weight: 900;
  font-size: 13px;
  color: #0f172a;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.diag-kpis {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.diag-pill {
  font-size: 11px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(2, 6, 23, 0.05);
}
.diag-pill.warn {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.18);
}
.diag-bd {
  margin-top: 8px;
}
.diag-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 6px;
}
.diag-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px dashed rgba(15, 23, 42, 0.08);
  padding-top: 6px;
}
.diag-list li:first-child {
  border-top: none;
  padding-top: 0;
}
.diag-empty {
  padding: 10px 12px;
  border: 1px dashed rgba(15, 23, 42, 0.1);
  border-radius: 14px;
  background: rgba(2, 6, 23, 0.02);
}

/* ===========================
   Filters & Progress
   =========================== */
.filters {
  margin: 10px 0 12px;
  padding: 10px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.02);
  border-radius: 14px;
}
.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.input,
.select {
  height: 38px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  outline: none;
  font-weight: 700;
}
.input {
  min-width: 210px;
  flex: 1;
}
.select {
  min-width: 180px;
}
.check {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 6px 10px;
  border-radius: 12px;
  border: 1px dashed var(--border);
  background: rgba(15, 23, 42, 0.015);
  user-select: none;
}
.check input {
  transform: translateY(1px);
}
.btn.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn.ghost:hover {
  border-color: rgba(37, 99, 235, 0.55);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.12);
}
.progress.card {
  margin-top: 12px;
  padding: 12px;
}
.progress-hd {
  font-weight: 900;
  color: var(--text);
  margin-bottom: 6px;
}
.progress-txt {
  color: var(--muted);
  font-weight: 800;
}
.progress-bar {
  margin-top: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    rgba(37, 99, 235, 0.55),
    rgba(34, 197, 94, 0.55)
  );
  transition: width 160ms ease;
}

/* ===== Summary row (KPIs + Status + Actions) ===== */
.summary .expander-summary > summary {
  font-weight: 800;
}
.summary-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  /* merged from duplicate selector below */
}
.mini {
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 12px;
  min-width: 160px;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
}
.mini.kpi .mini-hd {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.mini.kpi .mini-val {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.1;
}

.mini.status {
  min-width: 260px;
  flex: 1 1 260px;
}
.status-line {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}
.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.55);
  box-shadow: 0 0 0 6px rgba(37, 99, 235, 0.12);
}
.status-text {
  color: var(--text);
}
.mini-bar {
  margin-top: 8px;
  height: 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
  overflow: hidden;
}
.mini-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(
    90deg,
    rgba(37, 99, 235, 0.85),
    rgba(59, 130, 246, 0.85)
  );
  border-radius: 999px;
  transition: width 0.25s ease;
}

/* ===== View switch (Lado a Lado vs Estatísticas) ===== */
.view-switch {
  display: flex;
  justify-content: flex-end;
  margin: 10px 0 14px;
}
.segmented {
  display: inline-flex;
  gap: 8px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.06);
  border: 1px solid var(--border);
}
.seg-btn {
  border: 0;
  background: transparent;
  padding: 10px 14px;
  border-radius: 999px;
  font-weight: 900;
  color: var(--muted);
  cursor: pointer;
}
.seg-btn.active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.1);
}

/* ===== Switch (toggles) ===== */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  user-select: none;
  font-weight: 900;
}
.switch input {
  display: none;
}
.switch .slider {
  width: 58px;
  height: 32px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.12);
  border: 1px solid var(--border);
  position: relative;
  transition: all 0.18s ease;
  flex: 0 0 auto;
}
.switch .slider::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 4px;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #fff;
  transform: translateY(-50%);
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.18);
  transition: all 0.18s ease;
}
.switch input:checked + .slider {
  background: rgba(34, 197, 94, 0.22);
  border-color: rgba(34, 197, 94, 0.55);
}
.switch input:checked + .slider::after {
  left: calc(100% - 28px);
}
.toggle-row {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

/* --- Ajustes v4: painel Resumo mais discreto --- */
.expander-summary {
  border: 1px solid rgba(0, 0, 0, 0.08);
}
.expander-summary > summary {
  font-size: 14px;
  opacity: 0.9;
}
.summary-body {
  padding: 12px 12px 14px;
}
/* removed duplicate .summary-row selector; merged above */
.summary-row .mini.kpi {
  min-width: 140px;
}
.summary-row .mini.status {
  min-width: 260px;
}
.summary-row .btn {
  white-space: nowrap;
}
.summary-row .segmented {
  padding: 6px;
}
.summary-row .seg-btn {
  padding: 10px 12px;
  font-size: 13px;
}

/* Ensure hidden attribute always hides even when layout classes set display */
[hidden] {
  display: none !important;
}

/* Header filters inside table */
.th-filters th {
  padding: 8px 10px;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(248, 250, 252, 0.9);
}
.th-input,
.th-cell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
}
.th-cell > span {
  white-space: nowrap;
}
.th-select {
  width: 100%;
  /* padding: 8px 10px; -- duplicate removed */
  /* border-radius: 12px; -- duplicate removed */
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: white;
  font-weight: 700;
  /* font-size: 13px; -- duplicate removed */
  color: #0f172a;
  outline: none;

  max-width: 160px;
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 10px;
}
.th-input:focus,
.th-select:focus {
  border-color: rgba(37, 99, 235, 0.45);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

/* --- View toggle inside expander titles (secondary instance) --- */
.summary-right {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}
.segmented-compact {
  padding: 4px;
  gap: 6px;
}
.segmented-compact .seg-btn {
  padding: 8px 10px;
  font-size: 12px;
}

/* --- Inline header filters (Excel-like) --- */
.th-filter {
  position: relative;
}
.th-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
}
.th-label {
  white-space: nowrap;
}
.th-filter .th-select {
  max-width: 170px;
}

/* --- Divergentes counter next to toggle --- */
.count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 18px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.28);
  color: #012616;
  text-shadow:
    0 0 1px #fff,
    0 0 1px #fff; /* Add subtle outline for contrast */
  margin-left: 6px;
}

/* Compact switch for expander header */
.switch-compact {
  gap: 10px;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.04);
  border: 1px solid rgba(15, 23, 42, 0.08);
}
.switch-compact .switch-text {
  font-size: 11px;
  font-weight: 800;
}
.switch-compact .slider {
  width: 40px;
  height: 22px;
}
/* O switch base usa ::after (não :before). Ajuste compacto conforme essa estrutura */
.switch-compact .slider::after {
  width: 18px;
  height: 18px;
  left: 3px;
}
.switch-compact input:checked + .slider::after {
  left: calc(100% - 21px);
}

/* =========================================================
   Status pills (tabela Lado a Lado)
   ========================================================= */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 12px;
  line-height: 1;
  border: 1px solid transparent;
  white-space: nowrap;
}
.tag .tag-ic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}
.tag.ok {
  background: rgba(34, 197, 94, 0.14);
  border-color: rgba(34, 197, 94, 0.3);
}
.tag.warn {
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.3);
}
.tag.miss {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.3);
}
.tag.info {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.28);
}

.th-select-header {
  width: 100%;
  height: 34px;
  padding: 6px 10px;
  border-radius: 10px;
  font-weight: 800;
}
.th-select-header:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
}

/* ============================
   Estatísticas (Executivo RH)
   ============================ */
.execGrid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}
@media (max-width: 1200px) {
  .execGrid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 720px) {
  .execGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.execCard {
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 16px;
  padding: 12px 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
}
.execTitle {
  font-weight: 700;
  font-size: 0.82rem;
  color: #3a4a66;
  letter-spacing: 0.2px;
}
.execBig {
  margin-top: 6px;
  font-size: 1.55rem;
  font-weight: 800;
  color: #132a55;
}
.execSub {
  margin-top: 4px;
  font-size: 0.82rem;
  color: #6c7a92;
  line-height: 1.2;
}

.statsSplit {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}
@media (max-width: 980px) {
  .statsSplit {
    grid-template-columns: 1fr;
  }
}

.statsBox {
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 16px;
  padding: 12px 14px;
}
.statsBoxTitle {
  font-weight: 800;
  color: #132a55;
  font-size: 0.9rem;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.pillRow {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.pillWrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 999px;
  padding: 4px 10px;
}
.pillWrap .statusPill {
  transform: translateY(0);
}
.pillCount {
  font-weight: 800;
  color: #132a55;
  font-size: 0.85rem;
}

.topList {
  margin: 0;
  padding-left: 18px;
}
.topList li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px dashed rgba(0, 0, 0, 0.08);
}
.topList li:last-child {
  border-bottom: none;
}
.topKey {
  font-weight: 700;
  color: #1b2c55;
}
.topVal {
  font-weight: 900;
  color: #0e2a68;
}

/* ============================
   Modal Diagnóstico de Leitura
   ============================ */
.modalDialogWide {
  width: min(980px, calc(100vw - 40px));
  max-height: min(86vh, 860px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.modalHeaderSticky {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #eef4ff;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
.modalBodyScroll {
  overflow: auto;
  padding: 14px;
}
.diagSummaryGrid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0 6px;
}
@media (max-width: 760px) {
  .diagSummaryGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.diagMini {
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 14px;
  padding: 10px 12px;
}
.diagMini .k {
  font-size: 0.78rem;
  color: #6c7a92;
  font-weight: 700;
}
.diagMini .v {
  font-size: 1.1rem;
  font-weight: 900;
  color: #132a55;
  margin-top: 2px;
}

.diagGroupTitle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 14px 2px 8px;
  font-weight: 900;
  color: #132a55;
}
.diagFileCard {
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 16px;
  background: #fff;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.diagFileTop {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.diagFileName {
  font-weight: 900;
  color: #152a55;
}
.diagBadges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.diagNote {
  margin-top: 8px;
  color: #2f3d56;
}
.diagReasons {
  margin-top: 10px;
  padding-left: 16px;
  color: #2f3d56;
}
.diagReasons li {
  margin: 4px 0;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.8rem;
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.06);
}
.chipOk {
  background: rgba(46, 204, 113, 0.12);
  border-color: rgba(46, 204, 113, 0.25);
  color: #064726; /* Much darker green for accessibility */
}
.chipBad {
  background: rgba(231, 76, 60, 0.1);
  border-color: rgba(231, 76, 60, 0.22);
  color: #1a0000; /* Much darker red for accessibility */
}
.chipWarn {
  background: rgba(241, 196, 15, 0.14);
  border-color: rgba(241, 196, 15, 0.28);
  color: #6b3d04; /* Much darker orange for accessibility */
}

/* Ajustes novos Estatísticas v2 */
.execValue {
  margin-top: 6px;
  font-size: 1.55rem;
  font-weight: 800;
  color: #132a55;
}
.execMeta {
  font-size: 0.8rem;
  font-weight: 700;
  color: #6c7a92;
  margin-left: 6px;
}
.execEmpty {
  padding: 10px 0;
  color: #6c7a92;
  font-weight: 700;
}
.execGridBottom {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}
@media (max-width: 980px) {
  .execGridBottom {
    grid-template-columns: 1fr;
  }
}
.execPanel {
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 16px;
  padding: 12px 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.03);
}
.execPanelTitle {
  font-weight: 800;
  color: #132a55;
  font-size: 0.9rem;
  margin-bottom: 10px;
}
.rankList {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.rankRow {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px dashed rgba(0, 0, 0, 0.08);
  padding-bottom: 8px;
}
.rankRow:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.rankLeft {
  font-weight: 800;
  color: #132a55;
}
.rankRight {
  font-weight: 900;
  color: #132a55;
}
.deptTableWrap {
  max-height: 300px;
  overflow: auto;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.06);
}
.deptTable {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
.deptTable thead th {
  position: sticky;
  top: 0;
  background: #f3f7ff;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  padding: 10px 12px;
  text-align: left;
  font-size: 0.8rem;
  font-weight: 900;
  color: #132a55;
}
.deptTable tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  font-weight: 700;
  color: #2a3854;
}
.deptTable tbody tr:hover {
  background: rgba(59, 130, 246, 0.06);
}
.deptTable .tNum {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Compact buttons in expander header */
.btn-compact {
  padding: 8px 10px;
  border-radius: 12px;
  font-size: 12.5px;
}
.status-compact {
  min-width: 220px;
}
@media (max-width: 720px) {
  .status-compact {
    min-width: 160px;
  }
}

/* ===========================
   Expander summary (título + ações em linha)
   =========================== */
/* .expander > summary duplicate removed; definition is at line 232 */
/* .summary-left duplicate removed; definition is at line 1801 */
.summary-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap; /* não empilha */
  justify-content: flex-end;
}
.summary-actions .btn,
.summary-actions label,
.summary-actions .mini,
.summary-actions .segmented {
  white-space: nowrap;
}
@media (max-width: 980px) {
  .summary-actions {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
  }
}

/* ===========================
   v8 – header do expander em linha
   =========================== */
.summary-row-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: nowrap;
}
.summary-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.summary-title {
  font-weight: 800;
  white-space: nowrap;
}
.summary-actions-inline {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
  white-space: nowrap;
}
.summary-actions-inline .btn,
.summary-actions-inline .seg-btn,
.summary-actions-inline .switch-text {
  white-space: nowrap;
}
.summary-progress {
  margin-top: 10px;
}

@media (max-width: 980px) {
  .summary-row-inline {
    flex-wrap: wrap;
  }
  .summary-actions-inline {
    flex-wrap: wrap;
    justify-content: flex-start;
  }
}

/* =========================
   Diagnóstico de Leitura — exemplos
   ========================= */
.diagSamples {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed rgba(255, 255, 255, 0.12);
}
.diagSamplesTitle {
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.2px;
  opacity: 0.9;
  margin-bottom: 8px;
}
.diagSamplesList {
  margin: 0;
  padding-left: 16px;
}
.diagSamplesList li {
  margin: 6px 0;
  line-height: 1.25rem;
}
.diagVal {
  opacity: 0.9;
}
.diagTag {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.18);
}
.diagTag.warn {
  background: rgba(255, 196, 0, 0.12);
  border-color: rgba(255, 196, 0, 0.25);
}

/* ===========================
   Totals Card (Somatório por verba)
   =========================== */
.totalsCard {
  margin-top: 10px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
  padding: 10px 12px;
}

/* header/expander */
.totalsTop {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.totalsTopLeft {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.totalsTitle {
  font-weight: 1000;
  font-size: 13px;
  color: #0f172a;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.totalsSub {
  font-size: 12px;
  color: rgba(100, 116, 139, 0.95);
  font-weight: 700;
}

.totalsTopRight {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.totalsLegend {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.legendDot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
  border: 1px solid rgba(15, 23, 42, 0.18);
}
.legendN {
  background: rgba(37, 99, 235, 0.18);
}
.legendU {
  background: rgba(22, 163, 74, 0.18);
}

.totalsCaret {
  width: 28px;
  height: 28px;
  border-radius: 10px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  background: rgba(2, 6, 23, 0.02);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 1000;
  color: #0f172a;
}

.totalsCard.collapsed .totalsCaret {
  transform: rotate(-90deg);
}

.totalsBody {
  margin-top: 10px;
}

.totalsCard.collapsed .totalsBody {
  display: none;
}

.totalsGrid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.totalsRow {
  display: grid;
  grid-template-columns: 64px 1fr 1fr 1fr;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(2, 6, 23, 0.012);
}

.totalsRowHd {
  background: #f8fafc;
  border-style: solid;
  font-weight: 900;
  color: rgba(15, 23, 42, 0.85);
}

.totalsCell {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.totalsVerba {
  font-weight: 1000;
  color: #0f172a;
}

.totalsBadge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 999px;
  font-weight: 1000;
  font-size: 12px;
  border: 1px solid transparent;
}

.totalsBadgeN {
  background: rgba(37, 99, 235, 0.12);
  border-color: rgba(37, 99, 235, 0.28);
  color: #102040; /* Darker blue for better contrast */
}

.totalsBadgeU {
  background: rgba(22, 163, 74, 0.12);
  border-color: rgba(22, 163, 74, 0.28);
  color: #064420; /* Darker green for better contrast */
}

.totalsBadgeD {
  background: rgba(15, 23, 42, 0.06);
  border-color: rgba(15, 23, 42, 0.1);
  color: #101828; /* Solid dark for better contrast */
}

.totalsDiffPos {
  color: #0f6b2d;
}
.totalsDiffNeg {
  color: #b91c1c;
}

/* compact progress text so it doesn't compete with the card */
#progressText {
  font-size: 12px;
  font-weight: 800;
}

/* optional mini done pill (more discreto) */
.miniDonePill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 10px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  background: rgba(2, 6, 23, 0.02);
  font-weight: 900;
  font-size: 11px;
  color: #101828; /* Solid dark for better contrast */
}

@media (max-width: 720px) {
  .totalsRow {
    grid-template-columns: 52px 1fr;
  }
  .totalsRowHd {
    display: none;
  }
}
