/* Antara — admin panel (users, config, logs). Mobile-first responsive. */

* { box-sizing: border-box; }

:root {
  --cyan: #00f2ff;
  --blue: #0072ff;
  --violet: #7000ff;
  --bg: #03060e;
  --panel: rgba(8, 18, 36, 0.85);
  --panel-soft: rgba(12, 28, 50, 0.55);
  --text: #e8f4ff;
  --text-dim: rgba(200, 230, 255, 0.6);
  --danger: #ff5563;
  --warn: #ffb454;
  --ok: #42ffae;
  --border: rgba(0, 242, 255, 0.22);
  /* grid-app-dialog — mismo tema que el panel admin */
  --app-dialog-bg: var(--panel);
  --app-dialog-text: var(--text);
  --app-dialog-muted: var(--text-dim);
  --app-dialog-border: var(--border);
  --app-dialog-input-bg: rgba(0, 0, 0, 0.35);
  --app-dialog-input-border: var(--border);
  --app-dialog-btn-secondary-bg: rgba(0, 0, 0, 0.35);
  --app-dialog-btn-border: var(--border);
  --app-dialog-focus: var(--cyan);
  --app-dialog-accent-1: var(--violet);
  --app-dialog-accent-2: var(--blue);
  --app-dialog-accent-3: var(--cyan);
  --app-dialog-shadow: 0 18px 48px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  --app-dialog-backdrop: rgba(0, 0, 0, 0.55);
}

html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: system-ui, "Segoe UI", Roboto, sans-serif; min-height: 100vh; }

body::before {
  content: "";
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(ellipse 100% 60% at 80% 0%, rgba(112, 0, 255, 0.18), transparent 55%),
    radial-gradient(ellipse 100% 60% at 0% 100%, rgba(0, 114, 255, 0.18), transparent 55%),
    linear-gradient(180deg, #020308 0%, #050a14 60%, #020308 100%);
}

.admin-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.admin-sidebar {
  background: rgba(4, 10, 22, 0.85);
  border-right: 1px solid var(--border);
  padding: 1.25rem 1rem;
  display: flex; flex-direction: column; gap: 0.6rem;
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 1.1rem; font-weight: 700; letter-spacing: 0.32em; text-transform: uppercase;
  margin-bottom: 1.5rem; color: var(--cyan);
  text-shadow: 0 0 14px rgba(0, 242, 255, 0.4);
}
.admin-brand__text { letter-spacing: 0.32em; }
.admin-brand__logo-wrap {
  position: relative;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  overflow: hidden;
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--border);
}
.admin-brand__logo-wrap .admin-brand__logo,
.admin-brand__logo-wrap [data-antara-profile-video] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.admin-brand__logo-ph {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--cyan);
  background: rgba(0, 242, 255, 0.12);
}
.admin-brand__logo-wrap [hidden] { display: none !important; }

