/*
 * custom.css — Inventario PJ v2
 * Agregar DESPUÉS de Bootstrap en el <head>:
 * <link rel="stylesheet" href="{% static 'css/custom.css' %}">
 * ─────────────────────────────────────────────────────────────
 */

/* ── 1. TOKENS ─────────────────────────────────────────────── */
:root {
  --inv-bg:        #0d1117;
  --inv-surface:   #161b22;
  --inv-surface-2: #1e2530;
  --inv-border:    #2d3748;
  --inv-accent:    #4f7fff;
  --inv-accent-dim:#4f7fff1a;
  --inv-text:      #f0f4ff;
  --inv-muted:     #8b9ab5;
  --inv-success:   #3fb950;
  --inv-warning:   #e6a817;
  --inv-danger:    #f85149;
  --inv-radius:    10px;
  --inv-radius-sm: 6px;
  --inv-shadow:    0 4px 24px #00000060;
  --inv-font:      'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;
}

/* ── 2. BASE ────────────────────────────────────────────────── */
body {
  font-family: var(--inv-font) !important;
  background-color: var(--inv-bg) !important;
  color: var(--inv-text) !important;
}

/* ── 3. NAVBAR ──────────────────────────────────────────────── */
.navbar {
  background-color: var(--inv-surface) !important;
  border-bottom: 1px solid var(--inv-border) !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  min-height: 54px;
  box-shadow: 0 1px 0 var(--inv-border);
  position: relative;
  z-index: 1030;
}

.navbar-brand {
  font-weight: 700 !important;
  font-size: .95rem !important;
  color: var(--inv-text) !important;
  display: flex !important;
  align-items: center !important;
  gap: .5rem !important;
  padding: 10px 20px 10px 0 !important;
  border-right: 1px solid var(--inv-border);
  margin-right: 8px !important;
}

.navbar-brand .brand-icon {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--inv-accent), #7c6fff);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: .75rem;
  flex-shrink: 0;
}

/* ── NAV LINKS: más visibles, sin grises apagados ── */
.navbar-nav .nav-link {
  color: #c9d3e8 !important;   /* ← mucho más visible que antes */
  font-size: .82rem !important;
  font-weight: 500 !important;
  padding: 0 11px !important;
  height: 54px;
  display: flex !important;
  align-items: center !important;
  gap: 5px !important;
  text-decoration: none !important;
  position: relative;
  transition: color .15s !important;
  white-space: nowrap;
}

.navbar-nav .nav-link:hover {
  color: #fff !important;
}

.navbar-nav .nav-link.active,
.navbar-nav .nav-item.active .nav-link {
  color: #fff !important;
  font-weight: 600 !important;
}

.navbar-nav .nav-link.active::after,
.navbar-nav .nav-item.active .nav-link::after {
  content: '';
  position: absolute;
  bottom: 0; left: 8px; right: 8px;
  height: 2px;
  background: var(--inv-accent);
  border-radius: 2px 2px 0 0;
}

/* ── Neutralizar badges/pills dentro del navbar ── */
/* Si el template tiene <span class="badge ..."> dentro de .nav-link, los normalizamos */
.navbar-nav .nav-link .badge,
.navbar-nav .nav-link span.badge {
  display: none !important; /* ocúltalos; el ícono ya cumple su rol */
}

/* Alternativa: si quieres mantenerlos, al menos que sean consistentes */
/*
.navbar-nav .nav-link .badge {
  background: var(--inv-accent-dim) !important;
  color: var(--inv-accent) !important;
  font-size: .6rem !important;
  padding: 2px 6px !important;
  border-radius: 10px !important;
}
*/

/* ── Dropdowns ── */
.dropdown-menu {
  background-color: var(--inv-surface-2) !important;
  border: 1px solid var(--inv-border) !important;
  border-radius: var(--inv-radius-sm) !important;
  box-shadow: var(--inv-shadow) !important;
  padding: 6px !important;
  min-width: 200px;
  max-height: 70vh;
  overflow-y: auto;
  z-index: 9999 !important;
}

.dropdown-item {
  color: #c9d3e8 !important;
  font-size: .83rem !important;
  padding: 8px 12px !important;
  border-radius: var(--inv-radius-sm) !important;
  transition: background .12s, color .12s !important;
}

.dropdown-item:hover, .dropdown-item:focus {
  background-color: var(--inv-accent-dim) !important;
  color: #fff !important;
}

