/* Painel de auditoria (js/dashboard/dashboard-auditoria.js)
   Ocupa a área de conteúdo da seção Auditoria; o chat é o painel lateral
   (js/dashboard/section-chat.js). O tema escuro segue o toggle do SophIA (body.dark-theme). */

/* O painel é quem rola; a área de conteúdo fica fixa. */
.chat-wrapper.with-section-dash {
  align-items: stretch;
  padding: 0;
  overflow: hidden;
}

.da {
  --da-bg: #f4f5f7;
  --da-card: #ffffff;
  --da-border: #dde1e6;
  --da-line: #eef0f2;
  --da-text: #1f2328;
  --da-text-2: #3a424a;
  --da-muted: #59636e;
  --da-input-border: #c9ced4;
  --da-track: #f1f3f5;
  --da-link: #1f5fbf;
  --da-link-hover: #174a94;
  --da-alert: #a0111f;
  --da-pill-crit-bg: #fde2e1;
  --da-pill-crit: #a0111f;
  --da-pill-aten-bg: #fdf0da;
  --da-pill-aten: #7a5200;
  --da-pill-ok-bg: #dcf3e6;
  --da-pill-ok: #1a5e36;
  --da-heat-0: #f4f5f7;
  --da-heat-1: #fdf0da;
  --da-heat-2: #f9d9b8;
  --da-heat-3: #f3b48c;
  --da-heat-4: #ee9466;
  --da-heat-text: #1f2328;
  --da-in: #1fae6e;
  --da-out: #e8613a;

  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  width: 100%;
  box-sizing: border-box;
  background: var(--da-bg);
  color: var(--da-text);
  padding: 12px 16px 84px; /* folga embaixo para o botão flutuante não cobrir o fim da página */
  font-size: 13px;
  line-height: 1.35;
}

body.dark-theme .da {
  --da-bg: #0f1114;
  --da-card: #181b20;
  --da-border: #2a2f36;
  --da-line: #22272e;
  --da-text: #e6e8eb;
  --da-text-2: #c3c8ce;
  --da-muted: #8b949e;
  --da-input-border: #3a4048;
  --da-track: #262b31;
  --da-link: #6ea8fe;
  --da-link-hover: #9cc3ff;
  --da-alert: #ff8a8f;
  --da-pill-crit-bg: rgba(209, 36, 47, 0.2);
  --da-pill-crit: #ff9a9f;
  --da-pill-aten-bg: rgba(232, 163, 58, 0.2);
  --da-pill-aten: #f0c27a;
  --da-pill-ok-bg: rgba(31, 174, 110, 0.2);
  --da-pill-ok: #6fd6a4;
  --da-heat-0: #22272e;
  --da-heat-1: #3a2f1f;
  --da-heat-2: #5a3a22;
  --da-heat-3: #7d4427;
  --da-heat-4: #a24e2b;
  --da-heat-text: #f1f3f5;
}

.da *,
.da *::before,
.da *::after {
  box-sizing: border-box;
}

.da-inner {
  max-width: 1560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ---------- Cabeçalho ---------- */
.da-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--da-border);
}

.da-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.da-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.da-title {
  margin: 0;
  font-size: 19px;
  font-weight: 500;
  color: var(--da-text);
}

.da-badge-sample {
  padding: 1px 8px;
  border-radius: 999px;
  background: #fff4d6;
  color: #7a5200;
  font-size: 11px;
  font-weight: 600;
}

.da-subtitle,
.da-updated,
.da-auto,
.da-period,
.da-field {
  font-size: 12px;
  color: var(--da-muted);
  gap: 3px;
}

.da-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.da-updated {
  display: flex;
  align-items: center;
  gap: 8px;
}

.da-dot {
  width: 10px;
  height: 10px;
  border-radius: 5px;
  background: #1a7f37;
}

.da-auto {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  cursor: pointer;
}

