/* ================================
   BOTONES DATATABLES
   ================================ */
.dt-buttons button {
  background-color: #fff !important;
  margin: 0 2px;
  padding: 4px 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 13px;
  box-shadow: none !important;
  transition: all 0.2s ease-in-out;
}

.dt-buttons button:hover {
  background-color: #f8f9fa !important;
  border-color: #ccc;
}

/* ================================
   MODAL (Bootstrap 4 + Stisla fix)
   ================================ */
.modal {
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  z-index: 1050 !important;
}

/* Fondo del modal */
.modal-backdrop {
  z-index: 1040 !important;
  background-color: rgba(0, 0, 0, 0.6);
}

/* Evita que el contenedor padre o sidebar corte el modal */
.main-content,
.main-wrapper,
#app {
  overflow: visible !important;
}

/* Cuando el modal está abierto, evita desplazamiento lateral */
body.modal-open {
  overflow: hidden !important;
  padding-right: 0 !important;
}

/* ================================
   SCROLL Y RESPONSIVE MODALES
   ================================ */
@media (max-width: 768px) {
  .modal-dialog {
    margin: 0.5rem;
    max-width: 100%;
  }

  .modal-dialog.modal-lg {
    max-width: 100%;
  }

  .modal-dialog-scrollable .modal-body {
    max-height: calc(100vh - 7rem);
    overflow-y: auto;
  }
}

/* ================================
   SOMBRA SUAVE EN EL MODAL
   ================================ */
.modal-content {
  box-shadow: 0 0 25px rgba(0, 0, 0, 0.25);
  border-radius: 8px;
  border: none;
}

/* ================================
   NOTIFICACIONES EN CAMPANA
   ================================ */
.header-badge-noti {
  position: absolute;
  top: 2px;
  right: -2px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 10px;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
  background: #ff4d4f;
  color: #fff;
  font-weight: 700;
  z-index: 9999;
  display: inline-block;
}

/* ================================
   CREDIVER - VARIABLES GENERALES
   ================================ */
:root {
  --crediver-primary: #16a69a;
  --crediver-primary-dark: #0f8f86;
  --crediver-bg: #f7f9fb;
  --crediver-card: #ffffff;
  --crediver-text: #2f3545;
  --crediver-muted: #8a94a6;
  --crediver-border: #eef0f4;
  --crediver-shadow: 0 8px 24px rgba(31, 45, 61, 0.06);
}

.crediver-body {
  background: var(--crediver-bg);
}

.crediver-wrapper {
  background: var(--crediver-bg);
}

.crediver-section {
  padding-top: 20px;
}

/* ================================
   CREDIVER - MOBILE NAV
   ================================ */
.crediver-mobile-nav {
  display: none;
}

.mobile-nav-item {
  text-decoration: none !important;
}

/* ================================
   CREDIVER - DASHBOARD
   ================================ */
.crediver-dashboard {
  width: 100%;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 22px;
}

.dashboard-header h1 {
  font-size: 26px;
  font-weight: 800;
  margin: 0;
  color: var(--crediver-text);
}

.dashboard-header p {
  margin: 6px 0 0;
  color: var(--crediver-muted);
  font-size: 14px;
}

.dashboard-header-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-crediver-primary {
  background: var(--crediver-primary);
  color: #fff !important;
  border: 1px solid var(--crediver-primary);
  border-radius: 12px;
  font-weight: 700;
  padding: 9px 14px;
}

.btn-crediver-primary:hover {
  background: var(--crediver-primary-dark);
  border-color: var(--crediver-primary-dark);
}

.btn-crediver-outline {
  background: #fff;
  color: var(--crediver-primary) !important;
  border: 1px solid var(--crediver-primary);
  border-radius: 12px;
  font-weight: 700;
  padding: 9px 14px;
}

/* ================================
   TARJETAS DE RESUMEN
   ================================ */
.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

.stat-card {
  background: #fff;
  border-radius: 18px;
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none !important;
  border: 1px solid var(--crediver-border);
  box-shadow: var(--crediver-shadow);
  transition: all 0.2s ease-in-out;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(31, 45, 61, 0.1);
}

