﻿/*gestor-am/css/styles.css*/

:root {
  --bg-dark: #030712;
  --bg-card: #0f172a;
  --bg-soft: #111827;
  --accent: #22c55e;
  --accent-soft: rgba(34, 197, 94, 0.15);
  --text-main: #e5e7eb;
  --text-muted: #9ca3af;
  --danger: #f97373;
  --border-soft: #1f2937;
  --radius-lg: 16px;
  --shadow-soft: 0 18px 45px rgba(0, 0, 0, 0.6);
  --transition: 0.2s ease;
 --sidebar-width: 285px;
--font-main: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-main);
  color: var(--text-main);
}

body.modal-open {
  overflow: hidden;
}

.btn:focus-visible,
.menu-item:focus-visible,
.sidebar-footer-btn:focus-visible,
.user-avatar:focus-visible,
.search-clear-btn:focus-visible,
.toggle-password:focus-visible,
.modal-close:focus-visible,
.hamburger-btn:focus-visible,
.user-dropdown-item:focus-visible {
  outline: 2px solid rgba(34, 197, 94, 0.8);
  outline-offset: 2px;
}

/* ---------- LOGIN ---------- */

.body-login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at top, rgba(34, 197, 94, 0.14), transparent 28%),
    linear-gradient(180deg, #0d1c2a 0%, #0b1725 48%, #08131f 100%);
}

.body-login::before,
.body-login::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.body-login::before {
  background:
    radial-gradient(circle at 50% 50%, rgba(34, 197, 94, 0.1), transparent 38%),
    radial-gradient(circle at 20% 15%, rgba(96, 165, 250, 0.1), transparent 30%);
}

.body-login::after {
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.06), rgba(0, 0, 0, 0.22)),
    radial-gradient(circle at center, transparent 0, rgba(0, 0, 0, 0.18) 84%);
}

.login-effects {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.login-fx-grid {
  position: absolute;
  inset: -36vh -32vw;
  display: flex;
  flex-direction: column;
  gap: clamp(0.3rem, 0.9vw, 0.8rem);
  justify-content: center;
  transform: rotate(-28deg) scale(1.32);
  transform-origin: center;
}

.login-fx-row {
  display: flex;
  align-items: center;
  white-space: nowrap;
  font-size: clamp(2rem, 3.8vw, 4.25rem);
  line-height: 1;
  user-select: none;
  cursor: default;
}

.login-fx-track {
  min-width: max-content;
  display: inline-flex;
  align-items: center;
  animation: login-fx-left 20s linear infinite;
}

.login-fx-row[data-direction="right"] .login-fx-track {
  animation-name: login-fx-right;
}

.login-fx-icon {
  pointer-events: none;
  color: rgba(148, 163, 184, 0.16);
  padding: 0.18em 0.34em;
  -webkit-tap-highlight-color: transparent;
  transition:
    color 0.18s ease,
    text-shadow 0.18s ease,
    transform 0.18s ease;
}

.login-fx-icon.is-near,
.login-fx-icon:hover {
  color: #65fe6d;
  text-shadow:
    0 0 22px rgba(101, 254, 109, 0.92),
    0 0 64px rgba(65, 243, 33, 0.72),
    0 0 120px rgba(15, 255, 76, 0.55);
  transform: scale(1.04);
}

@keyframes login-fx-left {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-100%);
  }
}

@keyframes login-fx-right {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(0);
  }
}

.login-container {
  width: 100%;
  max-width: 400px;
  border-radius: 28px;
  overflow: hidden;
  position: relative;
  z-index: 2;
  background: rgba(15, 23, 42, 0.08);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.03),
    0 24px 60px rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(8px);
}

.login-card {
  width: 100%;
  background: transparent;
  padding: 22px 35px 18px;
  border-radius: 22px;
}

.login-card--center {
  background:
    linear-gradient(180deg, rgba(2, 6, 23, 0.36), rgba(2, 6, 23, 0.46));
  border: 1px solid rgba(148, 163, 184, 0.1);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 14px 36px rgba(0, 0, 0, 0.45);
}

.body-login .form-group label {
  color: rgba(226, 232, 240, 0.42);
  opacity: 0.72;
  transition: color 0.18s ease, opacity 0.18s ease;
}

.body-login .form-group:focus-within label {
  color: rgba(229, 231, 235, 0.96);
  opacity: 1;
}

