/* =====================================================================
   Topbar: avatar/profilo, busta messaggi, segnalazione bug
   ===================================================================== */
.bms-topbar__item { position: relative; display: flex; align-items: center; }

.bms-iconbtn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.3rem;
  height: 2.3rem;
  border-radius: 0.6rem;
  border: 1px solid var(--bms-topbar-border);
  background: transparent;
  color: var(--bms-topbar-text);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.1s ease, background-color 0.1s ease, color 0.1s ease, transform 0.05s ease;
}
.bms-iconbtn:active { transform: scale(0.97); }
.bms-iconbtn svg { width: 1.15rem; height: 1.15rem; }
.bms-iconbtn:hover { border-color: var(--bms-accent-strong); background-color: var(--bms-topbar-active); }
.bms-iconbtn__badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 1.05rem;
  height: 1.05rem;
  padding: 0 0.28rem;
  border-radius: 999px;
  background: var(--bms-cta-from, #fb355e);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  line-height: 1.05rem;
  text-align: center;
  box-shadow: 0 0 0 2px var(--bms-chrome, #131a33);
}

/* Avatar */
.bms-avatar {
  --av-size: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--av-size);
  height: var(--av-size);
  border-radius: 50%;
  background: var(--av-bg, #3b82f6);
  color: var(--av-fg, #fff);
  font-weight: 800;
  font-size: calc(var(--av-size) * 0.4);
  overflow: hidden;
  flex-shrink: 0;
  user-select: none;
  border: 2px solid rgba(255, 255, 255, 0.28);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.bms-avatar__initials {
  color: var(--av-fg, #fff);
  font-weight: 800;
  font-size: inherit;
  line-height: 1;
  letter-spacing: 0.03em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}
.bms-avatar[data-av-light="1"] .bms-avatar__initials {
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.55);
}
.bms-avatar--lg { --av-size: 2.8rem; }
.bms-avatar--xl { --av-size: 4.2rem; }
.bms-avatar__img { width: 100%; height: 100%; object-fit: cover; }

.bms-profile-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.28rem 0.5rem 0.28rem 0.3rem;
  border-radius: 999px;
  border: 1px solid var(--bms-topbar-border);
  background: transparent;
  color: var(--bms-topbar-text);
  cursor: pointer;
  max-width: 13rem;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.1s ease, background-color 0.1s ease, transform 0.05s ease;
}
.bms-profile-btn:hover { border-color: var(--bms-accent-strong); background-color: var(--bms-topbar-active); }
.bms-profile-btn:active { transform: scale(0.98); }
.bms-profile-btn__name {
  font-size: 0.85rem;
  font-weight: 600;
  max-width: 8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bms-profile-btn__caret { width: 0.9rem; height: 0.9rem; opacity: 0.7; }
@media (max-width: 640px) {
  .bms-profile-btn__name, .bms-profile-btn__caret { display: none; }
  .bms-profile-btn { padding: 0.2rem; border-radius: 50%; }
}

/* Dropdown generico */
.bms-dropdown {
  position: absolute;
  top: calc(100% + 0.55rem);
  right: 0;
  width: 17rem;
  background: var(--bms-card);
  border: 1px solid var(--bms-border);
  border-radius: 0.8rem;
  box-shadow: 0 24px 60px -18px rgba(0, 0, 0, 0.6);
  z-index: 80;
  overflow: hidden;
  animation: bms-rise 0.08s ease both;
}
.bms-dropdown--wide { width: 22rem; }
.bms-dropdown__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--bms-border-soft);
  font-weight: 700;
  font-size: 0.9rem;
}
.bms-dropdown__action {
  background: none;
  border: none;
  color: var(--bms-accent-strong);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}
.bms-dropdown__action:hover { text-decoration: underline; }
.bms-dropdown__empty { padding: 1.4rem 0.9rem; text-align: center; color: var(--bms-text-muted); font-size: 0.85rem; margin: 0; }
.bms-dropdown__foot { padding: 0.7rem 0.9rem; border-top: 1px solid var(--bms-border-soft); }

.bms-dropdown__profile {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.9rem;
  border-bottom: 1px solid var(--bms-border-soft);
}
.bms-dropdown__profile-meta { display: flex; flex-direction: column; min-width: 0; }
.bms-dropdown__profile-meta strong { font-size: 0.92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bms-dropdown__profile-meta .topbar-email { display: block; margin: 0; font-size: 0.75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bms-dropdown__menu { padding: 0.4rem; display: flex; flex-direction: column; }
.bms-dropdown__link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.6rem;
  border-radius: 0.5rem;
  background: none;
  border: none;
  color: var(--bms-text);
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  text-align: left;
  width: 100%;
}
.bms-dropdown__link svg { width: 1.05rem; height: 1.05rem; opacity: 0.85; }
.bms-dropdown__link:hover { background: var(--bms-surface); }
.bms-dropdown__link--danger { color: var(--bms-negative); }
.bms-dropdown__link--danger:hover { background: rgba(239, 68, 68, 0.12); }

.bms-dropdown__section {
  margin-top: 0.35rem;
  padding-top: 0.45rem;
  border-top: 1px solid var(--bms-border-soft);
}
.bms-dropdown__section--admin { padding-bottom: 0.15rem; }
.bms-dropdown__heading {
  margin: 0 0 0.25rem;
  padding: 0 0.6rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--bms-text-muted);
}
.bms-dropdown__icon-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 0.45rem;
  flex-shrink: 0;
  color: var(--ic, var(--bms-text-muted));
  background: color-mix(in srgb, var(--ic, #8893b5) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--ic, #8893b5) 32%, transparent);
}
.bms-dropdown__icon-box .bms-nav-icon { width: 0.95rem; height: 0.95rem; }
.bms-dropdown__link--admin.is-active {
  background: rgba(98, 181, 105, 0.12);
  color: var(--bms-text);
}

/* Lista messaggi */
.bms-msg-list { max-height: 60vh; overflow-y: auto; }
.bms-msg {
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--bms-border-soft);
  cursor: default;
}
.bms-msg:last-child { border-bottom: none; }
.bms-msg.is-unread { background: rgba(98, 181, 105, 0.07); cursor: pointer; }
.bms-msg.is-unread .bms-msg__subject::before {
  content: "";
  display: inline-block;
  width: 7px; height: 7px;
  margin-right: 0.4rem;
  border-radius: 50%;
  background: var(--bms-accent-strong);
  vertical-align: middle;
}
.bms-msg__head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.bms-msg__subject { font-weight: 700; font-size: 0.86rem; }
.bms-msg__body { font-size: 0.82rem; color: var(--bms-text-muted); margin-top: 0.2rem; white-space: pre-wrap; word-break: break-word; }
.bms-msg__meta { font-size: 0.72rem; color: var(--bms-text-muted); margin-top: 0.35rem; opacity: 0.8; }

/* Editor profilo */
.bms-modal__panel--profile {
  width: min(92vw, 26rem);
  max-height: min(92vh, 36rem);
}
.bms-modal__head-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}
.bms-modal__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--bms-text);
  line-height: 1.25;
}
.bms-modal__sub {
  margin: 0;
  font-size: 0.78rem;
  color: var(--bms-text-muted);
  line-height: 1.35;
}
.bms-profile-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding-top: 1rem;
  padding-bottom: 1rem;
}
.bms-profile-form__label {
  display: block;
  margin: 0 0 0.4rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--bms-text-muted);
}
.bms-profile-form__field .form-input {
  width: 100%;
}
.bms-profile-form__avatar-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  padding: 1rem 0.85rem;
  border-radius: 0.75rem;
  border: 1px solid var(--bms-border-soft);
  background: var(--bms-surface);
}
.bms-profile-form__avatar-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
}
.bms-profile-form__upload {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  cursor: pointer;
  margin: 0;
  font-size: 0.82rem;
  padding: 0.45rem 0.85rem;
}
.bms-profile-form__upload svg {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}
.bms-profile-form__remove {
  background: none;
  border: none;
  padding: 0.25rem 0.5rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--bms-text-muted);
  cursor: pointer;
  border-radius: 0.35rem;
  transition: color 0.15s ease, background 0.15s ease;
}
.bms-profile-form__remove:hover {
  color: var(--bms-negative);
  background: rgba(239, 68, 68, 0.08);
}
.bms-profile-form__hint {
  margin: 0.15rem 0 0;
  font-size: 0.68rem;
  color: var(--bms-text-muted);
  text-align: center;
  line-height: 1.35;
}
.bms-modal__panel--profile .bms-color-row {
  margin-top: 0;
  padding: 0.55rem 0.65rem;
  border-radius: 0.65rem;
  border: 1px solid var(--bms-border-soft);
  background: var(--bms-surface);
  justify-content: flex-start;
}
.bms-modal__panel--profile .bms-modal__actions {
  margin-top: 0;
}
@media (min-width: 480px) {
  .bms-profile-form__avatar-card {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    text-align: left;
  }
  .bms-profile-form__avatar-actions {
    align-items: flex-start;
    flex: 1 1 auto;
    min-width: 0;
  }
  .bms-profile-form__hint {
    text-align: left;
  }
}
.bms-avatar-edit { display: flex; align-items: center; gap: 1rem; margin-bottom: 0.5rem; }
.bms-color-row { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.4rem; }
.bms-swatch {
  width: 1.7rem; height: 1.7rem;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.12s ease;
}
.bms-swatch:hover { transform: scale(1.12); }
.bms-swatch.is-active { border-color: var(--bms-text); box-shadow: 0 0 0 2px var(--bms-card), 0 0 0 4px var(--bms-accent-strong); }

/* select riusa form-input */
select.form-input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2397a0c2' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.8rem center; padding-right: 2.2rem; }

