/* =========================================================
   Recaudación — estilos
   ========================================================= */
:root {
  --brand: #3b5bdb;
  --brand-dark: #2b44b0;
  --brand-soft: #edf1ff;
  --ink: #1b2440;
  --sidebar-bg: #141b33;
  --sidebar-ink: #aab3d1;
  --surface: #f5f7fb;
  --radius: 14px;
  --bs-primary: var(--brand);
  --bs-primary-rgb: 59, 91, 219;
  --bs-body-font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --bs-body-color: var(--ink);
  --bs-link-color: var(--brand);
  --bs-link-hover-color: var(--brand-dark);
}

body { font-family: var(--bs-body-font-family); }

.btn-primary {
  --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand);
  --bs-btn-hover-bg: var(--brand-dark); --bs-btn-hover-border-color: var(--brand-dark);
  --bs-btn-active-bg: var(--brand-dark); --bs-btn-disabled-bg: var(--brand);
  font-weight: 600;
}
.form-control { border-radius: 10px; border-color: #dfe3ee; }
.form-control:focus { border-color: var(--brand); box-shadow: 0 0 0 .25rem rgba(59, 91, 219, .15); }
.form-label { font-weight: 500; font-size: .9rem; }
.card { border-radius: var(--radius); border-color: #e8ebf3; box-shadow: 0 1px 2px rgba(20, 27, 51, .04); }
.alert { border-radius: 10px; border: 0; }

/* ---------- Marca ---------- */
.brand-mark {
  width: 56px; height: 56px; border-radius: 16px;
  display: inline-grid; place-items: center;
  background: rgba(255, 255, 255, .15); color: #fff; font-size: 1.7rem;
}
.brand-mark-sm { width: 38px; height: 38px; border-radius: 11px; font-size: 1.15rem; background: var(--brand); color: #fff; }

/* ---------- Pantallas de acceso ---------- */
.auth-body { background: var(--surface); min-height: 100vh; }
.auth-wrap { display: flex; min-height: 100vh; }
.auth-brand {
  flex: 0 0 44%; flex-direction: column; padding: 56px;
  color: #fff; position: relative; overflow: hidden;
  background: linear-gradient(145deg, #2b44b0 0%, #3b5bdb 55%, #5c7cfa 100%);
}
.auth-brand::after {
  content: ""; position: absolute; width: 520px; height: 520px; border-radius: 50%;
  right: -180px; bottom: -200px; background: rgba(255, 255, 255, .08);
}
.auth-brand h1 { font-weight: 700; font-size: 2.4rem; margin: 28px 0 10px; }
.auth-brand .lead { opacity: .85; max-width: 380px; }
.auth-features { list-style: none; padding: 0; margin: 36px 0 0; position: relative; z-index: 1; }
.auth-features li { display: flex; align-items: center; gap: 12px; padding: 9px 0; font-weight: 500; }
.auth-features i {
  width: 34px; height: 34px; display: grid; place-items: center;
  border-radius: 10px; background: rgba(255, 255, 255, .15);
}
.auth-main { flex: 1; display: flex; align-items: center; justify-content: center; padding: 32px 16px; }
.auth-card { width: 100%; max-width: 410px; }
.auth-title { font-weight: 700; font-size: 1.65rem; margin-bottom: 6px; }

/* Inputs con icono */
.input-icon { position: relative; }
.input-icon > i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: #8a93ad; pointer-events: none; }
.input-icon > .form-control { padding-left: 42px; }
.input-icon > .form-control-lg { font-size: 1rem; padding-top: .7rem; padding-bottom: .7rem; }
.toggle-pass {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  border: 0; background: none; color: #8a93ad; padding: 6px 8px;
}
.toggle-pass:hover { color: var(--brand); }
.input-icon:has(.toggle-pass) > .form-control { padding-right: 44px; }

/* Medidor de fuerza */
.strength { height: 5px; background: #e8ebf3; border-radius: 4px; overflow: hidden; }
.strength span { display: block; height: 100%; width: 0; transition: width .25s, background .25s; }

/* ---------- Aplicación ---------- */
.app-body { background: var(--surface); }
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 264px; flex-shrink: 0; background: var(--sidebar-bg); color: var(--sidebar-ink);
  position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 18px 14px;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px; padding: 6px 8px 22px;
  color: #fff; font-weight: 700; font-size: 1.1rem; text-decoration: none;
}
.sidebar-nav { list-style: none; padding: 0; margin: 0; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin-bottom: 2px;
  border-radius: 10px; color: var(--sidebar-ink); text-decoration: none; font-weight: 500; font-size: .93rem;
}
.sidebar-nav a i { font-size: 1.1rem; }
.sidebar-nav a span:not(.badge-soon) { white-space: nowrap; }
.sidebar-nav a:hover:not(.disabled) { background: rgba(255, 255, 255, .06); color: #fff; }
.sidebar-nav a.active { background: var(--brand); color: #fff; }
.sidebar-nav a.disabled { opacity: .5; cursor: default; }
.badge-soon {
  margin-left: auto; font-size: .65rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  padding: 2px 7px; border-radius: 20px; background: rgba(140, 150, 190, .2); color: #8a93ad;
}
.module-card .badge-soon { margin-left: 6px; vertical-align: middle; }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 12px 28px;
  background: #fff; border-bottom: 1px solid #e8ebf3; position: sticky; top: 0; z-index: 10;
}
.topbar-title { font-size: 1.15rem; font-weight: 600; margin: 0; }
.btn-icon { border: 0; background: none; font-size: 1.5rem; padding: 2px 6px; }
.user-chip {
  display: flex; align-items: center; gap: 10px; border: 0; background: none;
  padding: 4px 8px; border-radius: 12px;
}
.user-chip:hover { background: var(--surface); }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand); font-weight: 700;
}
.app-content { padding: 28px; }

.welcome { background: linear-gradient(120deg, #2b44b0, #5c7cfa); color: #fff; }
.section-title { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: #7a839e; font-weight: 600; margin-bottom: 14px; }
.module-icon {
  width: 44px; height: 44px; flex-shrink: 0; border-radius: 12px; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand); font-size: 1.25rem;
}

/* Sidebar móvil */
.sidebar-backdrop { display: none; }
@media (max-width: 991.98px) {
  .sidebar { position: fixed; left: 0; z-index: 1040; transform: translateX(-100%); transition: transform .25s; }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 1030; }
  .topbar, .app-content { padding-left: 16px; padding-right: 16px; }
}

/* ---------- Listados y formularios (Parte 2) ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.form-select { border-radius: 10px; border-color: #dfe3ee; }
.form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 .25rem rgba(59, 91, 219, .15); }
.filter-card .form-label { margin-bottom: 4px; color: #5b6480; }
.card-header { border-bottom-color: #eef0f6; padding: 14px 18px; }

.data-table thead th {
  font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: #7a839e;
  font-weight: 600; background: #fafbfd; border-bottom-color: #eef0f6; white-space: nowrap; padding: 12px 16px;
}
.data-table td { padding: 12px 16px; border-color: #f0f2f7; }
.th-sort { color: inherit; text-decoration: none; }
.th-sort:hover, .th-sort.active { color: var(--brand); }
.doc-type {
  display: inline-block; font-size: .68rem; font-weight: 700; letter-spacing: .03em;
  padding: 2px 6px; border-radius: 6px; background: var(--brand-soft); color: var(--brand); margin-right: 4px;
}
.row-inactive td { opacity: .55; }
.row-highlight td { animation: flashrow 2.5s ease-out; }
@keyframes flashrow { 0%, 40% { background: #fff6d6; } 100% { background: transparent; } }

.empty-state { text-align: center; padding: 56px 16px; color: #7a839e; }
.empty-state > i { font-size: 2.6rem; display: block; margin-bottom: 8px; color: #c3c9da; }

.form-actions {
  position: sticky; bottom: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: 8px;
  padding: 14px 0; margin-top: 4px; background: linear-gradient(to top, var(--surface) 70%, transparent);
}
.invalid-feedback { font-size: .82rem; }

/* Tarjetas del inicio */
.stat-card .stat-label { font-size: .78rem; color: #7a839e; font-weight: 500; }
.stat-card .stat-value { font-size: 1.7rem; font-weight: 700; color: var(--ink); line-height: 1.2; }
.module-link { transition: transform .15s, box-shadow .15s, border-color .15s; }
.module-link:hover { transform: translateY(-2px); border-color: #cdd6fb; box-shadow: 0 6px 18px rgba(59, 91, 219, .10); }

/* Ficha de solo lectura (rol usuario) */
.avatar-lg { width: 60px; height: 60px; font-size: 1.5rem; }
.info-row { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid #f0f2f7; }
.info-row:last-child { border-bottom: 0; }
.info-row > i { color: #8a93ad; font-size: 1.1rem; margin-top: 2px; }
.info-label { font-size: .75rem; color: #7a839e; }
.info-value { font-weight: 500; word-break: break-word; }

/* Acceso del cliente */
.access-dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; }
.access-dl dt { font-weight: 500; color: #7a839e; }
.access-dl dd { margin: 0; word-break: break-all; }

/* Modal de confirmación */
.confirm-icon {
  width: 52px; height: 52px; margin: 0 auto 12px; border-radius: 50%; display: grid; place-items: center;
  background: #fff1f0; color: #e03131; font-size: 1.4rem;
}
.modal-content { border-radius: var(--radius); border: 0; }
.contact-cell > div { white-space: nowrap; }

/* ---------- Nueva contraseña ---------- */
.pass-reqs { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .82rem; color: #7a839e; }
.pass-reqs li { display: flex; align-items: center; gap: 5px; transition: color .15s; }
.pass-reqs li.ok { color: #2f9e44; }
.pass-match { min-height: 1.3em; color: #7a839e; }
.pass-match.ok { color: #2f9e44; font-weight: 500; }
.pass-match.bad { color: #e03131; font-weight: 500; }
.form-control.match-ok { border-color: #2f9e44; }
.form-control.match-ok:focus { box-shadow: 0 0 0 .25rem rgba(47, 158, 68, .15); }
.form-control.match-bad { border-color: #e03131; }
.form-control.match-bad:focus { box-shadow: 0 0 0 .25rem rgba(224, 49, 49, .15); }
.btn:disabled { cursor: not-allowed; }

/* ---------- Proveedores ---------- */
.cred-line { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.cred-value { max-width: 190px; overflow: hidden; text-overflow: ellipsis; }
.btn-icon-sm {
  border: 0; background: none; padding: 1px 4px; border-radius: 6px; color: #8a93ad; line-height: 1;
}
.btn-icon-sm:hover { background: var(--brand-soft); color: var(--brand); }
.url-cell a { display: inline-block; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; text-decoration: none; }
.clave-actual {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px;
  border-radius: 10px; background: var(--surface); border: 1px dashed #dfe3ee;
}

/* ---------- Terminales ---------- */
.stat-chip {
  display: inline-flex; align-items: baseline; gap: 5px; padding: 6px 12px; border-radius: 20px;
  background: #fff; border: 1px solid #e8ebf3; color: #5b6480; font-size: .88rem; text-decoration: none;
}
.stat-chip b { color: var(--ink); font-size: 1rem; }
.stat-chip:hover { border-color: #cdd6fb; color: var(--brand); }
.ubicacion-actual { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--surface); }
.ubicacion-actual > i { font-size: 1.5rem; color: var(--brand); }

.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 15px; top: 6px; bottom: 6px; width: 2px; background: #eef0f6; }
.timeline-item { position: relative; display: flex; gap: 12px; padding-bottom: 16px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
  position: relative; z-index: 1; flex-shrink: 0; width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); font-size: .95rem;
}
.tipo-retiro .timeline-dot { background: #fff4e6; color: #e8590c; }
.tipo-estado .timeline-dot { background: #f3f0ff; color: #7048e8; }
.tipo-alta .timeline-dot   { background: #ebfbee; color: #2f9e44; }
.timeline-body { flex: 1; min-width: 0; padding-top: 4px; }

/* ---------- Logo ---------- */
.logo-img { border-radius: 11px; flex-shrink: 0; display: block; }
.brand-mark > img { display: block; }

/* ---------- Listas de precios ---------- */
.lista-grid .pct-input { width: 118px; margin: 0 auto; }
.lista-grid .pct-input .form-control { padding-left: 6px; padding-right: 6px; }
.lista-grid .fill-row td { background: #fafbfd; border-bottom-color: #eef0f6; padding-top: 6px; padding-bottom: 10px; }
.lista-grid tr.row-excluded td:not(:first-child) { opacity: .4; }
.lista-grid td { padding-top: 8px; padding-bottom: 8px; }
.lista-prov { width: 42%; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; line-height: 1.5; }

/* ---------- Movimientos ---------- */
.totales .stat-value { font-size: 1.25rem; }
.stat-ganancia { border-color: #d3f9d8; }
.movs-table td { padding-top: 8px; padding-bottom: 8px; }
.filtro-min { min-width: 150px; }
.col-cliente { max-width: 200px; }
.movs-table th, .movs-table td { padding-left: 12px; padding-right: 12px; }
.col-operacion { min-width: 150px; max-width: 200px; }
@media (max-width: 575.98px) {
  .movs-table th, .movs-table td { padding-left: 8px; padding-right: 8px; font-size: .88rem; }
  .card-body.p-4 { padding: 1rem !important; }
}
.row-rechazada td { color: #8a93ad; }