.da-auto input {
  width: 14px;
  height: 14px;
  accent-color: #1f5fbf;
}

.da-btn {
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid var(--da-input-border);
  border-radius: 4px;
  background: var(--da-card);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--da-text);
  cursor: pointer;
}

.da-btn:hover {
  border-color: var(--da-muted);
}

/* ---------- Filtros ---------- */
.da-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 10px;
}

.da-filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.da-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.da-select {
  width: 160px;
  max-width: 100%;
  min-height: 30px;
  padding: 0 8px;
  border: 1px solid var(--da-input-border);
  border-radius: 4px;
  background: var(--da-card);
  font: inherit;
  font-size: 13px;
  color: var(--da-text);
}

.da-period {
  text-align: right;
  line-height: 1.5;
}

/* Indicadores: 8 numa linha quando há espaço, senão 4 + 4 (ou 2 colunas no celular). */
.da-inner {
  container-type: inline-size;
}

@container (min-width: 1240px) {
  .da-kpis {
    grid-template-columns: repeat(8, minmax(0, 1fr));
  }
}

@container (max-width: 560px) {
  .da-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ---------- Cards ---------- */
.da-card {
  background: var(--da-card);
  border: 1px solid var(--da-border);
  border-radius: 6px;
}

.da-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

/* Repetida DEPOIS da regra base: a versão acima (linha ~245) perdia para o
   repeat(4) por vir antes na cascata, deixando 4 colunas apertadas no celular. */
@container (max-width: 560px) {
  .da-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.da-kpi {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.da-kpi-label {
  font-size: 12px;
  color: var(--da-text-2);
}

.da-kpi-value {
  font-size: 22px;
  font-weight: 500;
  line-height: 1.1;
}

.da-kpi-sub {
  font-size: 11px;
  color: var(--da-muted);
}

.da-kpi-sub.is-alert {
  color: var(--da-alert);
  font-weight: 600;
}

.da-kpi-rest {
  color: var(--da-muted);
  font-weight: 400;
}

.da-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.da-row > .da-panel,
.da-row > .da-col {
  flex: 1 1 320px;
  min-width: 0;
}

.da-row > .da-grow-2 {
  flex: 2 1 560px;
}

.da-row-even > .da-panel {
  flex: 1 1 380px;
}

.da-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.da-panel {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.da-panel-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.da-panel-head.da-center-items {
  align-items: center;
  gap: 12px;
}

.da-h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--da-text);
}

.da-note {
  font-size: 11px;
  color: var(--da-muted);
}

.da-insight {
  margin: 0;
  font-size: 12px;
  color: var(--da-text-2);
}

.da-foot {
  margin: 0;
  font-size: 11px;
  color: var(--da-muted);
}

.da-muted {
  color: var(--da-muted);
}

.da-right {
  text-align: right;
}

.da-center {
  text-align: center;
}

.da-left {
  text-align: left;
}

.da-strong {
  font-weight: 700;
}

.da-empty {
  padding: 18px 8px !important;
  text-align: center;
  color: var(--da-muted);
}

.da-scroll {
  overflow-x: auto;
}

/* ---------- Pílulas de situação ---------- */
.da-pill {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.da-pill-crit {
  background: var(--da-pill-crit-bg);
  color: var(--da-pill-crit);
}

.da-pill-aten {
  background: var(--da-pill-aten-bg);
  color: var(--da-pill-aten);
}

.da-pill-ok {
  background: var(--da-pill-ok-bg);
  color: var(--da-pill-ok);
}

/* ---------- Tabelas ---------- */
.da-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.da-table-verif {
  min-width: 520px;
}

.da-table-criticas {
  min-width: 760px;
}

.da-table th {
  padding: 5px 6px;
  border-bottom: 1px solid var(--da-border);
  font-size: 12px;
  font-weight: 600;
  color: var(--da-muted);
  text-align: left;
}

.da-table th.da-right {
  text-align: right;
}

.da-table td {
  padding: 5px 6px;
  border-bottom: 1px solid var(--da-line);
}

.da-table-criticas td {
  padding: 6px;
}

.da-table tbody tr:last-child td {
  border-bottom: none;
}

.da-occ {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.da-occ-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: #d1242f;
  flex-shrink: 0;
}

/* ---------- Rosca ---------- */
.da-donut-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}

.da-svg-muted {
  fill: var(--da-muted);
}

.da-svg-text {
  fill: var(--da-text);
}

.da-legend {
  flex: 1 1 140px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.da-legend-row {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) 26px 46px;
  gap: 8px;
  align-items: center;
}

.da-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 2px;
}

.da-sw-sm {
  width: 10px;
  height: 10px;
}

.da-swatch.is-in,
.da-vbar-fill.is-in {
  background: var(--da-in);
}

.da-swatch.is-out,
.da-vbar-fill.is-out {
  background: var(--da-out);
}

/* ---------- Configurações ---------- */
.da-config-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  border-bottom: 1px solid var(--da-line);
}

