/* ════════════════ ABA HISTÓRICO ════════════════ */
.hist-filters {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 18px 14px;
  border-bottom: 1px solid var(--border);
}
.hist-filters .hist-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-items: end;
}
.hist-filters .hist-row > * { min-width: 0; }
.hist-filters .hist-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.hist-filters .hist-field .field-label {
  font-size: .65rem;
  letter-spacing: .06em;
  color: var(--muted);
  font-weight: 700;
}
.hist-filters input[type="date"],
.hist-filters .search-input,
.hist-filters select {
  padding: 8px 10px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  width: 100%;
}
.hist-row-cor-clear {
  align-items: center;
}
.hist-filters .hist-clear {
  padding: 6px 14px;
}
@media (max-width: 560px) {
  .hist-filters .hist-row { grid-template-columns: 1fr; }
  .hist-row-cor-clear { grid-template-columns: 1fr 1fr; }
}
.hist-count { font-weight: 500; font-size: 14px; }

/* ── HIST: toggle Por evento / Por voluntário ────────────── */
.hist-view-toggle {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
  margin: 8px 0 12px;
  gap: 2px;
}
.hist-view-btn {
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.hist-view-btn:hover { color: var(--text); }
.hist-view-btn.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0,0,0,.08);
}

/* Tabela "Por voluntário" — full-width, sortable */
.hist-vol-table-wrap { overflow-x: auto; }
.hist-vol-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.hist-vol-table th,
.hist-vol-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.hist-vol-table tbody tr:last-child td { border-bottom: 0; }
.hist-vol-table tbody tr:hover { background: var(--surface-2); }
.hist-vol-table th {
  background: var(--surface-2);
  font-size: .72rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.hist-vol-table th.is-active { color: var(--accent); }
.hist-vol-table th.num,
.hist-vol-table td.num { text-align: center; font-variant-numeric: tabular-nums; }
.hist-vol-table th:not(.num):not(:first-child),
.hist-vol-table td:not(.num):not(:first-child) { text-align: center; }
.hist-vol-table .pct-ok   { color: #16a34a; font-weight: 700; }
.hist-vol-table .pct-warn { color: #d97706; font-weight: 700; }
.hist-vol-table .pct-bad  { color: #dc2626; font-weight: 700; }
.hist-vol-table .pct-mut  { color: var(--muted); }
.hist-vol-table .vol-name-cell { font-weight: 600; color: var(--text); }
.hist-vol-table .vol-cor-mini {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 999px;
  margin-right: 6px;
  vertical-align: middle;
}
.hist-vol-table .vol-cor-mini.amarelo  { background: #facc15; }
.hist-vol-table .vol-cor-mini.azul     { background: #3b82f6; }
.hist-vol-table .vol-cor-mini.verde    { background: #16a34a; }
.hist-vol-table .vol-cor-mini.vermelho { background: #dc2626; }

/* ── HIST: toolbar de busca colapsável ───────────────────── */
.hist-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.hist-toolbar-search {
  flex: 1;
  min-width: 200px;
  padding: 8px 12px !important; /* sobrescreve .hist-filters .search-input */
}
.hist-filtros-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  position: relative;
}
.hist-filtros-toggle.is-open {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: var(--accent);
}
.hist-filtros-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: .7rem;
  font-weight: 800;
  line-height: 1;
}

.hist-filtros-avancados {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 10px;
  padding: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
}
@media (max-width: 720px) {
  .hist-filtros-avancados { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .hist-filtros-avancados { grid-template-columns: 1fr; }
}

.hist-group {
  margin: 14px 14px 18px;
  padding: 10px 12px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--border-light);
  border-radius: 12px;
}
.hist-group.team-bg-amarelo  { border-left-color: var(--team-amarelo-text);  background: linear-gradient(180deg, rgba(240,192,64,.05), transparent 80%); }
.hist-group.team-bg-azul     { border-left-color: var(--team-azul-text);     background: linear-gradient(180deg, rgba(90,180,255,.05), transparent 80%); }
.hist-group.team-bg-verde    { border-left-color: var(--team-verde-text);    background: linear-gradient(180deg, rgba(52,211,153,.05), transparent 80%); }
.hist-group.team-bg-vermelho { border-left-color: var(--team-vermelho-text); background: linear-gradient(180deg, rgba(224,69,53,.06),  transparent 80%); }
.hist-group.team-bg-geral    { border-left-color: var(--team-geral-text);    background: linear-gradient(180deg, rgba(176,176,192,.06),transparent 80%); }

.hist-group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 4px;
  margin-bottom: 6px;
  font-size: 13px;
}
.hist-group-date { font-weight: 700; color: var(--text); }
.hist-group-title { flex: 1; color: var(--muted); }
.hist-group-count { font-size: 12px; }

.hist-list { display: flex; flex-direction: column; gap: 4px; }
.hist-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.hist-row-main { flex: 1; min-width: 0; }
.hist-row-name { font-weight: 600; font-size: 14px; color: var(--text); }
.hist-row-sub { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; margin-top: 2px; }

.hist-group-audit {
  padding: 6px 10px;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.audit-item { white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
.audit-item strong { color: var(--text); }
.audit-abrir strong  { color: #16a34a; }
.audit-fechar strong { color: var(--warn); }
.audit-when {
  color: var(--text-strong);
  font-weight: 700;
  background: var(--surface);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
  margin-left: 2px;
}

/* ── HIST: comparativo de equipes ────────────────────────── */
.cmp-card {
  margin: 0 14px 14px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.cmp-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  gap: 10px;
  flex-wrap: wrap;
}
.cmp-card-title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
  color: var(--text-strong);
}
.cmp-window-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .82rem;
  color: var(--muted);
}
.cmp-window-field select { min-width: 160px; }

.cmp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}
.cmp-table th {
  text-align: center;
  padding: 8px 6px;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 2px solid var(--border);
  cursor: help;
}
.cmp-table th:first-child { text-align: left; padding-left: 4px; }
.cmp-table td {
  padding: 10px 6px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.cmp-table tr:last-child td { border-bottom: none; }
.cmp-cor { padding-left: 4px; }
.cmp-num { text-align: center; font-variant-numeric: tabular-nums; font-weight: 600; }
.cmp-num-warn { color: var(--warn, #ef4444); }
.cmp-num-mut  { color: var(--muted); }
.cmp-num-accent { color: var(--accent); }

/* Chip de engajamento na lista de voluntários (só pra gestão) */
.vol-eng-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: .76rem;
  font-weight: 600;
  cursor: help;
  white-space: nowrap;
  border: 1px solid transparent;
}
.vol-eng-chip strong { font-weight: 800; font-size: .82rem; }
.vol-eng-frac { color: inherit; opacity: .75; font-weight: 500; }
.vol-eng-chip.eng-ok    { background: rgba(22,163,74,.12);  color: #16a34a; border-color: rgba(22,163,74,.25); }
.vol-eng-chip.eng-warn  { background: rgba(245,158,11,.12); color: #f59e0b; border-color: rgba(245,158,11,.25); }
.vol-eng-chip.eng-bad   { background: rgba(239,68,68,.12);  color: #ef4444; border-color: rgba(239,68,68,.25); }
.vol-eng-chip.eng-empty { background: var(--surface-2); color: var(--muted); border-color: var(--border); padding: 4px 12px; }
.cmp-pct { font-weight: 800; }
.cmp-pct-ok   { color: #16a34a; }
.cmp-pct-warn { color: #f59e0b; }
.cmp-pct-bad  { color: var(--warn, #ef4444); }
.cmp-row.team-bg-amarelo  { background: linear-gradient(90deg, rgba(240,192,64,.06),  transparent 50%); }
.cmp-row.team-bg-azul     { background: linear-gradient(90deg, rgba(90,180,255,.06),  transparent 50%); }
.cmp-row.team-bg-verde    { background: linear-gradient(90deg, rgba(52,211,153,.06),  transparent 50%); }
.cmp-row.team-bg-vermelho { background: linear-gradient(90deg, rgba(224,69,53,.07),   transparent 50%); }
.cmp-footer {
  font-size: .76rem;
  margin: 10px 0 0;
}

/* ── HIST: cards colapsáveis ────────────────────────────── */
.hist-card {
  margin: 12px 14px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--border-light);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color .15s;
}
.hist-card.team-bg-amarelo  { border-left-color: var(--team-amarelo-text);  background: linear-gradient(180deg, rgba(240,192,64,.04), transparent 70%); }
.hist-card.team-bg-azul     { border-left-color: var(--team-azul-text);     background: linear-gradient(180deg, rgba(90,180,255,.04), transparent 70%); }
.hist-card.team-bg-verde    { border-left-color: var(--team-verde-text);    background: linear-gradient(180deg, rgba(52,211,153,.04), transparent 70%); }
.hist-card.team-bg-vermelho { border-left-color: var(--team-vermelho-text); background: linear-gradient(180deg, rgba(224,69,53,.05),  transparent 70%); }
.hist-card.team-bg-geral    { border-left-color: var(--team-geral-text);    background: linear-gradient(180deg, rgba(176,176,192,.05),transparent 70%); }
.hist-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  background: transparent;
  border: none;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: background .15s;
}
.hist-card-header:hover { background: var(--surface-2); }
.hist-card-date { font-weight: 700; color: var(--text-strong); font-size: .92rem; min-width: 70px; }
.hist-card-title { flex: 1; color: var(--muted); font-size: .92rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-card-count { font-size: .82rem; color: var(--muted); white-space: nowrap; }
.hist-card-count em { color: var(--accent); font-style: normal; }
.hist-card-chev { font-size: .85rem; color: var(--muted); margin-left: 4px; }

.hist-card-body {
  padding: 4px 14px 14px;
  border-top: 1px solid var(--border);
  background: rgba(0,0,0,.02);
}

.hist-section { margin-top: 12px; }
.hist-section-title {
  font-size: .76rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin: 0 0 8px;
}
.hist-milestones {
  list-style: none;
  padding: 0;
  margin: 0 0 8px;
  font-size: .85rem;
}
.hist-milestone {
  padding: 4px 0;
  border-bottom: 1px dashed var(--border);
}
.hist-milestone:last-child { border-bottom: none; }
.hist-milestone strong { color: var(--text-strong); font-weight: 600; }
.hist-summary {
  font-size: .8rem;
  margin: 8px 0 0;
  padding: 6px 10px;
  background: var(--surface-2);
  border-radius: var(--r-sm);
  display: inline-block;
}

/* ── Histórico do evento — grid 2 colunas ────────────────── */
.hist-timeline {
  list-style: none;
  padding: 0;
  margin: 4px 0 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
@media (max-width: 560px) {
  .hist-timeline { grid-template-columns: 1fr; }
}
.hist-tl-item {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  border-left-width: 3px;
}
.hist-tl-item.m-create { border-left-color: #16a34a; }
.hist-tl-item.m-open   { border-left-color: #3b82f6; }
.hist-tl-item.m-close  { border-left-color: #f59e0b; }
.hist-tl-item.m-save   { border-left-color: var(--accent); }
.hist-tl-item.m-undo   { border-left-color: #a78bfa; }

.hist-tl-dot {
  flex-shrink: 0;
  width: 28px; height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 14px;
  line-height: 1;
}
.hist-tl-item.m-create .hist-tl-dot { border-color: #16a34a; background: rgba(22,163,74,.10); }
.hist-tl-item.m-open   .hist-tl-dot { border-color: #3b82f6; background: rgba(59,130,246,.10); }
.hist-tl-item.m-close  .hist-tl-dot { border-color: #f59e0b; background: rgba(245,158,11,.10); }
.hist-tl-item.m-save   .hist-tl-dot { border-color: var(--accent); background: var(--accent-dim); }
.hist-tl-item.m-undo   .hist-tl-dot { border-color: #a78bfa; background: rgba(167,139,250,.10); }

.hist-tl-body { min-width: 0; }
.hist-tl-title {
  font-weight: 700;
  color: var(--text-strong);
  font-size: .9rem;
  line-height: 1.2;
}
.hist-tl-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 3px;
  font-size: .76rem;
  color: var(--muted);
  align-items: baseline;
}
.hist-tl-actor { color: var(--text); font-weight: 600; }
.hist-tl-time  { font-variant-numeric: tabular-nums; }
.hist-tl-delta { font-style: italic; opacity: .7; }

.hist-tl-totals {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.hist-tl-pill {
  padding: 4px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: .76rem;
  color: var(--muted);
}
.hist-tl-pill strong { color: var(--text-strong); font-weight: 800; margin-right: 3px; }
.hist-tl-pill.m-manual { background: var(--accent-dim); border-color: rgba(224,69,53,.3); }
.hist-tl-pill.m-manual strong { color: var(--accent); }

/* Tabela compacta de Presentes — sem cor da equipe (já tá no header do card) */
.hist-tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}
.hist-tbl-th {
  text-align: left;
  padding: 8px 10px;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  border-bottom: 2px solid var(--border);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.hist-tbl-th:hover { color: var(--text-strong); }
.hist-tbl-th.is-active { color: var(--accent); }
.hist-tbl-num { text-align: right; }
.hist-tbl tbody td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
.hist-tbl tbody tr:last-child td { border-bottom: none; }
.hist-tbl tbody tr:hover { background: var(--surface-2); }
.hist-tbl-nome { font-weight: 600; color: var(--text-strong); }
.hist-origem {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.origem-manual {
  background: rgba(245,158,11,.15);
  color: #f59e0b;
}
.origem-auto {
  background: var(--surface-2);
  color: var(--muted);
}


/* ── Modal "Ver escala" ─────────────────────────────────────── */
.esc-culto { margin-bottom: 18px; }
.esc-culto-title {
  margin: 0 0 10px;
  font-size: 1rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
}
.esc-turno {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
}
.esc-turno-title {
  margin: 0 0 8px;
  font-size: .82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-strong, var(--text));
}
.esc-zona {
  margin-bottom: 8px;
}
.esc-zona:last-child { margin-bottom: 0; }
.esc-zona-name {
  display: block;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  margin-bottom: 4px;
}
.esc-pontos {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}
.esc-pontos li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: .88rem;
  padding: 3px 0;
}
.esc-pnum {
  display: inline-block;
  min-width: 32px;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.esc-apoio {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-top: 10px;
}

/* ── Linha clicável da tabela Por Voluntário → prontuário ──── */
.hist-vol-row { cursor: pointer; }
.hist-vol-row:hover { background: var(--surface-2); }

/* Resumo em pills no topo do modal Prontuário. As pills e a lista de
   eventos reusam .freq-pill / .freq-detail-* — só o wrapper é novo. */
.pront-resumo {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 14px;
}
