/* MoneyBuddy Money Snapshot + header action polish */
#mb-header-inner > div:last-child {
  gap: 8px !important;
}

.mb-header-action {
  height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(24,60,53,.10);
  background: rgba(255,255,255,.92);
  color: #183c35;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 13px;
  flex: 0 0 auto;
  font: 700 12px/1 Inter, Arial, sans-serif;
  letter-spacing: -.01em;
  box-shadow: 0 6px 18px -16px rgba(24,60,53,.35);
  transition: transform .16s ease, background .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.mb-header-action:hover {
  transform: translateY(-1px);
  background: #f7f8f4;
  border-color: rgba(24,60,53,.18);
  box-shadow: 0 10px 22px -17px rgba(24,60,53,.40);
}
.mb-header-action:focus-visible {
  outline: 3px solid rgba(201,162,74,.26);
  outline-offset: 2px;
}
.mb-header-action .material-symbols-outlined { font-size: 18px; color: #376757; }
#moneyBuddySnapshotButton {
  background: linear-gradient(135deg,#183c35,#24564b);
  color:#fff;
  border-color:rgba(24,60,53,.2);
}
#moneyBuddySnapshotButton .material-symbols-outlined { color:#efd58d; }
#moneyBuddySnapshotButton:hover { background:linear-gradient(135deg,#15362f,#214f45); }

/* Existing Buddy display becomes a clear header action rather than a passive chip. */
#headerBuddyDisplay {
  height: 40px !important;
  padding: 0 12px 0 7px !important;
  background: #f4f7f3 !important;
  border: 1px solid rgba(24,60,53,.10) !important;
  box-shadow: 0 6px 18px -16px rgba(24,60,53,.34) !important;
}
#headerBuddyDisplay::after {
  content: "Change Buddy";
  font: 700 12px/1 Inter, Arial, sans-serif;
  color:#183c35;
  white-space:nowrap;
}
#headerBuddyDisplay > div:last-child { display:none !important; }
#headerBuddyDisplay > div:first-child { width:28px !important; height:28px !important; }

/* Make authenticated state unmistakable. */
#headerUserAvatarBtn {
  width: auto !important;
  min-width: 112px !important;
  height: 42px !important;
  padding: 0 10px 0 6px !important;
  border-radius: 999px !important;
  gap: 7px !important;
  background: #edf6f2 !important;
  border: 1px solid rgba(24,60,53,.13) !important;
  color:#183c35 !important;
  justify-content:flex-start !important;
  box-shadow: 0 6px 18px -16px rgba(24,60,53,.34) !important;
}
#headerUserAvatarBtn .mb-account-avatar {
  width:30px;
  height:30px;
  border-radius:999px;
  display:grid;
  place-items:center;
  flex:0 0 auto;
  background:#183c35;
  color:#fff;
  font:800 12px/1 Inter,Arial,sans-serif;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18);
}
#headerUserAvatarBtn .mb-account-copy {
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  gap:1px;
  white-space:nowrap;
}
#headerUserAvatarBtn .mb-account-copy strong { font:800 11px/1.05 Inter,Arial,sans-serif; }
#headerUserAvatarBtn .mb-account-copy small { font:600 9px/1.05 Inter,Arial,sans-serif; color:#688078; }
#headerUserAvatarBtn .mb-account-chevron { font-size:16px; color:#6f827c; }
#userAccountPopover { top: 50px !important; }

/* Remove duplicate Change Buddy / Seasonal Style choices from More after they move to the header. */
#moneyBuddyMoreMenu button[data-action="buddy"],
#moneyBuddyMoreMenu button[data-action="style"] { display:none !important; }

/* Snapshot creation state */
#moneyBuddySnapshotButton.is-working { opacity:.76; cursor:wait; transform:none !important; }
#moneyBuddySnapshotButton.is-working .material-symbols-outlined { animation:mbSnapshotSpin .9s linear infinite; }
@keyframes mbSnapshotSpin { to { transform:rotate(360deg); } }

@media (max-width: 1180px) {
  .mb-header-action { width:40px; padding:0; }
  .mb-header-action .mb-header-action-label { display:none; }
  #headerBuddyDisplay { width:40px !important; padding:0 !important; justify-content:center !important; }
  #headerBuddyDisplay::after { display:none; }
  #headerBuddyDisplay > div:first-child { width:30px !important; height:30px !important; }
  #headerUserAvatarBtn { min-width:42px !important; width:42px !important; padding:0 5px !important; justify-content:center !important; }
  #headerUserAvatarBtn .mb-account-copy,
  #headerUserAvatarBtn .mb-account-chevron { display:none; }
}

@media (max-width: 767px) {
  #mb-header-inner > div:last-child { gap:5px !important; }
  #headerBuddyDisplay { display:inline-flex !important; width:34px !important; height:34px !important; }
  #headerBuddyDisplay > div:first-child { width:27px !important; height:27px !important; }
  .mb-header-action { width:34px; height:34px; }
  .mb-header-action .material-symbols-outlined { font-size:17px; }
  #headerUserAvatarBtn { display:flex !important; width:34px !important; min-width:34px !important; height:34px !important; padding:0 3px !important; }
  #headerUserAvatarBtn .mb-account-avatar { width:27px; height:27px; font-size:10px; }
  #moneyBuddyXFollow { display:none !important; }
  #headerSignInBtn { width:34px !important; height:34px !important; }
  .moneybuddy-brand-title { max-width:118px !important; }
}

@media (max-width: 430px) {
  .moneybuddy-brand-title { max-width:92px !important; font-size:13px !important; }
  #mb-header-inner a > div:first-child { width:34px !important; height:34px !important; }
  #mb-header-inner > div:last-child { gap:4px !important; }
  #headerBuddyDisplay,
  .mb-header-action,
  #headerUserAvatarBtn,
  #headerSignInBtn { width:32px !important; min-width:32px !important; height:32px !important; }
  #headerBuddyDisplay > div:first-child,
  #headerUserAvatarBtn .mb-account-avatar { width:25px !important; height:25px !important; }
}


/* Header ordering + dropdown anchor repair */
#moneyBuddyMoreButton {
  order: 999 !important;
  position: relative;
  z-index: 10012;
}
#moneyBuddyMoreMenu {
  right: 0 !important;
  left: auto !important;
  top: calc(100% + 10px) !important;
  transform: none !important;
  transform-origin: top right;
}
@media (min-width: 768px) {
  #moneyBuddyMoreButton { display: inline-flex !important; }
}