.body-login .form-group input,
.body-login .form-group select,
.body-login .form-group textarea {
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(2, 6, 23, 0.16);
  backdrop-filter: blur(8px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.body-login .toggle-password {
  color: rgba(226, 232, 240, 0.5);
}

.login-card-logo {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  width: auto !important;
  display: grid;
  place-items: center;
  height: auto !important;
  margin: 0 auto 25px !important;
}

.login-card-logo img {
  width: 200px;
  height: auto;
  display: block;
}

.login-card h2 {
  margin: 0 0 14px;
  text-align: center;
  letter-spacing: 0.04em;
}

/* Inputs un poquito más altos para look “app” */
.login-card .form-group input {
  padding: 10px 12px;
  border-radius: 12px;
}

/* Botón tipo “Entrar” como app */
.login-card .btn.full-width {
  padding: 11px 16px;
  border-radius: 14px;
}



/* ---------- FORMULARIOS ---------- */

.form-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 12px;
}

.form-group label {
  font-size: 0.9rem;
  margin-bottom: 4px;
  color: var(--text-muted);
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-soft);
  background: #020617;
  color: var(--text-main);
  outline: none;
  font-size: 0.95rem;
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-icon input {
  width: 100%;
  padding-right: 36px;
}

.toggle-password {
  position: absolute;
  right: 10px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 1rem;
}

/* Ocultar el botón del ojito cuando no haya texto */
.toggle-password.hidden-eye {
  opacity: 0;
  pointer-events: none;
}

/* Asegurar espacio a la derecha del input para el ojito */
.input-with-icon input {
  padding-right: 2.5rem;
}


.toggle-password i {
  pointer-events: none; /* Para que el click cuente sobre el botón, no sobre el ícono */
}


.toggle-password:hover {
  color: var(--text-main);
}

/* Select estilizado */
.form-group select {
  padding: 8px 36px 8px 12px;
  border-radius: 999px;
  background:
    radial-gradient(circle at top, rgba(34, 197, 94, 0.15), transparent 55%) padding-box,
    #020617;
  border: 1px solid rgba(34, 197, 94, 0.7);
  color: var(--text-main);
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5 7L10 12L15 7' stroke='%239ca3af' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px 16px;
}

.form-group select:focus {
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.45);
}

/* Opciones del desplegable (se respeta en la mayoría de navegadores modernos) */
.form-group select option {
  background-color: #020617;
  color: var(--text-main);
  padding: 8px 10px;
}

.form-group select option:not(:last-child) {
  border-bottom: 1px solid rgba(34, 197, 94, 0.4);
}



.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.4);
}

/* ---------- BOTONES ---------- */

.btn {
  border: none;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 0.95rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform var(--transition), box-shadow var(--transition),
    background var(--transition), color var(--transition), border var(--transition);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.72;
  transform: none !important;
  box-shadow: none !important;
}

.btn.is-busy {
  gap: 8px;
}

.btn-spinner {
  width: 0.95rem;
  height: 0.95rem;
  border-radius: 999px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  display: inline-flex;
  flex-shrink: 0;
  animation: btn-spin 0.8s linear infinite;
}

@keyframes btn-spin {
  to {
    transform: rotate(360deg);
  }
}

.btn.primary {
  background: var(--accent);
  color: #022c22;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(34, 197, 94, 0.45);
}

.btn.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 40px rgba(34, 197, 94, 0.6);
}

.btn.secondary {
  background: var(--bg-soft);
  color: var(--text-main);
  border: 1px solid var(--border-soft);
}

.btn.secondary:hover {
  background: #020617;
}

.btn.ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px dashed var(--border-soft);
}

.btn.small {
  padding: 4px 10px;
  font-size: 0.8rem;
  min-height: 30px;
}

.btn.full-width {
  width: 100%;
}

.btn.danger {
  background: rgba(248, 113, 113, 0.12);
  color: #fecaca;
  border: 1px solid #f97373;
}

/* ---------- MENSAJES ---------- */

.error-message {
  color: var(--danger);
  font-size: 0.85rem;
  min-height: 18px;
}

/* Ajuste específico para el modal de préstamo */
#loan-form-error {
  min-height: 0;
  margin: 0;
}

.hidden {
  display: none !important;
}

/* ---------- DASHBOARD ---------- */

.body-dashboard {
  min-height: 100vh;
  background: radial-gradient(circle at top, #1f2933, #020617);
}

.dashboard-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */

.sidebar {
  width: var(--sidebar-width);
  background: rgba(15, 23, 42, 0.98);
  border-right: 1px solid var(--border-soft);
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.sidebar-logo {
  width:42px;
  height: 42px;
  border-radius: 14px;
  background: radial-gradient(circle at top, var(--accent), #16a34a);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #022c22;
}

.sidebar-title {
  font-weight: 700;
  letter-spacing: 0.12em;
  font-size: 0.95rem;
  text-transform: uppercase;
  color: var(--text-muted);
}

.sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: auto;
}

.menu-item {
  text-align: left;
  padding: 8px 12px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  transition: background var(--transition), color var(--transition),
    transform var(--transition);
}

.sidebar-menu .menu-item{
  display: grid;
  grid-template-columns: 42px 1fr;
  column-gap: 14px;
  align-items: center;
  min-height: 48px;
  padding: 12px 14px;
}

/* (3) Icono centrado en su columna */
.sidebar-menu .menu-item i{
  justify-self: center;
  font-size: 1.08rem;
}

/* (4) Texto centrado en su zona */
.sidebar-menu .menu-item .menu-text{
  text-align: left;
  display: block;
  font-size: 1rem;
  font-weight: 600;
}

.menu-item:hover {
  background: rgba(15, 23, 42, 0.9);
  color: var(--text-main);
}

.menu-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  transform: translateX(2px);
}

.logout-btn {
  margin-top: 16px;
}

/* Main */

.main-content {
  flex: 1;
  min-width: 0;
  padding: 20px 18px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.main-header{
  position: sticky;
  top: 0;
  z-index: 60;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  padding: 12px 14px;
  box-shadow: 0 14px 36px rgba(0,0,0,0.45);
  backdrop-filter: blur(6px);

  display:flex;
  justify-content: space-between;
  align-items:center;
  gap: 12px;
}

.main-header h1{
  margin: 0;
  font-size: 1.35rem; /* <-- tamaño del título */
  letter-spacing: 0.02em;
}

.content-section {
  display: none;
  flex-direction: column;
  gap: 12px;
}

.content-section.active {
  display: flex;
}

/* Cards y tablas */

.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.5);
  overflow: visible;
}

