/* =====================================
   EMPRESAS A CARGO CSS AISLADO - EMX
   Independiente + modal moderno
===================================== */

/* =========================
   LAYOUT
========================= */
.emx-layout {
  display: block;
}

.emx-main {
  width: 100%;
  min-width: 0;
}

/* =========================
   HEADER
========================= */
.emx-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.emx-header h2 {
  margin: 0;
  font-size: 34px;
  font-weight: 700;
  color: #111827;
}

/* =========================
   BOTONES
========================= */
.emx-btn {
  border: none;
  border-radius: 10px;
  height: 44px;
  padding: 0 18px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  transition: 0.2s ease;
}

.emx-btn:hover {
  transform: translateY(-1px);
}

.emx-btn-primary {
  background: #2f56a6;
  color: white;
}

.emx-btn-primary:hover {
  background: #24468a;
}

.emx-btn-danger {
  background: #ea4335;
  color: white;
}

.emx-btn-danger:hover {
  background: #cf3528;
}

/* =========================
   FILTROS
========================= */
.emx-filters-box {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 20px;
}

.emx-filters-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 16px;
  align-items: end;
}

.emx-field {
  display: flex;
  flex-direction: column;
}

.emx-field label {
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  margin-bottom: 6px;
}

.emx-field input,
.emx-field select {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  font-size: 14px;
  background: white;
  box-sizing: border-box;
}

.emx-field input:focus,
.emx-field select:focus {
  outline: none;
  border-color: #2f56a6;
  box-shadow: 0 0 0 3px rgba(47,86,166,0.12);
}

.emx-filter-action {
  display: flex;
  align-items: end;
}

/* =========================
   TABLA
========================= */
.emx-table-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 16px;
}

.emx-table-scroll {
  width: 100%;
  max-height: 560px;
  overflow-x: auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.emx-table-scroll::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.emx-table-scroll::-webkit-scrollbar-thumb {
  background: #c7ced8;
  border-radius: 20px;
}

.emx-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
}

.emx-table th {
  background: #f3f4f6;
  color: #111827;
  font-size: 13px;
  font-weight: 700;
  text-align: left;
  padding: 12px 14px;
  white-space: nowrap;
}

.emx-table td {
  font-size: 14px;
  padding: 12px 14px;
  border-bottom: 1px solid #f1f1f1;
  white-space: nowrap;
  vertical-align: middle;
}

.emx-table tbody tr:hover {
  background: #fafafa;
}

/* inputs inline si existen */
.emx-table td input,
.emx-table td select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #d0d5dd;
  font-size: 12px;
}

/* =========================
   BADGES ESTADO
========================= */
.estado-badge {
  display: inline-block;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.estado-badge.activo {
  background: #e8f5e9;
  color: #2e7d32;
}

.estado-badge.inactivo {
  background: #fdecea;
  color: #c62828;
}

/* =========================
   MODAL
========================= */
.emx-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 999;
}

.hidden {
  display: none !important;
}

.emx-modal-box {
  background: white;
  width: min(92vw, 520px);
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.18);
}

.emx-modal-box::-webkit-scrollbar {
  width: 8px;
}

.emx-modal-box::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 20px;
}

.emx-modal-box h3 {
  margin: 0 0 18px;
  font-size: 24px;
  color: #111827;
}

/* =========================
   FORM MODAL
========================= */
.emx-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.emx-full {
  grid-column: span 2;
}

.emx-modal-actions {
  grid-column: span 2;
  display: flex;
  margin-top: 8px;
}

.emx-modal-actions .emx-btn {
  width: 100%;
}

.emx-form-grid input.error,
.emx-form-grid select.error {
  border-color: #dc2626;
}

/* =========================
   RESPONSIVE
========================= */
@media (max-width: 768px) {
  .emx-header {
    flex-direction: column;
    align-items: stretch;
  }

  .emx-header h2 {
    font-size: 28px;
  }

  .emx-header .emx-btn {
    width: 100%;
  }

  .emx-filters-grid {
    grid-template-columns: 1fr;
  }

  .emx-filter-action {
    display: block;
  }

  .emx-btn {
    width: 100%;
  }

  .emx-form-grid {
    grid-template-columns: 1fr;
  }

  .emx-full,
  .emx-modal-actions {
    grid-column: span 1;
  }

  .emx-table {
    min-width: 980px;
  }
}

@media (max-width: 480px) {
  .emx-header h2 {
    font-size: 24px;
  }

  .emx-filters-box,
  .emx-table-card,
  .emx-modal-box {
    padding: 14px;
  }
}

/* =====================================
   AJUSTE COMPACTO EMPRESAS A CARGO
   AGREGAR AL FINAL
===================================== */

/* layout */
.emx-layout{
  padding:14px !important;
}

/* header */
.emx-header{
  margin-bottom:14px !important;
}

.emx-header h2{
  font-size:28px !important;
}

/* botones */
.emx-btn{
  height:34px !important;
  padding:0 14px !important;
  font-size:12px !important;
  border-radius:9px !important;
}

/* =========================
   FILTROS MÁS COMPACTOS
========================= */
.emx-filters-box{
  padding:14px !important;
  margin-bottom:14px !important;
}

.emx-filters-grid{
  grid-template-columns:
    1.2fr   /* empresa */
    1fr     /* nit */
    .9fr    /* estado */
    .8fr    /* limpiar */
    !important;

  gap:8px !important;
}

.emx-field label{
  font-size:11px !important;
  margin-bottom:4px !important;
}

.emx-field input,
.emx-field select{
  height:34px !important;
  font-size:12px !important;
  padding:0 10px !important;
  border-radius:9px !important;
}

.emx-filter-action .emx-btn{
  width:100% !important;
}

/* =========================
   TABLA MÁS PEQUEÑA
========================= */
.emx-table-card{
  padding:12px !important;
}

.emx-table th{
  font-size:12px !important;
  padding:10px 12px !important;
}

.emx-table td{
  font-size:12px !important;
  padding:10px 12px !important;
}

/* =========================
   INLINE EDIT MÁS PEQUEÑO
========================= */
.emx-table td input,
.emx-table td select{
  height:28px !important;
  min-height:28px !important;
  padding:0 6px !important;
  font-size:11px !important;
  border-radius:7px !important;
}

.emx-table td select{
  min-width:120px !important;
}

/* badges compactos */
.estado-badge{
  font-size:11px !important;
  padding:4px 8px !important;
}

/* =========================
   MODAL MÁS COMPACTO
========================= */
.emx-modal-box{
  padding:18px !important;
}

.emx-modal-box h3{
  font-size:22px !important;
}

.emx-form-grid{
  gap:12px !important;
}

/* =========================
   RESPONSIVE
========================= */
@media (max-width:1100px){

  .emx-filters-grid{
    grid-template-columns:repeat(2,1fr) !important;
  }
}

@media (max-width:768px){

  .emx-filters-grid{
    grid-template-columns:1fr !important;
  }

  .emx-btn{
    width:100% !important;
  }
}