.dropdown-divider {
  border-color: var(--inv-border) !important;
  margin: 4px 0 !important;
}

/* ── Botón de usuario ── */
.nav-user-btn,
.navbar .dropdown-toggle.nav-user-btn {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  padding: 5px 12px !important;
  border-radius: 20px !important;
  background: var(--inv-surface-2) !important;
  border: 1px solid var(--inv-border) !important;
  color: #c9d3e8 !important;
  font-size: .78rem !important;
  margin: auto 0 !important;
  transition: border-color .15s, color .15s !important;
}

.nav-user-btn:hover {
  border-color: var(--inv-accent) !important;
  color: #fff !important;
}

.nav-user-btn .avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--inv-accent), #7c6fff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .65rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

/* ── 4. CONTENEDOR PRINCIPAL ────────────────────────────────── */
/* Si usás container-fluid, esto limita el ancho para que no se estire */
.container-fluid {
  max-width: 1320px !important;
  padding-left: 28px !important;
  padding-right: 28px !important;
}

.container {
  max-width: 1280px !important;
}

/* Padding de página */
.container-fluid > .row,
.container > .row,
body > .container-fluid {
  padding-top: 28px;
}

/* ── 4. PAGE HEADER ─────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--inv-text);
  letter-spacing: -.02em;
  margin: 0;
}

.page-subtitle {
  font-size: .8rem;
  color: var(--inv-muted);
  margin: 2px 0 0;
}

/* ── 5. KPI CARDS ───────────────────────────────────────────── */
.kpi-card {
  background: var(--inv-surface) !important;
  border: 1px solid var(--inv-border) !important;
  border-radius: var(--inv-radius) !important;
  padding: 18px 20px !important;
  display: flex !important;
  align-items: center !important;
  gap: 14px !important;
  transition: transform .15s, box-shadow .15s !important;
  height: 100%;
  text-decoration: none !important;
  color: inherit !important;
  /* SIN borde izquierdo de color — se ve genérico */
}

.kpi-card:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 6px 24px #00000050 !important;
  color: inherit !important;
}