.table-card {
  overflow-x: auto;
}

/* =========================
   SCROLLBARS OSCUROS GLOBALES
   ========================= */

.table-card,
.client-detail-box,
.lp-payments-wrapper,
.sidebar,
.cashbox-table-card {
  scrollbar-width: thin;
  scrollbar-color: #1f2937 #020617;
}

.table-card::-webkit-scrollbar,
.client-detail-box::-webkit-scrollbar,
.lp-payments-wrapper::-webkit-scrollbar,
.sidebar::-webkit-scrollbar,
.cashbox-table-card::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.table-card::-webkit-scrollbar-track,
.client-detail-box::-webkit-scrollbar-track,
.lp-payments-wrapper::-webkit-scrollbar-track,
.sidebar::-webkit-scrollbar-track,
.cashbox-table-card::-webkit-scrollbar-track {
  background: #020617;
}

.table-card::-webkit-scrollbar-thumb,
.client-detail-box::-webkit-scrollbar-thumb,
.lp-payments-wrapper::-webkit-scrollbar-thumb,
.sidebar::-webkit-scrollbar-thumb,
.cashbox-table-card::-webkit-scrollbar-thumb {
  background: #1f2937;
  border-radius: 999px;
}

.table-card::-webkit-scrollbar-corner,
.client-detail-box::-webkit-scrollbar-corner,
.lp-payments-wrapper::-webkit-scrollbar-corner,
.sidebar::-webkit-scrollbar-corner,
.cashbox-table-card::-webkit-scrollbar-corner {
  background: #020617;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

#users-table {
  min-width: 760px;
}

#clients-table {
  min-width: 980px;
}

#clients-table th:nth-child(4),
#clients-table th:nth-child(5),
#clients-table td:nth-child(4),
#clients-table td:nth-child(5) {
  text-align: center;
}

#loans-table {
  min-width: 1180px;
}

#cashbox-table {
  min-width: 760px;
}

.table th,
.table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-soft);
  white-space: nowrap;
}

.table thead th {
  text-align: left;
  font-weight: 500;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.table tbody tr:hover {
  background: rgba(15, 23, 42, 0.8);
}

/* Fila de préstamo vencido (fecha FIN pasada y status = open) */
.tr-loan-overdue {
  background-color: #3b1218;   /* rojo oscuro para que combine con tu tema */
}

.tr-loan-overdue td {
  color: #ffecec;              /* texto claro para que se lea bien */
}

.loans-total-row td {
  background: #020617;
  border-top: 1px solid rgba(34, 197, 94, 0.45);
  font-weight: 700;
}

.loans-total-label {
  color: var(--text-muted);
}

.loans-total-value {
  color: #bbf7d0;
}


.toolbar {
  margin-bottom: 10px;
}

.section-toolbar,
.clients-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.search-input-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #020617;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  padding: 8px 12px;
  min-height: 44px;
  max-width: 400px;
  width: 100%;
}

.search-input-wrapper:focus-within {
  border-color: rgba(34, 197, 94, 0.6);
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.2);
}

.search-input-wrapper .search-icon {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.search-input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  color: var(--text-main);
  font-size: 0.9rem;
}

.search-clear-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}


.toolbar input {
  width: 100%;
}

/* ---------- RESPONSIVE ---------- */

/* =========================
   LOGIN FIX (móvil/tablet)
   ========================= */

/* En tablet y móvil quitamos el "cuadro exterior" (login-container) */
@media (max-width: 900px) {
  .login-container {
    background: transparent !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    overflow: visible !important;
  }

  /* Quitamos el logo de arriba (login-left) para no duplicar */

  /* Dejamos solo el card interno como el único cuadro */
}

/* En móvil: el recuadro del logo que sea SOLO la imagen */
@media (max-width: 600px) {
  .body-login {
    padding: 14px;
  }

  .login-container {
    max-width: 320px;
    width: 100%;
  }

  .login-card {
    padding: 18px 16px 14px;
  }

  .login-card-logo {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    width: auto !important;
    height: auto !important;
    margin: 0 auto 18px !important;
  }

  .login-card-logo img {
    width: 170px;
    height: auto;
    display: block;
  }

  .form-group label {
    font-size: 0.78rem;
    margin-bottom: 3px;
  }
}



/* ---------- USER AVATAR Y MENÚ ---------- */

.user-menu-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-user-block {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-welcome {
  color: var(--text-main);
  font-size: 0.98rem;
  font-weight: 600;
  white-space: nowrap;
}

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  background: radial-gradient(circle at top, var(--accent-soft), #020617);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  color: var(--text-main);
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
}

.user-avatar span {
  pointer-events: none;
}

.user-dropdown {
  position: absolute;
  right: 0;
  top: 46px;
  min-width: 180px;
  background: var(--bg-card);
  border-radius: 14px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.8);
  padding: 6px;
  z-index: 20;
}

.user-dropdown-item {
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border-radius: 10px;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 0.9rem;
  cursor: pointer;
}

.user-dropdown-item:hover {
  background: rgba(15, 23, 42, 0.9);
}

