/* Dashboard Theme (global)
   - Seções com fundo #F0F2F5
   - Sombra leve padronizada em cards e superfícies de gráfico
*/

:root {
  --df-bg: #F0F2F5;
  --df-radius: 16px;
  --df-radius-sm: 12px;
  --df-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.10), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --df-text: #111827;
  --df-muted: #6b7280;
}

/* Estrutura base */
.dashboard-theme .df-filter-bar,
.dashboard-theme .df-section,
.dashboard-theme .overview-section {
  background: var(--df-bg);
  border-radius: var(--df-radius);
  box-shadow: var(--df-shadow);
}

.dashboard-theme .df-filter-bar {
  padding: 0.65rem 1rem;
  margin: 0 0 1.5rem 0;
  align-items: center;
}

.dashboard-theme .df-section,
.dashboard-theme .overview-section {
  padding: 1.35rem 1.5rem;
  margin: 0 .25rem 1.0rem .25rem;
  overflow: visible; /* não cortar ícones (mt-n4) dos cards */
}

.dashboard-theme .df-section-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--df-text);
  letter-spacing: -0.02em;
  margin: 0 0 1rem 0;
}

/* Cards e painéis */
.dashboard-theme .dashboard-panel {
  background-color: transparent;
  padding: 0;
  border-radius: 0;
}

.dashboard-theme .dashboard-panel .card {
  border-radius: var(--df-radius);
  box-shadow: var(--df-shadow);
}

/* Superfície do gráfico (wrapper e canvas) */
.dashboard-theme .bg-gradient-card-header {
  background: #fff !important;
  background-image: none !important;
  box-shadow: var(--df-shadow) !important;
  border-radius: var(--df-radius-sm);
}

.dashboard-theme .bg-gradient-card-header .chart-canvas,
.dashboard-theme #cashflowProjectionChart,
.dashboard-theme #revenueExpenseChart {
  background: #fff;
  border-radius: var(--df-radius-sm);
  /* sem sombra aqui para evitar “duas layers”; a sombra fica no wrapper (.bg-gradient-card-header) */
  box-shadow: none;
}

