/* ============================================
   VRLG REFORMAS — admin.css
   ============================================ */

.admin-page,
.admin-shell,
.admin-main,
.portal-main {
  overflow-x: hidden;
}

.admin-shell .container {
  max-width: 1440px;
}

.admin-layout {
  display: grid;
  grid-template-columns: 460px minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}

.admin-left,
.admin-right {
  min-width: 0;
}

/* Cards */
.admin-card {
  background: var(--blanco);
  border: 1px solid var(--gris-mid);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
}

.admin-card-header {
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--gris-mid);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--blanco);
}

.admin-card-header--column {
  align-items: flex-start;
}

.admin-card-header h3 {
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 700;
  color: var(--azul);
  margin: 0;
}

.admin-card-body {
  padding: 0;
}

.admin-card-body--padded {
  padding: 16px 18px;
}

.admin-subtext {
  font-size: 13px;
  color: var(--gris-texto);
  margin-top: 4px;
  line-height: 1.5;
}

/* Badge */
.badge-admin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--azul-light);
  color: var(--azul);
  font-family: var(--font-head);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

/* Toolbar */
.admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  width: 100%;
  margin-top: 8px;
}

.admin-toolbar-left,
.admin-toolbar-right {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.admin-toolbar input,
.admin-toolbar select {
  min-height: 40px;
  padding: 10px 12px;
  border: 1px solid var(--gris-mid);
  border-radius: var(--radius-md);
  background: var(--gris-claro);
  color: var(--negro);
  font-size: 13px;
}

/* Buttons */
.mini-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 10px;
  background: var(--azul);
  color: var(--blanco);
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 700;
  border: none;
  text-decoration: none;
  white-space: nowrap;
  transition: all var(--transition);
}

.mini-btn:hover {
  background: var(--azul-mid);
}

/* Workers list */
.workers-list {
  display: flex;
  flex-direction: column;
}

.worker-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--gris-mid);
}

.worker-list-item:last-child {
  border-bottom: none;
}

.worker-list-main {
  flex: 1;
  min-width: 0;
}

.worker-list-name {
  font-family: var(--font-head);
  font-size: 15px;
  font-weight: 700;
  color: var(--azul);
  line-height: 1.45;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.worker-list-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.worker-list-meta span {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--gris-claro);
  color: var(--gris-oscuro);
  font-size: 12px;
  line-height: 1.3;
}

.worker-list-action {
  flex-shrink: 0;
}

.worker-list-empty {
  padding: 16px;
  color: var(--gris-texto);
  font-size: 14px;
}

