/* ============================================================
   IMPULSO CAPITAL — Enterprise Design System v2.0
   ============================================================ */

:root {
  /* Brand */
  --ic-primary:       #1565C0;
  --ic-primary-dark:  #0D47A1;
  --ic-primary-mid:   #1976D2;
  --ic-primary-light: #E3F2FD;
  --ic-accent:        #0288D1;

  /* Semantic */
  --ic-success:     #2E7D32;
  --ic-success-bg:  #E8F5E9;
  --ic-danger:      #C62828;
  --ic-danger-bg:   #FFEBEE;
  --ic-warning:     #E65100;
  --ic-warning-bg:  #FFF8E1;
  --ic-info:        #0277BD;
  --ic-info-bg:     #E1F5FE;

  /* Neutrals */
  --ic-50:  #F8FAFC;
  --ic-100: #F0F4F8;
  --ic-200: #E4EBF2;
  --ic-300: #C8D6E5;
  --ic-400: #94A8BE;
  --ic-500: #637388;
  --ic-600: #455A72;
  --ic-700: #2E3D4F;
  --ic-800: #1C2B39;
  --ic-900: #0F1922;

  /* Shadows */
  --sh-xs:   0 1px 2px rgba(15,25,34,.06);
  --sh-sm:   0 1px 4px rgba(15,25,34,.08), 0 1px 2px rgba(15,25,34,.04);
  --sh-md:   0 4px 8px rgba(15,25,34,.08), 0 2px 4px rgba(15,25,34,.04);
  --sh-lg:   0 10px 20px rgba(15,25,34,.09), 0 4px 8px rgba(15,25,34,.04);
  --sh-xl:   0 24px 40px rgba(15,25,34,.12), 0 8px 16px rgba(15,25,34,.05);
  --sh-blue: 0 4px 16px rgba(21,101,192,.28);

  /* Radius */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 18px;

  /* Sidebar */
  --lte-sidebar-width: 255px;
}

/* ── Reset / Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', sans-serif;
  background: var(--ic-100);
  color: var(--ic-700);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Skeleton Loader ─────────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: -1000px 0; }
  100% { background-position:  1000px 0; }
}
.sk {
  background: linear-gradient(90deg,
    var(--ic-200) 25%, var(--ic-100) 50%, var(--ic-200) 75%);
  background-size: 2000px 100%;
  animation: shimmer 1.8s infinite linear;
  border-radius: var(--r-sm);
  display: inline-block;
}
.sk-text  { height: 13px; }
.sk-h3    { height: 28px; }
.sk-h4    { height: 22px; }
.sk-badge { height: 22px; width: 72px; border-radius: 20px; }
.sk-btn   { height: 30px; width: 64px; border-radius: var(--r-sm); }
.sk-w25   { width: 25%; }
.sk-w40   { width: 40%; }
.sk-w55   { width: 55%; }
.sk-w70   { width: 70%; }
.sk-w90   { width: 90%; }
.sk-full  { width: 100%; }

/* Skeleton table row */
.sk-row td { padding: 13px 16px !important; }

/* ── Navbar ──────────────────────────────────────────────── */
.app-header {
  z-index: 1034;
  background: #fff !important;
  border-bottom: 1px solid var(--ic-200) !important;
  box-shadow: var(--sh-sm) !important;
}
.avatar-circle {
  width: 34px; height: 34px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; letter-spacing: -.5px;
  background: linear-gradient(135deg, var(--ic-primary), var(--ic-accent));
  color: #fff;
  box-shadow: var(--sh-xs);
}

/* Cash status pill */
.cash-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 20px;
  font-size: 12px; font-weight: 600; cursor: pointer;
  transition: filter .15s;
  text-decoration: none;
}
.cash-pill:hover  { filter: brightness(.93); }
.cash-pill.open   { background: var(--ic-success-bg); color: var(--ic-success); }
.cash-pill.closed { background: var(--ic-danger-bg);  color: var(--ic-danger); }
.cash-pill.loading{ background: var(--ic-100);        color: var(--ic-400); }

/* ── Sidebar ─────────────────────────────────────────────── */
.app-sidebar {
  --lte-sidebar-color:             var(--ic-600);
  --lte-sidebar-hover-color:       var(--ic-primary);
  --lte-sidebar-hover-bg:          var(--ic-primary-light);
  --lte-sidebar-active-color:      var(--ic-primary);
  --lte-sidebar-menu-active-bg:    var(--ic-primary-light);
  --lte-sidebar-menu-active-color: var(--ic-primary);
  background: #fff !important;
  border-right: 1px solid var(--ic-200);
}
.sidebar-brand { border-bottom: 1px solid var(--ic-200); }

