/* =========================================================
   FactuSaaS — Design System v3.1  (Bootstrap-override safe)
   ========================================================= */

:root {
  --brand:        #4f46e5;
  --brand-d:      #4338ca;
  --brand-light:  #eef2ff;
  --brand-2:      #6366f1;
  --ink:          #0f172a;
  --ink-2:        #334155;
  --muted:        #64748b;
  --line:         #e2e8f0;
  --bg:           #f1f5f9;
  --surface:      #ffffff;
  --sidebar-bg:   #1e1b4b;
  --sidebar-w:    256px;
  --topbar-h:     60px;
  --radius:       10px;
  --radius-sm:    7px;
  --shadow-sm:    0 1px 3px rgba(0,0,0,.07);
  --shadow:       0 4px 18px rgba(0,0,0,.09);
  --shadow-md:    0 8px 28px rgba(0,0,0,.13);
  --transition:   .18s ease;
  --c-success:#16a34a; --bg-success:#dcfce7;
  --c-info:   #0369a1; --bg-info:   #e0f2fe;
  --c-warning:#b45309; --bg-warning:#fef3c7;
  --c-danger: #dc2626; --bg-danger: #fee2e2;
  --c-muted:  #64748b; --bg-muted:  #f1f5f9;
  --c-purple: #7c3aed; --bg-purple: #f3e8ff;
}

/* ── Reset básico ── */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif !important;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg) !important;
  -webkit-font-smoothing: antialiased;
  margin: 0; padding: 0;
}
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-d); text-decoration: underline; }
img { max-width: 100%; }

/* ═══════════════════════════════════════
   AUTH
═══════════════════════════════════════ */
body.auth-body {
  min-height: 100vh !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #312e81 0%, #4338ca 45%, #818cf8 100%) !important;
  padding: 20px;
}
.auth-card {
  width: 100%;
  max-width: 440px;
  background: #fff;
  border-radius: 18px;
  padding: 40px 36px;
  box-shadow: 0 24px 56px rgba(0,0,0,.28);
}
.auth-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}
.auth-logo-icon {
  width: 46px;
  height: 46px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 22px;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(79,70,229,.4);
}
.auth-card h1 { font-size: 21px; font-weight: 700; color: var(--ink); }

/* ═══════════════════════════════════════
   APP SHELL
═══════════════════════════════════════ */
.app-shell {
  display: flex;
  flex-direction: row;
  min-height: 100vh;
}

