/**
 * Tabla de administración de oficios — Control de Gestión
 * Paleta alineada con verdes institucionales (#235B4E / #006657)
 */

.cg-card-oficios {
  border: none;
  overflow: hidden;
}

.cg-card-oficios > .card-header {
  background: linear-gradient(90deg, #f4f9f7 0%, #ffffff 55%);
  border-bottom: 1px solid #e0ebe7;
  font-weight: 600;
  font-size: 0.88rem;
  color: #0d4a3f;
  letter-spacing: 0.02em;
  padding: 0.85rem 1.25rem;
}

/* Pestañas integradas en el card-header (sustituyen el título «Oficios») */
.cg-card-oficios > .card-header.cg-oficios-card-header-tabs {
  padding: 0.4rem 0.65rem 0;
}

@media (min-width: 768px) {
  .cg-card-oficios > .card-header.cg-oficios-card-header-tabs {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

.cg-oficios-nav-tabs {
  border-bottom: none;
}

.cg-oficios-nav-tabs .nav-item {
  margin-bottom: 0;
}

.cg-oficios-nav-tabs .nav-link {
  margin-bottom: -1px;
  border: 1px solid transparent;
  border-radius: 8px 8px 0 0;
  font-size: 0.78rem;
  font-weight: 500;
  color: rgba(13, 74, 63, 0.78) !important;
  padding: 0.5rem 0.5rem;
  letter-spacing: 0.01em;
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease;
}

.cg-oficios-nav-tabs .nav-link:hover:not(.active) {
  background: rgba(255, 255, 255, 0.7);
  border-color: rgba(224, 235, 231, 0.95);
}

.cg-oficios-nav-tabs .nav-link.active {
  color: #0d4a3f !important;
  font-weight: 600;
  background: #fff;
  border-color: #e0ebe7 #e0ebe7 #fff;
  border-bottom-color: #fff;
}

.cg-oficios-nav-tabs .badge {
  font-size: 0.65rem;
  font-weight: 600;
  vertical-align: middle;
}

/* Barra acción: nuevo oficio */
.cg-barra-acciones-oficios {
  margin-top: 0.25rem;
}

.cg-btn-capturar-oficio {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 10px;
  background: linear-gradient(145deg, #1a6b5c 0%, #0d4a3f 100%);
  color: #fff !important;
  font-size: 1.35rem;
  box-shadow: 0 2px 8px rgba(13, 74, 63, 0.25);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.cg-btn-capturar-oficio:hover {
  color: #fff !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(13, 74, 63, 0.35);
}

/* Panel de filtros (acordeón) */
.cg-filtros-panel {
  border: 1px solid #e0ebe7;
  border-radius: 10px;
  overflow: hidden;
  background: #fafcfb;
  box-shadow: 0 1px 4px rgba(0, 38, 32, 0.05);
}

.cg-filtros-toggle {
  background: linear-gradient(90deg, #f0f7f5 0%, #fafcfb 100%);
  border: none;
  border-bottom: 1px solid #e0ebe7;
  padding: 0.75rem 1rem;
  font-weight: 600;
  color: #0d4a3f;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 0.2s ease;
}

.cg-filtros-toggle:hover {
  background: #ecf5f2;
}

.cg-filtros-toggle:focus {
  outline: none;
  box-shadow: inset 0 0 0 2px rgba(35, 91, 78, 0.25);
}

.cg-filtros-toggle.collapsed {
  border-bottom-color: transparent;
}

.cg-filtros-toggle-titulo {
  flex: 1 1 auto;
  min-width: 0;
}

.cg-filtros-toggle-meta {
  flex: 0 0 auto;
}

.cg-filtros-chevron {
  transition: transform 0.25s ease;
  font-size: 0.8rem;
  color: #235b4e;
}

.cg-filtros-toggle:not(.collapsed) .cg-filtros-chevron {
  transform: rotate(180deg);
}

.cg-filtros-inner {
  padding: 1rem 1rem 1.1rem;
  background: #fff;
}

.cg-filtros-descripcion {
  font-size: 0.78rem;
  line-height: 1.4;
}

.cg-filtros-grupo-label {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(13, 74, 63, 0.65);
}

.cg-filtros-switches {
  gap: 0.35rem;
}

.cg-filtros-sep {
  margin: 1rem 0 1.1rem;
  border: none;
  border-top: 1px solid #e8eeec;
}

.cg-oficios-total-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  margin-bottom: 0.75rem;
  padding: 0.55rem 0.9rem;
  background: linear-gradient(90deg, rgba(35, 91, 78, 0.09) 0%, rgba(248, 250, 249, 0.6) 100%);
  border-radius: 10px;
  border-left: 4px solid #235b4e;
  font-size: 0.82rem;
}

.cg-oficios-total-bar .badge {
  font-size: 0.78rem;
  padding: 0.4em 0.75em;
}

/* Contenedor exterior */
.cg-tabla-oficios-outer {
  margin-top: 0.25rem;
  background: #fff;
  border-radius: 12px;
  box-shadow:
    0 4px 24px rgba(0, 38, 32, 0.07),
    0 1px 3px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(35, 91, 78, 0.1);
  overflow: hidden;
}

.cg-tabla-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-height: min(70vh, 720px);
}

/* Tabla */
table.cg-tabla-oficios {
  width: 100%;
  margin-bottom: 0;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.75rem;
}

.cg-tabla-oficios thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: linear-gradient(180deg, #0f5247 0%, #0a3d34 100%);
  color: #f0f7f6;
  font-weight: 600;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 0.75rem 0.6rem;
  border: none;
  border-bottom: 2px solid rgba(255, 255, 255, 0.12);
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  vertical-align: middle;
}

.cg-tabla-oficios thead th:first-child {
  padding-left: 1rem;
  min-width: 200px;
}

.cg-tabla-oficios thead th:last-child {
  padding-right: 1rem;
}

.cg-tabla-oficios thead th.text-center {
  text-align: center;
}

.cg-tabla-oficios tbody tr {
  background: #fff;
  transition: background 0.18s ease, box-shadow 0.18s ease;
}

.cg-tabla-oficios tbody tr:nth-child(even) {
  background: #f7faf9;
}

.cg-tabla-oficios tbody tr:hover {
  background: #ecf5f2 !important;
  box-shadow: inset 4px 0 0 #235b4e;
}

.cg-tabla-oficios tbody td {
  padding: 0.55rem 0.6rem;
  vertical-align: middle;
  border-top: 1px solid #e5ece9;
  color: #2a3532;
  line-height: 1.4;
  font-size: 0.75rem;
}

.cg-tabla-oficios tbody td:first-child {
  padding-left: 1rem;
}

.cg-tabla-oficios tbody td:last-child {
  padding-right: 1rem;
}

/* Columna unificada Folio + Oficio */
.cg-tabla-oficios .cg-celda-folio-oficio {
  min-width: 200px;
  max-width: 300px;
  width: 240px;
  vertical-align: middle;
  padding-top: 0.6rem !important;
  padding-bottom: 0.6rem !important;
  padding-left: 1rem !important;
  padding-right: 1rem !important;
}

.cg-ident-oficio {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.cg-ident-folio-wrap,
.cg-ident-oficio-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
}

.cg-ident-meta {
  display: block;
  font-size: 0.56rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(13, 74, 63, 0.55);
  line-height: 1;
}

.cg-ident-folio {
  display: block;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 0.9rem;
  color: #0d4a3f;
  letter-spacing: 0.02em;
  line-height: 1.3;
  word-break: break-word;
}

.cg-ident-oficio-num {
  display: block;
  font-variant-numeric: tabular-nums;
  font-size: 0.8rem;
  font-weight: 500;
  color: #3d4a47;
  line-height: 1.35;
  word-break: break-word;
}

.cg-ident-oficio-wrap {
  padding-top: 0.45rem;
  border-top: 1px solid rgba(35, 91, 78, 0.12);
}

.cg-tabla-oficios .cg-celda-fecha {
  font-size: 0.72rem;
  color: #4a5552;
  white-space: nowrap;
}

.cg-tabla-oficios .cg-celda-limite {
  color: #b83226;
  font-weight: 600;
  font-size: 0.72rem;
  white-space: nowrap;
}

.cg-tabla-oficios .cg-celda-asunto {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 240px;
  line-height: 1.35;
}

.cg-tabla-oficios .cg-celda-nombre {
  max-width: 160px;
  font-size: 0.72rem;
}

.cg-tabla-oficios .cg-celda-retorno {
  font-size: 0.68rem;
  font-weight: 600;
  color: #3d4845;
}

.cg-tabla-oficios .cg-celda-retorno p {
  margin-bottom: 0.25rem;
}

.cg-tabla-oficios .cg-celda-capturo {
  font-size: 0.72rem;
  color: #4a5552;
}

/* Badges de estatus agrupados */
.cg-badges-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: center;
  align-items: center;
  max-width: 320px;
  margin: 0 auto;
}

.cg-badges-cell .badge {
  font-weight: 500;
  font-size: 0.56rem;
  padding: 0.32em 0.55em;
  line-height: 1.2;
  border-radius: 999px;
}

/* Icono ayuda turnado */
.cg-tabla-oficios .cg-icon-ayuda {
  font-size: 1.15rem;
  color: #235b4e;
  opacity: 0.9;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.cg-tabla-oficios tbody tr:hover .cg-icon-ayuda {
  opacity: 1;
  transform: scale(1.05);
}

/* Paginación */
.cg-pagination-oficios {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  background: #f8faf9;
  border-radius: 10px;
  border: 1px solid #e3ebe8;
}

.cg-pagination-oficios .pagination {
  margin-bottom: 0;
  justify-content: center;
  flex-wrap: wrap;
}

.cg-pagination-oficios .page-link {
  color: #235b4e;
  border-color: #d5e3df;
  padding: 0.35rem 0.55rem;
  font-size: 0.78rem;
}

.cg-pagination-oficios .page-item.active .page-link {
  background-color: #235b4e;
  border-color: #235b4e;
  color: #fff;
}

.cg-pagination-oficios .page-link:hover {
  background-color: #ecf5f2;
  border-color: #235b4e;
  color: #0a3d34;
}

/* Pestañas: refinar badges de conteo */
#navTabsOficios .nav-link {
  font-size: 0.8rem;
  font-weight: 500;
  color: #4a5552;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 0.65rem 0.85rem;
  transition: color 0.15s ease, border-color 0.15s ease;
}

#navTabsOficios .nav-link:hover {
  color: #235b4e;
  border-bottom-color: rgba(35, 91, 78, 0.35);
}

#navTabsOficios .nav-link.active {
  color: #0a3d34;
  font-weight: 600;
  border-bottom-color: #235b4e;
  background: transparent;
}

#navTabsOficios .nav-link .badge {
  font-size: 0.65rem;
  vertical-align: middle;
  background-color: #e8f0ed !important;
  color: #0d4a3f !important;
  border: 1px solid rgba(35, 91, 78, 0.25);
}

#navTabsOficios .nav-link.active .badge {
  background-color: #235b4e !important;
  color: #fff !important;
  border-color: #235b4e;
}

@media (max-width: 991px) {
  .cg-tabla-oficios thead th {
    font-size: 0.58rem;
    padding: 0.55rem 0.4rem;
  }

  .cg-tabla-oficios tbody td {
    padding: 0.5rem 0.4rem;
    font-size: 0.7rem;
  }

  .cg-tabla-scroll {
    max-height: none;
  }
}
