/* sociedad-badge movido a components.css (compartido) */

/*************************************************************
 * DROPDOWN DE USUARIO — selector de sociedades
 *************************************************************/
.drop-soc-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #94a3b8;
  padding: 8px 14px 4px;
  margin: 0;
}
.drop-soc-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 7px 14px;
  border: none;
  background: none;
  font-size: 0.85rem;
  color: #374151;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.12s;
}
.drop-soc-btn:hover { background: #f1f5f9; }
.drop-soc-btn.activa {
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 600;
}
.drop-soc-btn.activa::before { content: "✓ "; }

/*************************************************************
 * PAGE HEADER
 *************************************************************/
.compras-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.compras-page-header h1 {
  font-size: 1.4rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 4px;
  letter-spacing: -0.02em;
}
.compras-subtitulo {
  font-size: 0.85rem;
  color: #64748b;
  margin: 0;
}

/*************************************************************
 * STATS
 *************************************************************/
.compras-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}
.stat-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.stat-icon { font-size: 1.6rem; }
.stat-label {
  font-size: 0.75rem;
  color: #64748b;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 2px;
}
.stat-num {
  font-size: 1.6rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0;
  line-height: 1;
}

/*************************************************************
 * FILTROS CHIPS
 *************************************************************/
.compras-filtros {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 16px;
}
.filtro-chip {
  padding: 5px 14px;
  border-radius: 999px;
  border: 1.5px solid #e2e8f0;
  background: #f8fafc;
  color: #475569;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.13s;
}
.filtro-chip:hover  { background: #f1f5f9; border-color: #cbd5e1; }
.filtro-chip.activo { background: #0f172a; color: #fff; border-color: #0f172a; }

/*************************************************************
 * LISTA DE SOLICITUDES — cards
 *************************************************************/
.compras-sol-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
  transition: box-shadow 0.15s;
}
.compras-sol-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.09); }