/* Evita sombra duplicada no wrapper do gráfico */
.dashboard-theme .card.z-index-2 {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

/* Tipografia auxiliar */
.dashboard-theme .card-body h6 {
  color: var(--df-text);
  font-weight: 600;
}

.dashboard-theme .card-body .text-sm {
  color: var(--df-muted);
}

/* Visão Geral: badges, subtítulos e cards do topo */
.dashboard-theme .dashboard-subtitle {
  color: #4b5563;
}

.dashboard-theme .dashboard-list-row + .dashboard-list-row {
  border-top: 1px solid #f0f2f5;
}

.dashboard-theme .dashboard-list-badge {
  border-radius: 15px;
  font-size: .72rem;
  font-weight: 600;
  padding: .35rem .65rem;
}

.dashboard-theme .dashboard-list-badge.warning {
  background-color: rgba(251, 140, 0, .12);
  color: #fb8c00;
}

.dashboard-theme .dashboard-list-badge.info {
  background-color: rgba(26, 115, 232, .12);
  color: #1a73e8;
}

.dashboard-theme .dashboard-list-badge.secondary {
  background-color: rgba(103, 116, 142, .12);
  color: #67748e;
}

.dashboard-theme .dashboard-card-top .card-header {
  padding-bottom: 0.5rem;
}

.dashboard-theme .dashboard-card-top .card-footer {
  margin-top: auto;
  padding-top: 0.75rem;
}

.dashboard-theme .dashboard-card-top .card-header:only-child {
  padding-bottom: 1rem;
}

/* Ícone Saldo: azul royal vibrante */
.dashboard-theme .icon-saldo-royal {
  background-image: linear-gradient(195deg, #3b82f6 0%, #1e40af 100%);
  box-shadow: 0 8px 22px 0 rgba(59, 130, 246, 0.35);
}

/* Equal height only on large screens (avoid squeezing on mobile) */
@media (min-width: 992px) {
  .dashboard-theme .equal-height-lg {
    display: flex;
  }
  .dashboard-theme .equal-height-lg > .overview-section,
  .dashboard-theme .equal-height-lg > .df-section {
    width: 100%;
    height: 100%;
  }
}

/* Mobile refinements */
@media (max-width: 576px) {
  .dashboard-theme .df-section,
  .dashboard-theme .overview-section {
    padding: 1rem 1rem;
    margin: 0 0 0.85rem 0;
  }

  .dashboard-theme .df-section-title {
    font-size: 1.05rem;
  }

  .dashboard-theme .bg-gradient-card-header {
    border-radius: 12px;
  }

  .dashboard-theme .bg-gradient-card-header .chart {
    min-height: 260px !important;
  }
}

/* DFC — tabela matriz (colunas redimensionáveis, texto com quebra de linha) */
.dashboard-theme .dfc-matriz {
  table-layout: fixed;
  width: 100%;
}

.dashboard-theme .dfc-matriz .dfc-th-resizable {
  position: relative;
  vertical-align: middle;
  overflow: visible;
}

.dashboard-theme .dfc-matriz .dfc-th-label {
  display: block;
  padding-right: 0.5rem;
  white-space: normal;
  word-break: break-word;
  line-height: 1.25;
}

.dashboard-theme .dfc-matriz .dfc-col-resizer {
  position: absolute;
  top: 0;
  right: 0;
  width: 7px;
  height: 100%;
  cursor: col-resize;
  user-select: none;
  z-index: 2;
}

.dashboard-theme .dfc-matriz .dfc-col-resizer:hover,
body.dfc-col-resizing .dashboard-theme .dfc-matriz .dfc-col-resizer {
  background: rgba(37, 99, 235, 0.35);
}

body.dfc-col-resizing {
  cursor: col-resize !important;
  user-select: none;
}

.dashboard-theme .dfc-matriz .dfc-cell-wrap {
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
  line-height: 1.35;
  vertical-align: middle;
}

.dashboard-theme .dfc-matriz .dfc-cell-num {
  white-space: nowrap;
  vertical-align: middle;
}

/* + e texto na mesma linha; só o que não couber quebra (como parágrafo inline) */
.dashboard-theme .dfc-matriz .dfc-hier-cell {
  display: block;
  line-height: 1.35;
}

.dashboard-theme .dfc-matriz .dfc-hier-cell .dfc-expand-toggle,
.dashboard-theme .dfc-matriz .dfc-hier-cell .dfc-expand-spacer {
  display: inline-block;
  vertical-align: top;
  margin-right: 0.2rem;
}

.dashboard-theme .dfc-matriz .dfc-cell-label {
  display: inline;
  font-weight: 400;
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
}

.dashboard-theme .dfc-matriz-row[data-dfc-nivel="0"] td {
  background-color: #e8e8e8 !important;
}

.dashboard-theme .dfc-matriz-resumo[data-dfc-nivel="1"] td,
.dashboard-theme .dfc-matriz-resumo[data-dfc-nivel="2"] td,
.dashboard-theme .dfc-matriz-resumo[data-dfc-nivel="3"] td {
  background-color: inherit;
}

.dashboard-theme .dfc-matriz .bg-light-subtle {
  background-color: #f8fafc !important;
}

.dashboard-theme .dfc-expand-toggle {
  width: 1.05rem;
  height: 1.05rem;
  min-width: 1.05rem;
  padding: 0;
  border: 1px solid #94a3b8;
  border-radius: 2px;
  background: #fff;
  color: #334155;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  vertical-align: middle;
}

.dashboard-theme .dfc-expand-toggle:hover {
  background: #f1f5f9;
  border-color: #64748b;
}

.dashboard-theme .dfc-expand-spacer {
  display: inline-block;
  width: 1.05rem;
  min-width: 1.05rem;
  height: 1.05rem;
}

.dashboard-theme .dashboard-ajuda-trigger:hover,
.dashboard-theme .financeiro-ajuda-trigger:hover {
  color: #94a3b8 !important;
}

.dashboard-theme .dfc-visao-toggle .btn.active {
  background-color: #334155;
  border-color: #334155;
  color: #fff;
}

.dashboard-theme .dfc-matriz-mes {
  table-layout: auto;
  min-width: 100%;
}

.dashboard-theme .dfc-matriz-mes .dfc-mes-col-origem {
  min-width: 220px;
  max-width: 320px;
}

.dashboard-theme .dfc-matriz-mes .dfc-mes-col-valor {
  min-width: 88px;
  white-space: nowrap;
}

.dashboard-theme .dfc-matriz-mes .dfc-mes-col-total {
  min-width: 96px;
  white-space: nowrap;
}

.dashboard-theme .dfc-matriz-mes caption {
  caption-side: top;
}

/* Resumo rápido — lista lateral */
.dashboard-theme .evento-resumo-panel .card-body {
  padding: 0.5rem 0.65rem;
}

.dashboard-theme .evento-resumo-lista__secao {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--df-muted);
  padding: 0.75rem 0.85rem 0.35rem;
  margin: 0;
}

.dashboard-theme .evento-resumo-lista__secao:not(:first-child) {
  padding-top: 1rem;
  border-top: 1px solid #eef1f5;
  margin-top: 0.25rem;
}

.dashboard-theme .evento-resumo-lista__item {
  margin: 0 0.35rem;
}

.dashboard-theme .evento-resumo-lista__item + .evento-resumo-lista__item .evento-resumo-lista__row {
  border-top: 1px solid #f1f5f9;
}

.dashboard-theme .evento-resumo-lista__row {
  display: grid;
  grid-template-columns: 2rem 1fr auto;
  align-items: center;
  gap: 0.65rem;
  min-height: 2.75rem;
  padding: 0.5rem 0.75rem;
  color: var(--df-text);
  border-radius: var(--df-radius-sm);
  transition: background-color 0.15s ease;
}

.dashboard-theme a.evento-resumo-lista__row:hover {
  background-color: #f8fafc;
}

.dashboard-theme .evento-resumo-lista__item--ativo .evento-resumo-lista__row {
  background-color: rgba(51, 65, 85, 0.07);
  box-shadow: inset 0 0 0 1px rgba(51, 65, 85, 0.12);
}

.dashboard-theme .evento-resumo-lista__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  font-size: 0.9rem;
}