/* ---------- MODAL CAMBIAR CONTRASEÑA ---------- */

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 120;
  padding: 18px;
  overscroll-behavior: contain;
}

/* Backdrop para MODALES (no sidebar) */
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(4px);
}

.modal-box {
  position: relative;
  max-width: 400px;
  width: 90%;
  z-index: 50;
  max-height: calc(100vh - 36px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}

.modal-box:focus {
  outline: none;
}

.modal-box h3 {
  margin-top: 0;
  margin-bottom: 12px;
}

.modal-divider {
  border: none;
  height: 1px;
  margin: 0 0 18px;
  background: linear-gradient(
    90deg,
    rgba(34, 197, 94, 0.04),
    rgba(148, 163, 184, 0.48),
    rgba(34, 197, 94, 0.04)
  );
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}

/* Modal específico de PRÉSTAMOS */
.loan-modal-box {
  width: min(92vw, 460px);
  max-width: 460px;
}

/* Layout vertical del formulario de préstamo */
.loan-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.loan-form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.loan-form-row-centered {
  grid-template-columns: minmax(0, 220px);
  justify-content: center;
}

.loan-interest-group label {
  text-align: center;
  font-size: 0.95rem;
}

.loan-form-row-summary input {
  text-align: center;
}

/* Fila del interés: botones - / + y valor centrado y compacto */
.loan-interest-row {
  display: flex;
  align-items: center;
  justify-content: center;   /* centra el conjunto en la celda */
  gap: 6px;
}

/* Botones - y + más pequeños y cuadrados */
.loan-interest-row button {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 999px;
  font-size: 1rem;
}

/* Campo del porcentaje más estrecho y sin estirarse */
.loan-interest-row input {
  flex: 0 0 96px;
  width: 96px;
  max-width: 100%;
  text-align: center;
}

/* Botones del modal de préstamo centrados */
.loan-modal-actions {
  justify-content: center;
  margin-top: 2px;
}


/* =========================
   Toast notifications
   ========================= */

.toast-container {
  position: fixed;
  top: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100vw - 24px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  z-index: 200;
  pointer-events: none;
}


.toast {
  width: max-content;
  max-width: min(420px, calc(100vw - 24px));
  padding: 0.75rem 1rem;
  border-radius: 999px;
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: radial-gradient(circle at top left, rgba(34, 197, 94, 0.14), transparent 55%),
    rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.4);
  color: #e5e7eb;
  box-shadow: 0 10px 40px rgba(15, 23, 42, 0.9);
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.2s ease-out, transform 0.2s ease-out;
  margin: 0 auto;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast-success {
  border-color: #22c55e;
}

.toast-success i {
  color: #22c55e;
}

.toast-error {
  border-color: #f97373;
  color: #fee2e2;
}

.toast-error i {
  color: #f97373;
}

.table-empty-cell {
  padding: 20px 12px !important;
  text-align: center;
  color: var(--text-muted);
  white-space: normal;
}

.table-limit-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 12px;
  padding: 14px 12px 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.table-limit-count {
  color: var(--text-muted);
  flex: 0 0 auto;
}

.table-footer-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 10px;
  flex: 0 0 auto;
}

.table-limit-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.table-limit-control select {
  min-width: 96px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background:
    #020617
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E")
    no-repeat right 14px center;
  color: var(--text-main);
  padding: 8px 38px 8px 12px;
  outline: none;
  appearance: none;
}

.table-limit-control select:focus {
  border-color: var(--accent);
}

.table-pagination {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.table-page-btn {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: #020617;
  color: var(--text-main);
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition), opacity var(--transition);
}

.table-page-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.table-page-btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.table-page-info {
  min-width: 104px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.86rem;
}

.movements-empty-card {
  text-align: center;
  color: var(--text-muted);
}
/* ---------- Toolbar clientes + búsqueda ---------- */


/* Detalle de cliente: lista de préstamos */

.client-detail-box {
  max-width: 860px;
  width: min(92vw, 860px);
  max-height: 80vh;
  overflow-y: auto;
}

.client-loans-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.client-loan-item {
  border-radius: 14px;
  padding: 10px 12px;
  background: #020617;
  border: 1px solid var(--border-soft);
}

.client-loan-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 0.85rem;
}

.client-loan-status {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
}

.client-loan-status.status-open {
  background: rgba(34, 197, 94, 0.12);
  color: #bbf7d0;
}

.client-loan-status.status-closed {
  background: rgba(55, 65, 81, 0.8);
  color: #e5e7eb;
}

.client-loan-dates {
  color: var(--text-muted);
}

.client-loan-body {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 4px 12px;
  font-size: 0.85rem;
}

.client-loan-body div strong {
  font-weight: 600;
}

.client-loan-payments {
  margin: 8px 0 0;
  padding-left: 16px;
  font-size: 0.8rem;
  color: var(--text-muted);
}


/* Píldora de estado de usuario */
.user-status-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
}

/* Píldora de tipo de usuario */
.user-type-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.user-type-pill.type-admin {
  background: rgba(249, 115, 22, 0.18);
  color: #fed7aa;
}

.user-type-pill.type-user {
  background: rgba(107, 114, 128, 0.22);
  color: #e5e7eb;
}

/* Activo: verde transparente */
.user-status-pill.status-active {
  background: rgba(34, 197, 94, 0.15);   /* verde suave */
  color: #bbf7d0;
}