.sidebar-menu .nav-link {
  border-radius: var(--r-md);
  margin: 1px 10px;
  padding: 9px 12px 9px 14px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ic-600);
  transition: all .13s ease;
  border-left: 3px solid transparent;
}
.sidebar-menu .nav-link:hover {
  background: var(--ic-primary-light);
  color: var(--ic-primary);
  border-left-color: rgba(21,101,192,.4);
  padding-left: 11px;
}
.sidebar-menu .nav-link.active {
  background: var(--ic-primary-light);
  color: var(--ic-primary);
  font-weight: 600;
  border-left-color: var(--ic-primary);
  padding-left: 11px;
  box-shadow: inset 0 1px 3px rgba(21,101,192,.08);
}
.nav-icon {
  margin-right: 10px; font-size: 1rem;
  width: 18px; text-align: center; display: inline-block;
}
.nav-header {
  font-size: 10px !important; font-weight: 700;
  letter-spacing: 1.8px; color: var(--ic-400) !important;
  padding: 16px 22px 5px !important;
}

/* ── Layout ──────────────────────────────────────────────── */
.app-content { padding: 0 !important; }
.app-main    { background: var(--ic-100); }

.page-hdr {
  padding: 16px 0 14px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--ic-200);
}
.page-hdr h4 { font-size: 1.05rem; color: var(--ic-800); }

/* ── KPI Cards ───────────────────────────────────────────── */
.kpi-card {
  transition: transform .18s ease, box-shadow .18s ease;
  border-radius: var(--r-lg) !important;
  border: 1px solid var(--ic-200) !important;
  overflow: hidden;
}
.kpi-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--sh-lg) !important;
  border-color: var(--ic-300) !important;
}
.kpi-icon {
  width: 48px; height: 48px; border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; flex-shrink: 0;
}
/* Metric trend */
.kpi-trend {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 11px; font-weight: 600;
  padding: 2px 7px; border-radius: 20px;
}
.kpi-trend.up   { background: var(--ic-success-bg); color: var(--ic-success); }
.kpi-trend.down { background: var(--ic-danger-bg);  color: var(--ic-danger); }
.kpi-trend.flat { background: var(--ic-100);         color: var(--ic-400); }

