/* Select2 en formularios Frean */
.frean-card .select2-container { width: 100% !important; }
.frean-card .select2-container--bootstrap4 .select2-selection--single {
  height: calc(1.5em + 0.75rem + 2px);
  padding: 0.375rem 0.75rem;
  border: 1px solid #ced4da;
  border-radius: 0.25rem;
  background: #fff;
}
.frean-card .select2-container--bootstrap4 .select2-selection--single .select2-selection__rendered {
  line-height: 1.5;
  padding-left: 0;
  color: #495057;
}
.frean-card .select2-container--bootstrap4 .select2-selection--single .select2-selection__arrow {
  height: 100%;
  right: 6px;
}
.frean-card .select2-container--bootstrap4.select2-container--focus .select2-selection--single,
.frean-card .select2-container--bootstrap4.select2-container--open .select2-selection--single {
  border-color: #80bdff;
  box-shadow: 0 0 0 0.2rem rgba(70, 173, 237, 0.25);
}
#items-table .select2-container { min-width: 220px; }

/* Frean PWA — tokens AccesoGym + ajustes ERP */
:root {
  --frean-accent: #46ADED;
  --frean-accent-dark: #359cd9;
  --frean-accent-light: #e4f3fd;
  --frean-text: #2c3e50;
  --frean-muted: #95a5a6;
  --frean-surface: #f8f9fa;
  --frean-card-radius: 16px;
  --frean-card-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

body.admin-nav-rail {
  background: var(--frean-surface);
  color: var(--frean-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.frean-main {
  margin-left: var(--ag-nav-current-width, 4rem);
  margin-top: var(--ag-nav-header-height, 4.25rem);
  min-height: calc(100vh - var(--ag-nav-header-height, 4.25rem));
}

@media (max-width: 767.98px) {
  .frean-main { margin-left: 0; }
}

.frean-brand {
  font-weight: 800 !important;
  letter-spacing: 0.02em;
  color: #fff !important;
  font-size: 1.25rem !important;
}

.frean-nav-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--frean-accent);
  color: #fff !important;
  font-weight: 800;
  font-size: 1.15rem;
  text-decoration: none !important;
}

.ag-sidebar-link.active,
.ag-sidebar-link.is-active,
.ag-sidebar-link.nav-item-active {
  background: var(--ag-nav-active-bg) !important;
  color: var(--ag-nav-active-color) !important;
  box-shadow: inset 3px 0 0 var(--ag-nav-active-color);
}

.ag-sidebar-link.active > i:first-child,
.ag-sidebar-link.is-active > i:first-child,
.ag-sidebar-link.nav-item-active > i:first-child {
  color: var(--ag-nav-active-color);
}

/* Dense rail: icon-only until hover/expand (AccesoGym pattern) */
#ag-admin-sidebar.ag-nav-dense .ag-sidebar-link {
  justify-content: flex-start;
}

.page-header-app h1 {
  font-weight: 800;
  font-size: 1.65rem;
  color: var(--frean-text);
}

.frean-card {
  background: #fff;
  border-radius: var(--frean-card-radius);
  box-shadow: var(--frean-card-shadow);
  border: none;
  padding: 1.25rem;
}

.btn-app-blue {
  background: var(--frean-accent) !important;
  border-color: var(--frean-accent) !important;
  color: #fff !important;
  font-weight: 700;
  border-radius: 12px;
  padding: 0.55rem 1.25rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.btn-app-blue:hover {
  background: var(--frean-accent-dark) !important;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(70, 173, 237, 0.35);
  color: #fff !important;
}

.btn-app-green {
  background: #2ecc71 !important;
  border: none;
  color: #fff !important;
  font-weight: 700;
  border-radius: 12px;
}

.premium-input, .form-control.premium-input {
  height: 42px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}
.premium-input:focus {
  border-color: var(--frean-accent);
  box-shadow: 0 0 0 3px rgba(70, 173, 237, 0.22);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-tile {
  background: #fff;
  border-radius: var(--frean-card-radius);
  box-shadow: var(--frean-card-shadow);
  padding: 1.15rem 1.25rem;
  border-left: 4px solid var(--frean-accent);
}
.stat-tile .label {
  text-transform: uppercase;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--frean-accent);
  margin-bottom: 0.35rem;
}
.stat-tile .value {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--frean-text);
}

