/* ── Variables ya en style.css, solo estilos específicos del historial ── */

.nav-link {
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 14px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 20px;
  transition: all 0.2s;
}
.nav-link:hover { background: rgba(255,255,255,0.1); color: #fff; }

/* Hero */
.hist-main { padding: 32px 0 60px; }
.hist-hero { margin-bottom: 28px; }
.hist-title {
  font-family: 'DM Serif Display', serif;
  font-size: 28px;
  color: #1A3A5C;
  margin-bottom: 16px;
}

.global-stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.gstat {
  background: #fff;
  border: 1px solid #E9ECEF;
  border-radius: 10px;
  padding: 14px 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 110px;
  box-shadow: 0 2px 8px rgba(26,58,92,0.06);
}
.gstat-val   { font-size: 28px; font-weight: 700; color: #1A3A5C; line-height: 1; }
.gstat-label { font-size: 11px; color: #6C757D; margin-top: 4px; font-weight: 500; text-align: center; }

/* Layout */
.hist-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 768px) { .hist-layout { grid-template-columns: 1fr; } }

/* Sidebar */
.hist-sidebar {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #E9ECEF;
  box-shadow: 0 2px 8px rgba(26,58,92,0.06);
  overflow: hidden;
  position: sticky;
  top: 76px;
}
.sidebar-header {
  padding: 16px;
  border-bottom: 1px solid #E9ECEF;
  background: #F8F9FA;
}
.sidebar-title { font-size: 13px; font-weight: 700; color: #1A3A5C; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 10px; }
.sidebar-search {
  width: 100%;
  background: #fff;
  border: 1.5px solid #DEE2E6;
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 12px;
  font-family: inherit;
  outline: none;
}
.sidebar-search:focus { border-color: #1A3A5C; }

.empresa-list { max-height: calc(100vh - 280px); overflow-y: auto; }

.empresa-item {
  padding: 12px 16px;
  border-bottom: 1px solid #F0F0F0;
  cursor: pointer;
  transition: background 0.15s;
}
.empresa-item:hover    { background: #F0F5FF; }
.empresa-item.active   { background: #E8F0FE; border-left: 3px solid #1A3A5C; }
.empresa-item-nombre   { font-size: 13px; font-weight: 600; color: #1A3A5C; line-height: 1.3; }
.empresa-item-ruc      { font-size: 11px; color: #6C757D; margin-top: 2px; }
.empresa-item-meta     { font-size: 11px; color: #ADB5BD; margin-top: 4px; }
.empresa-badge {
  display: inline-block;
  background: #CCE5FF;
  color: #004085;
  border-radius: 10px;
  padding: 1px 8px;
  font-size: 10px;
  font-weight: 600;
  margin-top: 4px;
}

/* Panel derecho */
.hist-panel {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #E9ECEF;
  box-shadow: 0 2px 8px rgba(26,58,92,0.06);
  min-height: 400px;
  overflow: hidden;
}
.panel-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  color: #ADB5BD;
  gap: 12px;
}
.panel-empty-icon { font-size: 48px; }
.panel-empty p    { font-size: 14px; }

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #E9ECEF;
  background: #F8F9FA;
  gap: 16px;
  flex-wrap: wrap;
}
.panel-empresa-nombre { font-size: 18px; font-weight: 700; color: #1A3A5C; }
.panel-empresa-ruc    { font-size: 12px; color: #6C757D; display: block; margin-top: 2px; }

.panel-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-start; }

/* Filtros */
.filtros-bar {
  display: flex;
  gap: 10px;
  padding: 14px 20px;
  border-bottom: 1px solid #E9ECEF;
  background: #fff;
  flex-wrap: wrap;
  align-items: center;
}
.filtro-select, .filtro-input {
  background: #F8F9FA;
  border: 1.5px solid #DEE2E6;
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 12px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}
.filtro-select:focus, .filtro-input:focus { border-color: #1A3A5C; }
.filtro-input { flex: 1; min-width: 140px; }

/* Botones pequeños */
.btn-sm {
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: 1.5px solid #DEE2E6;
  background: #fff;
  color: #495057;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-sm:hover { background: #F8F9FA; }
.btn-sm.btn-danger  { background: #FFF5F5; color: #DC3545; border-color: #F5C6CB; }
.btn-sm.btn-danger:hover  { background: #DC3545; color: #fff; }
.btn-sm.btn-warning { background: #FFF9E6; color: #856404; border-color: #FFEEBA; }
.btn-sm.btn-warning:hover { background: #FFC107; color: #212529; }
.btn-sm.btn-primary { background: #1A3A5C; color: #fff; border-color: #1A3A5C; }
.btn-sm.btn-primary:hover { background: #2C5282; }
.btn-sm.btn-green   { background: #D4EDDA; color: #155724; border-color: #C3E6CB; }
.btn-sm.btn-green:hover   { background: #28A745; color: #fff; }

/* Tabla */
.tabla-wrapper { overflow-x: auto; }
.hist-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.hist-table th {
  background: #F8F9FA;
  color: #495057;
  font-weight: 600;
  padding: 10px 12px;
  text-align: left;
  border-bottom: 2px solid #E9ECEF;
  white-space: nowrap;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.hist-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #F0F0F0;
  color: #495057;
  vertical-align: middle;
}
.hist-table tr:hover td { background: #F8F9FA; }
.td-empty { text-align: center; color: #ADB5BD; padding: 32px; }

/* Badges de estado */
.badge-estado {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-conciliado    { background: #D4EDDA; color: #155724; }
.badge-diferencias   { background: #FFF3CD; color: #856404; }
.badge-urgencia-alta { background: #F8D7DA; color: #721C24; }
.badge-urgencia-media{ background: #FFF3CD; color: #856404; }
.badge-urgencia-baja { background: #D4EDDA; color: #155724; }
.badge-banco         { background: #CCE5FF; color: #004085; }
.badge-concar        { background: #F8D7DA; color: #721C24; }

.acciones-cell { display: flex; gap: 6px; }

/* Partidas pendientes */
.partidas-section {
  border-top: 2px solid #FFF3CD;
  background: #FFFFF9;
  padding: 20px;
}
.partidas-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.partidas-header h3 { font-size: 14px; font-weight: 700; color: #856404; }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal {
  background: #fff;
  border-radius: 12px;
  padding: 28px;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}
.modal-title { font-size: 16px; font-weight: 700; color: #1A3A5C; margin-bottom: 10px; }
.modal-body  { font-size: 13px; color: #495057; line-height: 1.6; margin-bottom: 20px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

.empty-state-sm { padding: 24px; text-align: center; color: #ADB5BD; font-size: 13px; }

#modalOverlay {
  display: none;
}