/*
 * Complementos do painel. No portal-crcro a base de .form-control e da
 * paginação vem do AdminLTE/Bootstrap; aqui não carregamos nenhum dos dois,
 * então o mínimo necessário fica neste arquivo. Cores e bordas continuam
 * vindo de admin_redesign.css.
 */

.form-control { display: block; width: 100%; padding: 9px 12px; border: 1px solid; font: inherit; font-size: 13px; }
.form-control:focus { outline: none; }

.pagination { display: flex; gap: 4px; list-style: none; padding: 0; margin: 16px 0 0; }
.pagination .page-link { display: block; padding: 6px 11px; border: 1px solid; border-radius: 8px; font-size: 12px; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.row-errors { margin: 6px 0 0; padding-left: 16px; font-size: 12px; color: var(--color-error); }
.field-error { color: var(--color-error); }
.ds-alert-info { background: var(--color-info-bg); border: 1px solid var(--color-info-border); color: var(--color-info); }

.row-details { margin: 6px 0 0; padding-left: 16px; font-size: 11.5px; color: var(--text-soft); }
.inline-form { display: inline-block; margin-left: 8px; }

.progress-row { display: grid; grid-template-columns: 160px 1fr 110px; gap: 12px; align-items: center; margin-bottom: 12px; font-size: 13px; }
.progress { height: 10px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress-bar { height: 100%; background: var(--crcro-navy-light); transition: width .4s; }
.progress-bar-success { background: var(--color-success); }

.submit-panel { border-top: 3px solid var(--crcro-gold); }
.declaration { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; line-height: 1.5; padding: 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-inset); }
.declaration input { margin-top: 3px; }

.detail-list { display: grid; grid-template-columns: 160px 1fr; gap: 8px 16px; margin: 0; font-size: 13px; }
.detail-list dt { color: var(--text-muted); font-weight: 600; }
.detail-list dd { margin: 0; }
.json-block { background: var(--surface-inset); border: 1px solid var(--border); border-radius: 9px; padding: 14px; font-size: 12px; overflow-x: auto; margin: 0; }

a.stat-card { display: block; color: inherit; transition: border-color .15s; }
a.stat-card:hover { border-color: var(--crcro-navy-light); text-decoration: none; }

/* ── Gráficos do painel ──────────────────────────────────────────────────────
 * Rampa ordinal de um tom só, validada com scripts/validate_palette.js
 * (--ordinal, superfície #f8fbff): monotonia, ΔL >= 0.06 entre passos, extremo
 * claro em 2,05:1 e desvio de matiz de 7°. Os passos 4 e 5 são os próprios
 * tokens --crcro-navy-light e --crcro-navy. Não altere um passo isolado sem
 * rodar o validador de novo.
 */
.dash-charts {
  --viz-step-1: #8fb4e8;
  --viz-step-2: #5f8fd6;
  --viz-step-3: #3b6ebd;
  --viz-step-4: #2a5494;
  --viz-step-5: #1f3f70;
  --viz-step-6: #102841;
  --viz-line: #2a5494;
  --viz-surface: var(--surface-2);
  --viz-grid: var(--border);
  --viz-ink: var(--text-muted);

  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 18px;
}

/* Altura inclui a faixa dos rótulos do eixo: fixar só o plot cria uma barra de
 * rolagem minúscula dentro do cartão. */
.chart-wrap { position: relative; height: 260px; }

.chart-empty { color: var(--text-soft); font-size: 13px; margin: 0; padding: 28px 0; text-align: center; }

/* Tabela equivalente ao gráfico: todo valor continua alcançável sem hover. */
.chart-table { margin-top: 14px; font-size: 12.5px; }
.chart-table summary { cursor: pointer; color: var(--text-muted); font-size: 12px; }
.chart-table summary:hover { color: var(--text); }
.chart-table table { margin-top: 10px; }
.chart-table td:last-child, .chart-table th:last-child { text-align: right; font-variant-numeric: tabular-nums; }

.credit-query-form { margin-top: 12px; }
th[scope="row"] { text-align: left; width: 38%; color: var(--text-muted); font-weight: 600; }

.access-request-done { text-align: center; }
.access-request-icon { width: 64px; height: 64px; margin: 0 auto 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: rgba(196,154,42,.12); border: 2px solid rgba(196,154,42,.3); color: #c49a2a; font-size: 28px; }

.pending-requests { border-top: 3px solid var(--color-warning); }
.inline-approve { display: inline-flex; gap: 6px; align-items: center; }

/* ── Auditoria: cartões por dia, antes → depois sempre alinhados ── */
.audit-intro { margin: 0 0 16px; font-size: 13.5px; color: var(--text); line-height: 1.55; }
.audit-intro .form-hint { display: block; }

.audit-filters { display: flex; flex-wrap: wrap; gap: 12px 14px; align-items: flex-end; margin-bottom: 20px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 13px; padding: 14px 16px; }
.audit-filter { display: flex; flex-direction: column; gap: 5px; min-width: 150px; }
.audit-filter label { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.audit-filter .input { min-width: 150px; }
.audit-filter-actions { flex-direction: row; align-items: center; gap: 8px; min-width: 0; }

.audit-day { margin: 22px 0 10px; font-size: 13px; font-weight: 700; color: var(--text-muted); }
.audit-day:first-of-type { margin-top: 4px; }

.audit-entry { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 18px; margin-bottom: 10px; }
.audit-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.audit-head .badge { font-size: 11.5px; font-weight: 700; padding: 3px 10px; border-radius: 99px; }
.audit-title { font-size: 14.5px; font-weight: 700; color: var(--text-strong); }
.audit-title:hover { text-decoration: underline; }
.audit-module { font-size: 12px; color: var(--text-muted); background: var(--surface-3); padding: 2px 9px; border-radius: 99px; }
.audit-meta { margin-left: auto; font-size: 12.5px; color: var(--text-muted); white-space: nowrap; }

.audit-diff { display: grid; grid-template-columns: minmax(150px, 220px) minmax(0, 280px) 18px minmax(0, 1fr);
  gap: 7px 14px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 13.5px; line-height: 1.45; }
.audit-diff.is-single { grid-template-columns: minmax(150px, 220px) minmax(0, 1fr); }
.audit-field { color: var(--text-muted); }
.audit-before { color: var(--color-error); text-decoration: line-through; text-decoration-thickness: 1px; overflow-wrap: anywhere; }
.audit-after { color: var(--color-success); font-weight: 600; overflow-wrap: anywhere; }
.audit-value { color: var(--text); overflow-wrap: anywhere; }
.audit-value.is-removed { color: var(--color-error); }
.audit-arrow { color: var(--text-soft); text-align: center; }
.audit-empty { margin: 10px 0 0; font-size: 13px; color: var(--text-muted); }

.audit-more { margin-top: 6px; }
.audit-more > summary { cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--crcro-navy-light); margin-top: 8px; }
.audit-more .audit-diff { border-top: none; margin-top: 6px; padding-top: 0; }

@media (max-width: 760px) {
  .audit-meta { margin-left: 0; width: 100%; }
  .audit-diff, .audit-diff.is-single { grid-template-columns: 1fr; gap: 2px; }
  .audit-field { margin-top: 8px; font-weight: 600; }
  .audit-arrow { display: none; }
}

/* Devolução do lote: formulário recolhido, para não competir com "Validar e enviar". */
.return-batch { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 12px; }
.return-batch > summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--color-error); }
.return-batch form { margin-top: 10px; }