.da-config-row:last-child {
  border-bottom: none;
}

/* ---------- Mapa de calor ---------- */
.da-table-heat {
  width: 100%;
  min-width: 560px;
  border-collapse: separate;
  border-spacing: 3px;
  font-size: 13px;
}

.da-table-heat th {
  padding: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--da-muted);
  text-align: center;
}

.da-table-heat th.da-left {
  text-align: left;
}

.da-table-heat th.da-right {
  text-align: right;
}

.da-table-heat td {
  padding: 4px 6px;
}

.da-heat {
  text-align: center;
  border-radius: 3px;
  color: var(--da-heat-text);
}

.da-heat-0 {
  background: var(--da-heat-0);
  color: var(--da-muted);
}

.da-heat-1 {
  background: var(--da-heat-1);
}

.da-heat-2 {
  background: var(--da-heat-2);
}

.da-heat-3 {
  background: var(--da-heat-3);
}

.da-heat-4 {
  background: var(--da-heat-4);
}

.da-tag {
  font-size: 10px;
  color: var(--da-muted);
}

.da-heat-total td {
  color: var(--da-text-2);
  font-weight: 600;
  border-top: 1px solid var(--da-border);
}

/* ---------- Barras horizontais ---------- */
.da-hbars {
  display: flex;
  flex-direction: column;
}

.da-hbar-row {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr) 86px;
  gap: 8px;
  align-items: center;
  min-height: 30px;
  border-bottom: 1px solid var(--da-line);
}

.da-hbar-row:last-child {
  border-bottom: none;
}

.da-hbar-row.da-hbar-sm {
  grid-template-columns: 90px minmax(0, 1fr) 40px;
  gap: 8px;
  min-height: 26px;
  border-bottom: none;
}

.da-hbar-label {
  font-size: 12px;
  color: var(--da-text-2);
  text-align: right;
  line-height: 1.2;
}

.da-sigla {
  font-size: 10px;
  color: var(--da-muted);
}

.da-hbar-value {
  font-size: 12px;
  text-align: right;
}

.da-hbar-sm .da-hbar-value {
  font-size: 12px;
}

.da-track {
  height: 14px;
  background: var(--da-track);
  border-radius: 3px;
  overflow: hidden;
}

.da-hbar-sm .da-track {
  height: 12px;
}

.da-fill {
  height: 100%;
}

/* ---------- Barras verticais ---------- */
.da-legend-inline {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: var(--da-text-2);
}

.da-legend-inline > span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.da-vbars {
  display: grid;
  gap: 16px;
  align-items: end;
  height: 120px;
  border-bottom: 1px solid var(--da-input-border);
  padding: 0 8px;
}

.da-vbar-group {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 6px;
  height: 100%;
}

.da-vbar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.da-vbar-num {
  font-size: 11px;
  font-weight: 600;
}