/* Inactivo: naranja transparente */
.user-status-pill.status-inactive {
  background: rgba(249, 115, 22, 0.18);  /* naranja suave */
  color: #fed7aa;
}

/* Botón rectangular de icono (editar) */
.btn-icon-rect {
  border-radius: 10px;
  min-width: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Botón para habilitar / inhabilitar */
.btn-status-toggle {
  border-radius: 10px;
  min-width: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-icon-rect i,
.btn-status-toggle i {
  pointer-events: none;
}

/* Si el usuario está ACTIVO → mostrar X roja */
.btn-status-toggle.status-active-btn {
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid #f97373;
  color: #fecaca;
}

/* Si el usuario está INACTIVO → mostrar visto verde */
.btn-status-toggle.status-inactive-btn {
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid var(--accent);
  color: #bbf7d0;
}

.table-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 8px;
}

.btn-action,
.btn-icon-rect,
.btn-status-toggle,
.btn-trash,
.btn-pay-action,
#loan-payment-modal .lp-payments-list .btn.danger {
  width: 36px;
  min-width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 10px !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.btn-action i,
.btn-icon-rect i,
.btn-status-toggle i,
.btn-trash i,
.btn-pay-action i,
#loan-payment-modal .lp-payments-list .btn.danger i {
  pointer-events: none;
  font-size: 0.95rem !important;
  line-height: 1;
}

.btn-action-secondary {
  background: rgba(15, 23, 42, 0.88);
  color: #dbeafe;
  border: 1px solid rgba(148, 163, 184, 0.22);
}

.btn-action-secondary:hover {
  background: rgba(30, 41, 59, 0.96);
}

.btn-pay-action {
  background: rgba(0, 123, 255, 0.12);
  color: #0b66c2;
  border: 1px solid rgba(11, 102, 194, 0.55);
}

.btn-pay-action:hover {
  background: rgba(11, 102, 194, 0.18);
}

/*-------------- Calendario de préstamos (FullCalendar)-------------------------*/
.loan-date-group {
  position: relative; /* referencia para el popup */
}

.loan-calendar {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 260;
  width: 100%;
  max-width: 100%;
  max-height: min(360px, calc(100vh - 24px));
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.65);
  background: #ffffff;
  overflow: auto;
  overscroll-behavior: contain;
  touch-action: manipulation;
  -webkit-overflow-scrolling: touch;
  font-size: 0.82rem;
  color: #020617;
}

.calendar-tap-shield {
  position: fixed;
  inset: 0;
  z-index: 255;
  background: transparent;
}

.calendar-tap-shield.hidden {
  display: none;
}

/* oculta el popup */
.loan-calendar.hidden {
  display: none;
}

/* Estilo general compacto */
.loan-calendar .fc {
  background: #ffffff;
  color: #111827;
  font-size: 0.8rem;        /* <-- tamaño base de letra */
  width: 100%;
}

/* Barra superior (mes, botones prev/next) */
.loan-calendar .fc-toolbar {
  padding: 4px 8px;
  font-size: 0.8rem;
  align-items: center;
}

.loan-calendar .fc-toolbar-title {
  color: #111827;
  font-size: 1rem;       /* <-- tamaño del título del mes */
}

/* Botones prev/next más pequeños */
.loan-calendar .fc-button {
  background: #e5e7eb;
  border: 1px solid #d1d5db;
  color: #111827;
  padding: 2px 6px;
  font-size: 0.80rem;
  line-height: 1;
}

.loan-calendar .fc-button-primary:not(:disabled).fc-button-active,
.loan-calendar .fc-button-primary:not(:disabled):active {
  background: #d1d5db;
  border-color: #9ca3af;
}

/* Celdas del calendario más compactas */
.loan-calendar .fc-daygrid-day-frame {
  min-height: 15px;
  height: 45px;
  padding: 1px 1px;
}

.loan-calendar .fc-daygrid-day-top {
  justify-content: flex-end;
  align-items: flex-start;
}

.loan-calendar .fc-daygrid-day-number {
  color: #111827;
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1;
  padding: 1px 2px 0 0;
}

.loan-calendar .fc-scrollgrid-sync-table {
  width: 100% !important;
  table-layout: fixed;
  height: auto !important;
}

.loan-calendar .fc-scrollgrid,
.loan-calendar .fc-col-header,
.loan-calendar .fc-daygrid-body,
.loan-calendar .fc-daygrid-body table {
  width: 100% !important;
}

.loan-calendar td,
.loan-calendar th {
  width: 14.2857%;
  vertical-align: top;
}

/* --- FIX: asegurar que se vean los iconos de las acciones en tablas --- */
.table td .btn {
  font-size: 0.85rem !important;      /* el botón vuelve a tener texto/icono visible */
}

.table td .btn i {
  display: inline-block !important;   /* por si alguna regla los ponía en display:none */
  font-size: 0.9rem !important;       /* tamaño claro del icono */
  line-height: 1 !important;
  color: inherit !important;          /* usa el color del botón: verde/rojo, etc. */
}

/* Caja principal del modal de abonos */
.loan-payment-box {
  max-width: 520px;
}

/* Botón X del modal (arriba a la derecha) */
.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
}

.modal-close:hover {
  color: #ffffff;
}

