/* Usuarios admin — table, role pills, modal */

.usuarios-filters {
  display: grid;
  grid-template-columns: 280px 180px 180px;
  gap: 10px;
}
@media (max-width: 1100px) {
  .usuarios-filters { grid-template-columns: 1fr 1fr; }
}
.usuarios-filters .filter-input {
  font-size: 12px;
}

/* Role pills (en la tabla y en la ayuda) */
.role-pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: var(--r-pill);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  border: 1px solid;
  color: white;
  margin-right: 4px;
  margin-bottom: 4px;
  white-space: nowrap;
}
.role-pill.role-light { color: var(--ink); }

.campo-pills {
  display: inline-flex;
  gap: 4px;
  flex-wrap: wrap;
}
.campo-pill {
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  color: var(--ink-2);
  background: var(--paper-2);
}

.estado-pill {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  border: 1px solid;
  white-space: nowrap;
}
.estado-activo    { background: var(--sage-soft, #E8F5EE); color: var(--sage); border-color: var(--sage); }
.estado-pendiente { background: var(--gold-soft); color: #8B5800; border-color: #E8B86F; }
.estado-inactivo  { background: var(--paper-3); color: var(--muted); border-color: var(--line); }

.row-action {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  width: 30px;
  height: 30px;
  border-radius: var(--r-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .15s var(--ease-out);
}
.row-action:hover {
  color: var(--gold);
  border-color: var(--gold);
  background: var(--gold-soft);
}

/* Roles help section */
.roles-help {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 6px;
}
@media (max-width: 1100px) { .roles-help { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px)  { .roles-help { grid-template-columns: 1fr; } }

.role-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--paper-2);
}
.role-card .role-pill { margin-bottom: 8px; }
.role-card-desc {
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink-2);
}
.role-card-scope {
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}
.role-card.deferred {
  opacity: .55;
  border-style: dashed;
}
.role-card.deferred::after {
  content: "Diferido";
  display: inline-block;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-top: 6px;
}

/* ───────── Modal ───────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 31, 45, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fade-in .2s var(--ease-out);
}
.modal-backdrop[hidden] { display: none; }

.modal {
  background: var(--paper);
  border-radius: var(--r-lg);
  box-shadow: 0 32px 64px -16px rgba(0,0,0,.32), 0 8px 16px -8px rgba(0,0,0,.12);
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: fade-up .3s var(--ease-out);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--line-soft);
}
.modal-title {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  font-variation-settings: "opsz" 36;
  color: var(--ink);
  letter-spacing: -.018em;
}
.modal-close {
  background: transparent;
  border: none;
  font-size: 28px;
  color: var(--muted);
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
  line-height: 1;
}
.modal-close:hover {
  color: var(--ink);
  background: var(--paper-2);
}

.modal-body {
  padding: 22px 24px;
  overflow-y: auto;
  flex: 1;
}

.form-row {
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.form-row[hidden] { display: none; }
.form-lbl {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
}
.form-lbl .req { color: var(--alarm); margin-left: 2px; }

.form-row input[type="email"],
.form-row input[type="text"] {
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink);
  background: var(--paper);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.form-row input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(240,164,0,.12);
}

.role-options, .campo-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.campo-options { flex-direction: row; gap: 12px; }

.role-check-option, .campo-check-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all .12s;
  background: var(--paper);
}
.role-check-option:hover, .campo-check-option:hover {
  background: var(--paper-2);
  border-color: var(--muted-2);
}
.role-check-option.checked, .campo-check-option.checked {
  background: var(--gold-soft);
  border-color: var(--gold);
}
.role-check-option input, .campo-check-option input {
  margin-top: 2px;
  accent-color: var(--gold);
}
.role-check-content { flex: 1; }
.role-check-name {
  font-family: var(--sans);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
}
.role-check-desc {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 3px;
  line-height: 1.4;
}

.campo-options {
  flex-direction: row;
  gap: 10px;
}
.campo-check-option {
  flex: 1;
  align-items: center;
}
.campo-check-option .campo-check-name {
  font-family: var(--serif);
  font-size: 15px;
  font-variation-settings: "opsz" 24;
}

.form-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
}
.form-toggle-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--muted);
}
.form-toggle input:checked ~ * .form-toggle-label,
.form-toggle .toggle-switch input:checked + .toggle-slider + #f-activo-label { color: var(--sage); }

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line-soft);
}