.da-vbar-fill {
  display: block;
  width: 22px;
  border-radius: 3px 3px 0 0;
}

.da-vbar-labels {
  display: grid;
  gap: 16px;
  padding: 0 8px;
  margin-top: -4px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--da-muted);
}

/* ---------- Busca e link ---------- */
.da-search {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--da-input-border);
  border-radius: 4px;
  background: var(--da-card);
  width: 240px;
  max-width: 100%;
  color: var(--da-muted);
}

.da-search input {
  border: none;
  outline: none;
  font: inherit;
  font-size: 13px;
  width: 100%;
  background: transparent;
  color: var(--da-text);
}

.da-link {
  font-size: 12px;
  align-self: flex-start;
  color: var(--da-link);
}

.da-link:hover {
  color: var(--da-link-hover);
}

/* ---------- Telas pequenas ---------- */
@media (max-width: 767px) {
  .da {
    padding: 12px 12px 20px;
  }

  .da-title {
    font-size: 21px;
  }

  .da-period {
    text-align: left;
  }

  .da-select {
    width: 100%;
  }

  .da-field {
    flex: 1 1 140px;
  }

  .da-row > .da-panel,
  .da-row > .da-col,
  .da-row > .da-grow-2,
  .da-row-even > .da-panel {
    flex-basis: 100%;
  }

  .da-panel {
    padding: 16px;
  }

  .da-hbar-row {
    grid-template-columns: 96px minmax(0, 1fr) 84px;
  }
}

/* O botão de tema fica fixo no canto superior direito (desktop): reserva o espaço dele no cabeçalho
   para não cobrir os botões das ações (Atualizar, Nova conversa etc.). */
@media (min-width: 768px) {
  .da-header .da-actions {
    margin-right: 52px;
  }
}

/* Painel de auditoria com dados reais (js/dashboard/dashboard-auditoria.js): estados de carga, erro e
   blocos sem dados. Escopado a .da-aud para não afetar os demais painéis. */
.da-aud .da-dot.is-error {
  background: #d1242f;
}

.da-aud.is-loading .da-inner {
  opacity: 0.6;
  transition: opacity 0.15s;
}

.da-aud .da-aud-erro {
  padding: 12px 14px;
  border: 1px solid #d1242f;
  border-radius: 6px;
  background: var(--da-card);
  color: var(--da-alert);
  font-size: 13px;
}

.da-aud .da-aud-vazio {
  margin: 0;
}

.da-aud .da-aud-data {
  width: 140px;
}

.da-aud .da-aud-pill-na {
  background: var(--da-track);
  color: var(--da-muted);
}

/* ---------- Botão "Ver" do card e modal de Movimentações apagadas (painel de Auditoria) ---------- */
/* Botão "Ver": na mesma linha do texto de apoio do card, à direita. */
.da-aud-kpi-linha {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.da-aud-ver {
  flex: none;
  padding: 1px 10px;
  border: 1px solid var(--da-link);
  border-radius: 4px;
  background: transparent;
  color: var(--da-link);
  font: inherit;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.5;
  cursor: pointer;
}

.da-aud-ver:hover {
  background: var(--da-link);
  color: #fff;
}

.da-aud-ver:focus-visible {
  outline: 2px solid var(--da-link);
  outline-offset: 2px;
}

/* O modal fica no <body> (fora do .da): redefine as variáveis de cor que ele usa. */
.da-aud-modal {
  --da-card: #ffffff;
  --da-border: #dde1e6;
  --da-line: #eef0f2;
  --da-text: #1f2328;
  --da-text-2: #3a424a;
  --da-muted: #59636e;
  --da-input-border: #c9ced4;
  --da-link: #1f5fbf;
  --da-alert: #a0111f;

  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(8, 20, 34, 0.55);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.35;
}

body.dark-theme .da-aud-modal {
  --da-card: #181b20;
  --da-border: #2a2f36;
  --da-line: #22272e;
  --da-text: #e6e8eb;
  --da-text-2: #c3c8ce;
  --da-muted: #8b949e;
  --da-input-border: #3a4048;
  --da-link: #6ea8fe;
  --da-alert: #ff8a8f;
}

.da-aud-modal *,
.da-aud-modal *::before,
.da-aud-modal *::after {
  box-sizing: border-box;
}

.da-aud-modal-box {
  display: flex;
  flex-direction: column;
  width: min(960px, 100%);
  max-height: min(640px, 100%);
  border: 1px solid var(--da-border);
  border-radius: 10px;
  background: var(--da-card);
  color: var(--da-text);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
  outline: none;
}

.da-aud-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--da-border);
}