/* Info del préstamo (cliente, cédula, montos, etc.) */
/* Info del préstamo (cliente, cédula, montos, etc.) */
.lp-info {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 16px;
  font-size: 0.9rem;
  margin-top: 6px;
  margin-bottom: 12px;
}

/* Historial de abonos */
.lp-payments-section {
  margin-top: 8px;
  margin-bottom: 8px;
}

.lp-payments-header {
  display: grid;
  grid-template-columns: 90px 110px minmax(0, 1fr) 60px;
  gap: 8px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #9ca3af;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.35);
}

.lp-payments-wrapper {
  max-height: 150px;
  overflow-y: auto;
  margin-top: 4px;
  padding-right: 18px;
  margin-right: -14px;
  scrollbar-gutter: stable both-edges;
}

.lp-payments-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.8rem;
}

.lp-payments-list li {
  display: grid;
  grid-template-columns: 90px 110px minmax(0, 1fr) 60px;
  gap: 8px;
  align-items: center;
  padding: 4px 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.lp-payments-list li:last-child {
  border-bottom: none;
}


.lp-payments-empty {
  padding: 6px 0;
  font-size: 0.8rem;
  color: #9ca3af;
}

/* Fila con label + botones al mismo nivel */
.lp-add-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

/* Ocultar filas de deuda actual y pago diario */
.lp-hidden-row {
  display: none;
}


/* botón abonar (azul semitransparente) */
/* ===== Overrides finales para modal "Abonar préstamo" ===== */

/* línea divisora igual que las tablas */
#loan-payment-modal .loan-payment-box hr {
  border: none;
  border-top: 1px solid var(--border-soft);
  margin: 8px 0;
}

/* Botones Salir / Abonar alineados al lado derecho del label */
#loan-payment-modal .lp-add-actions {
  display: flex;
  gap: 8px;
}

/* Input del abono a lo ancho, como los demás campos largos */
#loan-payment-modal .lp-add input {
  width: 100%;
  max-width: 100%;
}


/* Historial: tabla con scrollbar */
#loan-payment-modal .lp-payments-section {
  margin: 6px 0 10px;
}

#loan-payment-modal .lp-payments-header {
  display: grid;
  grid-template-columns: 0.7fr 1.3fr 1.6fr 0.6fr;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-top: 6px;
}

#loan-payment-modal .lp-payments-header span:last-child {
  text-align: right;
}

#loan-payment-modal .lp-payments-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.85rem;
}

#loan-payment-modal .lp-payments-list li {
  display: grid;
  grid-template-columns: 0.7fr 1.3fr 1.6fr 0.6fr;
  align-items: center;
  padding: 5px 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
}

#loan-payment-modal .lp-payments-list li:last-child {
  border-bottom: none;
}

#loan-payment-modal .lp-payments-list span:nth-child(4) {
  text-align: right;
  display: flex;
  justify-content: flex-end;
}

#loan-payment-modal .lp-payments-header span:last-child {
  display: flex;
  justify-content: flex-end;
}

#loan-payment-modal .lp-payments-empty {
  padding: 6px 0;
  color: var(--text-muted);
}

/* Botón de tacho dentro del modal, igual al de las tablas */
#loan-payment-modal .lp-payments-list .btn.danger {
  width: 36px;
  min-width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
}

#loan-payment-modal .lp-payments-list .btn.danger i {
  font-size: 0.95rem;
  color: inherit;
}

/* ===== Detalle de préstamos cerrados por cliente ===== */

.client-detail-header {
  margin-bottom: 10px;
  font-size: 0.9rem;
}

.client-detail-header p {
  margin: 2px 0;
}

.client-detail-empty {
  margin-top: 6px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.client-closed-loans {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Cabecera tipo tabla */
.client-closed-loans-header {
  display: grid;
  grid-template-columns: 0.9fr 0.9fr 1fr 1.45fr 1.45fr auto;
  align-items: center;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #b6c2d4;
  padding: 0 4px 4px;
  margin-bottom: 2px;
}

/* Cada registro */
.client-closed-loan {
  background: #020617;
  border-radius: 14px;
  border: 1px solid var(--border-soft);
  padding: 8px 10px 6px;
}

.client-closed-loan-row {
  display: grid;
  grid-template-columns: 0.9fr 0.9fr 1fr 1.45fr 1.45fr auto;
  align-items: center;
  text-align: center;
  column-gap: 8px;
  font-size: 0.85rem;
}

.client-closed-loan-row span {
  display: block;
}

/* Botón de la flecha a la derecha */
.client-closed-loan-toggle {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 1.1rem;
  color: var(--text-muted);
  justify-self: end;
  transition: transform 0.15s ease;
}

.client-closed-loan-toggle.open i {
  transform: rotate(180deg);
}

@media (max-width: 900px) {
  .client-detail-box {
    width: min(96vw, 860px);
  }

  .client-closed-loans-header,
  .client-closed-loan-row {
    grid-template-columns: 0.95fr 0.95fr 1.05fr 1.35fr 1.35fr auto;
    column-gap: 6px;
    font-size: 0.8rem;
  }
}

/* Contenedor de abonos */
.client-closed-loan-payments {
  margin-top: 8px;
}

/* Separador entre préstamos */
.client-closed-loan-divider {
  margin: 6px 0 0;
  border: 0;
  border-top: 1px solid rgba(148, 163, 184, 0.25);
}

/* =========================
   Override FINAL - Nuevo abono
   ========================= */

/* Contenedor: input + botones en la misma fila */
#loan-payment-modal .lp-add {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  margin-top: 10px;
  margin-bottom: 10px;
}

/* Columna del label + input (como .form-group) */
#loan-payment-modal .lp-add-field {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Label con el mismo estilo que los demás */
#loan-payment-modal .lp-add-label {
  font-size: 0.9rem;
  margin-bottom: 4px;
  color: var(--text-muted);
}

