:root {
  --primary: #1a3c5e;
  --primary-light: #2563eb;
  --sidebar-width: 260px;
  --navbar-height: 56px;
  --sidebar-bg: #0f2744;
  --sidebar-text: #cbd5e1;
  --sidebar-hover: rgba(255,255,255,0.08);
  --sidebar-active: rgba(37,99,235,0.25);
  --sidebar-active-border: #3b82f6;
}

* { box-sizing: border-box; }

body {
  font-family: 'Inter', sans-serif;
  background: #f1f5f9;
  font-size: 14px;
}

/* ── NAVBAR TOP ── */
.navbar-top {
  background: var(--primary) !important;
  height: var(--navbar-height);
  z-index: 1050;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* ── SIDEBAR ── */
.sidebar {
  position: fixed;
  top: var(--navbar-height);
  left: 0;
  width: var(--sidebar-width);
  height: calc(100vh - var(--navbar-height));
  background: var(--sidebar-bg);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 1040;
  transition: transform 0.25s ease;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }

.sidebar-header { padding: 16px 0 8px; }

.sidebar-nav {
  list-style: none;
  padding: 0 8px 24px;
  margin: 0;
}

.nav-section {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #64748b;
  padding: 16px 12px 4px;
  text-transform: uppercase;
}

.nav-section-sub {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #94a3b8;
  padding: 10px 16px 2px;
  text-transform: uppercase;
  border-top: 1px solid rgba(255,255,255,0.06);
  margin-top: 4px;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--sidebar-text);
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 400;
  transition: background 0.15s, color 0.15s;
  text-decoration: none;
  white-space: nowrap;
}

.sidebar-nav .nav-link:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.sidebar-nav .nav-link.active {
  background: var(--sidebar-active);
  color: #93c5fd;
  border-left: 3px solid var(--sidebar-active-border);
  font-weight: 500;
}