.dashboard-theme .evento-resumo-lista__label {
  font-size: 0.8125rem;
  color: #4b5563;
  line-height: 1.3;
  min-width: 0;
}

.dashboard-theme .evento-resumo-lista__valor {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--df-text);
  text-align: right;
  min-width: 1.5rem;
  font-variant-numeric: tabular-nums;
}

.dashboard-theme .evento-resumo-lista__valor.text-info,
.dashboard-theme .evento-resumo-lista__valor.text-danger,
.dashboard-theme .evento-resumo-lista__valor.text-warning,
.dashboard-theme .evento-resumo-lista__valor.text-success {
  font-weight: 700;
}

/* Hero eventos: calendário estica até a altura da lateral; lateral não infla os cards */
@media (min-width: 992px) {
  .dashboard-theme .evento-board-hero-row {
    align-items: stretch;
  }

  .dashboard-theme .evento-board-hero-row__calendar {
    display: flex;
    flex-direction: column;
  }

  .dashboard-theme .evento-board-hero-row__sidebar {
    align-items: stretch;
  }

  .dashboard-theme .evento-board-hero-row__sidebar > .df-section {
    flex: 0 0 auto;
    height: auto !important;
    min-height: 0;
  }
}

@media (min-width: 992px) {
  .dashboard-theme .evento-board-calendar--hero {
    display: flex;
    flex-direction: column;
    min-height: 100%;
  }

  .dashboard-theme .evento-board-calendar--hero .evento-board-calendar__header,
  .dashboard-theme .evento-board-calendar--hero .evento-board-calendar__footer {
    flex: 0 0 auto;
  }

  .dashboard-theme .evento-board-calendar--hero .evento-board-calendar__card {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }

  .dashboard-theme .evento-board-calendar--hero .evento-board-calendar__card .card-body {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }

  .dashboard-theme .evento-board-calendar--hero .evento-board-calendar__shell {
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
  }

  .dashboard-theme .evento-board-calendar--hero .evento-board-calendar {
    flex: 1 1 auto;
    min-height: 0;
    height: 100% !important;
    width: 100%;
  }

  .dashboard-theme .evento-board-calendar--hero .evento-board-calendar .fc {
    height: 100% !important;
    min-height: 100%;
  }

  .dashboard-theme .evento-board-calendar--hero .evento-board-calendar .fc-view-harness {
    flex: 1 1 auto;
    min-height: 0;
  }

  .dashboard-theme .evento-board-calendar--hero .evento-board-calendar .fc-daygrid-body,
  .dashboard-theme .evento-board-calendar--hero .evento-board-calendar .fc-scrollgrid-sync-table {
    height: 100% !important;
  }
}

.dashboard-theme .evento-board-calendar--hero .evento-board-calendar__card .card-body {
  padding: 0.5rem !important;
}

.dashboard-theme .evento-board-calendar--hero .evento-board-calendar__shell {
  min-height: 320px;
}

.dashboard-theme .evento-board-calendar--hero .evento-board-calendar__footer {
  margin-top: 0.5rem;
}

.dashboard-theme .evento-board-calendar--hero .fc-toolbar-title {
  font-size: 1.15rem !important;
}

