/* =====================================
   USUARIOS CSS PRO - ESTILO UNIFICADO (VH)
===================================== */

/* =========================
   CONTENEDOR
========================= */
#us-container {
  font-family: "Inter", "Segoe UI", Arial, sans-serif;
  color: #111827;
  padding: 18px;
}

/* =========================
   LAYOUT
========================= */
.us-layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 22px;
  align-items: flex-start;
}

/* =========================
   CARDS
========================= */
.us-left-card,
.us-right-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 20px;
}

/* =========================
   TITULOS
========================= */
#us-title {
  margin: 0 0 18px;
  font-size: 28px;
  font-weight: 700;
}

.us-right-card h3 {
  margin: 0 0 16px;
  font-size: 18px;
  font-weight: 700;
}

/* =========================
   CAMPOS
========================= */
.us-field {
  display: flex;
  flex-direction: column;
  margin-bottom: 14px;
}

.us-field label {
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  margin-bottom: 6px;
}

#us-container input:not([type="checkbox"]) {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  font-size: 14px;
  background: #fff;
}

#us-container input:focus {
  outline: none;
  border-color: #2f56a6;
  box-shadow: 0 0 0 3px rgba(47,86,166,0.12);
}

/* =========================
   PERMISOS
========================= */
.us-permisos-box {
  height: 420px;
  overflow-y: auto;
  border: 1px solid #e5e7eb;
  padding: 14px 16px;
  border-radius: 12px;
  background: #fafafa;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 20px;
}

.us-permisos-box::-webkit-scrollbar {
  width: 6px;
}
.us-permisos-box::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 20px;
}

.us-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
}

.us-check input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: #2f56a6;
}

.us-check span {
  font-size: 13px;
  color: #374151;
}

/* =========================
   BOTONES
========================= */
.us-btn {
  border: none;
  border-radius: 10px;
  height: 44px;
  padding: 0 16px;
  cursor: pointer;
  font-weight: 600;
  transition: 0.2s ease;
}

.us-btn:hover {
  transform: translateY(-1px);
}

.us-btn-primary {
  background: #2f56a6;
  color: white;
}

.us-btn-primary:hover {
  background: #24468a;
}

/* =========================
   TABLA
========================= */
.us-table {
  width: 100%;
  border-collapse: collapse;
}

.us-table th {
  background: #f3f4f6;
  padding: 12px;
  font-size: 13px;
  font-weight: 700;
}

.us-table td {
  padding: 12px;
  border-bottom: 1px solid #f1f1f1;
}

/* badges */
.us-badge-activo {
  background: #e7f6ea;
  color: #1e8e3e;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.us-badge-inactivo {
  background: #fdeaea;
  color: #c62828;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

/* botones acción */
.us-btn-action {
  border: none;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
}

.us-btn-success {
  background: #16a34a;
  color: white;
}

.us-btn-danger {
  background: #dc2626;
  color: white;
}

/* =========================
   SECCIONES PERMISOS
========================= */
.us-perm-section {
  grid-column: 1 / -1;
  margin-top: 10px;
  margin-bottom: 4px;
  font-size: 12px;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* =========================
   MODAL LIMPIO Y CORREGIDO
========================= */

/* overlay */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35); /* menos oscuro */
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 999;

  backdrop-filter: none !important;
}

.modal.hidden {
  display: none !important;
}

/* caja */
.modal-content {
  background: #ffffff;
  width: min(92vw, 420px);
  border-radius: 16px;
  padding: 24px;
  text-align: center;

  box-shadow: 0 20px 50px rgba(0,0,0,0.18);
}

/* textos */
.modal-content h3 {
  margin-bottom: 10px;
  font-size: 20px;
}

.modal-content p {
  color: #6b7280;
  margin-bottom: 18px;
}

/* acciones */
.modal-actions {
  display: flex;
  gap: 10px;
}

/* botones base */
.modal-btn {
  flex: 1;
  height: 42px;
  border-radius: 10px;
  border: none;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s ease;
}

.modal-btn:hover {
  transform: translateY(-1px);
}

/* cancelar */
.modal-btn-cancel {
  background: #6b7280;
  color: white;
}

/* confirmar */
.modal-btn-primary {
  background: #2f56a6;
  color: white;
}

.modal-btn-primary:hover {
  background: #24468a;
}

/* ?? CLAVE: evitar que CSS global dañe los botones */
.modal-content button {
  opacity: 1 !important;
  filter: none !important;
}

/* ?? SOLO cuando están deshabilitados */
.modal-content button:disabled {
  background: #9ca3af !important;
  color: white !important;
  cursor: not-allowed;
}

/* ?? OVERRIDE GLOBAL (anti login.css) */
#us-container .modal-content button {
  background: unset !important;
}