.da-aud-modal-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--da-text);
}

.da-aud-modal-sub {
  font-size: 12px;
  color: var(--da-muted);
}

.da-aud-modal-x {
  flex: none;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--da-muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.da-aud-modal-x:hover {
  background: var(--da-line);
  color: var(--da-text);
}

.da-aud-modal-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0 16px;
}

.da-aud-modal-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--da-card);
}

.da-aud-modal-foot {
  margin: 0;
  padding: 8px 16px 0;
  font-size: 12px;
  color: var(--da-muted);
}

.da-aud-modal-msg {
  margin: 0;
  padding: 24px 16px 8px;
  text-align: center;
  color: var(--da-muted);
}

.da-aud-modal-msg.is-erro {
  color: var(--da-alert);
}

.da-aud-modal-actions {
  display: flex;
  justify-content: flex-end;
  padding: 10px 16px 14px;
}

.da-aud-modal .da-btn {
  min-height: 30px;
}

.da-aud-modal .da-btn-primary {
  border-color: #1f5fbf;
  background: #1f5fbf;
  color: #fff;
}

@media (max-width: 760px) {
  .da-aud-modal-table .da-aud-col-cli,
  .da-aud-modal-table .da-aud-col-fil {
    display: none;
  }
}

@media (max-width: 480px) {
  .da-aud-modal-table .da-aud-col-num {
    display: none;
  }
}


/* ---------- Áreas da auditoria (Movimento, Financeiro, Cadastro) ---------- */
.da-areas-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.da-areas-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 6px 16px;
}

.da-areas-titulo {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.da-areas {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.da-area {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid var(--da-border);
  border-radius: 6px;
  background: var(--da-card);
  color: var(--da-text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.da-area:hover {
  border-color: var(--da-muted);
}

.da-area:focus-visible {
  outline: 2px solid #1f5fbf;
  outline-offset: 2px;
}

.da-area-topo {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.da-area-nome {
  font-size: 18px;
  font-weight: 600;
}

.da-area-tag {
  font-size: 12px;
  font-weight: 600;
  color: #1f5fbf;
}

.da-area-baixo {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.da-area-qtd {
  margin-right: 4px;
  font-size: 13px;
  color: var(--da-muted);
}

.da-area.is-aberta {
  background: #1f5fbf;
  border-color: #1f5fbf;
  color: #fff;
}

.da-area.is-aberta .da-area-qtd {
  color: rgba(255, 255, 255, 0.85);
}

.da-area.is-aberta .da-area-tag {
  padding: 2px 10px;
  border-radius: 999px;
  background: #fff;
  color: #1f5fbf;
  font-size: 11px;
  letter-spacing: 0.04em;
}

body.dark-theme .da-area.is-aberta {
  background: #2a5fb0;
  border-color: #2a5fb0;
}

.da-areas-desc {
  margin: 4px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--da-border);
  font-size: 13px;
  color: var(--da-text-2);
}

.da-areas-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 8px;
}

@media (max-width: 720px) {
  .da-areas {
    grid-template-columns: minmax(0, 1fr);
  }
}

.da-areas-sep {
  height: 1px;
  background: var(--da-border);
}

.da-dicas {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
  color: var(--da-text-2);
}

.da-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

/* ---------- Cartão de filtros ---------- */
.da-fcard {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px;
  padding: 16px 18px;
  background: var(--da-card);
  border: 1px solid var(--da-border);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 6px 16px rgba(16, 24, 40, 0.05);
}

.da-fc {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 0 1 230px;
  min-width: 190px;
}

.da-fc-filial {
  flex-basis: 360px;
  min-width: 290px;
}

.da-fc-sep {
  align-self: stretch;
  width: 1px;
  background: var(--da-border);
}

.da-fc-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.da-fc-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--da-muted);
}

.da-fc-filial.is-pendente .da-fc-label {
  color: var(--da-link);
}

.da-fc-req {
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(31, 95, 191, 0.12);
  color: var(--da-link);
  font-size: 11px;
  letter-spacing: 0.02em;
  text-transform: none;
}

.da-fc-okmark {
  display: inline-flex;
  color: var(--da-pill-ok);
}

.da-fc-toggle {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: var(--da-line);
}

.da-fc-toggle button {
  min-height: 30px;
  padding: 0 12px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--da-muted);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.da-fc-toggle button[aria-pressed="true"] {
  background: var(--da-card);
  color: var(--da-text);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.14);
}

.da-fc-box {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--da-input-border);
  border-radius: 8px;
  background: var(--da-card);
  box-sizing: border-box;
  color: var(--da-muted);
}