/* Dashboard Eventos — listas e calendário (seções: .df-section) */
.dashboard-theme .evento-board-calendar .fc {
  font-size: 0.85rem;
}

.dashboard-theme .evento-board-calendar .fc-toolbar-title {
  font-size: 1.05rem !important;
  font-weight: 700;
}

.dashboard-theme .evento-board-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.dashboard-theme .evento-board-list__item + .evento-board-list__item {
  border-top: 1px solid #f1f5f9;
}

.dashboard-theme .evento-board-list__link {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.65rem 0;
  text-decoration: none;
  color: var(--df-text);
  transition: opacity 0.15s ease;
}

.dashboard-theme .evento-board-list__link:hover {
  opacity: 0.75;
}

.dashboard-theme .evento-board-list__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 0.35rem;
  flex-shrink: 0;
}

.dashboard-theme .evento-board-list__bell {
  margin-top: 0.2rem;
  flex-shrink: 0;
  font-size: 0.9rem;
}

.dashboard-theme .evento-board-list__body {
  flex: 1;
  min-width: 0;
}

.dashboard-theme .evento-board-list__title {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.25;
}

.dashboard-theme .evento-board-list__sub {
  display: block;
  font-size: 0.75rem;
  color: var(--df-muted);
  margin-top: 0.15rem;
}

.dashboard-theme .evento-board-list__meta {
  flex-shrink: 0;
  font-size: 0.75rem;
  color: var(--df-muted);
}

.dashboard-theme .evento-board-list__time {
  font-weight: 600;
  color: var(--df-text);
}

.dashboard-theme .evento-board-notes {
  list-style: none;
  padding: 0;
  margin: 0;
}

.dashboard-theme .evento-board-notes li + li {
  border-top: 1px solid #f1f5f9;
}

.dashboard-theme .evento-board-notes__link {
  display: flex;
  align-items: flex-start;
  padding: 0.65rem 0;
  text-decoration: none;
  color: var(--df-text);
}

.dashboard-theme .evento-board-notes__link:hover {
  opacity: 0.8;
}

/* Navbar autenticada — responsivo mobile */
@media (max-width: 1199.98px) {
  body.g-sidenav-show {
    overflow-x: hidden;
  }

  .main-content {
    overflow-x: hidden;
    max-width: 100vw;
  }

  .navbar-auth .container-fluid {
    max-width: 100%;
  }
}

@media (min-width: 1200px) {
  .navbar-auth-search-btn {
    max-width: 15rem;
  }
}

@media (max-width: 575.98px) {
  .navbar-auth h6 {
    max-width: 9rem;
  }

  .navbar-auth-search-btn {
    font-size: 0.875rem;
    padding-top: 0.45rem !important;
    padding-bottom: 0.45rem !important;
  }
}

/* ============================================================
   Upload de arquivos — estilo elegante e consistente (global)
   Aplica-se a todo input[type=file] com .form-control do sistema.
   ============================================================ */
input[type="file"].form-control {
  padding: 0.5rem 0.85rem;
  height: auto;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  border: 1px dashed #cbd5e1;
  border-radius: 0.6rem;
  background-color: #f8fafc;
  color: #64748b;
  font-size: 0.8125rem;
  line-height: 1.3;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
  overflow: hidden;
}

input[type="file"].form-control:hover {
  border-color: #1a73e8;
  background-color: #eef5fe;
}

input[type="file"].form-control:focus,
input[type="file"].form-control:focus-within {
  border-color: #1a73e8;
  background-color: #fff;
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.16);
  outline: none;
}

