:root {
  --azul: #0f3d5c;
  --nobar-color-menu: var(--azul);
  --azul-claro: #1a6ea8;
  --gris: #f4f6f8;
  --borde: #dde3e8;
}

/* Sistema → Diagnóstico: patrón común de botones, campos y responsive. */
body:has(#respaldoDetalle) .diagnostico-respaldos,
body:has(#respaldoDetalle) .diagnostico-programacion { display: flex; flex-direction: column; gap: 10px; }
body:has(#respaldoDetalle) .diagnostico-respaldos input,
body:has(#respaldoDetalle) .diagnostico-respaldos textarea,
body:has(#respaldoDetalle) .diagnostico-programacion input[type="number"] { width: 100%; box-sizing: border-box; }
body:has(#respaldoDetalle) #respaldoDetalle { min-height: 56px; resize: none; overflow: hidden; line-height: 1.45; }
body:has(#respaldoDetalle) #respaldoDetalleContador { align-self: flex-end; color: #5f6368; font-size: 12px; margin-top: -6px; }
body:has(#respaldoDetalle) .diagnostico-acciones { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
body:has(#respaldoDetalle) .diagnostico-acciones button { border: 1px solid #111; border-radius: 999px; background: #fff; color: #111; }
body:has(#respaldoDetalle) .diagnostico-acciones button:hover { background: #111; color: #fff; }
.nobar-soporte-aviso { position: sticky; top: 0; z-index: 1000; display: flex; gap: 16px; align-items: center; justify-content: center; padding: 10px 16px; background: #fff3cd; color: #664d03; border-bottom: 1px solid #ffecb5; font-size: 13px; }
.nobar-soporte-aviso button { min-height: 32px; padding: 6px 12px; border: 1px solid #664d03; border-radius: 5px; background: transparent; color: inherit; cursor: pointer; }
body:has(#respaldoDetalle) .diagnostico-check { display: inline-flex; align-items: center; justify-content: flex-start; gap: 8px; margin: 0; }
body:has(#respaldoDetalle) .diagnostico-check input { width: auto; margin: 0; flex: 0 0 auto; }
body:has(#respaldoDetalle) .diagnostico-programacion > label:not(.diagnostico-check) { display: flex; flex-direction: column; gap: 6px; }
body:has(#respaldoDetalle) #estadoProgramacion { margin: 0; }
@media (max-width: 760px) {
  body:has(#respaldoDetalle) .diagnostico-acciones { flex-direction: column; align-items: stretch; }
  body:has(#respaldoDetalle) .diagnostico-acciones button,
  body:has(#respaldoDetalle) #guardarProgramacionRespaldo { width: 100%; margin: 0; }
  body:has(#respaldoDetalle) #tablaRespaldos { display: block; overflow-x: auto; }
  body:has(#respaldoDetalle) #tablaRespaldos th,
  body:has(#respaldoDetalle) #tablaRespaldos td { white-space: normal; min-width: 110px; }
}

/* Control -> Soporte: buscadores de empresa y campos dependientes. */
body:has(#soporteEmpresaBuscar) .soporte-campo { display: grid; gap: 6px; margin: 0 0 10px; font-weight: 700; }
body:has(#soporteEmpresaBuscar) .soporte-campo > span { display: block; }
body:has(#soporteEmpresaBuscar) .soporte-buscador { position: relative; min-width: 0; }
body:has(#soporteEmpresaBuscar) .soporte-buscador input { width: 100%; box-sizing: border-box; padding-right: 42px; }
body:has(#soporteEmpresaBuscar) .soporte-buscador > button { display: block; position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 24px; min-width: 24px; height: 24px; min-height: 24px; margin: 0; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #555; font-size: 16px; line-height: 24px; text-align: center; }
body:has(#soporteEmpresaBuscar) .soporte-buscador > button:hover,
body:has(#soporteEmpresaBuscar) .soporte-buscador > button:focus-visible { background: #111; color: #fff; }
body:has(#soporteEmpresaBuscar) .soporte-buscador > button[hidden] { display: none !important; }
body:has(#soporteEmpresaBuscar) main > .card > table[hidden] { display: none !important; }
body:has(#soporteEmpresaBuscar) main > .card:has(.soporte-buscador) { overflow: visible; }
body:has(#soporteEmpresaBuscar) .soporte-buscador { z-index: 10; }
body:has(#soporteEmpresaBuscar) #soporteCampos,
body:has(#soporteEmpresaBuscar) #ticketCampos { margin-top: 10px; }
body:has(#soporteEmpresaBuscar) #soporteCampos[hidden],
body:has(#soporteEmpresaBuscar) #ticketCampos[hidden] { display: none; }
body:has(#soporteEmpresaBuscar) #soporteCampos > button,
body:has(#soporteEmpresaBuscar) #ticketCampos > button { margin: 0 0 12px; }
body:has(#soporteEmpresaBuscar) #ticketDetalle { min-height: 55px; resize: none; overflow: hidden; }
body:has(#tablaTickets) #versionNotas { display: block; width: 100%; min-height: 55px; box-sizing: border-box; resize: none; overflow: hidden; }
body:has(#soporteEmpresaBuscar) .soporte-contador { display: block; margin-top: -4px; color: #666; font-size: 12px; font-weight: 400; text-align: right; }
body:has(#tablaTickets) #tablaTickets td.soporte-acciones { display: flex; flex-wrap: nowrap !important; justify-content: flex-end !important; align-items: center; gap: 8px; width: 100% !important; min-width: 0; padding-left: 0 !important; padding-right: 0 !important; text-align: right; }
body:has(#tablaTickets) #tablaTickets td.soporte-acciones button { position: static !important; left: auto !important; transform: none !important; width: auto; min-width: 0; min-height: 40px; margin: 0 !important; padding: 0 12px; flex: 0 0 auto; border: 1px solid #8a8a8a; border-radius: 999px; box-sizing: border-box; white-space: nowrap; }
body:has(#tablaVersiones) #tablaVersiones td.soporte-versiones-acciones { display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding-right: 0 !important; text-align: right; }
body:has(#tablaTickets) #tablaTickets th:last-child { text-align: left; padding-left: 0; text-indent: calc(100% - 292px); overflow: visible; }
body:has(#tablaVersiones) #tablaVersiones th:last-child { text-align: left; padding-left: 0; text-indent: calc(100% - 292px); overflow: visible; }
body:has(#tablaVersiones) #tablaVersiones td.soporte-versiones-acciones button { width: auto; min-width: 0; flex: 0 0 auto !important; margin: 0; padding: 0 12px; border: 1px solid #8a8a8a; border-radius: 999px; white-space: nowrap; }
body:has(#tablaVersiones) #tablaVersiones td.soporte-versiones-acciones button:nth-child(1) { min-width: 95px; }
body:has(#tablaVersiones) #tablaVersiones td.soporte-versiones-acciones button:nth-child(2) { min-width: 84px; }
body:has(#tablaVersiones) #tablaVersiones td.soporte-versiones-acciones button:nth-child(3) { min-width: 109px; }
@media (min-width: 761px) {
  body:has(#tablaVersiones) #tablaVersiones th:nth-child(2),
  body:has(#tablaVersiones) #tablaVersiones td:nth-child(2),
  body:has(#tablaVersiones) #tablaVersiones th:nth-child(3),
  body:has(#tablaVersiones) #tablaVersiones td:nth-child(3) { text-indent: 100px; }
}
body:has(#tablaVersiones) #tablaVersiones td.soporte-versiones-acciones .soporte-btn-eliminar { border-color: #b42318; color: #b42318; }
@media (max-width: 760px) {
  body:has(#tablaVersiones) #tablaVersiones td.soporte-versiones-acciones { flex-wrap: nowrap !important; justify-content: flex-end !important; width: 100% !important; padding: 8px 0 !important; }
  body:has(#tablaVersiones) #tablaVersiones td.soporte-versiones-acciones::before { content: "Acciones" !important; display: block !important; flex: 0 0 auto; margin-right: auto; text-align: left; }
  body:has(#tablaVersiones) #tablaVersiones td.soporte-versiones-acciones button { flex: 0 0 auto !important; }
  body:has(#tablaTickets) #tablaTickets td.soporte-acciones { position: relative; padding-top: 8px !important; }
  body:has(#tablaTickets) #tablaTickets td.soporte-acciones::before { display: block !important; content: "Acciones" !important; position: static; flex: 0 0 auto; margin-right: auto; font-weight: 700; color: #111; }
  body:has(#tablaTickets) #tablaTickets td.soporte-acciones button:first-child { margin-left: 0 !important; }
}
body:has(#tablaTickets) #tablaTickets td.soporte-acciones .soporte-btn-seguimiento { border: 1px solid #8a8a8a !important; background: #fff; color: #111; }
body:has(#tablaTickets) #tablaTickets td.soporte-acciones .soporte-btn-seguimiento:hover { background: #111; color: #fff; }
body:has(#tablaTickets) #seguimientoDialog { width: min(520px, calc(100vw - 32px)); max-width: calc(100vw - 32px); padding: 20px; border: 1px solid #c8d0d6; border-radius: 12px; }
body:has(#tablaTickets) #seguimientoDialog::backdrop { background: rgba(0,0,0,.35); }
body:has(#tablaTickets) #seguimientoDialog form { display: grid; gap: 14px; }
body:has(#tablaTickets) #seguimientoDialog textarea { min-height: 110px; resize: vertical; }
body:has(#tablaTickets) .soporte-dialog-acciones { display: flex; justify-content: flex-end; gap: 8px; }
body:has(#tablaTickets) .soporte-dialog-acciones button { min-width: 110px; border: 1px solid #8a8a8a; border-radius: 999px; }
body:has(#tablaTickets) #detalleTicketDialog { width: min(620px, calc(100vw - 32px)); max-width: calc(100vw - 32px); max-height: calc(100vh - 32px); overflow: auto; padding: 20px; border: 1px solid #c8d0d6; border-radius: 12px; }
body:has(#tablaTickets) #detalleTicketDialog::backdrop { background: rgba(0,0,0,.35); }
body:has(#tablaTickets) #detalleTicketDialog form { display: grid; gap: 14px; }
body:has(#tablaTickets) #detalleTicketDatos { display: grid; grid-template-columns: minmax(110px, .35fr) minmax(0, 1fr); gap: 8px 14px; margin: 0; }
body:has(#tablaTickets) #detalleTicketDatos dt { font-weight: 700; }
body:has(#tablaTickets) #detalleTicketDatos dd { margin: 0; overflow-wrap: anywhere; }
body:has(#tablaTickets) #detalleTicketMensajes { display: grid; gap: 8px; }
body:has(#tablaTickets) #detalleTicketMensajes article { padding: 10px; border: 1px solid #dde3e8; border-radius: 8px; }
body:has(#tablaTickets) #detalleTicketMensajes p { margin: 6px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
body:has(#tablaTickets) #detalleTicketCerrar { justify-self: end; min-width: 110px; border: 1px solid #8a8a8a; border-radius: 999px; }
body:has(#tablaVersiones) #notasVersionDialog { width: min(620px, calc(100vw - 32px)); max-width: calc(100vw - 32px); max-height: calc(100vh - 32px); padding: 20px; border: 1px solid #c8d0d6; border-radius: 12px; }
body:has(#tablaVersiones) #notasVersionDialog::backdrop { background: rgba(0,0,0,.35); }
body:has(#tablaVersiones) #notasVersionDialog form { display: grid; gap: 14px; }
body:has(#tablaVersiones) #notasVersionTexto { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
body:has(#tablaVersiones) #notasVersionCerrar { justify-self: end; min-width: 110px; border: 1px solid #8a8a8a; border-radius: 999px; }

/* Control -> Soporte: el historial se convierte en tarjetas en móvil para
   conservar todos sus campos dentro del ancho disponible. */
@media (max-width: 760px) {
  body:has(#tablaAccesosSoporte) main > .card > table,
  body:has(#tablaTickets) main > .card > table,
  body:has(#tablaVersiones) main > .card > table {
    display: block;
    width: 100%;
    min-width: 0;
    overflow: visible;
    border: 0;
    table-layout: auto;
  }

  body:has(#tablaAccesosSoporte) main > .card > table thead,
  body:has(#tablaTickets) main > .card > table thead,
  body:has(#tablaVersiones) main > .card > table thead {
    display: none;
  }

  body:has(#tablaAccesosSoporte) main > .card > table tbody,
  body:has(#tablaTickets) main > .card > table tbody,
  body:has(#tablaVersiones) main > .card > table tbody {
    display: grid;
    gap: 12px;
    width: 100%;
  }

  body:has(#tablaAccesosSoporte) main > .card > table tr,
  body:has(#tablaTickets) main > .card > table tr,
  body:has(#tablaVersiones) main > .card > table tr {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1px solid #c8d0d6;
    border-radius: 10px;
    background: #fff;
  }

  body:has(#tablaAccesosSoporte) main > .card > table td,
  body:has(#tablaTickets) main > .card > table td,
  body:has(#tablaVersiones) main > .card > table td {
    display: flex;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 8px 0;
    border: 0;
    text-align: left;
    overflow-wrap: anywhere;
  }

  body:has(#tablaAccesosSoporte) main > .card > table td + td,
  body:has(#tablaTickets) main > .card > table td + td,
  body:has(#tablaVersiones) main > .card > table td + td {
    border-top: 1px solid #edf0f2;
  }

  body:has(#tablaAccesosSoporte) #tablaAccesosSoporte td::before,
  body:has(#tablaTickets) #tablaTickets td::before,
  body:has(#tablaVersiones) #tablaVersiones td::before {
    flex: 0 0 42%;
    font-weight: 700;
    text-align: left;
  }

  body:has(#tablaAccesosSoporte) #tablaAccesosSoporte td:nth-child(1)::before { content: 'Empresa'; }
  body:has(#tablaAccesosSoporte) #tablaAccesosSoporte td:nth-child(2)::before { content: 'Motivo'; }
  body:has(#tablaAccesosSoporte) #tablaAccesosSoporte td:nth-child(3)::before { content: 'Inicio'; }
  body:has(#tablaAccesosSoporte) #tablaAccesosSoporte td:nth-child(4)::before { content: 'Expira'; }
  body:has(#tablaAccesosSoporte) #tablaAccesosSoporte td:nth-child(5)::before { content: 'Estado'; }
  body:has(#tablaAccesosSoporte) #tablaAccesosSoporte td:nth-child(6)::before { content: 'Acción'; }
  body:has(#tablaTickets) #tablaTickets td:nth-child(1)::before { content: 'Empresa'; }
  body:has(#tablaTickets) #tablaTickets td:nth-child(2)::before { content: 'Asunto'; }
  body:has(#tablaTickets) #tablaTickets td:nth-child(3)::before { content: 'Prioridad'; }
  body:has(#tablaTickets) #tablaTickets td:nth-child(4)::before { content: 'Estado'; }
  body:has(#tablaTickets) #tablaTickets td:nth-child(5)::before { content: 'Acción'; }
  body:has(#tablaVersiones) #tablaVersiones td:nth-child(1)::before { content: 'Versión'; }
  body:has(#tablaVersiones) #tablaVersiones td:nth-child(2)::before { content: 'Título'; }
  body:has(#tablaVersiones) #tablaVersiones td:nth-child(3)::before { content: 'Estado'; }
  body:has(#tablaVersiones) #tablaVersiones td:nth-child(4)::before { content: 'Acción'; }
}

#administradorGlobalDialog { width: min(460px, calc(100vw - 32px)); max-width: calc(100vw - 32px); padding: 24px; }
#administradorGlobalDialog form { display: grid; gap: 14px; }
#administradorGlobalDialog label { display: grid; gap: 6px; }
#administradorGlobalDialog input[type="text"],
#administradorGlobalDialog input[type="email"] { width: 100%; box-sizing: border-box; }
#administradorGlobalDialog fieldset { display: grid; gap: 10px; margin: 0; padding: 14px; }
#administradorGlobalDialog fieldset label { display: grid !important; grid-template-columns: 18px minmax(0, 1fr); align-items: center; justify-content: start !important; gap: 8px; width: 100%; }
#administradorGlobalDialog fieldset input { margin: 0; }
#administradorGlobalDialog form > button { justify-self: end; }

/* Panel global NOBAR FLOW: alineación y acciones consistentes. */
body:has(#listaModulosGlobal) #listaModulosGlobal .permiso-item {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 10px;
  min-height: 42px;
}
body:has(#listaModulosGlobal) #listaModulosGlobal .permiso-item input[type="checkbox"] {
  margin: 0;
  align-self: center;
  justify-self: center;
}

/* Roles: reutiliza la misma cuadrícula de permisos del panel global NOBAR FLOW. */
#listaPermisos .rol-permiso-titulo {
  display: block;
  margin: 14px 0 6px;
}
#listaPermisos .rol-permiso-titulo:first-child {
  margin-top: 0;
}
#listaPermisos .rol-permiso-item {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  column-gap: 10px;
  min-height: 42px;
  margin: 0;
  font-weight: normal;
}
#listaPermisos .rol-permiso-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  padding: 0;
  align-self: center;
  justify-self: center;
}
.panel-admin-acciones {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.panel-admin-acciones .cliente-boton {
  width: 180px;
  min-width: 110px;
  margin: 0;
}

/* Panel global: misma familia visual de Clientes, Historial y Cotizaciones. */
.panel-admin-page main {
  width: calc(100% - 32px);
  max-width: 1400px;
  margin: 24px auto;
  padding: 0;
}
.panel-admin-page main .card {
  width: 100%;
  max-width: none;
  box-sizing: border-box;
  border: 1px solid #c8d0d6;
  border-radius: 12px;
  padding: 20px;
}
.panel-admin-page main > .card { min-width: 0; overflow: hidden; }
.panel-admin-page main > .card > table,
.panel-admin-page main > .card > .table-responsive { width: 100%; max-width: 100%; overflow-x: auto; }
#tablaConsumo { display: table !important; width: 100% !important; max-width: none !important; border: 1px solid #c8d0d6; border-radius: 10px; border-collapse: separate; border-spacing: 0; overflow: hidden; }
#tablaConsumo thead,
#tablaConsumo tbody { width: 100%; }
.buscador-consumo { position: relative; }
.buscador-consumo input { padding-right: 42px; }
.buscador-consumo input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.buscador-consumo #limpiarConsumoEmpresa { display: none; position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 30px; min-width: 30px; height: 30px; min-height: 30px; margin: 0; padding: 0; border: 0; background: transparent; color: #555; font-size: 24px; line-height: 1; }
.panel-admin-page main > .card > table { display: table; width: 100%; table-layout: auto; border: 1px solid #c8d0d6; border-radius: 10px; border-collapse: separate; border-spacing: 0; overflow: hidden; }
.panel-admin-page main > .card > table thead,
.panel-admin-page main > .card > table tbody { width: 100%; }

@media (max-width: 760px) {
  .panel-admin-page .empresas-panel h2,
  .panel-admin-page .empresas-panel p,
  .panel-admin-page .empresas-panel label,
  .panel-admin-page .empresas-panel th,
  .panel-admin-page .empresas-panel td { max-width: 100%; white-space: normal; overflow-wrap: anywhere; word-break: break-word; }
  .buscador-consumo #limpiarConsumoEmpresa:not([hidden]) { display: block; }
  .panel-admin-page #limpiarBuscarEmpresa:not([hidden]) { display: block; }
  #tablaConsumo { display: block !important; border: 0; overflow: visible; }
  #tablaConsumo thead { display: none; }
  #tablaConsumo tbody { display: grid; gap: 12px; }
  #tablaConsumo tbody tr { display: block; padding: 12px; border: 1px solid #c8d0d6; border-radius: 10px; background: #fff; }
  #tablaConsumo tbody td { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border: 0; text-align: right; }
  #tablaConsumo tbody td + td { border-top: 1px solid #edf0f2; }
  #tablaConsumo tbody td::before { font-weight: 700; text-align: left; }
  #tablaConsumo tbody td:nth-child(1)::before { content: 'Empresa'; }
  #tablaConsumo tbody td:nth-child(2)::before { content: 'Usuarios'; }
  #tablaConsumo tbody td:nth-child(3)::before { content: 'Clientes'; }
  #tablaConsumo tbody td:nth-child(4)::before { content: 'Cotizaciones'; }
  #tablaConsumo tbody td:nth-child(5)::before { content: 'Archivos'; }
  #tablaConsumo tbody td:nth-child(6)::before { content: 'Almacenamiento'; }
  #tablaConsumo tbody td:nth-child(7)::before { content: 'Comunicaciones'; }
  .panel-admin-page .empresas-panel .empresas-tabla table { display: block; border: 0; }
  .panel-admin-page .empresas-panel .empresas-tabla thead { display: none; }
  .panel-admin-page .empresas-panel .empresas-tabla tbody { display: grid; gap: 12px; }
  .panel-admin-page .empresas-panel .empresas-tabla tbody tr { display: block; padding: 12px; border: 1px solid #c8d0d6; border-radius: 10px; background: #fff; }
  .panel-admin-page .empresas-panel .empresas-tabla #tablaEmpresasGlobal { display: block !important; table-layout: auto; }
  .panel-admin-page .empresas-panel .empresas-tabla #tablaEmpresasGlobal tbody tr { display: block; width: auto; }
  .panel-admin-page .empresas-panel .empresas-tabla tbody td { display: flex; justify-content: space-between; gap: 12px; min-width: 0; padding: 8px 12px; border: 0; text-align: right; overflow-wrap: anywhere; }
  .panel-admin-page .empresas-panel .empresas-tabla tbody td + td { border-top: 1px solid #edf0f2; }
  .panel-admin-page .empresas-panel .empresas-tabla tbody td::before { font-weight: 700; text-align: left; }
  .panel-admin-page .empresas-panel .empresas-tabla tbody td:nth-child(1)::before { content: 'Empresa'; }
  .panel-admin-page .empresas-panel .empresas-tabla tbody td:nth-child(2)::before { content: 'Plan'; }
  .panel-admin-page .empresas-panel .empresas-tabla tbody td:nth-child(3)::before { content: 'Usuarios'; }
  .panel-admin-page .empresas-panel .empresas-tabla tbody td:nth-child(4)::before { content: 'Estado'; }
  .panel-admin-page .empresas-panel .empresas-tabla tbody td:nth-child(5).panel-admin-acciones { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 40px; justify-content: center !important; justify-items: center; gap: 8px; width: 100% !important; max-width: none !important; box-sizing: border-box; padding: 12px; }
  .panel-admin-page .empresas-panel .empresas-tabla #tablaEmpresasGlobal td:last-child.panel-admin-acciones { width: 100% !important; }
  .panel-admin-page .empresas-panel .empresas-tabla tbody td:nth-child(5).panel-admin-acciones::before { content: 'Acciones'; display: block; grid-column: 1 / -1; margin-bottom: 0; text-align: center; }
  .panel-admin-page .empresas-panel .empresas-tabla .panel-admin-acciones button { width: 100% !important; min-width: 0; max-width: none; margin: 0; font-size: 12px; white-space: nowrap; }
  .panel-admin-page .empresas-busqueda-fila { align-items: stretch; flex-direction: column; gap: 8px; }
  .panel-admin-page .empresas-busqueda-fila > #nuevaEmpresa { width: 100%; }
}

/* Control - Licencias: acciones y tablas responsive. */
.licencias-page > .card { overflow: hidden; }
.licencias-page > .card { min-height: 170px; box-sizing: border-box; padding: 16px; }
.licencias-page > .card > h2,
.licencias-page > .card > h3 { margin-top: 0; font-size: 20px; line-height: 24px; font-weight: 700; }
.licencias-page > .card > h2,
.licencias-page > .card > h3 { margin-bottom: 12px; }
.licencias-page > .card > p:first-of-type { margin: 0; }
.licencias-page > .card > h3 { margin-bottom: 12px; }
.licencias-page > .card select,
.licencias-page > .card input { width: 100%; box-sizing: border-box; margin: 6px 0; }
.licencias-page .licencia-formulario { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; gap: 12px; align-items: end; }
.licencias-page > .card:has(#crearLicencia) .licencia-formulario { position: relative; top: -11.44px; }
.licencias-page .licencia-formulario label { display: grid; gap: 4px; min-width: 0; font-weight: 700; }
.licencias-page .licencia-formulario label input,
.licencias-page .licencia-formulario label select { position: relative; top: -0.61px; }
.licencias-page .licencia-campo-titulo { display: inline-flex; align-items: baseline; gap: 4px; }
.licencias-page .licencia-plan-info { color: #555; font-weight: 400; }
.licencias-page .licencia-formulario select,
.licencias-page .licencia-formulario input { margin: 0; font-weight: 400; }
.licencias-page .licencia-formulario button { margin: 0; white-space: nowrap; }
.licencias-page .licencias-filtros { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: end; margin: 0 0 12px; padding-top: 8px; }
.licencias-page > .card:has(#tablaLicencias) .licencias-filtros,
.licencias-page > .card:has(#tablaPagos) .licencias-filtros { padding-top: 0; }
.licencias-page > .card:has(#tablaPagos) .licencia-filtro-etiqueta,
.licencias-page > .card:has(#tablaPagos) .licencia-filtro-estado,
.licencias-page > .card:has(#tablaPagos) .licencias-filtros input,
.licencias-page > .card:has(#tablaPagos) .licencias-filtros select { position: relative; top: -0.55px; }
.licencias-page .licencias-filtros input,
.licencias-page .licencias-filtros select { width: 100%; box-sizing: border-box; margin: 0; }
.licencias-page .licencias-filtros button { margin: 0; min-width: 110px; }
.licencias-page .licencias-filtros .buscador-consumo { min-width: 0; }
.licencias-page .licencias-filtros .buscador-consumo { display: grid; gap: 4px; }
.licencias-page .licencia-filtro-etiqueta,
.licencias-page .licencia-filtro-estado { display: grid; gap: 4px; margin: 0; font-weight: 700; }
.licencias-page .licencia-filtro-etiqueta { gap: 0; }
.licencias-page .licencia-filtro-etiqueta,
.licencias-page .licencia-filtro-estado,
.licencias-page .licencia-pago-form > label { font-size: 12px; line-height: 1.2; }
.licencias-page .licencias-filtros .buscador-consumo > button { display: none; position: absolute; right: 8px; top: auto; bottom: 4px; transform: none; box-sizing: border-box; width: 24px !important; min-width: 24px !important; max-width: 24px !important; height: 24px !important; min-height: 24px !important; max-height: 24px !important; aspect-ratio: 1 / 1 !important; margin: 0; padding: 0 !important; border: 0 !important; border-radius: 50% !important; overflow: hidden !important; background: transparent !important; color: #555 !important; font-size: 16px !important; line-height: 24px !important; text-align: center; }
.licencias-page .licencias-filtros .buscador-consumo > button:hover,
.licencias-page .licencias-filtros .buscador-consumo > button:focus-visible { transform: none !important; border: 0 !important; border-radius: 50% !important; background: #111 !important; color: #fff !important; }
.licencias-page .licencias-filtros .buscador-consumo > button:not([hidden]) { display: block; }
.licencias-page .licencia-sugerencia { display: block; margin: 0 0 12px; padding: 0; border: 0 !important; background: transparent !important; color: #555 !important; font-size: 13px; font-weight: 700; text-align: left; cursor: default; user-select: none; }
.licencias-page .licencia-sugerencia[hidden] { display: none !important; }
.licencias-page .licencia-sugerencia:hover { color: #555 !important; text-decoration: none; }
.busqueda-todas,
.licencia-sugerencia { font-weight: 700 !important; }
.licencia-dialog { width: min(520px, calc(100% - 24px)); border: 1px solid #c8d0d6; border-radius: 12px; padding: 24px; }
.licencia-dialog::backdrop { background: rgba(0, 0, 0, .45); }
.licencia-dialog form { display: grid; gap: 12px; }
.licencias-page .licencia-acordeon { margin: 0 0 16px; border: 1px solid #c8d0d6; border-radius: 8px; padding: 12px; }
.licencias-page .licencia-acordeon summary { cursor: pointer; font-weight: 700; }
.licencias-page .licencia-pago-contenido { width: 100%; }
.licencias-page .licencia-pago-titulo { grid-column: 1 / -1; margin: 0; font-size: 16px; }
  .licencias-page .licencia-pago-form { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 0; }
.licencias-page #registrarPagoForm > label { grid-column: 1 / -1; }
.licencias-page .licencia-pago-campos { display: contents; }
.licencias-page .licencia-pago-campos[hidden] { display: none !important; }
.licencias-page .licencia-pago-form label { display: grid; gap: 4px; font-size: 12px; font-weight: 700; }
.licencias-page #registrarPagoForm > label { gap: 1px; }
.licencias-page #registrarPagoForm > label { position: relative; top: -10px; }
.licencias-page #registrarPagoForm > label .pago-empresa-buscador { position: relative; top: -3px; }
.licencias-page .licencia-pago-form input, .licencias-page .licencia-pago-form select { width: 100%; box-sizing: border-box; }
.licencias-page .pago-empresa-buscador { position: relative; }
.licencias-page .pago-empresa-buscador input { width: 100%; box-sizing: border-box; }
.licencias-page .licencia-empresas-pago-lista { display: grid; gap: 0; width: 100%; margin: 10px 0 0; border: 1px solid #c8d0d6; border-radius: 8px; overflow: hidden; background: #fff; }
.licencias-page .licencia-empresas-pago-lista[hidden] { display: none !important; }
.licencias-page .licencia-empresa-pago-opcion { padding: 8px 10px; border-bottom: 1px solid #e1e5e8; cursor: pointer; transition: background-color .15s ease, color .15s ease; }
.licencias-page .licencia-empresa-pago-opcion:last-child { border-bottom: 0; }
.licencias-page .licencia-empresa-pago-opcion:hover,
.licencias-page .licencia-empresa-pago-opcion:focus-visible { background: #f0f0f0; color: #111; outline: 0; }
.licencias-page .licencia-empresa-pago-opcion[hidden] { display: none !important; }
  .licencias-page .pago-empresa-buscador > button { display: none; position: absolute; right: 8px; top: 50%; transform: translateY(-50%); box-sizing: border-box; width: 24px !important; min-width: 24px !important; max-width: 24px !important; height: 24px !important; min-height: 24px !important; max-height: 24px !important; align-items: center; justify-content: center; padding: 0 !important; border: 0 !important; border-radius: 50% !important; background: transparent !important; color: #555 !important; font-size: 16px !important; line-height: 1 !important; text-align: center; }
.licencias-page .pago-empresa-buscador > button:not([hidden]) { display: flex; }
  .licencias-page .pago-empresa-buscador > button:hover, .licencias-page .pago-empresa-buscador > button:focus-visible { transform: translateY(-50%) !important; border: 0 !important; border-radius: 50% !important; background: #111 !important; color: #fff !important; }
.licencias-page .licencia-pago-form button, .licencias-page .licencia-pago-form .error { grid-column: 1 / -1; }
.licencias-page .licencia-pago-form > .licencia-pago-campos > #registrarPago { border: 1px solid #236126 !important; border-radius: 999px; }
@media (max-width: 760px) { .licencias-page .licencia-pago-form { grid-template-columns: 1fr; } }
.licencia-dialog h3 { margin: 0; }
.licencia-dialog label { display: grid; gap: 5px; font-weight: 700; }
.licencia-dialog input { width: 100%; box-sizing: border-box; }
.licencia-dialog-acciones { display: flex; justify-content: flex-end; gap: 10px; padding-top: 12px; border-top: 1px solid #c8d0d6; }
.licencia-dialog-acciones button { margin: 0; border: 1px solid #8a8a8a !important; }
.licencias-page .licencias-tabla { width: 100%; overflow: hidden; border: 1px solid #c8d0d6; border-radius: 10px; }
.licencias-page .licencias-tabla table { width: 100%; min-width: 0; margin: 0; border: 0; table-layout: fixed; }
.licencias-page .licencias-tabla th,
.licencias-page .licencias-tabla td { overflow-wrap: anywhere; word-break: break-word; }
.licencias-page #tablaLicencias th:last-child,
.licencias-page #tablaLicencias td:last-child { width: 280px; }
.licencias-page #tablaPagos th,
.licencias-page #tablaPagos td { white-space: normal; }
.licencias-page .panel-admin-acciones { display: grid; grid-template-columns: repeat(2, 130px); gap: 8px; justify-content: end; justify-items: end; align-items: start; }
.licencias-page .panel-admin-acciones button { width: 100%; min-width: 0; margin: 0; border: 1px solid #8a8a8a !important; border-radius: 999px; white-space: nowrap; }
.licencias-page .panel-sugerencias > [hidden] { display: none !important; }
.licencias-page #tablaPagos td.panel-admin-acciones { display: flex !important; width: auto; min-width: 0; text-align: right; vertical-align: bottom; justify-content: flex-end; align-items: flex-end; gap: 8px; }
.licencias-page #tablaPagos td.panel-admin-acciones .cliente-boton { display: inline-flex; width: auto; min-width: 120px; margin-left: auto; justify-content: center; }
.licencias-page #tablaPagos td.panel-admin-acciones .cliente-boton { align-items: center; }

@media (min-width: 1025px) {
  .licencias-page .licencias-tabla table { display: table !important; table-layout: fixed; }
  .licencias-page .licencias-tabla th,
  .licencias-page .licencias-tabla td { min-width: 0; }
}

@media (min-width: 761px) and (max-width: 1024px) {
  .licencias-page .licencias-tabla table { display: block !important; overflow: visible !important; }
  .licencias-page .licencias-tabla thead { display: none !important; }
  .licencias-page .licencias-tabla tbody,
  .licencias-page .licencias-tabla tr,
  .licencias-page .licencias-tabla td { display: block !important; width: auto !important; min-width: 0 !important; max-width: none !important; }
  .licencias-page .licencias-tabla tr { margin: 12px; padding: 12px; border: 1px solid #c8d0d6; border-radius: 10px; }
  .licencias-page .licencias-tabla td { display: grid !important; grid-template-columns: 92px minmax(0, 1fr); gap: 8px; padding: 8px 0; border: 0; }
  .licencias-page #tablaLicencias td:nth-child(1)::before { content: 'Empresa'; font-weight: 700; }
  .licencias-page #tablaLicencias td:nth-child(2)::before { content: 'Plan'; font-weight: 700; }
  .licencias-page #tablaLicencias td:nth-child(3)::before { content: 'Clave'; font-weight: 700; }
  .licencias-page #tablaLicencias td:nth-child(4)::before { content: 'Estado'; font-weight: 700; }
  .licencias-page #tablaLicencias td:nth-child(5)::before { content: 'Vence'; font-weight: 700; }
  .licencias-page #tablaPagos td:nth-child(1)::before { content: 'Empresa'; font-weight: 700; }
  .licencias-page #tablaPagos td:nth-child(2)::before { content: 'Plan'; font-weight: 700; }
  .licencias-page #tablaPagos td:nth-child(3)::before { content: 'Monto'; font-weight: 700; }
  .licencias-page #tablaPagos td:nth-child(4)::before { content: 'Periodo'; font-weight: 700; }
  .licencias-page #tablaPagos td:nth-child(5)::before { content: 'Estado'; font-weight: 700; }
  .licencias-page #tablaPagos td:nth-child(6)::before { content: 'Fecha'; font-weight: 700; }
  .licencias-page .panel-admin-acciones { width: 100%; box-sizing: border-box; grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 8px; justify-items: stretch; }
  .licencias-page .panel-admin-acciones button { width: 100% !important; min-width: 0 !important; }
}

@media (max-width: 760px) {
  .licencia-dialog { padding: 16px; }
  .licencia-dialog-acciones { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .licencia-dialog-acciones button { width: 100%; min-width: 0; }
  .licencias-page .licencias-filtros { grid-template-columns: 1fr; gap: 8px; }
  .licencias-page .licencias-filtros button { width: 100%; }
  .licencias-page .licencia-formulario { grid-template-columns: 1fr; gap: 10px; }
  .licencias-page .licencia-formulario button { width: 100%; }
  .licencias-page .panel-admin-acciones { width: 100%; box-sizing: border-box; grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 8px; }
  .licencias-page .panel-admin-acciones button { width: 100% !important; min-width: 0 !important; }
  .licencias-page .licencias-tabla table { display: block !important; overflow: visible !important; }
  .licencias-page .licencias-tabla thead { display: none !important; }
  .licencias-page .licencias-tabla tbody,
  .licencias-page .licencias-tabla tr,
  .licencias-page .licencias-tabla td { display: block !important; width: auto !important; min-width: 0 !important; max-width: none !important; }
  .licencias-page .licencias-tabla tr { margin: 12px; padding: 12px; border: 1px solid #c8d0d6; border-radius: 10px; }
  .licencias-page .licencias-tabla td { display: grid !important; grid-template-columns: 82px minmax(0, 1fr); gap: 8px; padding: 8px 0; border: 0; }
  .licencias-page #tablaLicencias td:nth-child(1)::before { content: 'Empresa'; font-weight: 700; }
  .licencias-page #tablaLicencias td:nth-child(2)::before { content: 'Plan'; font-weight: 700; }
  .licencias-page #tablaLicencias td:nth-child(3)::before { content: 'Clave'; font-weight: 700; }
  .licencias-page #tablaLicencias td:nth-child(4)::before { content: 'Estado'; font-weight: 700; }
  .licencias-page #tablaLicencias td:nth-child(5)::before { content: 'Vence'; font-weight: 700; }
  .licencias-page #tablaPagos td:nth-child(1)::before { content: 'Empresa'; font-weight: 700; }
  .licencias-page #tablaPagos td:nth-child(2)::before { content: 'Plan'; font-weight: 700; }
  .licencias-page #tablaPagos td:nth-child(3)::before { content: 'Monto'; font-weight: 700; }
  .licencias-page #tablaPagos td:nth-child(4)::before { content: 'Periodo'; font-weight: 700; }
  .licencias-page #tablaPagos td:nth-child(5)::before { content: 'Estado'; font-weight: 700; }
  .licencias-page #tablaPagos td:nth-child(6)::before { content: 'Fecha'; font-weight: 700; }
  .licencias-page .panel-admin-acciones { grid-template-columns: repeat(2, minmax(0, 1fr)); justify-items: stretch; }
  .licencias-page .panel-admin-acciones button { font-size: 12px; }
}
@media (max-width: 1024px) {
  .panel-admin-page .planes-busqueda-fila { align-items: stretch; flex-direction: column; }
  .panel-admin-page .planes-busqueda-fila > #nuevoPlan { width: 100%; }
  .panel-admin-page .planes-tabla table { display: block !important; border: 0; overflow: visible; }
  .panel-admin-page .planes-tabla thead { display: none; }
  .panel-admin-page .planes-tabla tbody, .panel-admin-page .planes-tabla tr, .panel-admin-page .planes-tabla td { display: block; width: auto !important; min-width: 0 !important; max-width: none !important; }
  .panel-admin-page .planes-tabla tr { margin: 12px 0; padding: 12px; border: 1px solid #c8d0d6; border-radius: 10px; }
  .panel-admin-page .planes-tabla td { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border: 0; overflow-wrap: anywhere; }
  .panel-admin-page .planes-tabla td::before { font-weight: 700; margin-right: 10px; }
  .panel-admin-page .planes-tabla td:nth-child(1)::before { content: 'Plan'; }
  .panel-admin-page .planes-tabla td:nth-child(2)::before { content: 'Mensual'; }
  .panel-admin-page .planes-tabla td:nth-child(3)::before { content: 'Anual'; }
  .panel-admin-page .planes-tabla td:nth-child(4)::before { content: 'Usuarios'; }
  .panel-admin-page .planes-tabla td:nth-child(5)::before { content: 'Portal'; }
  .panel-admin-page .planes-tabla td:nth-child(6)::before { content: 'Estado'; }
  .panel-admin-page .planes-tabla td:nth-child(7) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding-top: 12px; margin-top: 8px; border-top: 1px solid #e1e6ea; }
  .panel-admin-page .planes-tabla td:nth-child(7)::before { content: 'Acciones'; grid-column: 1 / -1; text-align: center; }
  .panel-admin-page .planes-tabla td:last-child.panel-admin-acciones .cliente-boton { width: 100%; min-width: 0; margin: 0; }
  .panel-admin-page #listaPlanModulos { grid-template-columns: 1fr; }
}
.panel-admin-page .planes-cabecera h2, .panel-admin-page .planes-cabecera p { text-align: left; }
.panel-admin-page .planes-tabla th:last-child { text-align: center; }
.panel-admin-page .planes-tabla td.plan-estado-inactivo { color: #b3261e; font-weight: 700; }
@media (min-width: 761px) {
  .panel-admin-page .planes-tabla table { display: table !important; table-layout: fixed; overflow: hidden; }
  .panel-admin-page .planes-tabla th:nth-child(1), .panel-admin-page .planes-tabla td:nth-child(1) { width: 22%; }
  .panel-admin-page .planes-tabla th:nth-child(2), .panel-admin-page .planes-tabla td:nth-child(2), .panel-admin-page .planes-tabla th:nth-child(3), .panel-admin-page .planes-tabla td:nth-child(3) { width: 9%; }
  .panel-admin-page .planes-tabla th:nth-child(4), .panel-admin-page .planes-tabla td:nth-child(4), .panel-admin-page .planes-tabla th:nth-child(5), .panel-admin-page .planes-tabla td:nth-child(5), .panel-admin-page .planes-tabla th:nth-child(6), .panel-admin-page .planes-tabla td:nth-child(6) { width: 12%; }
  .panel-admin-page .planes-tabla th:nth-child(7), .panel-admin-page .planes-tabla td:nth-child(7) { width: 24% !important; }
  .panel-admin-page .planes-tabla td:last-child.panel-admin-acciones { display: table-cell; box-sizing: border-box; margin: 0; padding: 8px 12px 8px 0; text-align: right; white-space: nowrap; }
  .panel-admin-page .planes-tabla td:last-child.panel-admin-acciones .cliente-boton { display: inline-block; width: 100px; min-width: 100px; height: 40px; margin: 0 0 0 8px; border: 1px solid #8a8a8a; border-radius: 999px; }
}

@media (max-width: 900px) {
  body:has(#guardarPublico) .configuracion-identidad-grid { grid-template-columns: 1fr !important; gap: 16px; }
  .panel-admin-page header nav.nobar-nav-links .nobar-dashboard-directo {
    display: block !important;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.25);
  }
}

/* Planes usa tarjetas desde el ancho de la ventana de prueba (1024px). */
@media (min-width: 761px) and (max-width: 1024px) {
  .panel-admin-page .planes-busqueda-fila { align-items: stretch !important; flex-direction: column !important; }
  .panel-admin-page .planes-busqueda-fila > #nuevoPlan { width: 100% !important; }
  .panel-admin-page .planes-tabla table { display: block !important; table-layout: auto !important; border: 0 !important; overflow: visible !important; }
  .panel-admin-page .planes-tabla thead { display: none !important; }
  .panel-admin-page .planes-tabla tbody,
  .panel-admin-page .planes-tabla tr,
  .panel-admin-page .planes-tabla td { display: block !important; width: auto !important; min-width: 0 !important; max-width: none !important; }
  .panel-admin-page .planes-tabla tr { margin: 12px 0; padding: 12px; border: 1px solid #c8d0d6; border-radius: 10px; }
  .panel-admin-page .planes-tabla td { display: flex !important; justify-content: space-between; gap: 12px; padding: 7px 0; border: 0; overflow-wrap: anywhere; }
  .panel-admin-page .planes-tabla td:nth-child(7) { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding-top: 12px; margin-top: 8px; border-top: 1px solid #e1e6ea; }
  .panel-admin-page .planes-tabla td:last-child.panel-admin-acciones .cliente-boton { width: 100% !important; min-width: 0; margin: 0; white-space: nowrap; font-size: 12px; }
}

@media (max-width: 760px) {
  .seguridad-page .seguridad-filtros,
  .seguridad-page .auditoria-filtros { grid-template-columns: 1fr; gap: 12px; }
  .seguridad-page .seguridad-filtros button { width: 100%; min-width: 0; }
  .seguridad-page .seguridad-tabla table { display: block !important; table-layout: auto; overflow: visible !important; }
  .seguridad-page .seguridad-tabla thead { display: none !important; }
  .seguridad-page .seguridad-tabla tbody,
  .seguridad-page .seguridad-tabla tr,
  .seguridad-page .seguridad-tabla td { display: block !important; width: auto !important; min-width: 0 !important; max-width: none !important; }
  .seguridad-page .seguridad-tabla tr { margin: 12px; padding: 12px; border: 1px solid #c8d0d6; border-radius: 10px; }
  .seguridad-page .seguridad-tabla td { display: grid !important; grid-template-columns: 92px minmax(0, 1fr); align-items: start; gap: 8px; padding: 8px 0; border: 0; overflow-wrap: anywhere; word-break: break-word; }
  .seguridad-page .seguridad-tabla td::before { font-weight: 700; }
  .seguridad-page #tablaSesionesGlobal td:nth-child(1)::before { content: 'Usuario'; }
  .seguridad-page #tablaSesionesGlobal td:nth-child(2)::before { content: 'Empresa'; }
  .seguridad-page #tablaSesionesGlobal td:nth-child(3)::before { content: 'IP'; }
  .seguridad-page #tablaSesionesGlobal td:nth-child(4)::before { content: 'Último uso'; }
  .seguridad-page #tablaSesionesGlobal td:nth-child(5)::before { content: 'Estado'; }
  .seguridad-page #tablaEventosGlobal td:nth-child(1)::before { content: 'Fecha'; }
  .seguridad-page #tablaEventosGlobal td:nth-child(2)::before { content: 'Estado'; }
  .seguridad-page #tablaEventosGlobal td:nth-child(3)::before { content: 'Ruta'; }
  .seguridad-page #tablaEventosGlobal td:nth-child(4)::before { content: 'Usuario'; }
  .seguridad-page #tablaEventosGlobal td:nth-child(5)::before { content: 'Empresa'; }
  .seguridad-page #tablaEventosGlobal td:nth-child(6)::before { content: 'IP'; }
  .seguridad-page #tablaAuditoriaGlobal td:nth-child(1)::before { content: 'Fecha'; }
  .seguridad-page #tablaAuditoriaGlobal td:nth-child(2)::before { content: 'Empresa'; }
  .seguridad-page #tablaAuditoriaGlobal td:nth-child(3)::before { content: 'Usuario'; }
  .seguridad-page #tablaAuditoriaGlobal td:nth-child(4)::before { content: 'Módulo'; }
  .seguridad-page #tablaAuditoriaGlobal td:nth-child(5)::before { content: 'Acción'; }
  .seguridad-page #tablaAuditoriaGlobal td:nth-child(6)::before { content: 'Entidad'; }
  .seguridad-page .seguridad-acciones { display: grid !important; grid-template-columns: 1fr; margin-top: 8px; padding: 12px 0 0; border-top: 1px solid #e1e6ea; text-align: center; }
  .seguridad-page .seguridad-acciones::before { display: none; }
  .seguridad-page .seguridad-acciones button { grid-column: 1 / -1; width: 100% !important; min-width: 0 !important; max-width: none !important; justify-self: stretch; transform: none; }
}

.panel-admin-page main button,
.panel-admin-page dialog button {
  box-sizing: border-box;
  min-width: 110px;
  height: 42px;
  min-height: 42px;
  margin: 4px;
  padding: 7px 14px;
  border: 0;
  border-radius: 999px;
  background: #e5e5e5;
  color: #111;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.1;
  white-space: normal;
}
.panel-admin-page main button:is(#nuevaEmpresa,#nuevoPlan,#crearUsuarioGlobal,#crearRolGlobal,#crearLicencia,#iniciarAccesoSoporte,#crearTicket,#crearVersion,#crearRespaldoLocal),
.panel-admin-page dialog button:is(#guardarEmpresa,#guardarPlan,#guardarUsuarioGlobal) {
  background: #2e7d32;
  color: #fff;
  border: 1px solid #236126;
}
#buscarUsuarioGlobal + #crearUsuarioGlobal,
#crearUsuarioGlobal + #crearAdministradorGlobal {
  margin-top: 20px;
}
#tablaUsuariosGlobal {
  margin-top: 16px;
}
#crearRolGlobal + #rolesGlobales {
  margin-top: 16px;
}
.restablecer-password-wrap { position: relative; display: block; margin-top: 6px; }
.restablecer-password-wrap input { width: 100%; padding-right: 48px; }
.restablecer-password-wrap .toggle-password { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); width: 28px !important; height: 28px !important; min-width: 28px !important; min-height: 28px !important; max-width: 28px; max-height: 28px; margin: 0; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #111; cursor: pointer; display: inline-flex; flex: 0 0 28px; align-items: center; justify-content: center; line-height: 0; box-sizing: border-box; }
.restablecer-password-wrap .toggle-password svg { position: absolute; inset: 4px; width: 20px; height: 20px; display: block; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.restablecer-password-wrap .toggle-password .is-hidden { display: none; }
.restablecer-password-wrap .toggle-password:hover,
.restablecer-password-wrap .toggle-password:active { transform: translateY(-50%); }
.password-requisitos { list-style: none; margin: 14px 0 0; padding: 12px 14px; border: 1px solid #d7dce2; border-radius: 10px; background: #f7f8f9; color: #6b7280; font-size: 13px; text-align: left; }
.password-requisitos li { margin: 5px 0; }
.password-requisitos li::before { content: '○'; display: inline-block; width: 20px; color: #6b7280; font-weight: 700; }
.password-requisitos li.cumplido { color: #176b3a; }
.password-requisitos li.cumplido::before { content: '✓'; color: #176b3a; }
body:has(#formRestablecer) #formRestablecer > button[type="submit"],
body:has(#formRestablecer) .login-box .centrado a {
  display: block;
  width: 260px;
  min-width: 260px;
  height: 42px;
  min-height: 42px;
  margin: 20px auto 0;
  padding: 0 18px;
  border: 1px solid #111;
  border-radius: 999px;
  background: #fff;
  color: #000;
  font-family: inherit;
  font-weight: 700;
  line-height: 42px;
  text-align: center;
  box-sizing: border-box;
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease, transform 120ms ease;
}
body:has(#formRestablecer) #formRestablecer > button[type="submit"]:hover,
body:has(#formRestablecer) .login-box .centrado a:hover { background: #111; color: #fff !important; }
body:has(#formRestablecer) #formRestablecer > button[type="submit"]:active,
body:has(#formRestablecer) .login-box .centrado a:active { transform: translateY(2px); }
body:has(#formRestablecer) #formRestablecer > button[type="submit"]:focus-visible,
body:has(#formRestablecer) .login-box .centrado a:focus-visible { outline: 2px solid #111; outline-offset: 3px; }
body:has(#formRestablecer) { background: #000; color: #fff; }
body:has(#formRestablecer) .login-box { background: #fff; color: #111; }
body:has(#formRestablecer) .texto-ayuda,
body:has(#formRestablecer) label { color: #111; }
body:has(#formRestablecer) .texto-ayuda { color: #374151; }
body:has(#formRestablecer) input { background: #fff; color: #000; }
body:has(#formRestablecer) .password-requisitos { background: #fff; border-color: #d7dce2; color: #111; }
body:has(#formRestablecer) .password-requisitos li.cumplido,
body:has(#formRestablecer) .password-requisitos li.cumplido::before { color: #111; }
body:has(#formRestablecer) .login-box .centrado { margin-top: 18px; text-align: center; }
body:has(#formRestablecer) .login-box .centrado a { text-decoration: none; }
body:has(#formRecuperar) .login-box button.primary,
body:has(#formRecuperar) .login-box form + p a {
  display: block;
  width: 260px !important;
  height: 42px;
  min-height: 42px;
  box-sizing: border-box;
  margin: 20px auto 0;
  padding: 0 24px;
  border: 1px solid #111;
  border-radius: 999px;
  background: #fff !important;
  color: #111 !important;
  font-family: inherit;
  font-weight: 700;
  line-height: 42px;
  text-align: center;
  text-decoration: none;
  transition: background-color 120ms ease, color 120ms ease, transform 120ms ease;
}
body:has(#formRecuperar) .login-box button.primary:hover,
body:has(#formRecuperar) .login-box form + p a:hover { background: #111 !important; color: #fff !important; }
body:has(#formRecuperar) .login-box button.primary:active,
body:has(#formRecuperar) .login-box form + p a:active { transform: translateY(2px); }
body:has(#formRecuperar) { background: #000; color: #111; }
body:has(#formRecuperar) .login-box { background: #fff; color: #111; }
body:has(#formRecuperar) .login-box form + p a { font-size: 0; }
body:has(#formRecuperar) .login-box form + p a::after { content: 'Volver a iniciar sesión'; font-size: 16px; }
#tablaUsuariosGlobal tbody tr td.panel-admin-acciones > button:nth-child(1) { grid-column: 1 / 2 !important; grid-row: 1 / 2 !important; }
#tablaUsuariosGlobal tbody tr td.panel-admin-acciones > button:nth-child(2) { grid-column: 2 / 3 !important; grid-row: 1 / 2 !important; }
#tablaUsuariosGlobal tbody tr td.panel-admin-acciones > button:nth-child(3) { grid-column: 1 / 2 !important; grid-row: 2 / 3 !important; }
#tablaUsuariosGlobal tbody tr td.panel-admin-acciones > button:nth-child(4) { grid-column: 2 / 3 !important; grid-row: 2 / 3 !important; }
#tablaUsuariosGlobal tbody tr td.panel-admin-acciones > .boton-accion-vacio { display: inline-block; }
#tablaUsuariosGlobal tbody tr td:last-child.panel-admin-acciones {
  display: grid !important;
  grid-template-columns: repeat(2, 130px) !important;
  grid-auto-rows: 40px !important;
  justify-content: end !important;
  align-items: start !important;
  column-gap: 8px !important;
  row-gap: 16px !important;
}
#tablaUsuariosGlobal tbody tr td:last-child.panel-admin-acciones > button {
  margin: 0 !important;
}

/* Patrón visual compartido para todas las ventanas del panel empresarial. */
.panel-empresarial-page main {
  width: calc(100% - 32px);
  max-width: 1400px;
  margin: 24px auto;
  padding: 0;
}
.panel-empresarial-page main > .card {
  width: 100%;
  max-width: none;
  box-sizing: border-box;
  border: 1px solid #c8d0d6;
  border-radius: 12px;
  padding: 20px;
  min-width: 0;
  overflow: hidden;
}
.panel-empresarial-page main > .card + .card { margin-top: 20px; }
.panel-empresarial-page main button {
  box-sizing: border-box;
  min-height: 40px;
  margin: 4px;
  padding: 7px 14px;
  border-radius: 999px;
  line-height: 1.1;
  white-space: normal;
}
.panel-empresarial-page main > .card > table,
.panel-empresarial-page main > .card > .table-responsive {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  margin-top: 16px;
}
.panel-empresarial-page main > .card > table {
  border: 1px solid #c8d0d6;
  border-radius: 10px;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
}
.panel-empresarial-page main > .card > table th:last-child { text-align: center; }
.panel-empresarial-page main > .card > table td:last-child {
  vertical-align: middle;
  text-align: right;
}
.panel-empresarial-page main > .card > table td:last-child > button {
  margin: 0 0 0 8px;
}
.panel-admin-page main button.nobar-btn-eliminar,
.panel-empresarial-page main button.nobar-btn-eliminar,
button.nobar-btn-eliminar {
  background: #c62828 !important;
  color: #fff !important;
  border: 1px solid #a51f1f !important;
}
.panel-admin-page main button.nobar-btn-activar,
.panel-empresarial-page main button.nobar-btn-activar,
button.nobar-btn-activar {
  background: #2e7d32 !important;
  color: #fff !important;
  border: 1px solid #236126 !important;
}
.panel-admin-page main button.nobar-btn-desactivar,
.panel-empresarial-page main button.nobar-btn-desactivar,
button.nobar-btn-desactivar {
  background: #e5e5e5 !important;
  color: #111 !important;
  border: 1px solid #c8c8c8 !important;
}
#guardarPublico,
#guardarPlan,
#guardarEmpresa,
#guardarProgramacionRespaldo,
#guardarUsuarioGlobal,
#guardarAdministradorGlobal { background: #2e7d32 !important; color: #fff !important; border: 1px solid #236126 !important; }
#quitarLogoPublico,
#quitarFondoPublico { background: #c62828 !important; color: #fff !important; border: 1px solid #a51f1f !important; }
.panel-admin-page .panel-admin-acciones:has(#guardarPublico) {
  display: grid;
  grid-template-columns: repeat(2, minmax(130px, 160px));
  grid-auto-rows: 40px;
  gap: 16px 8px;
  justify-content: end;
  align-items: stretch;
}
.panel-admin-page .panel-admin-acciones:has(#guardarPublico) > button {
  width: 100%;
  min-width: 0;
  height: 40px;
  min-height: 40px;
  margin: 0;
  font-size: 13px;
}
body:has(#guardarPublico) .card:has(#guardarPublico) > label {
  display: grid;
  gap: 6px;
}
body:has(#guardarPublico) .card:has(#guardarPublico) input[type="file"] {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
body:has(#guardarPublico) .configuracion-archivo-control { display: flex; align-items: center; gap: 10px; min-width: 0; }
body:has(#guardarPublico) .configuracion-archivo-boton { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; height: 40px; box-sizing: border-box; padding: 0 12px; border: 1px solid #8a8a8a; border-radius: 999px; background: #fff; color: #111; font: inherit; cursor: pointer; }
body:has(#guardarPublico) .configuracion-archivo-control:hover .configuracion-archivo-boton,
body:has(#guardarPublico) .configuracion-archivo-control:focus-within .configuracion-archivo-boton { background: #111; color: #fff; }
body:has(#guardarPublico) .configuracion-archivo-nombre { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 400; color: #555; }
body:has(#guardarPublico) .configuracion-archivo-nombre:empty { display: none; }
body:has(#guardarPublico) .card:has(#guardarPublico) .configuracion-archivo-fila {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
}
body:has(#guardarPublico) .card:has(#guardarPublico) .configuracion-archivo-fila > label {
  min-width: 0;
  display: grid;
  gap: 8px;
}
body:has(#guardarPublico) .configuracion-archivo-titulo { display: inline-block; transform: translateX(7px); }
body:has(#guardarPublico) .card:has(#guardarPublico) h3 {
  margin: 0 0 16px;
  font-size: 22px;
  line-height: 1.2;
}
body:has(#guardarPublico) .card:has(#guardarPublico) > p {
  margin: 0 0 16px;
}
body:has(#guardarPublico) .card:has(#guardarPublico) > label,
body:has(#guardarPublico) .card:has(#guardarPublico) .configuracion-archivo-fila {
  margin-bottom: 12px;
}
body:has(#guardarPublico) .configuracion-identidad-grid {
  display: grid;
  grid-template-columns: minmax(0, .75fr) minmax(0, 1.25fr);
  gap: 24px;
  align-items: stretch;
}
body:has(#guardarPublico) .configuracion-colores,
body:has(#guardarPublico) .configuracion-archivos { display: grid; gap: 12px; min-width: 0; }
body:has(#guardarPublico) .configuracion-colores { gap: 3px; }
body:has(#guardarPublico) .configuracion-identidad-bloque { height: 100%; box-sizing: border-box; padding: 14px; border: 1px solid #dde3e8; border-radius: 10px; background: #fafbfc; }
body:has(#guardarPublico) .configuracion-archivos { gap: 0; padding-top: 0; padding-bottom: 0; }
body:has(#guardarPublico) .configuracion-archivos .configuracion-archivo-fila { margin-bottom: 0; }
body:has(#guardarPublico) .configuracion-identidad-bloque h4 { margin: 0 0 18px; font-size: 16px; line-height: 1.2; }
body:has(#guardarPublico) .configuracion-colores h4 { margin-bottom: 5px; }
body:has(#guardarPublico) .configuracion-archivos h4 { transform: translateY(14px); }
body:has(#guardarPublico) .configuracion-colores label { display: grid; grid-template-columns: minmax(0, 1fr) 42px; align-items: center; gap: 2px; }
body:has(#guardarPublico) .configuracion-colores input[type="color"] { width: 42px; height: 32px; margin: 0; padding: 2px; box-sizing: border-box; }
body:has(#guardarPublico) .configuracion-archivo-fila > .configuracion-archivo-selector { align-self: end; }
body:has(#guardarPublico) .configuracion-archivo-fila > .panel-admin-acciones-archivo { align-self: end; padding-bottom: 0; }
body:has(#guardarPublico) .configuracion-archivo-fila .configuracion-archivo-control { min-height: 40px; }
body:has(#guardarPublico) .configuracion-archivo-fila { grid-template-columns: max-content minmax(0, 1fr) max-content !important; align-items: center; gap: 10px; }
body:has(#guardarPublico) .configuracion-archivo-fila > .configuracion-archivo-titulo { transform: translateY(-14px); white-space: nowrap; }
body:has(#guardarPublico) .configuracion-archivo-fila > .configuracion-archivo-control { display: flex; align-items: center; min-width: 0; }
body:has(#guardarPublico) .configuracion-archivo-fila > .panel-admin-acciones-archivo { align-self: center; }
body:has(#guardarPublico) .configuracion-archivo-fila > .configuracion-archivo-control { justify-self: end; width: max-content; }
body:has(#guardarPublico) .configuracion-archivo-fila > .panel-admin-acciones-archivo { display: flex; width: auto; }
body:has(#guardarPublico) .configuracion-archivo-fila > .panel-admin-acciones-archivo { width: max-content !important; justify-self: end; }
body:has(#guardarPublico) .configuracion-archivo-fila > .panel-admin-acciones-archivo > button { width: 114px; min-width: 114px; box-sizing: border-box; }
body:has(#guardarPublico) .configuracion-archivo-fila > .panel-admin-acciones-archivo > button { transform: translateY(8px); }
body:has(#guardarPublico) #quitarLogoPublico,
body:has(#guardarPublico) #quitarFondoPublico { width: 114px !important; min-width: 114px !important; max-width: 114px !important; height: 40px; min-height: 40px; }
body:has(#guardarPublico) .card:has(#guardarPublico) > .panel-admin-acciones:last-of-type { margin-top: 38px; margin-bottom: 0; }
body:has(#guardarPublico) .card:has(#guardarPublico) input[type="file"]::file-selector-button {
  margin-right: 8px;
  padding: 8px 12px;
  border: 1px solid #8a8a8a;
  border-radius: 999px;
  background: #fff;
  color: #111;
  font: inherit;
  cursor: pointer;
}
body:has(#guardarPublico) .card:has(#guardarPublico) input[type="file"]::file-selector-button:hover {
  background: #111;
  color: #fff;
}
body:has(#guardarPublico) .card:has(#guardarPublico) .panel-admin-acciones {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}
body:has(#guardarPublico) .card:has(#guardarPublico) .panel-admin-acciones-archivo {
  justify-content: flex-end;
}
body:has(#guardarPublico) .card:has(#guardarPublico) .panel-admin-acciones > button {
  width: auto;
  min-width: 0;
  height: 40px;
  margin: 0;
  padding: 0 14px;
  border: 1px solid #8a8a8a;
  border-radius: 999px;
  white-space: nowrap;
}
.panel-empresarial-page main > .card > label + input,
.panel-empresarial-page main > .card > label + select,
.panel-empresarial-page main > .card > input + button,
.panel-empresarial-page main > .card > select + button {
  margin-top: 16px;
}
@media (max-width: 900px) {
  .panel-empresarial-page header { overflow: hidden; }
  .panel-empresarial-page header .nobar-nav-links { max-width: 100%; overflow-x: auto; }
  .panel-empresarial-page main { width: calc(100% - 24px); margin: 18px auto; }
  .panel-empresarial-page main > .card { padding: 16px; }
  .panel-empresarial-page main > .card + .card { margin-top: 16px; }
  .panel-empresarial-page main > .card > table,
  .panel-empresarial-page main > .card > .table-responsive { overflow-x: visible; }
  .panel-empresarial-page main > .card > table thead { display: none; }
  .panel-empresarial-page main > .card > table,
  .panel-empresarial-page main > .card > table tbody,
  .panel-empresarial-page main > .card > table tr,
  .panel-empresarial-page main > .card > table td { display: block; width: 100%; }
  .panel-empresarial-page main > .card > table tr {
    margin-bottom: 14px;
    padding: 10px;
    border: 1px solid #d7dce2;
    border-radius: 10px;
  }
  .panel-empresarial-page main > .card > table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 42px;
    padding: 6px 0;
    border: 0;
    overflow-wrap: anywhere;
    gap: 12px;
  }
  .panel-empresarial-page main > .card > table td::before {
    content: attr(data-label);
    font-weight: 700;
    flex: 0 0 36%;
  }
  .panel-empresarial-page main > .card > table td:last-child {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 130px));
    justify-content: end;
    gap: 8px;
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid #dde3e8;
  }
  .panel-empresarial-page main > .card > table td:last-child > button {
    width: 130px;
    margin: 0;
  }
}
.panel-admin-page main button.cliente-boton-eliminar,
.panel-admin-page dialog button.cliente-boton-eliminar {
  background: #c62828;
  color: #fff;
  border: 1px solid #a51f1f;
}
.panel-admin-page table td:last-child {
  vertical-align: middle;
}
.panel-admin-page table th:last-child {
  text-align: center;
}
.panel-admin-page table td:last-child > button,
.panel-admin-page table td:last-child > .panel-admin-acciones {
  margin: 4px;
}
.panel-admin-page .panel-admin-acciones {
  display: grid;
  grid-template-columns: repeat(2, 130px);
  grid-auto-rows: 40px;
  align-items: flex-start;
  column-gap: 8px;
  row-gap: 16px;
  min-width: 0;
  justify-content: end;
}
.panel-admin-page .panel-admin-acciones .cliente-boton {
  width: 130px;
  flex: 0 0 130px;
  min-width: 110px;
  margin: 0;
}
.panel-admin-page .boton-accion-vacio { display: block; visibility: visible; background: #f5f6f7; border: 1px solid #d7dce2; cursor: default; }
#tablaUsuariosGlobal tbody tr td:last-child > button:nth-child(1) { grid-column: 1; grid-row: 1; }
#tablaUsuariosGlobal tbody tr td:last-child > button:nth-child(2) { grid-column: 2; grid-row: 1; }
#tablaUsuariosGlobal tbody tr td:last-child > button:nth-child(3) { grid-column: 1; grid-row: 2; }
#tablaUsuariosGlobal tbody tr td:last-child > button:nth-child(4) { grid-column: 2; grid-row: 2; }
#tablaUsuariosGlobal tbody tr td.panel-admin-acciones {
  display: grid;
  grid-template-columns: repeat(2, 130px);
  grid-auto-rows: 40px;
  justify-content: end;
  align-items: start;
  column-gap: 8px;
  row-gap: 16px;
}
#tablaUsuariosGlobal tbody tr td.panel-admin-acciones > button:nth-child(1) { grid-column: 1 / 2; grid-row: 1 / 2; }
#tablaUsuariosGlobal tbody tr td.panel-admin-acciones > button:nth-child(2) { grid-column: 2 / 3; grid-row: 1 / 2; }
#tablaUsuariosGlobal tbody tr td.panel-admin-acciones > button:nth-child(3) { grid-column: 1 / 2; grid-row: 2 / 3; }
#tablaUsuariosGlobal tbody tr td.panel-admin-acciones > button:nth-child(4) { grid-column: 2 / 3; grid-row: 2 / 3; }
@media (max-width: 900px) {
  .panel-admin-page header { flex-wrap: wrap; }
  .panel-admin-page header .nobar-nav-links { order: 3; width: 100%; min-width: 0; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; }
  .panel-admin-page header #btnSalir { margin-left: auto; }
  .panel-admin-page main { width: calc(100% - 24px); margin: 18px auto; }
  .panel-admin-page main .card { padding: 16px; }
  .panel-admin-page main button,
  .panel-admin-page dialog button { min-width: 0; }
  .panel-admin-page .panel-admin-acciones { grid-template-columns: repeat(2, minmax(0, 130px)); min-width: 0; width: 100%; justify-content: end; }
  #tablaUsuariosGlobal { display: block; }
  #tablaUsuariosGlobal thead { display: none; }
  #tablaUsuariosGlobal tbody, #tablaUsuariosGlobal tbody tr { display: block; width: 100%; }
  #tablaUsuariosGlobal tbody tr { padding: 10px; }
  #tablaUsuariosGlobal tbody tr td { display: flex; justify-content: space-between; align-items: center; width: 100%; min-height: 42px; border: 0; }
  #tablaUsuariosGlobal tbody tr td:not(:last-child) { min-width: 0; overflow-wrap: anywhere; gap: 12px; }
  #tablaUsuariosGlobal tbody tr td:nth-child(1)::before { content: 'Usuario'; font-weight: 700; }
  #tablaUsuariosGlobal tbody tr td:nth-child(2)::before { content: 'Mail'; font-weight: 700; }
  #tablaUsuariosGlobal tbody tr td:nth-child(3)::before { content: 'Empresa'; font-weight: 700; }
  #tablaUsuariosGlobal tbody tr td:nth-child(4)::before { content: 'Rol'; font-weight: 700; }
  #tablaUsuariosGlobal tbody tr td:nth-child(5)::before { content: 'Estado'; font-weight: 700; }
  #tablaUsuariosGlobal tbody tr td:last-child { display: block; padding-top: 12px; margin-top: 8px; border-top: 1px solid #dde3e8; }
  #tablaUsuariosGlobal tbody tr td:last-child .panel-admin-acciones { width: 100%; justify-content: end; }
}

@media (min-width: 761px) and (max-width: 900px) {
  .panel-admin-page header { flex-wrap: nowrap; }
  .panel-admin-page header .nobar-nav-links {
    order: initial;
    width: auto;
    overflow: visible;
    padding-bottom: 0;
    gap: 6px;
  }
  .panel-admin-page header .nobar-menu-categoria,
  .panel-admin-page header .nobar-dashboard-directo,
  .panel-admin-page header .nobar-salir-menu {
    font-size: 12px;
  }
}

/* Solo móvil: los cuatro controles se organizan en dos líneas de dos. */
@media (max-width: 600px) {
  #tablaUsuariosGlobal tbody tr td:last-child > button:nth-child(3) { grid-column: 1; grid-row: 2; }
  #tablaUsuariosGlobal tbody tr td:last-child > button:nth-child(4) { grid-column: 2; grid-row: 2; }
}

/* Tablet mantiene la misma composición 2 x 2, con botones de ancho uniforme. */
@media (min-width: 601px) and (max-width: 900px) {
  .panel-admin-page .panel-admin-acciones {
    grid-template-columns: repeat(2, 130px);
    width: max-content;
    column-gap: 8px;
    row-gap: 16px;
  }
  .panel-admin-page .panel-admin-acciones .cliente-boton {
    width: 130px;
  }
  #tablaUsuariosGlobal tbody tr td:last-child .panel-admin-acciones {
    justify-content: end;
  }
}

/* Clientes: configuración única copiada de Historial. */
body:has(#buscarCliente) #cardCotizacionesCliente { width: 100% !important; max-width: none !important; margin: 0 auto !important; }
body:has(#buscarCliente) #tablaCotizacionesCliente { width: 100% !important; min-width: 0 !important; table-layout: fixed !important; }
body:has(#buscarCliente) #tablaCotizacionesCliente thead { display: table-header-group !important; }
body:has(#buscarCliente) #tablaCotizacionesCliente thead tr,
body:has(#buscarCliente) #tablaCotizacionesCliente tbody tr { display: table-row !important; width: 100% !important; }
body:has(#buscarCliente) #tablaCotizacionesCliente th,
body:has(#buscarCliente) #tablaCotizacionesCliente td:not(.historial-acciones) { display: table-cell !important; }
body:has(#buscarCliente) #tablaCotizacionesCliente th:nth-child(1), body:has(#buscarCliente) #tablaCotizacionesCliente td:nth-child(1) { width: 15% !important; }
body:has(#buscarCliente) #tablaCotizacionesCliente th:nth-child(2), body:has(#buscarCliente) #tablaCotizacionesCliente td:nth-child(2) { width: 10% !important; }
body:has(#buscarCliente) #tablaCotizacionesCliente th:nth-child(3), body:has(#buscarCliente) #tablaCotizacionesCliente td:nth-child(3) { width: 15% !important; }
body:has(#buscarCliente) #tablaCotizacionesCliente th:nth-child(4), body:has(#buscarCliente) #tablaCotizacionesCliente td:nth-child(4) { width: 10% !important; }
body:has(#buscarCliente) #tablaCotizacionesCliente th:nth-child(5), body:has(#buscarCliente) #tablaCotizacionesCliente td:nth-child(5) { width: 50% !important; }
body:has(#buscarCliente) #tablaCotizacionesCliente td.historial-acciones { display: flex !important; flex-wrap: nowrap !important; gap: 10px !important; width: auto !important; min-width: 0 !important; }
body:has(#buscarCliente) #tablaCotizacionesCliente td.historial-acciones > button { width: 78px !important; min-width: 78px !important; max-width: 78px !important; margin: 0 !important; }

@media (min-width: 901px) and (max-width: 1200px) {
  body:has(#buscarCliente) #tablaCotizacionesCliente { width: 860px !important; min-width: 860px !important; table-layout: auto !important; }
  body:has(#buscarCliente) #tablaCotizacionesCliente th:nth-child(1), body:has(#buscarCliente) #tablaCotizacionesCliente td:nth-child(1) { width: 170px !important; }
  body:has(#buscarCliente) #tablaCotizacionesCliente th:nth-child(2), body:has(#buscarCliente) #tablaCotizacionesCliente td:nth-child(2) { width: 90px !important; }
  body:has(#buscarCliente) #tablaCotizacionesCliente th:nth-child(3), body:has(#buscarCliente) #tablaCotizacionesCliente td:nth-child(3) { width: 190px !important; }
  body:has(#buscarCliente) #tablaCotizacionesCliente th:nth-child(4), body:has(#buscarCliente) #tablaCotizacionesCliente td:nth-child(4) { width: 110px !important; }
  body:has(#buscarCliente) #tablaCotizacionesCliente th:nth-child(5), body:has(#buscarCliente) #tablaCotizacionesCliente td:nth-child(5) { width: 300px !important; }
  body:has(#buscarCliente) #tablaCotizacionesCliente td.historial-acciones { flex-wrap: wrap !important; width: 300px !important; min-width: 300px !important; }
}

@media (max-width: 900px) {
  body:has(#buscarCliente) #tablaCotizacionesCliente,
  body:has(#buscarCliente) #tablaCotizacionesCliente tbody,
  body:has(#buscarCliente) #tablaCotizacionesCliente tr,
  body:has(#buscarCliente) #tablaCotizacionesCliente td { display: block !important; width: 100% !important; min-width: 0 !important; max-width: 100% !important; }
  body:has(#buscarCliente) #tablaCotizacionesCliente thead { display: none !important; }
  body:has(#buscarCliente) #tablaCotizacionesCliente tr { display: grid !important; grid-template-columns: 1fr !important; margin-bottom: 14px; }
  body:has(#buscarCliente) #tablaCotizacionesCliente td:not(.historial-acciones) { display: grid !important; grid-template-columns: 92px minmax(0, 1fr) !important; gap: 8px !important; padding: 7px 10px !important; }
  body:has(#buscarCliente) #tablaCotizacionesCliente td:not(.historial-acciones)::before { font-weight: 700; color: var(--azul); }
  body:has(#buscarCliente) #tablaCotizacionesCliente td:nth-child(1)::before { content: 'Número'; }
  body:has(#buscarCliente) #tablaCotizacionesCliente td:nth-child(2)::before { content: 'Fecha'; }
  body:has(#buscarCliente) #tablaCotizacionesCliente td:nth-child(3)::before { content: 'Total'; }
  body:has(#buscarCliente) #tablaCotizacionesCliente td:nth-child(4)::before { content: 'Estado'; }
  body:has(#buscarCliente) #tablaCotizacionesCliente td.historial-acciones { display: grid !important; grid-template-columns: repeat(2, 105px) !important; justify-content: start !important; gap: 8px !important; padding: 8px 10px !important; overflow: hidden !important; }
  body:has(#buscarCliente) #tablaCotizacionesCliente td.historial-acciones > button { width: 105px !important; min-width: 105px !important; max-width: 105px !important; }
}

@media (max-width: 900px) {
  body:has(#buscarCliente) #tablaCotizacionesCliente td.historial-acciones > button {
    box-sizing: border-box !important;
    width: calc(50% - 10px) !important;
    min-width: 0 !important;
    max-width: none !important;
    flex: 0 0 calc(50% - 10px) !important;
  }
}
* { box-sizing: border-box; }
body {
  font-family: 'Segoe UI', Arial, sans-serif;
  background: var(--gris);
  margin: 0;
  color: #222;
}
header {
  background: var(--azul);
  color: white;
  padding: 10px clamp(14px, 1.5vw, 20px);
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  align-items: center;
  row-gap: 8px;
  column-gap: clamp(8px, 1vw, 16px);
  position: sticky;
  top: 12px;
  z-index: 10001;
  width: calc(100% - 40px);
  margin: 12px 20px 0;
  border-radius: 14px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
}
header h1 { font-size: 18px; margin: 0; }
/* Evita que el nombre heredado se vea mientras se arma el encabezado dinámico. */
header > h1 { display: none; }
header.nobar-header-cargando { visibility: hidden; }
header nav.nobar-nav-links {
  display: flex;
  flex-wrap: nowrap;
  gap: clamp(8px, 1vw, 16px);
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
}
.nobar-categorias {
  display: flex;
  align-items: center;
  gap: clamp(8px, 1vw, 16px);
}
.nobar-dashboard-directo {
  color: white;
  text-decoration: none;
  padding: 6px 0;
  white-space: nowrap;
}
.nobar-dashboard-compacto { display: none; }
.nobar-dashboard-directo,
.nobar-perfil-directo,
.nobar-menu-categoria,
.nobar-salir-menu,
.nobar-submenu a,
.nobar-submenu button {
  font-family: inherit;
  font-size: clamp(13px, 1.1vw, 16px);
  font-weight: 600;
  line-height: 1.25;
}
.nobar-nav-acciones {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}
.nobar-perfil-directo {
  color: white;
  text-decoration: none;
  padding: 6px 0;
  white-space: nowrap;
}
.nobar-menu-grupo { position: relative; flex-shrink: 0; }
.nobar-menu-categoria {
  white-space: nowrap;
  border: 0;
  padding: 6px 0;
  border-radius: 0;
  font-size: clamp(13px, 1.1vw, 16px);
}
.nobar-submenu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 10000;
  min-width: 210px;
  padding: 6px;
  background: var(--nobar-color-menu);
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 6px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.22);
}
.nobar-menu-grupo.is-open .nobar-submenu { display: flex; flex-direction: column; }
.nobar-submenu a,
.nobar-submenu button {
  color: white;
  padding: 8px 10px;
  text-align: left;
  text-decoration: none;
  background: transparent;
  border: 0;
  cursor: pointer;
}
.nobar-submenu a:hover,
.nobar-submenu button:hover { background: rgba(255, 255, 255, 0.14); }
.nobar-dashboard-directo:hover,
.nobar-perfil-directo:hover,
.nobar-menu-categoria:hover {
  color: rgba(255, 255, 255, 0.72);
}
.nobar-menu-toggle:hover,
.nobar-salir-menu:hover {
  background: rgba(255, 255, 255, 0.14);
}
header .nobar-header-izquierda {
  display: flex;
  align-items: center;
  gap: 10px;
}
a.nobar-logo-inicio { display: inline-flex; align-items: center; }
a.nobar-logo-inicio img { height: 34px; display: block; }
a.nobar-logo-inicio .nobar-logo-texto {
  color: white; font-weight: 700; font-size: 16px; text-decoration: none;
}
header button {
  background: transparent;
  border: 1px solid white;
  color: white;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  flex-shrink: 0;
}
.nobar-menu-categoria,
.nobar-menu-categoria:hover,
.nobar-menu-categoria:focus-visible {
  background: transparent;
  border: 0;
}
.nobar-salir-menu,
.nobar-menu-toggle {
  border: 1px solid white;
  border-radius: 6px;
  padding: 6px 12px;
  background: transparent;
}
.nobar-salir-movil { display: none; }
.nobar-menu-toggle { display: none; }
main { max-width: 950px; margin: 24px auto; padding: 0 16px; }
body:has(#tablaHistorial) main,
body:has(#buscarCliente) main { max-width: min(1400px, calc(100% - 24px)); }
body:has(#tablaCatalogo) main { max-width: min(1400px, calc(100% - 24px)); }
.card {
  background: white;
  border: 1px solid var(--borde);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
  min-width: 0;
}
.panel-admin-page .dashboard-desplegable > summary {
  cursor: pointer;
  list-style-position: inside;
  font-size: 1.17em;
  font-weight: 700;
  color: #222;
}
.panel-admin-page .dashboard-desplegable > summary::marker { color: var(--azul); }
.panel-admin-page .dashboard-desplegable[open] > summary { margin-bottom: 16px; }
.panel-admin-page .empresas-tabla[hidden] { display: none; }
.panel-admin-page .empresas-panel { position: relative; }
.panel-admin-page .empresas-subcontenedor { width: 100%; box-sizing: border-box; padding: 16px; border: 1px solid #c8d0d6; border-radius: 10px; background: #fff; }
@media (min-width: 761px) {
  .panel-admin-page .empresas-panel > .empresas-subcontenedor { border-left: 1px solid #8a8a8a; border-right: 1px solid #8a8a8a; }
}
.panel-admin-page .empresas-cabecera,
.panel-admin-page .empresas-datos { padding: 16px 0 0; background: transparent; }
.panel-admin-page .empresas-cabecera { padding: 0 0 16px; background: transparent; }
.panel-admin-page .empresas-cabecera { margin-bottom: 16px; }
.panel-admin-page .empresas-cabecera { border-bottom: 1px solid #c8d0d6; }
.panel-admin-page .empresas-cabecera h2 { margin-top: 0; }
.panel-admin-page .empresas-cabecera p { margin-bottom: 0; }
.panel-admin-page .empresas-busqueda-fila { display: flex; align-items: end; gap: 12px; }
.panel-admin-page .empresas-busqueda { position: relative; display: flex; align-items: center; width: 100%; }
.panel-admin-page .empresas-busqueda input { flex: 1 1 auto; min-width: 0; }
.panel-admin-page .empresas-busqueda input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.panel-admin-page #limpiarBuscarEmpresa { display: none; position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 30px; min-width: 30px; height: 30px; min-height: 30px; margin: 0; padding: 0; border: 0; background: transparent; color: #555; font-size: 24px; line-height: 1; z-index: 1; }
.panel-admin-page #limpiarBuscarEmpresa:not([hidden]) { display: block; }
.panel-admin-page #limpiarBuscarEmpresa[hidden] { display: none; }
.panel-admin-page .buscador-consumo #limpiarConsumoEmpresa:not([hidden]) { display: block; }
.panel-admin-page .empresas-panel > label { display: block; margin: 12px 0 6px; font-weight: 600; }
.panel-admin-page .empresas-busqueda-fila > #nuevaEmpresa { flex: 0 0 auto; margin: 0; white-space: nowrap; }
.panel-admin-page .empresas-panel .empresas-tabla { margin-top: 18px; }
.panel-admin-page .empresas-panel .empresas-tabla table { width: 100%; border: 1px solid #c8d0d6; border-radius: 10px; border-collapse: separate; border-spacing: 0; overflow: hidden; }
.panel-admin-page .empresas-panel .empresas-tabla #tablaEmpresasGlobal { display: table !important; width: 100%; table-layout: fixed; }
.panel-admin-page .empresas-panel .empresas-tabla #tablaEmpresasGlobal tbody { display: table-row-group; }
.panel-admin-page .empresas-panel .empresas-tabla #tablaEmpresasGlobal tbody tr { display: table-row; width: auto; }
.panel-admin-page .empresas-panel .empresas-tabla #tablaEmpresasGlobal th:last-child,
.panel-admin-page .empresas-panel .empresas-tabla #tablaEmpresasGlobal td:last-child { width: 240px; }
.panel-admin-page .empresas-panel .panel-admin-acciones { display: grid; grid-template-columns: repeat(2, minmax(92px, 1fr)); grid-auto-rows: 40px; justify-content: end; align-items: start; gap: 8px; margin-left: auto; max-width: 220px; }
.panel-admin-page .empresas-panel .panel-admin-acciones button,
.panel-admin-page #empresaDialog button.cliente-boton { min-width: 0; margin: 0; border: 1px solid #8a8a8a; border-radius: 999px; background: #e5e5e5; color: #111; }
.panel-admin-page .empresas-panel .panel-admin-acciones button { width: 100% !important; }
.panel-admin-page .empresas-panel .panel-admin-acciones button:hover,
.panel-admin-page #empresaDialog button.cliente-boton:hover { background: #d8d8d8; }
.panel-admin-page #empresaDialog,
.panel-admin-page #empresaDetalle { width: min(760px, calc(100vw - 32px)); max-width: min(760px, calc(100vw - 32px)); }
.panel-admin-page #empresaDialog form { width: 100%; }
.panel-admin-page #empresaDialog .empresa-acordeon { margin: 12px 0; padding: 0 12px 12px; border: 1px solid #c8d0d6; border-radius: 10px; }
.panel-admin-page #empresaDialog .empresa-acordeon > summary { cursor: pointer; padding: 12px 0; font-weight: 700; }
.panel-admin-page #empresaDialog .empresa-acordeon[open] > summary { margin-bottom: 8px; }
.panel-admin-page #empresaDialog .empresa-acordeon[hidden] { display: none; }
.panel-admin-page #empresaDialog .password-requisitos { margin: -2px 0 10px; padding: 0; list-style: none; color: #68737d; font-size: 0.9rem; }
.panel-admin-page #empresaDialog .password-requisitos li::before { content: '☐'; display: inline-block; width: 22px; }
.panel-admin-page #empresaDialog .password-requisitos li.cumplido { color: #256b45; }
.panel-admin-page #empresaDialog .password-requisitos li.cumplido::before { content: '☑'; }
.panel-admin-page .empresa-dialog-acciones { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; padding-top: 12px; border-top: 1px solid #c8d0d6; }
.panel-admin-page .empresa-dialog-acciones button { margin: 0; border: 1px solid #8a8a8a; }
.panel-admin-page #empresaDetalleContenido { width: 100%; min-width: 0; }
.panel-admin-page .empresa-detalle-fila { display: grid; grid-template-columns: minmax(130px, 35%) minmax(0, 1fr); gap: 12px; padding: 10px 0; border-bottom: 1px solid #edf0f2; }
.panel-admin-page .empresa-detalle-campo { font-weight: 700; text-align: left; }
.panel-admin-page .empresa-detalle-valor { min-width: 0; overflow-wrap: anywhere; text-align: right; }
.panel-admin-page .empresas-panel .panel-admin-acciones button:disabled { opacity: .48; cursor: not-allowed; }
.panel-admin-page .planes-panel { position: relative; }
.panel-admin-page .planes-subcontenedor { width: 100%; box-sizing: border-box; padding: 16px; border: 1px solid #c8d0d6; border-radius: 10px; background: #fff; }
.panel-admin-page .planes-cabecera { padding-bottom: 16px; border-bottom: 1px solid #c8d0d6; margin-bottom: 16px; }
.panel-admin-page .planes-cabecera h2 { margin: 0; }
.panel-admin-page .planes-cabecera p { margin-bottom: 0; }
.panel-admin-page .planes-busqueda-fila { display: flex; align-items: end; gap: 12px; }
.panel-admin-page .planes-busqueda { flex: 1 1 auto; min-width: 0; }
.panel-admin-page .planes-busqueda label { display: block; margin: 0 0 6px; }
.panel-admin-page .buscador-plan { position: relative; display: flex; align-items: center; }
.panel-admin-page .buscador-plan input { min-width: 0; }
.panel-admin-page .buscador-plan input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.panel-admin-page #limpiarBuscarPlan { display: none; position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 30px; min-width: 30px; height: 30px; min-height: 30px; margin: 0; padding: 0; border: 0; background: transparent; color: #555; font-size: 24px; line-height: 1; }
.panel-admin-page #limpiarBuscarPlan:not([hidden]) { display: block; }
.panel-admin-page #limpiarBuscarPlan[hidden] { display: none; }
.panel-admin-page .planes-busqueda-fila > #nuevoPlan { margin: 0; white-space: nowrap; }
.panel-admin-page .planes-tabla[hidden] { display: none; }
.panel-admin-page .planes-tabla { margin-top: 18px; }
.panel-admin-page .planes-tabla table { width: 100%; border: 1px solid #c8d0d6; border-radius: 10px; border-collapse: separate; border-spacing: 0; overflow: hidden; }
.panel-admin-page .planes-tabla th, .panel-admin-page .planes-tabla td { border-right: 1px solid #e1e6ea; }
.panel-admin-page .planes-tabla th:last-child, .panel-admin-page .planes-tabla td:last-child { border-right: 0; }
.panel-admin-page .planes-tabla td:last-child { width: 220px; }
.panel-admin-page .planes-tabla .panel-admin-acciones { display: grid; grid-template-columns: repeat(2, minmax(92px, 1fr)); gap: 8px; }
.panel-admin-page .planes-tabla .panel-admin-acciones button { margin: 0; border: 1px solid #8a8a8a; border-radius: 999px; background: #e5e5e5; color: #111; }
.panel-admin-page .planes-modulos { margin-top: 18px; padding: 0 12px 12px; border: 1px solid #c8d0d6; border-radius: 10px; }
.panel-admin-page .planes-modulos summary, .panel-admin-page .plan-acordeon summary { cursor: pointer; padding: 12px 0; font-weight: 700; }
.panel-admin-page .planes-modulos[open] summary { margin-bottom: 8px; }
.panel-admin-page #listaPlanModulos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; margin-top: 12px; }
.panel-admin-page .plan-modulo-check, .panel-admin-page .check-line { display: flex; align-items: center; gap: 8px; }
.panel-admin-page .plan-modulo-check input, .panel-admin-page .check-line input { width: auto; }
.panel-admin-page #planDialog { width: min(620px, calc(100vw - 32px)); max-width: min(620px, calc(100vw - 32px)); }
.panel-admin-page #planDialog .plan-acordeon { margin: 12px 0; padding: 0 12px 12px; border: 1px solid #c8d0d6; border-radius: 10px; }
.panel-admin-page #planDialog .plan-acordeon[open] summary { margin-bottom: 8px; }
@media (max-width: 760px) {
  .panel-admin-page .planes-busqueda-fila { align-items: stretch; flex-direction: column; }
  .panel-admin-page .planes-busqueda-fila > #nuevoPlan { width: 100%; }
  .panel-admin-page .planes-tabla table { display: block; border: 0; overflow: visible; }
  .panel-admin-page .planes-tabla thead { display: none; }
  .panel-admin-page .planes-tabla tbody, .panel-admin-page .planes-tabla tr, .panel-admin-page .planes-tabla td { display: block; width: auto; }
  .panel-admin-page .planes-tabla tr { margin: 12px 0; padding: 12px; border: 1px solid #c8d0d6; border-radius: 10px; }
  .panel-admin-page .planes-tabla td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 7px 0; overflow-wrap: anywhere; }
  .panel-admin-page .planes-tabla td::before { font-weight: 700; margin-right: 10px; }
  .panel-admin-page .planes-tabla td:nth-child(1)::before { content: 'Plan'; }
  .panel-admin-page .planes-tabla td:nth-child(2)::before { content: 'Mensual'; }
  .panel-admin-page .planes-tabla td:nth-child(3)::before { content: 'Anual'; }
  .panel-admin-page .planes-tabla td:nth-child(4)::before { content: 'Usuarios'; }
  .panel-admin-page .planes-tabla td:nth-child(5)::before { content: 'Portal'; }
  .panel-admin-page .planes-tabla td:nth-child(6)::before { content: 'Estado'; }
  .panel-admin-page .planes-tabla td:nth-child(7) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding-top: 12px; border-top: 1px solid #e1e6ea; }
  .panel-admin-page .planes-tabla .panel-admin-acciones button { width: 100%; }
  .panel-admin-page #listaPlanModulos { grid-template-columns: 1fr; }
}
/* Tablas y formularios de Comercial/Administración no fuerzan el ancho de la pantalla. */
main .card table { display: block; max-width: 100%; overflow-x: auto; }
main .card table thead,
main .card table tbody { width: 100%; }
.pestanas { max-width: 100%; overflow-x: auto; }
.login-box {
  max-width: 360px;
  margin: 80px auto;
  background: white;
  padding: 30px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}
label { display: block; font-size: 13px; font-weight: 600; margin: 10px 0 4px; }
input, select, textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--borde);
  border-radius: 4px;
  font-size: 14px;
}
button.primary {
  background: var(--azul-claro);
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  margin-top: 12px;
}

body:has(#formRecuperar) { color: #000; }
body:has(#formRecuperar) button.primary {
  margin-top: 20px;
  padding: 12px 24px;
  border: 1px solid #111827;
  border-radius: 999px;
  background: #111827;
  color: #fff;
  font-weight: 700;
  box-shadow: none;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}
body:has(#formRecuperar) button.primary:hover { background: #1f2937; }
body:has(#formRecuperar) button.primary:active { transform: translateY(4px); box-shadow: none; }
body:has(#formRecuperar) label,
body:has(#formRecuperar) h2,
body:has(#formRecuperar) a { color: #000; }
button.secundario {
  background: white;
  border: 1px solid var(--azul-claro);
  color: var(--azul-claro);
  padding: 8px 14px;
  border-radius: 4px;
  cursor: pointer;
}
#btnAgregarItem { color: #000; border-color: #8a8a8a; }
#btnQuitarLogo,
#btnQuitarFondo,
#btnQuitarLogoCotizacion { color: #000; border-color: #000; }

/* Acciones uniformes de la ventana Editar cliente. */
.cliente-botones-edicion,
.cliente-boton-eliminar-wrap {
  display: flex;
  gap: 10px;
  margin-top: 56px;
  align-items: center;
}
.cliente-busqueda-fila { display: flex; align-items: stretch; gap: 10px; }
.cliente-busqueda-fila input { flex: 1 1 auto; min-width: 0; }
.clientes-ayuda { margin: 10px 0; color: #666; line-height: 1.45; }
.cliente-boton-agregar { background: #2e7d32; color: #fff; border: 1px solid #236126; margin: 0; width: auto; white-space: nowrap; }
#btnEditarCliente,
#btnVacioCliente { background: #fff; color: #222; border: 1px solid #236126; margin: 0; white-space: nowrap; }
#btnVacioCliente { margin-left: auto; }
#btnNuevoAccesoCliente {
  background: #fff;
  color: #222;
  border: 1px solid #222;
}
#btnNuevoAccesoCliente:focus,
#btnNuevoAccesoCliente:focus-visible {
  outline: none;
  box-shadow: none;
}
.accesos-clientes-panel {
  width: 100%;
  max-width: 1200px;
  margin: 18px auto 0;
  padding: 16px;
  box-sizing: border-box;
  border: 1px solid var(--borde);
  border-radius: 10px;
  background: #fff;
}
.accesos-clientes-resumen { margin: 0 0 10px; font-weight: 600; }
.accesos-clientes-resumen.ayuda { font-weight: 400; }
.accesos-clientes-resumen div { line-height: 1.35; }
.accesos-clientes-tabla-wrap { width: 100%; overflow-x: auto; }
#tablaAccesosClientes { min-width: 900px; }
#tablaAccesosClientes th:last-child { text-align: center; }
.accesos-clientes-acciones { display: grid; grid-template-columns: repeat(2, 120px); gap: 6px; min-width: 246px; }
.accesos-clientes-acciones > .cliente-boton {
  width: 120px;
  min-height: 32px;
  padding: 6px 8px;
  border: 0;
  border-radius: 999px;
  background: #e5e5e5;
  color: #111;
  height: 40px;
  font-size: 14px;
  white-space: normal;
  line-height: 1.1;
}
@media (max-width: 1050px) {
  .accesos-clientes-acciones { grid-template-columns: repeat(2, 120px); min-width: 0; }
  .accesos-clientes-tabla-wrap { overflow: visible; }
  #tablaAccesosClientes { min-width: 0; width: 100%; border-collapse: separate; }
  #tablaAccesosClientes thead { display: none; }
  #tablaAccesosClientes tbody,
  #tablaAccesosClientes tr,
  #tablaAccesosClientes td { display: block; width: 100%; box-sizing: border-box; }
  #tablaAccesosClientes tr {
    margin-bottom: 14px;
    padding: 12px;
    border: 1px solid var(--borde);
    border-radius: 10px;
    background: #fff;
  }
  #tablaAccesosClientes td {
    display: grid;
    grid-template-columns: 132px minmax(0, 1fr);
    gap: 8px;
    padding: 7px 0;
    border: 0;
    text-align: left;
    overflow-wrap: anywhere;
  }
  #tablaAccesosClientes td::before { font-weight: 700; color: var(--azul); }
  #tablaAccesosClientes td:nth-child(1)::before { content: 'Cliente'; }
  #tablaAccesosClientes td:nth-child(2)::before { content: 'Accesos'; }
  #tablaAccesosClientes td:nth-child(3)::before { content: 'Correo'; }
  #tablaAccesosClientes td:nth-child(4)::before { content: 'Estado'; }
  #tablaAccesosClientes td:nth-child(5)::before { content: 'Creado'; }
  #tablaAccesosClientes td:nth-child(6)::before { content: 'Último acceso'; }
  #tablaAccesosClientes td:nth-child(7) { display: block; padding-top: 10px; }
  #tablaAccesosClientes td:nth-child(7)::before { content: 'Acciones'; display: block; margin-bottom: 8px; text-align: center; }
  #tablaAccesosClientes td.accesos-clientes-acciones {
    display: grid;
    grid-template-columns: repeat(2, 120px);
    width: 246px;
    gap: 6px;
  }
  #tablaAccesosClientes td.accesos-clientes-acciones::before { grid-column: 1 / -1; }
  .accesos-clientes-acciones > .cliente-boton { width: 120px; height: 40px; justify-self: start; }
}
.cliente-formulario { min-width: min(620px, 90vw); }
.cliente-boton-eliminar-wrap { justify-content: flex-end; margin-top: 18px; }
.cliente-boton {
  box-sizing: border-box;
  width: clamp(110px, 28vw, 150px);
  min-height: 40px;
  padding: 9px 14px;
  border-radius: 5px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, background-color 140ms ease;
}
.cliente-boton:hover { transform: translateY(-1px); }
.cliente-boton:active { transform: translateY(2px) scale(.98); }
.cliente-boton-guardar { background: #2e7d32; color: #fff; border: 1px solid #236126; }
#btnGuardarEmpresa,
#btnGuardarMarca,
#btnGuardarApariencia { background: #2e7d32; color: #fff; border: 1px solid #236126; }
#btnGuardarEmpresa,
#btnGuardarMarca,
#btnGuardarApariencia { margin-top: 56px; }
#btnQuitarFondo,
#btnGuardarApariencia { display: block; margin-left: 0; }
.boton-guardar-estandar { margin-top: 56px; }
.cotizacion-acciones { display: flex; gap: 10px; align-items: center; }
.modo-edicion #btnGuardar { width: auto; min-width: 210px; white-space: nowrap; }
.cotizacion-acciones .cliente-boton-eliminar { margin-left: auto; }
.cliente-boton-cancelar { background: #fff; color: #222; border: 1px solid #8a8a8a; }
.cliente-boton-eliminar { background: #c62828; color: #fff; border: 1px solid #a51f1f; }
.cliente-boton-descargar { background: #fff; color: #222; border: 1px solid #8a8a8a; }
.quitar { background: #c62828 !important; color: #fff !important; border: 1px solid #a51f1f !important; }
.cliente-boton-eliminar { margin-left: auto; }
#tablaCategoriasCatalogo td:last-child { display:flex; align-items:center; gap:10px; }
#tablaCategoriasCatalogo td:last-child .cliente-boton { width:120px; min-width:120px; height:40px; min-height:40px; font-size:14px; }
#tablaCategoriasCatalogo .estado-inactivo { color:#b42318; font-weight:600; }
@media (max-width:600px) {
  #tablaCategoriasCatalogo td:last-child { flex-wrap:wrap; }
  #tablaCategoriasCatalogo td:last-child .cliente-boton { flex:1 1 120px; }
}
#tablaItems td:last-child { white-space: nowrap; }
#tablaItems td:last-child { padding-left: 30px; }
#tablaItems td:last-child .cliente-boton-descargar { margin-right: 55px; }

/* Clientes comparte el lenguaje visual de Historial sin cambiar su contenido. */
body:has(#buscarCliente) .card { overflow: hidden; }
body:has(#buscarCliente) .card > label {
  color: #222;
  font-size: 12px;
  font-weight: 600;
  margin: 0 0 4px;
}
body:has(#buscarCliente) .cliente-busqueda-fila { gap: 10px; margin-bottom: 14px; }
body:has(#buscarCliente) #buscarCliente { min-height: 36px; }
body:has(#buscarCliente) #listaClientes { margin-top: 0 !important; }
body:has(#buscarCliente) .cliente-resultado {
  padding: 10px 8px;
  border-bottom: 1px solid var(--borde);
  cursor: pointer;
  font-size: 13px;
}
body:has(#buscarCliente) .cliente-resultado:hover { background: var(--gris); }
body:has(#buscarCliente) #cardCotizacionesCliente h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 14px;
}
body:has(#buscarCliente) #cardCotizacionesCliente h3 button {
  font-size: 12px;
  margin-left: 0 !important;
}
body:has(#buscarCliente) #tablaCotizacionesCliente { margin-top: 0; }
body:has(#buscarCliente) #tablaCotizacionesCliente th {
  background: var(--gris);
  font-weight: 700;
}
body:has(#buscarCliente) #tablaCotizacionesCliente thead th:last-child {
  background: var(--gris);
}
body:has(#buscarCliente) #tablaCotizacionesCliente tr { border: 1px solid var(--borde); border-radius: 8px; }
body:has(#buscarCliente) #tablaCotizacionesCliente,
body:has(#buscarCliente) #tablaCotizacionesCliente thead,
body:has(#buscarCliente) #tablaCotizacionesCliente tbody,
body:has(#buscarCliente) #tablaCotizacionesCliente tr { width: 100%; box-sizing: border-box; }
body:has(#buscarCliente) #tablaCotizacionesCliente thead tr,
body:has(#buscarCliente) #tablaCotizacionesCliente tbody tr {
  display: grid;
  grid-template-columns: 170px 90px 190px 110px 520px;
  align-items: center;
}
body:has(#buscarCliente) #tablaCotizacionesCliente th,
body:has(#buscarCliente) #tablaCotizacionesCliente td { min-width: 0; box-sizing: border-box; }
body:has(#buscarCliente) #tablaCotizacionesCliente td { border-bottom: 0; }
body:has(#buscarCliente) #tablaCotizacionesCliente td.historial-acciones {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  justify-content: flex-start;
  width: 520px;
  min-width: 520px;
}
body:has(#buscarCliente) #tablaCotizacionesCliente td.historial-acciones > button {
  border: 0;
  border-radius: 999px;
  background: #e5e5e5;
  color: #111;
  padding: 7px 14px;
  font-size: 13px;
  white-space: nowrap;
}
body:has(#buscarCliente) #tablaCotizacionesCliente td.historial-acciones > button:disabled { opacity: .42; }
@media (max-width: 1200px) {
  body:has(#buscarCliente) .cliente-busqueda-fila { flex-wrap: wrap; }
  body:has(#buscarCliente) .cliente-busqueda-fila input,
  body:has(#buscarCliente) .cliente-busqueda-fila .cliente-boton-agregar {
    flex: 1 1 100%;
    width: 100%;
  }
  body:has(#buscarCliente) #cardCotizacionesCliente table {
    display: block;
    min-width: 0;
    overflow: visible;
  }
  body:has(#buscarCliente) #tablaCotizacionesCliente thead { display: none; }
  body:has(#buscarCliente) #tablaCotizacionesCliente,
  body:has(#buscarCliente) #tablaCotizacionesCliente tbody,
  body:has(#buscarCliente) #tablaCotizacionesCliente tr,
  body:has(#buscarCliente) #tablaCotizacionesCliente td { display: block; width: 100%; }
  body:has(#buscarCliente) #tablaCotizacionesCliente tr {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 14px;
    padding: 8px 0;
    border: 1px solid var(--borde);
    border-radius: 8px;
  }
  body:has(#buscarCliente) #tablaCotizacionesCliente td {
    display: grid;
    grid-template-columns: minmax(92px, 34%) 1fr;
    gap: 8px;
    padding: 7px 10px;
    border: 0;
    overflow-wrap: anywhere;
  }
  body:has(#buscarCliente) #tablaCotizacionesCliente td:nth-child(-n+4) { grid-column: 1 / -1; }
  body:has(#buscarCliente) #tablaCotizacionesCliente td:nth-child(n+5) {
    display: block;
    text-align: left;
  }
  body:has(#buscarCliente) #tablaCotizacionesCliente td:nth-child(n+5)::before { content: ''; }
  body:has(#buscarCliente) #tablaCotizacionesCliente td:nth-child(n+5) button,
  body:has(#buscarCliente) #tablaCotizacionesCliente td:nth-child(n+5) a {
    margin: 3px 8px 3px 0;
    white-space: nowrap;
  }
  body:has(#buscarCliente) #tablaCotizacionesCliente td:nth-child(-n+4)::before {
    font-weight: 700;
    color: var(--azul);
  }
  body:has(#buscarCliente) #tablaCotizacionesCliente td:nth-child(1)::before { content: 'Número'; }
  body:has(#buscarCliente) #tablaCotizacionesCliente td:nth-child(2)::before { content: 'Fecha'; }
  body:has(#buscarCliente) #tablaCotizacionesCliente td:nth-child(3)::before { content: 'Total'; }
  body:has(#buscarCliente) #tablaCotizacionesCliente td:nth-child(4)::before { content: 'Estado'; }
}

/* Clientes: las acciones ocupan una fila completa en móvil, igual que Historial. */
@media (max-width: 1200px) {
  body:has(#buscarCliente) #tablaCotizacionesCliente td.historial-acciones {
    display: flex !important;
    grid-column: 1 / -1 !important;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    padding: 8px 10px;
  }
  body:has(#buscarCliente) #tablaCotizacionesCliente td.historial-acciones > button {
    flex: 0 1 auto;
    width: auto;
    min-width: 78px;
    margin: 0;
  }
}

@media (max-width: 900px) {
  body:has(#buscarCliente) main { width: 100%; padding: 0 10px; }
  body:has(#buscarCliente) .card { padding: 12px; }
  body:has(#buscarCliente) #cardCotizacionesCliente h3 {
    align-items: flex-start;
    flex-direction: column;
  }
  body:has(#buscarCliente) #cardCotizacionesCliente h3 button {
    margin-left: 0 !important;
    width: 100%;
    border: 0;
    border-radius: 999px;
    background: #e5e5e5;
    color: #111;
    padding: 7px 12px;
  }
  body:has(#buscarCliente) #tablaCotizacionesCliente tbody tr {
    grid-template-columns: 1fr;
    width: 100%;
  }
  body:has(#buscarCliente) #tablaCotizacionesCliente tbody td,
  body:has(#buscarCliente) #tablaCotizacionesCliente tbody td:nth-child(n+5) {
    grid-column: 1 / -1;
    width: 100%;
  }
  body:has(#buscarCliente) #tablaCotizacionesCliente td.historial-acciones {
    display: flex !important;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-start;
  }
  body:has(#buscarCliente) #tablaCotizacionesCliente td.historial-acciones > button {
    min-width: 0;
    width: calc(50% - 4px);
    flex: 0 0 calc(50% - 4px);
  }
}

@media (max-width: 900px) {
  body:has(#buscarCliente) #tablaCotizacionesCliente td.historial-acciones {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 10px;
  }
  body:has(#buscarCliente) #tablaCotizacionesCliente td.historial-acciones > button {
    width: 105px !important;
    min-width: 105px !important;
    flex: 0 0 105px !important;
    box-sizing: border-box;
    margin: 0 !important;
    padding: 6px 4px;
    font-size: 12px;
    line-height: 1.2;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  body:has(#buscarCliente) #tablaCotizacionesCliente td.historial-acciones > .ver-pdf {
    margin-left: -10px !important;
  }
}

@media (min-width: 481px) and (max-width: 1200px) {
  body:has(#buscarCliente) #tablaCotizacionesCliente,
  body:has(#buscarCliente) #tablaCotizacionesCliente thead,
  body:has(#buscarCliente) #tablaCotizacionesCliente tbody,
  body:has(#buscarCliente) #tablaCotizacionesCliente tr {
    width: 860px !important;
    min-width: 860px !important;
    max-width: 860px !important;
  }
  body:has(#buscarCliente) #tablaCotizacionesCliente thead tr,
  body:has(#buscarCliente) #tablaCotizacionesCliente tbody tr {
    grid-template-columns: 170px 90px 190px 110px 300px;
  }
  body:has(#buscarCliente) #tablaCotizacionesCliente td.historial-acciones {
    width: 300px !important;
    min-width: 300px !important;
    max-width: 300px !important;
  }
  body:has(#buscarCliente) #tablaCotizacionesCliente td.historial-acciones > button {
    width: 105px !important;
    min-width: 105px !important;
    flex: 0 0 105px !important;
    margin: 0 !important;
  }
}

/* Clientes usa la misma vista de tablet que Historial: tabla visible, no tarjeta móvil. */
@media (min-width: 901px) and (max-width: 1200px) and (pointer: fine) {
  body:has(#buscarCliente) main .card table {
    display: table;
    min-width: 860px;
    overflow-x: auto;
  }
  body:has(#buscarCliente) #tablaCotizacionesCliente thead { display: table-header-group; }
  body:has(#buscarCliente) #tablaCotizacionesCliente,
  body:has(#buscarCliente) #tablaCotizacionesCliente tbody {
    display: table;
    width: 100%;
  }
  body:has(#buscarCliente) #tablaCotizacionesCliente {
    width: 860px;
    min-width: 860px;
    table-layout: auto;
  }
  body:has(#buscarCliente) #tablaCotizacionesCliente tr { display: table-row; }
  body:has(#buscarCliente) #tablaCotizacionesCliente td,
  body:has(#buscarCliente) #tablaCotizacionesCliente th {
    display: table-cell;
    width: auto;
  }
  body:has(#buscarCliente) #tablaCotizacionesCliente td.historial-acciones {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: flex-start !important;
    align-items: center;
    gap: 10px;
    width: 300px !important;
    min-width: 300px !important;
    overflow: visible;
  }
  body:has(#buscarCliente) #tablaCotizacionesCliente td.historial-acciones > button {
    width: 78px !important;
    min-width: 78px !important;
    max-width: 78px !important;
    margin: 0 !important;
  }
}

/* Configuración final de Clientes: exactamente tres vistas, igual que Historial. */
@media (min-width: 1201px) {
  body:has(#buscarCliente) #tablaCotizacionesCliente {
    width: 100% !important;
    table-layout: fixed !important;
  }
  body:has(#buscarCliente) #tablaCotizacionesCliente th:nth-child(1),
  body:has(#buscarCliente) #tablaCotizacionesCliente td:nth-child(1) { width: 15% !important; }
  body:has(#buscarCliente) #tablaCotizacionesCliente th:nth-child(2),
  body:has(#buscarCliente) #tablaCotizacionesCliente td:nth-child(2) { width: 10% !important; }
  body:has(#buscarCliente) #tablaCotizacionesCliente th:nth-child(3),
  body:has(#buscarCliente) #tablaCotizacionesCliente td:nth-child(3) { width: 15% !important; }
  body:has(#buscarCliente) #tablaCotizacionesCliente th:nth-child(4),
  body:has(#buscarCliente) #tablaCotizacionesCliente td:nth-child(4) { width: 10% !important; }
  body:has(#buscarCliente) #tablaCotizacionesCliente th:nth-child(5),
  body:has(#buscarCliente) #tablaCotizacionesCliente td:nth-child(5) { width: 50% !important; }
  body:has(#buscarCliente) #tablaCotizacionesCliente td.historial-acciones {
    flex-wrap: nowrap !important;
    width: 520px !important;
    min-width: 520px !important;
  }
  body:has(#buscarCliente) #tablaCotizacionesCliente td.historial-acciones > button {
    width: 78px !important;
    min-width: 78px !important;
    max-width: 78px !important;
    margin: 0 !important;
  }
}

@media (min-width: 901px) and (max-width: 1200px) {
  body:has(#buscarCliente) #tablaCotizacionesCliente,
  body:has(#buscarCliente) #tablaCotizacionesCliente tbody {
    display: table !important;
    width: 860px !important;
    min-width: 860px !important;
  }
  body:has(#buscarCliente) #tablaCotizacionesCliente thead { display: table-header-group !important; }
  body:has(#buscarCliente) #tablaCotizacionesCliente tr { display: table-row !important; }
  body:has(#buscarCliente) #tablaCotizacionesCliente th,
  body:has(#buscarCliente) #tablaCotizacionesCliente td {
    display: table-cell !important;
    width: auto !important;
    min-width: 0 !important;
    padding: 8px 10px !important;
  }
  body:has(#buscarCliente) #tablaCotizacionesCliente td.historial-acciones {
    display: flex !important;
    width: 300px !important;
    min-width: 300px !important;
    flex-wrap: wrap !important;
    gap: 10px !important;
  }
  body:has(#buscarCliente) #tablaCotizacionesCliente td.historial-acciones > button {
    width: 78px !important;
    min-width: 78px !important;
    max-width: 78px !important;
    margin: 0 !important;
  }
}

@media (min-width: 961px) {
  body:has(#buscarCliente) #cardCotizacionesCliente {
    width: 100% !important;
    max-width: none !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }
  body:has(#buscarCliente) #tablaCotizacionesCliente,
  body:has(#buscarCliente) #tablaCotizacionesCliente tbody {
    display: table !important;
    width: 100% !important;
    min-width: 0 !important;
    table-layout: auto !important;
  }
  body:has(#buscarCliente) #tablaCotizacionesCliente thead { display: table-header-group !important; }
  body:has(#buscarCliente) #tablaCotizacionesCliente thead tr,
  body:has(#buscarCliente) #tablaCotizacionesCliente tbody tr { display: table-row !important; }
  body:has(#buscarCliente) #tablaCotizacionesCliente th,
  body:has(#buscarCliente) #tablaCotizacionesCliente td:not(.historial-acciones) {
    display: table-cell !important;
  }
  body:has(#buscarCliente) #tablaCotizacionesCliente th:nth-child(1),
  body:has(#buscarCliente) #tablaCotizacionesCliente td:nth-child(1) { width: 170px !important; }
  body:has(#buscarCliente) #tablaCotizacionesCliente th:nth-child(2),
  body:has(#buscarCliente) #tablaCotizacionesCliente td:nth-child(2) { width: 90px !important; }
  body:has(#buscarCliente) #tablaCotizacionesCliente th:nth-child(3),
  body:has(#buscarCliente) #tablaCotizacionesCliente td:nth-child(3) { width: 190px !important; }
  body:has(#buscarCliente) #tablaCotizacionesCliente th:nth-child(4),
  body:has(#buscarCliente) #tablaCotizacionesCliente td:nth-child(4) { width: 110px !important; }
  body:has(#buscarCliente) #tablaCotizacionesCliente th:nth-child(5),
  body:has(#buscarCliente) #tablaCotizacionesCliente td:nth-child(5) { width: 520px !important; }
}

@media (max-width: 900px) {
  body:has(#buscarCliente) main { width: 100%; padding: 0 10px; }
  body:has(#buscarCliente) main .card { padding: 12px; }
  body:has(#buscarCliente) #cardCotizacionesCliente h3 {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  body:has(#buscarCliente) #cardCotizacionesCliente h3 button {
    width: 100% !important;
    margin: 0 !important;
    border: 0;
    border-radius: 999px;
    background: #e5e5e5;
    color: #111;
    padding: 7px 12px;
  }
  body:has(#buscarCliente) #tablaCotizacionesCliente,
  body:has(#buscarCliente) #tablaCotizacionesCliente tbody,
  body:has(#buscarCliente) #tablaCotizacionesCliente tr,
  body:has(#buscarCliente) #tablaCotizacionesCliente td { display: block !important; width: 100% !important; }
  body:has(#buscarCliente) #tablaCotizacionesCliente thead { display: none !important; }
  body:has(#buscarCliente) #tablaCotizacionesCliente tr {
    display: grid !important;
    grid-template-columns: 1fr !important;
    margin-bottom: 14px;
    padding: 8px 0;
  }
  body:has(#buscarCliente) #tablaCotizacionesCliente td:not(.historial-acciones) {
    display: grid !important;
    grid-template-columns: 92px minmax(0, 1fr) !important;
    gap: 8px !important;
    padding: 7px 10px !important;
    text-align: left !important;
    border: 0 !important;
    overflow-wrap: anywhere;
  }
  body:has(#buscarCliente) #tablaCotizacionesCliente td:nth-child(1)::before { content: 'Número'; }
  body:has(#buscarCliente) #tablaCotizacionesCliente td:nth-child(2)::before { content: 'Fecha'; }
  body:has(#buscarCliente) #tablaCotizacionesCliente td:nth-child(3)::before { content: 'Total'; }
  body:has(#buscarCliente) #tablaCotizacionesCliente td:nth-child(4)::before { content: 'Estado'; }
  body:has(#buscarCliente) #tablaCotizacionesCliente td:not(.historial-acciones)::before {
    font-weight: 700;
    color: var(--azul);
  }
  body:has(#buscarCliente) #tablaCotizacionesCliente td.historial-acciones {
    display: grid !important;
    grid-template-columns: repeat(2, 105px) !important;
    gap: 8px !important;
    padding: 8px 10px !important;
    justify-content: start !important;
    justify-items: stretch;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    overflow: hidden !important;
  }
  body:has(#buscarCliente) #tablaCotizacionesCliente td.historial-acciones > button {
    width: 105px !important;
    min-width: 0 !important;
    max-width: 105px !important;
    margin: 0 !important;
    flex: none !important;
    grid-column: auto !important;
    box-sizing: border-box;
  }
  body:has(#buscarCliente) #tablaCotizacionesCliente td.historial-acciones > .ver-pdf {
    margin: 0 !important;
  }
  body:has(#buscarCliente) #tablaCotizacionesCliente td.historial-acciones > button:nth-child(1) { grid-column: 1 !important; grid-row: 1 !important; }
  body:has(#buscarCliente) #tablaCotizacionesCliente td.historial-acciones > button:nth-child(2) { grid-column: 2 !important; grid-row: 1 !important; }
  body:has(#buscarCliente) #tablaCotizacionesCliente td.historial-acciones > button:nth-child(3) { grid-column: 1 !important; grid-row: 2 !important; }
  body:has(#buscarCliente) #tablaCotizacionesCliente td.historial-acciones > button:nth-child(4) { grid-column: 2 !important; grid-row: 2 !important; }
  body:has(#buscarCliente) #tablaCotizacionesCliente td.historial-acciones > button:nth-child(5) { grid-column: 1 !important; grid-row: 3 !important; }
  body:has(#buscarCliente) #tablaCotizacionesCliente td.historial-acciones > button:nth-child(6) { grid-column: 2 !important; grid-row: 3 !important; }
}

@media (min-width: 901px) and (max-width: 1200px) {
  body:has(#buscarCliente) #tablaCotizacionesCliente thead { display: table-header-group !important; }
  body:has(#buscarCliente) #tablaCotizacionesCliente tr { display: table-row !important; }
  body:has(#buscarCliente) #tablaCotizacionesCliente td,
  body:has(#buscarCliente) #tablaCotizacionesCliente th { display: table-cell !important; }
}

@media (max-width: 460px) {
  .cliente-botones-edicion { flex-wrap: wrap; }
  .cliente-boton { flex: 1 1 110px; width: auto; }
}

/* Respuesta uniforme al cursor y al toque: no altera tamaños ni navegación. */
button:not(:disabled),
.boton-entrar,
.nobar-dashboard-compacto,
.nobar-dashboard-directo,
.nobar-perfil-directo,
.nobar-menu-categoria,
.nobar-submenu a,
.nobar-salir-menu {
  transition: transform 140ms ease, box-shadow 140ms ease, background-color 140ms ease, color 140ms ease;
}

button:not(:disabled):hover,
.boton-entrar:hover,
.nobar-dashboard-compacto:hover,
.nobar-dashboard-directo:hover,
.nobar-perfil-directo:hover,
.nobar-menu-categoria:hover,
.nobar-submenu a:hover,
.nobar-salir-menu:hover {
  transform: translateY(-1px);
}

button:not(:disabled):active,
.boton-entrar:active,
.nobar-dashboard-compacto:active,
.nobar-dashboard-directo:active,
.nobar-perfil-directo:active,
.nobar-menu-categoria:active,
.nobar-submenu a:active,
.nobar-salir-menu:active {
  transform: translateY(2px) scale(0.98);
}

@media (prefers-reduced-motion: reduce) {
  button:not(:disabled),
  .boton-entrar,
  .nobar-dashboard-compacto,
  .nobar-dashboard-directo,
  .nobar-perfil-directo,
  .nobar-menu-categoria,
  .nobar-submenu a,
  .nobar-salir-menu {
    transition: none;
  }
}

/* Usuarios: misma mecánica visual de Clientes, Historial y Accesos. */
.usuarios-busqueda-fila { display:flex; align-items:center; gap:10px; }
.usuarios-busqueda-fila input { flex:1 1 auto; min-width:0; }
.usuarios-buscador-editable { flex:1 1 auto; min-width:0; min-height:42px; padding:10px 12px; border:1px solid var(--borde); border-radius:6px; background:#fff; outline:none; }
.usuarios-buscador-editable:empty::before { content:attr(data-placeholder); color:#888; pointer-events:none; }
.usuarios-buscador-editable:focus { border-color:var(--secundario); box-shadow:0 0 0 2px rgba(26,110,168,.12); }
.usuarios-ayuda { margin:10px 0; color:#666; line-height:1.45; }
.usuarios-filtros { display:flex; gap:10px; margin:10px 0; }
.usuarios-filtros label { display:flex; flex-direction:column; gap:4px; flex:1; }
.usuarios-resumen { margin:10px 0 14px; font-weight:600; }
.lista-usuarios { display:grid; gap:12px; }
.usuario-tarjeta { border:1px solid #c8d0d6; border-radius:12px; padding:16px; display:grid; grid-template-columns:minmax(0,1fr) auto; gap:18px; background:#f7f8f9; }
.usuario-tarjeta.seleccionada { border-color:#1a6ea8; }
.usuario-datos h4 { margin:0 0 10px; font-size:20px; }
.usuario-datos p { margin:4px 0; }
.usuario-estado-inactivo { color:#c62828; font-weight:700; }
.usuarios-acciones { display:grid; grid-template-columns:repeat(2, 120px); gap:6px; align-content:start; justify-content:end; }
.usuarios-accion { box-sizing:border-box; width:120px; min-width:120px; height:40px; min-height:40px; padding:6px 8px; border:0; border-radius:999px; background:#e5e5e5; color:#111; font-size:14px; font-weight:600; white-space:normal; line-height:1.1; }
.usuarios-accion.cliente-boton-eliminar { background:#c62828; color:#fff; border:1px solid #a51f1f; }
#modalUsuario { width:min(560px, calc(100% - 24px)); border:2px solid #111; padding:28px; }
#modalUsuario::backdrop { background:rgba(0,0,0,.45); }
#modalUsuario form { display:flex; flex-direction:column; gap:8px; }
#modalUsuario label { display:flex; flex-direction:column; gap:4px; font-weight:600; }
#modalUsuario .cliente-botones-edicion { display:flex; gap:10px; margin-top:12px; }
#modalUsuario .cliente-boton { flex:1; }
@media (max-width: 1200px) {
  .usuarios-busqueda-fila { flex-wrap:nowrap; }
  .usuarios-busqueda-fila input,
  .usuarios-buscador-editable { flex:1 1 auto; }
}
@media (max-width: 900px) {
  .usuarios-busqueda-fila { flex-wrap:wrap; }
  .usuarios-buscador-editable { flex:1 1 100%; }
  .usuarios-filtros { flex-direction:column; }
  .usuario-tarjeta { grid-template-columns:1fr; gap:12px; }
  .usuarios-acciones { grid-template-columns:repeat(2, 120px); justify-content:start; }
  .usuarios-accion { width:120px; min-width:120px; }
  .usuarios-busqueda-fila .cliente-boton { width:100%; }
  #modalUsuario { padding:20px; }
}
.autocomplete { position: relative; }
.sugerencias {
  position: absolute;
  background: white;
  border: 1px solid var(--borde);
  width: 100%;
  z-index: 10;
  max-height: 180px;
  overflow-y: auto;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
.sugerencias div { padding: 8px 10px; cursor: pointer; font-size: 13px; }
.sugerencias div:hover { background: var(--gris); }
table { width: 100%; border-collapse: collapse; margin-top: 10px; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--borde); font-size: 13px; }
.totales { text-align: right; margin-top: 10px; font-size: 14px; }
.totales strong { font-size: 16px; }
.error { color: #b00020; font-size: 13px; margin-top: 8px; }
.item-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.historial-filtros {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 10px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  margin-bottom: 14px;
}
.historial-filtros label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 0;
  min-width: 0;
  color: #222;
  font-size: 12px;
  font-weight: 600;
}
.historial-filtros .historial-filtro-busqueda { flex: 1 1 0; }
.historial-filtro-busqueda { position: relative; }
.historial-sugerencias {
  position: absolute;
  z-index: 20;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 180px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--borde);
  border-radius: 0 0 6px 6px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, .14);
}
.historial-sugerencias[hidden] { display: none; }
.historial-sugerencias button {
  display: block;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-bottom: 1px solid #eee;
  background: #fff;
  color: #222;
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.historial-sugerencias button:hover { background: var(--gris); }
.historial-filtros input,
.historial-filtros select {
  box-sizing: border-box;
  display: block;
  inline-size: 100%;
  max-inline-size: 100%;
  min-width: 0;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--borde);
  border-radius: 6px;
  background: #fff;
  color: #222;
  font: inherit;
  font-weight: 400;
}
.historial-filtro-limpiar {
  flex: 1 1 0;
  min-width: 0;
  box-sizing: border-box;
  min-height: 38px;
  padding: 8px 14px;
  border: 0;
  border-radius: 999px;
  background: #e5e5e5;
  color: #111;
  white-space: nowrap;
}
.historial-sin-resultados { padding: 20px 8px; text-align: center; color: #666; }
.historial-boton-reservado,
.historial-boton-reservado:disabled {
  opacity: .42;
  cursor: default;
  filter: grayscale(1);
}
@media (min-width: 961px) {
  .historial-filtros { flex-wrap: nowrap; align-items: end; }
  .historial-filtros > label {
    flex: 1 1 0;
    width: 0;
  }
  .historial-filtros input,
  .historial-filtros select {
    height: 46px;
    min-height: 46px;
    font-size: 16px;
  }
  .historial-filtros input[type="date"] {
    padding-inline: 12px;
    font-size: 17px;
  }
  .historial-filtros .historial-filtro-limpiar {
    flex: 0 0 78px;
    width: 78px;
    min-width: 78px;
    height: 46px;
    min-height: 46px;
    padding-inline: 8px;
  }
}
@media (max-width: 600px) {
  body:has(#tablaHistorial) main .card { overflow: hidden; }
  .historial-filtros { align-items: stretch; gap: 8px; }
  .historial-filtros label,
  .historial-filtros .historial-filtro-busqueda,
  .historial-filtro-limpiar { flex: 1 1 100%; min-width: 0; width: 100%; }
  .historial-filtros input,
  .historial-filtros select {
    width: 100%;
    max-width: 100%;
    inline-size: 100%;
    max-inline-size: 100%;
    padding-inline: 8px;
    font-size: 16px;
  }
  .historial-filtros input[type="date"] {
    appearance: none;
    -webkit-appearance: none;
  }
}
@media (min-width: 601px) and (max-width: 1200px) {
  body:has(#tablaHistorial) main .card { overflow: hidden; }
  .historial-filtros { align-items: stretch; gap: 8px; }
  .historial-filtros > label,
  .historial-filtros .historial-filtro-busqueda,
  .historial-filtro-limpiar {
    flex: 1 1 100%;
    min-width: 0;
    width: 100%;
  }
  .historial-filtros input,
  .historial-filtros select {
    width: 100%;
    max-width: 100%;
    inline-size: 100%;
    max-inline-size: 100%;
    font-size: 16px;
  }
}

/* Acciones de Historial: todos los botones comparten el ancho del mayor. */
.historial-acciones-fila > button,
.historial-acciones-fila > a {
  width: 140px;
  min-width: 140px;
  box-sizing: border-box;
  text-align: center;
}
.historial-acciones-fila > a button { width: 100%; box-sizing: border-box; }
.historial-acciones-fila > button,
.historial-acciones-fila > a button { color: #111 !important; }
.historial-acciones-fila > button,
.historial-acciones-fila > a button {
  font-size: clamp(10px, 1vw, 14px);
  line-height: 1.15;
  white-space: normal;
  overflow-wrap: anywhere;
  padding-inline: 4px;
}
@media (min-width: 901px) {
  body:has(#tablaHistorial) #tablaHistorial {
    width: 100%;
  }
  body:has(#tablaHistorial) main .card table {
    overflow: visible;
  }
  body:has(#tablaHistorial) #tablaHistorial td.historial-acciones {
    overflow: visible;
  }
  .historial-acciones {
    display: flex !important;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    align-content: flex-start;
    gap: 10px;
    width: auto;
    min-width: 0;
    overflow: visible;
  }
  .historial-acciones { overflow: visible !important; }
  .historial-acciones > button {
    flex: 0 0 78px;
    width: 78px !important;
    min-width: 78px;
    margin: 0;
    box-sizing: border-box;
    border: 0;
    border-radius: 999px;
    padding: 7px 8px;
    background: #e5e5e5;
    color: #111 !important;
    font-size: clamp(10px, 0.75vw, 13px);
    line-height: 1.2;
    white-space: nowrap;
    overflow: visible;
  }
  .historial-acciones-fila > button,
  .historial-acciones-fila > a {
    flex: 1 1 80px;
    width: auto;
    min-width: 80px;
    padding: 7px 4px;
    font-size: clamp(9px, 0.75vw, 12px);
    white-space: normal;
    overflow: visible;
  }
  .historial-acciones-fila > a { display: block; }
  .historial-acciones-fila > button,
  .historial-acciones-fila > a button {
    width: 100% !important;
    min-width: 0 !important;
    border: 0;
    border-radius: 999px;
    background: #e5e5e5;
    color: #111 !important;
    padding: 6px 4px;
    font-size: clamp(10px, 0.75vw, 13px);
    line-height: 1.2;
    white-space: normal;
    overflow: visible;
    overflow-wrap: anywhere;
    text-overflow: clip;
  }
  .historial-acciones-fila > button { padding: 6px 4px; font-size: clamp(10px, 0.75vw, 13px); }
  .historial-acciones-fila > button {
    width: auto !important;
  }
}
@media (max-width: 960px) {
  body:has(#tablaHistorial) #tablaHistorial td.historial-acciones {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 10px;
  }
  body:has(#tablaHistorial) #tablaHistorial td.historial-acciones::before {
    display: none !important;
  }
  body:has(#tablaHistorial) #tablaHistorial td.historial-acciones > button {
    width: 105px;
    min-width: 105px;
    box-sizing: border-box;
    margin: 0;
    border: 0;
    border-radius: 999px;
    padding: 7px 8px;
    background: #e5e5e5;
    color: #111 !important;
    font-size: 12px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: visible;
  }
  .historial-acciones-fila > button,
  .historial-acciones-fila > a { width: 105px; min-width: 105px; }
}
@media (max-width: 480px) {
  body:has(#tablaHistorial) #tablaHistorial td.historial-acciones > button {
    width: 92px;
    min-width: 92px;
  }
  .historial-acciones-fila > button,
  .historial-acciones-fila > a { width: 92px; min-width: 92px; }
}
.item-form .full { grid-column: 1 / -1; }

/* Pie estándar: ocupa el final real del documento, sin cubrir contenido. */
.nobar-pie-marca {
  position: static;
  margin: 48px 0 24px;
  padding: 18px 24px 0;
  background: transparent;
  color: #222;
  font-size: 13px;
  text-align: center;
}
.nobar-pie-marca a {
  color: inherit;
  position: relative;
  top: -2px;
}
/* Vista compacta única: móvil y escritorio angosto. */
@media (max-width: 760px) {
  header {
    width: calc(100% - 24px);
    margin: 10px 12px 0;
    padding: 10px 14px;
    flex-wrap: nowrap;
    align-items: center;
  }
  .nobar-menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
  }
  .nobar-dashboard-compacto {
    display: inline-flex;
    color: white;
    text-decoration: none;
    font-family: inherit;
    font-size: clamp(13px, 2.2vw, 16px);
    line-height: 1.25;
    white-space: nowrap;
  }
  header nav.nobar-nav-links {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: min(220px, calc(100vw - 24px));
    max-height: min(70vh, 460px);
    overflow-y: auto;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 6px 10px 10px;
    background: var(--nobar-color-menu);
    border-radius: 12px;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.22);
  }
  .panel-admin-page header nav.nobar-nav-links {
    top: calc(100% + 8px);
    right: 0;
    left: auto;
    width: min(280px, calc(100vw - 24px));
    max-height: min(70vh, 460px);
    order: initial;
    overflow-y: auto;
    border-radius: 12px;
  }
  .panel-admin-page header nav.nobar-nav-links.is-open { display: flex; }
  header nav.nobar-nav-links .nobar-dashboard-directo { display: none; }
  .nobar-categorias {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }
  .nobar-dashboard-directo {
    width: 100%;
    padding: 10px 4px;
    text-align: center;
  }
  .nobar-menu-grupo { position: static; width: 100%; }
  .nobar-nav-acciones {
    width: 100%;
    margin-left: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
  }
  .nobar-perfil-directo {
    width: 100%;
    padding: 10px 4px;
    text-align: center;
  }
  .nobar-menu-categoria {
    width: 100%;
    padding: 10px 4px;
    text-align: left;
    border: 0;
    border-radius: 0;
  }
  .nobar-submenu {
    position: static;
    min-width: 0;
    margin: 0;
    padding: 0 0 6px 14px;
    background: var(--nobar-color-menu);
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .nobar-submenu a,
  .nobar-submenu button {
    width: 100%;
    padding: 9px 6px;
    text-align: center;
  }
  header nav.nobar-nav-links.is-open { display: flex; }
  header nav.nobar-nav-links a,
  header nav.nobar-nav-links button {
    width: 100%;
    padding: 10px 4px;
    text-align: left;
    border: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 0;
  }
  header nav.nobar-nav-links .nobar-dashboard-directo,
  header nav.nobar-nav-links .nobar-perfil-directo {
    text-align: center;
    border-bottom: 0;
  }
  header nav.nobar-nav-links .nobar-menu-categoria {
    border-bottom: 0;
  }
  .panel-admin-page header nav.nobar-nav-links .nobar-menu-categoria { text-align: left; }
  .panel-admin-page header nav.nobar-nav-links .nobar-submenu { padding-left: 14px; }
  header > .nobar-salir-menu { display: none; }
  header nav.nobar-nav-links .nobar-salir-movil {
    display: block;
    width: 100%;
    margin: 8px 0 0;
    padding: 10px 4px;
    border: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
  }
  header nav.nobar-nav-links .nobar-salir-menu {
    width: auto;
    min-width: 96px;
    align-self: center;
    margin: 10px 0 0;
    border: 1px solid white;
    border-radius: 6px;
    text-align: center;
  }
  header nav.nobar-nav-links button { text-align: center; }
}

@media (max-width: 760px) {
  main.cotizacion-page { max-width: 100%; padding: 0 12px; }
  .cotizacion-acciones { flex-wrap: wrap; }
  .cotizacion-acciones .cliente-boton { flex: 1 1 140px; min-width: 0; }
  .modo-edicion #btnGuardar { min-width: 0; white-space: normal; }
  .cliente-busqueda-fila { flex-wrap: wrap; }
  .cliente-busqueda-fila .cliente-boton-agregar { flex: 1 1 100%; }
  .cliente-formulario { min-width: 0 !important; width: min(100%, 620px); }
  dialog { max-width: calc(100vw - 24px); }
}

/* Escritorio intermedio: mantiene acciones horizontales y permite dos filas
   únicamente cuando el ancho disponible no alcanza para una sola. */
/* Escritorio amplio: estado 1, los seis botones en una sola fila cuando hay espacio. */
@media (min-width: 1201px) {
  body:has(#tablaHistorial) #tablaHistorial td.historial-acciones {
    display: flex !important;
    flex-wrap: nowrap !important;
    justify-content: flex-end !important;
    align-items: center;
    gap: 10px;
    width: auto;
    min-width: 0;
    overflow: visible;
  }
  body:has(#tablaHistorial) #tablaHistorial td.historial-acciones > button {
    flex: 0 0 78px !important;
    width: 78px !important;
    min-width: 78px !important;
    margin: 0 !important;
  }
}

/* Vista grande: cada cotización queda centrada dentro del contenedor principal. */
@media (min-width: 1201px) and (pointer: fine) {
  body:has(#tablaHistorial) .historial-filtros {
    width: min(1200px, calc(100% - 24px));
    min-width: 0;
    max-width: 1200px;
    margin: 10px auto 14px;
  }
  body:has(#tablaHistorial) #tablaHistorial thead {
    display: block;
    width: 100%;
  }
  body:has(#tablaHistorial) #tablaHistorial thead tr {
    display: grid;
    grid-template-columns: minmax(120px, 1.2fr) minmax(70px, .7fr) minmax(120px, 1.3fr) minmax(80px, .8fr) minmax(70px, .8fr) minmax(520px, 3fr);
    width: min(1200px, calc(100% - 24px));
    min-width: 0;
    margin: 10px auto 0;
    padding: 8px 10px;
    border: 1px solid var(--borde);
    border-radius: 8px;
    box-sizing: border-box;
  }
  body:has(#tablaHistorial) #tablaHistorial thead th {
    display: block;
    width: auto;
    min-width: 0;
    border: 0;
  }
  body:has(#tablaHistorial) #tablaHistorial tbody {
    display: block;
    width: 100%;
  }
  body:has(#tablaHistorial) #tablaHistorial tbody tr {
    display: grid;
    grid-template-columns: minmax(120px, 1.2fr) minmax(70px, .7fr) minmax(120px, 1.3fr) minmax(80px, .8fr) minmax(70px, .8fr) minmax(520px, 3fr);
    width: min(1200px, calc(100% - 24px));
    min-width: 0;
    margin: 10px auto;
    padding: 8px 10px;
    border: 1px solid var(--borde);
    border-radius: 8px;
    box-sizing: border-box;
  }
  body:has(#tablaHistorial) #tablaHistorial tbody td {
    display: block;
    width: auto;
    min-width: 0;
    border: 0;
  }
  body:has(#tablaHistorial) #tablaHistorial tbody td.historial-acciones {
    display: flex !important;
    flex-wrap: nowrap !important;
    justify-content: flex-end !important;
    align-items: center;
    gap: 10px;
    width: auto;
    min-width: 0;
    padding: 7px 0;
  }
  body:has(#tablaHistorial) #tablaHistorial tbody td.historial-acciones > button {
    flex: 0 0 78px !important;
    width: 78px !important;
    min-width: 78px !important;
    max-width: 78px !important;
    margin: 0 !important;
  }
}

/* Escritorio intermedio: seis acciones en dos filas de tres. */
@media (min-width: 901px) and (max-width: 1200px) {
  body:has(#tablaHistorial) #tablaHistorial td.historial-acciones {
    display: grid !important;
    grid-template-columns: repeat(3, 78px);
    grid-auto-rows: 32px;
    justify-content: end !important;
    align-items: center;
    align-content: center;
    gap: 10px;
    min-width: 0;
    overflow: visible;
  }
  body:has(#tablaHistorial) #tablaHistorial td.historial-acciones > button {
    flex: none !important;
    width: 78px !important;
    min-width: 78px !important;
    max-width: 78px !important;
    margin: 0;
  }
}

@media (max-width: 480px) {
  main { width: 100%; padding: 0 10px; }
  .card { padding: 12px; }
  .cliente-botones-edicion { flex-wrap: wrap; }
  .cliente-botones-edicion .cliente-boton { flex: 1 1 100%; width: 100%; }
  .pestana { padding: 8px 10px; font-size: 12px; }
  input, select, textarea { font-size: 16px; }
}

@media (min-width: 481px) and (max-width: 900px) {
  .tarjetas { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Historial: en móvil/tablet cada cotización se lee verticalmente. */
@media (max-width: 1200px) {
  body:has(#tablaHistorial) main .card table {
    display: block;
    min-width: 0;
    overflow: visible;
  }
  body:has(#tablaHistorial) #tablaHistorial thead { display: none; }
  body:has(#tablaHistorial) #tablaHistorial,
  body:has(#tablaHistorial) #tablaHistorial tbody,
  body:has(#tablaHistorial) #tablaHistorial tr,
  body:has(#tablaHistorial) #tablaHistorial td { display: block; width: 100%; }
  body:has(#tablaHistorial) #tablaHistorial tr {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 14px;
    padding: 8px 0;
    border: 1px solid var(--borde);
    border-radius: 8px;
  }
  body:has(#tablaHistorial) #tablaHistorial td {
    display: grid;
    grid-template-columns: minmax(92px, 34%) 1fr;
    gap: 8px;
    padding: 7px 10px;
    border: 0;
    overflow-wrap: anywhere;
  }
  body:has(#tablaHistorial) #tablaHistorial td:nth-child(-n+5) { grid-column: 1 / -1; }
  /* Acciones: tres controles en la fila superior y dos en la inferior. */
  body:has(#tablaHistorial) #tablaHistorial td:nth-child(6) { grid-column: span 2; }
  body:has(#tablaHistorial) #tablaHistorial td:nth-child(7),
  body:has(#tablaHistorial) #tablaHistorial td:nth-child(8),
  body:has(#tablaHistorial) #tablaHistorial td:nth-child(9) { grid-column: span 1; }
  body:has(#tablaHistorial) #tablaHistorial td::before {
    font-weight: 700;
    color: var(--azul);
  }
  body:has(#tablaHistorial) #tablaHistorial td:nth-child(1)::before { content: 'Número'; }
  body:has(#tablaHistorial) #tablaHistorial td:nth-child(2)::before { content: 'Fecha'; }
  body:has(#tablaHistorial) #tablaHistorial td:nth-child(3)::before { content: 'Cliente'; }
  body:has(#tablaHistorial) #tablaHistorial td:nth-child(4)::before { content: 'Total'; }
  body:has(#tablaHistorial) #tablaHistorial td:nth-child(5)::before { content: 'Estado'; }
  body:has(#tablaHistorial) #tablaHistorial td:nth-child(n+6)::before { content: ''; }
  body:has(#tablaHistorial) #tablaHistorial td:nth-child(n+6) { display: block; text-align: center; }
  body:has(#tablaHistorial) #tablaHistorial td:nth-child(6) {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
  }
  body:has(#tablaHistorial) #tablaHistorial td:nth-child(n+6) button,
  body:has(#tablaHistorial) #tablaHistorial td:nth-child(n+6) a { margin: 3px; }
  body:has(#tablaHistorial) #tablaHistorial td:nth-child(n+6) button,
  body:has(#tablaHistorial) #tablaHistorial td:nth-child(n+6) a { white-space: nowrap; }
  body:has(#tablaHistorial) #tablaHistorial td:nth-child(n+6) { text-align: left; }
  body:has(#tablaHistorial) #tablaHistorial td:nth-child(n+6) { justify-content: flex-start; align-items: flex-start; }
  body:has(#tablaHistorial) #tablaHistorial td:nth-child(n+6) button,
  body:has(#tablaHistorial) #tablaHistorial td:nth-child(n+6) a { margin-left: 0; }
  /* Las cinco acciones forman una sola cuadrícula: tres arriba y dos abajo. */
  body:has(#tablaHistorial) #tablaHistorial td:nth-child(6) { grid-column: 1 / 3; display: flex; justify-content: flex-start; }
  body:has(#tablaHistorial) #tablaHistorial td:nth-child(7) { grid-column: 3; display: block; }
  body:has(#tablaHistorial) #tablaHistorial td:nth-child(8) { grid-column: 1; display: block; }
  body:has(#tablaHistorial) #tablaHistorial td:nth-child(9) { grid-column: 2; display: block; }
  body:has(#tablaHistorial) #tablaHistorial td.historial-acciones {
    grid-column: 1 / -1;
    display: grid !important;
    grid-template-columns: repeat(2, 105px);
    justify-content: start !important;
    align-items: start;
    gap: 10px;
  }
  body:has(#tablaHistorial) #tablaHistorial td.historial-acciones > button {
    width: 105px !important;
    min-width: 105px !important;
    max-width: 105px !important;
    box-sizing: border-box;
    margin: 0 !important;
    justify-self: start;
  }
  body:has(#tablaHistorial) #tablaHistorial .historial-acciones-fila {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    width: 100%;
  }
}

/* Escritorio intermedio: tabla legible y acciones en dos filas, sin forzarla a móvil. */
@media (min-width: 901px) and (max-width: 1200px) and (pointer: fine) {
  body:has(#tablaHistorial) main .card table {
    display: table;
    min-width: 1080px;
    overflow-x: auto;
  }
body:has(#tablaHistorial) #tablaHistorial thead { display: table-header-group; }
  body:has(#tablaHistorial) #tablaHistorial,
  body:has(#tablaHistorial) #tablaHistorial tbody { display: table; width: 100%; }
  body:has(#tablaHistorial) #tablaHistorial {
    width: 1080px;
    min-width: 1080px;
    table-layout: auto;
  }
  body:has(#tablaHistorial) #tablaHistorial th:nth-child(1),
  body:has(#tablaHistorial) #tablaHistorial td:nth-child(1) { width: 170px; }
  body:has(#tablaHistorial) #tablaHistorial th:nth-child(2),
  body:has(#tablaHistorial) #tablaHistorial td:nth-child(2) { width: 90px; }
  body:has(#tablaHistorial) #tablaHistorial th:nth-child(3),
  body:has(#tablaHistorial) #tablaHistorial td:nth-child(3) { width: 190px; }
  body:has(#tablaHistorial) #tablaHistorial th:nth-child(4),
  body:has(#tablaHistorial) #tablaHistorial td:nth-child(4) { width: 110px; }
  body:has(#tablaHistorial) #tablaHistorial th:nth-child(5),
  body:has(#tablaHistorial) #tablaHistorial td:nth-child(5) { width: 100px; }
  body:has(#tablaHistorial) #tablaHistorial th:nth-child(6),
  body:has(#tablaHistorial) #tablaHistorial td:nth-child(6) { width: 420px; }
  body:has(#tablaHistorial) #tablaHistorial {
    width: 1080px;
    table-layout: auto;
  }
  body:has(#tablaHistorial) #tablaHistorial th:nth-child(1),
  body:has(#tablaHistorial) #tablaHistorial td:nth-child(1) { width: 170px; }
  body:has(#tablaHistorial) #tablaHistorial th:nth-child(2),
  body:has(#tablaHistorial) #tablaHistorial td:nth-child(2) { width: 90px; }
  body:has(#tablaHistorial) #tablaHistorial th:nth-child(3),
  body:has(#tablaHistorial) #tablaHistorial td:nth-child(3) { width: 190px; }
  body:has(#tablaHistorial) #tablaHistorial th:nth-child(4),
  body:has(#tablaHistorial) #tablaHistorial td:nth-child(4) { width: 110px; }
  body:has(#tablaHistorial) #tablaHistorial th:nth-child(5),
  body:has(#tablaHistorial) #tablaHistorial td:nth-child(5) { width: 100px; }
  body:has(#tablaHistorial) #tablaHistorial th:nth-child(6),
  body:has(#tablaHistorial) #tablaHistorial td:nth-child(6) { width: 420px; }
  body:has(#tablaHistorial) #tablaHistorial tr { display: table-row; }
  body:has(#tablaHistorial) #tablaHistorial td { display: table-cell; width: auto; }
  body:has(#tablaHistorial) #tablaHistorial td.historial-acciones {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: flex-start !important;
    align-items: center;
    gap: 10px;
    width: 300px;
    min-width: 300px;
    overflow: visible;
  }
  body:has(#tablaHistorial) #tablaHistorial td.historial-acciones > button {
    width: 78px !important;
    min-width: 78px !important;
    max-width: 78px !important;
    margin: 0 !important;
  }
  .historial-filtros { flex-wrap: nowrap; align-items: end; }
  .historial-filtros > label { flex: 1 1 0; width: 0; }
  .historial-filtros input,
  .historial-filtros select { width: 100%; min-width: 0; }
  .historial-filtros .historial-filtro-limpiar {
    flex: 0 0 78px;
    width: 78px;
    min-width: 78px;
  }
}

@media (max-width: 600px) {
  .nobar-pie-marca {
    margin: 48px 0 calc(56px + env(safe-area-inset-bottom));
    padding: 18px 24px 0;
  }
}

/* Corrección final: escritorio intermedio no usa la estructura de tarjetas móvil. */
@media (min-width: 901px) and (max-width: 1200px) and (pointer: fine) {
  body:has(#tablaHistorial) .historial-filtros {
    flex-wrap: nowrap;
    align-items: end;
  }
  body:has(#tablaHistorial) .historial-filtros > label { flex: 1 1 0; width: 0; }
  body:has(#tablaHistorial) .historial-filtros input,
  body:has(#tablaHistorial) .historial-filtros select { width: 100%; min-width: 0; }
  body:has(#tablaHistorial) .historial-filtros .historial-filtro-limpiar {
    flex: 0 0 78px;
    width: 78px;
    min-width: 78px;
  }
  body:has(#tablaHistorial) main .card table {
    display: table;
    width: 100%;
    min-width: 1080px;
    overflow-x: auto;
  }
  body:has(#tablaHistorial) #tablaHistorial,
  body:has(#tablaHistorial) #tablaHistorial tbody { display: table; width: 100%; }
  body:has(#tablaHistorial) #tablaHistorial thead { display: table-header-group; }
  body:has(#tablaHistorial) #tablaHistorial tr { display: table-row; }
  body:has(#tablaHistorial) #tablaHistorial td,
  body:has(#tablaHistorial) #tablaHistorial th { display: table-cell; width: auto; }
  body:has(#tablaHistorial) #tablaHistorial td:not(.historial-acciones) {
    overflow-wrap: normal;
    word-break: normal;
  }
  body:has(#tablaHistorial) #tablaHistorial td:nth-child(1),
  body:has(#tablaHistorial) #tablaHistorial th:nth-child(1) { width: 170px !important; min-width: 170px !important; }
  body:has(#tablaHistorial) #tablaHistorial td:nth-child(2),
  body:has(#tablaHistorial) #tablaHistorial th:nth-child(2) { width: 90px !important; min-width: 90px !important; }
  body:has(#tablaHistorial) #tablaHistorial td:nth-child(3),
  body:has(#tablaHistorial) #tablaHistorial th:nth-child(3) { width: 190px !important; min-width: 190px !important; }
  body:has(#tablaHistorial) #tablaHistorial td:nth-child(4),
  body:has(#tablaHistorial) #tablaHistorial th:nth-child(4) { width: 110px !important; min-width: 110px !important; }
  body:has(#tablaHistorial) #tablaHistorial td:nth-child(5),
  body:has(#tablaHistorial) #tablaHistorial th:nth-child(5) { width: 100px !important; min-width: 100px !important; }
  body:has(#tablaHistorial) #tablaHistorial td:nth-child(6),
  body:has(#tablaHistorial) #tablaHistorial th:nth-child(6) { width: 420px !important; min-width: 420px !important; }
  body:has(#tablaHistorial) #tablaHistorial td::before { display: none !important; content: none !important; }
  body:has(#tablaHistorial) #tablaHistorial td.historial-acciones {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: flex-start !important;
    align-items: center;
    align-content: center;
    gap: 10px;
    width: 300px !important;
    min-width: 300px !important;
    max-width: 300px !important;
    padding: 7px 10px;
    overflow: visible;
  }
  body:has(#tablaHistorial) #tablaHistorial td.historial-acciones > button {
    flex: 0 0 78px !important;
    width: 78px !important;
    min-width: 78px !important;
    max-width: 78px !important;
    margin: 0 !important;
  }
  body:has(#tablaHistorial) #tablaHistorial {
    width: 1080px !important;
    min-width: 1080px !important;
    max-width: 1080px !important;
  }
  body:has(#tablaHistorial) #tablaHistorial tbody,
  body:has(#tablaHistorial) #tablaHistorial tr,
  body:has(#tablaHistorial) #tablaHistorial thead {
    width: 1080px !important;
    min-width: 1080px !important;
    max-width: 1080px !important;
  }
  body:has(#tablaHistorial) #tablaHistorial {
    display: block !important;
    width: 960px !important;
    min-width: 960px !important;
    max-width: 960px !important;
    overflow: visible;
  }
  body:has(#tablaHistorial) #tablaHistorial thead,
  body:has(#tablaHistorial) #tablaHistorial tbody { display: block !important; width: 960px !important; }
  body:has(#tablaHistorial) #tablaHistorial thead tr,
  body:has(#tablaHistorial) #tablaHistorial tbody tr {
    display: grid !important;
    grid-template-columns: 170px 90px 190px 110px 100px 300px;
    width: 960px !important;
    min-width: 960px !important;
    max-width: 960px !important;
  }
  body:has(#tablaHistorial) #tablaHistorial thead th,
  body:has(#tablaHistorial) #tablaHistorial tbody td {
    display: block !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
  }
  body:has(#tablaHistorial) #tablaHistorial td.historial-acciones {
    grid-column: 6 !important;
    width: 300px !important;
    min-width: 300px !important;
    max-width: 300px !important;
  }
  body:has(#tablaHistorial) #tablaHistorial thead th:nth-child(6) {
    grid-column: 6 !important;
    width: 300px !important;
    min-width: 300px !important;
  }
  body:has(#tablaHistorial) #tablaHistorial tbody td:nth-child(1) { grid-column: 1 !important; }
  body:has(#tablaHistorial) #tablaHistorial tbody td:nth-child(2) { grid-column: 2 !important; }
  body:has(#tablaHistorial) #tablaHistorial tbody td:nth-child(3) { grid-column: 3 !important; }
  body:has(#tablaHistorial) #tablaHistorial tbody td:nth-child(4) { grid-column: 4 !important; }
  body:has(#tablaHistorial) #tablaHistorial tbody td:nth-child(5) { grid-column: 5 !important; }
  body:has(#tablaHistorial) main .card { overflow: visible; }
  body:has(#tablaHistorial) main .card table,
  body:has(#tablaHistorial) #tablaHistorial,
  body:has(#tablaHistorial) #tablaHistorial thead,
  body:has(#tablaHistorial) #tablaHistorial tbody,
  body:has(#tablaHistorial) #tablaHistorial tr {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }
  body:has(#tablaHistorial) #tablaHistorial thead tr,
  body:has(#tablaHistorial) #tablaHistorial tbody tr {
    grid-template-columns: minmax(0, 1.3fr) minmax(0, .8fr) minmax(0, 1.3fr) minmax(0, .9fr) minmax(0, .9fr) 300px;
  }
  body:has(#tablaHistorial) #tablaHistorial td:not(.historial-acciones),
  body:has(#tablaHistorial) #tablaHistorial th {
    width: auto !important;
    min-width: 0 !important;
    overflow-wrap: anywhere;
    word-break: normal;
  }
  body:has(#tablaHistorial) #tablaHistorial tbody td:nth-child(-n+5),
  body:has(#tablaHistorial) #tablaHistorial thead th:nth-child(-n+5) {
    width: auto !important;
    min-width: 0 !important;
  }
  body:has(#tablaHistorial) #tablaHistorial thead tr,
  body:has(#tablaHistorial) #tablaHistorial tbody tr {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }
  body:has(#tablaHistorial) #tablaHistorial tbody tr {
    border-top: 1px solid var(--borde);
    border-bottom: 1px solid var(--borde);
  }
  body:has(#tablaHistorial) #tablaHistorial thead tr,
  body:has(#tablaHistorial) #tablaHistorial thead th {
    border-bottom: 0;
  }
  body:has(#tablaHistorial) #tablaHistorial thead tr { border-bottom: 1px solid var(--borde); }
}

/* Override final de Clientes: mismos tres estados que Historial. */
body:has(#btnEditarCliente:not([hidden])) .cliente-busqueda-fila { flex-wrap: nowrap !important; }
body:has(#btnEditarCliente:not([hidden])) .cliente-busqueda-fila input { flex: 1 1 auto !important; width: auto !important; }
body:has(#btnEditarCliente:not([hidden])) .cliente-busqueda-fila .cliente-boton-agregar,
body:has(#btnEditarCliente:not([hidden])) .cliente-busqueda-fila #btnEditarCliente { flex: 0 0 auto !important; width: auto !important; min-width: 0 !important; }
body:has(#btnVacioCliente:not([hidden])) .cliente-busqueda-fila { flex-wrap: nowrap !important; }
body:has(#btnVacioCliente:not([hidden])) .cliente-busqueda-fila input { flex: 1 1 auto !important; width: auto !important; min-width: 0 !important; }
body:has(#btnVacioCliente:not([hidden])) .cliente-busqueda-fila #btnVacioCliente { flex: 0 0 auto !important; width: auto !important; min-width: 0 !important; }
@media (max-width: 900px) {
  body:has(#btnVacioCliente) #btnVacioCliente {
    flex: 1 1 100%;
    width: 100%;
    margin-left: 0;
  }
  body:has(#btnEditarCliente:not([hidden])) .cliente-busqueda-fila { flex-wrap: wrap !important; }
  body:has(#btnEditarCliente:not([hidden])) .cliente-busqueda-fila input { flex: 1 1 100% !important; width: 100% !important; }
  body:has(#btnEditarCliente:not([hidden])) .cliente-busqueda-fila .cliente-boton-agregar,
  body:has(#btnEditarCliente:not([hidden])) .cliente-busqueda-fila #btnEditarCliente { flex: 1 1 calc(50% - 5px) !important; width: calc(50% - 5px) !important; }
}
body:has(#buscarCliente) #tablaHistorial tbody tr[hidden] { display: none !important; }
body:has(#buscarCliente) #cardCotizacionesCliente { width: 100% !important; max-width: none !important; }
@media (min-width: 901px) {
  body:has(#buscarCliente) #tablaCotizacionesCliente,
  body:has(#buscarCliente) #tablaCotizacionesCliente tbody { display: table !important; width: 100% !important; min-width: 0 !important; table-layout: fixed !important; }
  body:has(#buscarCliente) #tablaCotizacionesCliente thead { display: table-header-group !important; }
  body:has(#buscarCliente) #tablaCotizacionesCliente thead tr,
  body:has(#buscarCliente) #tablaCotizacionesCliente tbody tr { display: table-row !important; }
  body:has(#buscarCliente) #tablaCotizacionesCliente th,
  body:has(#buscarCliente) #tablaCotizacionesCliente td:not(.historial-acciones) { display: table-cell !important; }
  body:has(#buscarCliente) #tablaCotizacionesCliente td.historial-acciones { display: flex !important; flex-wrap: nowrap !important; width: auto !important; min-width: 0 !important; }
  body:has(#buscarCliente) #tablaCotizacionesCliente td.historial-acciones > button { width: 78px !important; min-width: 78px !important; max-width: 78px !important; margin: 0 !important; }
}
@media (max-width: 900px) {
  body:has(#buscarCliente) #tablaCotizacionesCliente,
  body:has(#buscarCliente) #tablaCotizacionesCliente tbody,
  body:has(#buscarCliente) #tablaCotizacionesCliente tr,
  body:has(#buscarCliente) #tablaCotizacionesCliente td { display: block !important; width: 100% !important; min-width: 0 !important; max-width: 100% !important; }
  body:has(#buscarCliente) #tablaCotizacionesCliente thead { display: none !important; }
  body:has(#buscarCliente) #tablaCotizacionesCliente tr { display: grid !important; grid-template-columns: 1fr !important; }
  body:has(#buscarCliente) #tablaCotizacionesCliente td:not(.historial-acciones) { display: grid !important; grid-template-columns: 92px minmax(0, 1fr) !important; gap: 8px !important; }
  body:has(#buscarCliente) #tablaCotizacionesCliente td.historial-acciones { display: grid !important; grid-template-columns: repeat(2, 105px) !important; justify-content: start !important; gap: 8px !important; overflow: hidden !important; }
  body:has(#buscarCliente) #tablaCotizacionesCliente td.historial-acciones > button { width: 105px !important; min-width: 105px !important; max-width: 105px !important; margin: 0 !important; }
}
.flow-tools{box-sizing:border-box;width:calc(100% - 32px);max-width:1180px;margin:32px auto;padding:32px}.flow-tabs{display:flex;flex-wrap:wrap;gap:10px;margin:20px 0}.flow-tabs button{border-radius:22px;padding:10px 18px}.flow-panel{border:1px solid #d7dce2;border-radius:14px;padding:24px;margin-top:20px}.flow-panel form{display:grid;gap:12px;margin:16px 0}.flow-panel input,.flow-panel select,.flow-panel textarea{width:100%;box-sizing:border-box}.flow-list{display:grid;gap:10px;margin-top:18px}.flow-list-item{display:flex;align-items:center;justify-content:space-between;gap:14px;border:1px solid #d7dce2;border-radius:12px;padding:14px}.button-link{display:inline-block;text-decoration:none;padding:12px 18px;border-radius:10px}@media(max-width:760px){.flow-tools{margin:16px auto;padding:18px}.flow-tabs{display:grid;grid-template-columns:1fr 1fr}.flow-tabs button{width:100%;min-height:48px}.flow-panel{padding:16px}.flow-list-item{align-items:flex-start;flex-direction:column}}
.flow-history{margin-top:24px;padding-top:16px;border-top:1px solid #d5dbe3}
.nobar-busqueda-global{width:150px;min-height:38px;margin:0;border-radius:10px;border:1px solid rgba(255,255,255,.65);background:#fff;color:#111;padding:0 12px}@media(max-width:760px){.nobar-busqueda-global{width:100%;order:-1}}

/* Estilo global de acciones: blanco por defecto y negro al pasar el mouse. */
main button:not(.toggle-password):not(:disabled),
dialog button:not(:disabled),
.cliente-boton:not(:disabled),
.usuarios-accion:not(:disabled),
.flow-tabs button:not(:disabled),
.button-link {
  background: #fff !important;
  color: #111 !important;
  border-color: #111 !important;
  transition: background-color 120ms ease, color 120ms ease, border-color 120ms ease, transform 120ms ease;
}

main button:not(.toggle-password):not(:disabled):hover,
dialog button:not(:disabled):hover,
.cliente-boton:not(:disabled):hover,
.usuarios-accion:not(:disabled):hover,
.flow-tabs button:not(:disabled):hover,
.button-link:hover {
  background: #111 !important;
  color: #fff !important;
  border-color: #111 !important;
}

/* Eliminar/Quitar conserva siempre la semántica roja. */
#tablaUsuariosGlobal tbody tr td.panel-admin-acciones > button.cliente-boton-cancelar:not(.nobar-btn-desactivar) {
  background: #fff !important;
  color: #222 !important;
  border: 1px solid #8a8a8a !important;
}

main button.nobar-btn-eliminar:not(:disabled),
main button.cliente-boton-eliminar:not(:disabled),
main button.quitar:not(:disabled),
dialog button.nobar-btn-eliminar:not(:disabled),
button.nobar-btn-eliminar:not(:disabled) {
  background: #c62828 !important;
  color: #fff !important;
  border-color: #a51f1f !important;
}

main button.nobar-btn-eliminar:not(:disabled):hover,
main button.cliente-boton-eliminar:not(:disabled):hover,
main button.quitar:not(:disabled):hover,
dialog button.nobar-btn-eliminar:not(:disabled):hover,
button.nobar-btn-eliminar:not(:disabled):hover {
  background: #a51f1f !important;
  color: #fff !important;
  border-color: #851818 !important;
}

/* Patrón común reutilizable del Panel Admin. Las páginas se migran a estas clases de forma gradual. */
:root {
  --panel-admin-borde: #c8d0d6;
  --panel-admin-borde-boton: #8a8a8a;
  --panel-admin-radio: 10px;
  --panel-admin-espacio: 16px;
}
.panel-contenedor,
.panel-subcontenedor {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  background: #fff;
  border: 1px solid var(--panel-admin-borde);
  border-radius: var(--panel-admin-radio);
}
.panel-contenedor { padding: var(--panel-admin-espacio); }
.panel-subcontenedor { padding: var(--panel-admin-espacio); }
.panel-tabla { width: 100%; max-width: 100%; min-width: 0; border: 1px solid var(--panel-admin-borde); border-radius: var(--panel-admin-radio); border-collapse: separate; border-spacing: 0; overflow: hidden; }
.panel-acciones { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; justify-items: center; align-items: start; min-width: 0; }
.panel-acciones > button { width: 100%; min-width: 0; margin: 0; border: 1px solid var(--panel-admin-borde-boton); border-radius: 999px; white-space: nowrap; }
.panel-buscador { position: relative; width: 100%; min-width: 0; }
.panel-buscador input[type="search"] { width: 100%; min-width: 0; padding-right: 42px; box-sizing: border-box; }
.panel-buscador input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.panel-buscador .panel-buscador-limpiar { display: none; position: absolute; right: 8px; top: auto; bottom: 2px; transform: none; width: 30px; min-width: 30px; height: 30px; min-height: 30px; margin: 0; padding: 0; border: 0; background: transparent; color: #555; font-size: 24px; line-height: 1; }
.panel-buscador .panel-buscador-limpiar:not([hidden]) { display: block; }

/* Usuarios globales: mismo patrón de búsqueda, contenedores y acciones del Panel Admin. */
.usuarios-panel { display: grid; gap: 16px; }
.usuarios-panel .usuarios-encabezado,
.usuarios-panel .usuarios-operacion,
.usuarios-panel .usuarios-roles { width: 100%; box-sizing: border-box; }
.usuarios-operacion .usuarios-encabezado { padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px solid var(--panel-admin-borde, #c8d0d6); }
.usuarios-operacion .usuarios-encabezado h2 { margin-top: 0; }
.usuarios-busqueda-fila > .cliente-boton { border: 1px solid var(--panel-admin-borde-boton, #8a8a8a) !important; border-radius: 999px; }
.usuarios-filtro-principal { display: grid; gap: 6px; margin-bottom: 14px; }
.usuarios-busqueda-fila { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: end; gap: 10px; }
.usuarios-busqueda-fila .panel-buscador { min-width: 0; }
.usuarios-busqueda-fila > button { min-height: 42px; white-space: nowrap; }
@media (min-width: 961px) {
  .usuarios-busqueda-fila > .panel-buscador { transform: translateY(-6px); }
}
.usuarios-tabla-subcontenedor { width: 100%; overflow: hidden; border: 1px solid var(--panel-admin-borde, #c8d0d6); border-radius: 10px; }
.usuarios-tabla-subcontenedor[hidden] { display: none; }
.usuarios-tabla-subcontenedor table { width: 100%; margin: 0; border: 0; }
@media (min-width: 961px) {
  .usuarios-tabla-subcontenedor #tablaUsuariosGlobal { table-layout: fixed; }
  .usuarios-tabla-subcontenedor #tablaUsuariosGlobal { display: table; }
  .usuarios-tabla-subcontenedor #tablaUsuariosGlobal th:last-child,
  .usuarios-tabla-subcontenedor #tablaUsuariosGlobal td:last-child { width: 300px; }
  .usuarios-tabla-subcontenedor #tablaUsuariosGlobal tbody,
  .usuarios-tabla-subcontenedor #tablaUsuariosGlobal tbody tr { width: 100%; }
  .usuarios-tabla-subcontenedor #tablaUsuariosGlobal tbody { display: table-row-group; }
  .usuarios-tabla-subcontenedor #tablaUsuariosGlobal tbody tr { display: table-row; }
  .usuarios-tabla-subcontenedor #tablaUsuariosGlobal tbody td { display: table-cell; width: auto; overflow-wrap: anywhere; vertical-align: top; }
  .usuarios-tabla-subcontenedor #tablaUsuariosGlobal th:nth-child(1),
  .usuarios-tabla-subcontenedor #tablaUsuariosGlobal td:nth-child(1) { width: 90px; }
  .usuarios-tabla-subcontenedor #tablaUsuariosGlobal th:nth-child(2),
  .usuarios-tabla-subcontenedor #tablaUsuariosGlobal td:nth-child(2) { width: 170px; }
  .usuarios-tabla-subcontenedor #tablaUsuariosGlobal th:nth-child(3),
  .usuarios-tabla-subcontenedor #tablaUsuariosGlobal td:nth-child(3) { width: 145px; }
  .usuarios-tabla-subcontenedor #tablaUsuariosGlobal th:nth-child(4),
  .usuarios-tabla-subcontenedor #tablaUsuariosGlobal td:nth-child(4) { width: 65px; }
  .usuarios-tabla-subcontenedor #tablaUsuariosGlobal th:nth-child(5),
  .usuarios-tabla-subcontenedor #tablaUsuariosGlobal td:nth-child(5) { width: 70px; }
  .usuarios-tabla-subcontenedor #tablaUsuariosGlobal tbody td.panel-admin-acciones { display: grid; }
  .usuarios-tabla-subcontenedor #tablaUsuariosGlobal td.panel-admin-acciones { justify-content: end; }
}
.panel-sugerencias { position: absolute; z-index: 5; left: 0; right: 0; top: 100%; background: #fff; border: 1px solid var(--panel-admin-borde, #c8d0d6); border-radius: 0 0 8px 8px; box-shadow: 0 4px 10px rgba(0,0,0,.12); }
.panel-sugerencias[hidden] { display: none; }
.panel-sugerencias [hidden] { display: none !important; }
.panel-sugerencias div { display: block; width: 100%; box-sizing: border-box; padding: 8px 10px; border: 0; background: #fff; text-align: left; font: inherit; font-size: 13px; cursor: pointer; }
.panel-sugerencias div:hover { background: #f0f0f0; }
.seguridad-page .seguridad-buscador { position: relative; }
.licencias-page .panel-sugerencias button,
.licencias-page .panel-sugerencias button:focus,
.licencias-page .panel-sugerencias button:active { box-sizing: border-box; min-width: 0; min-height: 40px; border: 0 !important; border-radius: 0 !important; background: #fff !important; color: #222 !important; box-shadow: none !important; transform: none !important; }
.licencias-page .panel-sugerencias button:hover { background: #f0f0f0 !important; color: #222 !important; }
.usuarios-roles > .cliente-boton { margin-bottom: 12px; }
.usuarios-roles #rolesGlobales .cliente-boton { border: 1px solid var(--panel-admin-borde-boton, #8a8a8a) !important; border-radius: 999px; }
.rol-permisos-categoria { border: 1px solid var(--panel-admin-borde, #c8d0d6); border-radius: 8px; margin: 8px 0; background: #fff; }
.rol-permisos-categoria summary { cursor: pointer; padding: 10px 12px; font-weight: 700; }
.rol-permisos-lista { display: grid; gap: 6px; padding: 0 12px 10px; }
#rolGlobalDialog { width: min(560px, calc(100vw - 32px)); max-width: calc(100vw - 32px); padding: 24px; }
#rolGlobalDialog form { display: grid; gap: 14px; }
#rolGlobalDialog fieldset { margin: 0; padding: 12px; }
#rolGlobalDialog .rol-permisos-lista .rol-permiso-item { display: flex !important; align-items: center; justify-content: flex-start !important; gap: 8px; width: 100%; min-height: 30px; margin: 0; font-weight: 400; text-align: left; }
#rolGlobalDialog .rol-permiso-item input[type="checkbox"] { flex: 0 0 16px; width: 16px; height: 16px; margin: 0; }
.rol-dialog-acciones { display: flex; justify-content: flex-end; gap: 10px; padding-top: 12px; border-top: 1px solid var(--panel-admin-borde, #c8d0d6); }
.rol-dialog-acciones button { min-width: 110px; margin: 0; padding: 10px 18px; border: 1px solid #111 !important; border-radius: 999px; }
@media (max-width: 960px) {
  #rolGlobalDialog { width: calc(100vw - 24px); max-width: calc(100vw - 24px); padding: 16px; }
  #rolGlobalDialog fieldset { padding: 10px; }
  .rol-permisos-lista { gap: 3px; padding: 0 8px 8px; }
  .rol-dialog-acciones { gap: 8px; }
  .rol-dialog-acciones button { flex: 1; min-width: 0; }
}

@media (max-width: 960px) {
  .usuarios-busqueda-fila { grid-template-columns: 1fr 1fr; align-items: stretch; }
  .usuarios-busqueda-fila .panel-buscador { grid-column: 1 / -1; }
  .usuarios-busqueda-fila > button { width: 100%; min-width: 0; white-space: normal; }
  .usuarios-busqueda-fila > button { align-self: start; }
  .usuarios-busqueda-fila > #crearUsuarioGlobal { margin-top: 0; }
  .usuarios-busqueda-fila > #crearAdministradorGlobal { margin-top: 0; }
  .usuarios-busqueda-fila > #crearUsuarioGlobal,
  .usuarios-busqueda-fila > #crearAdministradorGlobal { transform: translateY(12px); }
  #buscarUsuarioGlobal + #crearUsuarioGlobal,
  #crearUsuarioGlobal + #crearAdministradorGlobal { margin-top: 0; }
  .usuarios-tabla-subcontenedor { overflow: visible; border: 0; }
  #tablaUsuariosGlobal, #tablaUsuariosGlobal tbody, #tablaUsuariosGlobal tr, #tablaUsuariosGlobal td { display: block; width: 100%; box-sizing: border-box; }
  #tablaUsuariosGlobal thead { display: none; }
  #tablaUsuariosGlobal tbody { display: grid; gap: 12px; }
  #tablaUsuariosGlobal tbody tr { border: 1px solid var(--panel-admin-borde, #c8d0d6); border-radius: 10px; padding: 10px; background: #fff; }
  #tablaUsuariosGlobal tbody td { display: grid; grid-template-columns: minmax(90px, 34%) minmax(0, 1fr); gap: 8px; border: 0; padding: 8px 4px; overflow-wrap: anywhere; }
  #tablaUsuariosGlobal tbody td::before { font-weight: 700; }
  #tablaUsuariosGlobal tbody td:nth-child(1)::before { content: 'Usuario'; }
  #tablaUsuariosGlobal tbody td:nth-child(2)::before { content: 'Mail'; }
  #tablaUsuariosGlobal tbody td:nth-child(3)::before { content: 'Empresa'; }
  #tablaUsuariosGlobal tbody td:nth-child(4)::before { content: 'Rol'; }
  #tablaUsuariosGlobal tbody td:nth-child(5)::before { content: 'Estado'; }
  #tablaUsuariosGlobal tbody td:last-child { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding-top: 12px; }
  #tablaUsuariosGlobal tbody td:last-child::before { grid-column: 1 / -1; text-align: center; }
  #tablaUsuariosGlobal tbody td:last-child > button { width: 100%; min-width: 0; white-space: nowrap; }
}
@media (max-width: 760px) {
  .panel-tabla { display: block; overflow: visible; }
  .panel-acciones { width: 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel-acciones > button { font-size: 12px; white-space: nowrap; }
  .panel-contenedor,
  .panel-subcontenedor { max-width: 100%; }
}

/* Control - Seguridad: filtros, acciones y tarjetas responsive. */
.seguridad-page .seguridad-bloque { overflow: hidden; }
.seguridad-page .seguridad-filtros { display: grid; grid-template-columns: minmax(0, 1fr) 180px; align-items: end; gap: 10px; margin: 14px 0 16px; }
.seguridad-page .auditoria-filtros { grid-template-columns: repeat(4, minmax(0, 1fr)) auto auto; }
.seguridad-page .seguridad-filtros label { min-width: 0; }
.seguridad-page .seguridad-filtro-busqueda { position: relative; }
.seguridad-page .seguridad-filtro-limpiar { display: block; position: absolute; right: 8px; bottom: 2px; box-sizing: border-box; width: 24px !important; min-width: 24px !important; max-width: 24px !important; height: 24px !important; min-height: 24px !important; max-height: 24px !important; flex: 0 0 24px !important; margin: 0; padding: 0; border: 0 !important; border-radius: 50% !important; background: transparent !important; color: #555 !important; font-size: 16px !important; line-height: 24px !important; text-align: center; }
.seguridad-page .seguridad-filtro-limpiar:hover,
.seguridad-page .seguridad-filtro-limpiar:focus-visible { border: 0 !important; border-radius: 50% !important; background: #111 !important; color: #fff !important; }
.seguridad-page .seguridad-filtro-limpiar[hidden] { display: none; }
.seguridad-page .seguridad-filtros input,
.seguridad-page .seguridad-filtros select { width: 100%; box-sizing: border-box; }
.seguridad-page .seguridad-filtros button,
.seguridad-page .seguridad-acciones button { min-width: 110px; margin: 0; border: 1px solid #8a8a8a; border-radius: 999px; white-space: nowrap; }
.seguridad-page .seguridad-tabla { width: 100%; overflow: hidden; border: 1px solid #c8d0d6; border-radius: 10px; }
.seguridad-page .seguridad-tabla table { width: 100%; margin: 0; border: 0; }
.seguridad-page .seguridad-tabla table { display: table !important; table-layout: fixed; }
.seguridad-page #tablaSesionesGlobal th:last-child,
.seguridad-page #tablaSesionesGlobal td:last-child { width: 160px; }
.seguridad-page .seguridad-acciones { padding-right: 16px; text-align: right; white-space: nowrap; }
.seguridad-page .seguridad-acciones button { transform: translateX(-14px); }

@media (min-width: 761px) and (max-width: 1024px) {
  .seguridad-page .seguridad-filtros,
  .seguridad-page .auditoria-filtros { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .seguridad-page .seguridad-filtros button { width: 100%; }
  .seguridad-page .seguridad-tabla table { display: block !important; overflow: visible !important; }
  .seguridad-page .seguridad-tabla thead { display: none !important; }
  .seguridad-page .seguridad-tabla tbody,
  .seguridad-page .seguridad-tabla tr,
  .seguridad-page .seguridad-tabla td { display: block !important; width: auto !important; min-width: 0 !important; max-width: none !important; }
  .seguridad-page .seguridad-tabla tr { margin: 12px; padding: 12px; border: 1px solid #c8d0d6; border-radius: 10px; }
  .seguridad-page .seguridad-tabla td { display: flex !important; justify-content: space-between; gap: 12px; padding: 7px 0; border: 0; overflow-wrap: anywhere; }
  .seguridad-page .seguridad-tabla td::before { font-weight: 700; margin-right: 10px; }
  .seguridad-page #tablaSesionesGlobal td:nth-child(1)::before { content: 'Usuario'; }
  .seguridad-page #tablaSesionesGlobal td:nth-child(2)::before { content: 'Empresa'; }
  .seguridad-page #tablaSesionesGlobal td:nth-child(3)::before { content: 'IP'; }
  .seguridad-page #tablaSesionesGlobal td:nth-child(4)::before { content: 'Último uso'; }
  .seguridad-page #tablaSesionesGlobal td:nth-child(5)::before { content: 'Estado'; }
  .seguridad-page #tablaEventosGlobal td:nth-child(1)::before { content: 'Fecha'; }
  .seguridad-page #tablaEventosGlobal td:nth-child(2)::before { content: 'Estado'; }
  .seguridad-page #tablaEventosGlobal td:nth-child(3)::before { content: 'Ruta'; }
  .seguridad-page #tablaEventosGlobal td:nth-child(4)::before { content: 'Usuario'; }
  .seguridad-page #tablaEventosGlobal td:nth-child(5)::before { content: 'Empresa'; }
  .seguridad-page #tablaEventosGlobal td:nth-child(6)::before { content: 'IP'; }
  .seguridad-page #tablaAuditoriaGlobal td:nth-child(1)::before { content: 'Fecha'; }
  .seguridad-page #tablaAuditoriaGlobal td:nth-child(2)::before { content: 'Empresa'; }
  .seguridad-page #tablaAuditoriaGlobal td:nth-child(3)::before { content: 'Usuario'; }
  .seguridad-page #tablaAuditoriaGlobal td:nth-child(4)::before { content: 'Módulo'; }
  .seguridad-page #tablaAuditoriaGlobal td:nth-child(5)::before { content: 'Acción'; }
  .seguridad-page #tablaAuditoriaGlobal td:nth-child(6)::before { content: 'Entidad'; }
  .seguridad-page .seguridad-acciones { display: grid !important; grid-template-columns: 1fr; margin-top: 8px; padding-top: 12px; border-top: 1px solid #e1e6ea; text-align: center; }
  .seguridad-page .seguridad-acciones::before { display: none; }
  .seguridad-page .seguridad-acciones button { width: 100%; }
  .seguridad-page .seguridad-acciones button { transform: none; }
  .seguridad-page .auditoria-filtros { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .seguridad-page .auditoria-filtros button { width: 100%; min-width: 0; }
}

@media (max-width: 760px) {
  .seguridad-page .seguridad-filtros,
  .seguridad-page .auditoria-filtros { grid-template-columns: 1fr; gap: 12px; }
  .seguridad-page .seguridad-filtros button { width: 100%; min-width: 0; }
  .seguridad-page .seguridad-tabla table { display: block !important; table-layout: auto; overflow: visible !important; }
  .seguridad-page .seguridad-tabla thead { display: none !important; }
  .seguridad-page .seguridad-tabla tbody,
  .seguridad-page .seguridad-tabla tr,
  .seguridad-page .seguridad-tabla td { display: block !important; width: auto !important; min-width: 0 !important; max-width: none !important; }
  .seguridad-page .seguridad-tabla tr { margin: 12px; padding: 12px; border: 1px solid #c8d0d6; border-radius: 10px; }
  .seguridad-page .seguridad-tabla td { display: grid !important; grid-template-columns: 92px minmax(0, 1fr); align-items: start; gap: 8px; padding: 8px 0; border: 0; overflow-wrap: anywhere; word-break: break-word; }
  .seguridad-page .seguridad-tabla td::before { font-weight: 700; }
  .seguridad-page #tablaSesionesGlobal td:nth-child(1)::before { content: 'Usuario'; }
  .seguridad-page #tablaSesionesGlobal td:nth-child(2)::before { content: 'Empresa'; }
  .seguridad-page #tablaSesionesGlobal td:nth-child(3)::before { content: 'IP'; }
  .seguridad-page #tablaSesionesGlobal td:nth-child(4)::before { content: 'Último uso'; }
  .seguridad-page #tablaSesionesGlobal td:nth-child(5)::before { content: 'Estado'; }
  .seguridad-page #tablaEventosGlobal td:nth-child(1)::before { content: 'Fecha'; }
  .seguridad-page #tablaEventosGlobal td:nth-child(2)::before { content: 'Estado'; }
  .seguridad-page #tablaEventosGlobal td:nth-child(3)::before { content: 'Ruta'; }
  .seguridad-page #tablaEventosGlobal td:nth-child(4)::before { content: 'Usuario'; }
  .seguridad-page #tablaEventosGlobal td:nth-child(5)::before { content: 'Empresa'; }
  .seguridad-page #tablaEventosGlobal td:nth-child(6)::before { content: 'IP'; }
  .seguridad-page #tablaAuditoriaGlobal td:nth-child(1)::before { content: 'Fecha'; }
  .seguridad-page #tablaAuditoriaGlobal td:nth-child(2)::before { content: 'Empresa'; }
  .seguridad-page #tablaAuditoriaGlobal td:nth-child(3)::before { content: 'Usuario'; }
  .seguridad-page #tablaAuditoriaGlobal td:nth-child(4)::before { content: 'Módulo'; }
  .seguridad-page #tablaAuditoriaGlobal td:nth-child(5)::before { content: 'Acción'; }
  .seguridad-page #tablaAuditoriaGlobal td:nth-child(6)::before { content: 'Entidad'; }
  .seguridad-page .seguridad-acciones { display: grid !important; grid-template-columns: 1fr; margin-top: 8px; padding: 12px 0 0; border-top: 1px solid #e1e6ea; text-align: center; }
  .seguridad-page .seguridad-acciones::before { display: none; }
  .seguridad-page .seguridad-acciones button { width: 100% !important; min-width: 0 !important; max-width: none !important; justify-self: stretch; transform: none; }
}