/* Input del abono con EL MISMO estilo base de los otros campos */
#loan-payment-modal #lp-new-amount {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-soft);
  background: #020617;
  color: var(--text-main);
  outline: none;
  font-size: 0.95rem;
  width: 100%;
}

/* Mismo efecto al enfocar que los inputs normales */
#loan-payment-modal #lp-new-amount:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.4);
}

/* Botones Salir / Abonar alineados a la derecha y centrados verticalmente */
#loan-payment-modal .lp-add-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

/* =========================
   DASHBOARD RESPONSIVE NAV
   ========================= */

.header-left{
  display:flex;
  align-items:center;
  gap:10px;
}

.hamburger-btn{
  display:none;                 /* visible solo en móvil */
  width:40px;
  height:40px;
  border-radius: 12px;
  border:1px solid var(--border-soft);
  background: rgba(15, 23, 42, 0.7);
  color: var(--text-main);
  cursor:pointer;
  align-items:center;
  justify-content:center;
  box-shadow: 0 10px 25px rgba(0,0,0,.35);
}

.hamburger-btn i{ font-size: 1.05rem; }

/* Overlay para SIDEBAR (móvil) */
.sidebar-overlay{
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.55);
  backdrop-filter: blur(2px);
  z-index: 80;
}

.sidebar-footer-btn{
  width:100%;
  text-align:left;
  padding: 13px 15px;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.03));
  color: var(--text-main);
  cursor:pointer;
  display:flex;
  align-items:center;
  gap:12px;
  font-weight: 600;
  box-shadow: 0 10px 24px rgba(0,0,0,0.25);
}

.sidebar-footer-btn:hover{
  background: rgba(15, 23, 42, 0.9);
}

.sidebar-footer-btn.danger{
  border-color: rgba(249,115,115,.65);
  background: rgba(248, 113, 113, 0.10);
  color: #fee2e2;
}

/* ====== Breakpoint móvil/tablet (sidebar off-canvas) ====== */
@media (max-width: 900px){

  /* Sidebar pasa a drawer */
  .sidebar{
    position: fixed;
    top:0;
    left:0;
    height: 100vh;
    width: min(82vw, 320px);
    z-index: 80;
    transform: translateX(-105%);
    transition: transform .22s ease;
  }
  .sidebar.open{
    transform: translateX(0);
  }

  /* Layout: el main ocupa todo */
  .dashboard-layout{
    display:block;
  }

  .main-content{
    padding: 18px 14px 26px;
  }

  .modal {
    padding: 12px;
    align-items: flex-start;
    overflow-y: auto;
  }

  .modal-box {
    width: min(96vw, 640px);
    margin: auto;
  }

  .loan-payment-box,
  .client-detail-box {
    width: min(96vw, 760px);
  }

  .loan-modal-box {
    width: min(96vw, 460px);
  }

  .loan-form-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .loan-form-row-centered {
    grid-template-columns: minmax(0, 240px);
  }

  .lp-info {
    grid-template-columns: 1fr;
  }

  #loan-payment-modal .lp-payments-header,
  #loan-payment-modal .lp-payments-list li {
    grid-template-columns: 0.8fr 1fr 1.25fr auto;
    column-gap: 10px;
  }

  #loan-payment-modal .lp-add-row {
    flex-direction: column;
    align-items: stretch;
  }

  #loan-payment-modal .lp-add-actions {
    justify-content: stretch;
  }

  #loan-payment-modal .lp-add-actions .btn {
    flex: 1 1 0;
  }
  
   /* Botones más grandes y fáciles de tocar */
  .sidebar-footer-btn{
    min-height: 48px;         /* <-- alto tocable */
    padding: 12px 14px;       /* <-- más aire */
    border-radius: 16px;
    font-size: 1rem;          /* <-- letra más grande */
    gap: 12px;                /* <-- separa icono y texto */
  }

  .sidebar-footer-btn i{
    font-size: 1.05rem;       /* <-- icono ligeramente más grande */
    width: 22px;              /* <-- “columna” fija del icono */
    text-align: center;
  }
}

/* ====== Tablet (opcional: más aire) ====== */
@media (max-width: 1100px){
  .table{
    font-size: 0.88rem;
  }
}


/* =========================================================
   ✅ SIDEBAR RESPONSIVE + OVERLAY + FOOTER SOLO EN MÓVIL
   (NO adivina nada: depende de tus IDs y clases actuales)
   ========================================================= */

/* En desktop: overlay no se ve (aunque exista en el HTML) */
@media (min-width: 901px){
  .sidebar-overlay{ display:none !important; }
}

/* Footer del sidebar:
   ✅ En desktop NO debe aparecer (porque ya tienes dropdown arriba) */
.sidebar-footer{
  display: none; /* <-- desktop: oculto */
}

/* -------------------------
   ✅ MÓVIL / TABLET
   ------------------------- */