.kpi-icon {
  width: 44px;
  height: 44px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.kpi-icon.blue   { background: #4f7fff1e; color: #6a93ff; }
.kpi-icon.green  { background: #3fb9501e; color: #4fd463; }
.kpi-icon.orange { background: #f0883e1e; color: #f09a5a; }
.kpi-icon.purple { background: #bc8cff1e; color: #c9a0ff; }
.kpi-icon.red    { background: #f851491e; color: #ff6b6b; }

.kpi-label {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--inv-muted);
  margin-bottom: 4px;
}

.kpi-value {
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--inv-text);
  letter-spacing: -.02em;
  line-height: 1;
}

/* ── 6. CARDS / PANELS ──────────────────────────────────────── */
.inv-card {
  background: var(--inv-surface) !important;
  border: 1px solid var(--inv-border) !important;
  border-radius: var(--inv-radius) !important;
  overflow: hidden;
}

/* Reemplaza también las .card genéricas de Bootstrap */
.card {
  background: var(--inv-surface) !important;
  border: 1px solid var(--inv-border) !important;
  border-radius: var(--inv-radius) !important;
  color: var(--inv-text) !important;
}

.card-header, .inv-card-header {
  padding: 13px 18px !important;
  border-bottom: 1px solid var(--inv-border) !important;
  background: var(--inv-surface-2) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 12px !important;
  font-size: .875rem !important;
  font-weight: 600 !important;
  color: var(--inv-text) !important;
}

.card-body { color: var(--inv-text) !important; }

.inv-card-title, .card-title {
  font-size: .875rem !important;
  font-weight: 600 !important;
  margin: 0 !important;
  color: var(--inv-text) !important;
}

/* ── 7. TABLAS ──────────────────────────────────────────────── */
.inv-table,
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: .83rem;
  color: var(--inv-text) !important;
}

.inv-table thead th,
.table thead th {
  background: var(--inv-surface-2) !important;
  color: var(--inv-muted) !important;
  font-size: .68rem !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: .08em !important;
  padding: 10px 14px !important;
  border-bottom: 1px solid var(--inv-border) !important;
  border-top: none !important;
  white-space: nowrap;
}

.inv-table tbody tr,
.table tbody tr,
.table > tbody > tr {
  border-bottom: 1px solid var(--inv-border) !important;
  transition: background .1s !important;
}

.inv-table tbody tr:last-child,
.table tbody tr:last-child { border-bottom: none !important; }

.inv-table tbody tr:hover,
.table-hover tbody tr:hover,
.table > tbody > tr:hover {
  background: var(--inv-surface-2) !important;
}

.inv-table tbody td,
.table tbody td,
.table > tbody > tr > td {
  padding: 11px 14px !important;
  color: var(--inv-text) !important;
  vertical-align: middle !important;
  border-color: var(--inv-border) !important;
  background: transparent !important;
}

/* Quitar el striped feo de Bootstrap */
.table-striped > tbody > tr:nth-of-type(odd) > * {
  background-color: transparent !important;
  color: var(--inv-text) !important;
}

.col-actions, .text-end { text-align: right; }

/* ── 8. BOTONES DE ACCIÓN ───────────────────────────────────── */
.btn-action {
  width: 30px;
  height: 30px;
  border-radius: var(--inv-radius-sm);
  border: none;
  background: transparent;
  color: var(--inv-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .82rem;
  transition: background .12s, color .12s;
  cursor: pointer;
  text-decoration: none !important;
}

.btn-action:hover       { color: var(--inv-text); background: var(--inv-surface-2); }
.btn-action.edit:hover  { color: #6a93ff; background: #4f7fff18; }
.btn-action.delete:hover{ color: var(--inv-danger); background: #f8514918; }
.btn-action.view:hover  { color: #4fd463; background: #3fb95018; }

/* ── 9. BADGES ──────────────────────────────────────────────── */
.inv-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: .7rem;
  font-weight: 600;
}

.inv-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.inv-badge.success { background:#3fb95018; color:#4fd463; }
.inv-badge.success::before { background: #4fd463; }
.inv-badge.warning { background:#e6a81718; color:#e6c040; }
.inv-badge.warning::before { background: #e6c040; }
.inv-badge.danger  { background:#f8514918; color:#ff6b6b; }
.inv-badge.danger::before  { background: #ff6b6b; }
.inv-badge.info    { background:#4f7fff18; color:#6a93ff; }
.inv-badge.info::before    { background: #6a93ff; }
.inv-badge.neutral { background:#8b9ab518; color:#8b9ab5; }
.inv-badge.neutral::before { background: #8b9ab5; }

/* Sobrescribir badges Bootstrap en tablas */
.badge.bg-warning, .badge.bg-success, .badge.bg-danger,
.badge.text-bg-warning, .badge.text-bg-success, .badge.text-bg-danger {
  font-size: .7rem !important;
  padding: 4px 10px !important;
  border-radius: 20px !important;
  font-weight: 600 !important;
}

/* ── 10. FORMULARIOS ────────────────────────────────────────── */
.form-control, .form-select {
  background-color: var(--inv-surface-2) !important;
  border: 1.5px solid var(--inv-border) !important;
  color: var(--inv-text) !important;
  border-radius: var(--inv-radius-sm) !important;
  padding: 9px 13px !important;
  font-size: .875rem !important;
  font-family: var(--inv-font) !important;
  transition: border-color .15s, box-shadow .15s !important;
}

.form-control::placeholder { color: var(--inv-muted) !important; opacity: 1 !important; }

.form-control:focus, .form-select:focus {
  border-color: var(--inv-accent) !important;
  box-shadow: 0 0 0 3px #4f7fff1a !important;
  background-color: var(--inv-surface-2) !important;
  color: var(--inv-text) !important;
  outline: none !important;
}

.form-label {
  font-size: .72rem !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: .06em !important;
  color: var(--inv-muted) !important;
  margin-bottom: 5px !important;
}

/* ── 11. BOTONES ────────────────────────────────────────────── */
.btn-primary {
  background: var(--inv-accent) !important;
  border-color: var(--inv-accent) !important;
  color: #fff !important;
  font-weight: 600 !important;
  font-size: .83rem !important;
  border-radius: var(--inv-radius-sm) !important;
  padding: 8px 16px !important;
  transition: opacity .15s, box-shadow .15s !important;
  font-family: var(--inv-font) !important;
}

.btn-primary:hover {
  opacity: .88 !important;
  box-shadow: 0 4px 14px #4f7fff40 !important;
}

.btn-secondary, .btn-outline-secondary {
  border-color: var(--inv-border) !important;
  color: #c9d3e8 !important;
  background: var(--inv-surface-2) !important;
  font-size: .83rem !important;
  border-radius: var(--inv-radius-sm) !important;
  font-family: var(--inv-font) !important;
}

.btn-secondary:hover, .btn-outline-secondary:hover {
  background: var(--inv-border) !important;
  color: #fff !important;
}

.btn-success {
  background: #2a9e40 !important;
  border-color: #2a9e40 !important;
  color: #fff !important;
  font-weight: 600 !important;
  border-radius: var(--inv-radius-sm) !important;
}

.btn-danger {
  background: #c0392b !important;
  border-color: #c0392b !important;
  color: #fff !important;
  font-weight: 600 !important;
  border-radius: var(--inv-radius-sm) !important;
}

.btn-sm {
  padding: 5px 12px !important;
  font-size: .78rem !important;
}

/* ── 12. ALERTAS ────────────────────────────────────────────── */
.alert {
  border-radius: var(--inv-radius-sm) !important;
  font-size: .875rem !important;
  border-width: 1px !important;
}

.alert-success { background:#3fb95018 !important; border-color:#3fb95040 !important; color:#4fd463 !important; }
.alert-warning { background:#e6a81718 !important; border-color:#e6a81740 !important; color:#e6c040 !important; }
.alert-danger  { background:#f8514918 !important; border-color:#f8514940 !important; color:#ff6b6b !important; }
.alert-info    { background:#4f7fff18 !important; border-color:#4f7fff40 !important; color:#6a93ff !important; }

/* ── 13. LOGIN v3 — Fondo automotriz + panel oscuro ═══════════ */

.login-v3 {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  position: relative;
  background: url("/static/images/login-bg.f23e61c445e9.png") center/cover no-repeat;
}

/* Overlay oscuro sobre toda la pantalla */
.login-v3-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.60);
}

/* Panel central con fondo oscuro */
.login-v3-card {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 440px;
  background: rgba(10, 10, 10, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 1.5rem;
  padding: 3rem 2.5rem;
  backdrop-filter: blur(8px);
}

/* Logo */
.login-v3-logo {
  width: 13rem;
  height: 13rem;
  border-radius: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 2.5rem auto;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.35);
  border: 2px solid rgba(255, 255, 255, 0.10);
}
.login-v3-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.login-v3-logo i {
  font-size: 4rem;
  color: white;
}

/* Título */
.login-v3-title {
  font-size: 2.75rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: #ffffff;
  text-align: center;
  margin-bottom: 0.5rem;
  line-height: 1.1;
}

/* Subtítulo */
.login-v3-subtitle {
  font-size: 1.1rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.55);
  text-align: center;
  margin-bottom: 2.5rem;
}

/* Error */
.login-v3-error {
  padding: 0.875rem 1rem;
  background: rgba(220, 38, 38, 0.15);
  border: 1px solid rgba(220, 38, 38, 0.30);
  border-radius: 0.75rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: #fca5a5;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

/* Formulario */
.login-v3-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Campo con icono */
.login-v3-field {
  position: relative;
  display: flex;
  align-items: center;
}
.login-v3-field-icon {
  position: absolute;
  left: 1rem;
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.45);
  pointer-events: none;
}
.login-v3-field input {
  width: 100%;
  padding: 1rem 1rem 1rem 2.75rem;
  font-size: 1rem;
  font-weight: 500;
  color: white;
  background: rgba(255, 255, 255, 0.07);
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  border-radius: 0.875rem;
  transition: all 0.15s ease;
}
.login-v3-field input::placeholder {
  color: rgba(255, 255, 255, 0.35);
  font-weight: 400;
}
.login-v3-field input:hover:not(:focus) {
  border-color: rgba(255, 255, 255, 0.20);
  background: rgba(255, 255, 255, 0.10);
}
.login-v3-field input:focus {
  outline: none;
  border-color: rgba(178, 23, 29, 0.60);
  background: rgba(255, 255, 255, 0.10);
  box-shadow: 0 0 0 3px rgba(178, 23, 29, 0.20);
}

/* Botón */
.login-v3-btn {
  width: 100%;
  margin-top: 0.75rem;
  padding: 1rem;
  border-radius: 0.875rem;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  user-select: none;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: #b2171d;
  color: white;
  box-shadow: 0 2px 8px rgba(178, 23, 29, 0.35);
}
.login-v3-btn:hover {
  background-color: #99141a;
}

/* Footer */
.login-v3-footer {
  margin-top: 2.5rem;
  text-align: center;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.35);
}

/* Responsive */
@media (max-width: 480px) {
  .login-v3 {
    padding: 1rem;
  }
  .login-v3-card {
    padding: 2rem 1.5rem;
  }
  .login-v3-logo {
    width: 10rem;
    height: 10rem;
  }
  .login-v3-title {
    font-size: 2.25rem;
  }
}

/* ── 14. PAGINACIÓN ─────────────────────────────────────────── */
.page-item .page-link {
  background: var(--inv-surface) !important;
  border-color: var(--inv-border) !important;
  color: #c9d3e8 !important;
  font-size: .8rem !important;
}

.page-item.active .page-link {
  background: var(--inv-accent) !important;
  border-color: var(--inv-accent) !important;
  color: #fff !important;
}

.page-item .page-link:hover {
  background: var(--inv-surface-2) !important;
  color: #fff !important;
}

/* ── 15. EMPTY STATE ────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 56px 24px;
  color: var(--inv-muted);
}

.empty-state i {
  font-size: 2.5rem;
  margin-bottom: 16px;
  opacity: .35;
  display: block;
}

.empty-state h6 {
  font-size: .95rem;
  font-weight: 600;
  color: var(--inv-muted) !important;
  margin-bottom: 6px;
}

.empty-state p {
  font-size: .8rem;
  color: var(--inv-muted);
  margin: 0;
}

/* Cuando la tabla solo tiene "Sin alertas" o "0 resultados" */
.table td[colspan] {
  text-align: center;
  color: var(--inv-muted) !important;
  padding: 32px 16px !important;
  font-size: .83rem;
}

/* ── FILTROS / SEARCH BAR ───────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.filter-bar .form-control,
.filter-bar .form-select {
  max-width: 260px;
}

.filter-bar .btn { flex-shrink: 0; }

/* ── SESSION MODAL (menos agresivo) ─────────────────────────── */
/* Si el modal de sesión tiene un id específico, podés afinarlo */
.modal-content {
  background: var(--inv-surface-2) !important;
  border: 1px solid var(--inv-border) !important;
  border-radius: var(--inv-radius) !important;
  color: var(--inv-text) !important;
}

.modal-header {
  border-bottom: 1px solid var(--inv-border) !important;
  padding: 16px 20px !important;
}

.modal-footer {
  border-top: 1px solid var(--inv-border) !important;
  padding: 12px 20px !important;
}

.modal-title {
  font-size: .95rem !important;
  font-weight: 600 !important;
  color: var(--inv-text) !important;
}

.modal-backdrop.show { opacity: .6 !important; }

/* ── 15. TEXTO Y TIPOGRAFÍA GENERAL ─────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  color: var(--inv-text) !important;
  font-family: var(--inv-font) !important;
}

p, span, div, li, td, th, label, small {
  font-family: var(--inv-font) !important;
}

.text-muted { color: var(--inv-muted) !important; }

a { color: var(--inv-accent); }
a:hover { color: #7aa3ff; }

/* Links en tablas */
.inv-table a, .table a {
  color: var(--inv-accent);
  text-decoration: none;
  font-weight: 500;
}

.inv-table a:hover, .table a:hover { color: #7aa3ff; text-decoration: underline; }

/* ── 16. SCROLLBAR ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--inv-bg); }
::-webkit-scrollbar-thumb { background: var(--inv-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #3d4f6b; }

/* ── 17. FORM GRID (two-column page layout) ─────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
  align-items: start;
}

@media (max-width: 900px) {
  .form-grid { grid-template-columns: 1fr; }
}

/* ── BREADCRUMB ROW ─────────────────────────────────────────── */
.breadcrumb-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .75rem;
  color: var(--inv-muted);
  margin-bottom: 8px;
}
.breadcrumb-row a { color: var(--inv-muted) !important; text-decoration: none; }
.breadcrumb-row a:hover { color: var(--inv-accent) !important; }
.breadcrumb-row i { font-size: .65rem; }

/* ── CARD HEADER ICON ───────────────────────────────────────── */
.card-header-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  flex-shrink: 0;
}
.card-header-icon.blue   { background: #4f7fff1e; color: #6a93ff; }
.card-header-icon.green  { background: #3fb9501e; color: #4fd463; }
.card-header-icon.purple { background: #bc8cff1e; color: #c9a0ff; }
.card-header-icon.red    { background: #f851491e; color: #ff6b6b; }

/* ── PRODUCT SEARCH DROPDOWN ────────────────────────────────── */
.product-search-wrap { position: relative; }
.product-search-wrap .form-control { padding-left: 36px !important; }
.search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--inv-muted);
  font-size: .8rem;
  pointer-events: none;
  z-index: 1;
}
.product-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--inv-surface-2);
  border: 1px solid var(--inv-border);
  border-radius: var(--inv-radius-sm);
  box-shadow: 0 8px 24px #00000060;
  z-index: 200;
  max-height: 240px;
  overflow-y: auto;
  display: none;
}
.product-dropdown.open { display: block; }
.product-option {
  padding: 10px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background .1s;
  border-bottom: 1px solid var(--inv-border);
}
.product-option:last-child { border-bottom: none; }
.product-option:hover { background: var(--inv-border); }
.prod-name { font-size: .83rem; font-weight: 500; color: var(--inv-text); }
.prod-meta { font-size: .72rem; color: var(--inv-muted); margin-top: 1px; }
.prod-stock {
  font-size: .72rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  background: #3fb9501e;
  color: #4fd463;
  flex-shrink: 0;
  white-space: nowrap;
}
.prod-stock.low  { background: #e6a8171e; color: #e6c040; }
.prod-stock.zero { background: #f851491e; color: #ff6b6b; }
.no-results { padding: 16px; text-align: center; color: var(--inv-muted); font-size: .8rem; }

/* ── SELECTED PRODUCT TAG (venta/compra) ────────────────────── */
.selected-product {
  background: linear-gradient(135deg, #4f7fff22, #4f7fff11);
  border: 1px solid #4f7fff55;
  border-radius: var(--inv-radius-sm);
  padding: 10px 12px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.selected-product .sp-name { font-size: .83rem; font-weight: 600; color: var(--inv-text); }
.selected-product .sp-meta { font-size: .72rem; color: var(--inv-muted); margin-top: 2px; }

/* ── SELECTED PREVIEW (merma) ───────────────────────────────── */
.selected-preview {
  background: var(--inv-surface-2);
  border: 1px solid var(--inv-border);
  border-radius: var(--inv-radius-sm);
  padding: 14px 16px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.selected-preview .sp-name { font-size: .9rem; font-weight: 600; }
.selected-preview .sp-meta {
  font-size: .75rem;
  color: var(--inv-muted);
  margin-top: 3px;
  display: flex;
  gap: 12px;
}

/* ── STOCK PILL ─────────────────────────────────────────────── */
.stock-pill {
  padding: 3px 9px;
  border-radius: 20px;
  font-size: .7rem;
  font-weight: 600;
  white-space: nowrap;
}
.stock-pill.ok   { background: #3fb9501e; color: #4fd463; }
.stock-pill.low  { background: #e6a8171e; color: #e6c040; }
.stock-pill.zero { background: #f851491e; color: #ff6b6b; }

/* ── CLEAR BUTTON ───────────────────────────────────────────── */
.clear-btn {
  background: none;
  border: none;
  color: var(--inv-muted);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: .8rem;
  transition: color .1s, background .1s;
}
.clear-btn:hover { color: var(--inv-danger); background: #f851491e; }

/* ── BTN ADD ────────────────────────────────────────────────── */
.btn-add {
  width: 100%;
  padding: 10px;
  background: var(--inv-accent);
  color: #fff !important;
  border: none;
  border-radius: var(--inv-radius-sm);
  font-size: .83rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--inv-font);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: opacity .15s, box-shadow .15s;
  margin-top: 14px;
  text-decoration: none;
}
.btn-add:hover { opacity: .88; box-shadow: 0 4px 14px #4f7fff40; color: #fff !important; }
.btn-add:disabled { opacity: .4; cursor: not-allowed; }
.btn-add.danger { background: var(--inv-danger); }
.btn-add.danger:hover { box-shadow: 0 4px 14px #f8514940; }
.btn-add.success { background: #2a9e40; }
.btn-add.success:hover { box-shadow: 0 4px 14px #3fb95040; }

/* ── SEARCH MODE TOGGLE ─────────────────────────────────────── */
.btn-mode {
  padding: 3px 10px;
  font-size: .72rem;
  font-weight: 600;
  border: 1px solid var(--inv-border);
  border-radius: var(--inv-radius-sm);
  background: var(--inv-surface-2);
  color: var(--inv-muted);
  cursor: pointer;
  font-family: var(--inv-font);
  transition: background .15s, color .15s;
}
.btn-mode.active {
  background: var(--inv-accent);
  color: #fff;
  border-color: var(--inv-accent);
}

/* ── PRODUCTS TABLE (new style) ─────────────────────────────── */
.products-table-wrap { overflow-x: auto; }
.products-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
  color: var(--inv-text);
}
.products-table thead th {
  background: var(--inv-surface-2) !important;
  color: var(--inv-muted) !important;
  font-size: .65rem !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: .08em !important;
  padding: 9px 12px !important;
  border-bottom: 1px solid var(--inv-border) !important;
  white-space: nowrap;
  border-top: none !important;
}
.products-table tbody tr { border-bottom: 1px solid var(--inv-border); transition: background .1s; }
.products-table tbody tr:last-child { border-bottom: none; }
.products-table tbody tr:hover { background: var(--inv-surface-2); }
.products-table td {
  padding: 10px 12px;
  vertical-align: middle;
  color: var(--inv-text) !important;
  background: transparent !important;
}
.qty-input {
  width: 70px;
  padding: 5px 8px;
  background: var(--inv-surface-2);
  border: 1.5px solid var(--inv-border);
  color: var(--inv-text);
  border-radius: 4px;
  font-size: .82rem;
  text-align: center;
  font-family: var(--inv-font);
  outline: none;
}
.qty-input:focus { border-color: var(--inv-accent); box-shadow: 0 0 0 2px #4f7fff1a; }
.remove-row {
  width: 26px;
  height: 26px;
  border-radius: 4px;
  background: none;
  border: none;
  color: var(--inv-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  transition: background .1s, color .1s;
}
.remove-row:hover { background: #f851491e; color: #ff6b6b; }

/* ── TOTAL BAR ──────────────────────────────────────────────── */
.total-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  padding: 12px 16px;
  border-top: 1px solid var(--inv-border);
  background: var(--inv-surface-2);
}
.total-label {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--inv-muted);
}
.total-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--inv-text);
  letter-spacing: -.02em;
}

/* ── TABLE EMPTY STATE ──────────────────────────────────────── */
.table-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--inv-muted);
}
.table-empty i { font-size: 1.8rem; opacity: .3; display: block; margin-bottom: 10px; }
.table-empty p { font-size: .8rem; margin: 0; }

/* ── METHOD GRID (payment methods) ─────────────────────────── */
.method-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 6px;
}
.method-opt {
  padding: 9px 8px;
  background: var(--inv-surface-2);
  border: 1.5px solid var(--inv-border);
  border-radius: var(--inv-radius-sm);
  text-align: center;
  cursor: pointer;
  font-size: .75rem;
  font-weight: 600;
  color: var(--inv-muted);
  transition: all .15s;
  user-select: none;
}
.method-opt:hover { border-color: var(--inv-accent); color: var(--inv-text); }
.method-opt.selected { border-color: var(--inv-accent); background: #4f7fff1a; color: #6a93ff; }
.method-opt i { display: block; font-size: 1rem; margin-bottom: 4px; }

/* ── MOTIVO GRID (merma reasons) ────────────────────────────── */
.motivo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.motivo-opt {
  padding: 9px 8px;
  background: var(--inv-surface-2);
  border: 1.5px solid var(--inv-border);
  border-radius: var(--inv-radius-sm);
  text-align: center;
  cursor: pointer;
  font-size: .72rem;
  font-weight: 600;
  color: var(--inv-muted);
  transition: all .15s;
  line-height: 1.3;
  user-select: none;
}
.motivo-opt i { display: block; font-size: .95rem; margin-bottom: 4px; }
.motivo-opt:hover { border-color: var(--inv-danger); color: var(--inv-text); }
.motivo-opt.selected { border-color: var(--inv-danger); background: #f851491a; color: #ff6b6b; }

/* ── WARNING NOTE ───────────────────────────────────────────── */
.warning-note {
  background: #f851490d;
  border: 1px solid #f8514930;
  border-radius: var(--inv-radius-sm);
  padding: 10px 14px;
  font-size: .75rem;
  color: #ff8080;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}

/* ── SEARCH HINT ────────────────────────────────────────────── */
.search-hint {
  text-align: center;
  padding: 20px 0;
  color: var(--inv-muted);
  font-size: .78rem;
}
.search-hint i { display: block; font-size: 1.5rem; opacity: .2; margin-bottom: 8px; }

/* ── VUELTO ROW ─────────────────────────────────────────────── */
.vuelto-row {
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--inv-surface-2);
  border-radius: var(--inv-radius-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ── MERMA RESUMEN ──────────────────────────────────────────── */
.resumen-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: var(--inv-surface-2);
  border-radius: var(--inv-radius-sm);
  margin-bottom: 8px;
}
.resumen-row.highlight { border: 1px solid var(--inv-border); background: transparent; }
.resumen-label {
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--inv-muted);
}
.resumen-val { font-size: .83rem; font-weight: 600; text-align: right; max-width: 160px; }

/* ── MINI TABLE (últimas mermas) ────────────────────────────── */
.mini-table { width: 100%; border-collapse: collapse; font-size: .78rem; }
.mini-table th {
  background: var(--inv-surface-2) !important;
  color: var(--inv-muted) !important;
  font-size: .65rem !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: .07em !important;
  padding: 8px 12px !important;
  border-bottom: 1px solid var(--inv-border) !important;
  border-top: none !important;
}
.mini-table td {
  padding: 9px 12px !important;
  border-bottom: 1px solid var(--inv-border) !important;
  vertical-align: middle !important;
  color: var(--inv-text) !important;
  background: transparent !important;
}
.mini-table tr:last-child td { border-bottom: none !important; }
.mini-table tr:hover td { background: var(--inv-surface-2) !important; }

/* ── 19. MOBILE RESPONSIVE ─────────────────────────────────── */
@media (max-width: 767px) {

  /* Reduce page title size */
  h1 { font-size: 1.1rem !important; }

  /* Container padding */
  .container-fluid { padding-left: 10px !important; padding-right: 10px !important; }

  /* Page header: wrap buttons below title on small screens */
  .d-flex.justify-content-between.align-items-center {
    flex-wrap: wrap;
    gap: 8px;
  }
  .d-flex.justify-content-between.align-items-center > div,
  .d-flex.justify-content-between.align-items-center > a {
    flex-wrap: wrap;
  }

  /* Navbar: remove right border on brand, style expanded links */
  .navbar-brand {
    border-right: none !important;
    padding-right: 0 !important;
  }
  .navbar-collapse.show,
  .navbar-collapse.collapsing {
    border-top: 1px solid var(--inv-border);
    padding-top: 6px;
    padding-bottom: 6px;
  }
  .navbar-nav .nav-link {
    height: auto !important;
    padding: 9px 14px !important;
    border-radius: 6px;
  }
  .navbar-nav .nav-link.active::after { display: none; }

  /* Tables: tighter padding */
  .table thead th { padding: 8px 10px !important; font-size: .62rem !important; }
  .table tbody td { padding: 8px 10px !important; font-size: .8rem !important; }
  .table tfoot td { padding: 8px 10px !important; }

  /* Products table in forms */
  .products-table thead th { padding: 7px 8px !important; font-size: .6rem !important; }
  .products-table td { padding: 8px 8px !important; font-size: .78rem !important; }
  .qty-input { width: 56px; }

  /* Payment method grid: 2 columns on mobile */
  .method-grid { grid-template-columns: repeat(2, 1fr); }
  .motivo-grid { grid-template-columns: repeat(2, 1fr); }

  /* Detail info sections */
  .detail-meta-label { font-size: .72rem; }
  .detail-meta-value { font-size: .88rem; }

  /* Buttons in detail pages */
  .d-flex.gap-2.mt-2 { flex-wrap: wrap; }

  /* KPI cards: already 2 per row via col-6, just reduce padding */
  .kpi-card { padding: 12px 14px !important; }
  .kpi-value { font-size: 1.25rem; }
  .kpi-icon { width: 36px; height: 36px; font-size: .9rem; }

  /* Hide total-bar label on very small screens */
  .total-label { font-size: .65rem; }
  .total-value { font-size: 1.05rem; }

  /* Vuelto row */
  .vuelto-row { flex-direction: column; align-items: flex-start; gap: 4px; }

  /* Cards in detail pages */
  .card-body .row.g-3 > [class*="col-md"] { margin-bottom: 4px; }
}
