/* Compass & Dove 508 Social - Admin View-As Searchable Switcher + Clean Account Switch */
:root {
  --m508-va-bar-h: 0px;
}

/* Offset fixed smart-nav & body cleanly when impersonation bar is active */
html.m508-va-impersonating .smart-nav {
  top: var(--m508-va-bar-h, 46px) !important;
}
html.m508-va-impersonating body {
  padding-top: calc(var(--nav-h, 64px) + var(--m508-va-bar-h, 46px)) !important;
}
html.m508-va-impersonating .hamburger-menu {
  max-height: calc(100vh - 90px - var(--m508-va-bar-h, 46px));
}

/* Persistent Unmistakable Top Impersonation Banner */
#m508ViewAsBanner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  max-width: 100vw;
  box-sizing: border-box;
  z-index: 1150;
  background: linear-gradient(95deg, #0E152E 0%, #1B2952 52%, #111A36 100%);
  border-bottom: 2px solid #E0B85A;
  box-shadow: 0 6px 20px rgba(8, 12, 28, 0.42);
  color: #FAF6EC;
  font-family: 'Figtree', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  overflow: hidden;
}
#m508ViewAsBanner[hidden] {
  display: none !important;
}
.m508-va-bar-inner {
  max-width: 1380px;
  margin: 0 auto;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px 14px;
  flex-wrap: wrap;
  box-sizing: border-box;
}
.m508-va-bar-status {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 220px;
  font-size: 13px;
  line-height: 1.3;
  color: #F7F1E1;
}
.m508-va-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #F4C963;
  box-shadow: 0 0 0 3px rgba(244, 201, 99, 0.24);
  flex: 0 0 auto;
}
.m508-va-bar-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.m508-va-bar-text strong {
  color: #FFE08E;
  font-weight: 800;
}
.m508-va-bar-email {
  color: rgba(250, 246, 236, 0.78);
  font-size: 12px;
  margin-left: 4px;
}
.m508-va-bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  flex-wrap: wrap;
}
.m508-va-btn {
  appearance: none;
  border-radius: 999px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  padding: 8px 13px;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform 0.14s ease, filter 0.14s ease, background-color 0.14s ease;
  box-sizing: border-box;
}
.m508-va-btn:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-1px);
}
.m508-va-btn:disabled {
  opacity: 0.6;
  cursor: default;
}
.m508-va-btn-ghost {
  background: rgba(255, 255, 255, 0.08);
  color: #F7E8C2;
  border: 1.5px solid rgba(224, 184, 90, 0.72);
}
.m508-va-btn-gold {
  background: linear-gradient(135deg, #F0CA6C 0%, #CFA243 100%);
  color: #131B36;
  border: 1.5px solid #F7DA8C;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.28);
}

/* Top Nav Quick Button (Admin-Only) */
.btn-admin-viewas-nav {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 36px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1.5px solid #D9B052;
  background: linear-gradient(135deg, #1E2D5E, #121A36);
  color: #F8DE94;
  font-family: 'Figtree', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.24);
  transition: filter 0.14s ease, transform 0.14s ease;
  flex: 0 0 auto;
}
.btn-admin-viewas-nav:hover {
  filter: brightness(1.12);
  transform: translateY(-1px);
}
.btn-admin-viewas-nav.is-active {
  background: linear-gradient(135deg, #E8BE5E, #C99A3B);
  color: #131B36;
  border-color: #FFF0BE;
}
.btn-admin-viewas-nav svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}
.btn-admin-viewas-nav[hidden] {
  display: none !important;
}

/* Hamburger Menu - Admin View-As Card */
.m508-va-card {
  background: linear-gradient(180deg, #FDFBF5 0%, #F7F1E2 100%);
  border: 1.5px solid #D4AC50;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(19, 27, 54, 0.1);
}
.m508-va-card[hidden] {
  display: none !important;
}
.m508-va-card-head {
  background: linear-gradient(95deg, #131B36 0%, #223266 100%);
  color: #FAF6EC;
  padding: 9px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.m508-va-card-title {
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #F4CE74;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.m508-va-card-pill {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(244, 206, 116, 0.18);
  color: #FFE49E;
  border: 1px solid rgba(244, 206, 116, 0.45);
  white-space: nowrap;
}
.m508-va-card-body {
  padding: 10px 11px 11px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.m508-va-revert-btn {
  width: 100%;
  appearance: none;
  border: 1.5px solid #C89B3C;
  border-radius: 10px;
  background: linear-gradient(135deg, #F2CD70 0%, #D4A645 100%);
  color: #131B36;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 800;
  padding: 9px 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  box-shadow: 0 3px 10px rgba(200, 155, 60, 0.25);
  transition: filter 0.14s ease, transform 0.14s ease;
}
.m508-va-revert-btn:hover:not(:disabled) {
  filter: brightness(1.06);
  transform: translateY(-1px);
}
.m508-va-revert-btn[hidden] {
  display: none !important;
}
.m508-va-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.m508-va-search-ico {
  position: absolute;
  left: 10px;
  width: 15px;
  height: 15px;
  color: #6B7794;
  pointer-events: none;
}
.m508-va-search-input {
  width: 100%;
  box-sizing: border-box;
  height: 36px;
  padding: 0 30px 0 32px;
  border-radius: 10px;
  border: 1.5px solid #D8CCA9;
  background: #FFFFFF;
  color: #131B36;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  outline: none;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}
.m508-va-search-input::-webkit-search-cancel-button,
.m508-va-search-input::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
}
.m508-va-search-input:focus {
  border-color: #C9A24B;
  box-shadow: 0 0 0 3px rgba(201, 162, 75, 0.18);
}
.m508-va-search-clear {
  position: absolute;
  right: 6px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: #ECE6D6;
  color: #25345C;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.m508-va-search-clear[hidden] {
  display: none !important;
}
.m508-va-results {
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 2px;
}
.m508-va-empty {
  font-size: 12px;
  color: #5C6784;
  text-align: center;
  padding: 12px 6px;
}
.m508-va-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 8px;
  border-radius: 10px;
  background: #FFFFFF;
  border: 1px solid #E7DEC6;
  transition: border-color 0.14s ease, background-color 0.14s ease;
}
.m508-va-row:hover {
  border-color: #D4AC50;
  background: #FFFDF7;
}
.m508-va-row.is-current {
  border-color: #C9A24B;
  background: #FBF4E1;
}
.m508-va-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid #D9B768;
  background: #1B274C;
  flex: 0 0 34px;
}
.m508-va-meta {
  min-width: 0;
  flex: 1 1 auto;
}
.m508-va-name {
  font-size: 12.8px;
  font-weight: 700;
  color: #131B36;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 5px;
}
.m508-va-role-tag {
  font-size: 9.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 1px 5px;
  border-radius: 4px;
  background: #1B2952;
  color: #F4CE74;
  flex: 0 0 auto;
}
.m508-va-email {
  font-size: 11px;
  color: #5D6A87;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.m508-va-act {
  appearance: none;
  flex: 0 0 auto;
  border-radius: 8px;
  border: 1.5px solid #1C2B57;
  background: #1C2B57;
  color: #FAF6EC;
  font-family: inherit;
  font-size: 11px;
  font-weight: 800;
  padding: 6px 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: filter 0.14s ease, transform 0.14s ease;
}
.m508-va-act:hover:not(:disabled) {
  filter: brightness(1.16);
  transform: translateY(-1px);
}
.m508-va-act.is-self {
  background: linear-gradient(135deg, #F0CA6C, #D1A23F);
  color: #131B36;
  border-color: #C69635;
}
.m508-va-act.is-active {
  background: #E8F3EC;
  color: #1B6A3A;
  border-color: #A4D4B6;
  cursor: default;
}

/* Signed-In Account Switch / Sign Out Section (All Signed-In Users) */
.m508-acct-box {
  border-top: 1px solid #EAE2CE;
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.m508-acct-box[hidden] {
  display: none !important;
}
.m508-acct-who {
  font-size: 11.5px;
  color: #55617F;
  line-height: 1.35;
  padding: 0 2px;
  word-break: break-word;
}
.m508-acct-who strong {
  color: #131B36;
}
.m508-signout-btn {
  width: 100%;
  appearance: none;
  border: 1.5px solid #D6C9A6;
  border-radius: 11px;
  background: #FFFDF8;
  color: #1A274D;
  font-family: inherit;
  font-size: 13px;
  font-weight: 800;
  padding: 10px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transition: border-color 0.14s ease, background-color 0.14s ease;
}
.m508-signout-btn:hover:not(:disabled) {
  border-color: #C9A24B;
  background: #FBF4E1;
}
.m508-signout-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* Mobile Responsive Refinements (390px zero horizontal overflow) */
@media (max-width: 640px) {
  .m508-va-bar-inner {
    padding: 7px 10px;
    gap: 6px;
  }
  .m508-va-bar-status {
    flex: 1 1 100%;
    font-size: 12px;
  }
  .m508-va-bar-text {
    white-space: normal;
    word-break: break-word;
  }
  .m508-va-bar-email {
    display: inline-block;
    font-size: 11px;
    margin-left: 2px;
  }
  .m508-va-bar-actions {
    width: 100%;
    display: flex;
    gap: 6px;
  }
  .m508-va-bar-actions .m508-va-btn {
    flex: 1 1 auto;
    padding: 7px 9px;
    font-size: 11.5px;
    min-width: 0;
  }
  .btn-admin-viewas-nav {
    display: none !important;
  }
}