.compras-sol-top {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.compras-sol-docnum {
  font-size: 0.9rem;
  font-weight: 800;
  color: #0f172a;
  font-family: monospace;
  background: #f1f5f9;
  padding: 3px 8px;
  border-radius: 6px;
}
.compras-sol-depto {
  font-size: 0.8rem;
  color: #64748b;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 2px 8px;
}
.compras-sol-acciones {
  display: flex;
  gap: 6px;
  margin-left: auto;
}
.compras-sol-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}
.compras-sol-meta-item {
  font-size: 0.78rem;
  color: #64748b;
}
.compras-sol-meta-item b { color: #374151; }

/*************************************************************
 * EMPTY STATE (lista vacía)
 *************************************************************/
.compras-empty {
  text-align: center;
  padding: 60px 20px;
  color: #94a3b8;
}
.compras-empty-icon  { font-size: 3rem; display: block; margin-bottom: 12px; }
.compras-empty-titulo { font-size: 1.1rem; font-weight: 700; color: #64748b; margin: 0 0 6px; }
.compras-empty-sub    { font-size: 0.875rem; margin: 0; }

/*************************************************************
 * BANNER DEPARTAMENTO
 *************************************************************/
.compras-banner {
  border-radius: 10px;
  padding: 11px 16px;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.compras-banner--info    { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.compras-banner--success { background: #f0fdf4; color: #15803d; border: 1px solid #86efac; }
.compras-banner--error   { background: #fff1f2; color: #be123c; border: 1px solid #fecdd3; }

/* Banner selector múltiple de departamento */
.compras-banner--selector {
  background: #f5f3ff;
  color: #5b21b6;
  border: 1px solid #c4b5fd;
  flex-wrap: wrap;
  gap: 10px;
}
.dept-cards-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}
.dept-card-btn {
  padding: 6px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid #c4b5fd;
  background: #ede9fe;
  color: #5b21b6;
  transition: all .15s;
}
.dept-card-btn:hover  { background: #ddd6fe; border-color: #a78bfa; }
.dept-card-btn.active { background: #7c3aed; color: #fff; border-color: #7c3aed; }
.dept-cambiar-btn {
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid #86efac;
  background: #f0fdf4;
  color: #15803d;
  margin-left: auto;
  transition: all .15s;
}
.dept-cambiar-btn:hover { background: #dcfce7; border-color: #4ade80; }

/* Formulario bloqueado hasta seleccionar departamento */
#formBody {
  position: relative;
  transition: opacity .2s;
}
#formBody.form-bloqueado {
  opacity: 0.4;
  pointer-events: none;
  user-select: none;
}

/*************************************************************
 * CARDS DEL FORMULARIO
 *************************************************************/
.compras-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 20px 22px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.compras-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid #f1f5f9;
}
.compras-card-titulo {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
}
.compras-docnum {
  font-size: 0.9rem;
  font-weight: 700;
  color: #374151;
  font-family: monospace;
  background: #f1f5f9;
  padding: 4px 10px;
  border-radius: 6px;
}

/*************************************************************
 * GRID DE CAMPOS
 *************************************************************/
.compras-form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
@media (max-width: 800px) {
  .compras-form-grid { grid-template-columns: 1fr; }
  .compras-stats { grid-template-columns: repeat(2, 1fr); }
}
.compras-field       { display: flex; flex-direction: column; gap: 5px; }
.compras-field--full { grid-column: 1 / -1; }

.compras-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #374151;
}
.req { color: #ef4444; }

.compras-input,
.compras-select {
  padding: 9px 12px;
  border: 1.5px solid #e2e8f0;
  border-radius: 9px;
  font-size: 0.875rem;
  color: #0f172a;
  font-family: inherit;
  background: #f8fafc;
  transition: border-color 0.15s, background 0.15s;
}
.compras-input:focus,
.compras-select:focus {
  outline: none;
  border-color: #3b82f6;
  background: #fff;
}

.compras-textarea {
  padding: 9px 12px;
  border: 1.5px solid #e2e8f0;
  border-radius: 9px;
  font-size: 0.875rem;
  color: #0f172a;
  font-family: inherit;
  background: #f8fafc;
  resize: vertical;
  transition: border-color 0.15s;
  line-height: 1.5;
}
.compras-textarea:focus { outline: none; border-color: #3b82f6; background: #fff; }
.compras-char-count { font-size: 0.72rem; color: #94a3b8; margin-top: 2px; }

/*************************************************************
 * ÍTEMS
 *************************************************************/
.compras-items-empty {
  text-align: center;
  padding: 32px;
  color: #94a3b8;
  font-size: 0.9rem;
}
.compras-items-empty span { font-size: 2rem; display: block; margin-bottom: 8px; }

.compras-item-card {
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  margin-bottom: 10px;
  overflow: hidden;
  transition: border-color 0.15s;
}
.compras-item-card:focus-within { border-color: #3b82f6; }

.compras-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #f8fafc;
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid #e2e8f0;
}
.compras-item-head:hover { background: #f1f5f9; }

.compras-item-head-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.compras-item-toggle {
  background: none;
  border: none;
  font-size: 0.85rem;
  color: #64748b;
  cursor: pointer;
  padding: 0 4px;
  flex-shrink: 0;
}
.compras-item-num {
  font-size: 0.875rem;
  font-weight: 600;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}
.compras-item-status {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
  flex-shrink: 0;
}
.compras-item-status.completo   { background: #d1fae5; color: #065f46; }
.compras-item-status.incompleto { background: #fef3c7; color: #92400e; }

.compras-item-head-right { display: flex; gap: 6px; align-items: center; }

.btn-icon {
  background: none;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.9rem;
  cursor: pointer;
  color: #475569;
  transition: background 0.12s, color 0.12s;
}
.btn-icon:hover       { background: #f1f5f9; }
.btn-icon-danger:hover { background: #fee2e2; color: #dc2626; border-color: #fca5a5; }

.compras-item-body {
  padding: 18px 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/*************************************************************
 * BÚSQUEDA DE PRODUCTOS
 *************************************************************/
.compras-field-group { display: flex; flex-direction: column; gap: 8px; }
.compras-field-label-big {
  font-size: 0.9rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
}

.compras-busq-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: #64748b;
}
.compras-busq-tab {
  padding: 4px 12px;
  border-radius: 6px;
  border: 1.5px solid #e2e8f0;
  background: #f8fafc;
  font-size: 0.78rem;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  transition: all 0.12s;
}
.compras-busq-tab.activo {
  background: #0f172a;
  color: #fff;
  border-color: #0f172a;
}

.compras-busq-input {
  width: 100%;
  padding: 10px 40px 10px 14px;
  border: 1.5px solid #e2e8f0;
  border-radius: 9px;
  font-size: 0.85rem;
  font-family: inherit;
  color: #0f172a;
  background: #f8fafc url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398l3.85 3.85a1 1 0 0 0 1.415-1.415l-3.868-3.833zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'/%3E%3C/svg%3E") no-repeat right 12px center;
  box-sizing: border-box;
  transition: border-color 0.15s;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.compras-busq-input:focus { outline: none; border-color: #3b82f6; background-color: #fff; }
.compras-busq-input::placeholder { color: #94a3b8; font-size: 0.78rem; }

.compras-busq-resultados {
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  max-height: 220px;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0,0,0,0.10);
}
.compras-busq-resultados.oculto { display: none; }

.compras-busq-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  transition: background 0.1s;
}
.compras-busq-row:last-child { border-bottom: none; }
.compras-busq-row:hover { background: #eff6ff; }
.compras-busq-nombre { font-size: 0.875rem; color: #0f172a; font-weight: 500; }
.compras-busq-codigo { font-size: 0.75rem; color: #3b82f6; font-family: monospace; }
.compras-busq-loading,
.compras-busq-empty {
  padding: 14px;
  text-align: center;
  font-size: 0.85rem;
  color: #64748b;
  margin: 0;
}

.compras-producto-sel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #eff6ff;
  border: 1.5px solid #bfdbfe;
  border-radius: 10px;
  padding: 10px 14px;
}
.compras-producto-sel.oculto { display: none; }
.compras-producto-sel strong { font-size: 0.875rem; color: #0f172a; display: block; }
.compras-item-code  { font-size: 0.75rem; color: #3b82f6; font-family: monospace; }
.compras-cambiar-btn {
  background: none;
  border: none;
  color: #3b82f6;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.compras-cambiar-btn:hover { text-decoration: underline; }

/* Badge "SAP" — indica que el precio proviene de SAP */
.compras-sap-price-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
  border-radius: 4px;
  padding: 1px 5px;
  vertical-align: middle;
  margin-left: 4px;
}

/*************************************************************
 * PRESUPUESTO
 *************************************************************/
.compras-budget-card { background: #f8fafc; }
.compras-budget-hint {
  font-size: 0.75rem;
  color: #94a3b8;
  font-weight: 400;
  margin-left: 6px;
}
.compras-budget-rows { display: flex; flex-direction: column; gap: 10px; }
.compras-budget-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  color: #374151;
  padding-bottom: 8px;
  border-bottom: 1px solid #e2e8f0;
}
.compras-budget-total {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  border-bottom: none;
  padding-bottom: 0;
}

/*************************************************************
 * PIE DEL FORMULARIO
 *************************************************************/
.compras-form-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0 8px;
  margin-top: 4px;
}

/*************************************************************
 * MODAL DETALLE DE SOLICITUD
 *************************************************************/
.compras-modal-detalle {
  width: min(960px, 96vw);
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.compras-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid #f1f5f9;
}
.compras-modal-header h3 {
  font-size: 1.1rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0;
  font-family: monospace;
}
.compras-detalle-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  background: #f8fafc;
  border-radius: 10px;
  padding: 14px 16px;
}
.compras-detalle-meta-item { display: flex; flex-direction: column; gap: 2px; }
.compras-detalle-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #94a3b8;
  font-weight: 600;
}
.compras-detalle-valor {
  font-size: 0.9rem;
  color: #0f172a;
  font-weight: 500;
}

/*************************************************************
 * BADGES ESTADO (reutilizados de autorizaciones)
 *************************************************************/
.estado-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1.5px solid transparent;
}

/*************************************************************
 * BTN CERRAR
 *************************************************************/
.btn-cerrar {
  background: none;
  border: none;
  font-size: 1.1rem;
  color: #64748b;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  line-height: 1;
  transition: background 0.12s, color 0.12s;
  flex-shrink: 0;
}
.btn-cerrar:hover { background: #f1f5f9; color: #0f172a; }

/*************************************************************
 * BREADCRUMB (local override)
 *************************************************************/
.breadcrumb { font-size: 0.85rem; color: #64748b; }
.breadcrumb-item { color: inherit; text-decoration: none; }
.breadcrumb-item.active { color: #2563eb; font-weight: 600; }
.breadcrumb-sep { margin: 0 6px; }

/*************************************************************
 * OCULTO
 *************************************************************/
.oculto { display: none !important; }

/* Estilos de la campana de notificaciones → components.css (compartidos) */