/* Tables */
.admin-table-wrap {
  width: 100%;
  overflow: hidden;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.admin-table th,
.admin-table td {
  padding: 12px 10px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--gris-mid);
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.admin-table th {
  font-family: var(--font-head);
  font-size: 12px;
  font-weight: 700;
  color: var(--azul);
  background: var(--blanco);
}

/* Entries */
.admin-table--entries th:nth-child(1),
.admin-table--entries td:nth-child(1) { width: 30%; }

.admin-table--entries th:nth-child(2),
.admin-table--entries td:nth-child(2) { width: 11%; }

.admin-table--entries th:nth-child(3),
.admin-table--entries td:nth-child(3) { width: 11%; }

.admin-table--entries th:nth-child(4),
.admin-table--entries td:nth-child(4) { width: 12%; }

.admin-table--entries th:nth-child(5),
.admin-table--entries td:nth-child(5) { width: 12%; }

.admin-table--entries th:nth-child(6),
.admin-table--entries td:nth-child(6) { width: 14%; }

.admin-table--entries th:nth-child(7),
.admin-table--entries td:nth-child(7) { width: 10%; }

/* Requests */
.admin-table--requests th:nth-child(1),
.admin-table--requests td:nth-child(1) { width: 28%; }

.admin-table--requests th:nth-child(2),
.admin-table--requests td:nth-child(2) { width: 12%; }

.admin-table--requests th:nth-child(3),
.admin-table--requests td:nth-child(3) { width: 12%; }

.admin-table--requests th:nth-child(4),
.admin-table--requests td:nth-child(4) { width: 12%; }

.admin-table--requests th:nth-child(5),
.admin-table--requests td:nth-child(5) { width: 20%; }

.admin-table--requests th:nth-child(6),
.admin-table--requests td:nth-child(6) { width: 8%; }

.admin-table--requests th:nth-child(7),
.admin-table--requests td:nth-child(7) { width: 8%; }

/* Logs */
.admin-table--logs th:nth-child(1),
.admin-table--logs td:nth-child(1) { width: 22%; }

.admin-table--logs th:nth-child(2),
.admin-table--logs td:nth-child(2) { width: 20%; }

.admin-table--logs th:nth-child(3),
.admin-table--logs td:nth-child(3) { width: 58%; }

.admin-muted {
  color: var(--gris-texto);
  font-size: 12px;
}

.request-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.request-actions .mini-btn {
  min-width: 96px;
}

/* Responsive */
@media (max-width: 1280px) {
  .admin-layout {
    grid-template-columns: 400px minmax(0, 1fr);
  }

  .admin-table th,
  .admin-table td {
    padding: 11px 8px;
    font-size: 13px;
  }
}

@media (max-width: 1024px) {
  .admin-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .admin-layout {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }

  .admin-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-toolbar-left,
  .admin-toolbar-right {
    width: 100%;
  }

  .admin-toolbar input,
  .admin-toolbar select,
  .admin-toolbar .mini-btn {
    width: 100%;
  }

  .worker-list-item {
    flex-direction: column;
    align-items: stretch;
  }

  .worker-list-action .mini-btn {
    width: 100%;
  }

  .admin-table thead {
    display: none;
  }

  .admin-table,
  .admin-table tbody,
  .admin-table tr,
  .admin-table td {
    display: block;
    width: 100%;
  }

  .admin-table tr {
    padding: 14px 14px 10px;
    border-bottom: 1px solid var(--gris-mid);
    background: var(--blanco);
  }

  .admin-table td {
    border: none;
    padding: 6px 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
    font-size: 14px;
    text-align: left !important;
  }

  .admin-table td::before {
    content: attr(data-label);
    min-width: 90px;
    flex-shrink: 0;
    font-family: var(--font-head);
    font-weight: 700;
    color: var(--azul);
  }

  .admin-table td:last-child {
    padding-top: 10px;
  }

  .admin-table td:last-child .mini-btn {
    width: 100%;
  }

  .request-actions {
    width: 100%;
    flex-direction: column;
  }

  .request-actions .mini-btn {
    width: 100%;
  }
}

/* Ajustes finos de tablas derechas */
.admin-table--entries td:nth-child(6),
.admin-table--requests td:nth-child(6),
.admin-table--requests td:nth-child(7),
.admin-table--logs td:nth-child(2) {
  word-break: normal;
  overflow-wrap: break-word;
  hyphens: none;
}

/* Más espacio para Origen en registros */
.admin-table--entries th:nth-child(1),
.admin-table--entries td:nth-child(1) { width: 28%; }

.admin-table--entries th:nth-child(2),
.admin-table--entries td:nth-child(2) { width: 10%; }

.admin-table--entries th:nth-child(3),
.admin-table--entries td:nth-child(3) { width: 10%; }

.admin-table--entries th:nth-child(4),
.admin-table--entries td:nth-child(4) { width: 10%; }

.admin-table--entries th:nth-child(5),
.admin-table--entries td:nth-child(5) { width: 10%; }

.admin-table--entries th:nth-child(6),
.admin-table--entries td:nth-child(6) { width: 22%; }

.admin-table--entries th:nth-child(7),
.admin-table--entries td:nth-child(7) { width: 10%; }

/* Más espacio para Estado / Acción en solicitudes */
.admin-table--requests th:nth-child(1),
.admin-table--requests td:nth-child(1) { width: 22%; }

.admin-table--requests th:nth-child(2),
.admin-table--requests td:nth-child(2) { width: 10%; }

.admin-table--requests th:nth-child(3),
.admin-table--requests td:nth-child(3) { width: 10%; }

.admin-table--requests th:nth-child(4),
.admin-table--requests td:nth-child(4) { width: 10%; }

.admin-table--requests th:nth-child(5),
.admin-table--requests td:nth-child(5) { width: 20%; }

.admin-table--requests th:nth-child(6),
.admin-table--requests td:nth-child(6) { width: 12%; }

.admin-table--requests th:nth-child(7),
.admin-table--requests td:nth-child(7) { width: 16%; }

/* Logs: más espacio para tipo */
.admin-table--logs th:nth-child(1),
.admin-table--logs td:nth-child(1) { width: 22%; }

.admin-table--logs th:nth-child(2),
.admin-table--logs td:nth-child(2) { width: 26%; }

.admin-table--logs th:nth-child(3),
.admin-table--logs td:nth-child(3) { width: 52%; }

/* Botones de acciones más limpios */
.request-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-start;
}

.request-actions .mini-btn {
  min-width: 96px;
}
/* ============================================
   FIX MÓVIL TABLAS DERECHAS ADMIN
   ============================================ */
@media (max-width: 768px) {
  .admin-right .admin-table-wrap {
    overflow: hidden;
  }

  .admin-right .admin-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
  }

  .admin-right .admin-table thead {
    display: none !important;
  }

  .admin-right .admin-table,
  .admin-right .admin-table tbody,
  .admin-right .admin-table tr,
  .admin-right .admin-table td {
    display: block !important;
    width: 100% !important;
  }

  .admin-right .admin-table tr {
    background: var(--blanco);
    border-bottom: 1px solid var(--gris-mid);
    padding: 14px 14px 10px;
  }

  .admin-right .admin-table td {
    border: none !important;
    padding: 7px 0 !important;
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: flex-start !important;
    gap: 12px !important;
    text-align: left !important;
    font-size: 14px !important;
    line-height: 1.45 !important;
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
    white-space: normal !important;
  }

  .admin-right .admin-table td::before {
    content: attr(data-label);
    min-width: 92px;
    max-width: 92px;
    flex: 0 0 92px;
    font-family: var(--font-head);
    font-weight: 700;
    color: var(--azul);
    white-space: nowrap;
  }

  .admin-right .admin-table td > * {
    min-width: 0;
    max-width: 100%;
  }

  .admin-right .admin-table td:last-child {
    padding-top: 10px !important;
  }

  .admin-right .admin-table td:last-child .mini-btn,
  .admin-right .admin-table td:last-child .request-actions,
  .admin-right .admin-table td:last-child .request-actions .mini-btn {
    width: 100%;
  }

  .admin-right .request-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
  }

  .admin-right .admin-muted {
    display: inline-block;
    margin-top: 4px;
  }
}