/* ── Painel de filtros (sidebar) ────────────────────────────────────────── */
.filter-sidebar {
  background: #031A0E;
  border-right: 1px solid var(--border);
  padding: 18px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow-y: auto;
}
.filter-brand {
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.filter-brand .wordmark {
  display: block;
  font-family: "Albert Sans", var(--font-sans);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}
.filter-brand .wordmark span { color: var(--mint); }
.filter-brand .tool-name {
  display: block;
  margin-top: 3px;
  font-size: 10px;
  color: var(--text-subtle);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.filter-section { margin-bottom: 14px; }
.filter-section-label {
  font-size: 10px;
  color: var(--text-subtle);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 7px;
}

/* Botões de ano */
.year-group { display: flex; gap: 4px; flex-wrap: wrap; }
.period-btn {
  padding: 4px 7px;
  font-size: 11px;
  font-weight: 600;
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  border-radius: 4px;
  cursor: pointer;
  letter-spacing: 0;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
}
.period-btn:hover { background: var(--surface-hover); color: var(--text); }
.period-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

/* Grid de meses */
.month-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; }

/* De-Até */
.deate-row { display: flex; align-items: center; gap: 8px; }
.deate-row input {
  width: 52px;
  padding: 5px 7px;
  font-size: 12px;
  font-family: inherit;
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  text-align: center;
}
.deate-row input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.deate-sep { color: var(--text-subtle); font-size: 11px; }

/* Selects e inputs de filtro */
.filter-select, .filter-input {
  width: 100%;
  padding: 6px 8px;
  font-size: 12px;
  font-family: inherit;
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}
.filter-select:focus, .filter-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.filter-select-wrap { position: relative; }
.filter-select-wrap::after {
  content: '▾';
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-subtle);
  font-size: 10px;
  pointer-events: none;
}
.filter-input::placeholder { color: var(--text-subtle); }

.filter-footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.filter-footer .user-line { padding: 0 2px; }
.filter-footer strong { color: var(--text); font-weight: 500; }

/* ── Tabela ─────────────────────────────────────────────────────────────── */
.table-wrap {
  flex: 1;
  overflow-y: auto;
  overflow-x: auto;
  min-height: 0;
}
.table-wrap table {
  border-radius: 0;
  border: none;
  border-top: none;
  min-width: 900px;
}
.table-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}
.table-wrap thead th.th-sort {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.table-wrap thead th.th-sort:hover { color: var(--text); }
.sort-arrow { font-size: 9px; color: var(--mint); }
.table-wrap td, .table-wrap th {
  padding: 10px 13px;
}
td.td-req   { white-space: nowrap; font-weight: 600; font-variant-numeric: tabular-nums; }
td.td-data  { white-space: nowrap; color: var(--text-muted); font-variant-numeric: tabular-nums; }
td.td-cod   { white-space: nowrap; font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
td.td-desc  { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
td.td-und   { white-space: nowrap; text-align: center; color: var(--text-muted); font-size: 12px; }
td.td-qtd   { white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
td.td-custo { white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.custo-zero { color: var(--danger); font-weight: 700; }
tr.row-bloqueada { opacity: 0.6; }
tr.row-bloqueada td.td-custo { opacity: 1; }
td.td-user  { white-space: nowrap; font-size: 12px; color: var(--text-muted); }
td.td-hist  { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--text-muted); }

/* Status badge */
.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
  border: 1px solid;
}
.status-faturar {
  background: rgba(201, 168, 117, 0.14);
  color: var(--accent);
  border-color: rgba(201, 168, 117, 0.3);
}
.status-faturado {
  background: rgba(127, 185, 140, 0.14);
  color: #7fb98c;
  border-color: rgba(127, 185, 140, 0.3);
}
.status-outro {
  background: var(--surface-hover);
  color: var(--text-muted);
  border-color: var(--border);
}

/* Zebra por grupo de requisição */
tr.req-alt { background: rgba(255,255,255,0.025); }
tr.req-alt:hover { background: var(--surface-hover); }

/* Estado vazio / loading / erro dentro da tabela */
.state-row td {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  font-size: 13px;
  border-bottom: none;
}
.state-row.error-row td { color: var(--danger); }

/* ── Modal de confirmação da baixa ──────────────────────────────────────── */
.rec-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.rec-modal {
  width: 100%;
  max-width: 640px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}
.rec-modal-head {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.rec-modal-head h2 { font-size: 16px; font-weight: 700; color: var(--text); margin: 0; }
.rec-modal-x {
  margin-left: auto;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}
.rec-modal-x:hover { color: var(--text); }

.rec-modal-body { padding: 8px 20px; overflow-y: auto; }
.rec-modal-group { margin: 12px 0; }
.rec-modal-group-head {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.rec-modal-group-sub { font-weight: 400; color: var(--text-subtle); font-size: 11px; }

.rec-modal-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
}
.rec-modal-item { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rec-modal-cod { font-size: 11px; color: var(--text-subtle); font-variant-numeric: tabular-nums; }
.rec-modal-desc {
  font-size: 13px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rec-modal-saldo {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.rec-modal-qtd {
  width: 92px;
  padding: 5px 8px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.rec-modal-rm {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  border-radius: 4px;
  width: 26px;
  height: 26px;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}
.rec-modal-rm:hover { color: var(--danger); border-color: var(--danger); }

.rec-modal-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
}
.rec-modal-info { font-size: 12px; color: var(--text-muted); }
.rec-modal-info.rec-modal-err { color: var(--danger); }
.rec-modal-foot .rec-spacer { flex: 1; }
.rec-modal-ok:disabled { opacity: 0.5; cursor: not-allowed; }