.table-shell {
  background: #fff;
  border-radius: var(--frean-card-radius);
  box-shadow: var(--frean-card-shadow);
  padding: 1rem;
  overflow-x: auto;
}
.table-shell table.dataTable thead th {
  border-bottom: 2px solid #eef2f7 !important;
  color: var(--frean-text);
  font-weight: 700;
}
.badge-cae {
  background: var(--frean-accent-light);
  color: var(--frean-accent-dark);
  font-weight: 700;
  border-radius: 8px;
  padding: 0.25rem 0.5rem;
}
.badge-anulado {
  background: #fde8e8;
  color: #c0392b;
  font-weight: 700;
  border-radius: 8px;
  padding: 0.25rem 0.5rem;
}

/* Cheques — vencimiento + estado */
.cheque-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.cheque-pill,
.cheque-vence-badge,
.cheque-estado-badge {
  display: inline-block;
  border-radius: 8px;
  padding: 0.2rem 0.55rem;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
}
.cheque-pill { border: 1px solid transparent; }

.cheque-vence-vencido,
tr.cheque-vence-vencido > td:first-child {
  /* tint row via badge; light row bg */
}
tr.cheque-vence-vencido { background: rgba(192, 57, 43, 0.08); }
tr.cheque-vence-pronto { background: rgba(211, 147, 36, 0.10); }
tr.cheque-vence-mes { background: rgba(52, 152, 219, 0.07); }
tr.cheque-vence-ok { background: transparent; }

.cheque-vence-vencido { background: #fde8e8; color: #c0392b; }
.cheque-vence-pronto { background: #fff3d6; color: #9a6b00; }
.cheque-vence-mes { background: #e4f3fd; color: #1f6fa5; }
.cheque-vence-ok { background: #e8f6ef; color: #1e7a4a; }
.cheque-vence-na { background: #eef1f4; color: #6b7280; }

.cheque-estado-cartera { background: #e4f3fd; color: #1f6fa5; }
.cheque-estado-depositado { background: #e8eaf6; color: #3f4c8c; }
.cheque-estado-cobrado { background: #e8f6ef; color: #1e7a4a; }
.cheque-estado-entregado { background: #f0f3f6; color: #4b5563; }
.cheque-estado-sin-fondo { background: #fde8e8; color: #c0392b; }
.cheque-estado-devuelto { background: #fcebdc; color: #b85c1a; }
.cheque-estado-otro { background: #eef1f4; color: #4b5563; }

/* Reportes */
.report-chart-wrap {
  position: relative;
  height: 280px;
}
.report-chart-wrap.report-chart-sm {
  height: 220px;
}
.stat-tile .value.text-success { color: #1e7a4a !important; }
.stat-tile .value.text-danger { color: #c0392b !important; }

/* Login */
body.frean-login {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(ellipse at 20% 10%, rgba(70, 173, 237, 0.25), transparent 50%),
    radial-gradient(ellipse at 80% 90%, rgba(109, 137, 179, 0.2), transparent 45%),
    linear-gradient(160deg, #2c2f34 0%, #1a1c1f 55%, #2a3340 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}
.login-card {
  width: min(420px, 92vw);
  background: rgba(255, 255, 255, 0.96);
  border-radius: 20px;
  padding: 2rem 1.75rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}
.login-card .brand {
  font-size: 2rem;
  font-weight: 800;
  color: #2c2f34;
  margin-bottom: 0.25rem;
}
.login-card .tagline {
  color: #64748b;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}