/* ═══════════════════════════════════════
   MAIN WRAPPER
═══════════════════════════════════════ */
.main-wrapper {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
  transition: margin-left var(--transition);
}
/* ═══════════════════════════════════════
   SIDEBAR  — alto override de BS
═══════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w) !important;
  background: var(--sidebar-bg) !important;
  display: flex !important;
  flex-direction: column !important;
  position: fixed !important;
  top: 0; left: 0; bottom: 0;
  z-index: 1040;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform var(--transition);
  scrollbar-width: thin;
  scrollbar-color: #312e81 transparent;
}
.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-thumb { background: #312e81; border-radius: 3px; }

/* Marca */
.sidebar-brand {
  display: flex !important;
  align-items: center;
  gap: 10px;
  padding: 18px 14px 14px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  text-decoration: none !important;
  flex-shrink: 0;
}
.sidebar-brand-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 17px;
  flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(79,70,229,.45);
}
.sidebar-brand-name {
  font-size: 15px !important;
  font-weight: 700 !important;
  color: #f1f5f9 !important;
  letter-spacing: -.2px;
  white-space: nowrap;
}
.sidebar-brand:hover .sidebar-brand-name { color: #fff !important; }

.btn-sidebar-close {
  margin-left: auto;
  background: none !important;
  border: none !important;
  color: #94a3b8 !important;
  font-size: 17px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  display: none;
  line-height: 1;
}
.btn-sidebar-close:hover { color: #f1f5f9 !important; background: rgba(255,255,255,.08) !important; }

/* Etiqueta de sección */
.sidebar-section {
  font-size: 10px !important;
  font-weight: 700 !important;
  letter-spacing: 1.1px;
  color: rgba(148,163,184,.45) !important;
  text-transform: uppercase;
  padding: 14px 16px 3px;
  user-select: none;
  display: block;
}

/* Links y botones de nav */
.sidebar a,
.sidebar button.nav-toggle {
  display: flex !important;
  align-items: center !important;
  gap: 9px !important;
  color: rgba(148,163,184,.9) !important;
  padding: 8px 12px !important;
  margin: 1px 8px !important;
  border-radius: 7px !important;
  font-size: 13.5px !important;
  font-weight: 400 !important;
  transition: background var(--transition), color var(--transition) !important;
  cursor: pointer;
  width: calc(100% - 16px) !important;
  text-decoration: none !important;
  box-sizing: border-box;
}
.sidebar a i,
.sidebar button.nav-toggle i { font-size: 15px; flex-shrink: 0; }

.sidebar a:hover,
.sidebar button.nav-toggle:hover {
  background: rgba(255,255,255,.08) !important;
  color: #f1f5f9 !important;
  text-decoration: none !important;
}
.sidebar a.active {
  background: linear-gradient(135deg, rgba(79,70,229,.65), rgba(99,102,241,.45)) !important;
  color: #fff !important;
  font-weight: 600 !important;
}
.sidebar a.active:hover {
  background: linear-gradient(135deg, rgba(79,70,229,.8), rgba(99,102,241,.6)) !important;
}

/* ── nav-toggle button reset ── */
.sidebar button.nav-toggle {
  background: none !important;
  border: none !important;
  text-align: left !important;
  outline: none !important;
}
.nav-toggle .nav-arrow {
  margin-left: auto !important;
  font-size: 11px;
  transition: transform var(--transition);
  color: rgba(100,116,139,.55);
  flex-shrink: 0;
}
.nav-toggle.open .nav-arrow { transform: rotate(90deg); }
.nav-toggle.open { color: #e2e8f0 !important; }

/* ── Submenú ── */
.nav-submenu {
  display: block;
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.3s ease;
  flex-shrink: 0;    /* evita que el flex del sidebar lo comprima */
  width: 100%;
}
.nav-submenu.open {
  max-height: 500px;
}

.nav-submenu a {
  padding: 7px 14px 7px 40px !important;
  font-size: 13px !important;
  color: rgba(100,116,139,.8) !important;
  margin: 1px 8px !important;
  width: calc(100% - 16px) !important;
}
.nav-submenu a.active {
  background: rgba(99,102,241,.18) !important;
  color: #a5b4fc !important;
}
.nav-submenu a:hover {
  background: rgba(255,255,255,.07) !important;
  color: #e2e8f0 !important;
}

/* Footer sidebar */
.sidebar-footer {
  margin-top: auto;
  padding: 10px 8px 14px;
  border-top: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
}
.sidebar-footer a {
  display: flex !important;
  align-items: center;
  gap: 8px;
  padding: 7px 12px !important;
  margin: 1px 0 !important;
  border-radius: 7px !important;
  color: rgba(100,116,139,.75) !important;
  font-size: 13px !important;
  width: 100% !important;
}
.sidebar-footer a:hover { color: #f87171 !important; background: rgba(220,38,38,.1) !important; text-decoration: none !important; }

.sidebar-divider { height: 1px; background: rgba(255,255,255,.06); margin: 5px 14px; }

/* ═══════════════════════════════════════
   TOPBAR
═══════════════════════════════════════ */
.topbar {
  height: var(--topbar-h);
  background: #fff !important;
  border-bottom: 1px solid var(--line) !important;
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  flex-wrap: nowrap !important;
  padding: 0 22px !important;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 1030;
  box-shadow: 0 1px 0 var(--line), 0 2px 8px rgba(0,0,0,.04);
  flex-shrink: 0;
}

.btn-menu {
  background: none !important;
  border: 1px solid var(--line) !important;
  font-size: 18px !important;
  cursor: pointer;
  color: var(--muted) !important;
  padding: 5px 9px !important;
  border-radius: 7px !important;
  display: none !important;
  align-items: center;
  transition: all var(--transition);
}
.btn-menu:hover { background: var(--bg) !important; color: var(--ink) !important; }

.topbar-title {
  font-weight: 700 !important;
  font-size: 15px !important;
  color: var(--ink-2) !important;
  display: none;
}

.topbar-right {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  flex-wrap: nowrap !important;
  gap: 8px;
  margin-left: auto !important;
}

/* botones icono en topbar */
.topbar-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex !important;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none !important;
}
.topbar-btn:hover {
  background: var(--bg);
  color: var(--brand);
  border-color: var(--brand);
  text-decoration: none !important;
}

/* user pill */
.user-pill {
  display: flex !important;
  align-items: center !important;
  gap: 8px;
  padding: 4px 12px 4px 4px;
  border-radius: 30px;
  border: 1px solid var(--line);
  background: var(--bg);
  transition: all var(--transition);
  cursor: default;
}
.user-pill:hover { background: var(--line); }
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}
.user-name  { font-size: 13px; font-weight: 600; color: var(--ink-2); line-height: 1.2; }
.user-role  { font-size: 11px; color: var(--muted); line-height: 1.2; }

/* ═══════════════════════════════════════
   CONTENT
═══════════════════════════════════════ */
.content { padding: 26px; flex: 1; min-width: 0; }

/* ═══════════════════════════════════════
   PAGE HEADER
═══════════════════════════════════════ */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.page-title {
  font-size: 21px !important;
  font-weight: 800 !important;
  color: var(--ink) !important;
  line-height: 1.3;
  letter-spacing: -.3px;
  margin: 0 !important;
}
.page-subtitle { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 10px;
}

/* ═══════════════════════════════════════
   STAT CARDS
═══════════════════════════════════════ */
.stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: box-shadow var(--transition), transform var(--transition);
}
.stat:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: var(--radius) var(--radius) 0 0;
  opacity: 0;
  transition: opacity var(--transition);
}
.stat:hover::before { opacity: 1; }
.stat.stat-primary::before { background: linear-gradient(90deg, #4f46e5, #818cf8); }
.stat.stat-success::before { background: linear-gradient(90deg, #16a34a, #4ade80); }
.stat.stat-warning::before { background: linear-gradient(90deg, #f59e0b, #fde68a); }
.stat.stat-info::before    { background: linear-gradient(90deg, #0369a1, #38bdf8); }
.stat.stat-danger::before  { background: linear-gradient(90deg, #dc2626, #fca5a5); }

.stat-icon {
  width: 46px;
  height: 46px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-bottom: 14px;
}
.stat-icon.primary { background: #eef2ff; color: #4f46e5; }
.stat-icon.success { background: #dcfce7; color: #16a34a; }
.stat-icon.warning { background: #fef3c7; color: #b45309; }
.stat-icon.info    { background: #e0f2fe; color: #0369a1; }
.stat-icon.danger  { background: #fee2e2; color: #dc2626; }

.stat span {
  display: block !important;
  font-size: 11px !important;
  color: var(--muted) !important;
  text-transform: uppercase;
  letter-spacing: .6px;
  font-weight: 600 !important;
}
.stat strong {
  display: block !important;
  font-size: 26px !important;
  font-weight: 800 !important;
  color: var(--ink) !important;
  margin-top: 2px;
  letter-spacing: -.5px;
}
.stat-trend {
  font-size: 12px;
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--c-danger);
}

/* ═══════════════════════════════════════
   CARD-TABLE + TABLAS
═══════════════════════════════════════ */
.card-table {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.card-table .card-head {
  display: flex !important;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.card-table .card-head strong { font-size: 14px; font-weight: 700; color: var(--ink); }

.table { width: 100%; border-collapse: collapse; font-size: 13.5px; margin: 0; }
.table thead th {
  color: var(--muted) !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  text-transform: uppercase;
  letter-spacing: .5px;
  background: #f8fafc !important;
  border-bottom: 1px solid var(--line) !important;
  padding: 11px 16px !important;
  white-space: nowrap;
}
.table tbody td {
  padding: 12px 16px !important;
  border-bottom: 1px solid #f1f5f9 !important;
  vertical-align: middle !important;
  color: var(--ink-2);
}
.table tbody tr:last-child td { border-bottom: 0 !important; }
.table tbody tr { transition: background var(--transition); }
.table tbody tr:hover td { background: #f8fafc !important; }
.table-actions { text-align: right !important; white-space: nowrap; }

/* Empty state */
.empty-state { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty-state > i { font-size: 52px; display: block; margin-bottom: 14px; opacity: .18; }
.empty-state p { font-size: 15px; font-weight: 600; color: var(--ink-2); margin-bottom: 4px; }
.empty-state .empty-sub { font-size: 13px; color: var(--muted); margin-bottom: 16px; }

/* ═══════════════════════════════════════
   TOTALS
═══════════════════════════════════════ */
.totals { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.total-row {
  display: flex !important;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.total-row:last-child {
  border-bottom: 0;
  font-size: 17px;
  font-weight: 700;
  background: #eef2ff;
  padding: 13px 16px;
  color: var(--brand);
}

/* ═══════════════════════════════════════
   BADGES
═══════════════════════════════════════ */
.badge-estado {
  display: inline-flex !important;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-estado::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.estado-borrador   { background: var(--bg-muted);   color: var(--c-muted); }
.estado-emitida    { background: var(--bg-info);    color: var(--c-info); }
.estado-cobrada    { background: var(--bg-success); color: var(--c-success); }
.estado-parcial    { background: var(--bg-warning); color: var(--c-warning); }
.estado-vencida    { background: var(--bg-danger);  color: var(--c-danger); }
.estado-anulada    { background: var(--bg-muted);   color: var(--c-muted); }
.estado-pendiente  { background: var(--bg-warning); color: var(--c-warning); }
.estado-en_proceso { background: var(--bg-info);    color: var(--c-info); }
.estado-finalizado { background: var(--bg-success); color: var(--c-success); }
.estado-aceptado   { background: var(--bg-success); color: var(--c-success); }
.estado-rechazado  { background: var(--bg-danger);  color: var(--c-danger); }
.estado-convertido { background: var(--bg-purple);  color: var(--c-purple); }
.estado-enviado    { background: var(--bg-info);    color: var(--c-info); }
.estado-facturado  { background: var(--bg-success); color: var(--c-success); }
.estado-recibida   { background: var(--bg-info);    color: var(--c-info); }
.estado-pagada     { background: var(--bg-success); color: var(--c-success); }
.prio-urgente { background: var(--bg-danger);  color: var(--c-danger); }
.prio-alta    { background: #ffedd5;           color: #c2410c; }
.prio-media   { background: var(--bg-warning); color: var(--c-warning); }
.prio-baja    { background: var(--bg-success); color: var(--c-success); }

/* ═══════════════════════════════════════
   FORMS
═══════════════════════════════════════ */
.form-label { font-size: 12.5px !important; font-weight: 600 !important; color: var(--ink-2) !important; margin-bottom: 5px !important; }
.form-control, .form-select {
  border-color: var(--line) !important;
  border-radius: var(--radius-sm) !important;
  font-size: 13.5px !important;
  background: #fff !important;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus, .form-select:focus {
  border-color: var(--brand) !important;
  box-shadow: 0 0 0 3px rgba(79,70,229,.13) !important;
  outline: none !important;
}
input[type=number] { -moz-appearance: textfield; }
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; }

/* ═══════════════════════════════════════
   BUTTONS
═══════════════════════════════════════ */
.btn {
  border-radius: var(--radius-sm) !important;
  font-size: 13.5px !important;
  font-weight: 500 !important;
  transition: all var(--transition) !important;
  display: inline-flex !important;
  align-items: center;
  gap: 5px;
}
.btn-sm { border-radius: 6px !important; font-size: 12.5px !important; }
.btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-2)) !important;
  border-color: var(--brand) !important;
  box-shadow: 0 2px 8px rgba(79,70,229,.28) !important;
  color: #fff !important;
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--brand-d), var(--brand)) !important;
  border-color: var(--brand-d) !important;
  box-shadow: 0 4px 14px rgba(79,70,229,.38) !important;
  transform: translateY(-1px);
}
.btn-outline-primary { color: var(--brand) !important; border-color: var(--brand) !important; }
.btn-outline-primary:hover { background: var(--brand) !important; color: #fff !important; }

/* ═══════════════════════════════════════
   QUICK ACTIONS (dashboard)
═══════════════════════════════════════ */
.quick-action {
  display: flex !important;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-2) !important;
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none !important;
  transition: all var(--transition);
}
.quick-action:hover {
  border-color: var(--brand);
  color: var(--brand) !important;
  background: var(--brand-light);
  text-decoration: none !important;
  transform: translateX(3px);
  box-shadow: var(--shadow-sm);
}
.quick-action-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}

/* ═══════════════════════════════════════
   MISC
═══════════════════════════════════════ */
.bono-bar { height: 6px; background: var(--line); border-radius: 4px; overflow: hidden; margin-top: 4px; }
.bono-bar-fill { height: 100%; border-radius: 4px; transition: width .5s ease; }

.logo-preview { max-height: 80px; max-width: 200px; border: 1px solid var(--line); border-radius: 8px; padding: 4px; }
.hash-short { font-family: 'Courier New', monospace; font-size: 11px; color: var(--muted); }
code { white-space: normal; word-break: break-all; font-size: 12px; }

.alert { border-radius: var(--radius) !important; border: none !important; font-size: 13.5px !important; padding: 11px 16px !important; }
.alert-success { background: var(--bg-success) !important; color: #14532d !important; }
.alert-danger   { background: var(--bg-danger)  !important; color: #7f1d1d !important; }
.alert-warning  { background: var(--bg-warning) !important; color: #78350f !important; }
.alert-info     { background: var(--bg-info)    !important; color: #0c4a6e !important; }

/* Overlay mobile */
.sidebar-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 1039;
  display: none;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.show { display: block; }

/* ═══════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════ */
@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(calc(-1 * var(--sidebar-w))) !important;
    box-shadow: none !important;
  }
  .sidebar.open {
    transform: translateX(0) !important;
    box-shadow: 8px 0 30px rgba(0,0,0,.25) !important;
  }
  .btn-sidebar-close { display: flex !important; }
  .main-wrapper { margin-left: 0 !important; }
  .btn-menu { display: flex !important; }
  .topbar-title { display: block !important; }
}
@media (max-width: 767.98px) {
  .content { padding: 14px; }
  .page-title { font-size: 18px !important; }
  .stat strong { font-size: 22px !important; }
}
@media (max-width: 575.98px) {
  .page-header { flex-direction: column; align-items: flex-start; }
}

/* ═══════════════════════════════════════
   PRINT
═══════════════════════════════════════ */
@media print {
  .sidebar, .topbar, .no-print, .btn, nav, header, aside { display: none !important; }
  .main-wrapper { margin-left: 0 !important; }
  .content { padding: 0 !important; }
  .card-table { box-shadow: none !important; border: 1px solid #ccc !important; }
}

/* ═══════════════════════════════════════
   ANIMACIONES ENTRADA
═══════════════════════════════════════ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.content > .page-header,
.content > .row,
.content > .card-table,
.content > .alert {
  animation: fadeUp .22s ease both;
}
.content > .row:nth-child(2) { animation-delay: .05s; }
.content > .row:nth-child(3) { animation-delay: .1s; }

/* ═══════════════════════════════════════
   SEARCH PICKER MODAL (artículos / clientes / proveedores)
═══════════════════════════════════════ */

/* Input de búsqueda con botón integrado */
.picker-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}
.picker-display {
  flex: 1;
  background: var(--brand-light) !important;
  border-color: var(--brand) !important;
  color: var(--brand) !important;
  font-weight: 600 !important;
  cursor: pointer;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.picker-display:read-only:hover {
  background: #e0e7ff !important;
}
.btn-picker {
  flex-shrink: 0;
  padding: 5px 10px;
  border-radius: var(--radius-sm) !important;
  font-size: 12.5px !important;
  white-space: nowrap;
}

/* Modal de búsqueda */
#searchPickerModal .modal-dialog {
  max-width: 620px;
}
#searchPickerModal .modal-body {
  padding: 0;
}
.picker-search-bar {
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 2;
}
.picker-search-bar .input-group-text {
  background: var(--brand-light);
  border-color: var(--line);
  color: var(--brand);
}
.picker-search-bar .form-control {
  border-left: none !important;
}
.picker-results {
  max-height: 380px;
  overflow-y: auto;
  padding: 6px 0;
}
.picker-item {
  display: flex;
  align-items: center;
  padding: 9px 16px;
  cursor: pointer;
  transition: background var(--transition);
  gap: 10px;
  border-bottom: 1px solid var(--line);
}
.picker-item:last-child {
  border-bottom: none;
}
.picker-item:hover {
  background: var(--brand-light);
}
.picker-item-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
  background: var(--brand-light);
  color: var(--brand);
}
.picker-item-body {
  flex: 1;
  min-width: 0;
}
.picker-item-name {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.picker-item-sub {
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.picker-item-badge {
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  flex-shrink: 0;
}
.picker-item-badge.price {
  background: var(--bg-success);
  color: var(--c-success);
}
.picker-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
}
.picker-empty i {
  font-size: 28px;
  display: block;
  margin-bottom: 8px;
  opacity: .4;
}
.picker-loading {
  padding: 24px 16px;
  text-align: center;
  color: var(--muted);
}
.picker-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--bg);
}
.picker-footer small {
  color: var(--muted);
  font-size: 12px;
}

/* Fila de producto en línea de documento — botón lupa */
.product-picker-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
}
.product-picker-display {
  flex: 1;
  font-size: 12.5px !important;
  min-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: var(--brand-light) !important;
  border-color: var(--brand) !important;
  color: var(--brand) !important;
  font-weight: 600 !important;
  cursor: pointer;
}
.btn-product-picker {
  padding: 4px 7px;
  line-height: 1;
  font-size: 12px;
}