.config-branding {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}
.config-branding__preview {
  margin: 0.75rem 0 1rem;
}
.config-branding__preview .install-logo-media-wrap {
  width: 96px;
  height: 96px;
}
.config-branding .logo-selected-preview {
  display: none;
  margin: 0;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
  max-width: 220px;
}
.config-branding .logo-selected-preview.is-on {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.config-branding .logo-selected-preview__caption {
  display: block;
  margin-bottom: 8px;
  font-size: 0.78rem;
  color: var(--text-dim);
}
.config-branding .install-logo-media-wrap {
  position: relative;
  overflow: hidden;
  border-radius: 50%;
}
.config-branding .install-logo-media-wrap [data-antara-profile-img],
.config-branding .install-logo-media-wrap [data-antara-profile-video] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.config-branding .install-logo-media-wrap [hidden] { display: none !important; }

.admin-nav { display: flex; flex-direction: column; gap: 0.35rem; }
.admin-nav a {
  display: block; padding: 0.6rem 0.8rem; border-radius: 8px;
  color: var(--text-dim); text-decoration: none; font-size: 0.85rem;
  letter-spacing: 0.06em; transition: background 0.2s ease, color 0.2s ease;
}
.admin-nav a:hover { background: rgba(0, 242, 255, 0.08); color: var(--text); }
.admin-nav a.is-active { background: linear-gradient(95deg, rgba(112,0,255,0.25), rgba(0,242,255,0.18)); color: #fff; box-shadow: inset 0 0 0 1px var(--border); }
.admin-nav a:disabled, .admin-nav a.is-disabled { opacity: 0.4; pointer-events: none; }

.admin-user {
  margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--border);
  font-size: 0.78rem; color: var(--text-dim);
}
.admin-user__row {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
}
.admin-user__meta { min-width: 0; flex: 1; }
.admin-user__avatar-wrap {
  position: relative;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  overflow: hidden;
  border-radius: 50%;
}
.admin-user__avatar-wrap .admin-user__avatar,
.admin-user__avatar-wrap [data-antara-profile-video] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 1px var(--border);
  display: block;
}
.admin-user__avatar--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--cyan);
  background: rgba(0, 242, 255, 0.12);
}
/* display:flex en placeholder anula [hidden] del UA — un solo círculo visible */
.admin-user__avatar-wrap .admin-user__avatar[hidden],
.admin-user__avatar-wrap .admin-user__avatar--placeholder[hidden],
.admin-user__avatar-wrap [data-antara-profile-video][hidden] {
  display: none !important;
}
.admin-user strong { display: block; color: var(--text); font-size: 0.9rem; margin-bottom: 0.2rem; }
.admin-user .logout {
  display: block; margin-top: 0.6rem; padding: 0.5rem; border: 1px solid var(--border); background: transparent;
  border-radius: 8px; color: var(--cyan); cursor: pointer; text-align: center; font-size: 0.78rem; letter-spacing: 0.1em;
}
.admin-user .logout:hover { background: rgba(0, 242, 255, 0.1); }

.admin-main { padding: 1.25rem 1.5rem 2rem; overflow: auto; }

.admin-header {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  margin-bottom: 1.25rem; flex-wrap: wrap;
}
.admin-header h1 { margin: 0; font-size: 1.35rem; letter-spacing: 0.18em; text-transform: uppercase; }