/* restablecer estilos correctos */
#us-container .modal-btn-cancel {
  background: #6b7280 !important;
  color: white !important;
}

#us-container .modal-btn-primary {
  background: #2f56a6 !important;
  color: white !important;
}

/* =========================
   RESPONSIVE
========================= */
@media (max-width: 1000px) {
  .us-layout {
    grid-template-columns: 1fr;
  }
}

/* =====================================
   AJUSTE COMPACTO USUARIOS
   AGREGAR AL FINAL
===================================== */

#us-container{
  padding:14px !important;
}

.us-layout{
  grid-template-columns:320px 1fr !important;
  gap:16px !important;
}

.us-left-card,
.us-right-card{
  padding:14px !important;
  border-radius:12px !important;
}

/* títulos */
#us-title{
  font-size:24px !important;
  margin-bottom:14px !important;
}

.us-right-card h3{
  font-size:16px !important;
  margin-bottom:12px !important;
}

/* campos */
.us-field{
  margin-bottom:10px !important;
}

.us-field label{
  font-size:11px !important;
  margin-bottom:4px !important;
}

#us-container input:not([type="checkbox"]){
  height:34px !important;
  padding:0 10px !important;
  font-size:12px !important;
  border-radius:9px !important;
}

/* permisos */
.us-permisos-box{
  height:340px !important;
  padding:10px 12px !important;
  border-radius:10px !important;
  gap:8px 14px !important;
}

.us-check{
  gap:6px !important;
  font-size:12px !important;
}

.us-check input[type="checkbox"]{
  width:13px !important;
  height:13px !important;
}

.us-check span{
  font-size:12px !important;
}

.us-perm-section{
  font-size:11px !important;
  margin-top:6px !important;
  margin-bottom:2px !important;
}

/* botones */
.us-btn{
  height:34px !important;
  padding:0 12px !important;
  font-size:12px !important;
  border-radius:9px !important;
}

/* tabla */
.us-table th{
  font-size:12px !important;
  padding:9px !important;
}

.us-table td{
  font-size:12px !important;
  padding:9px !important;
}

.us-badge-activo,
.us-badge-inactivo{
  font-size:11px !important;
  padding:4px 8px !important;
}

.us-btn-action{
  padding:5px 8px !important;
  font-size:11px !important;
  border-radius:6px !important;
}

/* modal */
.modal-content{
  width:min(92vw,390px) !important;
  padding:18px !important;
  border-radius:14px !important;
}

.modal-content h3{
  font-size:18px !important;
}

.modal-content p{
  font-size:13px !important;
  margin-bottom:14px !important;
}

.modal-btn{
  height:36px !important;
  font-size:12px !important;
  border-radius:9px !important;
}

/* responsive */
@media (max-width:1100px){

  .us-layout{
    grid-template-columns:1fr !important;
  }
}

@media (max-width:768px){

  #us-container{
    padding:10px !important;
  }

  #us-title{
    font-size:22px !important;
  }

  .us-permisos-box{
    grid-template-columns:1fr !important;
    height:300px !important;
  }

  .modal-actions{
    flex-direction:column !important;
  }
}

/* ampliar caja de permisos */
.us-permisos-box{
  height:460px !important;
  max-height:460px !important;
}

/* responsive tablet */
@media (max-width:1100px){
  .us-permisos-box{
    height:380px !important;
    max-height:380px !important;
  }
}

/* responsive móvil */
@media (max-width:768px){
  .us-permisos-box{
    height:320px !important;
    max-height:320px !important;
  }
}

.modal-backdrop{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.45);
  display:flex;
  align-items:center;
  justify-content:center;
  z-index:9999;
}

.modal-card{
  background:#fff;
  width:420px;
  max-width:95%;
  border-radius:16px;
  padding:24px;
}

.cred-row{
  margin-top:14px;
}

.cred-row label{
  font-size:13px;
  color:#666;
}

.cred-box{
  margin-top:6px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  background:#f4f6f8;
  padding:10px 12px;
  border-radius:10px;
}

.cred-box button{
  background:#2f56a6;
  color:#fff;
  border:none;
  padding:6px 10px;
  border-radius:8px;
  cursor:pointer;
}

.cred-warning{
  margin-top:16px;
  font-size:13px;
  color:#dc2626;
}

.hidden{
  display:none;
}


/* =========================
   HEADER PERMISOS
========================= */

.us-perm-header{
  grid-column:1 / -1;
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-top:10px;
}

.us-select-all-btn{
  border:none;
  background:#e8eefc;
  color:#2f56a6;
  font-size:11px;
  font-weight:600;
  padding:5px 10px;
  border-radius:8px;
  cursor:pointer;
  transition:.2s ease;
}

.us-select-all-btn:hover{
  background:#d7e3ff;
}