.da-fc-filial.is-pendente .da-fc-box {
  border: 1.5px solid var(--da-link);
  background: rgba(31, 95, 191, 0.06);
  box-shadow: 0 0 0 4px rgba(31, 95, 191, 0.12);
  color: var(--da-link);
}

.da-fc-box:focus-within {
  border-color: var(--da-link);
  box-shadow: 0 0 0 3px rgba(31, 95, 191, 0.2);
}

.da-fc-select {
  flex: 1;
  min-width: 0;
  min-height: 42px;
  border: none;
  outline: none;
  background: transparent;
  color: var(--da-text);
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
}

.da-fc-filial.is-pendente .da-fc-select {
  color: var(--da-link);
  font-weight: 600;
}

.da-fc-select option,
.da-fc-select optgroup {
  background: var(--da-card);
  color: var(--da-text);
}

.da-fc-chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--da-input-border);
  border-radius: 999px;
  background: var(--da-card);
  color: var(--da-muted);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.da-fc-chip.is-on {
  border-color: var(--da-link);
  background: var(--da-link);
  color: #fff;
}

.da-fc-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  flex: 1 1 100%;
}

.da-fc-info {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--da-line);
  color: var(--da-text-2);
  font-size: 13px;
  font-weight: 600;
}

.da-fc-info.is-filial {
  background: rgba(31, 95, 191, 0.12);
  color: var(--da-link);
}

.da-fc-info.is-pendente {
  background: rgba(31, 95, 191, 0.1);
  color: var(--da-link);
}

