/* #region Responsivo que já tinha no sistema */

@media (min-width: 992px) {
  .d-none-responsive-991 {
    display: block;
  }

  .d-block-responsive-991 {
    display: none;
  }

  .hamburger-menu-sm {
    display: none;
  }
}

@media (max-width: 991.98px) {
  #sidebar.modern-sidebar {
    transform: none;
  }

  .hamburger-menu-lg {
    display: none;
  }

  .hamburger-menu-sm {
    display: block;
  }

  .btn-responsive-align {
    text-align: center !important;
    margin-bottom: 24px;
  }

  .d-block-responsive-991 {
    display: flex;
  }

  .d-none-responsive-991 {
    display: none;
  }

  .input-pesquisa {
    display: none;
  }

  nav.active-sidebar-responsive {
    display: block !important;
    height: 100% !important;
    width: 100% !important;
  }

  .content {
    margin-left: 0;
  }

  #sidebar.modern-sidebar {
    height: 100% !important;
    width: 0 !important;
    position: fixed !important;
    z-index: 1 !important;
    top: 0 !important;
    left: 0 !important;
    background-color: #f8f9fa !important;
    overflow-x: hidden !important;
    transition: 0.5s !important;
    padding-top: 0px;
  }

  nav.active-sidebar-responsive .menu-bar {
    width: 100% !important;
  }

  body.sidebar-sm-active #sidebar.modern-sidebar {
    width: 137px !important;
  }

  body.sidebar-sm-active .content {
    margin-left: 130px !important;
  }

  div#menuToggle {
    display: none;
  }
}

@media (max-width: 476.98px) {
  nav.navbar-top .logo img {
    width: 150px;
  }

  .content {
    margin-top: 55px;
    padding: 8px;
    padding-top: 24px;
    padding-bottom: 24px;
  }

  .menu-pessoal {
    display: none;
  }
}

/* ====== SIDEBAR / CONTENT LAYOUT ====== */

/* Padrão: sidebar visível */
body:not(.hide-sidebar-lg) .content {
  margin-left: 255px;
  transition: margin-left 0.3s ease;
}

/* Quando sidebar estiver oculto manualmente */
body.hide-sidebar-lg .content {
  margin-left: 0 !important;
  transition: margin-left 0.3s ease;
}

/* Se o body tiver atributo de configuração para esconder sidebar grande */

/* Em telas pequenas (mobile), sidebar some e o conteúdo ocupa 100% */
@media (max-width: 767px) {
  button#sidebarToggleTop {
    display: none !important;
  }

  .content {
    margin-left: 0 !important;
  }

  #sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 255px;
    background: var(--sidebar-bg, #111827);
    z-index: 1050;
    transition: all 0.3s ease;
  }
}

/* #endregion responsivo que já tinha no sistema */

/* ============================================ */
/* RESPONSIVIDADE (MEDIA QUERIES)           */
/* ============================================ */

/* Telas médias (≤ 1200px) */
@media (max-width: 1200px) {
  .content {
    padding: 60px 30px 30px;
  }
  .config-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  }
}

/* Tablets / telas médias (≤ 992px) */
@media (max-width: 992px) {
  .content {
    margin-left: 0;
    padding: 80px 20px 20px;
    margin-top: 70px;
  }
  footer.footer-system {
    margin-left: 0;
  }
  body.sidebar-collapsed .content {
    margin-left: 0;
  }
  .search-box input {
    width: 100%;
    max-width: 260px;
  }
  .assets-topo {
    gap: 16px;
  }
  .config-grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  }
  .kanban-full .kanban-column {
    min-width: 280px;
    max-width: 280px;
  }
  .main-content {
    margin-left: 0;
  }
  .header {
    padding: 0.8rem 1rem;
  }
  .content-area {
    padding: 1rem;
  }
}

/* Tablets pequenos / celulares grandes (≤ 768px) */
@media (max-width: 768px) {
  .content {
    padding: 70px 16px 16px;
  }
  .config-grid {
    grid-template-columns: 1fr;
  }
  .config-card {
    padding: 1.5rem;
  }
  .kanban-full .kanban-column {
    min-width: 260px;
  }
  .header-nav .profile {
    min-width: 220px;
  }
  .search-input {
    width: 100%;
    max-width: 100%;
  }
  .assets-topo {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }

  /* Força scroll horizontal em tabelas */
  .table-responsive,
  .table-responsive-sm,
  .table-responsive-md,
  .table-responsive-lg,
  .table-responsive-xl,
  .table-responsive-xxl {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }
}