@media (max-width: 900px){

  /* Mostrar hamburguesa en móvil */
  .hamburger-btn{
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* En móvil: ocultar el avatar/círculo del topbar
     (ya están las acciones en el sidebar footer) */
.user-menu-wrapper{
  display: none !important;
}

.topbar-welcome {
  font-size: 0.92rem;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}

  /* Sidebar como drawer */
  .sidebar{
    position: fixed;
    top: 0;
    left: -110%;
    height: 100vh;
    z-index: 90;
    transition: left 0.2s ease;
  }

  .sidebar.open{
    left: 0;
  }

  /* Footer del sidebar: ahora SÍ se muestra (solo móvil) */
  .sidebar-footer{
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border-soft);
  }

  /* ✅ Botones tocables (más grandes) */
  .sidebar-footer-btn{
    /* --- TAMAÑO del botón (cámbialo aquí) --- */
    padding: 12px 14px;       /* <-- tamaño “tap-friendly” */
    border-radius: 14px;      /* <-- redondez */
    font-size: 1rem;          /* <-- tamaño de letra */
    font-weight: 600;

    /* --- COLORES del botón (cámbialo aquí) --- */
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-soft);
    color: var(--text-main);

    display: flex;
    align-items: center;

    /* --- ESPACIO entre icono y texto (cámbialo aquí) --- */
    gap: 12px;
  }

  .sidebar-footer-btn i{
    font-size: 1.05rem; /* <-- tamaño icono */
  }

  /* Botón peligro (cerrar sesión) */
  .sidebar-footer-btn.danger{
    background: rgba(248, 113, 113, 0.10);
    border: 1px solid rgba(248, 113, 113, 0.55);
    color: #fee2e2;
  }
}

/* =========================
   CAJA CHICA
   ========================= */

.cashbox-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  overflow: visible;
}

.cashbox-filters {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.cashbox-filter-group {
  min-width: 160px;
  margin-bottom: 0;
}

.cashbox-filter-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cashbox-modal-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.cashbox-type-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.cashbox-type-pill.type-ingreso {
  background: rgba(34, 197, 94, 0.15);
  color: #bbf7d0;
}

.cashbox-type-pill.type-prestamo {
  background: rgba(248, 113, 113, 0.12);
  color: #fecaca;
  border: 1px solid rgba(249, 115, 115, 0.5);
}

.cashbox-description-input {
  width: 100%;
  min-height: 88px;
  resize: vertical;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.4;
}

@media (max-width: 900px) {
  .cashbox-toolbar {
    align-items: stretch;
  }

  .cashbox-filters {
    width: 100%;
  }

  .cashbox-filter-group {
    flex: 1 1 160px;
  }

  .cashbox-filter-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

/* =========================
   MOVIMIENTOS
   ========================= */

.movements-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.movement-date-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.movement-date-title {
  margin: 0;
  font-size: 1rem;
  color: var(--text-main);
}

.movement-group-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-soft);
  overflow: hidden;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.4);
}

.movement-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-soft);
}

.movement-row:last-child {
  border-bottom: none;
}

.movement-desc {
  min-width: 0;
}

.movement-desc-title {
  font-size: 0.98rem;
  color: var(--text-main);
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.movement-desc-sub {
  margin-top: 4px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.movement-amount {
  text-align: right;
  min-width: 110px;
  font-weight: 700;
  font-size: 1rem;
}

.movement-amount.positive {
  color: #4ade80;
}

.movement-amount.negative {
  color: #f87171;
}

.movement-balance {
  text-align: right;
  min-width: 110px;
  font-size: 0.95rem;
  color: var(--text-main);
}

@media (max-width: 700px) {
  .main-header {
    justify-content: flex-start;
    padding: 10px 12px;
  }

  .header-left {
    min-width: 0;
    gap: 10px;
  }

  .main-header h1 {
    font-size: 1.15rem;
    line-height: 1.1;
  }

  .topbar-user-block,
  .topbar-welcome {
    display: none !important;
  }

  .section-toolbar,
  .clients-toolbar,
  .cashbox-toolbar {
    align-items: stretch;
  }

  .section-toolbar,
  .clients-toolbar {
    flex-direction: column;
    justify-content: flex-start;
    gap: 10px;
  }

  .section-toolbar .btn,
  #btn-add-client {
    align-self: flex-start;
    width: auto;
    max-width: 90%;
    min-width: 0;
    padding-inline: 14px;
    line-height: 1.1;
  }

  .search-input-wrapper,
  .cashbox-filters {
    width: 100%;
    max-width: none;
  }

  .search-input-wrapper {
    min-height: 42px;
    padding: 8px 12px;
  }

  .movement-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .movement-amount,
  .movement-balance {
    text-align: left;
    min-width: 0;
  }

  .table-actions {
    gap: 6px;
  }

  .table-limit-bar {
    padding-inline: 10px;
  }

  .table-page-info {
    min-width: 92px;
    font-size: 0.82rem;
  }

  .loan-calendar {
    max-width: calc(100vw - 16px);
    max-height: min(340px, calc(100vh - 16px));
  }

  .modal-actions {
    flex-wrap: wrap;
  }
}

/* =========================
   MOVIMIENTOS - CARGAR MÁS
   ========================= */

#movements-load-more-wrap {
  margin-top: 2px;
}

#movements-load-more-wrap.hidden {
  display: none !important;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .login-fx-track {
    animation: none !important;
  }
}