input[type="file"].form-control::file-selector-button {
  margin: -0.5rem 0.25rem -0.5rem -0.85rem;
  padding: 0.6rem 1.1rem;
  border: 0;
  align-self: stretch;
  background-image: linear-gradient(195deg, #49a3f1 0%, #1a73e8 100%);
  color: #fff;
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: filter 0.15s ease;
}

input[type="file"].form-control::file-selector-button:hover {
  filter: brightness(1.06);
}

input[type="file"].form-control:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

input[type="file"].form-control:disabled::file-selector-button {
  background-image: linear-gradient(135deg, #adb5bd 0%, #ced4da 100%);
}

/* Input de arquivo dentro do padrão flutuante (.input-group-floating):
   alinha verticalmente com selects/inputs vizinhos. */
.input-group-floating:has(input[type="file"]) {
  background-color: #f0f2f5;
}

.input-group-floating:has(input[type="file"]):focus-within {
  background-color: #e9ecf1;
}

.input-group-floating:has(input[type="file"]) label,
.input-group-floating:has(input[type="file"]) .form-label {
  top: 0.58824rem;
  transform: none;
  font-size: 12px;
  line-height: 1.33337;
  color: #6e6e73;
}

.input-group-floating input[type="file"].form-control {
  display: flex;
  align-items: center;
  height: 100% !important;
  min-height: 0 !important;
  padding: 1.55rem 0.6rem 0.45rem 0.85rem !important;
  font-size: 0.78rem;
  color: #67748e;
  cursor: pointer;
  border: none !important;
  background: transparent !important;
}

.input-group-floating input[type="file"].form-control:hover,
.input-group-floating input[type="file"].form-control:focus {
  box-shadow: none !important;
}

.input-group-floating input[type="file"].form-control::file-selector-button {
  margin: 0 0.6rem 0 0;
  padding: 0.34rem 0.8rem;
  border: 0;
  border-radius: 0.45rem;
  align-self: center;
  background-image: linear-gradient(195deg, #49a3f1 0%, #1a73e8 100%);
  color: #fff;
  font-weight: 600;
  font-size: 0.72rem;
}

/* Setinha (chevron) dos selects customizados (select-pesquisa / select-no-lapis),
   imitando o ícone nativo do <select>. */
.select-dropdown-caret,
.select-nolapis-caret {
  position: absolute;
  top: 0;
  right: 0.35rem;
  bottom: 0;
  width: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #1d1d1f;
  cursor: pointer;
  z-index: 4;
  pointer-events: auto;
}

.select-dropdown-caret i,
.select-nolapis-caret i {
  font-size: 1.25rem;
  line-height: 1;
  transition: transform 0.15s ease, color 0.15s ease;
}

.select-dropdown-caret.is-open,
.select-nolapis-caret.is-open {
  color: #1a73e8;
}

.select-dropdown-caret.is-open i,
.select-nolapis-caret.is-open i {
  transform: rotate(180deg);
}

/* Reserva espaço à direita para a setinha não sobrepor o texto */
.input-group-floating:has(.select-dropdown-caret) .form-control,
.input-group-floating:has(.select-nolapis-caret) .form-control {
  padding-right: 2rem !important;
}

/* <select> nativo: garante setinha mesmo quando só usa form-control */
.input-group-floating select.form-control:not([multiple]):not([size]),
.input-group-floating select.form-select:not([multiple]):not([size]),
select.form-control:not([multiple]):not([size]) {
  -webkit-appearance: none;
     -moz-appearance: none;
          appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.65rem center;
  background-size: 14px 10px;
  padding-right: 2rem !important;
  cursor: pointer;
}

/* Toggle "Impostos manuais" em destaque (caixa cinza + acento azul ativo) */
.nfse-imposto-toggle {
  background-color: #f0f2f5;
  border: 1px solid #e2e8f0;
  border-radius: 0.6rem;
  padding: 0.6rem 0.9rem;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.nfse-imposto-toggle:hover {
  border-color: #cbd5e1;
}

.nfse-imposto-toggle .form-check-input {
  cursor: pointer;
}

.nfse-imposto-toggle .form-check-input:checked {
  background-color: #1a73e8 !important;
  border-color: #1a73e8 !important;
}

.nfse-imposto-toggle:has(.form-check-input:checked) {
  background-color: #eaf2fe;
  border-color: #9cc4f5;
}

.nfse-imposto-toggle .form-check-label {
  cursor: pointer;
  color: #475569;
}

/* Variante compacta (.form-control-sm) */
input[type="file"].form-control-sm {
  min-height: 38px;
  padding: 0.35rem 0.7rem;
  font-size: 0.76rem;
  border-radius: 0.5rem;
}

input[type="file"].form-control-sm::file-selector-button {
  margin: -0.35rem 0.2rem -0.35rem -0.7rem;
  padding: 0.42rem 0.85rem;
  font-size: 0.72rem;
}

/* Estado de erro herdado do .is-invalid */
input[type="file"].form-control.is-invalid {
  border-color: #fb6340;
  border-style: dashed;
}

/* Lista de arquivos já anexados — chip elegante */
.file-item {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  max-width: 100%;
  padding: 0.4rem 0.65rem;
  margin: 0 0.4rem 0.4rem 0;
  background-color: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  font-size: 0.8rem;
  color: #475569;
}

.file-item i.fa-file-alt {
  color: #1a73e8;
}

.file-item a {
  color: #475569;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-item a:hover {
  color: #1a73e8;
}

.file-item .delete-upload {
  color: #fb6340;
  line-height: 1;
}

.file-item .delete-upload:hover {
  color: #f5365c;
}