/* Celulares (≤ 576px) */
@media (max-width: 576px) {
  .content {
    padding: 60px 12px 12px;
  }
  .assets-topo {
    gap: 12px;
  }
  .edit-pers,
  .switch-theme {
    height: 40px;
    width: 40px;
  }
  .card-home h4 {
    font-size: 2rem;
  }
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .pagination {
    justify-content: center !important;
  }
  .modal-dialog {
    margin: 0.5rem;
  }
  .swal-modal {
    width: 90% !important;
  }
  .table-default-system ul.pagination {
    gap: 6px;
  }
  .table-default-system ul.pagination li a {
    font-size: 14px;
    padding: 0.4rem 0.6rem;
  }
  .page-title {
    font-size: 1.5rem;
  }
  .page-subtitle {
    font-size: 1rem;
  }
  .analises-creditos-home .service-card-modern {
    margin-bottom: 1rem;
  }
  .kanban-full .kanban-container {
    gap: 12px;
  }
  .kanban-full .kanban-column {
    min-width: 240px;
  }
}

/* =========================================
   Responsivo - Breadcrumb
========================================= */

/* tablet */
@media (max-width: 768px) {
  #breadcrumb {
    padding: 10px 14px 0;
  }

  #breadcrumb .breadcrumb {
    row-gap: 3px;
  }

  #breadcrumb .breadcrumb-item,
  #breadcrumb .breadcrumb-item a {
    font-size: 14px;
  }
}

/* mobile */
@media (max-width: 576px) {
  #breadcrumb {
    padding: 8px 12px 0;
  }

  #breadcrumb nav {
    margin-bottom: 12px !important;
    margin-top: 12px;
  }

  #breadcrumb .breadcrumb {
    row-gap: 2px;
  }

  #breadcrumb .breadcrumb-item,
  #breadcrumb .breadcrumb-item a {
    font-size: 13px;
    line-height: 1.3;
  }
}

/* =======================================================
   Responsivo - Botões de busca e controles do DataTables 
======================================================= */

/* topo dos botões acima da tabela */
@media (max-width: 991.98px) {
  #table-usuarios > .mb-4 > .d-flex.flex-wrap.gap-3 {
    flex-direction: column;
    align-items: stretch;
  }

  #table-usuarios > .mb-4 > .d-flex.flex-wrap.gap-3 > .dropdown,
  #table-usuarios
    > .mb-4
    > .d-flex.flex-wrap.gap-3
    > .ms-xxl-auto.d-flex.gap-2 {
    width: 100%;
  }

  #table-usuarios
    > .mb-4
    > .d-flex.flex-wrap.gap-3
    > .ms-xxl-auto.d-flex.gap-2 {
    margin-left: 0 !important;
    flex-direction: column;
    width: 100%;
  }

  #table-usuarios > .mb-4 .ms-xxl-auto.d-flex.gap-2 .btn,
  #table-usuarios > .mb-4 .dropdown .btn,
  #table-usuarios > .mb-4 .ms-xxl-auto.d-flex.gap-2 a.btn {
    width: 100%;
  }
}

/* tablet */
@media (max-width: 768px) {
  #table-filter_wrapper .row {
    row-gap: 10px;
    --bs-gutter-x: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  #table-filter_wrapper .row > * {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  #table-filter_wrapper .dataTables_length,
  #table-filter_wrapper .dataTables_filter,
  #table-filter_wrapper .dataTables_info,
  #table-filter_wrapper .dataTables_paginate {
    width: 100%;
  }

  #table-filter_wrapper .dataTables_filter {
    text-align: left !important;
  }

  #table-filter_wrapper .dataTables_paginate {
    display: flex;
    justify-content: center;
  }

  #table-filter_wrapper .dataTables_info {
    text-align: center;
  }

  #table-filter_wrapper .dataTables_length,
  #table-filter_wrapper .dataTables_filter,
  #table-filter_wrapper .dataTables_info,
  #table-filter_wrapper .dataTables_paginate {
    width: 100%;
  }

  #table-filter_wrapper .dataTables_filter {
    text-align: left !important;
  }

  #table-filter_wrapper .dataTables_paginate {
    display: flex;
    justify-content: center;
  }

  #table-filter_wrapper .dataTables_info {
    text-align: center;
  }
}

/* mobile */
@media (max-width: 576px) {
  /* remove limitação das colunas do datatables */
  #table-filter_wrapper .row > div {
    flex: 0 0 100%;
    max-width: 100%;
  }

  #table-filter_wrapper .dataTables_length {
    text-align: left !important;
  }

  /* garante largura total do bloco de busca */
  #table-filter_wrapper .dataTables_filter {
    width: 100% !important;
    display: block;
  }

  /* label vira container total */
  #table-filter_wrapper .dataTables_filter label {
    display: block;
    width: 100%;
    font-size: 0;
  }

  /* input realmente full width */
  #table-filter_wrapper .dataTables_filter input {
    width: 100% !important;
    min-width: 100% !important;
    display: block;
    margin: 0 !important;
  }
}