/* ── Alert Strips ────────────────────────────────────────── */
.alert-strip {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-radius: var(--r-md);
  border: none; font-size: 13.5px;
}
.alert-strip-danger  { background: var(--ic-danger-bg);  border-left: 4px solid #EF5350; }
.alert-strip-warning { background: var(--ic-warning-bg); border-left: 4px solid #FFA726; }
.alert-strip-info    { background: var(--ic-info-bg);    border-left: 4px solid #29B6F6; }
.alert-strip-success { background: var(--ic-success-bg); border-left: 4px solid #66BB6A; }

/* ── Cards ───────────────────────────────────────────────── */
.card {
  border-radius: var(--r-lg) !important;
  border: 1px solid var(--ic-200) !important;
  box-shadow: var(--sh-sm) !important;
}
.card-header {
  border-radius: var(--r-lg) var(--r-lg) 0 0 !important;
  padding: 13px 20px !important;
  background: #fff !important;
  border-bottom: 1px solid var(--ic-200) !important;
}
.card-header h6 { font-size: 13px; letter-spacing: .1px; }
.card-footer {
  background: var(--ic-50) !important;
  border-top: 1px solid var(--ic-200) !important;
  border-radius: 0 0 var(--r-lg) var(--r-lg) !important;
  padding: 10px 20px !important;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  border-radius: var(--r-sm);
  font-weight: 500; font-size: 13.5px;
  transition: all .13s ease; letter-spacing: .1px;
}
.btn:active { transform: scale(.97); }
.btn-primary {
  background: var(--ic-primary); border-color: var(--ic-primary);
}
.btn-primary:hover:not(:disabled) {
  background: var(--ic-primary-dark); border-color: var(--ic-primary-dark);
  box-shadow: var(--sh-blue); transform: translateY(-1px);
}
.btn-primary:disabled, .btn-primary.disabled {
  background: var(--ic-400); border-color: var(--ic-400);
  opacity: 1; transform: none; box-shadow: none;
}
.btn-sm { font-size: 12px; padding: 4px 11px; }
.btn-lg { font-size: 15px; padding: 10px 24px; }

/* ── Forms ───────────────────────────────────────────────── */
.form-label {
  font-size: 11px; font-weight: 700;
  color: var(--ic-500); text-transform: uppercase;
  letter-spacing: .8px; margin-bottom: 5px;
}
.form-control, .form-select {
  border-radius: var(--r-sm); border: 1.5px solid var(--ic-300);
  font-size: 13.5px; color: var(--ic-800); background: #fff;
  padding: 8px 12px; height: auto;
  transition: border-color .13s, box-shadow .13s;
}
.form-control:hover, .form-select:hover {
  border-color: var(--ic-400);
}
.form-control:focus, .form-select:focus {
  border-color: var(--ic-primary); background: #fff;
  box-shadow: 0 0 0 3px rgba(21,101,192,.1); color: var(--ic-800);
  outline: none;
}
.form-control::placeholder { color: var(--ic-400); font-size: 13px; }
.form-control.is-invalid, .form-select.is-invalid {
  border-color: #EF5350; box-shadow: 0 0 0 3px rgba(239,83,80,.1);
}
.form-control.is-valid, .form-select.is-valid {
  border-color: #43A047; box-shadow: 0 0 0 3px rgba(67,160,71,.1);
}
.invalid-feedback { font-size: 11.5px; color: #e53935; margin-top: 4px; }

.input-group .form-control,
.input-group .form-select  { border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.input-group .form-control:first-child,
.input-group .form-select:first-child { border-radius: var(--r-sm) 0 0 var(--r-sm); }
.input-group-text {
  background: var(--ic-50); border: 1.5px solid var(--ic-300);
  color: var(--ic-500); font-size: 13.5px;
  transition: all .13s;
}
.input-group:focus-within .input-group-text {
  border-color: var(--ic-primary);
  background: var(--ic-primary-light);
  color: var(--ic-primary);
}
textarea.form-control { min-height: 88px; resize: vertical; line-height: 1.55; }

/* Select2 */
.select2-container--bootstrap-5 .select2-selection {
  border: 1.5px solid var(--ic-300) !important;
  border-radius: var(--r-sm) !important;
  background: #fff !important;
  min-height: 39px !important;
  font-size: 13.5px;
  transition: border-color .13s, box-shadow .13s;
}
.select2-container--bootstrap-5.select2-container--focus .select2-selection,
.select2-container--bootstrap-5.select2-container--open  .select2-selection {
  border-color: var(--ic-primary) !important;
  box-shadow: 0 0 0 3px rgba(21,101,192,.1) !important;
}

/* ── Tables ──────────────────────────────────────────────── */
.table {
  --bs-table-hover-bg: #f4f8ff;
  --bs-table-striped-bg: var(--ic-50);
}
.table thead th {
  font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px;
  color: var(--ic-500); background: var(--ic-50) !important;
  border-bottom: 2px solid var(--ic-200) !important;
  padding: 11px 16px; white-space: nowrap;
  user-select: none;
}
.table thead th.sortable { cursor: pointer; }
.table thead th.sortable:hover  { color: var(--ic-primary); }
.table thead th.sort-asc::after  { content: ' ↑'; color: var(--ic-primary); }
.table thead th.sort-desc::after { content: ' ↓'; color: var(--ic-primary); }
.table tbody td {
  font-size: 13.5px; color: var(--ic-700);
  padding: 11px 16px; vertical-align: middle;
  border-color: var(--ic-200);
}
.table-hover tbody tr { transition: background .1s; }
.table-hover tbody tr:hover { background: #f4f8ff; }
.table-light { --bs-table-bg: var(--ic-50); }

/* Empty state */
.empty-state {
  padding: 56px 24px; text-align: center; color: var(--ic-400);
}
.empty-state i { font-size: 2.8rem; display: block; margin-bottom: 14px; opacity: .3; }
.empty-state strong { display: block; font-size: 14px; color: var(--ic-600); margin-bottom: 6px; }
.empty-state p { font-size: 13px; margin: 0; }

/* ── Badges / Status ─────────────────────────────────────── */
.badge-status {
  padding: 4px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600; letter-spacing: .2px;
  display: inline-block;
}
.status-active      { background: var(--ic-success-bg); color: var(--ic-success); }
.status-overdue     { background: var(--ic-danger-bg);  color: var(--ic-danger);  }
.status-paid        { background: var(--ic-primary-light); color: var(--ic-primary); }
.status-pending     { background: var(--ic-warning-bg); color: var(--ic-warning); }
.status-cancelled   { background: var(--ic-100); color: var(--ic-500); }
.status-inactive    { background: var(--ic-100); color: var(--ic-500); }
.status-blacklisted { background: #fce4ec; color: #880e4f; }

/* ── Pagination ──────────────────────────────────────────── */
.pagination { gap: 3px; }
.pagination .page-link {
  color: var(--ic-primary); border-radius: var(--r-sm) !important;
  border: 1px solid var(--ic-200); padding: 5px 11px; font-size: 13px;
  transition: all .13s;
}
.pagination .page-link:hover  { background: var(--ic-primary-light); border-color: var(--ic-primary); }
.pagination .page-item.active .page-link {
  background: var(--ic-primary); border-color: var(--ic-primary);
  box-shadow: var(--sh-blue);
}

/* ── Alerts ──────────────────────────────────────────────── */
.alert { border-radius: var(--r-md); border: none; font-size: 13.5px; }
.alert-info    { background: var(--ic-info-bg);    color: var(--ic-info); }
.alert-success { background: var(--ic-success-bg); color: var(--ic-success); }
.alert-danger  { background: var(--ic-danger-bg);  color: var(--ic-danger); }
.alert-warning { background: var(--ic-warning-bg); color: var(--ic-warning); }

/* ── Progress ────────────────────────────────────────────── */
.progress { border-radius: 50px; background: var(--ic-200); height: 8px; }
.progress-bar { border-radius: 50px; }

/* ── Dropdown ────────────────────────────────────────────── */
.dropdown-menu {
  border: 1px solid var(--ic-200); border-radius: var(--r-md);
  box-shadow: var(--sh-xl); padding: 5px; font-size: 13.5px;
  animation: dropIn .12s ease;
}
@keyframes dropIn {
  from { opacity:0; transform:translateY(-6px); }
  to   { opacity:1; transform:translateY(0); }
}
.dropdown-item {
  border-radius: var(--r-sm); padding: 7px 12px; transition: all .1s;
}
.dropdown-item:hover { background: var(--ic-primary-light); color: var(--ic-primary); }

/* ── Modal ───────────────────────────────────────────────── */
.modal-content {
  border: none; border-radius: var(--r-xl);
  box-shadow: var(--sh-xl);
}
.modal-header {
  border-bottom: 1px solid var(--ic-200);
  padding: 18px 24px;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
}
.modal-body   { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--ic-200); }
.modal-title  { font-size: 15px; font-weight: 600; }

/* ── Photo upload ────────────────────────────────────────── */
.photo-upload-area {
  cursor: pointer; padding: 20px;
  border: 2px dashed var(--ic-300); border-radius: var(--r-lg);
  transition: all .2s; text-align: center;
}
.photo-upload-area:hover {
  border-color: var(--ic-primary); background: var(--ic-primary-light);
}

/* ── Breadcrumb ──────────────────────────────────────────── */
.breadcrumb {
  font-size: 12.5px; margin-bottom: 0;
  --bs-breadcrumb-divider-color: var(--ic-400);
}
.breadcrumb-item a { color: var(--ic-primary); text-decoration: none; }
.breadcrumb-item a:hover { text-decoration: underline; }
.breadcrumb-item.active { color: var(--ic-500); }

/* ── Installment rows ────────────────────────────────────── */
tr.inst-paid    td { color: #43A047; }
tr.inst-overdue td { background: #FFF5F5; color: #e53935; }
tr.inst-partial td { color: #F57C00; }

/* ── Stat detail row ─────────────────────────────────────── */
.stat-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid var(--ic-200);
  font-size: 13.5px;
}
.stat-row:last-child { border-bottom: none; }
.stat-row .label  { color: var(--ic-500); }
.stat-row .value  { font-weight: 600; color: var(--ic-800); }

/* ── Scrollbar (webkit) ──────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--ic-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--ic-400); }

/* ── SweetAlert2 override ────────────────────────────────── */
.swal2-popup  { border-radius: var(--r-xl) !important; font-family: inherit !important; }
.swal2-title  { font-size: 18px !important; color: var(--ic-800) !important; }
.swal2-content { font-size: 14px !important; }
.swal2-toast  { border-radius: var(--r-md) !important; box-shadow: var(--sh-lg) !important; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 576px) {
  .page-hdr h4 { font-size: .92rem; }
  .page-hdr { padding: 12px 0 10px; margin-bottom: 14px; }
  .kpi-icon  { width: 40px; height: 40px; font-size: 1.1rem; }
  .card-header { padding: 12px 14px !important; }
  .table tbody td, .table thead th { padding: 10px 12px; }
}

/* ── Print ───────────────────────────────────────────────── */
@media print {
  .app-sidebar, .app-header, .btn:not(.btn-print),
  .page-hdr, nav[aria-label="breadcrumb"], .no-print, .pagination { display: none !important; }
  .app-main { padding: 0 !important; }
  .app-content .container-fluid { padding: 0 !important; }
  .card { box-shadow: none !important; border: 1px solid #ddd !important; }
  body { background: #fff !important; font-size: 12px; color: #000; }
  .card-header { background: #f5f5f5 !important; }
}