.sidebar-nav .nav-link i:first-child {
  font-size: 16px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.arrow { font-size: 11px !important; transition: transform 0.2s; }
.nav-link:not(.collapsed) .arrow { transform: rotate(180deg); }

.submenu {
  list-style: none;
  padding: 2px 0 4px 32px;
  margin: 0;
}

.submenu .nav-link.sub {
  font-size: 13px;
  padding: 6px 10px;
  color: #94a3b8;
}
.submenu .nav-link.sub:hover { color: #e2e8f0; background: var(--sidebar-hover); }
.submenu .nav-link.sub.active { color: #93c5fd; }

/* ── MAIN CONTENT ── */
.main-content {
  margin-left: var(--sidebar-width);
  margin-top: var(--navbar-height);
  /* Scroll vertical libre: +200px garantiza pista de aterrizaje en páginas cortas */
  min-height: calc(100vh + 200px - var(--navbar-height));
  padding-bottom: 2rem;
  transition: margin-left 0.25s ease;
}

/* Scroll horizontal de tablas no secuestra el scroll vertical de la página */
.table-responsive {
  overscroll-behavior-x: contain;
}

.sidebar.collapsed { transform: translateX(calc(-1 * var(--sidebar-width))); }
.main-content.expanded { margin-left: 0; }

/* ── BREADCRUMB BAR ── */
.breadcrumb-bar {
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  padding: 10px 24px;
  position: sticky;
  top: var(--navbar-height);
  z-index: 100;
}

.breadcrumb-item + .breadcrumb-item::before { color: #94a3b8; }
.breadcrumb-item a { color: #3b82f6; text-decoration: none; }
.breadcrumb-item.active { color: #64748b; }

/* ── CONTENT WRAPPER ── */
.content-wrapper { padding: 24px; }

/* ── CARDS ── */
.card {
  border: none;
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.card-header {
  background: transparent;
  border-bottom: 1px solid #f1f5f9;
  font-weight: 600;
  padding: 16px 20px;
}

/* ── STATS CARDS ── */
.stat-card {
  border-radius: 12px;
  padding: 20px;
  color: #fff;
  position: relative;
  overflow: hidden;
}
.stat-card .stat-icon {
  font-size: 48px;
  opacity: 0.2;
  position: absolute;
  right: 12px;
  bottom: 4px;
}
.stat-card .stat-value { font-size: 28px; font-weight: 700; line-height: 1; }
.stat-card .stat-label { font-size: 12px; opacity: 0.85; margin-top: 4px; }

.bg-gradient-blue   { background: linear-gradient(135deg, #1d4ed8, #3b82f6); }
.bg-gradient-green  { background: linear-gradient(135deg, #059669, #10b981); }
.bg-gradient-orange { background: linear-gradient(135deg, #d97706, #f59e0b); }
.bg-gradient-red    { background: linear-gradient(135deg, #dc2626, #ef4444); }
.bg-gradient-purple { background: linear-gradient(135deg, #7c3aed, #a78bfa); }
.bg-gradient-teal   { background: linear-gradient(135deg, #0d9488, #2dd4bf); }

/* ── TABLE ── */
.table-finansys th {
  background: #f8fafc;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #64748b;
  border-bottom: 2px solid #e2e8f0;
  padding: 10px 14px;
}
.table-finansys td {
  vertical-align: middle;
  padding: 10px 14px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 13.5px;
}
.table-finansys tbody tr:hover { background: #f8fafc; }

/* ── BUTTONS ── */
.btn-primary { background: var(--primary-light); border-color: var(--primary-light); }
.btn-primary:hover { background: #1d4ed8; border-color: #1d4ed8; }

/* ── LOGIN ── */
.login-bg {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0f2744;
  position: relative;
  overflow: hidden;
  padding: 24px 16px;
}

/* Círculos decorativos de fondo */
.login-bg::before,
.login-bg::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}
.login-bg::before {
  width: 600px;
  height: 600px;
  top: -200px;
  right: -150px;
  background: radial-gradient(circle, rgba(37,99,235,0.25) 0%, transparent 70%);
}
.login-bg::after {
  width: 500px;
  height: 500px;
  bottom: -180px;
  left: -120px;
  background: radial-gradient(circle, rgba(99,102,241,0.2) 0%, transparent 70%);
}

/* Card central */
.login-card {
  position: relative;
  z-index: 1;
  background: #fff;
  border-radius: 20px;
  padding: 44px 40px 36px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.45);
}
@media (max-width: 480px) {
  .login-card { padding: 32px 24px 28px; }
}

/* Logo icon */
.login-icon {
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, #1a3c5e 0%, #2563eb 100%);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  color: #fff;
  margin: 0 auto 20px;
  box-shadow: 0 8px 24px rgba(37,99,235,0.35);
}

/* Campos */
.login-field {
  position: relative;
  margin-bottom: 16px;
}
.login-field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: #475569;
  margin-bottom: 6px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.login-field-wrap {
  position: relative;
}
.login-field-wrap .field-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 16px;
  pointer-events: none;
  z-index: 2;
}
.login-field-wrap input {
  width: 100%;
  height: 48px;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  padding: 0 44px 0 42px;
  font-size: 14px;
  color: #1e293b;
  background: #f8fafc;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  outline: none;
}
.login-field-wrap input:focus {
  border-color: #2563eb;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}
.login-field-wrap input.is-invalid {
  border-color: #ef4444;
  background: #fff8f8;
}
.btn-eye {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 4px;
  color: #94a3b8;
  cursor: pointer;
  font-size: 17px;
  line-height: 1;
  z-index: 2;
  transition: color 0.15s;
}
.btn-eye:hover { color: #2563eb; }

/* Botón ingresar */
.login-submit {
  width: 100%;
  height: 50px;
  background: linear-gradient(135deg, #1a3c5e 0%, #2563eb 100%);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 4px 16px rgba(37,99,235,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
}
.login-submit:hover {
  opacity: 0.93;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(37,99,235,0.45);
}
.login-submit:active { transform: translateY(0); }

/* ── PAGE HEADER ── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.page-title { font-size: 20px; font-weight: 700; color: #1e293b; margin: 0; }
.page-subtitle { font-size: 13px; color: #64748b; margin: 0; }

/* ── SEARCH BAR ── */
.search-bar { position: relative; }
.search-bar input { padding-left: 36px; border-radius: 8px; border: 1px solid #e2e8f0; }
.search-bar .bi-search { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: #94a3b8; }

/* ── PAGINATION ── */
.pagination .page-link { color: #3b82f6; border-color: #e2e8f0; font-size: 13px; }
.pagination .page-item.active .page-link { background: #3b82f6; border-color: #3b82f6; }

/* ── BADGES ── */
.badge-estado { font-size: 11px; padding: 4px 8px; border-radius: 20px; }

/* ── FORM ── */
.form-label { font-weight: 500; font-size: 13px; color: #374151; }
.form-control, .form-select {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 13.5px;
  padding: 8px 12px;
}
.form-control:focus, .form-select:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

/* ── CARD GLOBAL IMPROVEMENTS ── */
/* Todos los card-header con bg-white reciben gradiente sutil */
.card-header.bg-white {
  background: linear-gradient(90deg, #f8fafc, #fff) !important;
}
/* Bordes de card más suaves */
.card {
  border: 1px solid #e9ecef;
  border-radius: 10px !important;
}
.card.shadow-sm {
  box-shadow: 0 1px 6px rgba(0,0,0,.07), 0 0 0 1px rgba(0,0,0,.03) !important;
}
.card-header {
  border-bottom: 1px solid rgba(0,0,0,.06);
  border-radius: 10px 10px 0 0 !important;
}
/* Tables inside cards */
.card .table thead th {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #6b7280;
  border-bottom-width: 1px;
}
.card .table-hover tbody tr:hover {
  background: #f8fafc;
}
/* KPI cards con border-left */
.card[style*="border-left"] {
  border-radius: 10px !important;
  border-top: none !important;
  border-right: none !important;
  border-bottom: none !important;
  overflow: hidden;
}
/* Badges */
.badge { border-radius: 6px !important; font-weight: 600; }
.badge.rounded-pill { border-radius: 20px !important; }
/* List group inside cards */
.card .list-group-item {
  border-left: none;
  border-right: none;
  font-size: 13px;
}
.card .list-group-item:first-child { border-top: none; }
/* Botones */
.btn { border-radius: 8px !important; font-size: 13px; font-weight: 500; }
.btn-lg { border-radius: 10px !important; font-size: 15px; }
.btn-sm { border-radius: 6px !important; font-size: 12px; }
/* Inputs */
.input-group > .form-control,
.input-group > .form-select,
.input-group > .input-group-text {
  border-radius: 0 !important;
}
.input-group > .form-control:first-child,
.input-group > .input-group-text:first-child {
  border-radius: 8px 0 0 8px !important;
}
.input-group > .form-control:last-child,
.input-group > .btn:last-child,
.input-group > .input-group-text:last-child {
  border-radius: 0 8px 8px 0 !important;
}