.btn {
  border: 1px solid var(--border); background: rgba(0, 0, 0, 0.35);
  color: var(--text); padding: 0.55rem 0.85rem; border-radius: 8px; cursor: pointer;
  font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.btn:hover { background: rgba(0, 242, 255, 0.08); border-color: var(--cyan); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.btn-primary {
  background: linear-gradient(95deg, var(--violet), var(--blue) 50%, var(--cyan));
  color: #fff; border: none; box-shadow: 0 0 18px rgba(0, 114, 255, 0.35);
}
.btn.btn-danger { color: #ffd9d9; border-color: rgba(255, 100, 110, 0.5); }
.btn.btn-danger:hover { background: rgba(255, 90, 100, 0.18); border-color: var(--danger); }
.btn.btn-warn { color: #ffe1be; border-color: rgba(255, 180, 80, 0.45); }
.btn.btn-ghost { background: transparent; }

.toolbar {
  display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center;
  background: var(--panel); padding: 0.75rem; border: 1px solid var(--border); border-radius: 10px;
  margin-bottom: 1rem;
}
.toolbar input, .toolbar select {
  background: rgba(0, 0, 0, 0.4); border: 1px solid var(--border); color: var(--text);
  padding: 0.45rem 0.6rem; border-radius: 6px; font-size: 0.85rem; outline: none;
}
.toolbar input:focus, .toolbar select:focus { border-color: var(--cyan); box-shadow: 0 0 0 1px var(--cyan); }
.toolbar .grow { flex: 1; }
.toolbar.is-disabled { opacity: 0.45; pointer-events: none; user-select: none; }

.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 1rem; box-shadow: 0 8px 28px rgba(0, 0, 0, 0.4);
}

.first-admin-wizard { margin-bottom: 1.25rem; }
.first-admin-wizard__title {
  margin: 0 0 0.5rem; font-size: 1rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--cyan);
}
.first-admin-wizard__lead { margin: 0 0 1rem; font-size: 0.88rem; line-height: 1.55; color: var(--text-dim); }
.first-admin-wizard__steps {
  margin: 0 0 1rem 1.1rem; padding: 0; color: var(--text-dim); font-size: 0.82rem; line-height: 1.6;
}
.first-admin-wizard__grid {
  display: grid; gap: 0.75rem;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}
.first-admin-wizard__form label {
  font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-dim); display: block; margin-bottom: 0.25rem;
}
.first-admin-wizard__form input {
  width: 100%; background: rgba(0, 0, 0, 0.45); border: 1px solid var(--border); color: var(--text);
  padding: 0.55rem 0.65rem; border-radius: 6px; font-size: 0.88rem; outline: none;
}
.first-admin-wizard__form input:focus { border-color: var(--cyan); box-shadow: 0 0 0 1px var(--cyan); }
.first-admin-wizard__actions { margin-top: 1rem; }
.first-admin-wizard .feedback { margin-top: 0.75rem; font-size: 0.82rem; color: var(--warn); min-height: 1.2em; }
.first-admin-wizard .feedback.is-ok { color: var(--ok); }

.first-admin-wizard__pass-block { grid-column: 1 / -1; max-width: min(100%, 420px); }
@media (min-width: 720px) {
  .first-admin-wizard__pass-block { grid-column: auto; max-width: 420px; }
}

.pw-meter { margin-top: 0.45rem; }
.pw-meter__track {
  height: 6px; border-radius: 999px; background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--border); overflow: hidden;
}
.pw-meter__fill {
  display: block; height: 100%; width: 0%; border-radius: 999px;
  transition: width 0.2s ease, background 0.2s ease;
  background: linear-gradient(90deg, #64748b, #94a3b8);
}
.pw-meter--1 .pw-meter__fill { width: 20%; background: linear-gradient(90deg, #b91c1c, #f87171); }
.pw-meter--2 .pw-meter__fill { width: 40%; background: linear-gradient(90deg, #c2410c, #fb923c); }
.pw-meter--3 .pw-meter__fill { width: 60%; background: linear-gradient(90deg, #a16207, #facc15); }
.pw-meter--4 .pw-meter__fill { width: 80%; background: linear-gradient(90deg, #047857, #34d399); }
.pw-meter--5 .pw-meter__fill { width: 100%; background: linear-gradient(90deg, #065f46, #6ee7b7); }

.pw-live { margin: 0.4rem 0 0; font-size: 0.78rem; line-height: 1.45; min-height: 2.2em; }
.pw-live--strength { color: var(--text-dim); }
.pw-live--strength strong { color: var(--text); font-weight: 600; }
.pw-live--match { color: var(--text-dim); }
.pw-live.is-warn { color: var(--warn); }
.pw-live.is-bad { color: var(--danger); }
.pw-live.is-ok { color: var(--ok); }

.users-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.users-table thead th {
  text-align: left; padding: 0.55rem 0.5rem; font-weight: 600;
  border-bottom: 1px solid var(--border); color: var(--text-dim);
  letter-spacing: 0.06em; font-size: 0.72rem; text-transform: uppercase;
}
.users-table tbody td {
  padding: 0.7rem 0.5rem; border-bottom: 1px solid rgba(0, 242, 255, 0.08); vertical-align: middle;
}
.users-table tbody tr:hover { background: rgba(0, 242, 255, 0.05); }
.users-table .col-actions { text-align: right; white-space: nowrap; }
.users-table .col-actions .btn { padding: 0.35rem 0.55rem; font-size: 0.7rem; margin-left: 0.3rem; }

.users-row__details-row { display: none; }
.users-row__toggle {
  width: 100%;
  margin: 0 0 0.5rem;
  padding: 0.45rem 0.65rem;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.users-row__more {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.65rem 0.7rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(0, 242, 255, 0.12);
}
.users-detail-item {
  display: grid;
  grid-template-columns: minmax(5.5rem, 34%) 1fr;
  gap: 0.35rem 0.65rem;
  align-items: start;
  font-size: 0.8rem;
}
.users-detail-item__label {
  color: var(--text-dim);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.users-detail-item__value { min-width: 0; word-break: break-word; }
.users-detail-item__value .badge { margin: 0 0.2rem 0.2rem 0; }

.badge {
  display: inline-block; padding: 0.18rem 0.45rem; border-radius: 999px;
  font-size: 0.62rem; letter-spacing: 0.1em; text-transform: uppercase;
  background: rgba(0, 242, 255, 0.12); color: var(--cyan); border: 1px solid var(--border);
}
.badge.role-super_admin { background: linear-gradient(95deg, rgba(112,0,255,0.4), rgba(0,242,255,0.25)); color: #fff; }
.badge.role-admin { background: rgba(0, 114, 255, 0.25); color: #c9e7ff; border-color: rgba(0, 114, 255, 0.5); }
.badge.role-usuario { background: rgba(0, 242, 255, 0.1); }
.badge.is-blocked { background: rgba(255, 80, 90, 0.2); color: #ffd0d0; border-color: rgba(255, 80, 90, 0.4); }
.badge.is-inactive { background: rgba(255, 180, 80, 0.15); color: #ffe2bf; border-color: rgba(255, 180, 80, 0.35); }
.badge.is-passkey { background: rgba(80, 255, 170, 0.12); color: var(--ok); border-color: rgba(80, 255, 170, 0.3); }

.muted { color: var(--text-dim); }
.empty { padding: 2rem; text-align: center; color: var(--text-dim); }

/* Modal */
.modal-back {
  position: fixed; inset: 0; background: rgba(2, 6, 14, 0.78);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: none; align-items: center; justify-content: center; z-index: 90;
}
.modal-back.is-open { display: flex; }
.modal {
  width: min(96vw, 460px); background: rgba(10, 22, 40, 0.95);
  border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5); max-height: 92vh; overflow: auto;
}
.modal header {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}
.modal-title-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex: 1;
  min-width: 0;
}
.modal-title-row h2 { margin: 0; font-size: 1rem; letter-spacing: 0.16em; text-transform: uppercase; }
.admin-avatar-wrap {
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--border);
}
.admin-avatar-wrap .admin-avatar,
.admin-avatar-wrap .admin-avatar--placeholder,
.admin-avatar-wrap [data-antara-profile-video] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  border-radius: 0;
  object-fit: cover;
  display: block;
  box-sizing: border-box;
}
/* UA [hidden] loses to our display rules above — keep avatar toggles from overlapping */
.admin-avatar-wrap .admin-avatar[hidden],
.admin-avatar-wrap .admin-avatar--placeholder[hidden],
.admin-avatar-wrap [data-antara-profile-video][hidden] {
  display: none !important;
}
.admin-avatar-wrap--lg {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
}
.admin-avatar-wrap--lg .admin-avatar--placeholder {
  font-size: 1rem;
}
.admin-avatar-wrap .admin-avatar--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--cyan);
  background: rgba(0, 242, 255, 0.12);
}
.user-cell {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
}
.user-cell .admin-avatar-wrap { margin-top: 0.1rem; }
.user-cell__body { min-width: 0; }
.modal .close { background: transparent; border: none; color: var(--cyan); font-size: 1.4rem; cursor: pointer; }
.modal .body { padding: 1rem; display: flex; flex-direction: column; gap: 0.75rem; }
.modal .body label { font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-dim); display: block; margin-bottom: 0.25rem; }
.modal .body input, .modal .body select {
  width: 100%; background: rgba(0, 0, 0, 0.45); border: 1px solid var(--border); color: var(--text);
  padding: 0.55rem 0.7rem; border-radius: 6px; font-size: 0.9rem; outline: none;
}
.modal .body input:focus, .modal .body select:focus { border-color: var(--cyan); box-shadow: 0 0 0 1px var(--cyan); }
.modal-photo-row .modal-photo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

/* Foto de perfil en modal (flujo tipo wizard) */
.modal-photo-block {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.35rem;
}
.modal-photo-block__label {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.um-photo-preview-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}
.um-photo-preview {
  position: relative;
  width: min(200px, 72vw);
  margin-inline: auto;
  flex-shrink: 0;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2px solid rgba(0, 242, 255, 0.4);
  overflow: hidden;
  background: rgba(0, 20, 40, 0.55);
  box-shadow: 0 0 0 1px var(--border);
}
.um-photo-preview__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.um-photo-preview [data-antara-profile-video] {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.um-photo-preview [data-antara-profile-video][hidden] {
  display: none !important;
}
.um-photo-preview__ph {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 2.25rem;
  color: var(--cyan);
  letter-spacing: 0.02em;
}
.um-photo-preview__img[hidden] {
  display: none !important;
}
.um-photo-preview__ph[hidden] {
  display: none !important;
}
.um-photo-step[hidden] {
  display: none !important;
}
.um-photo-mode {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  justify-content: center;
  margin: 0.25rem 0 0.65rem;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: rgba(220, 235, 255, 0.88);
}
.um-photo-mode__label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
}
.um-photo-mode__label input {
  accent-color: var(--cyan);
}
.um-photo-original-block[hidden],
.um-crop-block[hidden] {
  display: none !important;
}
.um-photo-original-preview {
  max-width: 300px;
  margin: 0 auto;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid rgba(0, 242, 255, 0.35);
  background: rgba(0, 0, 0, 0.35);
}
.um-photo-original-preview img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 280px;
  object-fit: contain;
}
.um-photo-save-hint {
  margin: 0.5rem 0 0;
  font-size: 0.62rem;
  text-align: center;
  color: var(--text-dim);
  letter-spacing: 0.05em;
}
.um-photo-save-hint strong {
  color: rgba(0, 242, 255, 0.85);
  font-weight: 600;
}
.um-photo-lead {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.45;
  color: rgba(220, 235, 255, 0.78);
  letter-spacing: 0.04em;
  text-align: center;
}
.um-photo-actions-row {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.35rem;
  justify-content: center;
}
.um-photo-actions-row--foot {
  margin-top: 0.5rem;
}
.um-photo-actions-row--triple {
  flex-wrap: wrap;
  justify-content: center;
}
.um-photo-actions-row--triple > .btn {
  flex: 1;
  min-width: min(100%, 108px);
}
.btn-secondary-wizardish {
  flex: 1;
  min-width: 120px;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  border: 1px solid rgba(0, 242, 255, 0.42);
  background: rgba(6, 18, 38, 0.65);
  color: var(--text);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}
.btn-secondary-wizardish:hover,
.btn-secondary-wizardish:focus-visible {
  border-color: var(--cyan);
  box-shadow: 0 0 18px rgba(0, 242, 255, 0.15);
  outline: none;
}
.btn-text-wizardish {
  padding: 0.45rem 0.25rem;
  border: none;
  background: transparent;
  color: rgba(0, 200, 255, 0.88);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.btn-text-wizardish:hover,
.btn-text-wizardish:focus-visible {
  color: var(--cyan);
  outline: none;
}
.um-crop-wrap {
  margin: 0.35rem 0 0.5rem;
}
.um-crop-viewport {
  position: relative;
  width: 100%;
  max-width: 300px;
  margin: 0 auto;
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid rgba(0, 242, 255, 0.45);
  box-shadow:
    inset 0 0 0 1px rgba(0, 114, 255, 0.35),
    0 0 28px rgba(0, 242, 255, 0.12);
  background: rgba(0, 0, 0, 0.35);
  touch-action: none;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}
.um-crop-viewport.is-dragging {
  cursor: grabbing;
}
.um-crop-viewport img {
  position: absolute;
  top: 0;
  left: 0;
  max-width: none;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}
.um-crop-frame {
  position: absolute;
  inset: 10%;
  border: 2px dashed rgba(0, 242, 255, 0.75);
  border-radius: 8px;
  pointer-events: none;
  box-shadow: 0 0 20px rgba(0, 242, 255, 0.15);
}
.um-crop-zoom {
  margin-top: 0.65rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  text-transform: uppercase;
}
.um-crop-zoom input[type="range"] {
  flex: 1;
  accent-color: var(--cyan);
}
.um-crop-hint {
  margin: 0.45rem 0 0;
  font-size: 0.62rem;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  text-align: center;
}
.modal .actions { display: flex; gap: 0.6rem; justify-content: flex-end; padding: 0.75rem 1rem; border-top: 1px solid var(--border); }
.modal .feedback { font-size: 0.78rem; min-height: 1em; padding: 0 1rem 0.5rem; color: var(--warn); }
.modal .feedback.is-ok { color: var(--ok); }

/* Config tab */
.config-grid {
  display: grid; gap: 0.65rem; grid-template-columns: 1fr; max-width: 640px;
}
.config-row {
  display: flex; align-items: flex-start; gap: 0.85rem; padding: 0.85rem 1rem;
  background: var(--panel-soft); border: 1px solid var(--border); border-radius: 10px;
}
.config-row .switch { flex-shrink: 0; }
.config-row .copy { flex: 1; }
.config-row .copy strong { display: block; font-size: 0.92rem; margin-bottom: 0.15rem; }
.config-row .copy span { color: var(--text-dim); font-size: 0.78rem; line-height: 1.5; }
.config-row.is-num input { width: 90px; }
.config-row label { font-size: 0.75rem; color: var(--text-dim); letter-spacing: 0.06em; }

.switch { position: relative; width: 46px; height: 26px; display: inline-block; }
.switch input { display: none; }
.switch span {
  position: absolute; inset: 0; border-radius: 999px;
  background: rgba(0, 60, 110, 0.55); border: 1px solid var(--border);
  cursor: pointer; transition: background 0.2s ease;
}
.switch span::before {
  content: ""; position: absolute; left: 3px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; background: #fff; border-radius: 50%;
  transition: left 0.2s ease, background 0.2s ease;
}
.switch input:checked + span { background: linear-gradient(95deg, var(--violet), var(--cyan)); border-color: var(--cyan); }
.switch input:checked + span::before { left: 24px; background: #03060e; }

.config-actions { margin-top: 1rem; display: flex; gap: 0.6rem; }

/* Logs */
.log-list { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 0.78rem; max-height: 70vh; overflow: auto; }
.log-list .row { padding: 0.45rem 0.6rem; border-bottom: 1px solid rgba(0, 242, 255, 0.06); display: grid; grid-template-columns: 160px 200px 1fr; gap: 0.65rem; }
.log-list .row .ts { color: var(--text-dim); }
.log-list .row .ev { color: var(--cyan); }
.log-list .row .ctx { color: var(--text); white-space: pre-wrap; word-break: break-all; }

.notice {
  padding: 0.8rem 1rem; border-radius: 10px; background: rgba(255, 180, 80, 0.1);
  border: 1px solid rgba(255, 180, 80, 0.3); color: #ffe1be; font-size: 0.85rem;
  margin-bottom: 1rem;
}

.admin-anon-banner {
  margin-bottom: 1rem; padding: 0.85rem 1rem; border-radius: 10px;
  background: rgba(0, 114, 255, 0.12); border: 1px solid rgba(0, 242, 255, 0.25);
  font-size: 0.82rem; line-height: 1.55; color: var(--text-dim);
}
.admin-anon-banner strong { color: var(--text); }

.admin-user__anon-hint {
  font-size: 0.78rem; line-height: 1.45; color: var(--text-dim); margin: 0 0 0.75rem 0;
}

.admin-anon-login { display: flex; flex-direction: column; gap: 0.35rem; }
.admin-anon-login label {
  font-size: 0.65rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-dim);
}
.admin-anon-login input {
  width: 100%; padding: 0.45rem 0.55rem; border-radius: 6px; border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.45); color: var(--text); font-size: 0.85rem; box-sizing: border-box;
}
.admin-anon-login__btn { margin-top: 0.35rem; width: 100%; }
.admin-anon-login__feedback {
  font-size: 0.72rem; color: var(--warn); margin: 0.25rem 0 0 0; min-height: 1.1em;
}
.admin-anon-login__feedback.is-ok { color: var(--ok); }

@media (max-width: 800px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-sidebar { flex-direction: row; flex-wrap: wrap; align-items: center; padding: 0.6rem 0.85rem; }
  .admin-brand { margin-bottom: 0; margin-right: 1rem; font-size: 0.95rem; }
  .admin-nav { flex-direction: row; flex: 1; flex-wrap: wrap; gap: 0.25rem; }
  .admin-nav a { padding: 0.45rem 0.65rem; font-size: 0.78rem; }
  .admin-user { margin-top: 0; padding-top: 0; border-top: none; border-left: 1px solid var(--border); padding-left: 0.85rem; }
  .admin-user .logout { margin-top: 0.3rem; }
  .users-table { font-size: 0.78rem; }
  .users-table .col-hide-sm { display: none; }
  .users-table .col-hide-mobile { display: none; }
  .users-table thead { display: none; }
  #users-page.card { overflow: visible; }
  .users-table { display: block; }
  .users-table tbody { display: block; }
  .users-table tbody tr.users-row {
    display: block;
    border: 1px solid rgba(0, 242, 255, 0.14);
    border-radius: 10px 10px 0 0;
    margin-bottom: 0;
    background: rgba(0, 12, 28, 0.45);
  }
  .users-table tbody tr.users-row__details-row {
    display: block;
    margin-bottom: 0.65rem;
    border: 1px solid rgba(0, 242, 255, 0.14);
    border-top: none;
    border-radius: 0 0 10px 10px;
    background: rgba(0, 12, 28, 0.45);
  }
  .users-table tbody tr.users-row.is-expanded + tr.users-row__details-row {
    border-top: 1px dashed rgba(0, 242, 255, 0.12);
  }
  .users-table tbody tr.users-row td,
  .users-table tbody tr.users-row__details-row td {
    display: block;
    border-bottom: none;
    padding: 0.55rem 0.75rem;
  }
  .users-table tbody tr.users-row td.users-row__user { padding-bottom: 0.35rem; }
  .users-table tbody tr.users-row td.users-row__role {
    padding-top: 0;
    padding-bottom: 0.35rem;
  }
  .users-table tbody tr.users-row td.users-row__actions {
    text-align: left;
    white-space: normal;
    padding-top: 0.25rem;
    padding-bottom: 0.65rem;
  }
  .users-table tbody tr.users-row td.users-row__actions .btn {
    margin: 0 0.35rem 0.35rem 0;
  }
  .users-table tbody tr.users-row__details-row td.users-row__details-cell {
    padding-top: 0;
  }
  .users-row__details-row { display: block; }
  .log-list .row { grid-template-columns: 1fr; gap: 0.2rem; }
}

/* Organización (departamentos / puestos por sucursal) */
.org-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
  margin-bottom: 1rem;
}
.org-toolbar label { display: block; font-size: 0.82rem; margin-bottom: 0.25rem; color: var(--text-dim); }
.org-toolbar select { min-width: 220px; }
.org-departments { display: flex; flex-direction: column; gap: 0.85rem; }
.org-dept.card-soft {
  background: var(--panel-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem 1rem;
}
.org-dept__head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem 0.75rem;
  align-items: end;
  margin-bottom: 0.65rem;
}
.org-dept__head label { grid-column: 1 / -1; font-size: 0.82rem; color: var(--text-dim); }
.org-positions { display: flex; flex-direction: column; gap: 0.45rem; margin-bottom: 0.55rem; }
.org-pos {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  align-items: center;
}
.org-pos .org-pos-remove { min-width: 2.2rem; padding: 0.35rem 0.5rem; }
.org-empty { margin: 0.5rem 0 0; }