/* =======================================================
   RESPONSIVO - TELA RELAÇÃO DE PROCESSOS
======================================================= */

/* topo da busca */
@media (max-width: 768px) {
  #table-analises > .mb-3.d-flex.gap-2.justify-content-end {
    justify-content: stretch !important;
  }

  #table-analises > .mb-3.d-flex.gap-2.justify-content-end form.d-flex.gap-2 {
    width: 100%;
    flex-wrap: wrap;
  }

  #table-analises
    > .mb-3.d-flex.gap-2.justify-content-end
    form.d-flex.gap-2
    input.form-control {
    flex: 1 1 100%;
    min-width: 100%;
  }

  #table-analises
    > .mb-3.d-flex.gap-2.justify-content-end
    form.d-flex.gap-2
    .btn {
    flex: 1 1 0;
  }
}

@media (max-width: 576px) {
  #table-analises > .mb-3 .btn-busca-avancada {
    width: 100%;
  }

  #table-analises > .mb-3.d-flex.gap-2.justify-content-end form.d-flex.gap-2 {
    flex-direction: row;
    align-items: stretch;
  }

  #table-analises
    > .mb-3.d-flex.gap-2.justify-content-end
    form.d-flex.gap-2
    input.form-control {
    width: 100%;
    min-width: 100%;
    flex: 0 0 100%;
  }

  #table-analises
    > .mb-3.d-flex.gap-2.justify-content-end
    form.d-flex.gap-2
    .btn {
    width: calc(50% - 0.25rem);
  }

  /* se existir só um botão, ocupa tudo */
  #table-analises
    > .mb-3.d-flex.gap-2.justify-content-end
    form.d-flex.gap-2
    .btn:only-of-type {
    width: 100%;
  }

  /* coluna ações */
  #table-analises td:last-child {
    min-width: 86px;
  }

  /* container interno dos botões */
  #table-analises td:last-child > div,
  #table-analises td:last-child .d-flex,
  #table-analises td:last-child .btn-group {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    align-items: stretch;
  }

  /* botões */
  #table-analises td:last-child .btn {
    width: 100%;
    min-width: 0;
    padding: 8px 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  #table-analises td:last-child .btn i {
    margin: 0 !important;
  }

  /* quebra o comportamento do btn-group */
  #table-analises td:last-child .btn-group {
    display: block !important;
    width: 100%;
  }

  /* botão "..." igual os outros */
  #table-analises td:last-child .btn-group .dropdown-toggle {
    width: 100% !important;
    min-width: 0;
    padding: 8px 6px !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
  }

  /* remove setinha */
  #table-analises td:last-child .dropdown-toggle::after {
    display: none !important;
  }
}

/* tablet */
@media (max-width: 768px) {
  #table-analises td:first-child {
    min-width: 76px;
    width: 76px;
  }

  #table-analises td .trocar-status-operacoes {
    min-width: 76px;
    max-width: 76px;
    font-size: 12px;
    padding-left: 0.55rem;
    padding-right: 1.5rem;
    text-overflow: ellipsis;
  }
}

/* mobile */
@media (max-width: 576px) {
  #table-analises td:first-child {
    min-width: 70px;
    width: 70px;
  }

  #table-analises td .trocar-status-operacoes {
    min-width: 70px;
    max-width: 70px;
    font-size: 11px;
    padding-left: 0.45rem;
    padding-right: 1.35rem;
    background-position: right 0.35rem center;
    background-size: 12px;
  }
}

/* =======================================================
   RESPONSIVO - TELA Whitelabel
======================================================= */

#tab-operacoes {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  padding-bottom: 6px;
  border-bottom: none;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

#tab-operacoes .nav-item {
  flex: 0 0 auto;
}

#tab-operacoes .nav-link {
  height: 100%;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

#tab-operacoes .badge-number {
  flex: 0 0 auto;
}

/* tablet */
@media (max-width: 991.98px) {
  #tab-operacoes {
    gap: 8px;
    padding-bottom: 4px;
  }

  #tab-operacoes .nav-link {
    padding: 0.7rem 0.9rem;
    font-size: 14px;
  }

  #tab-operacoes .badge-number {
    font-size: 12px;
  }
}

/* mobile */
@media (max-width: 576px) {
  #tab-operacoes {
    margin-bottom: 10px;
    padding-bottom: 2px;
  }

  #tab-operacoes .nav-link {
    padding: 0.6rem 0.8rem;
    font-size: 13px;
    border-radius: 10px;
  }

  #tab-operacoes .badge-number {
    font-size: 11px;
    line-height: 1;
  }
}