.stat-icon {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon i {
  font-size: 20px;
}

.stat-info span {
  display: block;
  color: var(--crediver-muted);
  font-size: 13px;
  font-weight: 700;
}

.stat-info strong {
  display: block;
  font-size: 26px;
  line-height: 1.1;
  color: var(--crediver-text);
}

.stat-active .stat-icon {
  background: rgba(255, 193, 7, 0.14);
  color: #b88700;
}

.stat-warning .stat-icon {
  background: rgba(220, 53, 69, 0.12);
  color: #dc3545;
}

.stat-success .stat-icon {
  background: rgba(40, 167, 69, 0.12);
  color: #28a745;
}

.stat-info .stat-icon {
  background: rgba(22, 166, 154, 0.12);
  color: var(--crediver-primary);
}

/* Nuevas tarjetas */
.stat-noti .stat-icon {
  background: rgba(0, 123, 255, 0.12);
  color: #007bff;
}

.stat-total .stat-icon {
  background: rgba(111, 66, 193, 0.12);
  color: #6f42c1;
}

/* ================================
   ACCIONES RÁPIDAS
   ================================ */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

.quick-action-card {
  background: #fff;
  border-radius: 18px;
  padding: 16px;
  display: flex;
  gap: 14px;
  align-items: center;
  text-decoration: none !important;
  color: var(--crediver-text);
  border: 1px solid var(--crediver-border);
  box-shadow: var(--crediver-shadow);
  transition: all 0.2s ease-in-out;
}

.quick-action-card:hover {
  transform: translateY(-2px);
  color: var(--crediver-text);
}

.quick-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: rgba(22, 166, 154, 0.12);
  color: var(--crediver-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.quick-action-card strong {
  display: block;
  font-size: 15px;
  margin-bottom: 3px;
}

.quick-action-card span {
  display: block;
  font-size: 13px;
  color: var(--crediver-muted);
}

/* ================================
   BLOQUE INFERIOR DASHBOARD
   ================================ */
.dashboard-lower-grid {
  display: grid;
  grid-template-columns: 1.35fr 0.85fr;
  gap: 14px;
}

.dashboard-panel {
  background: #fff;
  border-radius: 18px;
  border: 1px solid var(--crediver-border);
  box-shadow: var(--crediver-shadow);
  padding: 18px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.panel-header h2 {
  font-size: 18px;
  font-weight: 800;
  margin: 0;
  color: var(--crediver-text);
}

.panel-header p {
  margin: 4px 0 0;
  color: var(--crediver-muted);
  font-size: 13px;
}

.panel-header a {
  color: var(--crediver-primary);
  font-weight: 700;
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
}

.movement-list,
.notification-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.movement-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: 14px;
  background: #fafbfc;
  border: 1px solid #f0f2f5;
}

.movement-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.movement-avatar {
  width: 38px;
  height: 38px;
  border-radius: 14px;
  background: rgba(22, 166, 154, 0.12);
  color: var(--crediver-primary);
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.movement-main strong {
  display: block;
  font-size: 14px;
  color: var(--crediver-text);
}

.movement-main span {
  display: block;
  font-size: 12px;
  color: var(--crediver-muted);
}

.movement-meta {
  text-align: right;
  flex-shrink: 0;
}

.movement-meta small {
  display: block;
  margin-top: 4px;
  color: var(--crediver-muted);
  font-size: 11px;
}

.status-pill {
  display: inline-block;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}

.status-activo {
  background: rgba(255, 193, 7, 0.16);
  color: #9b7600;
}

.status-problema {
  background: rgba(220, 53, 69, 0.12);
  color: #dc3545;
}

.status-saldada {
  background: rgba(40, 167, 69, 0.12);
  color: #28a745;
}

.notification-item {
  position: relative;
  display: flex;
  gap: 10px;
  padding: 12px;
  border-radius: 14px;
  background: #fafbfc;
  border: 1px solid #f0f2f5;
}

.notification-item.unread {
  background: rgba(22, 166, 154, 0.07);
  border-color: rgba(22, 166, 154, 0.18);
}

.notification-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #c5cad3;
  margin-top: 6px;
  flex-shrink: 0;
}

.notification-item.unread .notification-dot {
  background: var(--crediver-primary);
}

.notification-item strong {
  display: block;
  color: var(--crediver-text);
  font-size: 14px;
}

.notification-item span {
  display: block;
  color: var(--crediver-muted);
  font-size: 13px;
  margin-top: 2px;
}

.notification-item small {
  display: block;
  color: var(--crediver-muted);
  font-size: 11px;
  margin-top: 5px;
}

.empty-dashboard {
  padding: 25px 10px;
  text-align: center;
  color: var(--crediver-muted);
}

.empty-dashboard i {
  font-size: 28px;
  margin-bottom: 8px;
  display: block;
}

/* ================================
   DASHBOARD RESPONSIVE TABLET
   ================================ */
@media (max-width: 992px) {
  .dashboard-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .quick-actions {
    grid-template-columns: 1fr;
  }

  .dashboard-lower-grid {
    grid-template-columns: 1fr;
  }
}

/* ================================
   CREDIVER - RESPONSIVE GENERAL MÓVIL
   ================================ */
@media (max-width: 768px) {
  body.crediver-body {
    background: var(--crediver-bg);
  }

  .navbar-bg {
    height: 58px;
  }

  .main-sidebar {
    display: none !important;
  }

  .main-content,
  .crediver-main-content {
    margin-left: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    padding-top: 70px !important;
    padding-bottom: 92px !important;
    width: 100% !important;
  }

  .section,
  .crediver-section {
    padding-left: 12px;
    padding-right: 12px;
  }

  .main-footer {
    display: none !important;
  }

  .crediver-mobile-nav {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: 10px;
    z-index: 99999;
    height: 64px;
    background: #ffffff;
    border: 1px solid var(--crediver-border);
    border-radius: 20px;
    box-shadow: 0 10px 35px rgba(31, 45, 61, 0.16);
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: center;
    padding: 6px 4px;
  }

  .mobile-nav-item {
    position: relative;
    color: #7d8797;
    font-size: 10px;
    font-weight: 600;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 3px;
    align-items: center;
    justify-content: center;
    line-height: 1.1;
  }

  .mobile-nav-item i {
    font-size: 17px;
  }

  .mobile-nav-item.active {
    color: var(--crediver-primary);
  }

  .mobile-nav-icon-wrap {
    position: relative;
    display: inline-flex;
  }

  .mobile-nav-badge {
    position: absolute;
    top: -9px;
    right: -10px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 999px;
    background: #ff3b30;
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    line-height: 17px;
    text-align: center;
    border: 2px solid #ffffff;
  }

  .dashboard-header {
    flex-direction: column;
    margin-bottom: 16px;
  }

  .dashboard-header h1 {
    font-size: 22px;
  }

  .dashboard-header p {
    font-size: 13px;
  }

  .dashboard-header-actions {
    width: 100%;
  }

  .dashboard-header-actions .btn {
    flex: 1;
    font-size: 13px;
    padding: 9px 10px;
  }

  .dashboard-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .stat-card {
    padding: 13px;
    border-radius: 16px;
    gap: 10px;
  }

  .stat-icon {
    width: 38px;
    height: 38px;
    border-radius: 13px;
  }

  .stat-icon i {
    font-size: 16px;
  }

  .stat-info span {
    font-size: 11px;
    line-height: 1.2;
  }

  .stat-info strong {
    font-size: 22px;
  }

  .quick-action-card {
    padding: 14px;
  }

  .dashboard-panel {
    padding: 15px;
    border-radius: 16px;
  }

  .movement-item {
    align-items: flex-start;
    flex-direction: column;
  }

  .movement-meta {
    text-align: left;
  }

  .panel-header h2 {
    font-size: 16px;
  }
}