/* Tela de espera: nenhuma filial escolhida */
.da-gate {
  position: relative;
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.da-gate-fundo {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-content: start;
  filter: blur(6px);
  opacity: 0.55;
}

.da-gate-fundo span {
  height: 96px;
  border-radius: 8px;
  background: var(--da-border);
}

.da-gate-msg {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 22px;
  border-radius: 999px;
  background: var(--da-card);
  border: 1px solid var(--da-border);
  box-shadow: 0 6px 20px rgba(16, 24, 40, 0.12);
  color: var(--da-text);
  font-size: 15px;
  font-weight: 600;
}

.da-gate-msg svg {
  color: var(--da-link);
}

/* Filtros: nada quebra nem fica cortado; se faltar espaço, o campo inteiro desce para a linha de baixo. */
.da-fc {
  flex: 1 1 auto;
  min-width: 230px;
  max-width: 100%;
}

.da-fc-filial {
  flex: 1 1 380px;
  min-width: 380px;
}

.da-fc-filial + .da-fc-sep + .da-fc {
  min-width: 240px; /* Período */
}

.da-fc[data-campo="funcionario"] {
  min-width: 370px;
}

.da-fc-label,
.da-fc-toggle button,
.da-fc-chip,
.da-fc-info {
  white-space: nowrap;
}

.da-fc-select {
  text-overflow: clip;
}

.da-fc-box {
  min-width: 0;
}

@media (max-width: 720px) {
  .da-fc,
  .da-fc-filial {
    min-width: 100%;
  }
  .da-fc-sep {
    display: none;
  }
}

/* Filtros compactos: tudo numa linha (quando cabe), texto menor, sem cortar nem quebrar. */
.da-fcard {
  gap: 10px 12px;
  padding: 10px 14px;
  border-radius: 10px;
}

.da-fc {
  flex: 0 1 auto;
  min-width: 0;
  gap: 5px;
}

.da-fc[data-campo="periodo"] {
  width: 186px;
}

.da-fc[data-campo="funcionario"] {
  width: 300px;
  min-width: 0;
}

.da-fc[data-campo="situacao"] {
  width: 132px;
}

.da-fc[data-campo="de"],
.da-fc[data-campo="ate"] {
  width: 150px;
}

.da-fc-filial {
  flex: 0 1 auto;
  width: 330px;
  min-width: 0;
}

.da-fc-filial + .da-fc-sep + .da-fc {
  min-width: 0;
}

.da-fc-label {
  font-size: 10.5px;
  gap: 4px;
}

.da-fc-req {
  padding: 0 7px;
  font-size: 10px;
}

.da-fc-toggle {
  padding: 2px;
}

.da-fc-toggle button {
  min-height: 24px;
  padding: 0 10px;
  font-size: 11px;
}

.da-fc-box {
  min-height: 34px;
  padding: 0 9px;
  gap: 6px;
  border-radius: 7px;
}

.da-fc-box svg {
  width: 15px;
  height: 15px;
  flex: none;
}

.da-fc-select {
  min-height: 32px;
  font-size: 13px;
}

.da-fc-chip {
  min-height: 22px;
  padding: 0 8px;
  font-size: 11px;
  gap: 4px;
}

.da-fc-chips {
  flex: 1 1 auto;
  gap: 6px;
  margin-left: auto;
}

.da-fc-info {
  padding: 3px 10px;
  font-size: 11.5px;
}

.da-fc-sep {
  align-self: stretch;
}

@media (max-width: 720px) {
  .da-fc,
  .da-fc-filial,
  .da-fc[data-campo] {
    width: 100%;
  }
}

/* ===== Responsivo: chips de filtro no celular (até 767px) =====
   O texto longo da chip (nowrap) empurrava o painel além da largura da tela. */
@media (max-width: 767px) {
  .da-fc-chips {
    min-width: 0;
    max-width: 100%;
    margin-left: 0;
    justify-content: flex-start;
  }

  .da-fc-info {
    max-width: 100%;
    min-width: 0;
    flex-wrap: wrap;
    white-space: normal;
  }

  .da-fc-info .da-muted {
    min-width: 0;
    overflow-wrap: anywhere;
  }
}

/* ===== Responsivo: campos com 16px no celular (até 767px) =====
   Abaixo de 16px o Safari/iOS dá zoom automático ao focar o campo. */
@media (max-width: 767px) {
  .da-fcard .da-fc-select,
  .ac-form .ac-input {
    font-size: 16px;
  }
}

/* Ícone do calendário dos campos De/Até visível no tema escuro (o padrão do navegador é preto) */
.da-fc-select[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.8;
}

:root[data-theme="dark"] .da-fc-select[type="date"]::-webkit-calendar-picker-indicator,
body.dark-theme .da-fc-select[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
}