/* =========================================
   Responsivo - CRM / KANBAN
========================================= */

/* topo de ações */
.kanban-full > .d-flex.gap-3.mt-3 {
  flex-wrap: wrap;
  align-items: center;
}

.kanban-full > .d-flex.gap-3.mt-3 .btn {
  white-space: nowrap;
}

/* agenda */
.kanban-full .card-header {
  gap: 10px;
}

/* cards */
.kanban-full .kanban-card strong {
  display: block;
  padding-right: 8px;
}

.kanban-full .kanban-card .d-flex.justify-content-between {
  gap: 8px;
  align-items: flex-start;
}

.kanban-full .card-actions {
  flex: 0 0 auto;
  white-space: nowrap;
}

/* tablet */
@media (max-width: 991.98px) {
  .kanban-full > .d-flex.gap-3.mt-3 {
    gap: 12px !important;
  }

  .kanban-full > .d-flex.gap-3.mt-3 .btn {
    flex: 1 1 calc(50% - 6px);
  }

  .kanban-full > .d-flex.gap-3.mt-3 .onoff,
  .kanban-full > .d-flex.gap-3.mt-3 #estado {
    flex: 0 0 100%;
  }

  .kanban-full .kanban-container {
    gap: 16px;
    padding-bottom: 14px;
    scroll-snap-type: x proximity;
  }

  .kanban-full .kanban-column {
    min-width: 280px;
    max-width: 280px;
    scroll-snap-align: start;
  }

  .kanban-full .kanban-cards {
    max-height: 55vh;
  }
}

/* mobile */
@media (max-width: 576px) {
  .kanban-full h2 {
    font-size: 1.35rem;
    margin-bottom: 0.75rem;
  }

  /* agenda */
  .kanban-full .card-header {
    flex-direction: column;
    align-items: stretch !important;
  }

  .kanban-full .card-header h5 {
    text-align: center;
  }

  .kanban-full .card-header .btn {
    width: 100%;
  }

  /* botões de ação */
  .kanban-full > .d-flex.gap-3.mt-3 {
    flex-direction: column;
    align-items: stretch;
    gap: 10px !important;
  }

  .kanban-full > .d-flex.gap-3.mt-3 .btn {
    width: 100%;
    flex: 0 0 100%;
  }

  .kanban-full > .d-flex.gap-3.mt-3 .onoff {
    display: flex;
    justify-content: center;
    width: 100%;
  }

  .kanban-full > .d-flex.gap-3.mt-3 #estado {
    width: 100%;
    text-align: center;
    margin-top: 0 !important;
  }

  /* kanban */
  .kanban-full .kanban-container {
    gap: 12px;
    margin-top: 14px;
    padding-bottom: 10px;
    scroll-snap-type: x mandatory;
  }

  .kanban-full .kanban-column {
    min-width: 86vw;
    max-width: 86vw;
    padding: 8px;
    scroll-snap-align: start;
  }

  .kanban-full .kanban-header {
    padding: 0.75rem;
  }

  .kanban-full .kanban-total {
    margin-top: 0.75rem !important;
    padding: 0.85rem !important;
  }

  .kanban-full .kanban-total h6 {
    font-size: 0.85rem;
  }

  .kanban-full .kanban-total h4 {
    font-size: 1.1rem;
    margin-top: 4px;
  }

  .kanban-full .kanban-cards {
    min-height: 180px;
    max-height: 52vh;
    padding: 0.35rem !important;
  }

  .kanban-full .kanban-card {
    padding: 0.85rem !important;
    margin-bottom: 12px !important;
  }

  .kanban-full .kanban-card .d-flex.justify-content-between {
    flex-wrap: nowrap;
  }

  .kanban-full .kanban-card strong {
    font-size: 0.95rem;
    line-height: 1.3;
  }

  .kanban-full .card-actions i {
    font-size: 14px;
  }

  .kanban-full .card-info {
    font-size: 12px;
    line-height: 1.45;
    margin-top: 10px !important;
  }
}

/* =========================================
   Responsivo - Links
========================================= */

#table-links td:last-child {
  white-space: nowrap;
}

/* mobile */
@media (max-width: 576px) {
  #table-links td:last-child {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }

  #table-links td:last-child .btn {
    width: 100%;
    padding: 6px;
    font-size: 13px;
  }

  #table-links td:last-child .btn i {
    margin: 0;
  }
}

/* =========================================
   Responsivo - Indicações
========================================= */

@media (max-width: 768px) {
  #table-indications + table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  #table-indications + table thead,
  #table-indications + table tbody,
  #table-indications + table tr {
    white-space: nowrap;
  }

  #table-indications + table th,
  #table-indications + table td {
    white-space: nowrap;
  }
}
