/* Avatar («bolita») y selector de personas (static/js/ubi-avatar.js).
   Colores del fondo de las iniciales: core/avatars.py → PALETA (≥ 4,5:1 con
   el texto blanco, en claro y en oscuro). */
.ubi-av {
  --av: #475569;
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0; border-radius: 9999px; overflow: hidden; vertical-align: middle;
  background: var(--av); color: #fff; font-weight: 700; line-height: 1; letter-spacing: .01em;
  user-select: none; font-family: inherit;
}
.ubi-av img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #e2e8f0; }
.ubi-av--xs { width: 20px; height: 20px; font-size: 8.5px; }
.ubi-av--sm { width: 28px; height: 28px; font-size: 11px; }
.ubi-av--md { width: 40px; height: 40px; font-size: 15px; }
.ubi-av--lg { width: 88px; height: 88px; font-size: 32px; }
.ubi-av--vacio { background: transparent; color: #64748b; border: 1.5px dashed #94a3b8; }
html.dark .ubi-av { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06); }
html.dark .ubi-av img { background: #1e2533; }
html.dark .ubi-av--vacio { color: #8590a1; border-color: #4b5563; box-shadow: none; }

/* ── Botón que sustituye al <select> ─────────────────────────────────── */
.upp-trigger {
  display: flex; align-items: center; gap: .55rem; width: 100%; min-height: 42px;
  padding: .35rem .7rem .35rem .4rem; border: 1px solid #e2e8f0; border-radius: .75rem;
  background: #fff; color: #0f172a; font-size: .875rem; font-weight: 600; text-align: left; cursor: pointer;
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.upp-trigger:hover { border-color: #cbd5e1; }
.upp-trigger:focus-visible, .upp-trigger[aria-expanded="true"] { outline: none; border-color: #37a9fb; box-shadow: 0 0 0 3px rgba(55, 169, 251, .14); }
.upp-trigger:disabled { opacity: .6; cursor: not-allowed; }
.upp-trigger:active:not(:disabled) { transform: translateY(1px); }
.upp-trigger--sm { min-height: 34px; padding: .2rem .55rem .2rem .25rem; border-radius: 8px; font-size: 13px; }
.upp-trigger--sm .ubi-av { width: 24px; height: 24px; font-size: 10px; }
.upp-tn { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upp-tn.is-vacio { color: #64748b; font-weight: 500; }
.upp-chev { width: 15px; height: 15px; flex-shrink: 0; color: #64748b; transition: transform .2s; }
.upp-trigger[aria-expanded="true"] .upp-chev { transform: rotate(180deg); }
html.dark .upp-trigger { background: #131925; border-color: #2c3340; color: #c4cbd6; }
html.dark .upp-trigger:hover { border-color: #3a4352; }
html.dark .upp-tn.is-vacio, html.dark .upp-chev { color: #8590a1; }

/* ── Lista emergente ─────────────────────────────────────────────────── */
.upp {
  position: fixed; z-index: 10060; display: flex; flex-direction: column; overflow: hidden;
  background: #fff; color: #0f172a; border: 1px solid #e2e8f0; border-radius: 14px;
  box-shadow: 0 18px 48px -12px rgba(15, 23, 42, .28), 0 2px 8px rgba(15, 23, 42, .08);
  opacity: 0; transform: translateY(-4px) scale(.98);
  transition: opacity .18s cubic-bezier(.16, 1, .3, 1), transform .18s cubic-bezier(.16, 1, .3, 1);
  font-size: 14px;
}
.upp.on { opacity: 1; transform: none; }
.upp-qw { padding: 8px 8px 4px; }
.upp-q {
  width: 100%; height: 36px; padding: 0 10px; border: 1px solid #e2e8f0 !important; border-radius: 9px !important;
  background: #f8fafc !important; color: #0f172a; font-size: 14px; outline: none; box-sizing: border-box;
}
.upp-q::placeholder { color: #64748b; }
.upp-q:focus { border-color: #37a9fb !important; box-shadow: 0 0 0 3px rgba(55, 169, 251, .14); }
.upp-lista { list-style: none; margin: 0; padding: 4px; overflow-y: auto; overscroll-behavior: contain; flex: 1; min-height: 0; outline: none; }
.upp-op {
  display: flex; align-items: center; gap: 10px; margin: 0; padding: 7px 8px; border-radius: 9px;
  cursor: pointer; list-style: none; position: relative;
}
/* Resaltado (ratón o flechas): fondo de marca y borde izquierdo, bien visible */
.upp-op.is-act { background: #e0efff; box-shadow: inset 3px 0 0 #0072cb; }
.upp-op.is-act .upp-n { color: #0059a4; }
.upp-op--sep { margin-bottom: 5px; }
.upp-op--sep::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -3px; height: 1px; background: #f1f5f9; }
.upp-t { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.upp-n { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #0f172a; }
.upp-s { font-size: 12px; color: #64748b; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upp-check { width: 16px; height: 16px; flex-shrink: 0; color: #0072cb; visibility: hidden; }
.upp-op.is-sel .upp-check { visibility: visible; }
.upp-op.is-sel .upp-n { font-weight: 700; }
.upp-nada { padding: 14px 10px; color: #64748b; font-size: 13px; list-style: none; text-align: center; }
.upp-velo { display: none; }

html.dark .upp { background: #1e2533; color: #c4cbd6; border-color: #2c3340; box-shadow: 0 18px 48px -12px rgba(15, 23, 42, .6); }
html.dark .upp-q { background: #131925 !important; border-color: #2c3340 !important; color: #c4cbd6; }
html.dark .upp-q::placeholder { color: #8590a1; }
html.dark .upp-n { color: #c4cbd6; }
html.dark .upp-s, html.dark .upp-nada { color: #b2bac8; }
html.dark .upp-op.is-act { background: #1c2941; box-shadow: inset 3px 0 0 #37a9fb; }
html.dark .upp-op.is-act .upp-n { color: #7cc5fd; }
html.dark .upp-check { color: #7cc5fd; }
html.dark .upp-op--sep::after { background: #2c3340; }

/* Móvil: hoja inferior a todo el ancho */
.upp--hoja {
  left: 0 !important; right: 0; bottom: 0; top: auto !important; width: auto !important; max-height: 72vh;
  border-radius: 18px 18px 0 0; border-bottom: 0; transform: translateY(24px);
  padding-bottom: env(safe-area-inset-bottom);
}
.upp--hoja .upp-op { padding: 10px; min-height: 48px; }
.upp-cab { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 4px 16px; font-weight: 700; }
.upp-x { width: 40px; height: 40px; border: 0; background: transparent; color: #64748b; font-size: 24px; border-radius: 10px; cursor: pointer; }
.upp-x:hover { background: #f1f5f9; }
html.dark .upp-x { color: #b2bac8; }
html.dark .upp-x:hover { background: #131925; }
.upp-velo.on { display: block; position: fixed; inset: 0; z-index: 10059; background: rgba(15, 23, 42, .62); }
@media (prefers-reduced-motion: reduce) { .upp { transition: none; } }

/* Foto de perfil en «Mi cuenta»: los botones se ocultan con [hidden] (Tailwind
   «inline-flex» lo pisaría) */
#foto-perfil [hidden] { display: none !important; }
